loop1: detected capacity change from 0 to 32768 ================================================================== BUG: KASAN: slab-out-of-bounds in bch2_sb_downgrade_to_text+0xfe0/0x1210 fs/bcachefs/sb-downgrade.c:185 Read of size 2 at addr ffff888056522000 by task syz-executor.1/9618 CPU: 0 PID: 9618 Comm: syz-executor.1 Not tainted 6.9.0-rc6-syzkaller-00290-gb9158815de52 #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+0x116/0x1f0 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 bch2_sb_downgrade_to_text+0xfe0/0x1210 fs/bcachefs/sb-downgrade.c:185 __bch2_sb_field_to_text+0x123/0x1e0 fs/bcachefs/super-io.c:1228 bch2_sb_field_validate+0x248/0x2d0 fs/bcachefs/super-io.c:1211 bch2_sb_validate.isra.0+0x6d8/0xce0 fs/bcachefs/super-io.c:468 __bch2_read_super+0x93c/0x12a0 fs/bcachefs/super-io.c:822 bch2_fs_open+0x3e5/0x10f0 fs/bcachefs/super.c:2049 bch2_mount+0xd41/0x1090 fs/bcachefs/fs.c:1903 legacy_get_tree+0x109/0x220 fs/fs_context.c:662 vfs_get_tree+0x8f/0x380 fs/super.c:1779 do_new_mount fs/namespace.c:3352 [inline] path_mount+0x6e1/0x1f10 fs/namespace.c:3679 do_mount fs/namespace.c:3692 [inline] __do_sys_mount fs/namespace.c:3898 [inline] __se_sys_mount fs/namespace.c:3875 [inline] __ia32_sys_mount+0x295/0x320 fs/namespace.c:3875 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x75/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf72d5579 Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f5ec7400 EFLAGS: 00000292 ORIG_RAX: 0000000000000015 RAX: ffffffffffffffda RBX: 00000000f5ec7460 RCX: 0000000020000000 RDX: 0000000020011a00 RSI: 0000000003a04000 RDI: 00000000f5ec74a0 RBP: 00000000f5ec7460 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000296 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 9618: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0xaa/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+0x220/0x470 mm/slub.c:3986 __do_krealloc mm/slab_common.c:1192 [inline] krealloc+0x5d/0x100 mm/slab_common.c:1225 bch2_sb_realloc+0x242/0x5d0 fs/bcachefs/super-io.c:189 read_one_super+0x2fa/0x2290 fs/bcachefs/super-io.c:659 __bch2_read_super+0x4d6/0x12a0 fs/bcachefs/super-io.c:750 bch2_fs_open+0x3e5/0x10f0 fs/bcachefs/super.c:2049 bch2_mount+0xd41/0x1090 fs/bcachefs/fs.c:1903 legacy_get_tree+0x109/0x220 fs/fs_context.c:662 vfs_get_tree+0x8f/0x380 fs/super.c:1779 do_new_mount fs/namespace.c:3352 [inline] path_mount+0x6e1/0x1f10 fs/namespace.c:3679 do_mount fs/namespace.c:3692 [inline] __do_sys_mount fs/namespace.c:3898 [inline] __se_sys_mount fs/namespace.c:3875 [inline] __ia32_sys_mount+0x295/0x320 fs/namespace.c:3875 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x75/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff888056520000 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 [ffff888056520000, ffff888056522000) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x56520 head: order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0x4fff00000000840(slab|head|node=1|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 04fff00000000840 ffff888014c43180 0000000000000000 0000000000000001 raw: 0000000000000000 0000000000020002 00000001ffffffff 0000000000000000 head: 04fff00000000840 ffff888014c43180 0000000000000000 0000000000000001 head: 0000000000000000 0000000000020002 00000001ffffffff 0000000000000000 head: 04fff00000000003 ffffea0001594801 dead000000000122 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 9200, tgid -320032416 (syz-executor.3), ts 9200, free_ts 165869640696 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1534 prep_new_page mm/page_alloc.c:1541 [inline] get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3317 __alloc_pages+0x22b/0x2460 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 mm/slub.c:2175 [inline] allocate_slab mm/slub.c:2338 [inline] new_slab+0xcc/0x3a0 mm/slub.c:2391 ___slab_alloc+0x670/0x16d0 mm/slub.c:3525 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3610 __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+0x36e/0x480 mm/slub.c:3973 kmalloc_node include/linux/slab.h:648 [inline] kvmalloc_node+0x6f/0x1a0 mm/util.c:634 kvmalloc include/linux/slab.h:766 [inline] kvmalloc_array include/linux/slab.h:784 [inline] __ptr_ring_init_queue_alloc include/linux/ptr_ring.h:471 [inline] ptr_ring_resize include/linux/ptr_ring.h:594 [inline] tun_attach.isra.0+0x8e1/0x1790 drivers/net/tun.c:791 tun_net_init+0x3cb/0x510 drivers/net/tun.c:1002 register_netdevice+0x59f/0x1c40 net/core/dev.c:10210 tun_set_iff drivers/net/tun.c:2851 [inline] __tun_chr_ioctl+0x25c2/0x4970 drivers/net/tun.c:3120 __do_compat_sys_ioctl+0x2c3/0x330 fs/ioctl.c:1004 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x75/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e page last free pid 6371 tgid 6371 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+0x527/0xb10 mm/page_alloc.c:2347 free_unref_page+0x33/0x3c0 mm/page_alloc.c:2487 vfree+0x181/0x7a0 mm/vmalloc.c:3340 kcov_put kernel/kcov.c:429 [inline] kcov_put+0x2a/0x40 kernel/kcov.c:425 kcov_close+0x10/0x20 kernel/kcov.c:525 __fput+0x270/0xb80 fs/file_table.c:422 task_work_run+0x14e/0x250 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xa7d/0x2c10 kernel/exit.c:878 do_group_exit+0xd3/0x2a0 kernel/exit.c:1027 __do_sys_exit_group kernel/exit.c:1038 [inline] __se_sys_exit_group kernel/exit.c:1036 [inline] __ia32_sys_exit_group+0x3e/0x50 kernel/exit.c:1036 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x75/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Memory state around the buggy address: ffff888056521f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888056521f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888056522000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff888056522080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888056522100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ---------------- Code disassembly (best guess), 2 bytes skipped: 0: 10 06 adc %al,(%rsi) 2: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 6: 10 07 adc %al,(%rdi) 8: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi c: 10 08 adc %cl,(%rax) e: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1e: 00 51 52 add %dl,0x52(%rcx) 21: 55 push %rbp 22: 89 e5 mov %esp,%ebp 24: 0f 34 sysenter 26: cd 80 int $0x80 * 28: 5d pop %rbp <-- trapping instruction 29: 5a pop %rdx 2a: 59 pop %rcx 2b: c3 ret 2c: 90 nop 2d: 90 nop 2e: 90 nop 2f: 90 nop 30: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 37: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi