================================================================== BUG: KASAN: slab-out-of-bounds in __bch2_alloc_to_v4+0x7b/0x8b0 fs/bcachefs/alloc_background.c:388 Read of size 64 at addr ffff888011f6c728 by task kworker/u4:2/31 CPU: 0 UID: 0 PID: 31 Comm: kworker/u4:2 Not tainted 6.16.0-rc4-syzkaller-00123-g4c06e63b9203 #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: btree_update btree_interior_update_work Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0xd2/0x2b0 mm/kasan/report.c:521 kasan_report+0x118/0x150 mm/kasan/report.c:634 check_region_inline mm/kasan/generic.c:-1 [inline] kasan_check_range+0x2b0/0x2c0 mm/kasan/generic.c:189 __asan_memcpy+0x29/0x70 mm/kasan/shadow.c:105 __bch2_alloc_to_v4+0x7b/0x8b0 fs/bcachefs/alloc_background.c:388 bch2_alloc_to_v4 fs/bcachefs/alloc_background.h:236 [inline] bch2_trigger_alloc+0x323/0x4090 fs/bcachefs/alloc_background.c:871 run_one_trans_trigger fs/bcachefs/btree_trans_commit.c:-1 [inline] bch2_trans_commit_run_triggers fs/bcachefs/btree_trans_commit.c:554 [inline] __bch2_trans_commit+0xa81/0x8870 fs/bcachefs/btree_trans_commit.c:1023 bch2_trans_commit fs/bcachefs/btree_update.h:241 [inline] btree_update_nodes_written fs/bcachefs/btree_update_interior.c:729 [inline] btree_interior_update_work+0x1082/0x27d0 fs/bcachefs/btree_update_interior.c:867 process_one_work kernel/workqueue.c:3238 [inline] process_scheduled_works+0xade/0x17b0 kernel/workqueue.c:3321 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402 kthread+0x70e/0x8a0 kernel/kthread.c:464 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 5340: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __do_kmalloc_node mm/slub.c:4328 [inline] __kmalloc_noprof+0x27a/0x4f0 mm/slub.c:4340 kmalloc_noprof include/linux/slab.h:909 [inline] bch2_journal_key_insert+0x50/0x140 fs/bcachefs/btree_journal_iter.c:342 do_bch2_trans_commit_to_journal_replay+0x127/0xd70 fs/bcachefs/btree_trans_commit.c:966 __bch2_trans_commit+0x1b67/0x8870 fs/bcachefs/btree_trans_commit.c:1030 bch2_trans_commit fs/bcachefs/btree_update.h:241 [inline] bch2_gc_alloc_done fs/bcachefs/btree_gc.c:951 [inline] bch2_check_allocations+0x2ee0/0x57b0 fs/bcachefs/btree_gc.c:1100 bch2_run_recovery_pass fs/bcachefs/recovery_passes.c:484 [inline] __bch2_run_recovery_passes+0x395/0x1010 fs/bcachefs/recovery_passes.c:539 bch2_run_recovery_passes+0x184/0x210 fs/bcachefs/recovery_passes.c:610 bch2_fs_recovery+0x2690/0x3a50 fs/bcachefs/recovery.c:1005 bch2_fs_start+0xa99/0xd90 fs/bcachefs/super.c:1212 bch2_fs_get_tree+0xafc/0x14f0 fs/bcachefs/fs.c:2490 vfs_get_tree+0x92/0x2b0 fs/super.c:1804 do_new_mount+0x24a/0xa40 fs/namespace.c:3902 do_mount fs/namespace.c:4239 [inline] __do_sys_mount fs/namespace.c:4450 [inline] __se_sys_mount+0x317/0x410 fs/namespace.c:4427 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888011f6c700 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 40 bytes inside of allocated 88-byte region [ffff888011f6c700, ffff888011f6c758) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11f6c flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000000 ffff88801a441280 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000200020 00000000f5000000 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 0x252800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP|__GFP_THISNODE), pid 5340, tgid 5339 (syz.0.0), ts 75909088729, free_ts 73934105078 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1704 prep_new_page mm/page_alloc.c:1712 [inline] get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3669 __alloc_pages_slowpath+0x2fe/0xce0 mm/page_alloc.c:4490 __alloc_frozen_pages_noprof+0x319/0x370 mm/page_alloc.c:4972 alloc_slab_page mm/slub.c:2453 [inline] allocate_slab+0x65/0x3b0 mm/slub.c:2619 new_slab mm/slub.c:2673 [inline] ___slab_alloc+0xbfc/0x1480 mm/slub.c:3859 __slab_alloc mm/slub.c:3949 [inline] __slab_alloc_node mm/slub.c:4024 [inline] slab_alloc_node mm/slub.c:4185 [inline] __kmalloc_cache_node_noprof+0x29a/0x3d0 mm/slub.c:4367 kmalloc_node_noprof include/linux/slab.h:928 [inline] alloc_node_nr_active kernel/workqueue.c:4874 [inline] __alloc_workqueue+0x6a4/0x1b70 kernel/workqueue.c:5728 alloc_workqueue+0xd4/0x210 kernel/workqueue.c:5788 loop_configure+0x6a1/0xfa0 drivers/block/loop.c:1032 lo_ioctl+0x79b/0x2410 drivers/block/loop.c:-1 blkdev_ioctl+0x5a8/0x6d0 block/ioctl.c:704 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 31 tgid 31 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1248 [inline] __free_frozen_pages+0xc71/0xe70 mm/page_alloc.c:2706 rcu_do_batch kernel/rcu/tree.c:2576 [inline] rcu_core+0xca5/0x1710 kernel/rcu/tree.c:2832 handle_softirqs+0x286/0x870 kernel/softirq.c:579 do_softirq+0xec/0x180 kernel/softirq.c:480 __local_bh_enable_ip+0x17d/0x1c0 kernel/softirq.c:407 spin_unlock_bh include/linux/spinlock.h:396 [inline] addrconf_dad_work+0x2a8/0x14b0 net/ipv6/addrconf.c:4228 process_one_work kernel/workqueue.c:3238 [inline] process_scheduled_works+0xade/0x17b0 kernel/workqueue.c:3321 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402 kthread+0x70e/0x8a0 kernel/kthread.c:464 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Memory state around the buggy address: ffff888011f6c600: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc ffff888011f6c680: 00 00 00 00 00 00 00 00 00 00 03 fc fc fc fc fc >ffff888011f6c700: 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc ^ ffff888011f6c780: 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc ffff888011f6c800: 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc ==================================================================