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: 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>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2018-02-01 07:43:56 -08:00
..
2017-11-16 14:05:12 -08:00
2017-11-14 16:49:31 -08:00
2018-01-08 11:03:35 +00:00
2017-11-15 14:54:53 -08:00
2018-01-29 09:58:36 +01:00
2017-11-13 21:14:07 -08:00
2018-01-29 11:30:16 -08:00
2018-01-02 13:59:16 -05:00
2017-11-30 16:55:35 +00:00
2017-11-15 13:28:48 -08:00
2017-09-07 21:11:05 -07:00
2017-11-15 18:21:04 -08:00
2018-01-03 14:03:48 +01:00
2018-01-30 13:57:43 -08:00
2017-11-13 21:05:31 -08:00
2017-11-17 09:51:57 -08:00
2017-11-27 16:19:56 -05:00
2018-01-25 14:10:39 -08:00
2017-11-13 01:41:20 +01:00
2018-01-31 10:18:00 -08:00
2018-01-29 09:08:34 -08:00
2017-11-15 18:21:06 -08:00
2018-01-17 11:30:16 +00:00
2017-11-17 14:58:01 -08:00
2017-11-15 18:21:05 -08:00
2017-11-17 09:51:57 -08:00
2017-12-29 21:13:04 +01:00
2018-01-29 09:08:34 -08:00
2017-11-15 18:21:01 -08:00
2017-11-17 16:10:04 -08:00
2017-10-12 15:41:05 +02:00
2017-11-15 18:21:01 -08:00
2017-12-01 13:09:40 -08:00
2017-10-07 10:45:02 -06:00
2017-08-28 20:51:22 +02:00
2018-01-03 11:00:22 -05:00
2017-11-15 18:21:04 -08:00
2017-11-17 09:51:57 -08:00
2017-11-15 13:46:33 -08:00
2017-11-17 14:18:00 -08:00
2017-11-17 14:18:00 -08:00
2017-11-17 16:10:00 -08:00
2017-11-15 15:01:28 -08:00
2017-12-14 16:00:49 -08:00
2017-11-15 18:21:03 -08:00
2017-11-15 18:21:06 -08:00
2017-11-09 10:23:28 +01:00
2017-11-17 16:10:04 -08:00
2017-11-17 16:10:04 -08:00
2017-11-13 01:33:48 +01:00
2017-12-16 02:05:48 +01:00
2017-11-27 16:19:55 -05:00
2017-11-17 20:14:10 -08:00
2018-01-29 10:59:24 -08:00
2017-11-07 12:22:21 +01:00
2017-11-27 16:19:55 -05:00
2017-11-15 20:42:10 -08:00
2018-01-29 12:02:54 -05:00
2017-11-15 18:21:01 -08:00
2017-11-15 18:21:06 -08:00
2017-11-15 18:21:01 -08:00
2018-01-18 11:56:49 +01:00
2018-01-15 09:35:45 +01:00
2017-10-11 22:36:54 -04:00
2017-11-14 18:01:46 -08:00
2017-10-04 10:29:22 +02:00
2017-11-27 16:19:54 -05:00