mbox series

[bpf,0/5] Couple of BPF JIT fixes

Message ID 20171214200727.22230-1-daniel@iogearbox.net
Headers show
Series Couple of BPF JIT fixes | expand

Message

Daniel Borkmann Dec. 14, 2017, 8:07 p.m. UTC
Two fixes that deal with buggy usage of bpf_helper_changes_pkt_data()
in the sense that they also reload cached skb data when there's no
skb context but xdp one, for example. A fix where skb meta data is
reloaded out of the wrong register on helper call, rest is test cases
and making sure on verifier side that there's always the guarantee
that ctx sits in r1. Thanks!

Daniel Borkmann (5):
  bpf, s390x: do not reload skb pointers in non-skb context
  bpf, ppc64: do not reload skb pointers in non-skb context
  bpf: guarantee r1 to be ctx in case of bpf_helper_changes_pkt_data
  bpf, sparc: fix usage of wrong reg for load_skb_regs after call
  bpf: add test case for ld_abs and helper changing pkt data

 arch/powerpc/net/bpf_jit_comp64.c           |  6 ++--
 arch/s390/net/bpf_jit_comp.c                | 11 ++++----
 arch/sparc/net/bpf_jit_comp_64.c            |  6 ++--
 kernel/bpf/verifier.c                       |  6 ++++
 lib/test_bpf.c                              | 43 +++++++++++++++++++++++++++++
 tools/testing/selftests/bpf/test_verifier.c | 24 ++++++++++++++++
 6 files changed, 86 insertions(+), 10 deletions(-)

Comments

Alexei Starovoitov Dec. 15, 2017, 5:28 p.m. UTC | #1
On Thu, Dec 14, 2017 at 09:07:22PM +0100, Daniel Borkmann wrote:
> Two fixes that deal with buggy usage of bpf_helper_changes_pkt_data()
> in the sense that they also reload cached skb data when there's no
> skb context but xdp one, for example. A fix where skb meta data is
> reloaded out of the wrong register on helper call, rest is test cases
> and making sure on verifier side that there's always the guarantee
> that ctx sits in r1. Thanks!

Applied, thanks Daniel!