================================================================== BUG: KASAN: use-after-free in ext4_search_dir+0xf7/0x1b0 fs/ext4/namei.c:1515 Read of size 1 at addr ffff88810d482ecf by task syz.4.545/2600 CPU: 0 PID: 2600 Comm: syz.4.545 Not tainted 5.10.223-syzkaller-00011-g1c5354a314ea #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x81/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:435 [inline] kasan_report+0x179/0x1c0 mm/kasan/report.c:452 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:306 ext4_search_dir+0xf7/0x1b0 fs/ext4/namei.c:1515 ext4_find_inline_entry+0x4b6/0x5e0 fs/ext4/inline.c:1700 __ext4_find_entry+0x2b0/0x1990 fs/ext4/namei.c:1588 ext4_lookup_entry fs/ext4/namei.c:1743 [inline] ext4_lookup+0x3c6/0xaa0 fs/ext4/namei.c:1811 __lookup_slow+0x2b9/0x400 fs/namei.c:1640 lookup_slow+0x5a/0x80 fs/namei.c:1657 walk_component+0x48c/0x610 fs/namei.c:1952 link_path_walk+0x5c7/0xbd0 path_lookupat+0xa0/0x450 fs/namei.c:2426 filename_lookup+0x26a/0x6f0 fs/namei.c:2460 user_path_at_empty+0x40/0x50 fs/namei.c:2740 user_path_at include/linux/namei.h:60 [inline] do_mount fs/namespace.c:3250 [inline] __do_sys_mount fs/namespace.c:3461 [inline] __se_sys_mount+0x285/0x3b0 fs/namespace.c:3438 __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3438 do_syscall_64+0x34/0x70 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7fb5689bbef9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fb567614038 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007fb568b74058 RCX: 00007fb5689bbef9 RDX: 0000000000000000 RSI: 0000000020000200 RDI: 00000000200001c0 RBP: 00007fb568a2e9f6 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000101091 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fb568b74058 R15: 00007fff44dc6728 Allocated by task 1850: 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_slab_alloc+0xb1/0xe0 mm/kasan/common.c:463 kasan_slab_alloc include/linux/kasan.h:244 [inline] slab_post_alloc_hook+0x61/0x2f0 mm/slab.h:583 slab_alloc_node mm/slub.c:2947 [inline] slab_alloc mm/slub.c:2955 [inline] kmem_cache_alloc+0x168/0x2e0 mm/slub.c:2960 dup_mm kernel/fork.c:1426 [inline] copy_mm+0x198/0x13a0 kernel/fork.c:1491 copy_process+0x1175/0x3340 kernel/fork.c:2183 kernel_clone+0x21e/0x9e0 kernel/fork.c:2574 __do_sys_clone kernel/fork.c:2700 [inline] __se_sys_clone kernel/fork.c:2684 [inline] __x64_sys_clone+0x23f/0x290 kernel/fork.c:2684 do_syscall_64+0x34/0x70 entry_SYSCALL_64_after_hwframe+0x61/0xcb The buggy address belongs to the object at ffff88810d482d00 which belongs to the cache mm_struct of size 1144 The buggy address is located 463 bytes inside of 1144-byte region [ffff88810d482d00, ffff88810d483178) The buggy address belongs to the page: page:ffffea0004352000 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88810d482d00 pfn:0x10d480 head:ffffea0004352000 order:2 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head) raw: 4000000000010200 ffffea000438e500 0000000200000002 ffff88810004cc00 raw: ffff88810d482d00 00000000800c000b 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 93, ts 25520819587, free_ts 25513497531 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2456 [inline] prep_new_page+0x166/0x180 mm/page_alloc.c:2462 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5348 allocate_slab mm/slub.c:1808 [inline] new_slab+0x80/0x400 mm/slub.c:1869 new_slab_objects mm/slub.c:2627 [inline] ___slab_alloc+0x302/0x4b0 mm/slub.c:2791 __slab_alloc+0x63/0xa0 mm/slub.c:2831 slab_alloc_node mm/slub.c:2913 [inline] slab_alloc mm/slub.c:2955 [inline] kmem_cache_alloc+0x1b9/0x2e0 mm/slub.c:2960 dup_mm kernel/fork.c:1426 [inline] copy_mm+0x198/0x13a0 kernel/fork.c:1491 copy_process+0x1175/0x3340 kernel/fork.c:2183 kernel_clone+0x21e/0x9e0 kernel/fork.c:2574 __do_sys_clone kernel/fork.c:2700 [inline] __se_sys_clone kernel/fork.c:2684 [inline] __x64_sys_clone+0x23f/0x290 kernel/fork.c:2684 do_syscall_64+0x34/0x70 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_pages_ok+0x82c/0x850 mm/page_alloc.c:1629 free_the_page+0x76/0x370 mm/page_alloc.c:5409 __free_pages+0x67/0xc0 mm/page_alloc.c:5418 free_pages+0x7c/0x90 mm/page_alloc.c:5429 __stack_depot_save+0x47b/0x4d0 lib/stackdepot.c:359 kasan_save_stack mm/kasan/common.c:39 [inline] kasan_set_track+0x5d/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x121/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:1595 [inline] slab_free_freelist_hook+0xc0/0x190 mm/slub.c:1621 slab_free mm/slub.c:3203 [inline] kmem_cache_free+0xa9/0x1e0 mm/slub.c:3219 kernfs_put+0x392/0x520 fs/kernfs/dir.c:547 kernfs_remove_by_name_ns+0xf4/0x160 fs/kernfs/dir.c:1599 kernfs_remove_by_name include/linux/kernfs.h:623 [inline] sysfs_unmerge_group+0xd3/0x130 fs/sysfs/group.c:369 rpm_sysfs_remove drivers/base/power/sysfs.c:826 [inline] dpm_sysfs_remove+0x74/0xc0 drivers/base/power/sysfs.c:835 device_del+0x262/0xf00 drivers/base/core.c:3429 Memory state around the buggy address: ffff88810d482d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88810d482e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88810d482e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88810d482f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88810d482f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================