bcachefs (loop0): error validating btree node on loop0 at btree dirents level 0/0 u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 267fcf747c875937 written 24 min_key 0:226016617283:672425216 durability: 1 ptr: 0:41:0 gen 0 node offset 0/24 bset u64s 0: checksum error, type chacha20_poly1305_128: got 9a1b1147f9e4b168909e4e71026051d3 should be 69b1fb03258d0bca46768bfb829da276, fixing bcachefs (loop0): btree_node_read_work: rewriting btree node at due to error btree=dirents level=0 u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 267fcf747c875937 written 24 min_key 0:226016617283:672425216 durability: 1 ptr: 0:41:0 gen 0 ================================================================== BUG: KASAN: stack-out-of-bounds in sg_mark_end include/linux/scatterlist.h:258 [inline] BUG: KASAN: stack-out-of-bounds in do_encrypt+0xa22/0xd70 fs/bcachefs/checksum.c:158 Read of size 8 at addr ffffc900005772a8 by task kworker/0:1H/36 CPU: 0 UID: 0 PID: 36 Comm: kworker/0:1H Not tainted 6.13.0-syzkaller-08291-g805ba04cb7cc #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: bcachefs_btree_read_complete btree_node_read_work Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x169/0x550 mm/kasan/report.c:489 kasan_report+0x143/0x180 mm/kasan/report.c:602 sg_mark_end include/linux/scatterlist.h:258 [inline] do_encrypt+0xa22/0xd70 fs/bcachefs/checksum.c:158 bset_encrypt fs/bcachefs/btree_io.h:118 [inline] bch2_btree_node_read_done+0x1d3b/0x5f70 fs/bcachefs/btree_io.c:1114 btree_node_read_work+0x6dc/0x1380 fs/bcachefs/btree_io.c:1358 process_one_work kernel/workqueue.c:3236 [inline] process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3317 worker_thread+0x870/0xd30 kernel/workqueue.c:3398 kthread+0x7a9/0x920 kernel/kthread.c:464 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 The buggy address belongs to stack of task kworker/0:1H/36 and is located at offset 1768 in frame: do_encrypt+0x0/0xd70 This frame has 8 objects: [32, 48) 'nonce.i272' [64, 528) '__req_desc.i273' [592, 608) 'nonce.i254' [624, 1088) '__req_desc.i255' [1152, 1168) 'nonce.i' [1184, 1648) '__req_desc.i' [1712, 1744) 'sg' [1776, 1928) 'sgl' The buggy address belongs to the virtual mapping at [ffffc90000570000, ffffc90000579000) created by: copy_process+0x5d1/0x3d50 kernel/fork.c:2222 The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1dc4f flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2dc2(GFP_KERNEL|__GFP_HIGHMEM|__GFP_NOWARN|__GFP_ZERO), pid 2, tgid 2 (kthreadd), ts 2696076519, free_ts 0 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f4/0x240 mm/page_alloc.c:1551 prep_new_page mm/page_alloc.c:1559 [inline] get_page_from_freelist+0x365c/0x37a0 mm/page_alloc.c:3477 __alloc_frozen_pages_noprof+0x292/0x710 mm/page_alloc.c:4739 __alloc_pages_noprof+0xa/0x30 mm/page_alloc.c:4773 __alloc_pages_node_noprof include/linux/gfp.h:265 [inline] alloc_pages_node_noprof include/linux/gfp.h:292 [inline] vm_area_alloc_pages mm/vmalloc.c:3593 [inline] __vmalloc_area_node mm/vmalloc.c:3669 [inline] __vmalloc_node_range_noprof+0x8b7/0x1380 mm/vmalloc.c:3846 alloc_thread_stack_node kernel/fork.c:314 [inline] dup_task_struct+0x444/0x8c0 kernel/fork.c:1116 copy_process+0x5d1/0x3d50 kernel/fork.c:2222 kernel_clone+0x226/0x8e0 kernel/fork.c:2804 kernel_thread+0x1bc/0x240 kernel/fork.c:2866 create_kthread kernel/kthread.c:487 [inline] kthreadd+0x60d/0x810 kernel/kthread.c:847 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 page_owner free stack trace missing Memory state around the buggy address: ffffc90000577180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffffc90000577200: 00 00 00 00 00 00 f2 f2 f2 f2 f2 f2 f2 f2 00 00 >ffffc90000577280: 00 00 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 ^ ffffc90000577300: 00 00 00 00 00 00 00 00 00 f3 f3 f3 f3 f3 f3 f3 ffffc90000577380: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================