syzbot


KASAN: use-after-free Read in disk_map_sector_rcu

Status: auto-closed as invalid on 2019/09/04 04:35
Subsystems: block
[Documentation on labels]
Reported-by: syzbot+e01322aeded15e015bbd@syzkaller.appspotmail.com
First crash: 1949d, last: 1886d
Discussions (3)
Title Replies (including bot) Last reply
Reminder: 11 open syzbot bugs in block subsystem 1 (1) 2019/07/24 02:26
Reminder: 11 open syzbot bugs in block subsystem 1 (1) 2019/06/25 06:17
KASAN: use-after-free Read in disk_map_sector_rcu 0 (1) 2019/01/04 16:37

Sample crash report:
device team0 entered promiscuous mode
device team_slave_0 entered promiscuous mode
device team_slave_1 entered promiscuous mode
8021q: adding VLAN 0 to HW filter on device team0
==================================================================
BUG: KASAN: use-after-free in sector_in_part block/genhd.c:260 [inline]
BUG: KASAN: use-after-free in disk_map_sector_rcu+0x475/0x490 block/genhd.c:288
Read of size 8 at addr ffff8880954f3640 by task blkid/4125

CPU: 0 PID: 4125 Comm: blkid Not tainted 5.0.0+ #11
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
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:187
 kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132
 sector_in_part block/genhd.c:260 [inline]
 disk_map_sector_rcu+0x475/0x490 block/genhd.c:288
 blk_account_io_start+0x507/0xcf0 block/blk-core.c:1363
 blk_mq_bio_to_request block/blk-mq.c:1757 [inline]
 blk_mq_make_request+0x656/0x1790 block/blk-mq.c:1971
 generic_make_request+0x740/0x12d0 block/blk-core.c:1090
 submit_bio+0xba/0x480 block/blk-core.c:1198
 mpage_bio_submit fs/mpage.c:66 [inline]
 mpage_readpages+0x466/0x630 fs/mpage.c:410
 blkdev_readpages+0x2d/0x40 fs/block_dev.c:615
 read_pages+0x10f/0x550 mm/readahead.c:125
 __do_page_cache_readahead+0x4c6/0x5c0 mm/readahead.c:211
 force_page_cache_readahead+0x1e9/0x360 mm/readahead.c:242
 page_cache_sync_readahead mm/readahead.c:521 [inline]
 page_cache_sync_readahead+0x4b9/0x520 mm/readahead.c:508
 generic_file_buffered_read mm/filemap.c:2102 [inline]
 generic_file_read_iter+0x1582/0x2870 mm/filemap.c:2375
 blkdev_read_iter+0x120/0x190 fs/block_dev.c:1967
 call_read_iter include/linux/fs.h:1848 [inline]
 new_sync_read fs/read_write.c:406 [inline]
 __vfs_read+0x610/0x8c0 fs/read_write.c:418
 vfs_read+0x194/0x3e0 fs/read_write.c:452
 ksys_read+0xea/0x1f0 fs/read_write.c:578
 __do_sys_read fs/read_write.c:588 [inline]
 __se_sys_read fs/read_write.c:586 [inline]
 __x64_sys_read+0x73/0xb0 fs/read_write.c:586
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7fc863f10310
Code: 73 01 c3 48 8b 0d 28 4b 2b 00 31 d2 48 29 c2 64 89 11 48 83 c8 ff eb ea 90 90 83 3d e5 a2 2b 00 00 75 10 b8 00 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 6e 8a 01 00 48 89 04 24
RSP: 002b:00007ffe47a5f808 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fc863f10310
RDX: 0000000000000400 RSI: 000000000226ac58 RDI: 0000000000000003
RBP: 000000000226ac30 R08: 0000000000000028 R09: 0000000001680000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000226a030
R13: 0000000000000400 R14: 000000000226a080 R15: 000000000226ac48

Allocated by task 3543:
 save_stack+0x45/0xd0 mm/kasan/common.c:75
 set_track mm/kasan/common.c:87 [inline]
 __kasan_kmalloc mm/kasan/common.c:497 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:470
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:511
 kmem_cache_alloc_trace+0x151/0x760 mm/slab.c:3621
 kmalloc include/linux/slab.h:545 [inline]
 kzalloc include/linux/slab.h:740 [inline]
 add_partition+0x1a6/0xe30 block/partition-generic.c:322
 rescan_partitions+0x668/0xa20 block/partition-generic.c:618
 __blkdev_reread_part+0x1a2/0x230 block/ioctl.c:173
 blkdev_reread_part+0x27/0x40 block/ioctl.c:193
 loop_reread_partitions+0x1c/0x40 drivers/block/loop.c:633
 loop_set_status+0xe57/0x1380 drivers/block/loop.c:1282
 loop_set_status64+0xc2/0x120 drivers/block/loop.c:1402
 lo_ioctl+0x43b/0x20d0 drivers/block/loop.c:1545
 __blkdev_driver_ioctl block/ioctl.c:303 [inline]
 blkdev_ioctl+0xee8/0x1c40 block/ioctl.c:605
 block_ioctl+0xee/0x130 fs/block_dev.c:1914
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:509 [inline]
 do_vfs_ioctl+0xd6e/0x1390 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+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 15370:
 save_stack+0x45/0xd0 mm/kasan/common.c:75
 set_track mm/kasan/common.c:87 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:459
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:467
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xcf/0x230 mm/slab.c:3821
 part_release+0xaa/0xd0 block/partition-generic.c:228
 device_release+0x7d/0x210 drivers/base/core.c:1064
 kobject_cleanup lib/kobject.c:662 [inline]
 kobject_release lib/kobject.c:691 [inline]
 kref_put include/linux/kref.h:67 [inline]
 kobject_put.cold+0x28f/0x2ec lib/kobject.c:708
 put_device+0x20/0x30 drivers/base/core.c:2205
 delete_partition_work_fn+0x14a/0x1b0 block/partition-generic.c:256
 process_one_work+0x98e/0x1790 kernel/workqueue.c:2259
 worker_thread+0x98/0xe40 kernel/workqueue.c:2405
 kthread+0x357/0x430 kernel/kthread.c:253
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352

The buggy address belongs to the object at ffff8880954f3640
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 0 bytes inside of
 2048-byte region [ffff8880954f3640, ffff8880954f3e40)
The buggy address belongs to the page:
page:ffffea0002553c80 count:1 mapcount:0 mapping:ffff88812c3f0c40 index:0x0 compound_mapcount: 0
flags: 0x1fffc0000010200(slab|head)
raw: 01fffc0000010200 ffffea00017ddc88 ffffea0002a32c88 ffff88812c3f0c40
raw: 0000000000000000 ffff8880954f2540 0000000100000003 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880954f3500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880954f3580: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8880954f3600: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                           ^
 ffff8880954f3680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880954f3700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/03/08 04:34 upstream 1fc1cd8399ab 4b69c3cb .config console log report ci-upstream-kasan-gce-root
2019/01/04 11:19 upstream 645ff1e8e704 7da23925 .config console log report ci-upstream-kasan-gce-root
* Struck through repros no longer work on HEAD.