EXT4-fs (loop0): mounted filesystem 00000000-0000-0000-0000-000000000000 r/w without journal. Quota mode: none. ext4 filesystem being mounted at /0/file0 supports timestamps until 2038-01-19 (0x7fffffff) ================================================================== BUG: KASAN: use-after-free in ext4_xattr_set_entry+0x179e/0x1e20 fs/ext4/xattr.c:1740 Read of size 260 at addr ffff88811cde4000 by task syz.0.17/5956 CPU: 0 UID: 0 PID: 5956 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xba/0x230 mm/kasan/report.c:482 kasan_report+0x117/0x150 mm/kasan/report.c:595 check_region_inline mm/kasan/generic.c:-1 [inline] kasan_check_range+0x264/0x2c0 mm/kasan/generic.c:200 __asan_memmove+0x29/0x70 mm/kasan/shadow.c:94 ext4_xattr_set_entry+0x179e/0x1e20 fs/ext4/xattr.c:1740 ext4_xattr_block_set+0x636/0x2b00 fs/ext4/xattr.c:1961 ext4_xattr_set_handle+0xdc2/0x14d0 fs/ext4/xattr.c:2432 ext4_xattr_set+0x255/0x340 fs/ext4/xattr.c:2560 __vfs_removexattr+0x431/0x470 fs/xattr.c:518 __vfs_removexattr_locked+0xe2/0x280 fs/xattr.c:553 vfs_removexattr+0x7f/0x230 fs/xattr.c:575 ovl_do_removexattr fs/overlayfs/overlayfs.h:335 [inline] ovl_removexattr fs/overlayfs/overlayfs.h:343 [inline] ovl_make_workdir fs/overlayfs/super.c:760 [inline] ovl_get_workdir fs/overlayfs/super.c:840 [inline] ovl_fill_super_creds fs/overlayfs/super.c:1453 [inline] ovl_fill_super+0x4c09/0x5e00 fs/overlayfs/super.c:1564 vfs_get_super fs/super.c:1327 [inline] get_tree_nodev+0xbb/0x150 fs/super.c:1346 vfs_get_tree+0x92/0x2a0 fs/super.c:1754 fc_mount fs/namespace.c:1193 [inline] do_new_mount_fc fs/namespace.c:3763 [inline] do_new_mount+0x341/0xd30 fs/namespace.c:3839 do_mount fs/namespace.c:4172 [inline] __do_sys_mount fs/namespace.c:4361 [inline] __se_sys_mount+0x31d/0x420 fs/namespace.c:4338 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f60b0d9c799 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:00007ffcaa4270a8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f60b1015fa0 RCX: 00007f60b0d9c799 RDX: 0000200000000b80 RSI: 0000200000000000 RDI: 0000000000000000 RBP: 00007f60b0e32bd9 R08: 0000200000000100 R09: 0000000000000000 R10: 0000000000000804 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f60b1015fac R14: 00007f60b1015fa0 R15: 00007f60b1015fa0 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x39c pfn:0x11cde4 flags: 0x17ff00000000000(node=0|zone=2|lastcpupid=0x7ff) raw: 017ff00000000000 ffffea0004737948 ffff888121040d70 0000000000000000 raw: 000000000000039c 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Movable, gfp_mask 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 5919, tgid 5919 (syz-executor), ts 71335198059, free_ts 71626869117 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x231/0x280 mm/page_alloc.c:1889 prep_new_page mm/page_alloc.c:1897 [inline] get_page_from_freelist+0x24dc/0x2580 mm/page_alloc.c:3962 __alloc_frozen_pages_noprof+0x18d/0x380 mm/page_alloc.c:5250 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2484 folio_alloc_mpol_noprof mm/mempolicy.c:2503 [inline] vma_alloc_folio_noprof+0xea/0x210 mm/mempolicy.c:2538 folio_prealloc mm/memory.c:-1 [inline] do_cow_fault mm/memory.c:5822 [inline] do_fault mm/memory.c:5934 [inline] do_pte_missing+0x4ea/0x3750 mm/memory.c:4477 handle_pte_fault mm/memory.c:6316 [inline] __handle_mm_fault mm/memory.c:6454 [inline] handle_mm_fault+0x1bec/0x3310 mm/memory.c:6623 do_user_addr_fault+0xa73/0x1340 arch/x86/mm/fault.c:1334 handle_page_fault arch/x86/mm/fault.c:1474 [inline] exc_page_fault+0x6a/0xc0 arch/x86/mm/fault.c:1527 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618 page last free pid 5920 tgid 5920 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] __free_pages_prepare mm/page_alloc.c:1433 [inline] free_unref_folios+0xed5/0x16d0 mm/page_alloc.c:3040 folios_put_refs+0x789/0x8d0 mm/swap.c:1002 free_pages_and_swap_cache+0x537/0x5b0 mm/swap_state.c:426 __tlb_batch_free_encoded_pages mm/mmu_gather.c:138 [inline] tlb_batch_pages_flush mm/mmu_gather.c:151 [inline] tlb_flush_mmu_free mm/mmu_gather.c:398 [inline] tlb_flush_mmu+0x6d3/0xa30 mm/mmu_gather.c:405 tlb_finish_mmu+0xf9/0x230 mm/mmu_gather.c:530 exit_mmap+0x498/0xa10 mm/mmap.c:1315 __mmput+0x118/0x430 kernel/fork.c:1174 exit_mm+0x168/0x220 kernel/exit.c:581 do_exit+0x62e/0x2320 kernel/exit.c:959 do_group_exit+0x21b/0x2d0 kernel/exit.c:1112 get_signal+0x1284/0x1330 kernel/signal.c:3034 arch_do_signal_or_restart+0xbc/0x830 arch/x86/kernel/signal.c:337 __exit_to_user_mode_loop kernel/entry/common.c:64 [inline] exit_to_user_mode_loop+0x86/0x480 kernel/entry/common.c:98 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:226 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:256 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:325 [inline] do_syscall_64+0x32d/0xf80 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88811cde3f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88811cde3f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88811cde4000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88811cde4080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88811cde4100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================