]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, sparc: fix usage of wrong reg for load_skb_regs after call
authorDaniel Borkmann <daniel@iogearbox.net>
Thu, 14 Dec 2017 20:07:26 +0000 (21:07 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 15 Dec 2017 17:19:35 +0000 (09:19 -0800)
commit12bab7d5210906a7ae83cf3dd5e1b21bcbb00b32
treefa31f2226634b8f83f00f99bfffd377eb59c270f
parentb16dd19b661918ccc6fdff794c615def73a0540a
bpf, sparc: fix usage of wrong reg for load_skb_regs after call

When LD_ABS/IND is used in the program, and we have a BPF helper
call that changes packet data (bpf_helper_changes_pkt_data() returns
true), then in case of sparc JIT, we try to reload cached skb data
from bpf2sparc[BPF_REG_6]. However, there is no such guarantee or
assumption that skb sits in R6 at this point, all helpers changing
skb data only have a guarantee that skb sits in R1. Therefore,
store BPF R1 in L7 temporarily and after procedure call use L7 to
reload cached skb data. skb sitting in R6 is only true at the time
when LD_ABS/IND is executed.

Fixes: c50eed8edafc ("sparc64: Add eBPF JIT.")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
arch/sparc/net/bpf_jit_comp_64.c