syzbot


KASAN: use-after-free Read in get_disk

Status: auto-closed as invalid on 2020/03/20 03:33
Reported-by: syzbot+42498191c906088d4e71@syzkaller.appspotmail.com
First crash: 2131d, last: 1558d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in get_disk 1 1662d 1662d 0/1 auto-closed as invalid on 2019/12/06 15:46
android-414 KASAN: use-after-free Read in get_disk C 48 1559d 1780d 0/1 public: reported C repro on 2019/04/13 00:01

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in get_disk+0xc9/0xe0 block/genhd.c:1339
Read of size 8 at addr ffff8801cf3d1ea8 by task blkid/29250

CPU: 1 PID: 29250 Comm: blkid Not tainted 4.9.202+ #0
 ffff8801ad23f6e8 ffffffff81b55d2b 0000000000000000 ffffea00073cf400
 ffff8801cf3d1ea8 0000000000000008 ffffffff81b271e9 ffff8801ad23f720
 ffffffff8150c321 0000000000000000 ffff8801cf3d1ea8 ffff8801cf3d1ea8
Call Trace:
 [<000000002c31a233>] __dump_stack lib/dump_stack.c:15 [inline]
 [<000000002c31a233>] dump_stack+0xcb/0x130 lib/dump_stack.c:56
 [<0000000066f6b282>] print_address_description+0x6f/0x23a mm/kasan/report.c:256
 [<00000000e3de7057>] kasan_report_error mm/kasan/report.c:355 [inline]
 [<00000000e3de7057>] kasan_report mm/kasan/report.c:413 [inline]
 [<00000000e3de7057>] kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:397
 [<00000000a75828cd>] __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:434
 [<000000008f1a3eab>] get_disk+0xc9/0xe0 block/genhd.c:1339
 [<00000000560f9168>] get_gendisk block/genhd.c:724 [inline]
 [<00000000560f9168>] get_gendisk+0x171/0x2d0 block/genhd.c:709
 [<0000000033d09fc8>] __blkdev_get+0x356/0xeb0 fs/block_dev.c:1267
 [<000000008bc7d876>] blkdev_get+0x2e8/0x920 fs/block_dev.c:1424
 [<000000000c4a96fc>] blkdev_open+0x1aa/0x250 fs/block_dev.c:1579
 [<00000000f991e036>] do_dentry_open+0x422/0xd20 fs/open.c:791
 [<000000000e5c6b48>] vfs_open+0x105/0x230 fs/open.c:904
 [<00000000895c6694>] do_last fs/namei.c:3457 [inline]
 [<00000000895c6694>] path_openat+0xbf5/0x2f60 fs/namei.c:3581
 [<000000003925a9d1>] do_filp_open+0x1a1/0x280 fs/namei.c:3615
 [<00000000ce21a306>] do_sys_open+0x2f0/0x610 fs/open.c:1097
 [<00000000d75e9e19>] SYSC_open fs/open.c:1115 [inline]
 [<00000000d75e9e19>] SyS_open+0x2d/0x40 fs/open.c:1110
 [<000000004e75ae09>] do_syscall_64+0x1ad/0x5c0 arch/x86/entry/common.c:288
 [<000000008e9f1d3b>] entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Allocated by task 28936:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack mm/kasan/kasan.c:512 [inline]
 set_track mm/kasan/kasan.c:524 [inline]
 kasan_kmalloc.part.0+0x62/0xf0 mm/kasan/kasan.c:616
 kasan_kmalloc+0xb7/0xd0 mm/kasan/kasan.c:601
 kmem_cache_alloc_trace+0x115/0x2d0 mm/slub.c:2742
 kmem_cache_alloc_node_trace include/linux/slab.h:381 [inline]
 kmalloc_node include/linux/slab.h:528 [inline]
 kzalloc_node include/linux/slab.h:647 [inline]
 alloc_disk_node+0x50/0x3c0 block/genhd.c:1294
 alloc_disk+0x1b/0x20 block/genhd.c:1286
 loop_add+0x37e/0x7d0 drivers/block/loop.c:1850
 loop_probe+0x154/0x180 drivers/block/loop.c:1957
 kobj_lookup+0x221/0x410 drivers/base/map.c:124
 get_gendisk+0x3c/0x2d0 block/genhd.c:716
 __blkdev_get+0x356/0xeb0 fs/block_dev.c:1267
 blkdev_get+0x2e8/0x920 fs/block_dev.c:1424
 blkdev_open+0x1aa/0x250 fs/block_dev.c:1579
 do_dentry_open+0x422/0xd20 fs/open.c:791
 vfs_open+0x105/0x230 fs/open.c:904
 do_last fs/namei.c:3457 [inline]
 path_openat+0xbf5/0x2f60 fs/namei.c:3581
 do_filp_open+0x1a1/0x280 fs/namei.c:3615
 do_sys_open+0x2f0/0x610 fs/open.c:1097
 SYSC_open fs/open.c:1115 [inline]
 SyS_open+0x2d/0x40 fs/open.c:1110
 do_syscall_64+0x1ad/0x5c0 arch/x86/entry/common.c:288
 entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Freed by task 20930:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack mm/kasan/kasan.c:512 [inline]
 set_track mm/kasan/kasan.c:524 [inline]
 kasan_slab_free+0xb0/0x190 mm/kasan/kasan.c:589
 slab_free_hook mm/slub.c:1355 [inline]
 slab_free_freelist_hook mm/slub.c:1377 [inline]
 slab_free mm/slub.c:2958 [inline]
 kfree+0xfc/0x310 mm/slub.c:3878
 disk_release+0x255/0x330 block/genhd.c:1147
 device_release+0x7d/0x220 drivers/base/core.c:248
 kobject_cleanup lib/kobject.c:643 [inline]
 kobject_release lib/kobject.c:672 [inline]
 kref_sub include/linux/kref.h:73 [inline]
 kref_put include/linux/kref.h:98 [inline]
 kobject_put+0x150/0x260 lib/kobject.c:689
 put_disk+0x23/0x30 block/genhd.c:1358
 __blkdev_get+0x581/0xeb0 fs/block_dev.c:1382
 blkdev_get+0x2e8/0x920 fs/block_dev.c:1424
 blkdev_open+0x1aa/0x250 fs/block_dev.c:1579
 do_dentry_open+0x422/0xd20 fs/open.c:791
 vfs_open+0x105/0x230 fs/open.c:904
 do_last fs/namei.c:3457 [inline]
 path_openat+0xbf5/0x2f60 fs/namei.c:3581
 do_filp_open+0x1a1/0x280 fs/namei.c:3615
 do_sys_open+0x2f0/0x610 fs/open.c:1097
 SYSC_open fs/open.c:1115 [inline]
 SyS_open+0x2d/0x40 fs/open.c:1110
 do_syscall_64+0x1ad/0x5c0 arch/x86/entry/common.c:288
 entry_SYSCALL_64_after_swapgs+0x5d/0xdb

The buggy address belongs to the object at ffff8801cf3d1980
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 1320 bytes inside of
 2048-byte region [ffff8801cf3d1980, ffff8801cf3d2180)
The buggy address belongs to the page:
page:ffffea00073cf400 count:1 mapcount:0 mapping:          (null) index:0xffff8801cf3d0000 compound_mapcount: 0
flags: 0x4000000000010200(slab|head)
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801cf3d1d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801cf3d1e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801cf3d1e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                  ^
 ffff8801cf3d1f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801cf3d1f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (42):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/11/21 03:32 android-4.9 258971b8e1ac 8098ea0f .config console log report ci-android-49-kasan-gce-root
2019/11/18 04:37 android-4.9 258971b8e1ac d5696d51 .config console log report ci-android-49-kasan-gce-root
2019/11/13 09:28 https://android.googlesource.com/kernel/common android-4.9 7fe05eede1c8 048f2d49 .config console log report ci-android-49-kasan-gce-root
2019/10/27 18:10 https://android.googlesource.com/kernel/common android-4.9 7fe05eede1c8 25bb509e .config console log report ci-android-49-kasan-gce-root
2019/10/26 19:29 https://android.googlesource.com/kernel/common android-4.9 7fe05eede1c8 25bb509e .config console log report ci-android-49-kasan-gce-root
2019/10/22 00:31 https://android.googlesource.com/kernel/common android-4.9 7fe05eede1c8 b24d2b8a .config console log report ci-android-49-kasan-gce-root
2019/10/13 06:49 https://android.googlesource.com/kernel/common android-4.9 7fe05eede1c8 426631dd .config console log report ci-android-49-kasan-gce-root
2019/10/13 03:35 https://android.googlesource.com/kernel/common android-4.9 7fe05eede1c8 426631dd .config console log report ci-android-49-kasan-gce-root
2019/10/10 22:49 https://android.googlesource.com/kernel/common android-4.9 7fe05eede1c8 1a3bad90 .config console log report ci-android-49-kasan-gce-root
2019/10/06 22:37 https://android.googlesource.com/kernel/common android-4.9 7fe05eede1c8 f3f7d9c8 .config console log report ci-android-49-kasan-gce-root
2019/09/24 09:50 https://android.googlesource.com/kernel/common android-4.9 7fe05eede1c8 c68252d2 .config console log report ci-android-49-kasan-gce-root
2019/09/08 12:16 https://android.googlesource.com/kernel/common android-4.9 9ca86082667c a60cb4cd .config console log report ci-android-49-kasan-gce-root
2019/09/01 17:30 https://android.googlesource.com/kernel/common android-4.9 1488597c127f bad3cce2 .config console log report ci-android-49-kasan-gce-root
2019/07/30 19:29 https://android.googlesource.com/kernel/common android-4.9 5220c435d873 f28bf2a5 .config console log report ci-android-49-kasan-gce-root
2019/07/17 05:52 https://android.googlesource.com/kernel/common android-4.9 5e2c340821b1 0d10349c .config console log report ci-android-49-kasan-gce-root
2019/06/08 16:04 https://android.googlesource.com/kernel/common android-4.9 83ae225d5ce3 0159583c .config console log report ci-android-49-kasan-gce-root
2019/06/08 07:48 https://android.googlesource.com/kernel/common android-4.9 83ae225d5ce3 cf9c3a50 .config console log report ci-android-49-kasan-gce-root
2019/04/29 03:07 https://android.googlesource.com/kernel/common android-4.9 6cf3205cc803 b617407b .config console log report ci-android-49-kasan-gce-root
2019/04/22 20:01 https://android.googlesource.com/kernel/common android-4.9 1ef64dae6217 0a77c33c .config console log report ci-android-49-kasan-gce-root
2019/03/14 13:40 https://android.googlesource.com/kernel/common android-4.9 1597fdfe52ba d09a902e .config console log report ci-android-49-kasan-gce-root
2019/02/21 11:49 https://android.googlesource.com/kernel/common android-4.9 1597fdfe52ba 3133098b .config console log report ci-android-49-kasan-gce-root
2019/02/02 11:17 https://android.googlesource.com/kernel/common android-4.9 5aa04bc73fa2 c198d5dd .config console log report ci-android-49-kasan-gce-root
2019/01/12 11:21 https://android.googlesource.com/kernel/common android-4.9 9e6c14f45398 c3f3344c .config console log report ci-android-49-kasan-gce-root
2018/12/24 12:15 https://android.googlesource.com/kernel/common android-4.9 a2f9236e8131 be79df56 .config console log report ci-android-49-kasan-gce-root
2018/11/24 13:08 https://android.googlesource.com/kernel/common android-4.9 f44ed2c9232d ecc7c870 .config console log report ci-android-49-kasan-gce-root
2018/10/29 13:18 https://android.googlesource.com/kernel/common android-4.9 4ba3f69128be 7df9db2e .config console log report ci-android-49-kasan-gce-root
2018/09/30 07:50 https://android.googlesource.com/kernel/common android-4.9 1c7637ca0b04 41e4b329 .config console log report ci-android-49-kasan-gce-root
2018/09/07 02:06 https://android.googlesource.com/kernel/common android-4.9 dcae9fa1319b e30d3b52 .config console log report ci-android-49-kasan-gce-root
2018/09/01 02:53 https://android.googlesource.com/kernel/common android-4.9 a06ea261bc2a a4718693 .config console log report ci-android-49-kasan-gce-root
2018/08/15 21:54 https://android.googlesource.com/kernel/common android-4.9 f85543ba3c54 9ccc1d45 .config console log report ci-android-49-kasan-gce-root
2018/08/13 01:33 https://android.googlesource.com/kernel/common android-4.9 9dc978d43ec7 7a88b141 .config console log report ci-android-49-kasan-gce-root
2018/08/11 18:58 https://android.googlesource.com/kernel/common android-4.9 9dc978d43ec7 7a88b141 .config console log report ci-android-49-kasan-gce-root
2018/08/06 23:51 https://android.googlesource.com/kernel/common android-4.9 47b77b8d01c4 1beb8136 .config console log report ci-android-49-kasan-gce-root
2018/08/04 08:01 https://android.googlesource.com/kernel/common android-4.9 8b21e85d919c df7f6947 .config console log report ci-android-49-kasan-gce-root
2018/06/23 15:16 https://android.googlesource.com/kernel/common android-4.9 7cecc756ceae 2064fc5c .config console log report ci-android-49-kasan-gce-root
2018/05/30 17:24 https://android.googlesource.com/kernel/common android-4.9 7fd40752c316 2f93b54f .config console log report ci-android-49-kasan-gce-root
2018/05/25 10:29 https://android.googlesource.com/kernel/common android-4.9 2e35bed46b50 f48c20b8 .config console log report ci-android-49-kasan-gce-root
2018/05/10 19:56 https://android.googlesource.com/kernel/common android-4.9 c462abbf779b 12c7428a .config console log report ci-android-49-kasan-gce-root
2018/05/06 19:54 https://android.googlesource.com/kernel/common android-4.9 63a812bb84e4 6c18ddb0 .config console log report ci-android-49-kasan-gce-root
2018/05/04 01:03 https://android.googlesource.com/kernel/common android-4.9 0e25e2cab07a 9ce14f4b .config console log report ci-android-49-kasan-gce-root
2018/04/27 06:41 https://android.googlesource.com/kernel/common android-4.9 71fce1edd26d 73417389 .config console log report ci-android-49-kasan-gce-root
2018/04/26 18:10 https://android.googlesource.com/kernel/common android-4.9 132f097f6547 73417389 .config console log report ci-android-49-kasan-gce-root
* Struck through repros no longer work on HEAD.