bcachefs (loop1): mounting version 1.7: mi_btree_bitmap opts=metadata_checksum=none,data_checksum=xxhash,compression=zstd,nocow bcachefs (loop1): recovering from clean shutdown, journal seq 10 ================================================================== BUG: KASAN: slab-use-after-free in memcpy_dir crypto/scatterwalk.c:23 [inline] BUG: KASAN: slab-use-after-free in scatterwalk_copychunks+0x1cc/0x460 crypto/scatterwalk.c:38 Read of size 40 at addr ffff88805967c000 by task syz-executor.1/9213 CPU: 0 PID: 9213 Comm: syz-executor.1 Not tainted 6.10.0-rc1-syzkaller-00021-ge0cce98fe279 #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 memcpy_dir crypto/scatterwalk.c:23 [inline] scatterwalk_copychunks+0x1cc/0x460 crypto/scatterwalk.c:38 skcipher_next_slow+0x39d/0x480 crypto/skcipher.c:276 skcipher_walk_next+0x634/0xba0 crypto/skcipher.c:361 chacha_simd_stream_xor+0x67f/0xd10 arch/x86/crypto/chacha_glue.c:192 do_encrypt_sg fs/bcachefs/checksum.c:108 [inline] do_encrypt+0x4ef/0x7d0 fs/bcachefs/checksum.c:128 bset_encrypt fs/bcachefs/btree_io.h:118 [inline] bch2_btree_node_read_done+0x184f/0x6740 fs/bcachefs/btree_io.c:1124 btree_node_read_work+0x68b/0x1260 fs/bcachefs/btree_io.c:1340 bch2_btree_node_read+0x2433/0x2a10 __bch2_btree_root_read fs/bcachefs/btree_io.c:1764 [inline] bch2_btree_root_read+0x61e/0x970 fs/bcachefs/btree_io.c:1788 read_btree_roots+0x22d/0x7b0 fs/bcachefs/recovery.c:475 bch2_fs_recovery+0x2346/0x3720 fs/bcachefs/recovery.c:803 bch2_fs_start+0x356/0x5b0 fs/bcachefs/super.c:1031 bch2_fs_open+0xa8d/0xdf0 fs/bcachefs/super.c:2123 bch2_mount+0x71d/0x1310 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+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f024c47e5ea 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:00007f024d18aef8 EFLAGS: 00000206 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f024d18af80 RCX: 00007f024c47e5ea RDX: 0000000020000000 RSI: 0000000020000200 RDI: 00007f024d18af40 RBP: 0000000020000000 R08: 00007f024d18af80 R09: 0000000001000014 R10: 0000000001000014 R11: 0000000000000206 R12: 0000000020000200 R13: 00007f024d18af40 R14: 00000000000119f9 R15: 0000000020000480 Allocated by task 2899: 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] kmalloc_trace_noprof+0x19c/0x2c0 mm/slub.c:4152 kmalloc_noprof include/linux/slab.h:660 [inline] batadv_forw_packet_alloc+0x19c/0x3b0 net/batman-adv/send.c:519 batadv_iv_ogm_aggregate_new net/batman-adv/bat_iv_ogm.c:562 [inline] batadv_iv_ogm_queue_add+0x6da/0xbf0 net/batman-adv/bat_iv_ogm.c:670 batadv_iv_ogm_schedule_buff net/batman-adv/bat_iv_ogm.c:849 [inline] batadv_iv_ogm_schedule+0xc4d/0x1090 net/batman-adv/bat_iv_ogm.c:868 batadv_iv_send_outstanding_bat_ogm_packet+0x6fe/0x810 net/batman-adv/bat_iv_ogm.c:1712 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 Freed by task 7262: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object+0xe0/0x150 mm/kasan/common.c:240 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2195 [inline] slab_free mm/slub.c:4436 [inline] kfree+0x149/0x360 mm/slub.c:4557 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 Last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47 __kasan_record_aux_stack+0xac/0xc0 mm/kasan/generic.c:541 insert_work+0x3e/0x330 kernel/workqueue.c:2207 __queue_work+0xaf2/0xee0 kernel/workqueue.c:2363 call_timer_fn+0x18e/0x650 kernel/time/timer.c:1792 expire_timers kernel/time/timer.c:1838 [inline] __run_timers kernel/time/timer.c:2417 [inline] __run_timer_base+0x695/0x8e0 kernel/time/timer.c:2428 run_timer_base kernel/time/timer.c:2437 [inline] run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2447 handle_softirqs+0x2c4/0x970 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637 irq_exit_rcu+0x9/0x30 kernel/softirq.c:649 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 The buggy address belongs to the object at ffff88805967c000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 0 bytes inside of freed 512-byte region [ffff88805967c000, ffff88805967c200) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88805967e400 pfn:0x5967c head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000240(workingset|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffefff(slab) raw: 00fff00000000240 ffff888015041c80 ffffea00007a6d10 ffffea00007ccb10 raw: ffff88805967e400 0000000000100005 00000001ffffefff 0000000000000000 head: 00fff00000000240 ffff888015041c80 ffffea00007a6d10 ffffea00007ccb10 head: ffff88805967e400 0000000000100005 00000001ffffefff 0000000000000000 head: 00fff00000000002 ffffea0001659f01 ffffffffffffffff 0000000000000000 head: 0000000000000004 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0x152820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 5156, tgid 5156 (kworker/0:5), ts 131010324263, free_ts 130525462874 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+0x2e2d/0x2ee0 mm/page_alloc.c:3402 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4660 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [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+0x257/0x400 mm/slub.c:4134 kmalloc_noprof include/linux/slab.h:664 [inline] kzalloc_noprof include/linux/slab.h:778 [inline] fib6_info_alloc+0x2e/0xf0 net/ipv6/ip6_fib.c:155 ip6_route_info_create+0x445/0x12b0 net/ipv6/route.c:3759 ip6_route_add+0x28/0x160 net/ipv6/route.c:3851 addrconf_prefix_route net/ipv6/addrconf.c:2485 [inline] addrconf_add_linklocal+0x61a/0xa30 net/ipv6/addrconf.c:3316 addrconf_addr_gen+0x510/0xbb0 addrconf_dev_config net/ipv6/addrconf.c:3491 [inline] addrconf_init_auto_addrs+0x96a/0xeb0 net/ipv6/addrconf.c:3569 addrconf_notify+0xaff/0x1020 net/ipv6/addrconf.c:3742 notifier_call_chain+0x19f/0x3e0 kernel/notifier.c:93 page last free pid 5927 tgid 5927 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1088 [inline] free_unref_folios+0xf12/0x19c0 mm/page_alloc.c:2614 folios_put_refs+0x93a/0xa60 mm/swap.c:1024 free_pages_and_swap_cache+0x5c8/0x690 mm/swap_state.c:332 __tlb_batch_free_encoded_pages mm/mmu_gather.c:136 [inline] tlb_batch_pages_flush mm/mmu_gather.c:149 [inline] tlb_flush_mmu_free mm/mmu_gather.c:366 [inline] tlb_flush_mmu+0x3a3/0x680 mm/mmu_gather.c:373 tlb_finish_mmu+0xd4/0x200 mm/mmu_gather.c:465 exit_mmap+0x44f/0xc80 mm/mmap.c:3354 __mmput+0x115/0x3c0 kernel/fork.c:1346 exec_mmap+0x651/0x6e0 fs/exec.c:1063 begin_new_exec+0x125f/0x1f50 fs/exec.c:1329 load_elf_binary+0x974/0x2620 fs/binfmt_elf.c:996 search_binary_handler fs/exec.c:1797 [inline] exec_binprm fs/exec.c:1839 [inline] bprm_execve+0xaf8/0x17c0 fs/exec.c:1891 do_execveat_common+0x553/0x700 fs/exec.c:1998 do_execve fs/exec.c:2072 [inline] __do_sys_execve fs/exec.c:2148 [inline] __se_sys_execve fs/exec.c:2143 [inline] __x64_sys_execve+0x92/0xb0 fs/exec.c:2143 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88805967bf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88805967bf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88805967c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805967c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805967c100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================