linux-stable/include
Song Liu 53cd885bc5 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
2022-07-22 22:04:30 +02:00
..
acpi
asm-generic kernel: add platform_has() infrastructure 2022-06-06 08:06:00 +02:00
clocksource pwm: Changes for v5.19-rc1 2022-06-01 10:49:11 -07:00
crypto
drm drm/ttm: fix bulk move handling v2 2022-06-14 11:15:19 +02:00
dt-bindings dt-bindings: net: pcs: add bindings for Renesas RZ/N1 MII converter 2022-06-27 11:37:55 +01:00
keys certs: Move load_certificate_list() to be with the asymmetric keys code 2022-06-21 16:05:06 +01:00
kunit
kvm
linux ftrace: Allow IPMODIFY and DIRECT ops on the same function 2022-07-22 22:04:30 +02:00
math-emu
media
memory
misc
net net: netfilter: Add kfuncs to set and change CT status 2022-07-21 21:03:16 -07:00
pcmcia
ras
rdma
scsi
soc net: dsa: felix: keep reference on entire tc-taprio config 2022-06-30 21:18:15 -07:00
sound ASoC: Remove unused hw_write_t type 2022-06-24 16:21:41 +01:00
target
trace Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-06-30 16:31:00 -07:00
uapi bpf: fix bpf_skb_pull_data documentation 2022-07-19 09:57:04 -07:00
ufs
vdso
video
xen arm/xen: Assign xen-grant DMA ops for xen-grant DMA devices 2022-06-06 16:07:30 +02:00