syzbot


KASAN: use-after-free Read in evict

Status: auto-obsoleted due to no activity on 2023/04/20 02:58
Subsystems: fat
[Documentation on labels]
Reported-by: syzbot+f5268a9e6b5ec9be2572@syzkaller.appspotmail.com
First crash: 637d, last: 637d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in evict ext4 1 1700d 1696d 0/28 auto-closed as invalid on 2020/06/12 13:31
upstream BUG: unable to handle kernel paging request in evict exfat C error done 23 701d 746d 22/28 fixed on 2023/02/24 13:50
linux-5.15 BUG: unable to handle kernel paging request in evict 2 13d 29d 0/3 upstream: reported on 2024/09/10 16:38
upstream BUG: unable to handle kernel paging request in evict (2) ntfs3 3 37d 49d 0/28 moderation: reported on 2024/08/21 10:47

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __list_del_entry_valid+0x88/0x130 lib/list_debug.c:59
Read of size 8 at addr ffff88816cc4b260 by task syz-executor.5/9015

CPU: 0 PID: 9015 Comm: syz-executor.5 Not tainted 5.15.78-syzkaller-00911-gc73b4619ad86 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description+0x87/0x3d0 mm/kasan/report.c:256
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x1a6/0x1f0 mm/kasan/report.c:452
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
 __list_del_entry_valid+0x88/0x130 lib/list_debug.c:59
 __list_del_entry include/linux/list.h:132 [inline]
 list_del_init include/linux/list.h:204 [inline]
 inode_io_list_del+0x75/0x1a0 fs/fs-writeback.c:1275
 evict+0x10e/0x630 fs/inode.c:574
 iput_final fs/inode.c:1663 [inline]
 iput+0x61c/0x7d0 fs/inode.c:1689
 dentry_unlink_inode+0x349/0x430 fs/dcache.c:376
 __dentry_kill+0x3e2/0x5d0 fs/dcache.c:582
 dentry_kill+0xc0/0x2a0
 dput+0x175/0x320 fs/dcache.c:888
 __fput+0x65a/0x910 fs/file_table.c:288
 ____fput+0x15/0x20 fs/file_table.c:308
 task_work_run+0x147/0x1b0 kernel/task_work.c:164
 exit_task_work include/linux/task_work.h:32 [inline]
 do_exit+0x67e/0x24d0 kernel/exit.c:828
 do_group_exit+0x13a/0x300 kernel/exit.c:925
 get_signal+0x77e/0x1600 kernel/signal.c:2890
 arch_do_signal_or_restart+0x9f/0x670 arch/x86/kernel/signal.c:865
 handle_signal_work kernel/entry/common.c:148 [inline]
 exit_to_user_mode_loop+0xd4/0x110 kernel/entry/common.c:172
 exit_to_user_mode_prepare+0x3b/0x40 kernel/entry/common.c:207
 irqentry_exit_to_user_mode+0x9/0x20 kernel/entry/common.c:313
 irqentry_exit+0x12/0x40 kernel/entry/common.c:404
 exc_page_fault+0x75/0x1a0 arch/x86/mm/fault.c:1620
 asm_exc_page_fault+0x27/0x30 arch/x86/include/asm/idtentry.h:568
RIP: 0033:0x7ff2059690d1
Code: Unable to access opcode bytes at RIP 0x7ff2059690a7.
RSP: 002b:0000000000000030 EFLAGS: 00010217
RAX: 0000000000000000 RBX: 00007ff205a88f80 RCX: 00007ff2059690c9
RDX: 0000000000000000 RSI: 0000000000000030 RDI: 0000000000020000
RBP: 00007ff2059c4ae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000
R13: 00007fff2caa83df R14: 00007ff2046dc300 R15: 0000000000022000
 </TASK>

Allocated by task 9007:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:433 [inline]
 __kasan_slab_alloc+0xb2/0xe0 mm/kasan/common.c:466
 kasan_slab_alloc include/linux/kasan.h:244 [inline]
 slab_post_alloc_hook mm/slab.h:550 [inline]
 slab_alloc_node mm/slub.c:3236 [inline]
 slab_alloc mm/slub.c:3244 [inline]
 kmem_cache_alloc+0x189/0x2f0 mm/slub.c:3249
 fat_alloc_inode+0x1d/0xa0 fs/fat/inode.c:748
 alloc_inode fs/inode.c:236 [inline]
 new_inode_pseudo+0x64/0x220 fs/inode.c:937
 new_inode+0x28/0x1c0 fs/inode.c:966
 fat_build_inode+0x1d9/0x3a0 fs/fat/inode.c:601
 msdos_create+0x480/0x580 fs/fat/namei_msdos.c:292
 lookup_open fs/namei.c:3334 [inline]
 open_last_lookups fs/namei.c:3404 [inline]
 path_openat+0x1323/0x2ea0 fs/namei.c:3612
 do_filp_open+0x277/0x4f0 fs/namei.c:3642
 file_open_name fs/open.c:1158 [inline]
 filp_open+0x255/0x2b0 fs/open.c:1178
 do_coredump+0x1ca9/0x2320 fs/coredump.c:767
 get_signal+0x48c/0x1600 kernel/signal.c:2876
 arch_do_signal_or_restart+0x9f/0x670 arch/x86/kernel/signal.c:865
 handle_signal_work kernel/entry/common.c:148 [inline]
 exit_to_user_mode_loop+0xd4/0x110 kernel/entry/common.c:172
 exit_to_user_mode_prepare+0x3b/0x40 kernel/entry/common.c:207
 irqentry_exit_to_user_mode+0x9/0x20 kernel/entry/common.c:313
 irqentry_exit+0x12/0x40 kernel/entry/common.c:404
 exc_page_fault+0x75/0x1a0 arch/x86/mm/fault.c:1620
 asm_exc_page_fault+0x27/0x30 arch/x86/include/asm/idtentry.h:568

Freed by task 13:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x126/0x160 mm/kasan/common.c:365
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
 kasan_slab_free include/linux/kasan.h:220 [inline]
 slab_free_hook mm/slub.c:1721 [inline]
 slab_free_freelist_hook+0xc9/0x1a0 mm/slub.c:1747
 slab_free mm/slub.c:3515 [inline]
 kmem_cache_free+0x11a/0x2e0 mm/slub.c:3531
 fat_free_inode+0x20/0x30 fs/fat/inode.c:765
 i_callback+0x4b/0x70 fs/inode.c:225
 rcu_do_batch+0x55b/0xbe0 kernel/rcu/tree.c:2509
 rcu_core+0x506/0x1000 kernel/rcu/tree.c:2749
 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2762
 __do_softirq+0x27e/0x5dc kernel/softirq.c:565

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 __call_rcu kernel/rcu/tree.c:2993 [inline]
 call_rcu+0x140/0x1400 kernel/rcu/tree.c:3073
 destroy_inode fs/inode.c:291 [inline]
 evict+0x5de/0x630 fs/inode.c:602
 iput_final fs/inode.c:1663 [inline]
 iput+0x61c/0x7d0 fs/inode.c:1689
 dentry_unlink_inode+0x349/0x430 fs/dcache.c:376
 __dentry_kill+0x3e2/0x5d0 fs/dcache.c:582
 dentry_kill+0xc0/0x2a0
 dput+0x175/0x320 fs/dcache.c:888
 __fput+0x65a/0x910 fs/file_table.c:288
 ____fput+0x15/0x20 fs/file_table.c:308
 task_work_run+0x147/0x1b0 kernel/task_work.c:164
 exit_task_work include/linux/task_work.h:32 [inline]
 do_exit+0x67e/0x24d0 kernel/exit.c:828
 do_group_exit+0x13a/0x300 kernel/exit.c:925
 get_signal+0x77e/0x1600 kernel/signal.c:2890
 arch_do_signal_or_restart+0x9f/0x670 arch/x86/kernel/signal.c:865
 handle_signal_work kernel/entry/common.c:148 [inline]
 exit_to_user_mode_loop+0xd4/0x110 kernel/entry/common.c:172
 exit_to_user_mode_prepare+0x3b/0x40 kernel/entry/common.c:207
 irqentry_exit_to_user_mode+0x9/0x20 kernel/entry/common.c:313
 irqentry_exit+0x12/0x40 kernel/entry/common.c:404
 exc_page_fault+0x75/0x1a0 arch/x86/mm/fault.c:1620
 asm_exc_page_fault+0x27/0x30 arch/x86/include/asm/idtentry.h:568

Second to last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 __call_rcu kernel/rcu/tree.c:2993 [inline]
 call_rcu+0x140/0x1400 kernel/rcu/tree.c:3073
 destroy_inode fs/inode.c:291 [inline]
 evict+0x5de/0x630 fs/inode.c:602
 iput_final fs/inode.c:1663 [inline]
 iput+0x61c/0x7d0 fs/inode.c:1689
 fat_put_super+0x6e/0xc0 fs/fat/inode.c:737
 generic_shutdown_super+0x157/0x2e0 fs/super.c:466
 kill_block_super+0x80/0xe0 fs/super.c:1396
 deactivate_locked_super+0xb0/0x100 fs/super.c:335
 deactivate_super+0xa5/0xd0 fs/super.c:366
 cleanup_mnt+0x45f/0x510 fs/namespace.c:1143
 __cleanup_mnt+0x19/0x20 fs/namespace.c:1150
 task_work_run+0x147/0x1b0 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0xfd/0x110 kernel/entry/common.c:175
 exit_to_user_mode_prepare kernel/entry/common.c:207 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline]
 syscall_exit_to_user_mode+0x79/0xc0 kernel/entry/common.c:300
 do_syscall_64+0x50/0xd0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff88816cc4b0c0
 which belongs to the cache fat_inode_cache of size 912
The buggy address is located 416 bytes inside of
 912-byte region [ffff88816cc4b0c0, ffff88816cc4b450)
The buggy address belongs to the page:
page:ffffea0005b31200 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88816cc48c30 pfn:0x16cc48
head:ffffea0005b31200 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 ffffea0005b16500 0000000200000002 ffff888108586600
raw: ffff88816cc48c30 00000000800f000b 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Reclaimable, gfp_mask 0x1d2050(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 9601, ts 441526082998, free_ts 440519350891
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1ab/0x1b0 mm/page_alloc.c:2495
 prep_new_page mm/page_alloc.c:2501 [inline]
 get_page_from_freelist+0x38b/0x400 mm/page_alloc.c:4281
 __alloc_pages+0x3a8/0x7c0 mm/page_alloc.c:5548
 allocate_slab+0x62/0x580 mm/slub.c:1928
 new_slab mm/slub.c:1991 [inline]
 ___slab_alloc+0x2e2/0x6f0 mm/slub.c:3024
 __slab_alloc+0x4a/0x90 mm/slub.c:3111
 slab_alloc_node mm/slub.c:3202 [inline]
 slab_alloc mm/slub.c:3244 [inline]
 kmem_cache_alloc+0x205/0x2f0 mm/slub.c:3249
 fat_alloc_inode+0x1d/0xa0 fs/fat/inode.c:748
 alloc_inode fs/inode.c:236 [inline]
 new_inode_pseudo+0x64/0x220 fs/inode.c:937
 new_inode+0x28/0x1c0 fs/inode.c:966
 fat_fill_super+0x32c2/0x4b30 fs/fat/inode.c:1846
 msdos_fill_super+0x2e/0x40 fs/fat/namei_msdos.c:655
 mount_bdev+0x280/0x3b0 fs/super.c:1369
 msdos_mount+0x34/0x40 fs/fat/namei_msdos.c:662
 legacy_get_tree+0xf0/0x190 fs/fs_context.c:610
 vfs_get_tree+0x88/0x290 fs/super.c:1499
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1364 [inline]
 free_pcp_prepare+0x448/0x450 mm/page_alloc.c:1435
 free_unref_page_prepare mm/page_alloc.c:3433 [inline]
 free_unref_page+0x9c/0x370 mm/page_alloc.c:3513
 free_the_page mm/page_alloc.c:706 [inline]
 __free_pages+0xd8/0x100 mm/page_alloc.c:5621
 __free_slab+0xf0/0x1d0 mm/slub.c:2016
 free_slab mm/slub.c:2031 [inline]
 discard_slab+0x29/0x40 mm/slub.c:2037
 __slab_free+0x238/0x2f0 mm/slub.c:3420
 do_slab_free mm/slub.c:3503 [inline]
 ___cache_free+0x112/0x130 mm/slub.c:3522
 qlink_free+0x4d/0x90 mm/kasan/quarantine.c:157
 qlist_free_all+0x4c/0xc0 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x15a/0x180 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:443
 kasan_slab_alloc include/linux/kasan.h:244 [inline]
 slab_post_alloc_hook mm/slab.h:550 [inline]
 slab_alloc_node mm/slub.c:3236 [inline]
 slab_alloc mm/slub.c:3244 [inline]
 kmem_cache_alloc+0x189/0x2f0 mm/slub.c:3249
 getname_flags+0xba/0x510 fs/namei.c:138
 getname+0x19/0x20 fs/namei.c:217
 do_sys_openat2+0xd2/0x500 fs/open.c:1228
 do_sys_open fs/open.c:1250 [inline]
 __do_sys_openat fs/open.c:1266 [inline]
 __se_sys_openat fs/open.c:1261 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1261

Memory state around the buggy address:
 ffff88816cc4b100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88816cc4b180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88816cc4b200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff88816cc4b280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88816cc4b300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/01/12 02:00 android13-5.15-lts c73b4619ad86 96166539 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in evict
* Struck through repros no longer work on HEAD.