================================================================== 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 ffff8880589bd003 by task syz-executor.2/21786 CPU: 1 PID: 21786 Comm: syz-executor.2 Not tainted 5.17.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/0x3a0 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report+0x19a/0x1f0 mm/kasan/report.c:459 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:1092 __ext4_new_inode+0x456f/0x5740 fs/ext4/ialloc.c:1325 ext4_mkdir+0x3ea/0xc00 fs/ext4/namei.c:2929 vfs_mkdir+0x2f6/0x4d0 fs/namei.c:3933 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:1413 legacy_get_tree+0xea/0x180 fs/fs_context.c:610 vfs_get_tree+0x86/0x270 fs/super.c:1497 do_new_mount fs/namespace.c:2994 [inline] path_mount+0x1986/0x2c30 fs/namespace.c:3324 do_mount fs/namespace.c:3337 [inline] __do_sys_mount fs/namespace.c:3545 [inline] __se_sys_mount+0x308/0x3c0 fs/namespace.c:3522 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:0x7fa82600d059 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fa824982168 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007fa82611ff60 RCX: 00007fa82600d059 RDX: 0000000020000080 RSI: 0000000020000040 RDI: 0000000000000000 RBP: 00007fa82606708d R08: 0000000020000180 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc373e061f R14: 00007fa824982300 R15: 0000000000022000 The buggy address belongs to the page: page:ffffea0001626f40 refcount:0 mapcount:-128 mapping:0000000000000000 index:0x100 pfn:0x589bd flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 ffffea0001632508 ffffea0001fbb6c8 0000000000000000 raw: 0000000000000100 0000000000000000 00000000ffffff7f 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 0x1100cca(GFP_HIGHUSER_MOVABLE), pid 6932, ts 285844572045, free_ts 286263115030 prep_new_page mm/page_alloc.c:2434 [inline] get_page_from_freelist+0x729/0x9e0 mm/page_alloc.c:4165 __alloc_pages+0x255/0x580 mm/page_alloc.c:5389 alloc_pages_vma+0x968/0x1150 mm/mempolicy.c:2232 wp_page_copy+0x22b/0x1670 mm/memory.c:3012 handle_pte_fault mm/memory.c:4588 [inline] __handle_mm_fault mm/memory.c:4705 [inline] handle_mm_fault+0x23d9/0x39e0 mm/memory.c:4803 do_user_addr_fault+0x8c4/0x1060 arch/x86/mm/fault.c:1397 handle_page_fault arch/x86/mm/fault.c:1484 [inline] exc_page_fault+0xa1/0x1e0 arch/x86/mm/fault.c:1540 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:1352 [inline] free_pcp_prepare+0xd1c/0xe00 mm/page_alloc.c:1404 free_unref_page_prepare mm/page_alloc.c:3325 [inline] free_unref_page_list+0x11f/0xa50 mm/page_alloc.c:3441 release_pages+0x15a7/0x17d0 mm/swap.c:980 tlb_batch_pages_flush mm/mmu_gather.c:50 [inline] tlb_flush_mmu_free mm/mmu_gather.c:243 [inline] tlb_flush_mmu+0x780/0x910 mm/mmu_gather.c:250 tlb_finish_mmu+0xcb/0x200 mm/mmu_gather.c:341 exit_mmap+0x402/0x740 mm/mmap.c:3180 __mmput+0x111/0x3a0 kernel/fork.c:1114 exit_mm+0x211/0x2f0 kernel/exit.c:507 do_exit+0x5be/0x2140 kernel/exit.c:793 do_group_exit+0x2af/0x2b0 kernel/exit.c:935 get_signal+0x1831/0x2330 kernel/signal.c:2862 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 do_syscall_64+0x53/0xd0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff8880589bcf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880589bcf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8880589bd000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8880589bd080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880589bd100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================