tracing/probes: Support BTF argument on module functions
Since the btf returned from bpf_get_btf_vmlinux() only covers functions in the vmlinux, BTF argument is not available on the functions in the modules. Use bpf_find_btf_id() instead of bpf_get_btf_vmlinux()+btf_find_name_kind() so that BTF argument can find the correct struct btf and btf_type in it. With this fix, fprobe events can use `$arg*` on module functions as below # grep nf_log_ip_packet /proc/kallsyms ffffffffa0005c00 t nf_log_ip_packet [nf_log_syslog] ffffffffa0005bf0 t __pfx_nf_log_ip_packet [nf_log_syslog] # echo 'f nf_log_ip_packet $arg*' > dynamic_events # cat dynamic_events f:fprobes/nf_log_ip_packet__entry nf_log_ip_packet net=net pf=pf hooknum=hooknum skb=skb in=in out=out loginfo=loginfo prefix=prefix To support the module's btf which is removable, the struct btf needs to be ref-counted. So this also records the btf in the traceprobe_parse_context and returns the refcount when the parse has done. Link: https://lore.kernel.org/all/169272154223.160970.3507930084247934031.stgit@devnote2/ Suggested-by:Alexei Starovoitov <alexei.starovoitov@gmail.com> Signed-off-by:
Masami Hiramatsu (Google) <mhiramat@kernel.org> Acked-by:
Steven Rostedt (Google) <rostedt@goodmis.org>
Showing
- include/linux/btf.h 1 addition, 0 deletionsinclude/linux/btf.h
- kernel/bpf/btf.c 1 addition, 1 deletionkernel/bpf/btf.c
- kernel/trace/trace_eprobe.c 1 addition, 3 deletionskernel/trace/trace_eprobe.c
- kernel/trace/trace_fprobe.c 1 addition, 0 deletionskernel/trace/trace_fprobe.c
- kernel/trace/trace_kprobe.c 1 addition, 0 deletionskernel/trace/trace_kprobe.c
- kernel/trace/trace_probe.c 58 additions, 42 deletionskernel/trace/trace_probe.c
- kernel/trace/trace_probe.h 11 additions, 3 deletionskernel/trace/trace_probe.h
- kernel/trace/trace_uprobe.c 1 addition, 0 deletionskernel/trace/trace_uprobe.c
Loading
Please register or sign in to comment