syzbot


KASAN: out-of-bounds Read in leaf_copy_items_entirely

Status: auto-obsoleted due to no activity on 2023/04/26 19:07
Subsystems: reiserfs
[Documentation on labels]
Reported-by: syzbot+569e87a1052b91ca8483@syzkaller.appspotmail.com
First crash: 417d, last: 417d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: out-of-bounds Read in leaf_copy_items_entirely origin:upstream C error 1 269d 269d 0/3 upstream: reported C repro on 2023/06/24 04:16
upstream KASAN: use-after-free Read in leaf_copy_items_entirely reiserfs 1 301d 301d 0/26 auto-obsoleted due to no activity on 2023/08/30 18:25

Sample crash report:
==================================================================
BUG: KASAN: out-of-bounds in leaf_copy_items_entirely+0x9e1/0xec0 fs/reiserfs/lbalance.c:384
Read of size 18446744073709545469 at addr ffff88805f15a000 by task syz-executor.1/18441

CPU: 1 PID: 18441 Comm: syz-executor.1 Not tainted 6.2.0-rc5-syzkaller-00047-g7c46948a6e9c #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1b1/0x290 lib/dump_stack.c:106
 print_address_description+0x74/0x340 mm/kasan/report.c:306
 print_report+0x107/0x1f0 mm/kasan/report.c:417
 kasan_report+0xcd/0x100 mm/kasan/report.c:517
 kasan_check_range+0x2a7/0x2e0 mm/kasan/generic.c:189
 memcpy+0x25/0x60 mm/kasan/shadow.c:65
 leaf_copy_items_entirely+0x9e1/0xec0 fs/reiserfs/lbalance.c:384
 leaf_copy_items fs/reiserfs/lbalance.c:610 [inline]
 leaf_move_items+0xe0d/0x1330 fs/reiserfs/lbalance.c:726
 balance_leaf_new_nodes_paste_whole fs/reiserfs/do_balan.c:1162 [inline]
 balance_leaf_new_nodes_paste fs/reiserfs/do_balan.c:1215 [inline]
 balance_leaf_new_nodes fs/reiserfs/do_balan.c:1246 [inline]
 balance_leaf+0x6420/0x123a0 fs/reiserfs/do_balan.c:1450
 do_balance+0x2d6/0x8d0 fs/reiserfs/do_balan.c:1888
 reiserfs_paste_into_item+0x740/0x880 fs/reiserfs/stree.c:2159
 reiserfs_get_block+0x223f/0x5180 fs/reiserfs/inode.c:1069
 __block_write_begin_int+0x54c/0x1a80 fs/buffer.c:1991
 reiserfs_write_begin+0x247/0x510 fs/reiserfs/inode.c:2775
 generic_cont_expand_simple+0x151/0x250 fs/buffer.c:2347
 reiserfs_setattr+0x642/0x1200 fs/reiserfs/inode.c:3305
 notify_change+0xe50/0x1100 fs/attr.c:482
 do_truncate+0x200/0x2f0 fs/open.c:65
 do_sys_ftruncate+0x2b0/0x350 fs/open.c:193
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f062208c0c9
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:00007f06187fe168 EFLAGS: 00000246 ORIG_RAX: 000000000000004d
RAX: ffffffffffffffda RBX: 00007f06221ac2c0 RCX: 00007f062208c0c9
RDX: 0000000000000000 RSI: 0000000002007ffb RDI: 0000000000000004
RBP: 00007f06220e7ae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffcdd80315f R14: 00007f06187fe300 R15: 0000000000022000
 </TASK>

The buggy address belongs to the physical page:
page:ffffea00017c5680 refcount:2 mapcount:0 mapping:ffff888140c9d4f8 index:0x213 pfn:0x5f15a
memcg:ffff888075f88000
aops:def_blk_aops ino:700001
flags: 0xfff0000000203a(referenced|dirty|lru|active|private|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff0000000203a ffffea0002089e08 ffffea0000ca5808 ffff888140c9d4f8
raw: 0000000000000213 ffff888076f56828 00000002ffffffff ffff888075f88000
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 18395, tgid 18393 (syz-executor.1), ts 721621433467, free_ts 721620241891
 prep_new_page mm/page_alloc.c:2531 [inline]
 get_page_from_freelist+0x742/0x7c0 mm/page_alloc.c:4283
 __alloc_pages+0x259/0x560 mm/page_alloc.c:5549
 folio_alloc+0x1a/0x50 mm/mempolicy.c:2296
 filemap_alloc_folio+0xca/0x2c0 mm/filemap.c:972
 __filemap_get_folio+0x892/0x1250 mm/filemap.c:1966
 pagecache_get_page+0x28/0x250 mm/folio-compat.c:98
 find_or_create_page include/linux/pagemap.h:612 [inline]
 grow_dev_page+0xba/0x920 fs/buffer.c:946
 grow_buffers fs/buffer.c:1011 [inline]
 __getblk_slow fs/buffer.c:1038 [inline]
 __getblk_gfp+0x16c/0x290 fs/buffer.c:1333
 sb_getblk include/linux/buffer_head.h:356 [inline]
 search_by_key+0x406/0x49c0 fs/reiserfs/stree.c:672
 reiserfs_read_locked_inode+0x223/0x2990 fs/reiserfs/inode.c:1549
 reiserfs_fill_super+0x128a/0x24a0 fs/reiserfs/super.c:2071
 mount_bdev+0x26c/0x3a0 fs/super.c:1359
 legacy_get_tree+0xea/0x180 fs/fs_context.c:610
 vfs_get_tree+0x88/0x270 fs/super.c:1489
 do_new_mount+0x289/0xad0 fs/namespace.c:3145
 do_mount fs/namespace.c:3488 [inline]
 __do_sys_mount fs/namespace.c:3697 [inline]
 __se_sys_mount+0x2d3/0x3c0 fs/namespace.c:3674
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+0x751/0x780 mm/page_alloc.c:1496
 free_unref_page_prepare mm/page_alloc.c:3369 [inline]
 free_unref_page_list+0xb2/0x830 mm/page_alloc.c:3510
 release_pages+0x233e/0x25e0 mm/swap.c:1076
 __pagevec_release+0x7d/0xf0 mm/swap.c:1096
 pagevec_release include/linux/pagevec.h:71 [inline]
 folio_batch_release include/linux/pagevec.h:135 [inline]
 shmem_undo_range+0x6d0/0x1fe0 mm/shmem.c:947
 shmem_truncate_range mm/shmem.c:1042 [inline]
 shmem_evict_inode+0x276/0xa10 mm/shmem.c:1151
 evict+0x2a4/0x620 fs/inode.c:664
 __dentry_kill+0x3b1/0x5b0 fs/dcache.c:607
 dentry_kill+0xbb/0x290
 dput+0x1f3/0x410 fs/dcache.c:913
 __fput+0x5e4/0x880 fs/file_table.c:328
 task_work_run+0x243/0x300 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0x124/0x150 kernel/entry/common.c:171
 exit_to_user_mode_prepare+0xb2/0x140 kernel/entry/common.c:203
 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
 syscall_exit_to_user_mode+0x26/0x60 kernel/entry/common.c:296
 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86

Memory state around the buggy address:
 ffff88805f159f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88805f159f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88805f15a000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                   ^
 ffff88805f15a080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88805f15a100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/01/26 19:07 upstream 7c46948a6e9c 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: out-of-bounds Read in leaf_copy_items_entirely
* Struck through repros no longer work on HEAD.