From: Jiri Olsa <olsajiri@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>, Hao Luo <haoluo@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
bpf@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-perf-users@vger.kernel.org, Martin KaFai Lau <kafai@fb.com>,
Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@chromium.org>,
Stanislav Fomichev <sdf@google.com>,
Daniel Borkmann <daniel@iogearbox.net>
Subject: Re: [PATCH RFC 4/5] selftests/bpf: Add file_build_id test
Date: Thu, 9 Feb 2023 15:04:45 +0100 [thread overview]
Message-ID: <Y+T9fYbGcDDb2RFt@krava> (raw)
In-Reply-To: <CAEf4BzZ6BVeLV5mG=nB88Ni_8WSYTG0xhFgn-OEM2s6dc14yVA@mail.gmail.com>
On Wed, Feb 08, 2023 at 03:58:06PM -0800, Andrii Nakryiko wrote:
SNIP
> > +
> > + /* parent, update child's pid and kick it */
> > + skel->bss->pid = child_pid;
> > +
> > + err = file_build_id__attach(skel);
> > + if (!ASSERT_OK(err, "file_build_id__attach"))
> > + goto out;
> > +
> > + err = write(go[1], &c, 1);
> > + if (!ASSERT_EQ(err, 1, "child_write_pipe"))
> > + goto out;
> > +
> > + /* wait for child to exit */
> > + waitpid(child_pid, &child_status, 0);
> > + if (!ASSERT_EQ(WEXITSTATUS(child_status), 0, "child_exit_value"))
> > + goto out;
> > +
> > + if (!ASSERT_OK(read_buildid("/bin/bash", &bid), "read_buildid"))
>
> can we use urandom_read for build_id ? And it would also be nice to
> check that build id fetching works for liburandom_read.so as well.
ok, will be better together with the shared library
SNIP
> > diff --git a/tools/testing/selftests/bpf/trace_helpers.c b/tools/testing/selftests/bpf/trace_helpers.c
> > index 09a16a77bae4..f5557890e383 100644
> > --- a/tools/testing/selftests/bpf/trace_helpers.c
> > +++ b/tools/testing/selftests/bpf/trace_helpers.c
> > @@ -9,6 +9,7 @@
> > #include <poll.h>
> > #include <unistd.h>
> > #include <linux/perf_event.h>
> > +#include <linux/limits.h>
> > #include <sys/mman.h>
> > #include "trace_helpers.h"
> >
> > @@ -230,3 +231,37 @@ ssize_t get_rel_offset(uintptr_t addr)
> > fclose(f);
> > return -EINVAL;
> > }
> > +
> > +int read_buildid(const char *path, char **build_id)
> > +{
> > + char tmp[] = "/tmp/dataXXXXXX";
> > + char buf[PATH_MAX + 200];
> > + int err, fd;
> > + FILE *f;
> > +
> > + fd = mkstemp(tmp);
> > + if (fd == -1)
> > + return -1;
> > + close(fd);
> > +
> > + snprintf(buf, sizeof(buf),
> > + "readelf -n %s 2>/dev/null | grep 'Build ID' | awk '{print $3}' > %s",
> > + path, tmp);
> > +
>
> shelling out to readelf for this is unfortunate... maybe let's write a
> libelf-based helper to fetch build ID from .note section?
right, I was thinking of that, shouldn't be that hard
and will speed things up
thanks,
jirka
next prev parent reply other threads:[~2023-02-09 14:04 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-01 13:57 [RFC 0/5] mm/bpf/perf: Store build id in file object Jiri Olsa
2023-02-01 13:57 ` [PATCH RFC 1/5] mm: " Jiri Olsa
2023-02-08 23:52 ` Andrii Nakryiko
2023-02-09 14:04 ` Jiri Olsa
2023-02-01 13:57 ` [PATCH RFC 2/5] bpf: Use file object build id in stackmap Jiri Olsa
2023-02-09 7:23 ` Hao Luo
2023-02-09 13:19 ` Jiri Olsa
2023-02-01 13:57 ` [PATCH RFC 3/5] perf: Use file object build id in perf_event_mmap_event Jiri Olsa
2023-02-01 13:57 ` [PATCH RFC 4/5] selftests/bpf: Add file_build_id test Jiri Olsa
2023-02-08 23:58 ` Andrii Nakryiko
2023-02-09 14:04 ` Jiri Olsa [this message]
2023-02-01 13:57 ` [PATCH RFC 5/5] selftests/bpf: Add iter_task_vma_buildid test Jiri Olsa
2023-02-09 0:01 ` Andrii Nakryiko
2023-02-09 14:04 ` Jiri Olsa
2023-02-09 17:16 ` Andrii Nakryiko
2023-02-02 11:15 ` [RFC 0/5] mm/bpf/perf: Store build id in file object Alexei Starovoitov
2023-02-02 14:47 ` Jiri Olsa
2023-02-03 10:03 ` Peter Zijlstra
2023-02-02 15:10 ` Matthew Wilcox
2023-02-02 15:33 ` Jiri Olsa
2023-02-09 7:12 ` Hao Luo
2023-02-09 14:18 ` Jiri Olsa
2023-02-09 19:38 ` Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y+T9fYbGcDDb2RFt@krava \
--to=olsajiri@gmail.com \
--cc=acme@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=sdf@google.com \
--cc=songliubraving@fb.com \
--cc=viro@zeniv.linux.org.uk \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).