================================================================== 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+0x149/0x180 fs/bcachefs/varint.c:114 Read of size 8 at addr ffff88806a507886 by task syz-executor.1/6662 CPU: 0 PID: 6662 Comm: syz-executor.1 Not tainted 6.9.0-rc6-next-20240503-syzkaller #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 get_unaligned_le64 include/asm-generic/unaligned.h:37 [inline] bch2_varint_decode_fast+0x149/0x180 fs/bcachefs/varint.c:114 bch2_inode_unpack_v3 fs/bcachefs/inode.c:270 [inline] bch2_inode_unpack+0x7d2/0x2960 fs/bcachefs/inode.c:323 __bch2_inode_invalid+0x14e/0x5a0 fs/bcachefs/inode.c:449 __bch2_trans_commit+0x9c3/0x8a10 fs/bcachefs/btree_trans_commit.c:1033 bch2_trans_commit fs/bcachefs/btree_update.h:170 [inline] bch2_extent_update+0x4c0/0xbb0 fs/bcachefs/io_write.c:318 bch2_write_index_default fs/bcachefs/io_write.c:366 [inline] __bch2_write_index+0xee9/0x2190 fs/bcachefs/io_write.c:519 bch2_write_data_inline fs/bcachefs/io_write.c:1549 [inline] bch2_write+0xf20/0x1640 fs/bcachefs/io_write.c:1617 closure_queue include/linux/closure.h:257 [inline] closure_call include/linux/closure.h:390 [inline] bch2_writepage_do_io fs/bcachefs/fs-io-buffered.c:460 [inline] bch2_writepages+0x27d/0x380 fs/bcachefs/fs-io-buffered.c:652 do_writepages+0x359/0x870 mm/page-writeback.c:2633 filemap_fdatawrite_wbc+0x125/0x180 mm/filemap.c:397 __filemap_fdatawrite_range mm/filemap.c:430 [inline] filemap_write_and_wait_range+0x198/0x290 mm/filemap.c:685 bch2_symlink+0x1d8/0x2e0 fs/bcachefs/fs.c:619 vfs_symlink+0x137/0x2e0 fs/namei.c:4489 do_symlinkat+0x222/0x3a0 fs/namei.c:4515 __do_sys_symlink fs/namei.c:4536 [inline] __se_sys_symlink fs/namei.c:4534 [inline] __x64_sys_symlink+0x7e/0x90 fs/namei.c:4534 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:0x7f00d5e7dca9 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:00007f00d6cac0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000058 RAX: ffffffffffffffda RBX: 00007f00d5fabf80 RCX: 00007f00d5e7dca9 RDX: 0000000000000000 RSI: 0000000020000100 RDI: 0000000020000340 RBP: 00007f00d5ec947e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f00d5fabf80 R15: 00007ffc6b4bed18 Allocated by task 6662: 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] __do_kmalloc_node mm/slub.c:4121 [inline] kmalloc_node_track_caller_noprof+0x22a/0x450 mm/slub.c:4141 __do_krealloc mm/slab_common.c:1183 [inline] krealloc_noprof+0x7d/0x120 mm/slab_common.c:1216 __bch2_trans_kmalloc+0x202/0xb50 fs/bcachefs/btree_iter.c:2959 bch2_trans_kmalloc_nomemzero fs/bcachefs/btree_iter.h:540 [inline] __bch2_bkey_make_mut_noupdate fs/bcachefs/btree_update.h:225 [inline] __bch2_bkey_get_mut_noupdate fs/bcachefs/btree_update.h:284 [inline] bch2_bkey_get_mut_noupdate fs/bcachefs/btree_update.h:295 [inline] bch2_extent_update_i_size_sectors+0xdc2/0x1310 fs/bcachefs/io_write.c:219 bch2_extent_update+0x40a/0xbb0 fs/bcachefs/io_write.c:314 bch2_write_index_default fs/bcachefs/io_write.c:366 [inline] __bch2_write_index+0xee9/0x2190 fs/bcachefs/io_write.c:519 bch2_write_data_inline fs/bcachefs/io_write.c:1549 [inline] bch2_write+0xf20/0x1640 fs/bcachefs/io_write.c:1617 closure_queue include/linux/closure.h:257 [inline] closure_call include/linux/closure.h:390 [inline] bch2_writepage_do_io fs/bcachefs/fs-io-buffered.c:460 [inline] bch2_writepages+0x27d/0x380 fs/bcachefs/fs-io-buffered.c:652 do_writepages+0x359/0x870 mm/page-writeback.c:2633 filemap_fdatawrite_wbc+0x125/0x180 mm/filemap.c:397 __filemap_fdatawrite_range mm/filemap.c:430 [inline] filemap_write_and_wait_range+0x198/0x290 mm/filemap.c:685 bch2_symlink+0x1d8/0x2e0 fs/bcachefs/fs.c:619 vfs_symlink+0x137/0x2e0 fs/namei.c:4489 do_symlinkat+0x222/0x3a0 fs/namei.c:4515 __do_sys_symlink fs/namei.c:4536 [inline] __se_sys_symlink fs/namei.c:4534 [inline] __x64_sys_symlink+0x7e/0x90 fs/namei.c:4534 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 The buggy address belongs to the object at ffff88806a507800 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 6 bytes to the right of allocated 128-byte region [ffff88806a507800, ffff88806a507880) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6a507 ksm flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffefff(slab) raw: 00fff00000000000 ffff888015041a00 ffffea0001a95bc0 dead000000000003 raw: 0000000000000000 0000000080100010 00000001ffffefff 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 0x152cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 5409, tgid 5409 (syz-executor.2), ts 73350834773, free_ts 73292669752 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_node_noprof include/linux/gfp.h:244 [inline] alloc_pages_node_noprof include/linux/gfp.h:271 [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] kmalloc_trace_noprof+0x1d5/0x2c0 mm/slub.c:4147 kmalloc_noprof include/linux/slab.h:660 [inline] kzalloc_noprof include/linux/slab.h:778 [inline] kcov_open+0x25/0x90 kernel/kcov.c:512 open_proxy_open+0x2c5/0x480 fs/debugfs/file.c:289 do_dentry_open+0x95a/0x1720 fs/open.c:955 do_open fs/namei.c:3650 [inline] path_openat+0x289f/0x3280 fs/namei.c:3807 do_filp_open+0x235/0x490 fs/namei.c:3834 do_sys_openat2+0x13e/0x1d0 fs/open.c:1405 do_sys_open fs/open.c:1420 [inline] __do_sys_openat fs/open.c:1436 [inline] __se_sys_openat fs/open.c:1431 [inline] __x64_sys_openat+0x247/0x2a0 fs/open.c:1431 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 5111 tgid 5111 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1088 [inline] free_unref_folios+0xf23/0x19e0 mm/page_alloc.c:2650 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 exit_mm+0x220/0x310 kernel/exit.c:565 do_exit+0x9aa/0x27e0 kernel/exit.c:861 do_group_exit+0x207/0x2c0 kernel/exit.c:1023 __do_sys_exit_group kernel/exit.c:1034 [inline] __se_sys_exit_group kernel/exit.c:1032 [inline] __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1032 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 Memory state around the buggy address: ffff88806a507780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88806a507800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88806a507880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff88806a507900: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806a507980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================