================================================================== BUG: KASAN: use-after-free in leaf_paste_in_buffer+0xa2d/0xc30 fs/reiserfs/lbalance.c:1043 Read of size 112 at addr ffff88804e985fd0 by task syz-executor.2/14533 CPU: 2 PID: 14533 Comm: syz-executor.2 Not tainted 6.1.0-syzkaller-02469-geb4511538191 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 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:284 [inline] print_report+0x15e/0x45d mm/kasan/report.c:395 kasan_report+0xbf/0x1f0 mm/kasan/report.c:495 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_paste_left_whole fs/reiserfs/do_balan.c:560 [inline] balance_leaf_paste_left fs/reiserfs/do_balan.c:594 [inline] balance_leaf_left fs/reiserfs/do_balan.c:613 [inline] balance_leaf+0x5558/0xde40 fs/reiserfs/do_balan.c:1409 do_balance+0x319/0x810 fs/reiserfs/do_balan.c:1888 reiserfs_paste_into_item+0x767/0x8e0 fs/reiserfs/stree.c:2159 reiserfs_get_block+0x1588/0x4150 fs/reiserfs/inode.c:1069 __block_write_begin_int+0x3bd/0x14b0 fs/buffer.c:1991 reiserfs_write_begin+0x36e/0xa60 fs/reiserfs/inode.c:2775 generic_perform_write+0x256/0x570 mm/filemap.c:3753 __generic_file_write_iter+0x2ae/0x4d0 mm/filemap.c:3881 generic_file_write_iter+0xe3/0x350 mm/filemap.c:3913 call_write_iter include/linux/fs.h:2219 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x9ed/0xdd0 fs/read_write.c:584 ksys_write+0x12b/0x250 fs/read_write.c:637 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 RIP: 0023:0xf7f6f549 Code: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f7f6a5cc EFLAGS: 00000296 ORIG_RAX: 0000000000000004 RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 0000000020000000 RDX: 000000000208e24b RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000296 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 The buggy address belongs to the physical page: page:ffffea00013a6140 refcount:3 mapcount:0 mapping:ffff8880405feaf8 index:0x2e0 pfn:0x4e985 memcg:ffff88806bec6000 aops:def_blk_aops ino:700002 flags: 0x4fff00000002022(referenced|active|private|node=1|zone=1|lastcpupid=0x7ff) raw: 04fff00000002022 0000000000000000 dead000000000122 ffff8880405feaf8 raw: 00000000000002e0 ffff88807037b3a0 00000003ffffffff ffff88806bec6000 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 14541, tgid 14532 (syz-executor.2), ts 921402243482, free_ts 921034983285 prep_new_page mm/page_alloc.c:2539 [inline] get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4291 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5558 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2285 folio_alloc+0x20/0x70 mm/mempolicy.c:2295 filemap_alloc_folio+0x362/0x450 mm/filemap.c:971 __filemap_get_folio+0x32c/0xd90 mm/filemap.c:1965 pagecache_get_page+0x32/0x280 mm/folio-compat.c:110 find_or_create_page include/linux/pagemap.h:613 [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] get_empty_nodes+0x519/0x7d0 fs/reiserfs/fix_node.c:890 fix_nodes+0x1c21/0x8660 fs/reiserfs/fix_node.c:2662 reiserfs_insert_item+0x7fc/0x11b0 fs/reiserfs/stree.c:2240 reiserfs_new_inode+0xe55/0x2190 fs/reiserfs/inode.c:2054 reiserfs_create+0x351/0x730 fs/reiserfs/namei.c:668 lookup_open.isra.0+0xf05/0x12a0 fs/namei.c:3413 open_last_lookups fs/namei.c:3481 [inline] path_openat+0x996/0x2860 fs/namei.c:3711 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1459 [inline] free_pcp_prepare+0x65c/0xd90 mm/page_alloc.c:1509 free_unref_page_prepare mm/page_alloc.c:3387 [inline] free_unref_page_list+0x176/0xc40 mm/page_alloc.c:3529 release_pages+0xc8a/0x1360 mm/swap.c:1055 __pagevec_release+0x7b/0x110 mm/swap.c:1075 pagevec_release include/linux/pagevec.h:71 [inline] folio_batch_release include/linux/pagevec.h:135 [inline] shmem_undo_range+0x63a/0x1360 mm/shmem.c:946 shmem_truncate_range mm/shmem.c:1045 [inline] shmem_evict_inode+0x3ca/0xc30 mm/shmem.c:1154 evict+0x2ed/0x6b0 fs/inode.c:664 iput_final fs/inode.c:1747 [inline] iput.part.0+0x59b/0x880 fs/inode.c:1773 iput+0x5c/0x80 fs/inode.c:1763 dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:401 __dentry_kill+0x3c0/0x640 fs/dcache.c:607 dentry_kill fs/dcache.c:733 [inline] dput+0x80a/0xdb0 fs/dcache.c:913 __fput+0x3cc/0xa90 fs/file_table.c:328 task_work_run+0x16f/0x270 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x23c/0x250 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:296 Memory state around the buggy address: ffff88804e985f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88804e985f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88804e986000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88804e986080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88804e986100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== ---------------- Code disassembly (best guess): 0: 03 74 c0 01 add 0x1(%rax,%rax,8),%esi 4: 10 05 03 74 b8 01 adc %al,0x1b87403(%rip) # 0x1b8740d a: 10 06 adc %al,(%rsi) c: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 10: 10 07 adc %al,(%rdi) 12: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi 16: 10 08 adc %cl,(%rax) 18: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1c: 00 00 add %al,(%rax) 1e: 00 00 add %al,(%rax) 20: 00 51 52 add %dl,0x52(%rcx) 23: 55 push %rbp 24: 89 e5 mov %esp,%ebp 26: 0f 34 sysenter 28: cd 80 int $0x80 * 2a: 5d pop %rbp <-- trapping instruction 2b: 5a pop %rdx 2c: 59 pop %rcx 2d: c3 retq 2e: 90 nop 2f: 90 nop 30: 90 nop 31: 90 nop 32: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 39: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi