loop0: detected capacity change from 0 to 1024 EXT4-fs (loop0): mounted filesystem 00000000-0000-0000-0000-000000000000 r/w without journal. Quota mode: none. ================================================================== BUG: KASAN: use-after-free in ext4_xattr_set_entry+0xdc9/0x1ed0 fs/ext4/xattr.c:1812 Write of size 234 at addr ffff888053917fb8 by task syz.0.0/5317 CPU: 0 UID: 0 PID: 5317 Comm: syz.0.0 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_address_description+0x55/0x1e0 mm/kasan/report.c:378 print_report+0x58/0x70 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_memcpy+0x40/0x70 mm/kasan/shadow.c:106 ext4_xattr_set_entry+0xdc9/0x1ed0 fs/ext4/xattr.c:1812 ext4_xattr_ibody_set+0x262/0x710 fs/ext4/xattr.c:2277 ext4_xattr_set_handle+0xd86/0x15f0 fs/ext4/xattr.c:2449 ext4_xattr_set+0x257/0x340 fs/ext4/xattr.c:2563 __vfs_setxattr+0x442/0x480 fs/xattr.c:223 __vfs_setxattr_noperm+0x12a/0x660 fs/xattr.c:257 vfs_setxattr+0x163/0x360 fs/xattr.c:344 do_setxattr fs/xattr.c:662 [inline] filename_setxattr+0x296/0x630 fs/xattr.c:690 path_setxattrat+0x408/0x450 fs/xattr.c:734 __do_sys_setxattr fs/xattr.c:768 [inline] __se_sys_setxattr fs/xattr.c:764 [inline] __x64_sys_setxattr+0xbc/0xe0 fs/xattr.c:764 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fe23339e1d9 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:00007fe23419ffe8 EFLAGS: 00000246 ORIG_RAX: 00000000000000bc RAX: ffffffffffffffda RBX: 00007fe233625fa0 RCX: 00007fe23339e1d9 RDX: 0000200000000300 RSI: 0000200000000180 RDI: 0000200000000100 RBP: 00007fe233435888 R08: 0000000000000001 R09: 0000000000000000 R10: 00000000000000ea R11: 0000000000000246 R12: 0000000000000000 R13: 00007fe233626038 R14: 00007fe233625fa0 R15: 00007fff5a3de0e8 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x559020243 pfn:0x53917 flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff) raw: 04fff00000000000 ffffea00014e6e48 ffffea00014e5b08 0000000000000000 raw: 0000000559020243 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 4988, tgid 4988 (dhcpcd), ts 94450135385 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1f9/0x250 mm/page_alloc.c:1871 prep_new_page mm/page_alloc.c:1879 [inline] get_page_from_freelist+0x2209/0x2280 mm/page_alloc.c:3943 __alloc_frozen_pages_noprof+0x217/0x5a0 mm/page_alloc.c:5436 alloc_pages_mpol+0x21e/0x390 mm/mempolicy.c:2486 folio_alloc_mpol_noprof+0x39/0x160 mm/mempolicy.c:2505 vma_alloc_folio_noprof+0xe1/0x1e0 mm/mempolicy.c:2540 folio_prealloc mm/memory.c:-1 [inline] wp_page_copy mm/memory.c:4007 [inline] do_wp_page+0x117d/0x4b80 mm/memory.c:4472 handle_pte_fault mm/memory.c:6582 [inline] __handle_mm_fault mm/memory.c:6707 [inline] handle_mm_fault+0x15d7/0x3750 mm/memory.c:6876 do_user_addr_fault+0xa4f/0x1340 arch/x86/mm/fault.c:1343 handle_page_fault arch/x86/mm/fault.c:1483 [inline] exc_page_fault+0x6a/0xc0 arch/x86/mm/fault.c:1536 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:595 page last free pid 5320 tgid 5320 ts 94547647641 stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] __free_pages_prepare mm/page_alloc.c:1418 [inline] free_unref_folios+0xdc2/0x14e0 mm/page_alloc.c:3022 folios_put_refs+0x9e9/0xb30 mm/folio.c:1036 free_pages_and_swap_cache+0x2ba/0x490 mm/swap_state.c:592 __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:417 [inline] tlb_flush_mmu+0x6d3/0xa30 mm/mmu_gather.c:424 tlb_finish_mmu+0xf4/0x220 mm/mmu_gather.c:549 exit_mmap+0x4b2/0x9f0 mm/mmap.c:1328 __mmput+0x118/0x420 kernel/fork.c:1193 exit_mm+0x18e/0x240 kernel/exit.c:592 do_exit+0x6cd/0x2360 kernel/exit.c:974 do_group_exit+0x22d/0x2f0 kernel/exit.c:1129 __do_sys_exit_group kernel/exit.c:1140 [inline] __se_sys_exit_group kernel/exit.c:1138 [inline] __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1138 x64_sys_call+0x18c6/0x18d0 arch/x86/include/generated/asm/syscalls_64.h:232 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888053917e80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888053917f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888053917f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888053918000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888053918080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================