I want to count the malloc
system call with Kprobe in fedora.
I know that malloc
is not a system call and is implemented in user space, but I want to count malloc with kprobe if its possible.
What is the name of system call that I must give to Kprobe? For example for do_work:
kp.addr = (kprobe_opcode_t *) kallsyms_lookup_name("do_fork");
This is not possible with kprobes because, as you said,
malloc
is not a system call.You can, however, use USDTs to trace userspace processes. The bcc tools contain an example with
uobjnew
. It traces object allocations in the given process: