On Tue, Jul 9, 2024 at 1:43 PM Andrii Nakryiko <andrii@xxxxxxxxxx> 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@xxxxxxxxxx> > --- > 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 $@ > [...]