diff mbox series

[bpf] selftests/bpf: fix stacktrace_build_id with missing kprobe/urandom_read

Message ID 20220526191608.2364049-1-song@kernel.org (mailing list archive)
State Accepted
Commit 59ed76fe2f981bccde37bdddb465f260a96a2404
Delegated to: BPF
Headers show
Series [bpf] selftests/bpf: fix stacktrace_build_id with missing kprobe/urandom_read | expand

Checks

Context Check Description
bpf/vmtest-bpf-PR success PR summary
netdev/tree_selection success Clearly marked for bpf
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers fail 2 blamed authors not CCed: Jason@zx2c4.com axboe@kernel.dk; 11 maintainers not CCed: songliubraving@fb.com axboe@kernel.dk hengqi.chen@gmail.com davemarchevsky@fb.com yhs@fb.com linux-kselftest@vger.kernel.org john.fastabend@gmail.com Jason@zx2c4.com kafai@fb.com shuah@kernel.org kpsingh@kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-VM_Test-1 success Logs for Kernel LATEST on ubuntu-latest with gcc
bpf/vmtest-bpf-VM_Test-2 success Logs for Kernel LATEST on ubuntu-latest with llvm-15
bpf/vmtest-bpf-VM_Test-3 success Logs for Kernel LATEST on z15 with gcc

Commit Message

Song Liu May 26, 2022, 7:16 p.m. UTC
Kernel function urandom_read is replaced with urandom_read_iter.
Therefore, kprobe on urandom_read is not working any more:

[root@eth50-1 bpf]# ./test_progs -n 161
test_stacktrace_build_id:PASS:skel_open_and_load 0 nsec
libbpf: kprobe perf_event_open() failed: No such file or directory
libbpf: prog 'oncpu': failed to create kprobe 'urandom_read+0x0' \
        perf event: No such file or directory
libbpf: prog 'oncpu': failed to auto-attach: -2
test_stacktrace_build_id:FAIL:attach_tp err -2
161     stacktrace_build_id:FAIL

Fix this by replacing urandom_read with urandom_read_iter in the test.

Fixes: 1b388e7765f2 ("random: convert to using fops->read_iter()")
Reported-by: Mykola Lysenko <mykolal@fb.com>
Signed-off-by: Song Liu <song@kernel.org>
---
 tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Vernet May 26, 2022, 7:28 p.m. UTC | #1
On Thu, May 26, 2022 at 12:16:08PM -0700, Song Liu wrote:
> Kernel function urandom_read is replaced with urandom_read_iter.
> Therefore, kprobe on urandom_read is not working any more:
> 
> [root@eth50-1 bpf]# ./test_progs -n 161
> test_stacktrace_build_id:PASS:skel_open_and_load 0 nsec
> libbpf: kprobe perf_event_open() failed: No such file or directory
> libbpf: prog 'oncpu': failed to create kprobe 'urandom_read+0x0' \
>         perf event: No such file or directory
> libbpf: prog 'oncpu': failed to auto-attach: -2
> test_stacktrace_build_id:FAIL:attach_tp err -2
> 161     stacktrace_build_id:FAIL
> 
> Fix this by replacing urandom_read with urandom_read_iter in the test.
> 
> Fixes: 1b388e7765f2 ("random: convert to using fops->read_iter()")
> Reported-by: Mykola Lysenko <mykolal@fb.com>
> Signed-off-by: Song Liu <song@kernel.org>
> ---
>  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 6c62bfb8bb6f..0c4426592a26 100644
> --- a/tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c
> +++ b/tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c
> @@ -39,7 +39,7 @@ struct {
>  	__type(value, stack_trace_t);
>  } stack_amap SEC(".maps");
>  
> -SEC("kprobe/urandom_read")
> +SEC("kprobe/urandom_read_iter")
>  int oncpu(struct pt_regs *args)
>  {
>  	__u32 max_len = sizeof(struct bpf_stack_build_id)
> -- 
> 2.30.2
> 

Acked-by: David Vernet <void@manifault.com>
patchwork-bot+netdevbpf@kernel.org May 27, 2022, 3:10 p.m. UTC | #2
Hello:

This patch was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Thu, 26 May 2022 12:16:08 -0700 you wrote:
> Kernel function urandom_read is replaced with urandom_read_iter.
> Therefore, kprobe on urandom_read is not working any more:
> 
> [root@eth50-1 bpf]# ./test_progs -n 161
> test_stacktrace_build_id:PASS:skel_open_and_load 0 nsec
> libbpf: kprobe perf_event_open() failed: No such file or directory
> libbpf: prog 'oncpu': failed to create kprobe 'urandom_read+0x0' \
>         perf event: No such file or directory
> libbpf: prog 'oncpu': failed to auto-attach: -2
> test_stacktrace_build_id:FAIL:attach_tp err -2
> 161     stacktrace_build_id:FAIL
> 
> [...]

Here is the summary with links:
  - [bpf] selftests/bpf: fix stacktrace_build_id with missing kprobe/urandom_read
    https://git.kernel.org/bpf/bpf/c/59ed76fe2f98

You are awesome, thank you!
diff mbox series

Patch

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 6c62bfb8bb6f..0c4426592a26 100644
--- a/tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c
+++ b/tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c
@@ -39,7 +39,7 @@  struct {
 	__type(value, stack_trace_t);
 } stack_amap SEC(".maps");
 
-SEC("kprobe/urandom_read")
+SEC("kprobe/urandom_read_iter")
 int oncpu(struct pt_regs *args)
 {
 	__u32 max_len = sizeof(struct bpf_stack_build_id)