Re: [PATCH bpf-next] selftests/bpf: fix selftest after random:urandom_read tracepoint removal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 25, 2022 at 3:44 PM Yonghong Song <yhs@xxxxxx> wrote:
>
>
>
> 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.
>

I noticed flakiness locally as well. Switching to kprobe/urandom_read
seems to work well, thanks!

> Also, if using kprobe, maybe rename 'struct random_urandom_args'
> to 'struct pt_regs'? Also, the struct random_urandom_args definition
> can be removed.
>

yep, missed the need to clean this up. I'll send v2 shortly.



>
> >   int oncpu(struct random_urandom_args *args)
> >   {
> >       __u32 max_len = sizeof(struct bpf_stack_build_id)



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux