syzbot


KASAN: wild-memory-access Read in sg_read

Status: public: reported C repro on 2019/04/12 00:00
Reported-by: syzbot+6ac7cf445f8bef6ba70e@syzkaller.appspotmail.com
First crash: 2528d, last: 2427d

Sample crash report:
==================================================================
BUG: KASAN: wild-memory-access in __copy_to_user arch/x86/include/asm/uaccess_64.h:182 [inline]
BUG: KASAN: wild-memory-access in sg_read_oxfer drivers/scsi/sg.c:1970 [inline]
BUG: KASAN: wild-memory-access in sg_read+0x12c5/0x1470 drivers/scsi/sg.c:519
Read of size 184 at addr ffe70873f7349000 by task syzkaller953683/3659
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in:
CPU: 1 PID: 3660 Comm: syzkaller953683 Not tainted 4.9.91-gbb94f9d #68
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
task: ffff8801c2d10000 task.stack: ffff8801c2128000
RIP: 0010:[<ffffffff8144e131>]  [<ffffffff8144e131>] __read_once_size include/linux/compiler.h:243 [inline]
RIP: 0010:[<ffffffff8144e131>]  [<ffffffff8144e131>] atomic_read arch/x86/include/asm/atomic.h:26 [inline]
RIP: 0010:[<ffffffff8144e131>]  [<ffffffff8144e131>] page_ref_count include/linux/page_ref.h:66 [inline]
RIP: 0010:[<ffffffff8144e131>]  [<ffffffff8144e131>] put_page_testzero include/linux/mm.h:450 [inline]
RIP: 0010:[<ffffffff8144e131>]  [<ffffffff8144e131>] __free_pages+0x21/0x80 mm/page_alloc.c:3897
RSP: 0018:ffff8801c212f938  EFLAGS: 00010a07
RAX: dffffc0000000000 RBX: dead4ead00000000 RCX: ffffffff8266930b
RDX: 1bd5a9d5a0000003 RSI: 0000000000000001 RDI: dead4ead0000001c
RBP: ffff8801c212f948 R08: 0000000000000001 R09: 0000000000000001
R10: 0000000000000000 R11: ffff8801c2d10000 R12: 0000000000000004
R13: 0000000000000020 R14: ffff8801c2038000 R15: dffffc0000000000
FS:  00007f4def96a700(0000) GS:ffff8801db300000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020979fff CR3: 00000001c3868000 CR4: 0000000000160670
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Stack:
 0000000000000001 ffff8801c2038158 ffff8801c212f9a8 ffffffff82669331
 ffff8801c2038170 ffffed003840702b ffffed003840702e ffff8801c2038168
 dead4ead00000000 ffff8801c2038140 0000000000000000 0000000000000000
Call Trace:
 [<ffffffff82669331>] sg_remove_scat.isra.19+0x1c1/0x2d0 drivers/scsi/sg.c:1946
 [<ffffffff826696e6>] sg_finish_rem_req+0x2a6/0x320 drivers/scsi/sg.c:1829
 [<ffffffff82669aec>] sg_new_read+0x38c/0x440 drivers/scsi/sg.c:567
 [<ffffffff8266b475>] sg_read+0x8c5/0x1470 drivers/scsi/sg.c:455
 [<ffffffff8156c1c8>] do_loop_readv_writev.part.17+0xc8/0x2b0 fs/read_write.c:715
 [<ffffffff8157030d>] do_loop_readv_writev fs/read_write.c:879 [inline]
 [<ffffffff8157030d>] do_readv_writev+0x5fd/0x740 fs/read_write.c:873
 [<ffffffff815704d4>] vfs_readv+0x84/0xc0 fs/read_write.c:897
 [<ffffffff815705f6>] do_readv+0xe6/0x250 fs/read_write.c:923
 [<ffffffff81573ac7>] SYSC_readv fs/read_write.c:1010 [inline]
 [<ffffffff81573ac7>] SyS_readv+0x27/0x30 fs/read_write.c:1007
 [<ffffffff81006504>] do_syscall_64+0x1a4/0x490 arch/x86/entry/common.c:282
 [<ffffffff838b8493>] entry_SYSCALL_64_after_swapgs+0x5d/0xdb
Code: e9 27 fc ff ff 0f 1f 44 00 00 48 b8 00 00 00 00 00 fc ff df 55 48 89 e5 53 48 89 fb 48 83 c7 1c 48 89 fa 48 83 ec 08 48 c1 ea 03 <0f> b6 14 02 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 04 84 d2 75 3d 
RIP  [<ffffffff8144e131>] __read_once_size include/linux/compiler.h:243 [inline]
RIP  [<ffffffff8144e131>] atomic_read arch/x86/include/asm/atomic.h:26 [inline]
RIP  [<ffffffff8144e131>] page_ref_count include/linux/page_ref.h:66 [inline]
RIP  [<ffffffff8144e131>] put_page_testzero include/linux/mm.h:450 [inline]
RIP  [<ffffffff8144e131>] __free_pages+0x21/0x80 mm/page_alloc.c:3897
 RSP <ffff8801c212f938>
---[ end trace de539e4c0ef6a2cc ]---

Crashes (5826):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/03/30 01:46 https://android.googlesource.com/kernel/common android-4.9 bb94f9d8f542 d47f0ed6 .config console log report syz C ci-android-49-kasan-gce
2017/12/21 18:20 https://android.googlesource.com/kernel/common android-4.9 250637879165 eaadba98 .config console log report syz C ci-android-49-kasan-gce
2017/12/20 10:15 https://android.googlesource.com/kernel/common android-4.9 c14c7b37e933 2d836b1d .config console log report syz C ci-android-49-kasan-gce
2017/12/20 07:17 https://android.googlesource.com/kernel/common android-4.9 c14c7b37e933 2d836b1d .config console log report syz C ci-android-49-kasan-gce
2018/03/30 02:14 https://android.googlesource.com/kernel/common android-4.9 bb94f9d8f542 d47f0ed6 .config console log report syz ci-android-49-kasan-gce-386
2018/03/31 11:14 https://android.googlesource.com/kernel/common android-4.9 cc88c05eca31 8fbce0e4 .config console log report ci-android-49-kasan-gce
2018/03/31 06:29 https://android.googlesource.com/kernel/common android-4.9 cc88c05eca31 8fbce0e4 .config console log report ci-android-49-kasan-gce
2018/03/30 07:10 https://android.googlesource.com/kernel/common android-4.9 bb94f9d8f542 d47f0ed6 .config console log report ci-android-49-kasan-gce
2018/03/29 23:55 https://android.googlesource.com/kernel/common android-4.9 bb94f9d8f542 d47f0ed6 .config console log report ci-android-49-kasan-gce
2018/03/28 13:00 https://android.googlesource.com/kernel/common android-4.9 dd1e37e64645 bf5e585c .config console log report ci-android-49-kasan-gce
2018/03/28 11:35 https://android.googlesource.com/kernel/common android-4.9 dd1e37e64645 bf5e585c .config console log report ci-android-49-kasan-gce
2018/03/28 09:47 https://android.googlesource.com/kernel/common android-4.9 dd1e37e64645 bf5e585c .config console log report ci-android-49-kasan-gce
2018/03/28 07:20 https://android.googlesource.com/kernel/common android-4.9 dd1e37e64645 bf5e585c .config console log report ci-android-49-kasan-gce
2018/03/28 04:23 https://android.googlesource.com/kernel/common android-4.9 dd1e37e64645 bf5e585c .config console log report ci-android-49-kasan-gce
2018/03/27 18:11 https://android.googlesource.com/kernel/common android-4.9 dd1e37e64645 bf5e585c .config console log report ci-android-49-kasan-gce
2018/03/27 16:25 https://android.googlesource.com/kernel/common android-4.9 dd1e37e64645 bf5e585c .config console log report ci-android-49-kasan-gce
2018/03/27 04:14 https://android.googlesource.com/kernel/common android-4.9 dd1e37e64645 0ca7878b .config console log report ci-android-49-kasan-gce
2018/03/26 22:28 https://android.googlesource.com/kernel/common android-4.9 dd1e37e64645 0ca7878b .config console log report ci-android-49-kasan-gce
2018/03/26 19:23 https://android.googlesource.com/kernel/common android-4.9 dd1e37e64645 0ca7878b .config console log report ci-android-49-kasan-gce
2018/03/25 22:37 https://android.googlesource.com/kernel/common android-4.9 dd1e37e64645 e033c1f1 .config console log report ci-android-49-kasan-gce
2018/03/25 19:00 https://android.googlesource.com/kernel/common android-4.9 dd1e37e64645 e033c1f1 .config console log report ci-android-49-kasan-gce
2018/03/25 14:46 https://android.googlesource.com/kernel/common android-4.9 dd1e37e64645 e033c1f1 .config console log report ci-android-49-kasan-gce
2018/03/25 11:27 https://android.googlesource.com/kernel/common android-4.9 dd1e37e64645 e033c1f1 .config console log report ci-android-49-kasan-gce
2018/03/23 16:26 https://android.googlesource.com/kernel/common android-4.9 f361eb39cdbf 2e9d9054 .config console log report ci-android-49-kasan-gce
2018/03/23 05:19 https://android.googlesource.com/kernel/common android-4.9 f361eb39cdbf 2e9d9054 .config console log report ci-android-49-kasan-gce
2018/03/22 08:15 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 95c88d7a .config console log report ci-android-49-kasan-gce
2018/03/22 00:10 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 95c88d7a .config console log report ci-android-49-kasan-gce
2018/03/21 19:55 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 f63eeee9 .config console log report ci-android-49-kasan-gce
2018/03/21 16:34 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 f63eeee9 .config console log report ci-android-49-kasan-gce
2018/03/21 13:31 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 f63eeee9 .config console log report ci-android-49-kasan-gce
2018/03/21 12:17 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 f63eeee9 .config console log report ci-android-49-kasan-gce
2018/03/21 06:16 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 113a43ff .config console log report ci-android-49-kasan-gce
2018/03/21 00:44 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 113a43ff .config console log report ci-android-49-kasan-gce
2018/03/20 23:06 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 72c33b66 .config console log report ci-android-49-kasan-gce
2018/03/20 21:34 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 72c33b66 .config console log report ci-android-49-kasan-gce
2018/03/20 19:18 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 72c33b66 .config console log report ci-android-49-kasan-gce
2018/03/20 18:05 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 72c33b66 .config console log report ci-android-49-kasan-gce
2018/03/20 15:16 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 72c33b66 .config console log report ci-android-49-kasan-gce
2018/03/20 09:46 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 7e7d7ed2 .config console log report ci-android-49-kasan-gce
2018/03/20 04:08 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 7e7d7ed2 .config console log report ci-android-49-kasan-gce
2018/03/20 00:44 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 7e7d7ed2 .config console log report ci-android-49-kasan-gce
2018/03/31 13:00 https://android.googlesource.com/kernel/common android-4.9 cc88c05eca31 8fbce0e4 .config console log report ci-android-49-kasan-gce-386
2018/03/29 12:45 https://android.googlesource.com/kernel/common android-4.9 bb94f9d8f542 d47f0ed6 .config console log report ci-android-49-kasan-gce-386
2018/03/22 19:30 https://android.googlesource.com/kernel/common android-4.9 960923fdc278 2e9d9054 .config console log report ci-android-49-kasan-gce-386
2018/03/22 10:46 https://android.googlesource.com/kernel/common android-4.9 960923fdc278 95c88d7a .config console log report ci-android-49-kasan-gce-386
2018/03/21 09:26 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 113a43ff .config console log report ci-android-49-kasan-gce-386
2018/03/19 19:53 https://android.googlesource.com/kernel/common android-4.9 bb52bba67e35 7e7d7ed2 .config console log report ci-android-49-kasan-gce-386
* Struck through repros no longer work on HEAD.