loop5: detected capacity change from 0 to 32768 ================================================================== BUG: KASAN: slab-out-of-bounds in bch2_sb_downgrade_to_text+0x15ab/0x1f70 fs/bcachefs/sb-downgrade.c:185 Read of size 2 at addr ffff88802c4f2000 by task syz-executor.5/12490 CPU: 1 PID: 12490 Comm: syz-executor.5 Not tainted 6.9.0-rc6-syzkaller-00290-gb9158815de52 #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+0x15ab/0x1f70 fs/bcachefs/sb-downgrade.c:185 bch2_sb_field_validate+0x1f7/0x2d0 fs/bcachefs/super-io.c:1211 bch2_sb_validate+0xa79/0xe10 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:2049 bch2_mount+0x71d/0x1320 fs/bcachefs/fs.c:1903 legacy_get_tree+0xf0/0x190 fs/fs_context.c:662 vfs_get_tree+0x92/0x2a0 fs/super.c:1779 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:0x7f4ce367f3aa 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:00007f4ce434bef8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f4ce434bf80 RCX: 00007f4ce367f3aa RDX: 0000000020011a00 RSI: 0000000020000000 RDI: 00007f4ce434bf40 RBP: 0000000020011a00 R08: 00007f4ce434bf80 R09: 0000000003a04000 R10: 0000000003a04000 R11: 0000000000000202 R12: 0000000020000000 R13: 00007f4ce434bf40 R14: 0000000000011a04 R15: 0000000020000600 Allocated by task 12490: 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:3966 [inline] __kmalloc_node_track_caller+0x24e/0x4e0 mm/slub.c:3986 __do_krealloc mm/slab_common.c:1192 [inline] krealloc+0x7d/0x120 mm/slab_common.c:1225 bch2_sb_realloc+0x2fc/0x660 fs/bcachefs/super-io.c:189 read_one_super+0x7d7/0x3a10 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:2049 bch2_mount+0x71d/0x1320 fs/bcachefs/fs.c:1903 legacy_get_tree+0xf0/0x190 fs/fs_context.c:662 vfs_get_tree+0x92/0x2a0 fs/super.c:1779 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 ffff88802c4f0000 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 [ffff88802c4f0000, ffff88802c4f2000) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2c4f0 head: order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000840 ffff888015042280 ffffea000073d800 dead000000000004 raw: 0000000000000000 0000000000020002 00000001ffffffff 0000000000000000 head: 00fff00000000840 ffff888015042280 ffffea000073d800 dead000000000004 head: 0000000000000000 0000000000020002 00000001ffffffff 0000000000000000 head: 00fff00000000003 ffffea0000b13c01 ffffea0000b13c48 00000000ffffffff head: 0000000800000000 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 6995, tgid -1170406294 (syz-executor.3), ts 6996, free_ts 161979284838 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1534 prep_new_page mm/page_alloc.c:1541 [inline] get_page_from_freelist+0x3410/0x35b0 mm/page_alloc.c:3317 __alloc_pages+0x256/0x6c0 mm/page_alloc.c:4575 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page+0x5f/0x160 mm/slub.c:2175 allocate_slab mm/slub.c:2338 [inline] new_slab+0x84/0x2f0 mm/slub.c:2391 ___slab_alloc+0xc73/0x1260 mm/slub.c:3525 __slab_alloc mm/slub.c:3610 [inline] __slab_alloc_node mm/slub.c:3663 [inline] slab_alloc_node mm/slub.c:3835 [inline] __do_kmalloc_node mm/slub.c:3965 [inline] __kmalloc_node_track_caller+0x2d6/0x4e0 mm/slub.c:3986 __do_krealloc mm/slab_common.c:1192 [inline] krealloc+0x7d/0x120 mm/slab_common.c:1225 realloc_array kernel/bpf/verifier.c:1245 [inline] grow_stack_state kernel/bpf/verifier.c:1308 [inline] check_stack_access_within_bounds+0x5be/0x980 kernel/bpf/verifier.c:6727 check_mem_access+0x865/0x1e60 kernel/bpf/verifier.c:6880 do_check+0x7e7f/0x10740 kernel/bpf/verifier.c:17770 do_check_common+0x14bd/0x1dd0 kernel/bpf/verifier.c:20545 do_check_main kernel/bpf/verifier.c:20636 [inline] bpf_check+0x130c7/0x19a20 kernel/bpf/verifier.c:21306 bpf_prog_load+0x1667/0x20f0 kernel/bpf/syscall.c:2895 __sys_bpf+0x4ee/0x810 kernel/bpf/syscall.c:5660 __do_sys_bpf kernel/bpf/syscall.c:5767 [inline] __se_sys_bpf kernel/bpf/syscall.c:5765 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5765 page last free pid 6995 tgid 6995 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1141 [inline] free_unref_page_prepare+0x986/0xab0 mm/page_alloc.c:2347 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2487 discard_slab mm/slub.c:2437 [inline] __put_partials+0xeb/0x130 mm/slub.c:2906 put_cpu_partial+0x17c/0x250 mm/slub.c:2981 __slab_free+0x2ea/0x3d0 mm/slub.c:4151 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x5e/0xc0 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3798 [inline] slab_alloc_node mm/slub.c:3845 [inline] kmem_cache_alloc+0x174/0x340 mm/slub.c:3852 getname_flags+0xbd/0x4f0 fs/namei.c:139 user_path_at_empty+0x2c/0x60 fs/namei.c:2920 user_path_at include/linux/namei.h:57 [inline] __do_sys_chdir fs/open.c:558 [inline] __se_sys_chdir+0xbf/0x220 fs/open.c:552 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 Memory state around the buggy address: ffff88802c4f1f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88802c4f1f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88802c4f2000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff88802c4f2080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802c4f2100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================