summaryrefslogtreecommitdiff
path: root/lib/parman.c
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2020-03-10 17:39:06 -0700
committerDaniel Borkmann <daniel@iogearbox.net>2020-03-11 14:07:32 +0100
commit13fac1d851e09109096b5862bf37c3da6908fb48 (patch)
tree927815f0128976e44e7f0435f52b91dd348ca4ea /lib/parman.c
parentbabf3164095b0670435910340c2a1eec37757b57 (diff)
bpf: Fix trampoline generation for fmod_ret programs
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
Diffstat (limited to 'lib/parman.c')
0 files changed, 0 insertions, 0 deletions