syzbot


general protection fault in scsi_queue_rq

Status: fixed on 2022/03/08 16:11
Subsystems: fuse scsi
[Documentation on labels]
Reported-by: syzbot+0796b72dc61f223d8cc5@syzkaller.appspotmail.com
Fix commit: 20aaef52eb08 scsi: scsi_ioctl: Validate command size
First crash: 1462d, last: 1063d
Cause bisection: introduced by (bisect log) :
commit 2ceda20f0a99a74a82b78870f3b3e5fa93087a7f
Author: Christoph Hellwig <hch@lst.de>
Date: Mon Oct 5 08:41:23 2020 +0000

  scsi: core: Move command size detection out of the fast path

Crash: BUG: unable to handle kernel NULL pointer dereference in scsi_queue_rq (log)
Repro: C syz .config
  
Fix bisection: fixed by (bisect log) :
commit 20aaef52eb08f1d987d46ad26edb8f142f74d83a
Author: Tadeusz Struk <tadeusz.struk@linaro.org>
Date: Wed Nov 3 17:06:58 2021 +0000

  scsi: scsi_ioctl: Validate command size

  
Discussions (1)
Title Replies (including bot) Last reply
general protection fault in scsi_queue_rq 2 (5) 2021/12/13 07:13
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 general protection fault in scsi_queue_rq C error 3 1051d 1076d 1/2 fixed on 2021/12/01 19:46
Last patch testing requests (3)
Created Duration User Patch Repo Result
2020/10/13 23:19 16m jejb@linux.ibm.com git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-misc OK
2020/10/13 23:10 17m jejb@linux.ibm.com git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-misc OK
2020/10/12 23:27 17m anmol.karan123@gmail.com upstream OK

Sample crash report:
general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
CPU: 1 PID: 6508 Comm: syz-executor963 Not tainted 5.15.0-rc5-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:scsi_command_size include/scsi/scsi_common.h:24 [inline]
RIP: 0010:scsi_setup_scsi_cmnd drivers/scsi/scsi_lib.c:1178 [inline]
RIP: 0010:scsi_prepare_cmd drivers/scsi/scsi_lib.c:1564 [inline]
RIP: 0010:scsi_queue_rq+0x268a/0x3470 drivers/scsi/scsi_lib.c:1670
Code: 00 fc ff df 48 c1 ea 03 80 3c 02 00 0f 85 4d 0d 00 00 4c 8b b3 58 02 00 00 48 b8 00 00 00 00 00 fc ff df 4c 89 f2 48 c1 ea 03 <0f> b6 04 02 4c 89 f2 83 e2 07 38 d0 7f 08 84 c0 0f 85 25 0c 00 00
RSP: 0018:ffffc9000528f530 EFLAGS: 00010256
RAX: dffffc0000000000 RBX: ffff88801e03d400 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff8486b687 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
R10: ffffffff8486b672 R11: 0000000000000000 R12: ffff88801e03d658
R13: 0000000000000000 R14: 0000000000000000 R15: ffff88801ac9c000
FS:  00007ff410e6c700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1e00d39740 CR3: 000000004213b000 CR4: 0000000000350ee0
Call Trace:
 blk_mq_dispatch_rq_list+0x422/0x1f00 block/blk-mq.c:1360
 __blk_mq_sched_dispatch_requests+0x20b/0x410 block/blk-mq-sched.c:327
 blk_mq_sched_dispatch_requests+0xfb/0x180 block/blk-mq-sched.c:360
 __blk_mq_run_hw_queue+0xd8/0x150 block/blk-mq.c:1480
 __blk_mq_delay_run_hw_queue+0x547/0x640 block/blk-mq.c:1557
 blk_mq_run_hw_queue+0x16c/0x2f0 block/blk-mq.c:1610
 blk_mq_sched_insert_request+0x368/0x450 block/blk-mq-sched.c:479
 blk_execute_rq+0xdc/0x410 block/blk-exec.c:96
 sg_io+0x678/0x10e0 drivers/scsi/scsi_ioctl.c:484
 scsi_ioctl_sg_io drivers/scsi/scsi_ioctl.c:872 [inline]
 scsi_ioctl+0xa77/0x15d0 drivers/scsi/scsi_ioctl.c:928
 sd_ioctl+0x1a6/0x2b0 drivers/scsi/sd.c:1576
 blkdev_ioctl+0x2a1/0x700 block/ioctl.c:589
 block_ioctl+0xfa/0x140 block/fops.c:478
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl fs/ioctl.c:860 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860
 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+0x44/0xae
RIP: 0033:0x7ff410eba599
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 81 14 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:00007ff410e6c2f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007ff410f444c0 RCX: 00007ff410eba599
RDX: 0000000020002300 RSI: 0000000000002285 RDI: 0000000000000004
RBP: 00007ff410f12034 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000003
R13: 00007ff410f12054 R14: 2f30656c69662f2e R15: 00007ff410f444c8
Modules linked in:
---[ end trace 6a5b9ccf7d777fc6 ]---
RIP: 0010:scsi_command_size include/scsi/scsi_common.h:24 [inline]
RIP: 0010:scsi_setup_scsi_cmnd drivers/scsi/scsi_lib.c:1178 [inline]
RIP: 0010:scsi_prepare_cmd drivers/scsi/scsi_lib.c:1564 [inline]
RIP: 0010:scsi_queue_rq+0x268a/0x3470 drivers/scsi/scsi_lib.c:1670
Code: 00 fc ff df 48 c1 ea 03 80 3c 02 00 0f 85 4d 0d 00 00 4c 8b b3 58 02 00 00 48 b8 00 00 00 00 00 fc ff df 4c 89 f2 48 c1 ea 03 <0f> b6 04 02 4c 89 f2 83 e2 07 38 d0 7f 08 84 c0 0f 85 25 0c 00 00
RSP: 0018:ffffc9000528f530 EFLAGS: 00010256
RAX: dffffc0000000000 RBX: ffff88801e03d400 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff8486b687 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
R10: ffffffff8486b672 R11: 0000000000000000 R12: ffff88801e03d658
R13: 0000000000000000 R14: 0000000000000000 R15: ffff88801ac9c000
FS:  00007ff410e6c700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1e00d39740 CR3: 000000004213b000 CR4: 0000000000350ee0
----------------
Code disassembly (best guess), 4 bytes skipped:
   0:	48 c1 ea 03          	shr    $0x3,%rdx
   4:	80 3c 02 00          	cmpb   $0x0,(%rdx,%rax,1)
   8:	0f 85 4d 0d 00 00    	jne    0xd5b
   e:	4c 8b b3 58 02 00 00 	mov    0x258(%rbx),%r14
  15:	48 b8 00 00 00 00 00 	movabs $0xdffffc0000000000,%rax
  1c:	fc ff df
  1f:	4c 89 f2             	mov    %r14,%rdx
  22:	48 c1 ea 03          	shr    $0x3,%rdx
* 26:	0f b6 04 02          	movzbl (%rdx,%rax,1),%eax <-- trapping instruction
  2a:	4c 89 f2             	mov    %r14,%rdx
  2d:	83 e2 07             	and    $0x7,%edx
  30:	38 d0                	cmp    %dl,%al
  32:	7f 08                	jg     0x3c
  34:	84 c0                	test   %al,%al
  36:	0f 85 25 0c 00 00    	jne    0xc61

Crashes (4000):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/10/15 17:56 upstream ec681c53f8d2 0c5d9412 .config console log report syz C ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/02/12 02:59 upstream 291009f656e8 a5f86b15 .config console log report syz C ci-upstream-kasan-gce-selinux-root general protection fault in scsi_queue_rq
2021/02/01 01:33 upstream 6642d600b541 fc9fd31e .config console log report syz C ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/03/29 02:59 linux-next 931294922e65 a8529b82 .config console log report syz C ci-upstream-linux-next-kasan-gce-root general protection fault in scsi_queue_rq
2020/10/08 21:42 linux-next e4fb79c771fb 92390980 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2021/11/11 18:41 upstream debe436e77c7 75b04091 .config console log report info ci-qemu-upstream general protection fault in scsi_queue_rq
2021/11/05 04:26 upstream 7ddb58cb0eca 4c1be0be .config console log report info ci-qemu-upstream general protection fault in scsi_queue_rq
2021/11/02 16:03 upstream bfc484fe6abb 098b5d53 .config console log report info ci-upstream-kasan-gce-smack-root general protection fault in scsi_queue_rq
2021/10/30 16:28 upstream f25a5481af12 098b5d53 .config console log report info ci-upstream-kasan-gce-smack-root general protection fault in scsi_queue_rq
2021/10/26 23:10 upstream 3906fe9bb7f1 d50eb50a .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/24 23:39 upstream 6c62666d8879 282f03fb .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/24 00:44 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/22 12:21 upstream 2f111a6fd5b5 55f90bc6 .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/21 06:31 upstream 8e37395c3a5d f111d03b .config console log report info ci-upstream-kasan-gce-selinux-root general protection fault in scsi_queue_rq
2021/10/21 06:07 upstream 8e37395c3a5d f111d03b .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/21 04:28 upstream 8e37395c3a5d f111d03b .config console log report info ci-upstream-kasan-gce-selinux-root general protection fault in scsi_queue_rq
2021/10/20 13:58 upstream d9abdee5fd5a 418a00eb .config console log report info ci-upstream-kasan-gce-smack-root general protection fault in scsi_queue_rq
2021/10/20 12:49 upstream d9abdee5fd5a 418a00eb .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/20 07:33 upstream d9abdee5fd5a 466b7db1 .config console log report info ci-upstream-kasan-gce-selinux-root general protection fault in scsi_queue_rq
2021/10/20 03:27 upstream d9abdee5fd5a 466b7db1 .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/19 06:30 upstream 519d81956ee2 24dc29db .config console log report info ci-upstream-kasan-gce-selinux-root general protection fault in scsi_queue_rq
2021/10/17 23:10 upstream d999ade1cc86 0c5d9412 .config console log report info ci-upstream-kasan-gce-selinux-root general protection fault in scsi_queue_rq
2021/10/17 22:00 upstream d999ade1cc86 0c5d9412 .config console log report info ci-upstream-kasan-gce-selinux-root general protection fault in scsi_queue_rq
2021/10/17 16:29 upstream d999ade1cc86 0c5d9412 .config console log report info ci-upstream-kasan-gce-selinux-root general protection fault in scsi_queue_rq
2021/10/17 06:21 upstream 304040fb4909 0c5d9412 .config console log report info ci-qemu-upstream general protection fault in scsi_queue_rq
2021/10/16 18:28 upstream 8fe31e0995f0 0c5d9412 .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/16 07:11 upstream 8fe31e0995f0 0c5d9412 .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/15 23:01 upstream ec681c53f8d2 0c5d9412 .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/14 17:55 upstream 26d657410983 5462d470 .config console log report info ci-upstream-kasan-gce-smack-root general protection fault in scsi_queue_rq
2021/10/14 07:41 upstream 348949d9a444 5462d470 .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/14 03:13 upstream 348949d9a444 5462d470 .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/14 01:22 upstream 348949d9a444 5462d470 .config console log report info ci-upstream-kasan-gce-selinux-root general protection fault in scsi_queue_rq
2021/10/14 00:21 upstream 348949d9a444 5462d470 .config console log report info ci-upstream-kasan-gce-smack-root general protection fault in scsi_queue_rq
2021/10/14 00:21 upstream 348949d9a444 5462d470 .config console log report info ci-upstream-kasan-gce-smack-root general protection fault in scsi_queue_rq
2021/10/13 23:17 upstream 348949d9a444 5462d470 .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/12 07:58 upstream fa5878760579 838e7e2c .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/07 13:09 upstream 5af4055fa813 62ee0987 .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/07 01:26 upstream 60a9483534ed 62ee0987 .config console log report info ci-upstream-kasan-gce-selinux-root general protection fault in scsi_queue_rq
2021/10/06 15:35 upstream 60a9483534ed 0a63fd36 .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/05 00:04 upstream 84b3e42564ac ce697b49 .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/04 10:09 upstream 9e1ff307c779 ce697b49 .config console log report info ci-upstream-kasan-gce-selinux-root general protection fault in scsi_queue_rq
2021/10/03 02:40 upstream ab2a7a35c4e7 db0f5787 .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/03 01:14 upstream ab2a7a35c4e7 db0f5787 .config console log report info ci-upstream-kasan-gce-selinux-root general protection fault in scsi_queue_rq
2021/10/02 21:20 upstream ab2a7a35c4e7 db0f5787 .config console log report info ci-upstream-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/02 18:30 upstream 53d5fc89d66a db0f5787 .config console log report info ci-upstream-kasan-gce-smack-root general protection fault in scsi_queue_rq
2021/11/09 04:10 upstream e851dfae4371 8ab17e57 .config console log report info ci-qemu-upstream-386 general protection fault in scsi_queue_rq
2021/11/05 10:25 upstream d4439a1189f9 4c1be0be .config console log report info ci-qemu-upstream-386 general protection fault in scsi_queue_rq
2021/11/04 13:52 upstream ce840177930f 4c1be0be .config console log report info ci-qemu-upstream-386 general protection fault in scsi_queue_rq
2021/10/19 22:49 upstream d9abdee5fd5a 466b7db1 .config console log report info ci-qemu-upstream-386 general protection fault in scsi_queue_rq
2021/10/19 17:17 upstream d9abdee5fd5a 466b7db1 .config console log report info ci-qemu-upstream-386 general protection fault in scsi_queue_rq
2021/10/19 06:35 upstream 519d81956ee2 24dc29db .config console log report info ci-qemu-upstream-386 general protection fault in scsi_queue_rq
2021/10/28 07:54 linux-next ae5179317e79 be531bb4 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/23 11:49 linux-next cf6c9d12750c 282f03fb .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/17 19:10 linux-next 7c832d2f9b95 0c5d9412 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/17 17:42 linux-next 7c832d2f9b95 0c5d9412 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/16 06:02 linux-next 7c832d2f9b95 0c5d9412 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/15 00:13 linux-next 8006b911c90a 7aa5fe41 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/12 06:47 linux-next d3134eb5de85 838e7e2c .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/11 02:42 linux-next 683f29b781ae 838e7e2c .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/10 05:39 linux-next 683f29b781ae 838e7e2c .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/10 05:39 linux-next 683f29b781ae 838e7e2c .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/08 03:56 linux-next f8dc23b3dc0c efe0f24d .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/07 01:13 linux-next 0dda5ee37364 62ee0987 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/04 01:43 linux-next a25006a77348 db0f5787 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in scsi_queue_rq
2021/10/02 18:49 linux-next a25006a77348 db0f5787 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in scsi_queue_rq
2021/01/17 10:23 upstream 0da0a8a0a0e1 65a7a854 .config console log report info ci-upstream-kasan-gce-selinux-root
2020/10/08 14:44 linux-next e4fb79c771fb 92390980 .config console log report info ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.