syzbot


BUG: unable to handle kernel NULL pointer dereference in __build_skb_around

Status: fixed on 2023/06/08 14:41
Subsystems: net bpf
[Documentation on labels]
Reported-by: syzbot+e1d1b65f7c32f2a86a9f@syzkaller.appspotmail.com
Fix commit: e5995bc7e2ba bpf, test_run: fix crashes due to XDP frame overwriting/corruption
First crash: 574d, last: 569d
Cause bisection: introduced by (bisect log) :
commit 9c94bbf9a87b264294f42e6cc0f76d87854733ec
Author: Alexander Lobakin <aleksander.lobakin@intel.com>
Date: Mon Mar 13 21:55:52 2023 +0000

  xdp: recycle Page Pool backed skbs built from XDP frames

Crash: BUG: unable to handle kernel NULL pointer dereference in __build_skb_around (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[PATCH bpf-next 0/2] double-fix bpf_test_run + XDP_PASS recycling 10 (10) 2023/03/17 13:40
[syzbot] [bpf?] [net?] BUG: unable to handle kernel NULL pointer dereference in __build_skb_around 3 (4) 2023/03/15 12:54
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: user-memory-access Write in __build_skb_around net 2 1032d 1033d 0/28 closed as invalid on 2022/01/10 10:36
upstream KASAN: slab-out-of-bounds Write in __build_skb_around bpf net C error 2536 666d 681d 22/28 fixed on 2023/02/24 13:50

Sample crash report:
BUG: kernel NULL pointer dereference, address: 0000000000000d28
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
PGD 7b741067 P4D 7b741067 PUD 7c1ca067 PMD 0 
Oops: 0002 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 5080 Comm: syz-executor371 Not tainted 6.2.0-syzkaller-13030-g3c2611bac08a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
RIP: 0010:memset_erms+0xd/0x20 arch/x86/lib/memset_64.S:66
Code: 01 48 0f af c6 f3 48 ab 89 d1 f3 aa 4c 89 c8 c3 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 66 0f 1f 00 49 89 f9 40 88 f0 48 89 d1 <f3> aa 4c 89 c8 c3 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 66 0f 1f
RSP: 0018:ffffc90003baf730 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff888028b94000 RCX: 0000000000000020
RDX: 0000000000000020 RSI: 0000000000000000 RDI: 0000000000000d28
RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000d28
R10: ffffed100517281c R11: 0000000000094001 R12: 0000000000000d48
R13: 0000000000000d28 R14: 0000000000000f68 R15: 0000000000000100
FS:  0000555555979300(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000d28 CR3: 0000000028e2d000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 __finalize_skb_around net/core/skbuff.c:321 [inline]
 __build_skb_around+0x232/0x3a0 net/core/skbuff.c:379
 build_skb_around+0x32/0x290 net/core/skbuff.c:444
 __xdp_build_skb_from_frame+0x121/0x760 net/core/xdp.c:622
 xdp_recv_frames net/bpf/test_run.c:248 [inline]
 xdp_test_run_batch net/bpf/test_run.c:334 [inline]
 bpf_test_run_xdp_live+0x1289/0x1930 net/bpf/test_run.c:362
 bpf_prog_test_run_xdp+0xa05/0x14e0 net/bpf/test_run.c:1418
 bpf_prog_test_run kernel/bpf/syscall.c:3675 [inline]
 __sys_bpf+0x1598/0x5100 kernel/bpf/syscall.c:5028
 __do_sys_bpf kernel/bpf/syscall.c:5114 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5112 [inline]
 __x64_sys_bpf+0x79/0xc0 kernel/bpf/syscall.c:5112
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f320b4efca9
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd2c9924d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f320b4efca9
RDX: 0000000000000048 RSI: 0000000020000080 RDI: 000000000000000a
RBP: 00007f320b4b3e50 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f320b4b3ee0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>
Modules linked in:
CR2: 0000000000000d28
---[ end trace 0000000000000000 ]---
RIP: 0010:memset_erms+0xd/0x20 arch/x86/lib/memset_64.S:66
Code: 01 48 0f af c6 f3 48 ab 89 d1 f3 aa 4c 89 c8 c3 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 66 0f 1f 00 49 89 f9 40 88 f0 48 89 d1 <f3> aa 4c 89 c8 c3 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 66 0f 1f
RSP: 0018:ffffc90003baf730 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff888028b94000 RCX: 0000000000000020
RDX: 0000000000000020 RSI: 0000000000000000 RDI: 0000000000000d28
RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000d28
R10: ffffed100517281c R11: 0000000000094001 R12: 0000000000000d48
R13: 0000000000000d28 R14: 0000000000000f68 R15: 0000000000000100
FS:  0000555555979300(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000d28 CR3: 0000000028e2d000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess), 1 bytes skipped:
   0:	48 0f af c6          	imul   %rsi,%rax
   4:	f3 48 ab             	rep stos %rax,%es:(%rdi)
   7:	89 d1                	mov    %edx,%ecx
   9:	f3 aa                	rep stos %al,%es:(%rdi)
   b:	4c 89 c8             	mov    %r9,%rax
   e:	c3                   	retq
   f:	66 66 2e 0f 1f 84 00 	data16 nopw %cs:0x0(%rax,%rax,1)
  16:	00 00 00 00
  1a:	66 90                	xchg   %ax,%ax
  1c:	66 0f 1f 00          	nopw   (%rax)
  20:	49 89 f9             	mov    %rdi,%r9
  23:	40 88 f0             	mov    %sil,%al
  26:	48 89 d1             	mov    %rdx,%rcx
* 29:	f3 aa                	rep stos %al,%es:(%rdi) <-- trapping instruction
  2b:	4c 89 c8             	mov    %r9,%rax
  2e:	c3                   	retq
  2f:	66 66 2e 0f 1f 84 00 	data16 nopw %cs:0x0(%rax,%rax,1)
  36:	00 00 00 00
  3a:	66 90                	xchg   %ax,%ax
  3c:	66                   	data16
  3d:	0f                   	.byte 0xf
  3e:	1f                   	(bad)

Crashes (29):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/03/15 05:14 bpf-next 3c2611bac08a 0d5c4377 .config strace log report syz C ci-upstream-bpf-next-kasan-gce BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/19 06:37 linux-next 6f08c1de13a9 7939252e .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/19 06:17 linux-next 6f08c1de13a9 7939252e .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/15 06:37 bpf-next 3c2611bac08a 0d5c4377 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/15 06:28 bpf-next 3c2611bac08a 0d5c4377 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/15 05:36 bpf-next 3c2611bac08a 0d5c4377 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/15 05:36 bpf-next 3c2611bac08a 0d5c4377 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/15 03:59 bpf-next 3c2611bac08a 0d5c4377 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/15 03:41 bpf-next 3c2611bac08a 0d5c4377 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/15 03:30 bpf-next 3c2611bac08a 0d5c4377 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/15 03:03 bpf-next 3c2611bac08a 0d5c4377 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/15 01:43 bpf-next 3c2611bac08a 0d5c4377 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/15 01:36 bpf-next 3c2611bac08a 0d5c4377 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/15 00:58 bpf-next 3c2611bac08a 0d5c4377 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/15 00:42 bpf-next 3c2611bac08a 0d5c4377 .config console log report info ci-upstream-bpf-next-kasan-gce BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/20 19:54 linux-next 73f2c2a7e1d2 7939252e .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/20 19:47 linux-next 73f2c2a7e1d2 7939252e .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/20 19:46 linux-next 73f2c2a7e1d2 7939252e .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/20 19:46 linux-next 73f2c2a7e1d2 7939252e .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/20 19:43 linux-next 73f2c2a7e1d2 7939252e .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/20 19:38 linux-next 73f2c2a7e1d2 7939252e .config console log report info ci-upstream-linux-next-kasan-gce-root BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/18 13:59 linux-next 6f08c1de13a9 7939252e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/16 11:21 linux-next 6f72958a49f6 18b58603 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/16 07:56 linux-next 6f72958a49f6 18b58603 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/16 07:37 linux-next 6f72958a49f6 18b58603 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/16 07:24 linux-next 6f72958a49f6 18b58603 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/16 06:25 linux-next 6f72958a49f6 18b58603 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/16 06:18 linux-next 6f72958a49f6 18b58603 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
2023/03/16 03:22 linux-next 6f72958a49f6 18b58603 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root BUG: unable to handle kernel NULL pointer dereference in __build_skb_around
* Struck through repros no longer work on HEAD.