JFS: metapage_get_blocks failed ================================================================== BUG: KASAN: use-after-free in release_metapage+0x521/0x9b0 fs/jfs/jfs_metapage.c:750 Read of size 8 at addr ffff88805a78f190 by task syz.0.129/4867 CPU: 0 PID: 4867 Comm: syz.0.129 Not tainted 6.1.116-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15f/0x4f0 mm/kasan/report.c:395 kasan_report+0x136/0x160 mm/kasan/report.c:495 release_metapage+0x521/0x9b0 fs/jfs/jfs_metapage.c:750 write_metapage fs/jfs/jfs_metapage.h:75 [inline] flush_metapage fs/jfs/jfs_metapage.h:81 [inline] ea_write+0x69f/0xe50 fs/jfs/xattr.c:280 ea_put fs/jfs/xattr.c:621 [inline] __jfs_setxattr+0x8a5/0x11d0 fs/jfs/xattr.c:787 __jfs_xattr_set+0xf5/0x180 fs/jfs/xattr.c:936 __vfs_setxattr+0x3e7/0x420 fs/xattr.c:182 __vfs_setxattr_noperm+0x12a/0x5e0 fs/xattr.c:216 vfs_setxattr+0x21d/0x420 fs/xattr.c:309 do_setxattr fs/xattr.c:594 [inline] setxattr+0x250/0x2b0 fs/xattr.c:617 path_setxattr+0x1bc/0x2a0 fs/xattr.c:636 __do_sys_lsetxattr fs/xattr.c:659 [inline] __se_sys_lsetxattr fs/xattr.c:655 [inline] __x64_sys_lsetxattr+0xb4/0xd0 fs/xattr.c:655 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7f5bd017e719 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f5bd0fb5038 EFLAGS: 00000246 ORIG_RAX: 00000000000000bd RAX: ffffffffffffffda RBX: 00007f5bd0336130 RCX: 00007f5bd017e719 RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000020000040 RBP: 00007f5bd01f1616 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000001 R14: 00007f5bd0336130 R15: 00007ffc1cdfb8b8 Allocated by task 4867: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 __kasan_slab_alloc+0x65/0x70 mm/kasan/common.c:328 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737 slab_alloc_node mm/slub.c:3398 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x10c/0x2d0 mm/slub.c:3422 mempool_alloc+0x190/0x580 mm/mempool.c:392 alloc_metapage fs/jfs/jfs_metapage.c:176 [inline] __get_metapage+0x58f/0x1040 fs/jfs/jfs_metapage.c:651 ea_write+0x633/0xe50 fs/jfs/xattr.c:256 ea_put fs/jfs/xattr.c:621 [inline] __jfs_setxattr+0x8a5/0x11d0 fs/jfs/xattr.c:787 __jfs_xattr_set+0xf5/0x180 fs/jfs/xattr.c:936 __vfs_setxattr+0x3e7/0x420 fs/xattr.c:182 __vfs_setxattr_noperm+0x12a/0x5e0 fs/xattr.c:216 vfs_setxattr+0x21d/0x420 fs/xattr.c:309 do_setxattr fs/xattr.c:594 [inline] setxattr+0x250/0x2b0 fs/xattr.c:617 path_setxattr+0x1bc/0x2a0 fs/xattr.c:636 __do_sys_lsetxattr fs/xattr.c:659 [inline] __se_sys_lsetxattr fs/xattr.c:655 [inline] __x64_sys_lsetxattr+0xb4/0xd0 fs/xattr.c:655 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Freed by task 4866: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook mm/slub.c:1750 [inline] slab_free mm/slub.c:3661 [inline] kmem_cache_free+0x292/0x510 mm/slub.c:3683 free_metapage fs/jfs/jfs_metapage.c:191 [inline] metapage_release_folio+0x5c8/0x730 fs/jfs/jfs_metapage.c:551 folio_invalidate mm/truncate.c:158 [inline] truncate_cleanup_folio+0x252/0x660 mm/truncate.c:178 truncate_inode_pages_range+0x2e6/0x1340 mm/truncate.c:368 jfs_remount+0x360/0x6a0 fs/jfs/super.c:451 reconfigure_super+0x43a/0x870 fs/super.c:977 vfs_fsconfig_locked fs/fsopen.c:254 [inline] __do_sys_fsconfig fs/fsopen.c:439 [inline] __se_sys_fsconfig+0x98b/0xec0 fs/fsopen.c:314 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 The buggy address belongs to the object at ffff88805a78f0f8 which belongs to the cache jfs_mp of size 184 The buggy address is located 152 bytes inside of 184-byte region [ffff88805a78f0f8, ffff88805a78f1b0) The buggy address belongs to the physical page: page:ffffea000169e3c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5a78f flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 0000000000000000 dead000000000122 ffff88801afa38c0 raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x192800(GFP_NOWAIT|__GFP_NOWARN|__GFP_NORETRY|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 4867, tgid 4845 (syz.0.129), ts 115887542782, free_ts 115877822017 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2517 prep_new_page mm/page_alloc.c:2524 [inline] get_page_from_freelist+0x3731/0x38d0 mm/page_alloc.c:4313 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5589 alloc_slab_page+0x6a/0x150 mm/slub.c:1794 allocate_slab mm/slub.c:1939 [inline] new_slab+0x84/0x2d0 mm/slub.c:1992 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180 __slab_alloc mm/slub.c:3279 [inline] slab_alloc_node mm/slub.c:3364 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x1a5/0x2d0 mm/slub.c:3422 mempool_alloc+0x190/0x580 mm/mempool.c:392 alloc_metapage fs/jfs/jfs_metapage.c:176 [inline] __get_metapage+0x58f/0x1040 fs/jfs/jfs_metapage.c:651 ea_get+0x6f1/0x12b0 fs/jfs/xattr.c:549 __jfs_setxattr+0xf8/0x11d0 fs/jfs/xattr.c:675 __jfs_xattr_set+0xf5/0x180 fs/jfs/xattr.c:936 __vfs_setxattr+0x3e7/0x420 fs/xattr.c:182 __vfs_setxattr_noperm+0x12a/0x5e0 fs/xattr.c:216 vfs_setxattr+0x21d/0x420 fs/xattr.c:309 do_setxattr fs/xattr.c:594 [inline] setxattr+0x250/0x2b0 fs/xattr.c:617 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1444 [inline] free_pcp_prepare mm/page_alloc.c:1494 [inline] free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3369 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3464 free_slab mm/slub.c:2031 [inline] discard_slab mm/slub.c:2037 [inline] __unfreeze_partials+0x1b7/0x210 mm/slub.c:2586 put_cpu_partial+0x17b/0x250 mm/slub.c:2662 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x156/0x170 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737 slab_alloc_node mm/slub.c:3398 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x10c/0x2d0 mm/slub.c:3422 getname_flags+0xb8/0x4f0 fs/namei.c:139 do_sys_openat2+0xd2/0x4f0 fs/open.c:1312 do_sys_open fs/open.c:1334 [inline] __do_sys_openat fs/open.c:1350 [inline] __se_sys_openat fs/open.c:1345 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1345 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Memory state around the buggy address: ffff88805a78f080: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fa ffff88805a78f100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88805a78f180: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc ^ ffff88805a78f200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88805a78f280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================