]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
bpf, ppc64: do not reload skb pointers in non-skb context
authorDaniel Borkmann <daniel@iogearbox.net>
Thu, 14 Dec 2017 20:07:24 +0000 (21:07 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 15 Dec 2017 17:19:35 +0000 (09:19 -0800)
commit87338c8e2cbb317b5f757e6172f94e2e3799cd20
tree5190b98815efc7a2c96a8a49c3b443ab9565fcc5
parent6d59b7dbf72ed20d0138e2f9b75ca3d4a9d4faca
bpf, ppc64: do not reload skb pointers in non-skb context

The assumption of unconditionally reloading skb pointers on
BPF helper calls where bpf_helper_changes_pkt_data() holds
true is wrong. There can be different contexts where the helper
would enforce a reload such as in case of XDP. Here, we do
have a struct xdp_buff instead of struct sk_buff as context,
thus this will access garbage.

JITs only ever need to deal with cached skb pointer reload
when ld_abs/ind was seen, therefore guard the reload behind
SEEN_SKB.

Fixes: 156d0e290e96 ("powerpc/ebpf/jit: Implement JIT compiler for extended BPF")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Tested-by: Sandipan Das <sandipan@linux.vnet.ibm.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
arch/powerpc/net/bpf_jit_comp64.c