diff options
author | Daniel T. Lee <danieltimlee@gmail.com> | 2023-08-18 18:01:14 +0900 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-08-21 15:39:09 -0700 |
commit | 02dabc247ad68b41758bf39f11e2d682b8b32dd7 (patch) | |
tree | 687d6b63d82cb4b847647ccecee0c2ca8bdc0747 /samples/bpf/offwaketime.bpf.c | |
parent | 4a0ee78890699706f59cc9bdf8283ecaa4e0a141 (diff) | |
download | linux-02dabc247ad68b41758bf39f11e2d682b8b32dd7.tar.gz linux-02dabc247ad68b41758bf39f11e2d682b8b32dd7.tar.bz2 linux-02dabc247ad68b41758bf39f11e2d682b8b32dd7.zip |
samples/bpf: fix symbol mismatch by compiler optimization
Currently, multiple kprobe programs are suffering from symbol mismatch
due to compiler optimization. These optimizations might induce
additional suffix to the symbol name such as '.isra' or '.constprop'.
# egrep ' finish_task_switch| __netif_receive_skb_core' /proc/kallsyms
ffffffff81135e50 t finish_task_switch.isra.0
ffffffff81dd36d0 t __netif_receive_skb_core.constprop.0
ffffffff8205cc0e t finish_task_switch.isra.0.cold
ffffffff820b1aba t __netif_receive_skb_core.constprop.0.cold
To avoid this, this commit replaces the original kprobe section to
kprobe.multi in order to match symbol with wildcard characters. Here,
asterisk is used for avoiding symbol mismatch.
Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
Link: https://lore.kernel.org/r/20230818090119.477441-5-danieltimlee@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'samples/bpf/offwaketime.bpf.c')
-rw-r--r-- | samples/bpf/offwaketime.bpf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/samples/bpf/offwaketime.bpf.c b/samples/bpf/offwaketime.bpf.c index 8e5105811178..3200a0f44969 100644 --- a/samples/bpf/offwaketime.bpf.c +++ b/samples/bpf/offwaketime.bpf.c @@ -118,7 +118,7 @@ int oncpu(struct trace_event_raw_sched_switch *ctx) /* record previous thread sleep time */ u32 pid = ctx->prev_pid; #else -SEC("kprobe/finish_task_switch") +SEC("kprobe.multi/finish_task_switch*") int oncpu(struct pt_regs *ctx) { struct task_struct *p = (void *) PT_REGS_PARM1(ctx); |