]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: fix bpf_tail_call() x64 JIT
authorAlexei Starovoitov <ast@fb.com>
Tue, 3 Oct 2017 22:37:20 +0000 (15:37 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 3 Oct 2017 23:04:44 +0000 (16:04 -0700)
commit6c6a450e3709ebe716abbbae2e9f7b049701afbf
tree8d091b5f97b4c15bf8127a48edd6bc4151374dac
parent891e8380f04682ca548d705e3c79b37196037d9c
bpf: fix bpf_tail_call() x64 JIT

- bpf prog_array just like all other types of bpf array accepts 32-bit index.
  Clarify that in the comment.
- fix x64 JIT of bpf_tail_call which was incorrectly loading 8 instead of 4 bytes
- tighten corresponding check in the interpreter to stay consistent

The JIT bug can be triggered after introduction of BPF_F_NUMA_NODE flag
in commit 73499cf94e29 in 4.14. Before that the map_flags would stay zero and
though JIT code is wrong it will check bounds correctly.
Hence two fixes tags. All other JITs don't have this problem.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Fixes: 73499cf94e29 ("bpf: Allow selecting numa node during map creation")
Fixes: a2fda4268bf8 ("x86: bpf_jit: implement bpf_tail_call() helper")
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/x86/net/bpf_jit_comp.c
include/uapi/linux/bpf.h
kernel/bpf/core.c