================================================================== BUG: KASAN: use-after-free in poly1305_update_arch+0x259/0x7d0 arch/x86/crypto/poly1305_glue.c:198 Read of size 8 at addr ffff888046eddb50 by task syz-executor.4/11859 CPU: 0 PID: 11859 Comm: syz-executor.4 Not tainted 6.9.0-rc7-next-20240508-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/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:229 bch2_btree_node_read_done+0x1358/0x5ed0 fs/bcachefs/btree_io.c:1117 btree_node_read_work+0x665/0x1300 fs/bcachefs/btree_io.c:1345 bch2_btree_node_read+0x2637/0x2c80 fs/bcachefs/btree_io.c:1730 __bch2_btree_root_read fs/bcachefs/btree_io.c:1769 [inline] bch2_btree_root_read+0x61e/0x970 fs/bcachefs/btree_io.c:1793 read_btree_roots+0x22d/0x7b0 fs/bcachefs/recovery.c:472 bch2_fs_recovery+0x2346/0x3700 fs/bcachefs/recovery.c:800 bch2_fs_start+0x356/0x5b0 fs/bcachefs/super.c:1031 bch2_fs_open+0xa8d/0xdf0 fs/bcachefs/super.c:2123 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:0x7f795f07f46a 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:00007f795feccef8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f795feccf80 RCX: 00007f795f07f46a RDX: 0000000020011a00 RSI: 0000000020011a40 RDI: 00007f795feccf40 RBP: 0000000020011a00 R08: 00007f795feccf80 R09: 0000000001200014 R10: 0000000001200014 R11: 0000000000000202 R12: 0000000020011a40 R13: 00007f795feccf40 R14: 00000000000119f4 R15: 0000000020000100 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x46edd flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 dead000000000100 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Unmovable, gfp_mask 0x102cc2(GFP_HIGHUSER|__GFP_NOWARN), pid 10689, tgid 10688 (syz-executor.1), ts 427824830200, free_ts 431217183632 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_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265 vm_area_alloc_pages mm/vmalloc.c:3567 [inline] __vmalloc_area_node mm/vmalloc.c:3643 [inline] __vmalloc_node_range_noprof+0x9a4/0x1490 mm/vmalloc.c:3824 kvmalloc_node_noprof+0x142/0x190 mm/util.c:659 kvmalloc_array_node_noprof include/linux/slab.h:799 [inline] kvmalloc_array include/linux/slab.h:807 [inline] __bch2_darray_resize+0xb9/0x1e0 fs/bcachefs/darray.c:12 __darray_resize fs/bcachefs/darray.h:31 [inline] __darray_make_room fs/bcachefs/darray.h:43 [inline] bch2_fs_btree_write_buffer_init+0x264/0x2e0 fs/bcachefs/btree_write_buffer.c:667 bch2_fs_alloc+0x1cb2/0x2040 fs/bcachefs/super.c:916 bch2_fs_open+0x8cc/0xdf0 fs/bcachefs/super.c:2102 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 page last free pid 10182 tgid 10182 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 vfree+0x186/0x2e0 mm/vmalloc.c:3346 bch2_fs_btree_write_buffer_exit+0x174/0x1b0 fs/bcachefs/btree_write_buffer.c:653 __bch2_fs_free fs/bcachefs/super.c:565 [inline] bch2_fs_release+0x2ca/0x6e0 fs/bcachefs/super.c:603 kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x22f/0x480 lib/kobject.c:737 deactivate_locked_super+0xc4/0x130 fs/super.c:473 cleanup_mnt+0x426/0x4c0 fs/namespace.c:1267 task_work_run+0x24f/0x310 kernel/task_work.c:180 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop kernel/entry/common.c:114 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x168/0x370 kernel/entry/common.c:218 do_syscall_64+0x102/0x240 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888046edda00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888046edda80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888046eddb00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888046eddb80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888046eddc00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================