linux-stable/arch/x86
Leon Hwang 2b5dcb31a1 bpf, x64: Fix tailcall infinite loop
From commit ebf7d1f508 ("bpf, x64: rework pro/epilogue and tailcall
handling in JIT"), the tailcall on x64 works better than before.

From commit e411901c0b ("bpf: allow for tailcalls in BPF subprograms
for x64 JIT"), tailcall is able to run in BPF subprograms on x64.

From commit 5b92a28aae ("bpf: Support attaching tracing BPF program
to other BPF programs"), BPF program is able to trace other BPF programs.

How about combining them all together?

1. FENTRY/FEXIT on a BPF subprogram.
2. A tailcall runs in the BPF subprogram.
3. The tailcall calls the subprogram's caller.

As a result, a tailcall infinite loop comes up. And the loop would halt
the machine.

As we know, in tail call context, the tail_call_cnt propagates by stack
and rax register between BPF subprograms. So do in trampolines.

Fixes: ebf7d1f508 ("bpf, x64: rework pro/epilogue and tailcall handling in JIT")
Fixes: e411901c0b ("bpf: allow for tailcalls in BPF subprograms for x64 JIT")
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
Link: https://lore.kernel.org/r/20230912150442.2009-3-hffilwlqm@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2023-09-12 13:06:12 -07:00
..
boot Misc x86 cleanups. 2023-08-28 17:05:58 -07:00
coco - Some SEV and CC platform helpers cleanup and simplifications now that 2023-06-27 13:26:30 -07:00
configs - The first, cleanup part of the microcode loader reorg tglx has been 2023-08-28 15:55:20 -07:00
crypto crypto: x86/aesni - remove unused parameter to aes_set_key_common() 2023-07-22 13:59:39 +12:00
entry Add x86 shadow stack support 2023-08-31 12:20:12 -07:00
events Perf events changes for v6.6: 2023-08-28 16:35:01 -07:00
hyperv hyperv-next for v6.6 2023-09-04 11:26:29 -07:00
ia32
include ARM: 2023-09-07 13:52:20 -07:00
kernel ARM: 2023-09-07 13:52:20 -07:00
kvm ARM: 2023-09-07 13:52:20 -07:00
lib x86: bring back rep movsq for user access on CPUs without ERMS 2023-08-30 09:45:12 -07:00
math-emu x86/fpu: Include asm/fpu/regset.h 2023-05-18 11:56:18 -07:00
mm Add x86 shadow stack support 2023-08-31 12:20:12 -07:00
net bpf, x64: Fix tailcall infinite loop 2023-09-12 13:06:12 -07:00
pci pci-v6.6-changes 2023-08-30 20:23:07 -07:00
platform * Rework apic callbacks, getting rid of unnecessary ones and 2023-08-30 10:44:46 -07:00
power x86/topology: Remove CPU0 hotplug option 2023-05-15 13:44:49 +02:00
purgatory x86/purgatory: Include header for warn() declaration 2023-08-03 16:37:18 +02:00
ras
realmode x86/realmode: Make stack lock work in trampoline_compat() 2023-05-30 14:11:47 +02:00
tools ELF: fix all "Elf" typos 2023-04-08 13:45:37 -07:00
um um: Hard-code the result of 'uname -s' 2023-08-26 22:40:37 +02:00
video Merge drm/drm-next into drm-misc-next 2023-07-24 15:44:47 +02:00
virt/vmx/tdx
xen Add x86 shadow stack support 2023-08-31 12:20:12 -07:00
.gitignore
Kbuild
Kconfig Add x86 shadow stack support 2023-08-31 12:20:12 -07:00
Kconfig.assembler x86/shstk: Add Kconfig option for shadow stack 2023-07-11 14:12:18 -07:00
Kconfig.cpu x86/cpu: Remove X86_FEATURE_NAMES 2023-05-15 20:03:08 +02:00
Kconfig.debug
Makefile Kbuild updates for v6.6 2023-09-05 11:01:47 -07:00
Makefile.postlink x86/build: Avoid relocation information in final vmlinux 2023-06-14 19:54:40 +02:00
Makefile.um
Makefile_32.cpu