TencentOS-kernel/arch
Alexei Starovoitov c21b04f6ef bpf: Fix trampoline generation for fmod_ret programs
[upstream commit 13fac1d851e09109096b5862bf37c3da6908fb48]

fmod_ret progs are emitted as:

start = __bpf_prog_enter();
call fmod_ret
*(u64 *)(rbp - 8) = rax
__bpf_prog_exit(, start);
test eax, eax
jne do_fexit

That 'test eax, eax' is working by accident. The compiler is free to use rax
inside __bpf_prog_exit() or inside functions that __bpf_prog_exit() is calling.
Which caused "test_progs -t modify_return" to sporadically fail depending on
compiler version and kconfig. Fix it by using 'cmp [rbp - 8], 0' instead of
'test eax, eax'.

Fixes: ae24082331d9 ("bpf: Introduce BPF_MODIFY_RETURN")
Reported-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: KP Singh <kpsingh@google.com>
Link: https://lore.kernel.org/bpf/20200311003906.3643037-1-ast@kernel.org
2022-07-21 11:32:34 +08:00
..
alpha net: retrieve netns cookie via getsocketopt 2022-03-02 10:48:06 +08:00
arc arc: kernel: Return -EFAULT if copy_to_user() fails 2021-05-20 16:07:08 +08:00
arm bpf: Introduce BPF nospec instruction for mitigating Spectre v4 2022-07-21 11:32:29 +08:00
arm64 bpf: Introduce BPF nospec instruction for mitigating Spectre v4 2022-07-21 11:32:29 +08:00
c6x
csky csky: change a Kconfig symbol name to fix e1000 build error 2021-05-20 16:07:15 +08:00
h8300 h8300: fix PREEMPTION build, TI_PRE_COUNT undefined 2021-04-12 12:52:05 +08:00
hexagon
ia64 ia64: fix discontig.c section mismatches 2021-05-20 16:07:15 +08:00
m68k m68k: mvme147,mvme16x: Don't wipe PCC timer config bits 2021-05-20 16:07:48 +08:00
microblaze
mips bpf: Introduce BPF nospec instruction for mitigating Spectre v4 2022-07-21 11:32:29 +08:00
nds32 nds32: flush_dcache_page: use page_mapping_file to avoid races with swapoff 2021-05-20 16:06:56 +08:00
nios2
openrisc openrisc: Fix issue with get_user for 64-bit values 2021-03-16 16:39:36 +08:00
parisc net: retrieve netns cookie via getsocketopt 2022-03-02 10:48:06 +08:00
powerpc bpf: Introduce BPF nospec instruction for mitigating Spectre v4 2022-07-21 11:32:29 +08:00
riscv bpf: Introduce BPF nospec instruction for mitigating Spectre v4 2022-07-21 11:32:29 +08:00
s390 bpf: Introduce BPF nospec instruction for mitigating Spectre v4 2022-07-21 11:32:29 +08:00
sh sh: dma: fix kconfig dependency for G2_DMA 2021-04-12 12:51:39 +08:00
sparc bpf: Introduce BPF nospec instruction for mitigating Spectre v4 2022-07-21 11:32:29 +08:00
um um: mm: check more comprehensively for stub changes 2021-04-12 12:52:40 +08:00
unicore32
x86 bpf: Fix trampoline generation for fmod_ret programs 2022-07-21 11:32:34 +08:00
xtensa xtensa: move coprocessor_flush to the .text section 2021-05-20 16:06:49 +08:00
.gitignore
Kconfig Revert: "ring-buffer: Remove HAVE_64BIT_ALIGNED_ACCESS" 2021-03-16 16:43:47 +08:00