syzbot


KASAN: use-after-free Read in blkdev_get

Status: upstream: reported syz repro on 2019/12/24 19:21
Reported-by: syzbot+59a29b27d3a7b378dadd@syzkaller.appspotmail.com
First crash: 1806d, last: 1628d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in blkdev_get reiserfs C done error 117 1654d 2366d 0/28 auto-obsoleted due to no activity on 2022/09/19 20:06
linux-4.19 KASAN: use-after-free Read in blkdev_get C error 10 1698d 1808d 0/1 auto-obsoleted due to no activity on 2022/08/27 08:20
Last patch testing requests (2)
Created Duration User Patch Repo Result
2023/01/27 12:32 13m retest repro linux-4.14.y report log
2022/09/09 03:27 9m retest repro linux-4.14.y report log

Sample crash report:
md: could not open unknown-block(8,3).
md: md_import_device returned -6
md: could not open unknown-block(8,3).
md: md_import_device returned -6
==================================================================
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:183 [inline]
BUG: KASAN: use-after-free in atomic64_read arch/x86/include/asm/atomic64_64.h:22 [inline]
BUG: KASAN: use-after-free in atomic_long_read include/asm-generic/atomic-long.h:45 [inline]
BUG: KASAN: use-after-free in __mutex_unlock_slowpath+0x656/0x800 kernel/locking/mutex.c:1027
Read of size 8 at addr ffff888099ad97d8 by task syz-executor.2/1595

CPU: 1 PID: 1595 Comm: syz-executor.2 Not tainted 4.14.171-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x142/0x197 lib/dump_stack.c:58
 print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report mm/kasan/report.c:409 [inline]
 kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
 __read_once_size include/linux/compiler.h:183 [inline]
 atomic64_read arch/x86/include/asm/atomic64_64.h:22 [inline]
 atomic_long_read include/asm-generic/atomic-long.h:45 [inline]
 __mutex_unlock_slowpath+0x656/0x800 kernel/locking/mutex.c:1027
 mutex_unlock+0xd/0x10 kernel/locking/mutex.c:614
 blkdev_get+0x555/0x8e0 fs/block_dev.c:1655
 blkdev_get_by_dev+0x42/0x80 fs/block_dev.c:1734
 lock_rdev+0x83/0x110 drivers/md/md.c:2293
 md_import_device+0x1cd/0x450 drivers/md/md.c:3466
 add_new_disk+0x4e2/0x15f0 drivers/md/md.c:6320
 md_ioctl+0x38d0/0x4bd0 drivers/md/md.c:7338
 __blkdev_driver_ioctl block/ioctl.c:297 [inline]
 blkdev_ioctl+0x95f/0x1850 block/ioctl.c:594
 block_ioctl+0xde/0x120 fs/block_dev.c:1881
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x7ae/0x1060 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x45c449
RSP: 002b:00007f87255bfc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f87255c06d4 RCX: 000000000045c449
RDX: 0000000020001200 RSI: 0000000040140921 RDI: 0000000000000004
RBP: 000000000076bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 000000000000021e R14: 00000000004c4025 R15: 000000000076bf2c

Allocated by task 1595:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc mm/kasan/kasan.c:551 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
 kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:489
 kmem_cache_alloc+0x12e/0x780 mm/slab.c:3552
 bdev_alloc_inode+0x1c/0x50 fs/block_dev.c:754
 alloc_inode+0x64/0x180 fs/inode.c:209
 iget5_locked+0x170/0x460 fs/inode.c:1049
 bdget+0x82/0x4e0 fs/block_dev.c:895
 blkdev_get_by_dev+0x27/0x80 fs/block_dev.c:1730
 lock_rdev+0x83/0x110 drivers/md/md.c:2293
 md_import_device+0x1cd/0x450 drivers/md/md.c:3466
 add_new_disk+0x4e2/0x15f0 drivers/md/md.c:6320
 md_ioctl+0x38d0/0x4bd0 drivers/md/md.c:7338
 __blkdev_driver_ioctl block/ioctl.c:297 [inline]
 blkdev_ioctl+0x95f/0x1850 block/ioctl.c:594
 block_ioctl+0xde/0x120 fs/block_dev.c:1881
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x7ae/0x1060 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 7486:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kmem_cache_free+0x83/0x2b0 mm/slab.c:3758
 bdev_i_callback+0x20/0x30 fs/block_dev.c:765
 __rcu_reclaim kernel/rcu/rcu.h:195 [inline]
 rcu_do_batch kernel/rcu/tree.c:2699 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2962 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2929 [inline]
 rcu_process_callbacks+0x7b8/0x12b0 kernel/rcu/tree.c:2946
 __do_softirq+0x244/0x9a0 kernel/softirq.c:288

The buggy address belongs to the object at ffff888099ad97c0
 which belongs to the cache bdev_cache of size 1352
The buggy address is located 24 bytes inside of
 1352-byte region [ffff888099ad97c0, ffff888099ad9d08)
The buggy address belongs to the page:
page:ffffea000266b640 count:1 mapcount:0 mapping:ffff888099ad91c0 index:0xffff888099ad9ffe
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff888099ad91c0 ffff888099ad9ffe 0000000100000002
raw: ffffea00025d5460 ffffea00025d5560 ffff88821f8b5980 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888099ad9680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888099ad9700: fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888099ad9780: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                                    ^
 ffff888099ad9800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888099ad9880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/02/19 19:15 linux-4.14.y 98db2bf27b9e 47fae6e9 .config console log report syz ci2-linux-4-14
2020/06/19 23:35 linux-4.14.y b850307b279c 123cf502 .config console log report ci2-linux-4-14
2020/06/02 14:04 linux-4.14.y 4f68020fef1c 52fd7b7d .config console log report ci2-linux-4-14
2020/05/28 09:38 linux-4.14.y 4f68020fef1c 9072c126 .config console log report ci2-linux-4-14
2020/05/26 00:56 linux-4.14.y a41ba30d9df2 8ca3b7d2 .config console log report ci2-linux-4-14
2020/02/19 13:38 linux-4.14.y 98db2bf27b9e 47fae6e9 .config console log report ci2-linux-4-14
2020/01/22 05:54 linux-4.14.y c1141b3aab36 8eda0b95 .config console log report ci2-linux-4-14
2019/12/24 19:20 linux-4.14.y e1f7d50ae3a3 be5c2c81 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.