linux-stable/arch
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
..
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 ARM: 2023-09-07 13:52:20 -07:00
arm64 ARM: 2023-09-07 13:52:20 -07: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 Kbuild updates for v6.6 2023-09-05 11:01:47 -07:00
loongarch TTY/Serial driver changes for 6.6-rc1 2023-09-01 09:38:00 -07: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 ARM: 2023-09-07 13:52:20 -07: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 ata changes for 6.6 2023-09-05 12:37:28 -07:00
powerpc ata changes for 6.6 2023-09-05 12:37:28 -07:00
riscv ARM: 2023-09-07 13:52:20 -07:00
s390 Including fixes from netfilter and bpf. 2023-09-07 18:33:07 -07:00
sh Add x86 shadow stack support 2023-08-31 12:20:12 -07:00
sparc ata changes for 6.6 2023-09-05 12:37:28 -07: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-09-12 13:06:12 -07:00
xtensa Xtensa updates for v6.6 2023-09-07 10:30:17 -07:00
.gitignore
Kconfig Add x86 shadow stack support 2023-08-31 12:20:12 -07:00