linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Andrii Nakryiko <andrii@kernel.org>
Cc: bpf@vger.kernel.org, linux-mm@kvack.org,
	akpm@linux-foundation.org,  adobriyan@gmail.com,
	shakeel.butt@linux.dev, hannes@cmpxchg.org,  ak@linux.intel.com,
	osandov@osandov.com
Subject: Re: [PATCH bpf-next 10/10] selftests/bpf: add build ID tests
Date: Wed, 10 Jul 2024 10:55:52 -0700	[thread overview]
Message-ID: <CAEf4BzY8KfjR==9Yfcgij18Px6ggxqySqyYis6cv8GZY4PVxbw@mail.gmail.com> (raw)
In-Reply-To: <20240709204245.3847811-11-andrii@kernel.org>

On Tue, Jul 9, 2024 at 1:43 PM Andrii Nakryiko <andrii@kernel.org> wrote:
>
> Add a new set of tests validating behavior of capturing stack traces
> with build ID. We extend uprobe_multi target binary with ability to
> trigger uprobe (so that we can capture stack traces from it), but also
> we allow to force build ID data to be either resident or non-resident in
> memory. That way we can validate that in non-sleepable context we won't
> get build ID (as expected), but with sleepable uprobes we will get that
> build ID regardless of it being physically present in memory.
>
> Also, we add a small add-on linker script which reorders
> .note.gnu.build-id section and puts it after (big) .text section,
> putting build ID data outside of the very first page of ELF file. This
> will test all the relaxations we did in build ID parsing logic in kernel
> thanks to freader abstraction.
>
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
> ---
>  tools/testing/selftests/bpf/Makefile          |   5 +-
>  .../selftests/bpf/prog_tests/build_id.c       | 118 ++++++++++++++++++
>  .../selftests/bpf/progs/test_build_id.c       |  31 +++++
>  tools/testing/selftests/bpf/uprobe_multi.c    |  34 +++++
>  tools/testing/selftests/bpf/uprobe_multi.ld   |  11 ++
>  5 files changed, 197 insertions(+), 2 deletions(-)
>  create mode 100644 tools/testing/selftests/bpf/prog_tests/build_id.c
>  create mode 100644 tools/testing/selftests/bpf/progs/test_build_id.c
>  create mode 100644 tools/testing/selftests/bpf/uprobe_multi.ld
>

FYI for anyone that decided to not look at this patch set because BPF
CI build is failing. It's due to outdated libc headers that don't have
MADV_POPULATE_READ constant. I've fixed it up with the usual
#ifndef+#define+#endif block in selftests.

I'm not going to send another revision just to fix this up, I will
wait for feedback. Thanks!

> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index e0b3887b3d2d..45f67e822f49 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -762,9 +762,10 @@ $(OUTPUT)/veristat: $(OUTPUT)/veristat.o
>         $(call msg,BINARY,,$@)
>         $(Q)$(CC) $(CFLAGS) $(LDFLAGS) $(filter %.a %.o,$^) $(LDLIBS) -o $@
>

[...]


      reply	other threads:[~2024-07-10 17:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-09 20:42 [PATCH bpf-next 00/10] Harden and extend ELF build ID parsing logic Andrii Nakryiko
2024-07-09 20:42 ` [PATCH bpf-next 01/10] lib/buildid: add single page-based file reader abstraction Andrii Nakryiko
2024-07-09 20:42 ` [PATCH bpf-next 02/10] lib/buildid: take into account e_phoff when fetching program headers Andrii Nakryiko
2024-07-09 20:42 ` [PATCH bpf-next 03/10] lib/buildid: remove single-page limit for PHDR search Andrii Nakryiko
2024-07-09 20:42 ` [PATCH bpf-next 04/10] lib/buildid: rename build_id_parse() into build_id_parse_nofault() Andrii Nakryiko
2024-07-09 20:42 ` [PATCH bpf-next 05/10] lib/buildid: implement sleepable build_id_parse() API Andrii Nakryiko
2024-07-09 20:42 ` [PATCH bpf-next 06/10] lib/buildid: don't limit .note.gnu.build-id to the first page in ELF Andrii Nakryiko
2024-07-09 20:42 ` [PATCH bpf-next 07/10] lib/buildid: harden build ID parsing logic some more Andrii Nakryiko
2024-07-10 20:45   ` Andi Kleen
2024-07-10 20:53     ` Andrii Nakryiko
2024-07-09 20:42 ` [PATCH bpf-next 08/10] bpf: decouple stack_map_get_build_id_offset() from perf_callchain_entry Andrii Nakryiko
2024-07-09 20:42 ` [PATCH bpf-next 09/10] bpf: wire up sleepable bpf_get_stack() and bpf_get_task_stack() helpers Andrii Nakryiko
2024-07-09 20:42 ` [PATCH bpf-next 10/10] selftests/bpf: add build ID tests Andrii Nakryiko
2024-07-10 17:55   ` Andrii Nakryiko [this message]

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='CAEf4BzY8KfjR==9Yfcgij18Px6ggxqySqyYis6cv8GZY4PVxbw@mail.gmail.com' \
    --to=andrii.nakryiko@gmail.com \
    --cc=adobriyan@gmail.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-mm@kvack.org \
    --cc=osandov@osandov.com \
    --cc=shakeel.butt@linux.dev \
    /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