EXT4-fs error (device loop1): ext4_readdir:260: inode #2: block 16: comm syz-executor: path /4/file1: bad entry in directory: rec_len is smaller than minimal - offset=980, inode=0, rec_len=0, size=1024 fake=0 ================================================================== BUG: KASAN: slab-use-after-free in ext4_read_inline_data fs/ext4/inline.c:209 [inline] BUG: KASAN: slab-use-after-free in ext4_read_inline_dir+0x48b/0xdf0 fs/ext4/inline.c:1483 Read of size 68 at addr ffff88805f6b641a by task syz-executor/7303 CPU: 0 UID: 0 PID: 7303 Comm: syz-executor Not tainted 6.11.0-rc6-syzkaller-00326-gd1f2d51b711a #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call Trace: __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 kasan_check_range+0x282/0x290 mm/kasan/generic.c:189 __asan_memcpy+0x29/0x70 mm/kasan/shadow.c:105 ext4_read_inline_data fs/ext4/inline.c:209 [inline] ext4_read_inline_dir+0x48b/0xdf0 fs/ext4/inline.c:1483 ext4_readdir+0x3bb/0x3500 fs/ext4/dir.c:158 iterate_dir+0x57a/0x810 fs/readdir.c:108 __do_sys_getdents64 fs/readdir.c:407 [inline] __se_sys_getdents64+0x20d/0x4f0 fs/readdir.c:392 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7febfdbaf093 Code: c1 66 0f 1f 44 00 00 48 83 c4 08 48 89 ef 5b 5d e9 42 43 f8 ff 66 90 b8 ff ff ff 7f 48 39 c2 48 0f 47 d0 b8 d9 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 05 c3 0f 1f 40 00 48 c7 c2 a8 ff ff ff f7 d8 RSP: 002b:00007ffe4f411b38 EFLAGS: 00000293 ORIG_RAX: 00000000000000d9 RAX: ffffffffffffffda RBX: 00005555867e8640 RCX: 00007febfdbaf093 RDX: 0000000000008000 RSI: 00005555867e8640 RDI: 0000000000000006 RBP: 00005555867e8614 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000001000 R11: 0000000000000293 R12: ffffffffffffffa8 R13: 0000000000000016 R14: 00005555867e8610 R15: 00007ffe4f414ed0 Allocated by task 7751: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:312 [inline] __kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:338 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3992 [inline] slab_alloc_node mm/slub.c:4041 [inline] kmem_cache_alloc_noprof+0x135/0x2a0 mm/slub.c:4048 getname_kernel+0x59/0x2f0 fs/namei.c:234 kern_path+0x1d/0x50 fs/namei.c:2702 lookup_bdev block/bdev.c:1157 [inline] bdev_file_open_by_path+0xd1/0x480 block/bdev.c:1030 btrfs_get_bdev_and_sb+0x3b/0x1c0 fs/btrfs/volumes.c:475 btrfs_open_one_device fs/btrfs/volumes.c:657 [inline] open_fs_devices+0x2ae/0x12a0 fs/btrfs/volumes.c:1196 btrfs_get_tree_super fs/btrfs/super.c:1851 [inline] btrfs_get_tree+0x504/0x1920 fs/btrfs/super.c:2114 vfs_get_tree+0x90/0x2b0 fs/super.c:1800 fc_mount+0x1b/0xb0 fs/namespace.c:1231 btrfs_get_tree_subvol fs/btrfs/super.c:2077 [inline] btrfs_get_tree+0x652/0x1920 fs/btrfs/super.c:2115 vfs_get_tree+0x90/0x2b0 fs/super.c:1800 do_new_mount+0x2be/0xb40 fs/namespace.c:3472 do_mount fs/namespace.c:3812 [inline] __do_sys_mount fs/namespace.c:4020 [inline] __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3997 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 7751: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object+0xe0/0x150 mm/kasan/common.c:240 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2256 [inline] slab_free mm/slub.c:4477 [inline] kmem_cache_free+0x145/0x350 mm/slub.c:4552 kern_path+0x3f/0x50 fs/namei.c:2705 lookup_bdev block/bdev.c:1157 [inline] bdev_file_open_by_path+0xd1/0x480 block/bdev.c:1030 btrfs_get_bdev_and_sb+0x3b/0x1c0 fs/btrfs/volumes.c:475 btrfs_open_one_device fs/btrfs/volumes.c:657 [inline] open_fs_devices+0x2ae/0x12a0 fs/btrfs/volumes.c:1196 btrfs_get_tree_super fs/btrfs/super.c:1851 [inline] btrfs_get_tree+0x504/0x1920 fs/btrfs/super.c:2114 vfs_get_tree+0x90/0x2b0 fs/super.c:1800 fc_mount+0x1b/0xb0 fs/namespace.c:1231 btrfs_get_tree_subvol fs/btrfs/super.c:2077 [inline] btrfs_get_tree+0x652/0x1920 fs/btrfs/super.c:2115 vfs_get_tree+0x90/0x2b0 fs/super.c:1800 do_new_mount+0x2be/0xb40 fs/namespace.c:3472 do_mount fs/namespace.c:3812 [inline] __do_sys_mount fs/namespace.c:4020 [inline] __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3997 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88805f6b5500 which belongs to the cache names_cache of size 4096 The buggy address is located 3866 bytes inside of freed 4096-byte region [ffff88805f6b5500, ffff88805f6b6500) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5f6b0 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xfdffffff(slab) raw: 00fff00000000040 ffff88801b6fe8c0 ffffea0001764800 0000000000000002 raw: 0000000000000000 0000000000070007 00000001fdffffff 0000000000000000 head: 00fff00000000040 ffff88801b6fe8c0 ffffea0001764800 0000000000000002 head: 0000000000000000 0000000000070007 00000001fdffffff 0000000000000000 head: 00fff00000000003 ffffea00017dac01 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5454, tgid 5454 (udevd), ts 201265260734, free_ts 197844863208 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1500 prep_new_page mm/page_alloc.c:1508 [inline] get_page_from_freelist+0x2e4c/0x2f10 mm/page_alloc.c:3446 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4702 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] alloc_slab_page+0x5f/0x120 mm/slub.c:2325 allocate_slab+0x5a/0x2f0 mm/slub.c:2488 new_slab mm/slub.c:2541 [inline] ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3727 __slab_alloc+0x58/0xa0 mm/slub.c:3817 __slab_alloc_node mm/slub.c:3870 [inline] slab_alloc_node mm/slub.c:4029 [inline] kmem_cache_alloc_noprof+0x1c1/0x2a0 mm/slub.c:4048 getname_flags+0xb7/0x540 fs/namei.c:139 do_sys_openat2+0xd2/0x1d0 fs/open.c:1410 do_sys_open fs/open.c:1431 [inline] __do_sys_openat fs/open.c:1447 [inline] __se_sys_openat fs/open.c:1442 [inline] __x64_sys_openat+0x247/0x2a0 fs/open.c:1442 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 5807 tgid 5807 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1101 [inline] __free_pages_ok+0xb46/0xcb0 mm/page_alloc.c:1221 __folio_put+0x2c8/0x440 mm/swap.c:128 folio_put include/linux/mm.h:1490 [inline] free_large_kmalloc+0x105/0x1c0 mm/slub.c:4569 kfree+0x1c4/0x360 mm/slub.c:4592 xlog_dealloc_log+0xc5/0x1a0 fs/xfs/xfs_log.c:1881 xfs_unmountfs+0x18b/0x230 fs/xfs/xfs_mount.c:1120 xfs_fs_put_super+0x65/0x150 fs/xfs/xfs_super.c:1145 generic_shutdown_super+0x136/0x2d0 fs/super.c:642 kill_block_super+0x44/0x90 fs/super.c:1696 xfs_kill_sb+0x15/0x50 fs/xfs/xfs_super.c:2045 deactivate_locked_super+0xc4/0x130 fs/super.c:473 cleanup_mnt+0x41f/0x4b0 fs/namespace.c:1373 task_work_run+0x24f/0x310 kernel/task_work.c:228 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop kernel/entry/common.c:114 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x168/0x370 kernel/entry/common.c:218 do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88805f6b6300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805f6b6380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88805f6b6400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805f6b6480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805f6b6500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================