syzbot


KASAN: use-after-free Read in __fput (2)

Status: auto-closed as invalid on 2019/02/22 10:26
Subsystems: fs
[Documentation on labels]
Reported-by: syzbot+84182572be3bf4a0f9b9@syzkaller.appspotmail.com
First crash: 2205d, last: 2205d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in __fput (2) 0 (1) 2018/04/19 16:13
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in __fput fs 23 2331d 2365d 4/26 fixed on 2018/02/13 04:59
linux-4.19 KASAN: use-after-free Read in __fput syz done 1 1330d 1330d 1/1 fixed on 2020/10/03 03:32
upstream KASAN: use-after-free Read in __fput (3) fs syz done unreliable 1 1336d 1332d 0/26 auto-obsoleted due to no activity on 2022/09/19 18:33

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in fsnotify_close include/linux/fsnotify.h:233 [inline]
BUG: KASAN: use-after-free in __fput+0x807/0x890 fs/file_table.c:195
Read of size 8 at addr ffff8801c96aa1c8 by task syz-executor1/10565

CPU: 0 PID: 10565 Comm: syz-executor1 Not tainted 4.16.0+ #2
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+0x1b9/0x29f lib/dump_stack.c:53
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0xac/0x2f5 mm/kasan/report.c:412
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 fsnotify_close include/linux/fsnotify.h:233 [inline]
 __fput+0x807/0x890 fs/file_table.c:195
 ____fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x1e4/0x290 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x1aee/0x2730 kernel/exit.c:865
 do_group_exit+0x16f/0x430 kernel/exit.c:968
 get_signal+0x886/0x1960 kernel/signal.c:2469
 do_signal+0x90/0x2020 arch/x86/kernel/signal.c:810
 exit_to_usermode_loop+0x28a/0x310 arch/x86/entry/common.c:162
 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
 do_syscall_64+0x792/0x9d0 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x455259
RSP: 002b:00007efdb432bce8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 000000000072bf80 RCX: 0000000000455259
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 000000000072bf80
RBP: 000000000072bf80 R08: 0000000000000000 R09: 000000000072bf58
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000a3e81f R14: 00007efdb432c9c0 R15: 0000000000000001

Allocated by task 10558:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:552
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489
 slab_post_alloc_hook mm/slab.h:443 [inline]
 slab_alloc mm/slab.c:3380 [inline]
 kmem_cache_alloc+0x11b/0x760 mm/slab.c:3540
 __d_alloc+0xc1/0xc00 fs/dcache.c:1610
 d_alloc_pseudo+0x1d/0x30 fs/dcache.c:1732
 sock_alloc_file+0x157/0x4e0 net/socket.c:401
 __sys_accept4+0x28d/0x8a0 net/socket.c:1580
 SYSC_accept4 net/socket.c:1626 [inline]
 SyS_accept4+0x2c/0x40 net/socket.c:1623
 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 10565:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:520
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:527
 __cache_free mm/slab.c:3486 [inline]
 kmem_cache_free+0x86/0x2d0 mm/slab.c:3744
 __d_free fs/dcache.c:266 [inline]
 dentry_free+0xe9/0x170 fs/dcache.c:342
 __dentry_kill+0x516/0x770 fs/dcache.c:589
 dentry_kill fs/dcache.c:616 [inline]
 dput.part.25+0x7cb/0x9a0 fs/dcache.c:831
 dput+0x1f/0x30 fs/dcache.c:795
 path_put+0x31/0x70 fs/namei.c:481
 free_fs_struct+0x22/0x60 fs/fs_struct.c:90
 exit_fs+0xf3/0x130 fs/fs_struct.c:107
 do_exit+0xf58/0x2730 kernel/exit.c:861
 do_group_exit+0x16f/0x430 kernel/exit.c:968
 get_signal+0x886/0x1960 kernel/signal.c:2469
 do_signal+0x90/0x2020 arch/x86/kernel/signal.c:810
 exit_to_usermode_loop+0x28a/0x310 arch/x86/entry/common.c:162
 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
 do_syscall_64+0x792/0x9d0 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8801c96aa170
 which belongs to the cache dentry(29:syz1) of size 288
The buggy address is located 88 bytes inside of
 288-byte region [ffff8801c96aa170, ffff8801c96aa290)
The buggy address belongs to the page:
page:ffffea000725aa80 count:1 mapcount:0 mapping:ffff8801c96aa000 index:0x0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801c96aa000 0000000000000000 000000010000000b
raw: ffffea00072dee20 ffffea000725dda0 ffff8801d8328c00 ffff8801b45ba000
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff8801b45ba000

Memory state around the buggy address:
 ffff8801c96aa080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801c96aa100: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fb fb
>ffff8801c96aa180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                              ^
 ffff8801c96aa200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801c96aa280: fb fb fc fc fc fc fc fc fc fc fc fc fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/04/11 08:46 net-next-old 17dec0a94915 8b8de427 .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.