public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat•com>
To: Daniel Borkmann <daniel@iogearbox•net>
Cc: brouer@redhat•com, alexei.starovoitov@gmail•com, netdev@vger•kernel.org
Subject: Re: [PATCH bpf v2] bpf: fix null pointer deref in bpf_prog_test_run_xdp
Date: Wed, 31 Jan 2018 15:52:12 +0100	[thread overview]
Message-ID: <20180131155212.173a1360@redhat.com> (raw)
In-Reply-To: <20180131115856.2965-1-daniel@iogearbox.net>

On Wed, 31 Jan 2018 12:58:56 +0100
Daniel Borkmann <daniel@iogearbox•net> wrote:

> syzkaller was able to generate the following XDP program ...
> 
>   (18) r0 = 0x0
>   (61) r5 = *(u32 *)(r1 +12)
>   (04) (u32) r0 += (u32) 0
>   (95) exit
> 
> ... and trigger a NULL pointer dereference in ___bpf_prog_run()
> via bpf_prog_test_run_xdp() where this was attempted to run.
> 
> Reason is that recent xdp_rxq_info addition to XDP programs
> updated all drivers, but not bpf_prog_test_run_xdp(), where
> xdp_buff is set up. Thus when context rewriter does the deref
> on the netdev it's NULL at runtime. Fix it by using xdp_rxq
> from loopback dev. __netif_get_rx_queue() helper can also be
> reused in various other locations later on.
> 
> Fixes: 02dd3291b2f0 ("bpf: finally expose xdp_rxq_info to XDP bpf-programs")
> Reported-by: syzbot+1eb094057b338eb1fc00@syzkaller•appspotmail.com
> Signed-off-by: Daniel Borkmann <daniel@iogearbox•net>
> Cc: Jesper Dangaard Brouer <brouer@redhat•com>

Acked-by: Jesper Dangaard Brouer <brouer@redhat•com>

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

  reply	other threads:[~2018-01-31 14:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-31 11:58 [PATCH bpf v2] bpf: fix null pointer deref in bpf_prog_test_run_xdp Daniel Borkmann
2018-01-31 14:52 ` Jesper Dangaard Brouer [this message]
2018-02-01 15:49 ` Alexei Starovoitov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180131155212.173a1360@redhat.com \
    --to=brouer@redhat$(echo .)com \
    --cc=alexei.starovoitov@gmail$(echo .)com \
    --cc=daniel@iogearbox$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox