You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am going to use the ebpf to do some trace work against my kernel module, however, I haven't seen much discussion on that and most of the discussion are based on Linux kernel events, functions. I tried to trace a kernel module function, let's say named as my_kernel_func(), I will get the errors like below: libbpf: kprobe perf_event_open() failed: Cannot assign requested address libbpf: prog 'my_kernel_func': failed to create kprobe 'my_kernel_func+0x0' perf event: Cannot assign requested address libbpf: failed to auto-attach program 'asmSubmitBio': -99 failed to attach BPF programs: Cannot assign requested address
This function is already existed and available for tracing
$sudo bpftrace -l "kprobe:my_kernel_func"
kprobe:my_kernel_func
$ sudo cat /sys/kernel/debug/tracing/available_filter_functions|grep my_kernel_func
my_kernel_func [test_module]
$ cat /proc/kallsyms |grep my_kernel_func
0000000000000000 t asmSubmitBio [test_module]
do I miss anything? how to make it work? thanks for your suggestions
This is how I define the trace function in .bpf.c file:
SEC("kprobe/my_kernel_func")
int BPF_KPROBE(kprobe__my_kernel_func)
{
return inc_stats(S_MY_KERNEL_FUNC);
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
hi community,
I am going to use the ebpf to do some trace work against my kernel module, however, I haven't seen much discussion on that and most of the discussion are based on Linux kernel events, functions. I tried to trace a kernel module function, let's say named as my_kernel_func(), I will get the errors like below:
libbpf: kprobe perf_event_open() failed: Cannot assign requested address libbpf: prog 'my_kernel_func': failed to create kprobe 'my_kernel_func+0x0' perf event: Cannot assign requested address libbpf: failed to auto-attach program 'asmSubmitBio': -99 failed to attach BPF programs: Cannot assign requested addressThis function is already existed and available for tracing
$sudo bpftrace -l "kprobe:my_kernel_func"
kprobe:my_kernel_func
$ sudo cat /sys/kernel/debug/tracing/available_filter_functions|grep my_kernel_func
my_kernel_func [test_module]
$ cat /proc/kallsyms |grep my_kernel_func
0000000000000000 t asmSubmitBio [test_module]
do I miss anything? how to make it work? thanks for your suggestions
This is how I define the trace function in .bpf.c file:
SEC("kprobe/my_kernel_func")
int BPF_KPROBE(kprobe__my_kernel_func)
{
return inc_stats(S_MY_KERNEL_FUNC);
}
Beta Was this translation helpful? Give feedback.
All reactions