syzbot


KASAN: use-after-free Read in blk_mq_free_rqs

Status: fixed on 2019/07/03 22:49
Subsystems: block
[Documentation on labels]
Reported-by: syzbot+784281a934c3f71eb71a@syzkaller.appspotmail.com
Fix commit: c3e2219216c9 block: free sched's request pool in blk_cleanup_queue
First crash: 1819d, last: 1811d
Cause bisection: failed (error log, bisect log)
  
Discussions (1)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in blk_mq_free_rqs 1 (2) 2019/06/06 22:21

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in blk_mq_free_rqs+0x49f/0x4b0 block/blk-mq.c:2049
Read of size 8 at addr ffff888219398250 by task kworker/0:3/8567

CPU: 0 PID: 8567 Comm: kworker/0:3 Not tainted 5.2.0-rc3+ #23
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events __blk_release_queue
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x172/0x1f0 lib/dump_stack.c:113
 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:188
 __kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
 kasan_report+0x12/0x20 mm/kasan/common.c:614
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132
 blk_mq_free_rqs+0x49f/0x4b0 block/blk-mq.c:2049
 blk_mq_sched_free_tags block/blk-mq-sched.c:453 [inline]
 blk_mq_sched_tags_teardown+0x126/0x210 block/blk-mq-sched.c:485
 blk_mq_exit_sched+0x1fa/0x2d0 block/blk-mq-sched.c:557
 elevator_exit+0x70/0xa0 block/elevator.c:185
 blk_exit_queue block/blk-sysfs.c:853 [inline]
 __blk_release_queue+0x127/0x330 block/blk-sysfs.c:895
 process_one_work+0x989/0x1790 kernel/workqueue.c:2269
 worker_thread+0x98/0xe40 kernel/workqueue.c:2415
 kthread+0x354/0x420 kernel/kthread.c:255
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

Allocated by task 1:
 save_stack+0x23/0x90 mm/kasan/common.c:71
 set_track mm/kasan/common.c:79 [inline]
 __kasan_kmalloc mm/kasan/common.c:489 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:462
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:503
 kmem_cache_alloc_trace+0x151/0x750 mm/slab.c:3555
 kmalloc include/linux/slab.h:547 [inline]
 kzalloc include/linux/slab.h:742 [inline]
 loop_add+0x51/0x8d0 drivers/block/loop.c:1973
 loop_init+0x1fe/0x25a drivers/block/loop.c:2267
 do_one_initcall+0x107/0x7ba init/main.c:915
 do_initcall_level init/main.c:983 [inline]
 do_initcalls init/main.c:991 [inline]
 do_basic_setup init/main.c:1009 [inline]
 kernel_init_freeable+0x4d4/0x5c3 init/main.c:1169
 kernel_init+0x12/0x1c5 init/main.c:1087
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

Freed by task 8565:
 save_stack+0x23/0x90 mm/kasan/common.c:71
 set_track mm/kasan/common.c:79 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:451
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:459
 __cache_free mm/slab.c:3432 [inline]
 kfree+0xcf/0x220 mm/slab.c:3755
 loop_remove+0xa1/0xd0 drivers/block/loop.c:2078
 loop_control_ioctl drivers/block/loop.c:2173 [inline]
 loop_control_ioctl+0x320/0x360 drivers/block/loop.c:2139
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:509 [inline]
 do_vfs_ioctl+0xd5f/0x1380 fs/ioctl.c:696
 ksys_ioctl+0xab/0xd0 fs/ioctl.c:713
 __do_sys_ioctl fs/ioctl.c:720 [inline]
 __se_sys_ioctl fs/ioctl.c:718 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff888219398040
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 528 bytes inside of
 1024-byte region [ffff888219398040, ffff888219398440)
The buggy address belongs to the page:
page:ffffea000864e600 refcount:1 mapcount:0 mapping:ffff8880aa400ac0 index:0x0 compound_mapcount: 0
flags: 0x6fffc0000010200(slab|head)
raw: 06fffc0000010200 ffffea0008659f88 ffffea000864ef88 ffff8880aa400ac0
raw: 0000000000000000 ffff888219398040 0000000100000007 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888219398100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888219398180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888219398200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff888219398280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888219398300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (3481):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/06/08 21:46 upstream 79c3ba3206c7 0159583c .config console log report syz C ci-upstream-kasan-gce-smack-root
2019/06/08 20:15 upstream 79c3ba3206c7 0159583c .config console log report syz C ci-upstream-kasan-gce-root
2019/06/08 18:40 upstream 79c3ba3206c7 0159583c .config console log report syz C ci-upstream-kasan-gce-selinux-root
2019/06/08 18:18 upstream 79c3ba3206c7 0159583c .config console log report syz C ci-upstream-kasan-gce-smack-root
2019/06/08 16:44 upstream 79c3ba3206c7 0159583c .config console log report syz C ci-upstream-kasan-gce-root
2019/06/08 11:50 upstream 79c3ba3206c7 cf9c3a50 .config console log report syz C ci-upstream-kasan-gce-smack-root
2019/06/08 09:49 upstream 79c3ba3206c7 cf9c3a50 .config console log report syz C ci-upstream-kasan-gce-smack-root
2019/06/08 09:15 upstream 79c3ba3206c7 cf9c3a50 .config console log report syz C ci-upstream-kasan-gce
2019/06/08 07:40 upstream 79c3ba3206c7 cf9c3a50 .config console log report syz C ci-upstream-kasan-gce-root
2019/06/08 06:45 upstream 79c3ba3206c7 cf9c3a50 .config console log report syz C ci-upstream-kasan-gce-selinux-root
2019/06/08 04:40 upstream 79c3ba3206c7 cf9c3a50 .config console log report syz C ci-upstream-kasan-gce-selinux-root
2019/06/08 04:26 upstream 79c3ba3206c7 cf9c3a50 .config console log report syz C ci-upstream-kasan-gce
2019/06/07 21:46 upstream 16d72dd4891f ce9107d0 .config console log report syz C ci-upstream-kasan-gce-selinux-root
2019/06/07 19:17 upstream 16d72dd4891f ce9107d0 .config console log report syz C ci-upstream-kasan-gce-root
2019/06/07 07:13 upstream 01047631df81 698773cb .config console log report syz C ci-upstream-kasan-gce
2019/06/07 04:58 upstream 01047631df81 698773cb .config console log report syz C ci-upstream-kasan-gce-selinux-root
2019/06/07 04:34 upstream 01047631df81 698773cb .config console log report syz C ci-upstream-kasan-gce-smack-root
2019/06/07 03:53 upstream 01047631df81 698773cb .config console log report syz C ci-upstream-kasan-gce
2019/06/06 22:08 upstream 156c05917e09 698773cb .config console log report syz C ci-upstream-kasan-gce
2019/06/06 18:50 upstream 156c05917e09 698773cb .config console log report syz C ci-upstream-kasan-gce-root
2019/06/05 13:18 upstream 788a024921c4 bfb4a51e .config console log report syz C ci-upstream-kasan-gce
2019/06/05 01:05 upstream 788a024921c4 e41a20c5 .config console log report syz C ci-upstream-kasan-gce
2019/06/04 22:40 upstream 788a024921c4 e41a20c5 .config console log report syz C ci-upstream-kasan-gce
2019/06/04 21:50 upstream 788a024921c4 e41a20c5 .config console log report syz C ci-upstream-kasan-gce-smack-root
2019/06/04 20:41 upstream 788a024921c4 e41a20c5 .config console log report syz C ci-upstream-kasan-gce-selinux-root
2019/06/04 16:55 upstream 788a024921c4 e41a20c5 .config console log report syz C ci-upstream-kasan-gce-root
2019/06/02 21:01 upstream 9221dced3069 53c81ea5 .config console log report syz C ci-upstream-kasan-gce-smack-root
2019/06/08 16:48 upstream 79c3ba3206c7 0159583c .config console log report syz C ci-upstream-kasan-gce-386
2019/06/08 09:13 upstream 79c3ba3206c7 cf9c3a50 .config console log report syz C ci-upstream-kasan-gce-386
2019/06/08 05:06 upstream 79c3ba3206c7 cf9c3a50 .config console log report syz C ci-upstream-kasan-gce-386
2019/06/07 04:07 upstream 01047631df81 698773cb .config console log report syz C ci-upstream-kasan-gce-386
2019/06/06 21:19 upstream 156c05917e09 698773cb .config console log report syz C ci-upstream-kasan-gce-386
2019/06/06 08:13 upstream 156c05917e09 a547defc .config console log report syz C ci-upstream-kasan-gce-386
2019/06/09 13:24 linux-next 3f310e51ceb1 0159583c .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/06/09 10:54 linux-next 3f310e51ceb1 0159583c .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/06/08 15:44 linux-next 3f310e51ceb1 0159583c .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/06/07 03:47 linux-next 8b4d1d574048 698773cb .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/06/06 07:45 linux-next b2924447b98a a547defc .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/06/08 16:03 upstream 79c3ba3206c7 0159583c .config console log report syz ci-upstream-kasan-gce
2019/06/08 01:20 upstream 16d72dd4891f ce9107d0 .config console log report syz ci-upstream-kasan-gce-smack-root
2019/06/05 19:08 upstream 788a024921c4 bfb4a51e .config console log report syz ci-upstream-kasan-gce
2019/06/04 23:34 upstream 788a024921c4 e41a20c5 .config console log report syz ci-upstream-kasan-gce
2019/06/04 23:13 upstream 788a024921c4 e41a20c5 .config console log report syz ci-upstream-kasan-gce
2019/06/10 12:38 linux-next 3f310e51ceb1 0159583c .config console log report syz ci-upstream-linux-next-kasan-gce-root
2019/06/08 21:33 upstream 79c3ba3206c7 0159583c .config console log report ci-upstream-kasan-gce-selinux-root
2019/06/08 16:08 upstream 79c3ba3206c7 0159583c .config console log report ci-upstream-kasan-gce
2019/06/02 17:52 upstream 9221dced3069 53c81ea5 .config console log report ci-upstream-kasan-gce-selinux-root
2019/06/11 09:36 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/11 08:51 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/11 07:24 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/11 05:05 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/11 03:48 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/11 03:21 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/11 01:50 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/11 01:19 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/11 00:08 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/10 22:44 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/10 21:27 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/10 21:13 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/10 19:41 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/10 19:41 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/10 18:27 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/10 17:02 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/10 15:59 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/10 13:31 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/10 11:38 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/10 08:46 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/10 07:44 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/10 06:38 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/10 05:33 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/10 04:41 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/10 03:20 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/10 01:27 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/09 23:41 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/09 21:58 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/09 18:13 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/09 15:38 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/09 14:10 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/09 13:22 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/09 11:53 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/09 09:32 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/09 06:55 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/09 06:19 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/09 04:58 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/09 04:28 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/09 03:27 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/08 23:46 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/06/08 20:36 linux-next 3f310e51ceb1 0159583c .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.