aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bpf/bpftool/prog.c
diff options
context:
space:
mode:
authorAlexei Starovoitov <[email protected]>2020-03-11 00:39:06 +0000
committerDaniel Borkmann <[email protected]>2020-03-11 13:07:32 +0000
commit13fac1d851e09109096b5862bf37c3da6908fb48 (patch)
tree927815f0128976e44e7f0435f52b91dd348ca4ea /tools/bpf/bpftool/prog.c
parentbpf: Add bpf_link_new_file that doesn't install FD (diff)
downloadkernel-13fac1d851e09109096b5862bf37c3da6908fb48.tar.gz
kernel-13fac1d851e09109096b5862bf37c3da6908fb48.zip
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 <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Andrii Nakryiko <[email protected]> Acked-by: KP Singh <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/bpf/bpftool/prog.c')
0 files changed, 0 insertions, 0 deletions