Skip to content

Commit

Permalink
selftests/bpf: fix selftest after random: Urandom_read tracepoint rem…
Browse files Browse the repository at this point in the history
…oval

[ Upstream commit 99dea2c ]

14c1746 ("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.

Fix breakage by switching to kprobing urandom_read() function.

Suggested-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20220325225643.2606-1-andrii@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
anakryiko authored and gregkh committed Jun 14, 2022
1 parent 5ff2514 commit 8969c3b
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c
Expand Up @@ -39,16 +39,8 @@ struct {
__type(value, stack_trace_t);
} stack_amap SEC(".maps");

/* taken from /sys/kernel/debug/tracing/events/random/urandom_read/format */
struct random_urandom_args {
unsigned long long pad;
int got_bits;
int pool_left;
int input_left;
};

SEC("tracepoint/random/urandom_read")
int oncpu(struct random_urandom_args *args)
SEC("kprobe/urandom_read")
int oncpu(struct pt_regs *args)
{
__u32 max_len = sizeof(struct bpf_stack_build_id)
* PERF_MAX_STACK_DEPTH;
Expand Down

0 comments on commit 8969c3b

Please sign in to comment.