================================================================== 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 ffff8880424f8f7f by task syz-executor.3/12500 CPU: 1 PID: 12500 Comm: syz-executor.3 Not tainted 6.9.0-rc7-syzkaller-00012-gdccb07f2914c #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 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+0x1cb/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+0x1a3/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+0x3e8/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:0x7f9ec587dd69 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:00007f9ec661c0c8 EFLAGS: 00000246 ORIG_RAX: 000000000000010a RAX: ffffffffffffffda RBX: 00007f9ec59abf80 RCX: 00007f9ec587dd69 RDX: 0000000020000200 RSI: ffffffffffffff9c RDI: 00000000200001c0 RBP: 00007f9ec58ca49e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f9ec59abf80 R15: 00007ffd96f3c2c8 Allocated by task 12500: 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+0x1a3/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+0x3e8/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 ffff8880424f8f00 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 127 bytes inside of allocated 128-byte region [ffff8880424f8f00, ffff8880424f8f80) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x424f8 flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000800 ffff8880150428c0 ffffea0000a64680 dead000000000002 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 4685, tgid -1232453302 (udevd), ts 4685, free_ts 54552345658 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] kmalloc_trace+0x306/0x340 mm/slub.c:3998 kmalloc include/linux/slab.h:628 [inline] kzalloc include/linux/slab.h:749 [inline] kernfs_get_open_node fs/kernfs/file.c:525 [inline] kernfs_fop_open+0xa8e/0xdb0 fs/kernfs/file.c:700 do_dentry_open+0x8da/0x18c0 fs/open.c:955 do_open fs/namei.c:3642 [inline] path_openat+0x1dfb/0x2990 fs/namei.c:3799 do_filp_open+0x1dc/0x430 fs/namei.c:3826 do_sys_openat2+0x17a/0x1e0 fs/open.c:1406 do_sys_open fs/open.c:1421 [inline] __do_sys_openat fs/open.c:1437 [inline] __se_sys_openat fs/open.c:1432 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1432 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 page last free pid 5197 tgid 5197 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_page+0x33/0x3c0 mm/page_alloc.c:2487 vfree+0x181/0x7a0 mm/vmalloc.c:3340 kcov_put kernel/kcov.c:429 [inline] kcov_put+0x2a/0x40 kernel/kcov.c:425 kcov_close+0x10/0x20 kernel/kcov.c:525 __fput+0x270/0xb80 fs/file_table.c:422 task_work_run+0x14e/0x250 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xa7d/0x2c10 kernel/exit.c:878 do_group_exit+0xd3/0x2a0 kernel/exit.c:1027 __do_sys_exit_group kernel/exit.c:1038 [inline] __se_sys_exit_group kernel/exit.c:1036 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1036 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: ffff8880424f8e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880424f8f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8880424f8f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff8880424f9000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880424f9080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================