Files
Linux/include/linux
Daniel Borkmann 65073a6733 bpf: fix null pointer deref in bpf_prog_test_run_xdp
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: 02dd3291b2 ("bpf: finally expose xdp_rxq_info to XDP bpf-programs")
Reported-by: [email protected]
Signed-off-by: Daniel Borkmann <[email protected]>
Cc: Jesper Dangaard Brouer <[email protected]>
Acked-by: Jesper Dangaard Brouer <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
2018-02-01 07:43:56 -08:00
..
…
…
…
…
…
…
…
…
…
…
…
2018-01-08 11:03:35 +00:00
…
…
…
…
2018-01-02 13:59:16 -05:00
…
…
…
2017-11-30 16:55:35 +00:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-01-03 14:03:48 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-11-27 16:19:56 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-01-25 14:10:39 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-01-17 11:30:16 +00:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-12-29 21:13:04 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-12-01 13:09:40 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-01-03 11:00:22 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-12-14 16:00:49 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-12-16 02:05:48 +01:00
…
…
…
…
2017-11-27 16:19:55 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-11-27 16:19:55 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-01-29 12:02:54 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-01-18 11:56:49 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
2018-01-15 09:35:45 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-11-27 16:19:54 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…