aboutsummaryrefslogtreecommitdiff
path: root/kernel/cgroup
diff options
context:
space:
mode:
authorGravatar Song Liu <song@kernel.org> 2022-07-19 17:21:24 -0700
committerGravatar Daniel Borkmann <daniel@iogearbox.net> 2022-07-22 22:04:30 +0200
commit53cd885bc5c3ea283cc9c00ca6446c778f00bfba (patch)
tree88e11137c9d99c12e72fa147685d15fbb85b33f1 /kernel/cgroup
parentftrace: Add modify_ftrace_direct_multi_nolock (diff)
downloadlinux-53cd885bc5c3ea283cc9c00ca6446c778f00bfba.tar.gz
linux-53cd885bc5c3ea283cc9c00ca6446c778f00bfba.tar.bz2
linux-53cd885bc5c3ea283cc9c00ca6446c778f00bfba.zip
ftrace: Allow IPMODIFY and DIRECT ops on the same function
IPMODIFY (livepatch) and DIRECT (bpf trampoline) ops are both important users of ftrace. It is necessary to allow them work on the same function at the same time. First, DIRECT ops no longer specify IPMODIFY flag. Instead, DIRECT flag is handled together with IPMODIFY flag in __ftrace_hash_update_ipmodify(). Then, a callback function, ops_func, is added to ftrace_ops. This is used by ftrace core code to understand whether the DIRECT ops can share with an IPMODIFY ops. To share with IPMODIFY ops, the DIRECT ops need to implement the callback function and adjust the direct trampoline accordingly. If DIRECT ops is attached before the IPMODIFY ops, ftrace core code calls ENABLE_SHARE_IPMODIFY_PEER on the DIRECT ops before registering the IPMODIFY ops. If IPMODIFY ops is attached before the DIRECT ops, ftrace core code calls ENABLE_SHARE_IPMODIFY_SELF in __ftrace_hash_update_ipmodify. Owner of the DIRECT ops may return 0 if the DIRECT trampoline can share with IPMODIFY, so error code otherwise. The error code is propagated to register_ftrace_direct_multi so that onwer of the DIRECT trampoline can handle it properly. For more details, please refer to comment before enum ftrace_ops_cmd. Signed-off-by: Song Liu <song@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org> Link: https://lore.kernel.org/all/20220602193706.2607681-2-song@kernel.org/ Link: https://lore.kernel.org/all/20220718055449.3960512-1-song@kernel.org/ Link: https://lore.kernel.org/bpf/20220720002126.803253-3-song@kernel.org
Diffstat (limited to 'kernel/cgroup')
0 files changed, 0 insertions, 0 deletions