bcachefs (loop0): initializing new filesystem bcachefs (loop0): going read-write bcachefs (loop0): marking superblocks bcachefs (loop0): initializing freespace bcachefs (loop0): done initializing freespace bcachefs (loop0): reading snapshots table bcachefs (loop0): reading snapshots done bcachefs (loop0): loop0: Superblock write was silently dropped! (seq 0 expected 42) bcachefs (loop0): done starting filesystem FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 1 CPU: 0 UID: 0 PID: 5327 Comm: syz.0.0 Not tainted 6.16.0-rc2-syzkaller-00378-gb67ec639010f #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 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 fail_dump lib/fault-inject.c:73 [inline] should_fail_ex+0x414/0x560 lib/fault-inject.c:174 should_failslab+0xa8/0x100 mm/failslab.c:46 slab_pre_alloc_hook mm/slub.c:4101 [inline] slab_alloc_node mm/slub.c:4177 [inline] __do_kmalloc_node mm/slub.c:4327 [inline] __kmalloc_node_track_caller_noprof+0xcc/0x4e0 mm/slub.c:4347 __do_krealloc mm/slub.c:4905 [inline] krealloc_noprof+0x124/0x340 mm/slub.c:4958 bch2_printbuf_make_room+0x1f5/0x360 fs/bcachefs/printbuf.c:59 prt_bytes fs/bcachefs/printbuf.h:227 [inline] prt_str+0x3e/0x760 fs/bcachefs/printbuf.h:239 bch2_btree_id_level_to_text+0x25/0xa0 fs/bcachefs/btree_cache.c:1404 bch2_btree_path_to_text_short+0x182/0xde0 fs/bcachefs/btree_iter.c:1521 __bch2_trans_paths_to_text+0xe5/0x190 fs/bcachefs/btree_iter.c:1589 bch2_trans_update_max_paths+0x14e/0x340 fs/bcachefs/btree_iter.c:1625 btree_path_alloc+0x89a/0xa70 fs/bcachefs/btree_iter.c:1722 bch2_path_get+0x8bd/0x1540 fs/bcachefs/btree_iter.c:1778 bch2_trans_iter_init_common fs/bcachefs/btree_iter.h:529 [inline] bch2_trans_iter_init fs/bcachefs/btree_iter.h:543 [inline] bch2_nocow_write+0x5f2/0x3e90 fs/bcachefs/io_write.c:1333 __bch2_write+0x371c/0x3900 fs/bcachefs/io_write.c:1505 closure_queue include/linux/closure.h:270 [inline] closure_call include/linux/closure.h:432 [inline] bch2_writepage_do_io fs/bcachefs/fs-io-buffered.c:486 [inline] bch2_writepages+0x211/0x2d0 fs/bcachefs/fs-io-buffered.c:668 do_writepages+0x32e/0x550 mm/page-writeback.c:2636 filemap_fdatawrite_wbc mm/filemap.c:386 [inline] __filemap_fdatawrite_range mm/filemap.c:419 [inline] file_write_and_wait_range+0x22c/0x330 mm/filemap.c:794 bch2_fsync+0x127/0x330 fs/bcachefs/fs-io.c:245 generic_write_sync include/linux/fs.h:3031 [inline] bch2_write_iter+0x2822/0x2b90 fs/bcachefs/fs-io-buffered.c:1089 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x548/0xa90 fs/read_write.c:686 ksys_pwrite64 fs/read_write.c:793 [inline] __do_sys_pwrite64 fs/read_write.c:801 [inline] __se_sys_pwrite64 fs/read_write.c:798 [inline] __x64_sys_pwrite64+0x193/0x220 fs/read_write.c:798 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 RIP: 0033:0x7f747498e929 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:00007f7470df5038 EFLAGS: 00000246 ORIG_RAX: 0000000000000012 RAX: ffffffffffffffda RBX: 00007f7474bb5fa0 RCX: 00007f747498e929 RDX: 0000000000000045 RSI: 0000200000000100 RDI: 0000000000000009 RBP: 00007f7470df5090 R08: 0000000000000000 R09: 0000000000000000 R10: 000000000000709c R11: 0000000000000246 R12: 0000000000000002 R13: 0000000000000000 R14: 00007f7474bb5fa0 R15: 00007ffcba653418 bcachefs (loop0 inum 4098 offset 28672): data write error: I/O ================================================================== BUG: KASAN: slab-use-after-free in __bch2_write+0x38f8/0x3900 fs/bcachefs/io_write.c:1506 Read of size 2 at addr ffff88805243937c by task syz.0.0/5327 CPU: 0 UID: 0 PID: 5327 Comm: syz.0.0 Not tainted 6.16.0-rc2-syzkaller-00378-gb67ec639010f #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 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 __bch2_write+0x38f8/0x3900 fs/bcachefs/io_write.c:1506 closure_queue include/linux/closure.h:270 [inline] closure_call include/linux/closure.h:432 [inline] bch2_writepage_do_io fs/bcachefs/fs-io-buffered.c:486 [inline] bch2_writepages+0x211/0x2d0 fs/bcachefs/fs-io-buffered.c:668 do_writepages+0x32e/0x550 mm/page-writeback.c:2636 filemap_fdatawrite_wbc mm/filemap.c:386 [inline] __filemap_fdatawrite_range mm/filemap.c:419 [inline] file_write_and_wait_range+0x22c/0x330 mm/filemap.c:794 bch2_fsync+0x127/0x330 fs/bcachefs/fs-io.c:245 generic_write_sync include/linux/fs.h:3031 [inline] bch2_write_iter+0x2822/0x2b90 fs/bcachefs/fs-io-buffered.c:1089 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x548/0xa90 fs/read_write.c:686 ksys_pwrite64 fs/read_write.c:793 [inline] __do_sys_pwrite64 fs/read_write.c:801 [inline] __se_sys_pwrite64 fs/read_write.c:798 [inline] __x64_sys_pwrite64+0x193/0x220 fs/read_write.c:798 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 RIP: 0033:0x7f747498e929 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:00007f7470df5038 EFLAGS: 00000246 ORIG_RAX: 0000000000000012 RAX: ffffffffffffffda RBX: 00007f7474bb5fa0 RCX: 00007f747498e929 RDX: 0000000000000045 RSI: 0000200000000100 RDI: 0000000000000009 RBP: 00007f7470df5090 R08: 0000000000000000 R09: 0000000000000000 R10: 000000000000709c R11: 0000000000000246 R12: 0000000000000002 R13: 0000000000000000 R14: 00007f7474bb5fa0 R15: 00007ffcba653418 Allocated by task 5327: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:319 [inline] __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:345 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4148 [inline] slab_alloc_node mm/slub.c:4197 [inline] kmem_cache_alloc_noprof+0x1c1/0x3c0 mm/slub.c:4204 mempool_alloc_noprof+0x1a7/0x510 mm/mempool.c:402 bio_alloc_bioset+0x241/0x1110 block/bio.c:555 bch2_writepage_io_alloc fs/bcachefs/fs-io-buffered.c:502 [inline] __bch2_writepage+0x1581/0x2790 fs/bcachefs/fs-io-buffered.c:636 write_cache_pages+0x61/0x100 mm/page-writeback.c:2614 bch2_writepages+0xf9/0x2d0 fs/bcachefs/fs-io-buffered.c:666 do_writepages+0x32e/0x550 mm/page-writeback.c:2636 filemap_fdatawrite_wbc mm/filemap.c:386 [inline] __filemap_fdatawrite_range mm/filemap.c:419 [inline] file_write_and_wait_range+0x22c/0x330 mm/filemap.c:794 bch2_fsync+0x127/0x330 fs/bcachefs/fs-io.c:245 generic_write_sync include/linux/fs.h:3031 [inline] bch2_write_iter+0x2822/0x2b90 fs/bcachefs/fs-io-buffered.c:1089 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x548/0xa90 fs/read_write.c:686 ksys_pwrite64 fs/read_write.c:793 [inline] __do_sys_pwrite64 fs/read_write.c:801 [inline] __se_sys_pwrite64 fs/read_write.c:798 [inline] __x64_sys_pwrite64+0x193/0x220 fs/read_write.c:798 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 Freed by task 1080: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:576 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x62/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2381 [inline] slab_free_after_rcu_debug+0x129/0x2a0 mm/slub.c:4693 rcu_do_batch kernel/rcu/tree.c:2576 [inline] rcu_core+0xca8/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] cfg80211_inform_single_bss_data+0x13d2/0x1ac0 net/wireless/scan.c:2383 cfg80211_inform_bss_data+0x1fb/0x3b20 net/wireless/scan.c:3222 cfg80211_inform_bss_frame_data+0x3d7/0x730 net/wireless/scan.c:3313 ieee80211_bss_info_update+0x746/0x9e0 net/mac80211/scan.c:226 ieee80211_rx_bss_info net/mac80211/ibss.c:1094 [inline] ieee80211_rx_mgmt_probe_beacon net/mac80211/ibss.c:1573 [inline] ieee80211_ibss_rx_queued_mgmt+0xa36/0x2ae0 net/mac80211/ibss.c:1600 ieee80211_iface_process_skb net/mac80211/iface.c:1668 [inline] ieee80211_iface_work+0x806/0xfe0 net/mac80211/iface.c:1722 cfg80211_wiphy_work+0x2df/0x460 net/wireless/core.c:435 process_one_work kernel/workqueue.c:3238 [inline] process_scheduled_works+0xae1/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 Last potentially related work creation: kasan_save_stack+0x3e/0x60 mm/kasan/common.c:47 kasan_record_aux_stack+0xbd/0xd0 mm/kasan/generic.c:548 slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4643 [inline] kmem_cache_free+0x2f6/0x400 mm/slub.c:4745 process_one_work kernel/workqueue.c:3238 [inline] process_scheduled_works+0xae1/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 Second to last potentially related work creation: kasan_save_stack+0x3e/0x60 mm/kasan/common.c:47 kasan_record_aux_stack+0xbd/0xd0 mm/kasan/generic.c:548 insert_work+0x3d/0x330 kernel/workqueue.c:2183 __queue_work+0xcfc/0xfe0 kernel/workqueue.c:2341 queue_work_on+0x181/0x270 kernel/workqueue.c:2392 queue_work include/linux/workqueue.h:662 [inline] closure_queue include/linux/closure.h:268 [inline] closure_put_after_sub+0x2ac/0x320 lib/closure.c:42 bch2_nocow_write+0x3ab2/0x3e90 fs/bcachefs/io_write.c:1462 __bch2_write+0x371c/0x3900 fs/bcachefs/io_write.c:1505 closure_queue include/linux/closure.h:270 [inline] closure_call include/linux/closure.h:432 [inline] bch2_writepage_do_io fs/bcachefs/fs-io-buffered.c:486 [inline] bch2_writepages+0x211/0x2d0 fs/bcachefs/fs-io-buffered.c:668 do_writepages+0x32e/0x550 mm/page-writeback.c:2636 filemap_fdatawrite_wbc mm/filemap.c:386 [inline] __filemap_fdatawrite_range mm/filemap.c:419 [inline] file_write_and_wait_range+0x22c/0x330 mm/filemap.c:794 bch2_fsync+0x127/0x330 fs/bcachefs/fs-io.c:245 generic_write_sync include/linux/fs.h:3031 [inline] bch2_write_iter+0x2822/0x2b90 fs/bcachefs/fs-io-buffered.c:1089 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x548/0xa90 fs/read_write.c:686 ksys_pwrite64 fs/read_write.c:793 [inline] __do_sys_pwrite64 fs/read_write.c:801 [inline] __se_sys_pwrite64 fs/read_write.c:798 [inline] __x64_sys_pwrite64+0x193/0x220 fs/read_write.c:798 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 ffff888052439300 which belongs to the cache bio-1072 of size 1072 The buggy address is located 124 bytes inside of freed 1072-byte region [ffff888052439300, ffff888052439730) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x52438 head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000040 ffff8880523d43c0 dead000000000122 0000000000000000 raw: 0000000000000000 00000000800d000d 00000000f5000000 0000000000000000 head: 04fff00000000040 ffff8880523d43c0 dead000000000122 0000000000000000 head: 0000000000000000 00000000800d000d 00000000f5000000 0000000000000000 head: 04fff00000000002 ffffea0001490e01 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5327, tgid 5326 (syz.0.0), ts 85793996522, free_ts 85654968207 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_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:4959 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2419 alloc_slab_page mm/slub.c:2451 [inline] allocate_slab+0x8a/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] kmem_cache_alloc_noprof+0x283/0x3c0 mm/slub.c:4204 mempool_init_node+0x1e5/0x4d0 mm/mempool.c:217 mempool_init_noprof+0x3a/0x50 mm/mempool.c:246 bioset_init+0x2eb/0x790 block/bio.c:1803 bch2_fs_fs_io_buffered_init+0x2b/0x50 fs/bcachefs/fs-io-buffered.c:1101 bch2_fs_init_rw fs/bcachefs/super.c:816 [inline] __bch2_fs_read_write+0x6cf/0x830 fs/bcachefs/super.c:489 bch2_fs_read_write_early+0x26/0x40 fs/bcachefs/super.c:576 bch2_fs_initialize+0xae2/0x1550 fs/bcachefs/recovery.c:1188 bch2_fs_start+0xa88/0xd90 fs/bcachefs/super.c:1204 bch2_fs_get_tree+0xb02/0x14f0 fs/bcachefs/fs.c:2489 page last free pid 5296 tgid 5296 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 discard_slab mm/slub.c:2717 [inline] __put_partials+0x161/0x1c0 mm/slub.c:3186 put_cpu_partial+0x17c/0x250 mm/slub.c:3261 __slab_free+0x2f7/0x400 mm/slub.c:4513 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x97/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4148 [inline] slab_alloc_node mm/slub.c:4197 [inline] kmem_cache_alloc_noprof+0x1c1/0x3c0 mm/slub.c:4204 getname_flags+0xb8/0x540 fs/namei.c:146 getname include/linux/fs.h:2907 [inline] __do_sys_unlink fs/namei.c:4705 [inline] __se_sys_unlink fs/namei.c:4703 [inline] __x64_sys_unlink+0x3a/0x50 fs/namei.c:4703 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 Memory state around the buggy address: ffff888052439200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc ffff888052439280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888052439300: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888052439380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888052439400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================