EXT4-fs warning (device loop6): dx_probe:946: inode #2: comm syz.6.18: Corrupt directory, running e2fsck is recommended ================================================================== BUG: KASAN: use-after-free in __ext4_check_dir_entry+0x7e3/0x990 fs/ext4/dir.c:85 Read of size 2 at addr ffff88811a979003 by task syz.6.18/544 CPU: 1 PID: 544 Comm: syz.6.18 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026 Call Trace: __dump_stack+0x21/0x24 lib/dump_stack.c:77 dump_stack_lvl+0x1a7/0x208 lib/dump_stack.c:118 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:435 [inline] kasan_report+0x100/0x140 mm/kasan/report.c:452 __asan_report_load2_noabort+0x14/0x20 mm/kasan/report_generic.c:307 __ext4_check_dir_entry+0x7e3/0x990 fs/ext4/dir.c:85 ext4_readdir+0x1220/0x3a80 fs/ext4/dir.c:261 iterate_dir+0x25c/0x560 fs/readdir.c:-1 __do_sys_getdents64 fs/readdir.c:369 [inline] __se_sys_getdents64+0xf2/0x250 fs/readdir.c:354 __x64_sys_getdents64+0x7b/0x90 fs/readdir.c:354 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7f2cd3ff2379 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 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 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f2cd3e57028 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9 RAX: ffffffffffffffda RBX: 00007f2cd423dfa0 RCX: 00007f2cd3ff2379 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000006 RBP: 00007f2cd4085d68 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f2cd423e038 R14: 00007f2cd423dfa0 R15: 00007fff80bf9448 Allocated by task 456: 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:430 [inline] ____kasan_kmalloc mm/kasan/common.c:509 [inline] __kasan_kmalloc+0xd4/0x100 mm/kasan/common.c:518 kasan_kmalloc include/linux/kasan.h:254 [inline] kmem_cache_alloc_trace+0x179/0x2e0 mm/slub.c:2979 kmalloc include/linux/slab.h:555 [inline] kzalloc include/linux/slab.h:667 [inline] kernfs_fop_open+0x375/0xbb0 fs/kernfs/file.c:628 do_dentry_open+0x7a5/0x10a0 fs/open.c:819 vfs_open+0x73/0x80 fs/open.c:944 do_open fs/namei.c:3441 [inline] path_openat+0x26c3/0x3040 fs/namei.c:3559 do_filp_open+0x1df/0x400 fs/namei.c:3586 do_sys_openat2+0x19f/0x750 fs/open.c:1219 do_sys_open fs/open.c:1235 [inline] __do_sys_openat fs/open.c:1251 [inline] __se_sys_openat fs/open.c:1246 [inline] __x64_sys_openat+0x136/0x160 fs/open.c:1246 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xcb Freed by task 456: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4a/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x125/0x160 mm/kasan/common.c:362 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370 kasan_slab_free include/linux/kasan.h:220 [inline] slab_free_hook mm/slub.c:1600 [inline] slab_free_freelist_hook+0xc5/0x190 mm/slub.c:1626 slab_free mm/slub.c:3208 [inline] kfree+0xc0/0x270 mm/slub.c:4196 kernfs_fop_release+0x1c4/0x240 fs/kernfs/file.c:763 __fput+0x2dc/0x730 fs/file_table.c:281 ____fput+0x15/0x20 fs/file_table.c:314 task_work_run+0x127/0x190 kernel/task_work.c:189 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop+0xcb/0xe0 kernel/entry/common.c:175 exit_to_user_mode_prepare+0x76/0xa0 kernel/entry/common.c:202 syscall_exit_to_user_mode+0x1d/0x40 kernel/entry/common.c:277 do_syscall_64+0x3d/0x40 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x61/0xcb The buggy address belongs to the object at ffff88811a979000 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 3 bytes inside of 192-byte region [ffff88811a979000, ffff88811a9790c0) The buggy address belongs to the page: page:ffffea00046a5e40 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11a979 flags: 0x4000000000000200(slab) raw: 4000000000000200 dead000000000100 dead000000000122 ffff888100043380 raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 95, ts 40992592612, free_ts 40992295270 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2456 [inline] prep_new_page+0x176/0x190 mm/page_alloc.c:2462 get_page_from_freelist+0x225f/0x23f0 mm/page_alloc.c:4254 __alloc_pages_nodemask+0x29a/0x640 mm/page_alloc.c:5384 alloc_slab_page mm/slub.c:-1 [inline] allocate_slab mm/slub.c:1813 [inline] new_slab+0x84/0x3f0 mm/slub.c:1874 new_slab_objects mm/slub.c:2632 [inline] ___slab_alloc+0x2f8/0x4c0 mm/slub.c:2796 __slab_alloc+0x63/0xa0 mm/slub.c:2836 slab_alloc_node mm/slub.c:2918 [inline] slab_alloc mm/slub.c:2960 [inline] kmem_cache_alloc_trace+0x1a8/0x2e0 mm/slub.c:2977 kmalloc include/linux/slab.h:555 [inline] kzalloc include/linux/slab.h:667 [inline] kernfs_fop_open+0x375/0xbb0 fs/kernfs/file.c:628 do_dentry_open+0x7a5/0x10a0 fs/open.c:819 vfs_open+0x73/0x80 fs/open.c:944 do_open fs/namei.c:3441 [inline] path_openat+0x26c3/0x3040 fs/namei.c:3559 do_filp_open+0x1df/0x400 fs/namei.c:3586 do_sys_openat2+0x19f/0x750 fs/open.c:1219 do_sys_open fs/open.c:1235 [inline] __do_sys_openat fs/open.c:1251 [inline] __se_sys_openat fs/open.c:1246 [inline] __x64_sys_openat+0x136/0x160 fs/open.c:1246 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xcb page last free stack trace: reset_page_owner include/linux/page_owner.h:28 [inline] free_pages_prepare mm/page_alloc.c:1349 [inline] free_pcp_prepare mm/page_alloc.c:1421 [inline] free_unref_page_prepare+0x2b7/0x2d0 mm/page_alloc.c:3336 free_unref_page mm/page_alloc.c:3391 [inline] free_the_page mm/page_alloc.c:5443 [inline] __free_pages+0x146/0x390 mm/page_alloc.c:5454 free_pages+0x82/0x90 mm/page_alloc.c:5465 selinux_genfs_get_sid+0x20b/0x250 security/selinux/hooks.c:1333 inode_doinit_with_dentry+0x879/0xd70 security/selinux/hooks.c:1530 selinux_d_instantiate+0x27/0x40 security/selinux/hooks.c:6396 security_d_instantiate+0x9e/0xf0 security/security.c:1980 d_splice_alias+0x6d/0x390 fs/dcache.c:3038 kernfs_iop_lookup+0x2c5/0x310 fs/kernfs/dir.c:1178 __lookup_slow+0x2b8/0x410 fs/namei.c:1648 lookup_slow+0x57/0x70 fs/namei.c:1665 walk_component+0x326/0x460 fs/namei.c:1960 lookup_last fs/namei.c:2411 [inline] path_lookupat+0x155/0x430 fs/namei.c:2435 filename_lookup+0x1fd/0x660 fs/namei.c:2468 user_path_at_empty+0x43/0x50 fs/namei.c:2790 do_readlinkat+0xd9/0x490 fs/stat.c:414 Memory state around the buggy address: ffff88811a978f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88811a978f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88811a979000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88811a979080: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88811a979100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== EXT4-fs error (device loop6): ext4_readdir:263: inode #2: block 3: comm syz.6.18: path /0/file0: bad entry in directory: rec_len % 4 != 0 - offset=2047, inode=1693458432, rec_len=33050, size=2048 fake=0 EXT4-fs (loop6): Remounting filesystem read-only