syzbot


KASAN: use-after-free Read in cd_forget

Status: auto-closed as invalid on 2022/03/12 09:04
Reported-by: syzbot+d557847403d1ceed5437@syzkaller.appspotmail.com
First crash: 1117d, last: 1117d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __list_del_entry_valid+0xd6/0xf0 lib/list_debug.c:54
Read of size 8 at addr ffff88809a9b2600 by task syz-executor.3/13276

CPU: 0 PID: 13276 Comm: syz-executor.3 Not tainted 4.19.211-syzkaller #0
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+0x1fc/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
 __list_del_entry_valid+0xd6/0xf0 lib/list_debug.c:54
 __list_del_entry include/linux/list.h:117 [inline]
 list_del_init include/linux/list.h:159 [inline]
 cd_forget+0x32/0x1e0 fs/char_dev.c:438
 evict+0x544/0x760 fs/inode.c:567
 iput_final fs/inode.c:1555 [inline]
 iput+0x4f1/0x860 fs/inode.c:1581
 dentry_unlink_inode+0x265/0x320 fs/dcache.c:374
 __dentry_kill+0x3c0/0x640 fs/dcache.c:566
 shrink_dentry_list+0x28d/0x6e0 fs/dcache.c:1081
 shrink_dcache_parent+0xdc/0x120 fs/dcache.c:1488
 do_one_tree fs/dcache.c:1524 [inline]
 shrink_dcache_for_umount+0x71/0x330 fs/dcache.c:1541
 generic_shutdown_super+0x68/0x370 fs/super.c:441
 kill_anon_super+0x36/0x60 fs/super.c:1032
 deactivate_locked_super+0x94/0x160 fs/super.c:329
 deactivate_super+0x174/0x1a0 fs/super.c:360
 cleanup_mnt+0x1a8/0x290 fs/namespace.c:1098
 task_work_run+0x148/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f85c8c02f57
Code: ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff246b99e8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f85c8c02f57
RDX: 00007fff246b9abb RSI: 000000000000000a RDI: 00007fff246b9ab0
RBP: 00007fff246b9ab0 R08: 00000000ffffffff R09: 00007fff246b9880
R10: 0000555557176903 R11: 0000000000000202 R12: 00007f85c8c5b105
R13: 00007fff246bab70 R14: 0000555557176810 R15: 00007fff246babb0

Allocated by task 20639:
 kmem_cache_alloc+0x122/0x370 mm/slab.c:3559
 fuse_alloc_inode+0x1d/0x3f0 fs/fuse/inode.c:87
 alloc_inode+0x5d/0x180 fs/inode.c:211
 iget5_locked fs/inode.c:1131 [inline]
 iget5_locked+0x57/0xd0 fs/inode.c:1124
 fuse_iget+0x1a6/0x800 fs/fuse/inode.c:307
 fuse_lookup_name+0x413/0x5c0 fs/fuse/dir.c:341
 fuse_lookup+0xdf/0x410 fs/fuse/dir.c:368
 fuse_atomic_open+0x20a/0x330 fs/fuse/dir.c:508
 atomic_open fs/namei.c:3073 [inline]
 lookup_open+0x1023/0x1a20 fs/namei.c:3205
 do_last fs/namei.c:3327 [inline]
 path_openat+0x1094/0x2df0 fs/namei.c:3537
 do_filp_open+0x18c/0x3f0 fs/namei.c:3567
 do_sys_open+0x3b3/0x520 fs/open.c:1085
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 4700:
 __cache_free mm/slab.c:3503 [inline]
 kmem_cache_free+0x7f/0x260 mm/slab.c:3765
 __rcu_reclaim kernel/rcu/rcu.h:236 [inline]
 rcu_do_batch kernel/rcu/tree.c:2584 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2897 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2864 [inline]
 rcu_process_callbacks+0x8ff/0x18b0 kernel/rcu/tree.c:2881
 __do_softirq+0x265/0x980 kernel/softirq.c:292

The buggy address belongs to the object at ffff88809a9b2280
 which belongs to the cache fuse_inode of size 1264
The buggy address is located 896 bytes inside of
 1264-byte region [ffff88809a9b2280, ffff88809a9b2770)
The buggy address belongs to the page:
page:ffffea00026a6c80 count:1 mapcount:0 mapping:ffff8880b0eb7240 index:0xffff88809a9b2ffe
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea000132d288 ffffea000237ab88 ffff8880b0eb7240
raw: ffff88809a9b2ffe ffff88809a9b2280 0000000100000002 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809a9b2500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809a9b2580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88809a9b2600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88809a9b2680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809a9b2700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/11/12 09:03 linux-4.19.y 3f8a27f9e27b 75b04091 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in cd_forget
* Struck through repros no longer work on HEAD.