loop0: detected capacity change from 0 to 32768 bcachefs (loop0): mounting version 1.7: mi_btree_bitmap opts=metadata_checksum=none,data_checksum=none,nojournal_transaction_names bcachefs (loop0): recovering from clean shutdown, journal seq 10 ================================================================== BUG: KASAN: use-after-free in poly1305_update_arch+0x259/0x7d0 arch/x86/crypto/poly1305_glue.c:198 Read of size 8 at addr ffff888075c61790 by task syz-executor414/5125 CPU: 0 PID: 5125 Comm: syz-executor414 Not tainted 6.9.0-rc6-syzkaller-00234-g7367539ad4b0 #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 kasan_check_range+0x282/0x290 mm/kasan/generic.c:189 __asan_memcpy+0x29/0x70 mm/kasan/shadow.c:105 poly1305_update_arch+0x259/0x7d0 arch/x86/crypto/poly1305_glue.c:198 crypto_poly1305_update+0x28/0x40 arch/x86/crypto/poly1305_glue.c:230 bch2_checksum+0x5a9/0x730 fs/bcachefs/checksum.c:228 bch2_btree_node_read_done+0x109a/0x5a40 fs/bcachefs/btree_io.c:1096 btree_node_read_work+0x665/0x1300 fs/bcachefs/btree_io.c:1324 bch2_btree_node_read+0x2b64/0x32c0 __bch2_btree_root_read fs/bcachefs/btree_io.c:1748 [inline] bch2_btree_root_read+0x61e/0x970 fs/bcachefs/btree_io.c:1772 read_btree_roots+0x22d/0x7b0 fs/bcachefs/recovery.c:457 bch2_fs_recovery+0x431c/0x6390 fs/bcachefs/recovery.c:785 bch2_fs_start+0x356/0x5b0 fs/bcachefs/super.c:1043 bch2_fs_open+0xa8d/0xdf0 fs/bcachefs/super.c:2102 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:0x7fd721be902a Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 5e 04 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffd3c0e9348 EFLAGS: 00000282 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007ffd3c0e9360 RCX: 00007fd721be902a RDX: 0000000020011a00 RSI: 0000000020011a40 RDI: 00007ffd3c0e9360 RBP: 0000000000000004 R08: 00007ffd3c0e93a0 R09: 00000000000119f3 R10: 0000000001200014 R11: 0000000000000282 R12: 0000000001200014 R13: 00007ffd3c0e93a0 R14: 0000000000000003 R15: 0000000001000000 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x2000000000 pfn:0x75c61 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000 raw: 0000002000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 5, migratetype Unmovable, gfp_mask 0x52800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP), pid 5109, tgid -1545345822 (syz-executor414), ts 5109, free_ts 80376804801 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] __kmalloc_large_node+0x91/0x1f0 mm/slub.c:3911 __do_kmalloc_node mm/slub.c:3954 [inline] __kmalloc_node+0x33e/0x4e0 mm/slub.c:3973 kmalloc_node include/linux/slab.h:648 [inline] kvmalloc_node+0x72/0x190 mm/util.c:634 kvmalloc include/linux/slab.h:766 [inline] btree_bounce_alloc fs/bcachefs/btree_io.c:118 [inline] bch2_btree_node_read_done+0x346f/0x5a40 fs/bcachefs/btree_io.c:1185 btree_node_read_work+0x665/0x1300 fs/bcachefs/btree_io.c:1324 bch2_btree_node_read+0x2b64/0x32c0 __bch2_btree_root_read fs/bcachefs/btree_io.c:1748 [inline] bch2_btree_root_read+0x61e/0x970 fs/bcachefs/btree_io.c:1772 read_btree_roots+0x22d/0x7b0 fs/bcachefs/recovery.c:457 bch2_fs_recovery+0x431c/0x6390 fs/bcachefs/recovery.c:785 bch2_fs_start+0x356/0x5b0 fs/bcachefs/super.c:1043 bch2_fs_open+0xa8d/0xdf0 fs/bcachefs/super.c:2102 bch2_mount+0x71d/0x1320 fs/bcachefs/fs.c:1903 legacy_get_tree+0xf0/0x190 fs/fs_context.c:662 page last free pid 5109 tgid 5109 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1141 [inline] __free_pages_ok+0xc60/0xd90 mm/page_alloc.c:1270 __folio_put_large+0x168/0x1d0 mm/swap.c:132 __folio_put+0x299/0x390 mm/swap.c:140 folio_put include/linux/mm.h:1508 [inline] free_large_kmalloc+0x105/0x1c0 mm/slub.c:4361 kfree+0x1ca/0x3a0 mm/slub.c:4384 btree_node_data_free+0xaa/0x160 fs/bcachefs/btree_cache.c:64 bch2_fs_btree_cache_exit+0x6b9/0xb80 fs/bcachefs/btree_cache.c:441 __bch2_fs_free fs/bcachefs/super.c:564 [inline] bch2_fs_release+0x1d9/0x5a0 fs/bcachefs/super.c:610 kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x231/0x480 lib/kobject.c:737 bch2_fs_stop fs/bcachefs/super.c:681 [inline] bch2_fs_open+0xb57/0xdf0 fs/bcachefs/super.c:2118 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 Memory state around the buggy address: ffff888075c61680: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888075c61700: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888075c61780: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888075c61800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888075c61880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================