syzbot


general protection fault in bpf_check (2)

Status: upstream: reported C repro on 2024/03/22 19:13
Subsystems: bpf
[Documentation on labels]
Reported-by: syzbot+ba82760c63ba37799f70@syzkaller.appspotmail.com
First crash: 35d, last: 24d
Cause bisection: introduced by (bisect log) :
commit 6082b6c328b5486da2b356eae94b8b83c98b5565
Author: Alexei Starovoitov <ast@kernel.org>
Date: Fri Mar 8 01:08:03 2024 +0000

  bpf: Recognize addr_space_cast instruction in the verifier.

Crash: BUG: unable to handle kernel NULL pointer dereference in bpf_check (log)
Repro: C syz .config
  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [bpf?] general protection fault in bpf_check (2) 1 (3) 2024/03/24 08:37
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream general protection fault in bpf_check bpf 3 2363d 2368d 3/26 fixed on 2017/11/28 03:36
Last patch testing requests (4)
Created Duration User Patch Repo Result
2024/04/17 06:10 21m retest repro bpf-next error OK
2024/04/17 06:10 21m retest repro net error OK
2024/04/17 06:10 21m retest repro bpf error OK
2024/04/17 06:10 32m retest repro net-next error OK

Sample crash report:
general protection fault, probably for non-canonical address 0xdffffc0000000006: 0000 [#1] PREEMPT SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000000000037]
CPU: 1 PID: 5066 Comm: syz-executor115 Not tainted 6.8.0-syzkaller-05232-gddb2ffdc474a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
RIP: 0010:do_misc_fixups kernel/bpf/verifier.c:19609 [inline]
RIP: 0010:bpf_check+0xa19b/0x19010 kernel/bpf/verifier.c:21294
Code: 48 c1 e8 03 80 3c 08 00 74 12 48 89 df e8 2d 93 50 00 48 b9 00 00 00 00 00 fc ff df 48 8b 1b 48 83 c3 30 48 89 d8 48 c1 e8 03 <0f> b6 04 08 84 c0 0f 85 e3 4c 00 00 8b 1b be 00 00 04 00 21 de 31
RSP: 0018:ffffc900039671e0 EFLAGS: 00010206
RAX: 0000000000000006 RBX: 0000000000000030 RCX: dffffc0000000000
RDX: ffff888018358000 RSI: 0000000000010000 RDI: 0000000000000001
RBP: ffffc90003967b50 R08: ffffffff81a7a128 R09: ffffffff81a7a365
R10: 0000000000000004 R11: ffff888018358000 R12: ffffc90000ace072
R13: 1ffff92000159c0e R14: 1ffff92000159c0e R15: 0000000000010000
FS:  000055555905c380(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000111ed398 CR3: 000000002258e000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 bpf_prog_load+0x1667/0x20f0 kernel/bpf/syscall.c:2895
 __sys_bpf+0x4ee/0x810 kernel/bpf/syscall.c:5631
 __do_sys_bpf kernel/bpf/syscall.c:5738 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5736 [inline]
 __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5736
 do_syscall_64+0xfb/0x240
 entry_SYSCALL_64_after_hwframe+0x6d/0x75
RIP: 0033:0x7f425974e3e9
Code: 48 83 c4 28 c3 e8 37 17 00 00 0f 1f 80 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe73dd9d38 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007ffe73dd9f18 RCX: 00007f425974e3e9
RDX: 0000000000000090 RSI: 00000000200000c0 RDI: 0000000000000005
RBP: 00007f42597c1610 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffe73dd9f08 R14: 0000000000000001 R15: 0000000000000001
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:do_misc_fixups kernel/bpf/verifier.c:19609 [inline]
RIP: 0010:bpf_check+0xa19b/0x19010 kernel/bpf/verifier.c:21294
Code: 48 c1 e8 03 80 3c 08 00 74 12 48 89 df e8 2d 93 50 00 48 b9 00 00 00 00 00 fc ff df 48 8b 1b 48 83 c3 30 48 89 d8 48 c1 e8 03 <0f> b6 04 08 84 c0 0f 85 e3 4c 00 00 8b 1b be 00 00 04 00 21 de 31
RSP: 0018:ffffc900039671e0 EFLAGS: 00010206
RAX: 0000000000000006 RBX: 0000000000000030 RCX: dffffc0000000000
RDX: ffff888018358000 RSI: 0000000000010000 RDI: 0000000000000001
RBP: ffffc90003967b50 R08: ffffffff81a7a128 R09: ffffffff81a7a365
R10: 0000000000000004 R11: ffff888018358000 R12: ffffc90000ace072
R13: 1ffff92000159c0e R14: 1ffff92000159c0e R15: 0000000000010000
FS:  000055555905c380(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000111ed398 CR3: 000000002258e000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	48 c1 e8 03          	shr    $0x3,%rax
   4:	80 3c 08 00          	cmpb   $0x0,(%rax,%rcx,1)
   8:	74 12                	je     0x1c
   a:	48 89 df             	mov    %rbx,%rdi
   d:	e8 2d 93 50 00       	call   0x50933f
  12:	48 b9 00 00 00 00 00 	movabs $0xdffffc0000000000,%rcx
  19:	fc ff df
  1c:	48 8b 1b             	mov    (%rbx),%rbx
  1f:	48 83 c3 30          	add    $0x30,%rbx
  23:	48 89 d8             	mov    %rbx,%rax
  26:	48 c1 e8 03          	shr    $0x3,%rax
* 2a:	0f b6 04 08          	movzbl (%rax,%rcx,1),%eax <-- trapping instruction
  2e:	84 c0                	test   %al,%al
  30:	0f 85 e3 4c 00 00    	jne    0x4d19
  36:	8b 1b                	mov    (%rbx),%ebx
  38:	be 00 00 04 00       	mov    $0x40000,%esi
  3d:	21 de                	and    %ebx,%esi
  3f:	31                   	.byte 0x31

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/03/22 17:36 bpf ddb2ffdc474a 7a239ce7 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce general protection fault in bpf_check
2024/03/22 14:42 net f99c5f563c17 7a239ce7 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce general protection fault in bpf_check
2024/03/22 22:00 bpf-next 4c2a26fc80bc 7a239ce7 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-bpf-next-kasan-gce general protection fault in bpf_check
2024/03/22 11:58 net-next 237bb5f7f7f5 7a239ce7 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce general protection fault in bpf_check
2024/04/02 21:04 bpf-next 14bb1e8c8d4a 6baf5069 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-bpf-next-kasan-gce general protection fault in bpf_check
2024/03/31 22:06 bpf-next 14bb1e8c8d4a 6baf5069 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-bpf-next-kasan-gce general protection fault in bpf_check
2024/03/22 11:31 net-next 237bb5f7f7f5 7a239ce7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce general protection fault in bpf_check
* Struck through repros no longer work on HEAD.