================================================================== BUG: KASAN: slab-out-of-bounds in get_unaligned_le64 include/asm-generic/unaligned.h:37 [inline] BUG: KASAN: slab-out-of-bounds in bch2_varint_decode_fast+0x1b5/0x1e0 fs/bcachefs/varint.c:114 Read of size 8 at addr ffff888051fcb67f by task syz-executor.1/28862 CPU: 0 PID: 28862 Comm: syz-executor.1 Not tainted 6.9.0-rc7-syzkaller-00012-gdccb07f2914c #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+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 get_unaligned_le64 include/asm-generic/unaligned.h:37 [inline] bch2_varint_decode_fast+0x1b5/0x1e0 fs/bcachefs/varint.c:114 bch2_inode_unpack_v3+0xf3d/0x2060 fs/bcachefs/inode.c:270 bch2_inode_unpack fs/bcachefs/inode.c:323 [inline] __bch2_inode_invalid+0x1a2/0x4d0 fs/bcachefs/inode.c:449 bch2_inode_v3_invalid+0x1f1/0x2e0 fs/bcachefs/inode.c:529 bch2_bkey_val_invalid+0x1ce/0x290 fs/bcachefs/bkey_methods.c:140 bch2_bkey_invalid+0x86/0x90 fs/bcachefs/bkey_methods.c:231 __bch2_trans_commit+0x7ea/0x7880 fs/bcachefs/btree_trans_commit.c:1008 bch2_trans_commit fs/bcachefs/btree_update.h:168 [inline] bch2_extent_update+0x494/0xa40 fs/bcachefs/io_write.c:318 bch2_write_index_default+0x8d7/0xb70 fs/bcachefs/io_write.c:366 __bch2_write_index+0x5ee/0xa60 fs/bcachefs/io_write.c:520 bch2_write_data_inline fs/bcachefs/io_write.c:1538 [inline] bch2_write+0x1113/0x1400 fs/bcachefs/io_write.c:1606 bch2_writepages+0x136/0x200 fs/bcachefs/fs-io-buffered.c:660 do_writepages+0x1a6/0x7f0 mm/page-writeback.c:2612 filemap_fdatawrite_wbc mm/filemap.c:397 [inline] filemap_fdatawrite_wbc+0x148/0x1c0 mm/filemap.c:387 __filemap_fdatawrite_range+0xba/0x100 mm/filemap.c:430 filemap_write_and_wait_range mm/filemap.c:685 [inline] filemap_write_and_wait_range+0xa3/0x130 mm/filemap.c:676 bch2_symlink+0x13a/0x200 fs/bcachefs/fs.c:587 vfs_symlink fs/namei.c:4481 [inline] vfs_symlink+0x3eb/0x630 fs/namei.c:4465 do_symlinkat+0x263/0x310 fs/namei.c:4507 __do_sys_symlinkat fs/namei.c:4523 [inline] __se_sys_symlinkat fs/namei.c:4520 [inline] __x64_sys_symlinkat+0x97/0xc0 fs/namei.c:4520 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7facce27dca9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007faccf0ae0c8 EFLAGS: 00000246 ORIG_RAX: 000000000000010a RAX: ffffffffffffffda RBX: 00007facce3abf80 RCX: 00007facce27dca9 RDX: 0000000020000180 RSI: 0000000000000005 RDI: 0000000020000140 RBP: 00007facce2c947e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007facce3abf80 R15: 00007fff4b315258 Allocated by task 28862: 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:3972 [inline] __kmalloc_node_track_caller+0x220/0x480 mm/slub.c:3992 __do_krealloc mm/slab_common.c:1192 [inline] krealloc+0x5d/0x100 mm/slab_common.c:1225 __bch2_trans_kmalloc+0x392/0xbf0 fs/bcachefs/btree_iter.c:2831 bch2_trans_kmalloc_nomemzero fs/bcachefs/btree_iter.h:537 [inline] __bch2_bkey_make_mut_noupdate.constprop.0+0x3c9/0x4e0 fs/bcachefs/btree_update.h:223 __bch2_bkey_get_mut_noupdate fs/bcachefs/btree_update.h:282 [inline] bch2_bkey_get_mut_noupdate fs/bcachefs/btree_update.h:293 [inline] bch2_extent_update_i_size_sectors+0x33d/0x760 fs/bcachefs/io_write.c:219 bch2_extent_update+0x3db/0xa40 fs/bcachefs/io_write.c:314 bch2_write_index_default+0x8d7/0xb70 fs/bcachefs/io_write.c:366 __bch2_write_index+0x5ee/0xa60 fs/bcachefs/io_write.c:520 bch2_write_data_inline fs/bcachefs/io_write.c:1538 [inline] bch2_write+0x1113/0x1400 fs/bcachefs/io_write.c:1606 bch2_writepages+0x136/0x200 fs/bcachefs/fs-io-buffered.c:660 do_writepages+0x1a6/0x7f0 mm/page-writeback.c:2612 filemap_fdatawrite_wbc mm/filemap.c:397 [inline] filemap_fdatawrite_wbc+0x148/0x1c0 mm/filemap.c:387 __filemap_fdatawrite_range+0xba/0x100 mm/filemap.c:430 filemap_write_and_wait_range mm/filemap.c:685 [inline] filemap_write_and_wait_range+0xa3/0x130 mm/filemap.c:676 bch2_symlink+0x13a/0x200 fs/bcachefs/fs.c:587 vfs_symlink fs/namei.c:4481 [inline] vfs_symlink+0x3eb/0x630 fs/namei.c:4465 do_symlinkat+0x263/0x310 fs/namei.c:4507 __do_sys_symlinkat fs/namei.c:4523 [inline] __se_sys_symlinkat fs/namei.c:4520 [inline] __x64_sys_symlinkat+0x97/0xc0 fs/namei.c:4520 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888051fcb600 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 127 bytes inside of allocated 128-byte region [ffff888051fcb600, ffff888051fcb680) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x51fcb flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000800 ffff8880150418c0 dead000000000122 0000000000000000 raw: 0000000000000000 0000000080100010 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 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 28860, tgid 836454928 (syz-executor.1), ts 28862, free_ts 1774457148104 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:2180 [inline] allocate_slab mm/slub.c:2343 [inline] new_slab+0xcc/0x3a0 mm/slub.c:2396 ___slab_alloc+0x66d/0x1790 mm/slub.c:3530 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3615 __slab_alloc_node mm/slub.c:3668 [inline] slab_alloc_node mm/slub.c:3841 [inline] __do_kmalloc_node mm/slub.c:3971 [inline] __kmalloc_node_track_caller+0x372/0x480 mm/slub.c:3992 __do_krealloc mm/slab_common.c:1192 [inline] krealloc+0x5d/0x100 mm/slab_common.c:1225 bch2_printbuf_make_room+0x195/0x2a0 fs/bcachefs/printbuf.c:38 bch2_prt_printf+0x223/0x3d0 fs/bcachefs/printbuf.c:78 bch2_bpos_to_text+0x367/0x3c0 fs/bcachefs/bkey_methods.c:270 bch2_btree_path_to_text fs/bcachefs/btree_iter.c:1441 [inline] __bch2_trans_paths_to_text+0x2e0/0x4c0 fs/bcachefs/btree_iter.c:1460 bch2_trans_update_max_paths+0x193/0x360 fs/bcachefs/btree_iter.c:1494 btree_path_alloc fs/bcachefs/btree_iter.c:1591 [inline] btree_path_clone fs/bcachefs/btree_iter.c:1226 [inline] __bch2_btree_path_make_mut+0xa52/0xfc0 fs/bcachefs/btree_iter.c:1237 bch2_btree_path_make_mut fs/bcachefs/btree_iter.h:196 [inline] __bch2_btree_path_set_pos+0x43a/0x1840 fs/bcachefs/btree_iter.c:1252 bch2_btree_path_set_pos fs/bcachefs/btree_iter.h:211 [inline] bch2_btree_iter_peek_slot+0x10b8/0x22d0 fs/bcachefs/btree_iter.c:2469 page last free pid 28863 tgid 28861 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_folios+0x256/0xad0 mm/page_alloc.c:2536 folios_put_refs+0x487/0x6d0 mm/swap.c:1034 free_pages_and_swap_cache+0x40e/0x4b0 mm/swap_state.c:332 __tlb_batch_free_encoded_pages+0xf9/0x290 mm/mmu_gather.c:136 tlb_batch_pages_flush mm/mmu_gather.c:149 [inline] tlb_flush_mmu_free mm/mmu_gather.c:366 [inline] tlb_flush_mmu mm/mmu_gather.c:373 [inline] tlb_finish_mmu+0x168/0x7b0 mm/mmu_gather.c:465 unmap_region+0x342/0x420 mm/mmap.c:2315 do_vmi_align_munmap+0x11b3/0x1ad0 mm/mmap.c:2628 do_vmi_munmap+0x20b/0x450 mm/mmap.c:2696 __vm_munmap+0x145/0x3a0 mm/mmap.c:2972 __do_sys_munmap mm/mmap.c:2989 [inline] __se_sys_munmap mm/mmap.c:2986 [inline] __x64_sys_munmap+0x61/0x90 mm/mmap.c:2986 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888051fcb580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888051fcb600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888051fcb680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff888051fcb700: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888051fcb780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================