]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Support bpf_trampoline on functions with IPMODIFY (e.g. livepatch)
authorSong Liu <song@kernel.org>
Wed, 20 Jul 2022 00:21:26 +0000 (17:21 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 22 Jul 2022 20:04:37 +0000 (22:04 +0200)
commit5cad83f97fb479e2f31a74bf6c3897fb8fa43a58
tree91073f9e37c12cf4321a60f5c1b20c307c64e199
parentb9657996eb92c72e4c8dfc568c6807f3bed2333d
bpf: Support bpf_trampoline on functions with IPMODIFY (e.g. livepatch)

When tracing a function with IPMODIFY ftrace_ops (livepatch), the bpf
trampoline must follow the instruction pointer saved on stack. This needs
extra handling for bpf trampolines with BPF_TRAMP_F_CALL_ORIG flag.

Implement bpf_tramp_ftrace_ops_func and use it for the ftrace_ops used
by BPF trampoline. This enables tracing functions with livepatch.

This also requires moving bpf trampoline to *_ftrace_direct_mult APIs.

Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/all/20220602193706.2607681-2-song@kernel.org/
Link: https://lore.kernel.org/bpf/20220720002126.803253-5-song@kernel.org
include/linux/bpf.h
kernel/bpf/trampoline.c