REISERFS (device loop3): Using r5 hash to sort names REISERFS (device loop3): 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 ffff8880472c3fd8 by task syz-executor.3/8845 CPU: 1 PID: 8845 Comm: syz-executor.3 Not tainted 6.1.0-next-20221220-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 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+0xc0/0xf0 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:0x7f7cf2c8c0d9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f7cf39d7168 EFLAGS: 00000246 ORIG_RAX: 000000000000004d RAX: ffffffffffffffda RBX: 00007f7cf2dabf80 RCX: 00007f7cf2c8c0d9 RDX: 0000000000000000 RSI: 0000000002007ffb RDI: 0000000000000006 RBP: 00007f7cf2ce7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc853f975f R14: 00007f7cf39d7300 R15: 0000000000022000 The buggy address belongs to the physical page: page:ffffea00011cb0c0 refcount:2 mapcount:0 mapping:ffff888144dadff8 index:0x213 pfn:0x472c3 memcg:ffff888035210000 aops:def_blk_aops ino:700003 flags: 0xfff00000002032(referenced|lru|active|private|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000002032 ffffea00014e8348 ffffea000153f748 ffff888144dadff8 raw: 0000000000000213 ffff888074af8cb0 00000002ffffffff ffff888035210000 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 8845, tgid 8843 (syz-executor.3), ts 580073516478, free_ts 579384063396 prep_new_page mm/page_alloc.c:2531 [inline] get_page_from_freelist+0x119e/0x2a80 mm/page_alloc.c:4283 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5549 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2282 folio_alloc+0x20/0x70 mm/mempolicy.c:2292 filemap_alloc_folio+0x3a3/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:359 [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+0x4d0/0x9e0 mm/page_alloc.c:1496 free_unref_page_prepare mm/page_alloc.c:3369 [inline] free_unref_page_list+0x176/0xcd0 mm/page_alloc.c:3510 release_pages+0xcb1/0x1330 mm/swap.c:1074 __pagevec_release+0x77/0xe0 mm/swap.c:1094 pagevec_release include/linux/pagevec.h:71 [inline] folio_batch_release include/linux/pagevec.h:135 [inline] shmem_undo_range+0x595/0x1340 mm/shmem.c:949 shmem_truncate_range mm/shmem.c:1044 [inline] shmem_evict_inode+0x32f/0xb60 mm/shmem.c:1159 evict+0x2ed/0x6b0 fs/inode.c:664 iput_final fs/inode.c:1747 [inline] iput fs/inode.c:1773 [inline] iput+0x52b/0x8c0 fs/inode.c:1759 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 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 Memory state around the buggy address: ffff8880472c3f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880472c3f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8880472c4000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8880472c4080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880472c4100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================