]> git.proxmox.com Git - mirror_ubuntu-artful-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)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 19 Oct 2017 14:48:37 +0000 (09:48 -0500)
commitfa8625584568f9fa259871ee966866d74ca8a8a4
tree0f3c453fc68726e55b1a2d25b7e91e0afd532bc7
parent57a27ba25ae6f7b5842f7d62ef8386b23585aaa3
bpf: fix bpf_tail_call() x64 JIT

BugLink: http://bugs.launchpad.net/bugs/1723145
[ Upstream commit 90caccdd8cc0215705f18b92771b449b01e2474a ]

- 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 96eabe7a40aa 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: 96eabe7a40aa ("bpf: Allow selecting numa node during map creation")
Fixes: b52f00e6a715 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
arch/x86/net/bpf_jit_comp.c
include/uapi/linux/bpf.h
kernel/bpf/core.c