syzbot


general protection fault in check_helper_call

Status: internal: reported C repro on 2022/07/15 13:31
Reported-by: syzbot+@syzkaller.appspotmail.com
Fix commit: d1a6edecc1fd bpf: Check attach_func_proto more carefully in check_return_code
Patched on: [ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 ci-upstream-gce-leak 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 ci-upstream-kmsan-gce-386 ci-upstream-linux-next-kasan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb], missing on: [ci-qemu2-riscv64]
First crash: 198d, last: 193d

Cause bisection: introduced by (bisect log) :
commit 69fd337a975c7e690dfe49d9cb4fe5ba1e6db44e
Author: Stanislav Fomichev <sdf@google.com>
Date: Tue Jun 28 17:43:06 2022 +0000

  bpf: per-cgroup lsm flavor

Crash: general protection fault in check_helper_call (log)
Repro: C syz .config

Sample crash report:
general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
CPU: 1 PID: 3614 Comm: syz-executor119 Not tainted 5.19.0-rc5-syzkaller-01146-gb77ffb30cfc5 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022
RIP: 0010:check_helper_call+0x4af3/0x8f40 kernel/bpf/verifier.c:7335
Code: 48 c1 ea 03 80 3c 02 00 0f 85 b9 38 00 00 48 8b 9b 00 01 00 00 48 b8 00 00 00 00 00 fc ff df 48 8d 7b 08 48 89 fa 48 c1 ea 03 <0f> b6 14 02 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 14
RSP: 0018:ffffc9000319f410 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000001 RSI: ffffffff818d35a2 RDI: 0000000000000008
RBP: ffffc9000319f610 R08: 0000000000000005 R09: 000000000000002b
R10: 000000000000002b R11: 0000000000000001 R12: 000000000000002b
R13: ffffc90000ade070 R14: ffff88801bc1b000 R15: 0000000000000070
FS:  0000555555e3a300(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fc4445f5a70 CR3: 0000000025559000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 do_check kernel/bpf/verifier.c:12304 [inline]
 do_check_common+0x612a/0xd2c0 kernel/bpf/verifier.c:14611
 do_check_main kernel/bpf/verifier.c:14674 [inline]
 bpf_check+0x7444/0xb0d0 kernel/bpf/verifier.c:15244
 bpf_prog_load+0xfb2/0x2250 kernel/bpf/syscall.c:2595
 __sys_bpf+0x133f/0x5750 kernel/bpf/syscall.c:4954
 __do_sys_bpf kernel/bpf/syscall.c:5058 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5056 [inline]
 __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:5056
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x46/0xb0
RIP: 0033:0x7f41a6408c59
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:00007ffd5e9d3e98 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f41a6408c59
RDX: 0000000000000080 RSI: 0000000020000780 RDI: 0000000000000005
RBP: 00007f41a63cce00 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000246 R12: 00007f41a63cce90
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:check_helper_call+0x4af3/0x8f40 kernel/bpf/verifier.c:7335
Code: 48 c1 ea 03 80 3c 02 00 0f 85 b9 38 00 00 48 8b 9b 00 01 00 00 48 b8 00 00 00 00 00 fc ff df 48 8d 7b 08 48 89 fa 48 c1 ea 03 <0f> b6 14 02 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 14
RSP: 0018:ffffc9000319f410 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000001 RSI: ffffffff818d35a2 RDI: 0000000000000008
RBP: ffffc9000319f610 R08: 0000000000000005 R09: 000000000000002b
R10: 000000000000002b R11: 0000000000000001 R12: 000000000000002b
R13: ffffc90000ade070 R14: ffff88801bc1b000 R15: 0000000000000070
FS:  0000555555e3a300(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fc4445f5a70 CR3: 0000000025559000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	48 c1 ea 03          	shr    $0x3,%rdx
   4:	80 3c 02 00          	cmpb   $0x0,(%rdx,%rax,1)
   8:	0f 85 b9 38 00 00    	jne    0x38c7
   e:	48 8b 9b 00 01 00 00 	mov    0x100(%rbx),%rbx
  15:	48 b8 00 00 00 00 00 	movabs $0xdffffc0000000000,%rax
  1c:	fc ff df
  1f:	48 8d 7b 08          	lea    0x8(%rbx),%rdi
  23:	48 89 fa             	mov    %rdi,%rdx
  26:	48 c1 ea 03          	shr    $0x3,%rdx
* 2a:	0f b6 14 02          	movzbl (%rdx,%rax,1),%edx <-- trapping instruction
  2e:	48 89 f8             	mov    %rdi,%rax
  31:	83 e0 07             	and    $0x7,%eax
  34:	83 c0 03             	add    $0x3,%eax
  37:	38 d0                	cmp    %dl,%al
  39:	7c 08                	jl     0x43
  3b:	84 d2                	test   %dl,%dl
  3d:	0f                   	.byte 0xf
  3e:	85                   	.byte 0x85
  3f:	14                   	.byte 0x14

Crashes (4):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-bpf-next-kasan-gce 2022/07/20 07:36 bpf-next b77ffb30cfc5 775344bc .config strace log report syz C general protection fault in check_helper_call
ci-upstream-net-kasan-gce 2022/07/19 23:41 net-next e22c88799f26 72a3cc0c .config strace log report syz C general protection fault in check_helper_call
ci-upstream-net-kasan-gce 2022/07/15 16:15 net-next 459f326e995c 5d921b08 .config strace log report syz C general protection fault in check_helper_call
ci-upstream-bpf-next-kasan-gce 2022/07/15 13:30 bpf-next 96a233e600df 5d921b08 .config strace log report syz C general protection fault in check_helper_call
* Struck through repros no longer work on HEAD.