]> asedeno.scripts.mit.edu Git - linux.git/commit
bpf, s390x: do not reload skb pointers in non-skb context
authorDaniel Borkmann <daniel@iogearbox.net>
Thu, 14 Dec 2017 20:07:23 +0000 (21:07 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 15 Dec 2017 17:19:35 +0000 (09:19 -0800)
commit6d59b7dbf72ed20d0138e2f9b75ca3d4a9d4faca
treeb9781d7d7d52ec54a68e5e70036f181db4603cc6
parent2d17d8d79e77ff3f1b35b87522fc72fa562260ff
bpf, s390x: 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
BPF 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 only. Tested on s390x.

Fixes: 9db7f2b81880 ("s390/bpf: recache skb->data/hlen for skb_vlan_push/pop")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Cc: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
arch/s390/net/bpf_jit_comp.c