syzbot


KASAN: use-after-free Write in unhash_mnt

Status: auto-closed as invalid on 2020/09/02 04:47
Subsystems: fs
[Documentation on labels]
Reported-by: syzbot+bc051007d6d4c8b92868@syzkaller.appspotmail.com
First crash: 1421d, last: 1421d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __write_once_size include/linux/compiler.h:279 [inline]
BUG: KASAN: use-after-free in __hlist_del include/linux/list.h:811 [inline]
BUG: KASAN: use-after-free in hlist_del_init_rcu include/linux/rculist.h:185 [inline]
BUG: KASAN: use-after-free in unhash_mnt+0x3a6/0x420 fs/namespace.c:829
Write of size 8 at addr ffff8880001101c0 by task syz-executor.2/7009

CPU: 0 PID: 7009 Comm: syz-executor.2 Not tainted 5.7.0-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+0x188/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xd3/0x413 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 __write_once_size include/linux/compiler.h:279 [inline]
 __hlist_del include/linux/list.h:811 [inline]
 hlist_del_init_rcu include/linux/rculist.h:185 [inline]
 unhash_mnt+0x3a6/0x420 fs/namespace.c:829
 umount_mnt fs/namespace.c:841 [inline]
 __detach_mounts+0xd7/0x290 fs/namespace.c:1680
 detach_mounts fs/mount.h:118 [inline]
 vfs_rmdir fs/namei.c:3697 [inline]
 vfs_rmdir+0x346/0x500 fs/namei.c:3669
 do_rmdir+0x371/0x3e0 fs/namei.c:3752
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295
 entry_SYSCALL_64_after_hwframe+0x49/0xb3
RIP: 0033:0x45c837
Code: 00 66 90 b8 57 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 2d b9 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 b8 54 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 0d b9 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffc19e22108 EFLAGS: 00000207 ORIG_RAX: 0000000000000054
RAX: ffffffffffffffda RBX: 0000000000000065 RCX: 000000000045c837
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00007ffc19e232a0
RBP: 0000000000001993 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000005 R11: 0000000000000207 R12: 00007ffc19e232a0
R13: 0000000001da79c0 R14: 0000000000000000 R15: 00007ffc19e25420

Allocated by task 27214:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc mm/kasan/common.c:494 [inline]
 __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:467
 slab_post_alloc_hook mm/slab.h:586 [inline]
 slab_alloc mm/slab.c:3320 [inline]
 kmem_cache_alloc+0x11b/0x740 mm/slab.c:3484
 kmem_cache_zalloc include/linux/slab.h:659 [inline]
 alloc_vfsmnt+0x23/0x680 fs/namespace.c:177
 clone_mnt+0x6c/0xf50 fs/namespace.c:1042
 copy_tree+0xfb/0x920 fs/namespace.c:1813
 propagate_one fs/pnode.c:261 [inline]
 propagate_one+0x40e/0x760 fs/pnode.c:225
 propagate_mnt+0xfd/0x330 fs/pnode.c:308
 attach_recursive_mnt+0x83f/0xd30 fs/namespace.c:2124
 graft_tree+0x199/0x220 fs/namespace.c:2232
 do_loopback fs/namespace.c:2360 [inline]
 do_mount+0x15a3/0x1b40 fs/namespace.c:3188
 __do_sys_mount fs/namespace.c:3404 [inline]
 __se_sys_mount fs/namespace.c:3381 [inline]
 __x64_sys_mount+0x18f/0x230 fs/namespace.c:3381
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295
 entry_SYSCALL_64_after_hwframe+0x49/0xb3

Freed by task 9:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 kasan_set_free_info mm/kasan/common.c:316 [inline]
 __kasan_slab_free+0xf7/0x140 mm/kasan/common.c:455
 __cache_free mm/slab.c:3426 [inline]
 kmem_cache_free+0x7f/0x320 mm/slab.c:3694
 rcu_do_batch kernel/rcu/tree.c:2396 [inline]
 rcu_core+0x59f/0x1370 kernel/rcu/tree.c:2623
 __do_softirq+0x26c/0x9f7 kernel/softirq.c:292

The buggy address belongs to the object at ffff8880001101c0
 which belongs to the cache mnt_cache of size 312
The buggy address is located 0 bytes inside of
 312-byte region [ffff8880001101c0, ffff8880001102f8)
The buggy address belongs to the page:
page:ffffea0000004400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0x7ffe0000000200(slab)
raw: 007ffe0000000200 ffffea000136c888 ffffea00013d88c8 ffff88821bc50c40
raw: 0000000000000000 ffff888000110040 000000010000000a 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888000110080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888000110100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc
>ffff888000110180: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                           ^
 ffff888000110200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888000110280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/06/04 04:46 upstream d6f9469a03d8 a5ce5de0 .config console log report ci-upstream-kasan-gce-selinux-root
* Struck through repros no longer work on HEAD.