syzbot


general protection fault in do_blk_trace_setup

Status: fixed on 2021/11/10 00:50
Subsystems: block trace
[Documentation on labels]
Reported-by: syzbot+f74aa89114a236643919@syzkaller.appspotmail.com
Fix commit: 1d1cf156dc17 sg: pass the device name to blk_trace_setup
First crash: 947d, last: 945d
Cause bisection: introduced by (bisect log) :
commit 45938335d0a9773d65a82a7ca722bb76e4b997a8
Author: Christoph Hellwig <hch@lst.de>
Date: Mon Aug 16 13:19:03 2021 +0000

  st: do not allocate a gendisk

Crash: BUG: sleeping function called from invalid context in lock_sock_nested (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] sg: pass the device name to blk_trace_setup 3 (3) 2021/08/25 12:46
[syzbot] general protection fault in do_blk_trace_setup 1 (2) 2021/08/25 07:55

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: 6540 Comm: syz-executor323 Not tainted 5.14.0-rc7-next-20210824-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:strncpy+0x32/0xb0 lib/string.c:130
Code: 54 55 53 48 83 ec 08 48 85 d2 74 5c 4c 8d 2c 17 48 89 fb 49 bc 00 00 00 00 00 fc ff df 48 89 f0 48 89 f2 48 c1 e8 03 83 e2 07 <42> 0f b6 04 20 38 d0 7f 04 84 c0 75 41 48 89 d8 48 89 da 0f b6 2e
RSP: 0018:ffffc90002d2fb98 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffffc90002d2fc70 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffc90002d2fc70
RBP: 0000000000000000 R08: 0000000000000000 R09: ffffc90002d2fcb7
R10: ffffffff817c66f5 R11: 0000000000000000 R12: dffffc0000000000
R13: ffffc90002d2fc90 R14: ffffc90002d2fc70 R15: ffffc90002d2fc94
FS:  0000000001ff3300(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f5c7fb696c0 CR3: 000000001ae25000 CR4: 00000000001506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 strncpy include/linux/fortify-string.h:59 [inline]
 do_blk_trace_setup+0x113/0xcd0 kernel/trace/blktrace.c:485
 __blk_trace_setup+0xca/0x180 kernel/trace/blktrace.c:589
 blk_trace_setup+0x43/0x60 kernel/trace/blktrace.c:607
 sg_ioctl_common drivers/scsi/sg.c:1122 [inline]
 sg_ioctl+0x252/0x2760 drivers/scsi/sg.c:1164
 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:0x4434b9
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:00007ffd335501e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000004004a0 RCX: 00000000004434b9
RDX: 0000000020000100 RSI: 00000000c0481273 RDI: 0000000000000004
RBP: 0000000000403060 R08: 00000000004004a0 R09: 00000000004004a0
R10: 002367732f766564 R11: 0000000000000246 R12: 00000000004030f0
R13: 0000000000000000 R14: 00000000004b1018 R15: 00000000004004a0
Modules linked in:
---[ end trace c8de7dc978626109 ]---
RIP: 0010:strncpy+0x32/0xb0 lib/string.c:130
Code: 54 55 53 48 83 ec 08 48 85 d2 74 5c 4c 8d 2c 17 48 89 fb 49 bc 00 00 00 00 00 fc ff df 48 89 f0 48 89 f2 48 c1 e8 03 83 e2 07 <42> 0f b6 04 20 38 d0 7f 04 84 c0 75 41 48 89 d8 48 89 da 0f b6 2e
RSP: 0018:ffffc90002d2fb98 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffffc90002d2fc70 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffc90002d2fc70
RBP: 0000000000000000 R08: 0000000000000000 R09: ffffc90002d2fcb7
R10: ffffffff817c66f5 R11: 0000000000000000 R12: dffffc0000000000
R13: ffffc90002d2fc90 R14: ffffc90002d2fc70 R15: ffffc90002d2fc94
FS:  0000000001ff3300(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f8125f40018 CR3: 000000001ae25000 CR4: 00000000001506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	54                   	push   %rsp
   1:	55                   	push   %rbp
   2:	53                   	push   %rbx
   3:	48 83 ec 08          	sub    $0x8,%rsp
   7:	48 85 d2             	test   %rdx,%rdx
   a:	74 5c                	je     0x68
   c:	4c 8d 2c 17          	lea    (%rdi,%rdx,1),%r13
  10:	48 89 fb             	mov    %rdi,%rbx
  13:	49 bc 00 00 00 00 00 	movabs $0xdffffc0000000000,%r12
  1a:	fc ff df
  1d:	48 89 f0             	mov    %rsi,%rax
  20:	48 89 f2             	mov    %rsi,%rdx
  23:	48 c1 e8 03          	shr    $0x3,%rax
  27:	83 e2 07             	and    $0x7,%edx
* 2a:	42 0f b6 04 20       	movzbl (%rax,%r12,1),%eax <-- trapping instruction
  2f:	38 d0                	cmp    %dl,%al
  31:	7f 04                	jg     0x37
  33:	84 c0                	test   %al,%al
  35:	75 41                	jne    0x78
  37:	48 89 d8             	mov    %rbx,%rax
  3a:	48 89 da             	mov    %rbx,%rdx
  3d:	0f b6 2e             	movzbl (%rsi),%ebp

Crashes (25):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/08/24 13:27 linux-next 372b2891c15a b599f2fc .config console log report syz C ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/26 08:13 linux-next 7636510f976d b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/26 07:13 linux-next 7636510f976d b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/26 04:01 linux-next 7636510f976d b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/26 03:09 linux-next 7636510f976d b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/26 03:09 linux-next 7636510f976d b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/26 02:47 linux-next 7636510f976d b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/26 01:59 linux-next 7636510f976d b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/25 20:31 linux-next 7636510f976d b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/25 20:15 linux-next 7636510f976d b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/25 08:42 linux-next 372b2891c15a b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/25 06:31 linux-next 372b2891c15a b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/25 06:16 linux-next 372b2891c15a b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/25 04:04 linux-next 372b2891c15a b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/24 23:26 linux-next 372b2891c15a b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/24 23:14 linux-next 372b2891c15a b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/24 23:13 linux-next 372b2891c15a b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/24 23:08 linux-next 372b2891c15a b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/24 23:08 linux-next 372b2891c15a b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/24 19:29 linux-next 372b2891c15a b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/24 14:59 linux-next 372b2891c15a b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/24 12:29 linux-next 372b2891c15a b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/24 12:18 linux-next 372b2891c15a b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/24 12:02 linux-next 372b2891c15a b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
2021/08/24 10:52 linux-next 372b2891c15a b599f2fc .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in do_blk_trace_setup
* Struck through repros no longer work on HEAD.