Handle duplicate kprobe symbols#11253
Handle duplicate kprobe symbols#11253kernel-patches-daemon-bpf[bot] wants to merge 2 commits intobpf-next_basefrom
Conversation
|
Upstream branch: 309d880 |
73579ec to
9848291
Compare
|
Upstream branch: 44dd647 |
41278d8 to
e221391
Compare
9848291 to
c7dcbca
Compare
|
Upstream branch: 05c9b2e |
e221391 to
ea72fd8
Compare
c7dcbca to
69a44ca
Compare
|
Upstream branch: 4faa189 |
ea72fd8 to
125e009
Compare
69a44ca to
f264dc7
Compare
|
Upstream branch: 748f9c6 |
125e009 to
86fad50
Compare
f264dc7 to
59120bd
Compare
When a kernel module exports a symbol with the same name as an existing vmlinux symbol, kprobe attachment via bpf_program__attach_kprobe_opts() fails with EADDRNOTAVAIL (perf_event_open path) or EINVAL (legacy tracefs path). Implement a fallback mechanism that, on such failures, resolves the vmlinux address through /proc/kallsyms - filtering out module symbols - and retries probe attachment using the absolute address, bypassing kernel symbol name validation. Changes: - Restructure libbpf_kallsyms_parse() to accept a bool skip_if_module parameter that filters module symbols before invoking the callback. - Add find_kaddr_cb() callback and find_kaddr_ctx struct to resolve vmlinux text symbol addresses from /proc/kallsyms. - Detect duplicate symbol errors (-EADDRNOTAVAIL for perf_event_open, -EINVAL for legacy tracefs) and retry with resolved KADDR. - Fix NULL pointer in gen_probe_legacy_event_name() when using absolute address by passing func_name instead of optional_func_name. - Fix NULL pointer in pr_warn() calls within perf_event_kprobe_open_legacy() by using ternary fallback. - Fix memory leak of legacy_probe buffer on retry path. Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@crowdstrike.com>
Add bpf_testmod_dup_sym.ko test module that creates a duplicate nanosleep symbols to test kprobe attachment when a module exports a symbol with the same name as a vmlinux symbol. Add test_attach_probe_dup_sym() to attach_probe tests that loads the duplicate symbol module and validates kprobe attachment across all four attach modes: auto-attach, explicit symbol, legacy with offset, and perf_event_open with offset. Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@crowdstrike.com> Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
|
Upstream branch: 6dd780f |
86fad50 to
0fca78c
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1060295 expired. Closing PR. |
Pull request for series with
subject: Handle duplicate kprobe symbols
version: 5
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1060295