On 3/25/22 3:23 PM, Andrii Nakryiko wrote:
14c174633f34 ("random: remove unused tracepoints") removed all the
tracepoints from drivers/char/random.c, one of which,
random:urandom_read, was used by stacktrace_build_id selftest to trigger
stack trace capture from two different kernel code paths.
Fix breakage by switching to kprobing chacha_block_generic() function which
is also called in both code paths that selftest uses for triggering.
Suggested-by: Alexei Starovoitov <ast@xxxxxxxxxx>
Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
---
tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c b/tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c
index 36a707e7c7a7..698fef6d90bc 100644
--- a/tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c
+++ b/tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c
@@ -47,7 +47,7 @@ struct random_urandom_args {
int input_left;
};
-SEC("tracepoint/random/urandom_read")
+SEC("kprobe/chacha_block_generic")
I tried this and it doesn't work in my environment. But changing to
SEC("kprobe/urandom_read")
works.
Also, if using kprobe, maybe rename 'struct random_urandom_args'
to 'struct pt_regs'? Also, the struct random_urandom_args definition
can be removed.
int oncpu(struct random_urandom_args *args)
{
__u32 max_len = sizeof(struct bpf_stack_build_id)