REISERFS (device loop0): Using r5 hash to sort names REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage. ================================================================== BUG: KASAN: use-after-free in leaf_paste_in_buffer+0xa2d/0xc30 fs/reiserfs/lbalance.c:1043 Read of size 104 at addr ffff888071e4bfd8 by task syz-executor314/5067 CPU: 1 PID: 5067 Comm: syz-executor314 Not tainted 6.2.0-rc6-syzkaller-00050-g9f266ccaa2f5 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:306 [inline] print_report+0x15e/0x45d mm/kasan/report.c:417 kasan_report+0xbf/0x1f0 mm/kasan/report.c:517 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x141/0x190 mm/kasan/generic.c:189 memcpy+0x24/0x60 mm/kasan/shadow.c:65 leaf_paste_in_buffer+0xa2d/0xc30 fs/reiserfs/lbalance.c:1043 leaf_copy_dir_entries.isra.0+0x7f3/0x980 fs/reiserfs/lbalance.c:108 leaf_copy_boundary_item fs/reiserfs/lbalance.c:168 [inline] leaf_copy_items fs/reiserfs/lbalance.c:551 [inline] leaf_move_items+0x16d2/0x3ad0 fs/reiserfs/lbalance.c:726 leaf_shift_left+0xa4/0x380 fs/reiserfs/lbalance.c:750 balance_leaf_left fs/reiserfs/do_balan.c:616 [inline] balance_leaf+0x3337/0xde40 fs/reiserfs/do_balan.c:1409 do_balance+0x319/0x810 fs/reiserfs/do_balan.c:1888 reiserfs_insert_item+0xdb2/0x11b0 fs/reiserfs/stree.c:2261 reiserfs_get_block+0x1b23/0x4150 fs/reiserfs/inode.c:868 __block_write_begin_int+0x3bd/0x14b0 fs/buffer.c:1991 reiserfs_write_begin+0x36e/0xa60 fs/reiserfs/inode.c:2775 generic_cont_expand_simple+0x117/0x1f0 fs/buffer.c:2347 reiserfs_setattr+0x39a/0x1460 fs/reiserfs/inode.c:3305 notify_change+0xca7/0x1420 fs/attr.c:482 do_truncate+0x143/0x200 fs/open.c:65 do_sys_ftruncate+0x51f/0x710 fs/open.c:193 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f4ed201fa09 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 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 c0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffe38d5a2d8 EFLAGS: 00000246 ORIG_RAX: 000000000000004d RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007f4ed201fa09 RDX: 00007f4ed201fa09 RSI: 0000000002007ffb RDI: 0000000000000006 RBP: 0000000000000000 R08: 00007ffe38d5a300 R09: 00007ffe38d5a300 R10: 00007ffe38d5a300 R11: 0000000000000246 R12: 00007ffe38d5a2fc R13: 00007ffe38d5a330 R14: 00007ffe38d5a310 R15: 0000000000000001 The buggy address belongs to the physical page: page:ffffea0001c792c0 refcount:2 mapcount:0 mapping:ffff888144c49df8 index:0x213 pfn:0x71e4b memcg:ffff88813ff40000 aops:def_blk_aops ino:700000 flags: 0xfff00000002032(referenced|lru|active|private|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000002032 ffffea0001c79288 ffffea00006fec48 ffff888144c49df8 raw: 0000000000000213 ffff8880728d5658 00000002ffffffff ffff88813ff40000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Movable, gfp_mask 0x148c48(GFP_NOFS|__GFP_NOFAIL|__GFP_COMP|__GFP_HARDWALL|__GFP_MOVABLE), pid 5067, tgid 5067 (syz-executor314), ts 42577079040, free_ts 9666845253 prep_new_page mm/page_alloc.c:2531 [inline] get_page_from_freelist+0x119c/0x2ce0 mm/page_alloc.c:4283 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5549 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2286 folio_alloc+0x20/0x70 mm/mempolicy.c:2296 filemap_alloc_folio+0x362/0x450 mm/filemap.c:972 __filemap_get_folio+0x32c/0xd80 mm/filemap.c:1966 pagecache_get_page+0x2e/0x280 mm/folio-compat.c:98 find_or_create_page include/linux/pagemap.h:612 [inline] grow_dev_page fs/buffer.c:946 [inline] grow_buffers fs/buffer.c:1011 [inline] __getblk_slow+0x1f4/0x1030 fs/buffer.c:1038 __getblk_gfp+0x72/0x80 fs/buffer.c:1333 sb_getblk include/linux/buffer_head.h:356 [inline] search_by_key+0x3ac/0x3bf0 fs/reiserfs/stree.c:672 reiserfs_read_locked_inode+0x158/0x2160 fs/reiserfs/inode.c:1549 reiserfs_fill_super+0x1273/0x2e90 fs/reiserfs/super.c:2071 mount_bdev+0x351/0x410 fs/super.c:1359 legacy_get_tree+0x109/0x220 fs/fs_context.c:610 vfs_get_tree+0x8d/0x2f0 fs/super.c:1489 do_new_mount fs/namespace.c:3145 [inline] path_mount+0x132a/0x1e20 fs/namespace.c:3475 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1446 [inline] free_pcp_prepare+0x65c/0xc00 mm/page_alloc.c:1496 free_unref_page_prepare mm/page_alloc.c:3369 [inline] free_unref_page+0x1d/0x490 mm/page_alloc.c:3464 free_contig_range+0xb5/0x180 mm/page_alloc.c:9485 destroy_args+0xa8/0x64c mm/debug_vm_pgtable.c:998 debug_vm_pgtable+0x28de/0x296f mm/debug_vm_pgtable.c:1318 do_one_initcall+0x141/0x790 init/main.c:1306 do_initcall_level init/main.c:1379 [inline] do_initcalls init/main.c:1395 [inline] do_basic_setup init/main.c:1414 [inline] kernel_init_freeable+0x6f9/0x782 init/main.c:1634 kernel_init+0x1e/0x1d0 init/main.c:1522 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 Memory state around the buggy address: ffff888071e4bf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888071e4bf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888071e4c000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888071e4c080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888071e4c100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================