]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Use NOP_ATOMIC5 instead of emit_nops(&prog, 5) for BPF_TRAMP_F_CALL_ORIG
authorStanislav Fomichev <sdf@google.com>
Sat, 20 Mar 2021 00:00:01 +0000 (17:00 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 20 Mar 2021 02:25:39 +0000 (19:25 -0700)
commitb9082970478009b778aa9b22d5561eef35b53b63
treec94b34dac36e81130d41eae939186180de7eaedb
parentf60a85cad677c4f9bb4cadd764f1d106c38c7cf8
bpf: Use NOP_ATOMIC5 instead of emit_nops(&prog, 5) for BPF_TRAMP_F_CALL_ORIG

__bpf_arch_text_poke does rewrite only for atomic nop5, emit_nops(xxx, 5)
emits non-atomic one which breaks fentry/fexit with k8 atomics:

P6_NOP5 == P6_NOP5_ATOMIC (0f1f440000 == 0f1f440000)
K8_NOP5 != K8_NOP5_ATOMIC (6666906690 != 6666666690)

Can be reproduced by doing "ideal_nops = k8_nops" in "arch_init_ideal_nops()
and running fexit_bpf2bpf selftest.

Fixes: e21aa341785c ("bpf: Fix fexit trampoline.")
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210320000001.915366-1-sdf@google.com
arch/x86/net/bpf_jit_comp.c