acrn-kernel/arch/arm64
Martin KaFai Lau a12f15d1f8 bpf: Remove prog->active check for bpf_lsm and bpf_iter
[ Upstream commit 271de525e1 ]

The commit 64696c40d0 ("bpf: Add __bpf_prog_{enter,exit}_struct_ops for struct_ops trampoline")
removed prog->active check for struct_ops prog.  The bpf_lsm
and bpf_iter is also using trampoline.  Like struct_ops, the bpf_lsm
and bpf_iter have fixed hooks for the prog to attach.  The
kernel does not call the same hook in a recursive way.
This patch also removes the prog->active check for
bpf_lsm and bpf_iter.

A later patch has a test to reproduce the recursion issue
for a sleepable bpf_lsm program.

This patch appends the '_recur' naming to the existing
enter and exit functions that track the prog->active counter.
New __bpf_prog_{enter,exit}[_sleepable] function are
added to skip the prog->active tracking. The '_struct_ops'
version is also removed.

It also moves the decision on picking the enter and exit function to
the new bpf_trampoline_{enter,exit}().  It returns the '_recur' ones
for all tracing progs to use.  For bpf_lsm, bpf_iter,
struct_ops (no prog->active tracking after 64696c40d0), and
bpf_lsm_cgroup (no prog->active tracking after 69fd337a97),
it will return the functions that don't track the prog->active.

Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://lore.kernel.org/r/20221025184524.3526117-2-martin.lau@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Stable-dep-of: 7645629f7d ("bpf: Invoke __bpf_prog_exit_sleepable_recur() on recursion in kern_sys_bpf().")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-09-19 12:28:03 +02:00
..
boot arm64: dts: renesas: rzg2l: Fix txdv-skew-psec typos 2023-09-19 12:27:56 +02:00
configs
crypto
hyperv
include arm64: sdei: abort running SDEI handlers during crash 2023-09-13 09:43:03 +02:00
kernel arm64: sdei: abort running SDEI handlers during crash 2023-09-13 09:43:03 +02:00
kvm KVM: arm64: vgic-v4: Make the doorbell request robust w.r.t preemption 2023-08-23 17:52:28 +02:00
lib arm64: csum: Fix OoB access in IP checksum code for negative lengths 2023-09-13 09:43:01 +02:00
mm arm64: mm: use ptep_clear() instead of pte_clear() in clear_flush() 2023-09-13 09:42:34 +02:00
net bpf: Remove prog->active check for bpf_lsm and bpf_iter 2023-09-19 12:28:03 +02:00
tools arm64: errata: Mitigate Ampere1 erratum AC03_CPU_38 at stage-2 2023-08-03 10:23:54 +02:00
xen
Kbuild
Kconfig arm64: errata: Mitigate Ampere1 erratum AC03_CPU_38 at stage-2 2023-08-03 10:23:54 +02:00
Kconfig.debug
Kconfig.platforms
Makefile