loop2: detected capacity change from 0 to 32768 ================================================================== BUG: KASAN: slab-out-of-bounds in bch2_sb_downgrade_to_text+0x5c3/0x970 fs/bcachefs/sb-downgrade.c:182 Read of size 2 at addr ffff888058ec6000 by task syz-executor.2/7032 CPU: 0 PID: 7032 Comm: syz-executor.2 Not tainted 6.9.0-rc6-next-20240503-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 bch2_sb_downgrade_to_text+0x5c3/0x970 fs/bcachefs/sb-downgrade.c:182 bch2_sb_field_validate+0x1f7/0x2d0 fs/bcachefs/super-io.c:1208 bch2_sb_validate+0xa61/0xdf0 fs/bcachefs/super-io.c:468 __bch2_read_super+0xc9a/0x1460 fs/bcachefs/super-io.c:822 bch2_fs_open+0x246/0xdf0 fs/bcachefs/super.c:2052 bch2_mount+0x71d/0x1320 fs/bcachefs/fs.c:1917 legacy_get_tree+0xee/0x190 fs/fs_context.c:662 vfs_get_tree+0x90/0x2a0 fs/super.c:1780 do_new_mount+0x2be/0xb40 fs/namespace.c:3352 do_mount fs/namespace.c:3692 [inline] __do_sys_mount fs/namespace.c:3898 [inline] __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3875 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fc5a447f3aa Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 09 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fc5a5153ef8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007fc5a5153f80 RCX: 00007fc5a447f3aa RDX: 0000000020011a00 RSI: 0000000020000000 RDI: 00007fc5a5153f40 RBP: 0000000020011a00 R08: 00007fc5a5153f80 R09: 0000000003a04000 R10: 0000000003a04000 R11: 0000000000000202 R12: 0000000020000000 R13: 00007fc5a5153f40 R14: 0000000000011a04 R15: 0000000020000600 Allocated by task 7032: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slub.c:4121 [inline] kmalloc_node_track_caller_noprof+0x22a/0x450 mm/slub.c:4141 __do_krealloc mm/slab_common.c:1183 [inline] krealloc_noprof+0x7d/0x120 mm/slab_common.c:1216 bch2_sb_realloc+0x2fc/0x660 fs/bcachefs/super-io.c:189 read_one_super+0x77a/0x1080 fs/bcachefs/super-io.c:659 __bch2_read_super+0x65a/0x1460 fs/bcachefs/super-io.c:750 bch2_fs_open+0x246/0xdf0 fs/bcachefs/super.c:2052 bch2_mount+0x71d/0x1320 fs/bcachefs/fs.c:1917 legacy_get_tree+0xee/0x190 fs/fs_context.c:662 vfs_get_tree+0x90/0x2a0 fs/super.c:1780 do_new_mount+0x2be/0xb40 fs/namespace.c:3352 do_mount fs/namespace.c:3692 [inline] __do_sys_mount fs/namespace.c:3898 [inline] __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3875 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888058ec4000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 0 bytes to the right of allocated 8192-byte region [ffff888058ec4000, ffff888058ec6000) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x58ec0 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffefff(slab) raw: 00fff00000000040 ffff888015042280 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000020002 00000001ffffefff 0000000000000000 head: 00fff00000000040 ffff888015042280 dead000000000122 0000000000000000 head: 0000000000000000 0000000000020002 00000001ffffefff 0000000000000000 head: 00fff00000000003 ffffea000163b001 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 2840, tgid 2840 (kworker/u8:7), ts 157005966323, free_ts 153564325079 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1468 prep_new_page mm/page_alloc.c:1476 [inline] get_page_from_freelist+0x2ce2/0x2d90 mm/page_alloc.c:3438 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4696 __alloc_pages_node_noprof include/linux/gfp.h:244 [inline] alloc_pages_node_noprof include/linux/gfp.h:271 [inline] alloc_slab_page+0x5f/0x120 mm/slub.c:2264 allocate_slab+0x5a/0x2e0 mm/slub.c:2427 new_slab mm/slub.c:2480 [inline] ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3666 __slab_alloc+0x58/0xa0 mm/slub.c:3756 __slab_alloc_node mm/slub.c:3809 [inline] slab_alloc_node mm/slub.c:3988 [inline] __do_kmalloc_node mm/slub.c:4120 [inline] __kmalloc_noprof+0x25e/0x410 mm/slub.c:4134 kmalloc_noprof include/linux/slab.h:664 [inline] kmalloc_array_noprof include/linux/slab.h:699 [inline] __sta_info_alloc+0xbcb/0x1ea0 net/mac80211/sta_info.c:616 ieee80211_ibss_add_sta+0x5ad/0x860 net/mac80211/ibss.c:620 ieee80211_update_sta_info net/mac80211/ibss.c:1006 [inline] ieee80211_rx_bss_info net/mac80211/ibss.c:1097 [inline] ieee80211_rx_mgmt_probe_beacon net/mac80211/ibss.c:1578 [inline] ieee80211_ibss_rx_queued_mgmt+0x15c0/0x2d70 net/mac80211/ibss.c:1605 ieee80211_iface_process_skb net/mac80211/iface.c:1605 [inline] ieee80211_iface_work+0x8a3/0xf10 net/mac80211/iface.c:1659 cfg80211_wiphy_work+0x221/0x260 net/wireless/core.c:437 process_one_work kernel/workqueue.c:3231 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312 worker_thread+0x86d/0xd70 kernel/workqueue.c:3393 kthread+0x2f0/0x390 kernel/kthread.c:389 page last free pid 12 tgid 12 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1088 [inline] free_unref_page+0xd22/0xea0 mm/page_alloc.c:2601 __folio_put+0x3b9/0x620 mm/swap.c:129 io_pages_unmap+0x1d3/0x330 io_uring/memmap.c:111 io_rings_free+0xcf/0x2b0 io_uring/io_uring.c:2564 io_ring_ctx_free+0xc61/0xea0 io_uring/io_uring.c:2673 io_ring_exit_work+0x80f/0x8a0 io_uring/io_uring.c:2885 process_one_work kernel/workqueue.c:3231 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312 worker_thread+0x86d/0xd70 kernel/workqueue.c:3393 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Memory state around the buggy address: ffff888058ec5f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888058ec5f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888058ec6000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff888058ec6080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888058ec6100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================