================================================================== BUG: KASAN: double-free or invalid-free in kfree+0x19e/0x220 mm/slub.c:4574 CPU: 1 PID: 10293 Comm: syz-executor.3 Not tainted 5.15.98-syzkaller-00348-g7364b7abbafb #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106 print_address_description+0x87/0x3b0 mm/kasan/report.c:248 kasan_report_invalid_free+0x6b/0xa0 mm/kasan/report.c:370 __kasan_kfree_large+0x82/0x90 mm/kasan/common.c:398 kasan_kfree_large include/linux/kasan.h:201 [inline] kfree_hook mm/slub.c:1687 [inline] free_nonslab_page+0x3c/0xc0 mm/slub.c:3551 kfree+0x19e/0x220 mm/slub.c:4574 kvfree+0x35/0x40 mm/util.c:658 ext4_xattr_move_to_block fs/ext4/xattr.c:2617 [inline] ext4_xattr_make_inode_space fs/ext4/xattr.c:2680 [inline] ext4_expand_extra_isize_ea+0x11dc/0x1bd0 fs/ext4/xattr.c:2772 __ext4_expand_extra_isize+0x303/0x3f0 fs/ext4/inode.c:5856 ext4_try_to_expand_extra_isize fs/ext4/inode.c:5899 [inline] __ext4_mark_inode_dirty+0x4af/0x7a0 fs/ext4/inode.c:5977 __ext4_unlink+0x8cd/0xae0 fs/ext4/namei.c:3256 ext4_unlink+0x142/0x3f0 fs/ext4/namei.c:3299 vfs_unlink+0x38c/0x630 fs/namei.c:4153 do_unlinkat+0x47d/0x910 fs/namei.c:4221 __do_sys_unlinkat fs/namei.c:4264 [inline] __se_sys_unlinkat fs/namei.c:4257 [inline] __x64_sys_unlinkat+0xcd/0xf0 fs/namei.c:4257 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7fa4f5dce0f9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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:00007fa4f4b41168 EFLAGS: 00000246 ORIG_RAX: 0000000000000107 RAX: ffffffffffffffda RBX: 00007fa4f5eedf80 RCX: 00007fa4f5dce0f9 RDX: 0000000000000000 RSI: 0000000020000000 RDI: 0000000000000003 RBP: 00007fa4f5e29b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc3d982b9f R14: 00007fa4f4b41300 R15: 0000000000022000 The buggy address belongs to the page: page:ffffea000485a540 refcount:9 mapcount:0 mapping:ffff888109197258 index:0x1 pfn:0x121695 memcg:ffff8881001f8000 aops:def_blk_aops ino:700003 flags: 0x400000000002201c(uptodate|dirty|lru|private|mappedtodisk|zone=1) raw: 400000000002201c ffffea000570d448 ffffea0007d795c8 ffff888109197258 raw: 0000000000000001 ffff888185fe79d8 00000009ffffffff ffff8881001f8000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 9174, ts 2689497836675, free_ts 2689483853736 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2502 prep_new_page mm/page_alloc.c:2508 [inline] get_page_from_freelist+0x2c14/0x2cf0 mm/page_alloc.c:4291 __alloc_pages+0x386/0x7b0 mm/page_alloc.c:5569 __alloc_pages_node include/linux/gfp.h:591 [inline] alloc_pages_node include/linux/gfp.h:605 [inline] alloc_pages include/linux/gfp.h:618 [inline] __page_cache_alloc include/linux/pagemap.h:305 [inline] page_cache_ra_unbounded+0x316/0x920 mm/readahead.c:227 do_page_cache_ra mm/readahead.c:280 [inline] force_page_cache_ra+0x3c0/0x420 mm/readahead.c:312 page_cache_sync_ra+0x2d5/0x4d0 mm/readahead.c:588 page_cache_sync_readahead include/linux/pagemap.h:831 [inline] filemap_get_pages mm/filemap.c:2551 [inline] filemap_read+0x6ec/0x21c0 mm/filemap.c:2634 generic_file_read_iter+0xae/0x420 mm/filemap.c:2785 blkdev_read_iter+0x135/0x190 block/fops.c:545 call_read_iter include/linux/fs.h:2151 [inline] new_sync_read fs/read_write.c:404 [inline] vfs_read+0xa7e/0xd40 fs/read_write.c:485 ksys_read+0x199/0x2c0 fs/read_write.c:623 __do_sys_read fs/read_write.c:633 [inline] __se_sys_read fs/read_write.c:631 [inline] __x64_sys_read+0x7b/0x90 fs/read_write.c:631 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1370 [inline] free_pcp_prepare mm/page_alloc.c:1442 [inline] free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3441 free_unref_page_list+0x15d/0x980 mm/page_alloc.c:3562 release_pages+0x1310/0x1370 mm/swap.c:1009 free_pages_and_swap_cache+0x8a/0xa0 mm/swap_state.c:320 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline] tlb_flush_mmu_free mm/mmu_gather.c:240 [inline] tlb_flush_mmu mm/mmu_gather.c:247 [inline] tlb_finish_mmu+0x177/0x320 mm/mmu_gather.c:338 exit_mmap+0x3ef/0x6f0 mm/mmap.c:3211 __mmput+0x95/0x310 kernel/fork.c:1171 mmput+0x5b/0x170 kernel/fork.c:1194 exit_mm kernel/exit.c:551 [inline] do_exit+0xbb4/0x2b60 kernel/exit.c:862 do_group_exit+0x141/0x310 kernel/exit.c:997 get_signal+0x7a3/0x1630 kernel/signal.c:2891 arch_do_signal_or_restart+0xbd/0x1680 arch/x86/kernel/signal.c:865 handle_signal_work kernel/entry/common.c:148 [inline] exit_to_user_mode_loop+0xa0/0xe0 kernel/entry/common.c:172 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x26/0x160 kernel/entry/common.c:300 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86 Memory state around the buggy address: ffff888121695480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888121695500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888121695580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff888121695600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888121695680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================