linux-stable/arch
Leon Hwang 8f873cc3f6 bpf, x64: Fix tailcall infinite loop
[ Upstream commit 2b5dcb31a1 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-20 11:58:55 +01:00
..
alpha Kbuild updates for v6.6 2023-09-05 11:01:47 -07:00
arc ARC updates for v6.6 2023-09-04 15:38:24 -07:00
arm Few minor fixes for omaps 2023-10-18 15:29:11 +02:00
arm64 ARM: SoC fixes for 6.7, part 3 2023-10-26 08:17:26 -10:00
csky arch/csky 2nd patches for 6.6 2023-09-01 08:02:45 -07:00
hexagon Add x86 shadow stack support 2023-08-31 12:20:12 -07:00
ia64 cpu-hotplug: Provide prototypes for arch CPU registration 2023-10-11 14:27:37 +02:00
loongarch LoongArch: Disable WUC for pgprot_writecombine() like ioremap_wc() 2023-10-18 08:42:52 +08:00
m68k ata changes for 6.6 2023-09-05 12:37:28 -07:00
microblaze Microblaze patches for 6.6-rc1 2023-09-05 10:15:22 -07:00
mips KVM: MIPS: fix -Wunused-but-set-variable warning 2023-10-12 11:25:40 -04:00
nios2 Add x86 shadow stack support 2023-08-31 12:20:12 -07:00
openrisc OpenRISC updates for 6.6 2023-09-05 10:09:31 -07:00
parisc parisc architecture fixes for kernel v6.6-rc5: 2023-10-07 13:05:43 -07:00
powerpc powerpc fixes for 6.6 #6 2023-10-27 05:40:42 -10:00
riscv ARM: SoC fixes for 6.7, part 3 2023-10-26 08:17:26 -10:00
s390 s390 updates for 6.6-rc7 2023-10-21 10:11:11 -07:00
sh sh: mm: re-add lost __ref to ioremap_prot() to fix modpost warning 2023-09-19 13:21:32 -07:00
sparc sparc32: fix a braino in fault handling in csum_and_copy_..._user() 2023-10-27 20:06:06 -04:00
um This pull request contains the following changes for UML: 2023-09-04 11:32:21 -07:00
x86 bpf, x64: Fix tailcall infinite loop 2023-11-20 11:58:55 +01:00
xtensa xtensa: boot/lib: fix function prototypes 2023-09-20 05:03:30 -07:00
.gitignore
Kconfig Add x86 shadow stack support 2023-08-31 12:20:12 -07:00