syzbot


KASAN: use-after-free Read in path_init (3)

Status: auto-closed as invalid on 2020/12/29 19:01
Subsystems: fs
[Documentation on labels]
Reported-by: syzbot+3e565bbd2673747f90c2@syzkaller.appspotmail.com
First crash: 1330d, last: 1330d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in path_init (3) 0 (1) 2020/11/04 22:20
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in path_init fs 1 2247d 2245d 0/27 auto-closed as invalid on 2019/02/22 10:09
upstream KASAN: use-after-free Read in path_init (2) fs C done 29 1408d 1410d 15/27 fixed on 2020/09/16 22:51

Sample crash report:
MINIX-fs: mounting unchecked file system, running fsck is recommended
MINIX-fs: deleted inode referenced: 6
==================================================================
BUG: KASAN: use-after-free in path_init+0x14ba/0x17d0 fs/namei.c:2208
Read of size 8 at addr ffff8880633cc400 by task syz-executor.3/14486

CPU: 1 PID: 14486 Comm: syz-executor.3 Not tainted 5.10.0-rc1-next-20201030-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+0x107/0x163 lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x4c8 mm/kasan/report.c:385
 __kasan_report mm/kasan/report.c:545 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:562
 path_init+0x14ba/0x17d0 fs/namei.c:2208
 path_parentat+0x22/0x1b0 fs/namei.c:2385
 filename_parentat+0x188/0x560 fs/namei.c:2408
 do_renameat2+0x16e/0xc00 fs/namei.c:4375
 __do_sys_renameat fs/namei.c:4501 [inline]
 __se_sys_renameat fs/namei.c:4498 [inline]
 __x64_sys_renameat+0xbf/0xf0 fs/namei.c:4498
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45deb9
Code: 0d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 db b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fbef8029c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000108
RAX: ffffffffffffffda RBX: 0000000000027340 RCX: 000000000045deb9
RDX: 0000000000000006 RSI: 0000000020000500 RDI: 0000000000000003
RBP: 000000000118bf68 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000200017c0 R11: 0000000000000246 R12: 000000000118bf2c
R13: 00007ffe203745cf R14: 00007fbef802a9c0 R15: 000000000118bf2c

Allocated by task 14486:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:461
 slab_post_alloc_hook mm/slab.h:506 [inline]
 slab_alloc_node mm/slub.c:2889 [inline]
 slab_alloc mm/slub.c:2897 [inline]
 kmem_cache_alloc+0x122/0x460 mm/slub.c:2902
 getname_flags.part.0+0x50/0x4f0 fs/namei.c:138
 getname_flags+0x9a/0xe0 include/linux/audit.h:319
 getname fs/namei.c:209 [inline]
 __do_sys_renameat fs/namei.c:4501 [inline]
 __se_sys_renameat fs/namei.c:4498 [inline]
 __x64_sys_renameat+0xad/0xf0 fs/namei.c:4498
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 14486:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:56
 kasan_set_free_info+0x1b/0x30 mm/kasan/generic.c:355
 __kasan_slab_free+0x102/0x140 mm/kasan/common.c:422
 slab_free_hook mm/slub.c:1544 [inline]
 slab_free_freelist_hook+0x5d/0x150 mm/slub.c:1577
 slab_free mm/slub.c:3140 [inline]
 kmem_cache_free+0x82/0x350 mm/slub.c:3156
 putname+0xe1/0x120 fs/namei.c:259
 do_renameat2+0x3e6/0xc00 fs/namei.c:4481
 __do_sys_renameat fs/namei.c:4501 [inline]
 __se_sys_renameat fs/namei.c:4498 [inline]
 __x64_sys_renameat+0xbf/0xf0 fs/namei.c:4498
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff8880633cc400
 which belongs to the cache names_cache of size 4096
The buggy address is located 0 bytes inside of
 4096-byte region [ffff8880633cc400, ffff8880633cd400)
The buggy address belongs to the page:
page:00000000f2c066e0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x633c8
head:00000000f2c066e0 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff8880101c1280
raw: 0000000000000000 0000000000070007 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880633cc300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880633cc380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880633cc400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff8880633cc480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880633cc500: 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
2020/10/30 19:00 linux-next 4e78c578cb98 a6e3ac3b .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/10/30 17:58 linux-next 4e78c578cb98 a6e3ac3b .config console log report info ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.