JFS: metapage_get_blocks failed ERROR: (device loop1): release_metapage: write_one_page() failed ================================================================== BUG: KASAN: use-after-free in drop_metapage fs/jfs/jfs_metapage.c:222 [inline] BUG: KASAN: use-after-free in release_metapage+0x5a0/0x918 fs/jfs/jfs_metapage.c:758 Read of size 8 at addr ffff0000df2a6218 by task syz.1.77/4475 CPU: 1 PID: 4475 Comm: syz.1.77 Not tainted 5.15.173-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/2024 Call trace: dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 print_address_description+0x7c/0x3f0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:434 [inline] kasan_report+0x174/0x1e4 mm/kasan/report.c:451 __asan_report_load8_noabort+0x44/0x50 mm/kasan/report_generic.c:309 drop_metapage fs/jfs/jfs_metapage.c:222 [inline] release_metapage+0x5a0/0x918 fs/jfs/jfs_metapage.c:758 write_metapage fs/jfs/jfs_metapage.h:75 [inline] flush_metapage fs/jfs/jfs_metapage.h:81 [inline] ea_write+0x514/0xbc0 fs/jfs/xattr.c:280 ea_put fs/jfs/xattr.c:621 [inline] __jfs_setxattr+0x920/0x13ac fs/jfs/xattr.c:787 __jfs_xattr_set+0xf8/0x190 fs/jfs/xattr.c:936 jfs_xattr_set+0x58/0x70 fs/jfs/xattr.c:960 __vfs_setxattr+0x388/0x3a4 fs/xattr.c:182 __vfs_setxattr_noperm+0x110/0x528 fs/xattr.c:216 __vfs_setxattr_locked+0x1ec/0x218 fs/xattr.c:277 vfs_setxattr+0x1a8/0x344 fs/xattr.c:303 do_setxattr fs/xattr.c:588 [inline] setxattr+0x250/0x2b4 fs/xattr.c:611 path_setxattr+0x17c/0x258 fs/xattr.c:630 __do_sys_lsetxattr fs/xattr.c:653 [inline] __se_sys_lsetxattr fs/xattr.c:649 [inline] __arm64_sys_lsetxattr+0xbc/0xd8 fs/xattr.c:649 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 Allocated by task 4475: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] __kasan_slab_alloc+0x8c/0xcc mm/kasan/common.c:467 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook+0x74/0x3f4 mm/slab.h:519 slab_alloc_node mm/slub.c:3220 [inline] slab_alloc mm/slub.c:3228 [inline] kmem_cache_alloc+0x1dc/0x45c mm/slub.c:3233 mempool_alloc_slab+0x58/0x74 mm/mempool.c:513 mempool_alloc+0x144/0x480 mm/mempool.c:393 alloc_metapage fs/jfs/jfs_metapage.c:175 [inline] __get_metapage+0x588/0x1128 fs/jfs/jfs_metapage.c:652 ea_write+0x49c/0xbc0 fs/jfs/xattr.c:256 ea_put fs/jfs/xattr.c:621 [inline] __jfs_setxattr+0x920/0x13ac fs/jfs/xattr.c:787 __jfs_xattr_set+0xf8/0x190 fs/jfs/xattr.c:936 jfs_xattr_set+0x58/0x70 fs/jfs/xattr.c:960 __vfs_setxattr+0x388/0x3a4 fs/xattr.c:182 __vfs_setxattr_noperm+0x110/0x528 fs/xattr.c:216 __vfs_setxattr_locked+0x1ec/0x218 fs/xattr.c:277 vfs_setxattr+0x1a8/0x344 fs/xattr.c:303 do_setxattr fs/xattr.c:588 [inline] setxattr+0x250/0x2b4 fs/xattr.c:611 path_setxattr+0x17c/0x258 fs/xattr.c:630 __do_sys_lsetxattr fs/xattr.c:653 [inline] __se_sys_lsetxattr fs/xattr.c:649 [inline] __arm64_sys_lsetxattr+0xbc/0xd8 fs/xattr.c:649 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 Freed by task 4474: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x84 mm/kasan/common.c:46 kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360 ____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1705 [inline] slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731 slab_free mm/slub.c:3499 [inline] kmem_cache_free+0xdc/0x3c4 mm/slub.c:3515 mempool_free_slab+0x28/0x38 mm/mempool.c:520 mempool_free+0xbc/0x384 mm/mempool.c:502 free_metapage fs/jfs/jfs_metapage.c:190 [inline] metapage_releasepage+0x44c/0x5c4 fs/jfs/jfs_metapage.c:552 metapage_invalidatepage+0x118/0x180 fs/jfs/jfs_metapage.c:564 do_invalidatepage mm/truncate.c:157 [inline] truncate_cleanup_page+0x15c/0x414 mm/truncate.c:176 truncate_inode_pages_range+0x254/0xbe0 mm/truncate.c:325 truncate_inode_pages+0x2c/0x3c mm/truncate.c:425 jfs_remount+0x2dc/0x594 fs/jfs/super.c:456 legacy_reconfigure+0xfc/0x114 fs/fs_context.c:634 reconfigure_super+0x1d0/0x6ec fs/super.c:938 vfs_fsconfig_locked fs/fsopen.c:254 [inline] __do_sys_fsconfig fs/fsopen.c:439 [inline] __se_sys_fsconfig fs/fsopen.c:314 [inline] __arm64_sys_fsconfig+0xa1c/0xd18 fs/fsopen.c:314 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 The buggy address belongs to the object at ffff0000df2a61f0 which belongs to the cache jfs_mp of size 184 The buggy address is located 40 bytes inside of 184-byte region [ffff0000df2a61f0, ffff0000df2a62a8) The buggy address belongs to the page: page:000000003690e1ff refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11f2a6 flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff) raw: 05ffc00000000200 0000000000000000 dead000000000122 ffff0000c6120900 raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000df2a6100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff0000df2a6180: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fa fb >ffff0000df2a6200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000df2a6280: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc ffff0000df2a6300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ================================================================== BUG: KASAN: double-free or invalid-free in slab_free mm/slub.c:3499 [inline] BUG: KASAN: double-free or invalid-free in kmem_cache_free+0xdc/0x3c4 mm/slub.c:3515 CPU: 0 PID: 4475 Comm: syz.1.77 Tainted: G B 5.15.173-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/2024 Call trace: dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 print_address_description+0x7c/0x3f0 mm/kasan/report.c:248 kasan_report_invalid_free+0x64/0x94 mm/kasan/report.c:373 ____kasan_slab_free+0x134/0x164 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1705 [inline] slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731 slab_free mm/slub.c:3499 [inline] kmem_cache_free+0xdc/0x3c4 mm/slub.c:3515 mempool_free_slab+0x28/0x38 mm/mempool.c:520 mempool_free+0xbc/0x384 mm/mempool.c:502 free_metapage fs/jfs/jfs_metapage.c:190 [inline] drop_metapage fs/jfs/jfs_metapage.c:227 [inline] release_metapage+0x6a8/0x918 fs/jfs/jfs_metapage.c:758 write_metapage fs/jfs/jfs_metapage.h:75 [inline] flush_metapage fs/jfs/jfs_metapage.h:81 [inline] ea_write+0x514/0xbc0 fs/jfs/xattr.c:280 ea_put fs/jfs/xattr.c:621 [inline] __jfs_setxattr+0x920/0x13ac fs/jfs/xattr.c:787 __jfs_xattr_set+0xf8/0x190 fs/jfs/xattr.c:936 jfs_xattr_set+0x58/0x70 fs/jfs/xattr.c:960 __vfs_setxattr+0x388/0x3a4 fs/xattr.c:182 __vfs_setxattr_noperm+0x110/0x528 fs/xattr.c:216 __vfs_setxattr_locked+0x1ec/0x218 fs/xattr.c:277 vfs_setxattr+0x1a8/0x344 fs/xattr.c:303 do_setxattr fs/xattr.c:588 [inline] setxattr+0x250/0x2b4 fs/xattr.c:611 path_setxattr+0x17c/0x258 fs/xattr.c:630 __do_sys_lsetxattr fs/xattr.c:653 [inline] __se_sys_lsetxattr fs/xattr.c:649 [inline] __arm64_sys_lsetxattr+0xbc/0xd8 fs/xattr.c:649 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 Allocated by task 4475: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] __kasan_slab_alloc+0x8c/0xcc mm/kasan/common.c:467 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook+0x74/0x3f4 mm/slab.h:519 slab_alloc_node mm/slub.c:3220 [inline] slab_alloc mm/slub.c:3228 [inline] kmem_cache_alloc+0x1dc/0x45c mm/slub.c:3233 mempool_alloc_slab+0x58/0x74 mm/mempool.c:513 mempool_alloc+0x144/0x480 mm/mempool.c:393 alloc_metapage fs/jfs/jfs_metapage.c:175 [inline] __get_metapage+0x588/0x1128 fs/jfs/jfs_metapage.c:652 ea_write+0x49c/0xbc0 fs/jfs/xattr.c:256 ea_put fs/jfs/xattr.c:621 [inline] __jfs_setxattr+0x920/0x13ac fs/jfs/xattr.c:787 __jfs_xattr_set+0xf8/0x190 fs/jfs/xattr.c:936 jfs_xattr_set+0x58/0x70 fs/jfs/xattr.c:960 __vfs_setxattr+0x388/0x3a4 fs/xattr.c:182 __vfs_setxattr_noperm+0x110/0x528 fs/xattr.c:216 __vfs_setxattr_locked+0x1ec/0x218 fs/xattr.c:277 vfs_setxattr+0x1a8/0x344 fs/xattr.c:303 do_setxattr fs/xattr.c:588 [inline] setxattr+0x250/0x2b4 fs/xattr.c:611 path_setxattr+0x17c/0x258 fs/xattr.c:630 __do_sys_lsetxattr fs/xattr.c:653 [inline] __se_sys_lsetxattr fs/xattr.c:649 [inline] __arm64_sys_lsetxattr+0xbc/0xd8 fs/xattr.c:649 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 Freed by task 4474: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x84 mm/kasan/common.c:46 kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360 ____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1705 [inline] slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731 slab_free mm/slub.c:3499 [inline] kmem_cache_free+0xdc/0x3c4 mm/slub.c:3515 mempool_free_slab+0x28/0x38 mm/mempool.c:520 mempool_free+0xbc/0x384 mm/mempool.c:502 free_metapage fs/jfs/jfs_metapage.c:190 [inline] metapage_releasepage+0x44c/0x5c4 fs/jfs/jfs_metapage.c:552 metapage_invalidatepage+0x118/0x180 fs/jfs/jfs_metapage.c:564 do_invalidatepage mm/truncate.c:157 [inline] truncate_cleanup_page+0x15c/0x414 mm/truncate.c:176 truncate_inode_pages_range+0x254/0xbe0 mm/truncate.c:325 truncate_inode_pages+0x2c/0x3c mm/truncate.c:425 jfs_remount+0x2dc/0x594 fs/jfs/super.c:456 legacy_reconfigure+0xfc/0x114 fs/fs_context.c:634 reconfigure_super+0x1d0/0x6ec fs/super.c:938 vfs_fsconfig_locked fs/fsopen.c:254 [inline] __do_sys_fsconfig fs/fsopen.c:439 [inline] __se_sys_fsconfig fs/fsopen.c:314 [inline] __arm64_sys_fsconfig+0xa1c/0xd18 fs/fsopen.c:314 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 The buggy address belongs to the object at ffff0000df2a61f0 which belongs to the cache jfs_mp of size 184 The buggy address is located 0 bytes inside of 184-byte region [ffff0000df2a61f0, ffff0000df2a62a8) The buggy address belongs to the page: page:000000003690e1ff refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11f2a6 flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff) raw: 05ffc00000000200 0000000000000000 dead000000000122 ffff0000c6120900 raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000df2a6080: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc 00 ffff0000df2a6100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff0000df2a6180: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fa fb ^ ffff0000df2a6200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000df2a6280: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc ==================================================================