syzbot


BUG: unable to handle kernel paging request in bpf_prog_ADDR (3)

Status: upstream: reported C repro on 2024/07/13 16:24
Subsystems: bpf net
[Documentation on labels]
Reported-by: syzbot+ad9ec60c8eaf69e6f99c@syzkaller.appspotmail.com
Fix commit: bpf: Fail verification for sign-extension of packet data/data_end/data_meta
Patched on: [ci-upstream-bpf-next-kasan-gce ci-upstream-linux-next-kasan-gce-root], missing on: [ci-qemu-native-arm64-kvm ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-qemu2-riscv64 ci-snapshot-upstream-root ci-upstream-bpf-kasan-gce ci-upstream-gce-arm64 ci-upstream-gce-leak ci-upstream-kasan-badwrites-root ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce-386-root ci-upstream-kmsan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb]
First crash: 57d, last: 56d
Cause bisection: introduced by (bisect log) :
commit 1f1e864b65554e33fe74e3377e58b12f4302f2eb
Author: Yonghong Song <yonghong.song@linux.dev>
Date: Fri Jul 28 01:12:07 2023 +0000

  bpf: Handle sign-extenstin ctx member accesses

Crash: BUG: unable to handle kernel paging request in ___bpf_prog_run (log)
Repro: C syz .config
  
Discussions (4)
Title Replies (including bot) Last reply
[PATCH bpf-next v3 1/2] bpf: Fail verification for sign-extension of packet data/data_end/data_meta 2 (2) 2024/07/24 02:40
[PATCH bpf-next v2 1/2] bpf: Fail verification for sign-extension of packet data/data_end/data_meta 2 (2) 2024/07/23 01:58
[PATCH bpf-next 1/2] bpf: Fail verification for sign-extension of packet data/data_end/data_meta 2 (2) 2024/07/16 19:49
[syzbot] [bpf?] [net?] BUG: unable to handle kernel paging request in bpf_prog_ADDR (3) 1 (2) 2024/07/15 16:45
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream BUG: unable to handle kernel paging request in bpf_prog_ADDR kernel C done 13 1861d 1877d 12/27 fixed on 2019/08/27 17:15
upstream BUG: sleeping function called from invalid context in do_user_addr_fault (2) syz done error 27 788d 1352d 0/27 auto-obsoleted due to no activity on 2023/12/05 09:08
upstream BUG: unable to handle kernel paging request in bpf_prog_ADDR (2) bpf C 3 137d 151d 25/27 fixed on 2024/06/05 13:52
upstream BUG: unable to handle kernel NULL pointer dereference in bpf_prog_ADDR net bpf syz error error 19 1183d 1497d 0/27 auto-obsoleted due to no activity on 2023/04/14 06:50

Sample crash report:
BUG: unable to handle page fault for address: 0000000079d22040
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 800000002946e067 P4D 800000002946e067 PUD 0 
Oops: Oops: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 1 PID: 5091 Comm: syz-executor122 Not tainted 6.10.0-rc7-syzkaller-00133-g8b9b59e27aa8 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
RIP: 0010:bpf_prog_82ec301e76077160+0x5c/0xa0
Code: 0a b8 02 00 00 00 41 5d 5b c9 c3 48 89 df 48 8b b7 d8 00 00 00 48 63 f6 48 8b 57 50 48 89 f0 48 83 c0 08 48 39 c2 77 02 eb dc <48> 0f b7 5e 00 4c 0f bf eb 48 81 fb 0f ff 07 00 74 00 48 c1 e3 20
RSP: 0018:ffffc900039a7980 EFLAGS: 00010292
RAX: 0000000079d22048 RBX: 0000000000000000 RCX: ffff888073238000
RDX: ffff888079d22050 RSI: 0000000079d22040 RDI: ffff88801f507b40
RBP: ffffc900039a7990 R08: ffffffff8183cf51 R09: 1ffffffff1f5b295
R10: dffffc0000000000 R11: ffffffffa0001d58 R12: ffffffff8998404e
R13: dffffc0000000000 R14: ffffc90000ace030 R15: ffffc90000ace020
FS:  00005555802b4380(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000079d22040 CR3: 0000000071598000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 bpf_dispatcher_nop_func include/linux/bpf.h:1243 [inline]
 __bpf_prog_run include/linux/filter.h:691 [inline]
 bpf_prog_run include/linux/filter.h:698 [inline]
 bpf_test_run+0x409/0x910 net/bpf/test_run.c:425
 bpf_prog_test_run_skb+0xafa/0x13a0 net/bpf/test_run.c:1072
 bpf_prog_test_run+0x33a/0x3b0 kernel/bpf/syscall.c:4292
 __sys_bpf+0x48d/0x810 kernel/bpf/syscall.c:5706
 __do_sys_bpf kernel/bpf/syscall.c:5795 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5793 [inline]
 __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5793
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f126d02bbb9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 c1 17 00 00 90 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:00007ffec30f1c48 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f126d02bbb9
RDX: 000000000000004c RSI: 0000000020000240 RDI: 000000000000000a
RBP: 0000000000000000 R08: 0000000000000006 R09: 0000000000000006
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000001 R15: 0000000000000001
 </TASK>
Modules linked in:
CR2: 0000000079d22040
---[ end trace 0000000000000000 ]---
RIP: 0010:bpf_prog_82ec301e76077160+0x5c/0xa0
Code: 0a b8 02 00 00 00 41 5d 5b c9 c3 48 89 df 48 8b b7 d8 00 00 00 48 63 f6 48 8b 57 50 48 89 f0 48 83 c0 08 48 39 c2 77 02 eb dc <48> 0f b7 5e 00 4c 0f bf eb 48 81 fb 0f ff 07 00 74 00 48 c1 e3 20
RSP: 0018:ffffc900039a7980 EFLAGS: 00010292
RAX: 0000000079d22048 RBX: 0000000000000000 RCX: ffff888073238000
RDX: ffff888079d22050 RSI: 0000000079d22040 RDI: ffff88801f507b40
RBP: ffffc900039a7990 R08: ffffffff8183cf51 R09: 1ffffffff1f5b295
R10: dffffc0000000000 R11: ffffffffa0001d58 R12: ffffffff8998404e
R13: dffffc0000000000 R14: ffffc90000ace030 R15: ffffc90000ace020
FS:  00005555802b4380(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000079d22040 CR3: 0000000071598000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	0a b8 02 00 00 00    	or     0x2(%rax),%bh
   6:	41 5d                	pop    %r13
   8:	5b                   	pop    %rbx
   9:	c9                   	leave
   a:	c3                   	ret
   b:	48 89 df             	mov    %rbx,%rdi
   e:	48 8b b7 d8 00 00 00 	mov    0xd8(%rdi),%rsi
  15:	48 63 f6             	movslq %esi,%rsi
  18:	48 8b 57 50          	mov    0x50(%rdi),%rdx
  1c:	48 89 f0             	mov    %rsi,%rax
  1f:	48 83 c0 08          	add    $0x8,%rax
  23:	48 39 c2             	cmp    %rax,%rdx
  26:	77 02                	ja     0x2a
  28:	eb dc                	jmp    0x6
* 2a:	48 0f b7 5e 00       	movzwq 0x0(%rsi),%rbx <-- trapping instruction
  2f:	4c 0f bf eb          	movswq %bx,%r13
  33:	48 81 fb 0f ff 07 00 	cmp    $0x7ff0f,%rbx
  3a:	74 00                	je     0x3c
  3c:	48 c1 e3 20          	shl    $0x20,%rbx

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/07/13 06:11 bpf 8b9b59e27aa8 eaeb5c15 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce BUG: unable to handle kernel paging request in bpf_prog_ADDR
2024/07/13 04:51 bpf 8b9b59e27aa8 eaeb5c15 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce BUG: unable to handle kernel paging request in bpf_prog_ADDR
2024/07/13 03:26 bpf 8b9b59e27aa8 eaeb5c15 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce BUG: unable to handle kernel paging request in bpf_prog_ADDR
2024/07/13 02:03 bpf 8b9b59e27aa8 eaeb5c15 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce BUG: unable to handle kernel paging request in bpf_prog_ADDR
2024/07/13 00:40 bpf 8b9b59e27aa8 eaeb5c15 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce BUG: unable to handle kernel paging request in bpf_prog_ADDR
2024/07/12 23:16 bpf 8b9b59e27aa8 eaeb5c15 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce BUG: unable to handle kernel paging request in bpf_prog_ADDR
* Struck through repros no longer work on HEAD.