mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-14 03:14:48 -05:00
selftests/bpf: Add selftests for bpf_stream_print_stack
Add selftests for the new bpf_stream_print_stack kfunc. Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com> Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/r/20260203180424.14057-3-emil@etsalapatis.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
committed by
Alexei Starovoitov
parent
63328bb23f
commit
954fa97e21
@@ -234,4 +234,25 @@ int stream_arena_callback_fault(void *ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
SEC("syscall")
|
||||
__arch_x86_64
|
||||
__arch_arm64
|
||||
__success __retval(0)
|
||||
__stderr("CPU: {{[0-9]+}} UID: 0 PID: {{[0-9]+}} Comm: {{.*}}")
|
||||
__stderr("Call trace:\n"
|
||||
"{{([a-zA-Z_][a-zA-Z0-9_]*\\+0x[0-9a-fA-F]+/0x[0-9a-fA-F]+\n"
|
||||
"|[ \t]+[^\n]+\n)*}}")
|
||||
int stream_print_stack_kfunc(void *ctx)
|
||||
{
|
||||
return bpf_stream_print_stack(BPF_STDERR);
|
||||
}
|
||||
|
||||
SEC("syscall")
|
||||
__success __retval(-2)
|
||||
int stream_print_stack_invalid_id(void *ctx)
|
||||
{
|
||||
/* Try to pass an invalid stream ID. */
|
||||
return bpf_stream_print_stack((enum bpf_stream_id)0xbadcafe);
|
||||
}
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
Reference in New Issue
Block a user