syzbot


KASAN: use-after-free Read in mntput

Status: closed as dup on 2019/06/12 18:47
Subsystems: fs
[Documentation on labels]
Reported-by: syzbot+99de05d099a170867f22@syzkaller.appspotmail.com
Fix commit: 1b0b9cc8d379 vfs: fsmount: add missing mntget()
First crash: 1811d, last: 1804d
Cause bisection: introduced by (bisect log) :
commit 9c8ad7a2ff0bfe58f019ec0abc1fb965114dde7d
Author: David Howells <dhowells@redhat.com>
Date: Thu May 16 11:52:27 2019 +0000

  uapi, x86: Fix the syscall numbering of the mount API syscalls [ver #2]

Crash: KASAN: use-after-free Read in mntput (log)
Repro: C syz .config
  
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
BUG: Dentry still in use [unmount of tmpfs tmpfs] fs 2 1813d 1812d
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] vfs: fsmount: add missing mntget() 8 (8) 2019/10/16 00:52
KASAN: use-after-free Read in mntput 1 (2) 2019/06/12 18:47

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in mntput+0x91/0xa0 fs/namespace.c:1207
Read of size 4 at addr ffff888099134924 by task syz-executor213/8923

CPU: 0 PID: 8923 Comm: syz-executor213 Not tainted 5.2.0-rc4 #25
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:188
 __kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
 kasan_report+0x12/0x20 mm/kasan/common.c:614
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/generic_report.c:131
 mntput+0x91/0xa0 fs/namespace.c:1207
 path_put+0x50/0x70 fs/namei.c:483
 free_fs_struct+0x25/0x70 fs/fs_struct.c:91
 exit_fs+0xf0/0x130 fs/fs_struct.c:108
 do_exit+0x8e0/0x2fa0 kernel/exit.c:873
 do_group_exit+0x135/0x370 kernel/exit.c:981
 __do_sys_exit_group kernel/exit.c:992 [inline]
 __se_sys_exit_group kernel/exit.c:990 [inline]
 __x64_sys_exit_group+0x44/0x50 kernel/exit.c:990
 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x43ff48
Code: 00 00 be 3c 00 00 00 eb 19 66 0f 1f 84 00 00 00 00 00 48 89 d7 89 f0 0f 05 48 3d 00 f0 ff ff 77 21 f4 48 89 d7 44 89 c0 0f 05 <48> 3d 00 f0 ff ff 76 e0 f7 d8 64 41 89 01 eb d8 0f 1f 84 00 00 00
RSP: 002b:00007ffd444dcf78 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000043ff48
RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
RBP: 00000000004bfa70 R08: 00000000000000e7 R09: ffffffffffffffd0
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006d2180 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 8923:
 save_stack+0x23/0x90 mm/kasan/common.c:71
 set_track mm/kasan/common.c:79 [inline]
 __kasan_kmalloc mm/kasan/common.c:489 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:462
 kasan_slab_alloc+0xf/0x20 mm/kasan/common.c:497
 slab_post_alloc_hook mm/slab.h:437 [inline]
 slab_alloc mm/slab.c:3326 [inline]
 kmem_cache_alloc+0x11a/0x6f0 mm/slab.c:3488
 kmem_cache_zalloc include/linux/slab.h:732 [inline]
 alloc_vfsmnt+0x28/0x780 fs/namespace.c:182
 vfs_create_mount+0x96/0x500 fs/namespace.c:961
 __do_sys_fsmount fs/namespace.c:3423 [inline]
 __se_sys_fsmount fs/namespace.c:3340 [inline]
 __x64_sys_fsmount+0x584/0xc80 fs/namespace.c:3340
 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 9:
 save_stack+0x23/0x90 mm/kasan/common.c:71
 set_track mm/kasan/common.c:79 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:451
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:459
 __cache_free mm/slab.c:3432 [inline]
 kmem_cache_free+0x86/0x260 mm/slab.c:3698
 free_vfsmnt+0x6f/0x90 fs/namespace.c:559
 delayed_free_vfsmnt+0x16/0x20 fs/namespace.c:564
 __rcu_reclaim kernel/rcu/rcu.h:222 [inline]
 rcu_do_batch kernel/rcu/tree.c:2092 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2310 [inline]
 rcu_core+0xba5/0x1500 kernel/rcu/tree.c:2291
 __do_softirq+0x25c/0x94c kernel/softirq.c:292

The buggy address belongs to the object at ffff888099134800
 which belongs to the cache mnt_cache of size 432
The buggy address is located 292 bytes inside of
 432-byte region [ffff888099134800, ffff8880991349b0)
The buggy address belongs to the page:
page:ffffea0002644d00 refcount:1 mapcount:0 mapping:ffff8880aa596940 index:0x0
flags: 0x1fffc0000000200(slab)
raw: 01fffc0000000200 ffffea0002824648 ffffea00029e78c8 ffff8880aa596940
raw: 0000000000000000 ffff888099134000 0000000100000008 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888099134800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888099134880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888099134900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff888099134980: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc
 ffff888099134a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/06/10 21:40 upstream d1fdb6d8f6a4 0159583c .config console log report syz C ci-upstream-kasan-gce-smack-root
2019/06/10 20:15 upstream d1fdb6d8f6a4 0159583c .config console log report syz C ci-upstream-kasan-gce-root
2019/06/10 10:51 upstream d1fdb6d8f6a4 0159583c .config console log report syz C ci-upstream-kasan-gce-selinux-root
2019/06/10 10:50 upstream d1fdb6d8f6a4 0159583c .config console log report syz C ci-upstream-kasan-gce
2019/06/10 10:23 upstream d1fdb6d8f6a4 0159583c .config console log report syz C ci-upstream-kasan-gce-386
2019/06/17 03:57 upstream 963172d9c7e8 442206d7 .config console log report ci-upstream-kasan-gce-smack-root
2019/06/13 04:36 upstream 35110e38e6c5 3f4e812b .config console log report ci-upstream-kasan-gce
2019/06/10 09:40 upstream d1fdb6d8f6a4 0159583c .config console log report ci-upstream-kasan-gce-386
* Struck through repros no longer work on HEAD.