Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ebpf: intercepting function calls

I am reading about kprobes BPF program type, and am wondering if it is possible to not just intercept a function call for tracing purposes or collect some low-level information (registers, stack etc.), but substitute a call and execute instead of the actual function?

Does kprobe provide this capability or I'm looking at the wrong tool?

like image 239
Mark Avatar asked Sep 22 '26 00:09

Mark


1 Answers

No, kprobes BPF programs have only read access to the syscall parameters and return value, they cannot modify registers and therefore cannot intercept function calls. This is a limitation imposed by the BPF verifier.

Kernel modules, however, can intercept function calls using kprobes.

like image 88
pchaigno Avatar answered Sep 26 '26 16:09

pchaigno



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!