[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <478a8e03-dea3-ebca-8376-6b7e3b616b5e@iogearbox.net>
Date: Thu, 16 Mar 2023 20:59:21 +0100
From: Daniel Borkmann <daniel@...earbox.net>
To: Jiri Olsa <jolsa@...nel.org>, Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii@...nel.org>,
Hao Luo <haoluo@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Matthew Wilcox <willy@...radead.org>
Cc: bpf@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-perf-users@...r.kernel.org, Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Stanislav Fomichev <sdf@...gle.com>,
Namhyung Kim <namhyung@...il.com>,
Dave Chinner <david@...morbit.com>
Subject: Re: [PATCHv3 bpf-next 9/9] selftests/bpf: Add file_build_id test
On 3/16/23 6:01 PM, Jiri Olsa wrote:
> The test attaches bpf program to sched_process_exec tracepoint
> and gets build of executed file from bprm->file object.
>
> We use urandom_read as the test program and in addition we also
> attach uprobe to liburandom_read.so:urandlib_read_without_sema
> and retrieve and check build id of that shared library.
>
> Also executing the no_build_id binary to verify the bpf program
> gets the error properly.
>
> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
[...]
> diff --git a/tools/testing/selftests/bpf/progs/file_build_id.c b/tools/testing/selftests/bpf/progs/file_build_id.c
> new file mode 100644
> index 000000000000..6dc10c8e17ac
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/file_build_id.c
> @@ -0,0 +1,70 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include "vmlinux.h"
> +#include "err.h"
> +#include <bpf/bpf_helpers.h>
> +#include <bpf/bpf_tracing.h>
> +#include <linux/string.h>
> +
> +char _license[] SEC("license") = "GPL";
> +
> +int pid;
> +
> +u32 build_id_bin_size;
> +u32 build_id_lib_size;
> +
> +char build_id_bin[BUILD_ID_SIZE_MAX];
> +char build_id_lib[BUILD_ID_SIZE_MAX];
> +
> +long build_id_bin_err;
> +long build_id_lib_err;
> +
> +static int store_build_id(struct file *file, char *build_id, u32 *sz, long *err)
> +{
> + struct build_id *bid;
> +
> + bid = file->f_build_id;
> + if (IS_ERR_OR_NULL(bid)) {
I think you might need to enable this also in the CI config:
[...]
CLNG-BPF [test_maps] btf_dump_test_case_multidim.bpf.o
CLNG-BPF [test_maps] ima.bpf.o
CLNG-BPF [test_maps] bpf_cubic.bpf.o
progs/bpf_iter_task_vma_buildid.c:46:27: error: no member named 'f_build_id' in 'struct file'
if (IS_ERR_OR_NULL(file->f_build_id)) {
~~~~ ^
progs/bpf_iter_task_vma_buildid.c:51:37: error: no member named 'f_build_id' in 'struct file'
__builtin_memcpy(&build_id, file->f_build_id, sizeof(*file->f_build_id));
~~~~ ^
progs/bpf_iter_task_vma_buildid.c:51:63: error: no member named 'f_build_id' in 'struct file'
__builtin_memcpy(&build_id, file->f_build_id, sizeof(*file->f_build_id));
~~~~ ^
3 errors generated.
make: *** [Makefile:578: /tmp/work/bpf/bpf/tools/testing/selftests/bpf/bpf_iter_task_vma_buildid.bpf.o] Error 1
make: *** Waiting for unfinished jobs....
make: Leaving directory '/tmp/work/bpf/bpf/tools/testing/selftests/bpf'
Error: Process completed with exit code 2.
Thanks,
Daniel
Powered by blists - more mailing lists