================================================================== BUG: KASAN: use-after-free in memcmp lib/string.c:770 [inline] BUG: KASAN: use-after-free in bcmp+0xf5/0x170 lib/string.c:802 Read of size 8 at addr ffff888099f28003 by task syz-executor.5/3326 CPU: 1 PID: 3326 Comm: syz-executor.5 Not tainted 5.16.0-rc1-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1dc/0x2d8 lib/dump_stack.c:106 print_address_description+0x65/0x380 mm/kasan/report.c:247 __kasan_report mm/kasan/report.c:433 [inline] kasan_report+0x19a/0x1f0 mm/kasan/report.c:450 memcmp lib/string.c:770 [inline] bcmp+0xf5/0x170 lib/string.c:802 ext4_xattr_cmp fs/ext4/xattr.c:3000 [inline] ext4_xattr_block_cache_find fs/ext4/xattr.c:3046 [inline] ext4_xattr_block_set+0x1811/0x41d0 fs/ext4/xattr.c:1977 ext4_xattr_set_handle+0x10cb/0x22b0 fs/ext4/xattr.c:2379 ext4_initxattrs+0xa2/0x100 fs/ext4/xattr_security.c:44 security_inode_init_security+0x2a2/0x3c0 security/security.c:1100 __ext4_new_inode+0x446c/0x5650 fs/ext4/ialloc.c:1325 ext4_mkdir+0x3ea/0xc00 fs/ext4/namei.c:2929 vfs_mkdir+0x44d/0x680 fs/namei.c:3883 ovl_do_mkdir fs/overlayfs/overlayfs.h:162 [inline] ovl_mkdir_real+0x53/0x1a0 fs/overlayfs/dir.c:145 ovl_workdir_create+0x55d/0x7b0 fs/overlayfs/super.c:790 ovl_make_workdir+0xeb/0x12b0 fs/overlayfs/super.c:1368 ovl_get_workdir fs/overlayfs/super.c:1515 [inline] ovl_fill_super+0x3dfd/0x5d60 fs/overlayfs/super.c:2071 mount_nodev+0x52/0xe0 fs/super.c:1416 legacy_get_tree+0xea/0x180 fs/fs_context.c:610 vfs_get_tree+0x86/0x270 fs/super.c:1500 do_new_mount fs/namespace.c:2988 [inline] path_mount+0x1986/0x2c30 fs/namespace.c:3318 do_mount fs/namespace.c:3331 [inline] __do_sys_mount fs/namespace.c:3539 [inline] __se_sys_mount+0x308/0x3c0 fs/namespace.c:3516 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f30c4688ae9 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f30c1bfe188 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f30c479bf60 RCX: 00007f30c4688ae9 RDX: 0000000020000080 RSI: 0000000020000040 RDI: 0000000000000000 RBP: 00007f30c46e2f6d R08: 0000000020000180 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc7a70cb8f R14: 00007f30c1bfe300 R15: 0000000000022000 The buggy address belongs to the page: page:ffffea000267ca00 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x99f28 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 ffffea000257f108 ffffea000257c508 0000000000000000 raw: 0000000000000001 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 0x1100dca(GFP_HIGHUSER_MOVABLE|__GFP_ZERO), pid 30318, ts 903992463827, free_ts 904207911446 prep_new_page mm/page_alloc.c:2418 [inline] get_page_from_freelist+0x729/0x9e0 mm/page_alloc.c:4149 __alloc_pages+0x255/0x580 mm/page_alloc.c:5369 alloc_pages_vma+0x668/0x1030 mm/mempolicy.c:2152 do_anonymous_page+0x313/0x14f0 mm/memory.c:3760 handle_pte_fault mm/memory.c:4549 [inline] __handle_mm_fault mm/memory.c:4686 [inline] handle_mm_fault+0x1860/0x2560 mm/memory.c:4784 do_user_addr_fault+0x8cc/0x10c0 arch/x86/mm/fault.c:1397 handle_page_fault arch/x86/mm/fault.c:1485 [inline] exc_page_fault+0xa1/0x1e0 arch/x86/mm/fault.c:1541 asm_exc_page_fault+0x1e/0x30 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1338 [inline] free_pcp_prepare+0xd1c/0xe00 mm/page_alloc.c:1389 free_unref_page_prepare mm/page_alloc.c:3309 [inline] free_unref_page_list+0x11f/0xa50 mm/page_alloc.c:3425 release_pages+0x15a7/0x17d0 mm/swap.c:979 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline] tlb_flush_mmu_free mm/mmu_gather.c:242 [inline] tlb_flush_mmu+0x780/0x910 mm/mmu_gather.c:249 zap_pte_range+0x1a21/0x1ba0 mm/memory.c:1418 zap_pmd_range mm/memory.c:1467 [inline] zap_pud_range mm/memory.c:1496 [inline] zap_p4d_range mm/memory.c:1517 [inline] unmap_page_range+0x745/0xa20 mm/memory.c:1538 unmap_vmas+0x202/0x390 mm/memory.c:1615 exit_mmap+0x3c6/0x6f0 mm/mmap.c:3170 __mmput+0x111/0x3a0 kernel/fork.c:1113 exit_mm+0x211/0x2f0 kernel/exit.c:507 do_exit+0x688/0x24f0 kernel/exit.c:819 do_group_exit+0x168/0x2d0 kernel/exit.c:929 get_signal+0x1740/0x2120 kernel/signal.c:2830 arch_do_signal_or_restart+0x9c/0x730 arch/x86/kernel/signal.c:868 handle_signal_work kernel/entry/common.c:148 [inline] exit_to_user_mode_loop kernel/entry/common.c:172 [inline] exit_to_user_mode_prepare+0x191/0x220 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x2e/0x70 kernel/entry/common.c:300 Memory state around the buggy address: ffff888099f27f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888099f27f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888099f28000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888099f28080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888099f28100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================