]> www.infradead.org Git - users/jedix/linux-maple.git/commit
selftests/bpf: Add uretprobe syscall test for regs changes
authorJiri Olsa <jolsa@kernel.org>
Tue, 11 Jun 2024 23:44:28 +0000 (08:44 +0900)
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>
Tue, 11 Jun 2024 23:44:28 +0000 (08:44 +0900)
commitf42a58ffb8bb54e66bf9668a6be91477828c0c1b
tree90dd76bf311f610cb059848a666241a427dd7e96
parent3e8e25761a40194887336650673587191564e12c
selftests/bpf: Add uretprobe syscall test for regs changes

Adding test that creates uprobe consumer on uretprobe which changes some
of the registers. Making sure the changed registers are propagated to the
user space when the ureptobe syscall trampoline is used on x86_64.

To be able to do this, adding support to bpf_testmod to create uprobe via
new attribute file:
  /sys/kernel/bpf_testmod_uprobe

This file is expecting file offset and creates related uprobe on current
process exe file and removes existing uprobe if offset is 0. The can be
only single uprobe at any time.

The uprobe has specific consumer that changes registers used in ureprobe
syscall trampoline and which are later checked in the test.

Link: https://lore.kernel.org/all/20240611112158.40795-7-jolsa@kernel.org/
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c