BUG: spinlock bad magic on CPU#3, jfsCommit/131 ================================================================== BUG: KASAN: slab-use-after-free in string_nocheck lib/vsprintf.c:645 [inline] BUG: KASAN: slab-use-after-free in string+0x394/0x3d0 lib/vsprintf.c:727 Read of size 1 at addr ffff888028cc65d0 by task jfsCommit/131 CPU: 3 PID: 131 Comm: jfsCommit Not tainted 6.6.0-rc4-syzkaller-00016-g5e62ed3b1c8a #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 string_nocheck lib/vsprintf.c:645 [inline] string+0x394/0x3d0 lib/vsprintf.c:727 vsnprintf+0xc5f/0x1870 lib/vsprintf.c:2818 vprintk_store+0x3a0/0xb80 kernel/printk/printk.c:2191 vprintk_emit+0x14c/0x5f0 kernel/printk/printk.c:2288 vprintk+0x7b/0x90 kernel/printk/printk_safe.c:45 _printk+0xc8/0x100 kernel/printk/printk.c:2332 spin_dump kernel/locking/spinlock_debug.c:63 [inline] spin_bug+0x154/0x1d0 kernel/locking/spinlock_debug.c:77 debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline] do_raw_spin_lock+0x223/0x2b0 kernel/locking/spinlock_debug.c:114 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline] _raw_spin_lock_irqsave+0x42/0x50 kernel/locking/spinlock.c:162 __wake_up_common_lock+0xbb/0x140 kernel/sched/wait.c:137 unlock_metapage fs/jfs/jfs_metapage.c:38 [inline] release_metapage+0x172/0xdc0 fs/jfs/jfs_metapage.c:765 discard_metapage fs/jfs/jfs_metapage.h:88 [inline] xtTruncate+0x1f6f/0x2c70 fs/jfs/jfs_xtree.c:2488 jfs_free_zero_link+0x36e/0x4e0 fs/jfs/namei.c:758 jfs_evict_inode+0x422/0x4b0 fs/jfs/inode.c:153 evict+0x2ed/0x6b0 fs/inode.c:664 iput_final fs/inode.c:1775 [inline] iput.part.0+0x55e/0x7a0 fs/inode.c:1801 iput+0x5c/0x80 fs/inode.c:1791 txUpdateMap+0xaef/0xd10 fs/jfs/jfs_txnmgr.c:2367 txLazyCommit fs/jfs/jfs_txnmgr.c:2664 [inline] jfs_lazycommit+0x5da/0xb10 fs/jfs/jfs_txnmgr.c:2732 kthread+0x33c/0x440 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 Allocated by task 23973: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 __kasan_slab_alloc+0x81/0x90 mm/kasan/common.c:328 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slub.c:3478 [inline] slab_alloc mm/slub.c:3486 [inline] __kmem_cache_alloc_lru mm/slub.c:3493 [inline] kmem_cache_alloc_lru+0x221/0x680 mm/slub.c:3509 alloc_inode_sb include/linux/fs.h:2868 [inline] jfs_alloc_inode+0x25/0x60 fs/jfs/super.c:105 alloc_inode+0x5d/0x220 fs/inode.c:259 new_inode_pseudo fs/inode.c:1004 [inline] new_inode+0x22/0x260 fs/inode.c:1030 diReadSpecial+0x51/0x6e0 fs/jfs/jfs_imap.c:423 jfs_mount+0x31e/0x890 fs/jfs/jfs_mount.c:166 jfs_fill_super+0x5a3/0xd20 fs/jfs/super.c:556 mount_bdev+0x1f3/0x2e0 fs/super.c:1629 legacy_get_tree+0x109/0x220 fs/fs_context.c:638 vfs_get_tree+0x8c/0x370 fs/super.c:1750 do_new_mount fs/namespace.c:3335 [inline] path_mount+0x1492/0x1ed0 fs/namespace.c:3662 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount fs/namespace.c:3861 [inline] __ia32_sys_mount+0x291/0x310 fs/namespace.c:3861 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 Freed by task 5210: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x15b/0x1b0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:164 [inline] slab_free_hook mm/slub.c:1800 [inline] slab_free_freelist_hook+0x114/0x1e0 mm/slub.c:1826 slab_free mm/slub.c:3809 [inline] kmem_cache_free+0xf0/0x480 mm/slub.c:3831 i_callback+0x43/0x70 fs/inode.c:248 rcu_do_batch kernel/rcu/tree.c:2139 [inline] rcu_core+0x805/0x1bb0 kernel/rcu/tree.c:2403 __do_softirq+0x218/0x965 kernel/softirq.c:553 Last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492 __call_rcu_common.constprop.0+0x9a/0x790 kernel/rcu/tree.c:2653 destroy_inode+0x129/0x1b0 fs/inode.c:314 iput_final fs/inode.c:1775 [inline] iput.part.0+0x55e/0x7a0 fs/inode.c:1801 iput+0x5c/0x80 fs/inode.c:1791 diFreeSpecial+0x7a/0x110 fs/jfs/jfs_imap.c:549 jfs_umount+0x193/0x430 fs/jfs/jfs_umount.c:65 jfs_put_super+0x88/0x1d0 fs/jfs/super.c:194 generic_shutdown_super+0x161/0x3c0 fs/super.c:693 kill_block_super+0x3b/0x70 fs/super.c:1646 deactivate_locked_super+0x9a/0x170 fs/super.c:481 deactivate_super+0xde/0x100 fs/super.c:514 cleanup_mnt+0x222/0x3d0 fs/namespace.c:1254 task_work_run+0x14d/0x240 kernel/task_work.c:180 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x215/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1d/0x60 kernel/entry/common.c:296 __do_fast_syscall_32+0x6d/0xe0 arch/x86/entry/common.c:181 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 Second to last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492 __call_rcu_common.constprop.0+0x9a/0x790 kernel/rcu/tree.c:2653 destroy_inode+0x129/0x1b0 fs/inode.c:314 dispose_list+0x117/0x1e0 fs/inode.c:697 evict_inodes+0x34f/0x450 fs/inode.c:747 generic_shutdown_super+0xb5/0x3c0 fs/super.c:672 kill_block_super+0x3b/0x70 fs/super.c:1646 deactivate_locked_super+0x9a/0x170 fs/super.c:481 deactivate_super+0xde/0x100 fs/super.c:514 cleanup_mnt+0x222/0x3d0 fs/namespace.c:1254 task_work_run+0x14d/0x240 kernel/task_work.c:180 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x215/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1d/0x60 kernel/entry/common.c:296 __do_fast_syscall_32+0x6d/0xe0 arch/x86/entry/common.c:181 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 The buggy address belongs to the object at ffff888028cc65c0 which belongs to the cache jfs_ip of size 2240 The buggy address is located 16 bytes inside of freed 2240-byte region [ffff888028cc65c0, ffff888028cc6e80) The buggy address belongs to the physical page: page:ffffea0000a33000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x28cc0 head:ffffea0000a33000 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff888029a06601 flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000840 ffff888040651680 ffffea0000a07c00 dead000000000002 raw: 0000000000000000 00000000800d000d 00000001ffffffff ffff888029a06601 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Reclaimable, gfp_mask 0xd2050(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_RECLAIMABLE), pid 21565, tgid 21564 (syz-executor.0), ts 584929929149, free_ts 581866467442 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536 prep_new_page mm/page_alloc.c:1543 [inline] get_page_from_freelist+0xee0/0x2f20 mm/page_alloc.c:3170 __alloc_pages_slowpath.constprop.0+0x2dd/0x2360 mm/page_alloc.c:3960 __alloc_pages+0x411/0x4a0 mm/page_alloc.c:4439 alloc_pages+0x1a9/0x270 mm/mempolicy.c:2297 alloc_slab_page mm/slub.c:1870 [inline] allocate_slab+0x251/0x380 mm/slub.c:2017 new_slab mm/slub.c:2070 [inline] ___slab_alloc+0x8c7/0x1580 mm/slub.c:3223 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322 __slab_alloc_node mm/slub.c:3375 [inline] slab_alloc_node mm/slub.c:3468 [inline] slab_alloc mm/slub.c:3486 [inline] __kmem_cache_alloc_lru mm/slub.c:3493 [inline] kmem_cache_alloc_lru+0x4ed/0x680 mm/slub.c:3509 alloc_inode_sb include/linux/fs.h:2868 [inline] jfs_alloc_inode+0x25/0x60 fs/jfs/super.c:105 alloc_inode+0x5d/0x220 fs/inode.c:259 iget_locked+0x1b3/0x700 fs/inode.c:1314 jfs_iget+0x1e/0x4c0 fs/jfs/inode.c:29 jfs_fill_super+0x6c8/0xd20 fs/jfs/super.c:580 mount_bdev+0x1f3/0x2e0 fs/super.c:1629 legacy_get_tree+0x109/0x220 fs/fs_context.c:638 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1136 [inline] free_unref_page_prepare+0x476/0xa40 mm/page_alloc.c:2312 free_unref_page_list+0xe6/0xb30 mm/page_alloc.c:2451 release_pages+0x32a/0x14e0 mm/swap.c:1042 __folio_batch_release+0x77/0xe0 mm/swap.c:1062 folio_batch_release include/linux/pagevec.h:83 [inline] shmem_undo_range+0x582/0x1040 mm/shmem.c:1022 shmem_truncate_range mm/shmem.c:1114 [inline] shmem_evict_inode+0x392/0xb50 mm/shmem.c:1243 evict+0x2ed/0x6b0 fs/inode.c:664 iput_final fs/inode.c:1775 [inline] iput.part.0+0x55e/0x7a0 fs/inode.c:1801 iput+0x5c/0x80 fs/inode.c:1791 dentry_unlink_inode+0x292/0x430 fs/dcache.c:401 __dentry_kill+0x3b8/0x640 fs/dcache.c:607 dentry_kill fs/dcache.c:733 [inline] dput+0x8b7/0xf80 fs/dcache.c:913 __fput+0x536/0xa70 fs/file_table.c:392 task_work_run+0x14d/0x240 kernel/task_work.c:180 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x215/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1d/0x60 kernel/entry/common.c:296 Memory state around the buggy address: ffff888028cc6480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888028cc6500: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc >ffff888028cc6580: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb ^ ffff888028cc6600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888028cc6680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================