Commit 0be9ae5
bpf, events: Use prog to emit ksymbol event for main program
Since commit 0108a4e ("bpf: ensure main program has an extable"),
prog->aux->func[0]->kallsyms is left as uninitialized. For BPF programs
with subprogs, the symbol for the main program is missing just as shown
in the output of perf script below:
ffffffff81284b69 qp_trie_lookup_elem+0xb9 ([kernel.kallsyms])
ffffffffc0011125 bpf_prog_a4a0eb0651e6af8b_lookup_qp_trie+0x5d (bpf...)
ffffffff8127bc2b bpf_for_each_array_elem+0x7b ([kernel.kallsyms])
ffffffffc00110a1 +0x25 ()
ffffffff8121a89a trace_call_bpf+0xca ([kernel.kallsyms])
Fix it by always using prog instead prog->aux->func[0] to emit ksymbol
event for the main program. After the fix, the output of perf script
will be correct:
ffffffff81284b96 qp_trie_lookup_elem+0xe6 ([kernel.kallsyms])
ffffffffc001382d bpf_prog_a4a0eb0651e6af8b_lookup_qp_trie+0x5d (bpf...)
ffffffff8127bc2b bpf_for_each_array_elem+0x7b ([kernel.kallsyms])
ffffffffc0013779 bpf_prog_245c55ab25cfcf40_qp_trie_lookup+0x25 (bpf...)
ffffffff8121a89a trace_call_bpf+0xca ([kernel.kallsyms])
Fixes: 0108a4e ("bpf: ensure main program has an extable")
Signed-off-by: Hou Tao <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Tested-by: Yonghong Song <[email protected]>
Reviewed-by: Krister Johansen <[email protected]>
Reviewed-by: Jiri Olsa <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]1 parent 6caf9ef commit 0be9ae5
1 file changed
+13
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9327 | 9327 | | |
9328 | 9328 | | |
9329 | 9329 | | |
9330 | | - | |
9331 | | - | |
9332 | | - | |
9333 | | - | |
9334 | | - | |
9335 | | - | |
9336 | | - | |
9337 | | - | |
9338 | | - | |
9339 | | - | |
9340 | | - | |
9341 | | - | |
9342 | | - | |
9343 | | - | |
9344 | | - | |
| 9330 | + | |
| 9331 | + | |
| 9332 | + | |
| 9333 | + | |
| 9334 | + | |
| 9335 | + | |
| 9336 | + | |
| 9337 | + | |
| 9338 | + | |
| 9339 | + | |
| 9340 | + | |
| 9341 | + | |
| 9342 | + | |
9345 | 9343 | | |
9346 | 9344 | | |
9347 | 9345 | | |
| |||
0 commit comments