acrn-kernel/arch/x86
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 x86/decompressor: Don't rely on upper 32 bits of GPRs being preserved 2023-09-13 09:42:28 +02:00
coco x86/tdx: Fix race between set_memory_encrypted() and load_unaligned_zeropad() 2023-07-19 16:21:00 +02:00
configs
crypto
entry x86/mm: Fix VDSO and VVAR placement on 5-level paging machines 2023-08-16 18:27:25 +02:00
events perf/x86/uncore: Correct the number of CHAs on EMR 2023-09-13 09:43:04 +02:00
hyperv x86/hyperv: Disable IBT when hypercall page lacks ENDBR instruction 2023-08-11 12:08:21 +02:00
ia32
include x86/virt: Drop unnecessary check on extended CPUID level in cpu_has_svm() 2023-09-19 12:27:59 +02:00
kernel x86/sgx: Break up long non-preemptible delays in sgx_vepc_release() 2023-09-13 09:43:04 +02:00
kvm KVM: x86/mmu: Add "never" option to allow sticky disabling of nx_huge_pages 2023-09-13 09:42:26 +02:00
lib x86/retpoline,kprobes: Fix position of thunk sections with CONFIG_LTO_CLANG 2023-08-26 13:27:00 +02:00
math-emu
mm x86/sev: Make enc_dec_hypercall() accept a size instead of npages 2023-09-13 09:43:03 +02:00
net bpf: Remove prog->active check for bpf_lsm and bpf_iter 2023-09-19 12:28:03 +02:00
pci x86/pci/xen: populate MSI sysfs entries 2023-05-30 14:03:22 +01:00
platform x86/efi: Make efi_set_virtual_address_map IBT safe 2023-07-19 16:21:45 +02:00
power
purgatory x86/purgatory: remove PGO flags 2023-06-21 16:00:55 +02:00
ras
realmode
tools
um x86: um: vdso: Add '%rcx' and '%r11' to the syscall clobber list 2023-03-11 13:55:22 +01:00
video
virt/vmx/tdx
xen x86/xen: Fix secondary processors' FPU initialization 2023-08-08 20:03:49 +02:00
.gitignore
Kbuild
Kconfig x86/srso: Add a Speculative RAS Overflow mitigation 2023-08-08 20:03:50 +02:00
Kconfig.assembler
Kconfig.cpu
Kconfig.debug
Makefile
Makefile.um um: Only disable SSE on clang to work around old GCC bugs 2023-05-01 08:26:27 +09:00
Makefile_32.cpu