KASAN: out-of-bounds Read in leaf_paste_in_buffer

13 views
Skip to first unread message

syzbot

unread,
Nov 26, 2022, 7:33:33 PM11/26/22
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3f8a27f9e27b Linux 4.19.211
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13dc0973880000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=684b490648932546ad60
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=178ef275880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14ed363d880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/98c0bdb4abb3/disk-3f8a27f9.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ea228ff02669/vmlinux-3f8a27f9.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/00c3de6a8dae/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+684b49...@syzkaller.appspotmail.com

REISERFS (device loop0): journal params: device loop0, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop0): checking transaction log (loop0)
REISERFS (device loop0): Using r5 hash to sort names
REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.
==================================================================
BUG: KASAN: out-of-bounds in memcpy include/linux/string.h:377 [inline]
BUG: KASAN: out-of-bounds in leaf_paste_in_buffer+0xa27/0xc20 fs/reiserfs/lbalance.c:1043
Read of size 80 at addr ffff88808af42fe0 by task syz-executor400/8105

CPU: 1 PID: 8105 Comm: syz-executor400 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
kasan_report+0x8f/0xa0 mm/kasan/report.c:412
memcpy+0x20/0x50 mm/kasan/kasan.c:302
memcpy include/linux/string.h:377 [inline]
leaf_paste_in_buffer+0xa27/0xc20 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+0x17f6/0x3b60 fs/reiserfs/lbalance.c:726
leaf_shift_left+0xa0/0x380 fs/reiserfs/lbalance.c:750
balance_leaf_left fs/reiserfs/do_balan.c:622 [inline]
balance_leaf+0x2fb8/0xca70 fs/reiserfs/do_balan.c:1420
do_balance+0x30a/0x760 fs/reiserfs/do_balan.c:1899
reiserfs_insert_item+0xbf3/0x1010 fs/reiserfs/stree.c:2271
reiserfs_get_block+0x122b/0x3e40 fs/reiserfs/inode.c:876
__block_write_begin_int+0x46c/0x17b0 fs/buffer.c:1978
reiserfs_write_begin+0x39f/0xa10 fs/reiserfs/inode.c:2794
generic_perform_write+0x1f8/0x4d0 mm/filemap.c:3170
__generic_file_write_iter+0x24b/0x610 mm/filemap.c:3295
generic_file_write_iter+0x3f8/0x730 mm/filemap.c:3323
call_write_iter include/linux/fs.h:1821 [inline]
new_sync_write fs/read_write.c:474 [inline]
__vfs_write+0x51b/0x770 fs/read_write.c:487
__kernel_write+0x109/0x370 fs/read_write.c:506
dump_emit+0x183/0x300 fs/coredump.c:801
elf_core_dump+0x2914/0x4c10 fs/binfmt_elf.c:2335
do_coredump+0x1d4e/0x2d60 fs/coredump.c:765
get_signal+0xed9/0x1f70 kernel/signal.c:2583
do_signal+0x8f/0x1670 arch/x86/kernel/signal.c:799
exit_to_usermode_loop+0x204/0x2a0 arch/x86/entry/common.c:163
prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7fa5c6cf8819
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 01 18 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:00007fffe032b488 EFLAGS: 00000246 ORIG_RAX: 000000000000004d
RAX: ffffffffffffffe5 RBX: 0000000000000003 RCX: 00007fa5c6cf8819
RDX: 00007fa5c6cf8819 RSI: 000001fffffff000 RDI: 0000000000000006
RBP: 00007fffe032b4f0 R08: 00000000000f4240 R09: 00000000000f4240
R10: 00000000000f4240 R11: 0000000000000246 R12: 0000000000000000
R13: 00000000000f4240 R14: 00007fffe032b4b4 R15: 00007fffe032b4c0

The buggy address belongs to the page:
page:ffffea00022bd080 count:2 mapcount:0 mapping:ffff8880b1adeae0 index:0x213
flags: 0xfff00000001064(referenced|lru|active|private)
raw: 00fff00000001064 ffffea00022bd048 ffffea00022baa88 ffff8880b1adeae0
raw: 0000000000000213 ffff88808db6d7e0 00000002ffffffff ffff8880b59f68c0
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff8880b59f68c0

Memory state around the buggy address:
ffff88808af42f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88808af42f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88808af43000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
ffff88808af43080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88808af43100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Dec 3, 2022, 4:39:36 PM12/3/22
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 179ef7fe8677 Linux 4.14.300
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1413944d880000
kernel config: https://syzkaller.appspot.com/x/.config?x=aa85f51ec321d5a9
dashboard link: https://syzkaller.appspot.com/bug?extid=3c1eef603f3e794cdae9
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11974a1d880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=130527bd880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/d311ef57b59a/disk-179ef7fe.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/25bf5d729f69/vmlinux-179ef7fe.xz
kernel image: https://storage.googleapis.com/syzbot-assets/db9b96571e69/bzImage-179ef7fe.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/47bfea2f2b20/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+3c1eef...@syzkaller.appspotmail.com

REISERFS (device loop0): journal params: device loop0, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop0): checking transaction log (loop0)
REISERFS (device loop0): Using r5 hash to sort names
REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.
==================================================================
BUG: KASAN: out-of-bounds in memcpy include/linux/string.h:376 [inline]
BUG: KASAN: out-of-bounds in leaf_paste_in_buffer+0x981/0xb80 fs/reiserfs/lbalance.c:1043
Read of size 80 at addr ffff88808b242fe0 by task syz-executor211/8196

CPU: 1 PID: 8196 Comm: syz-executor211 Not tainted 4.14.300-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x281 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
kasan_report+0x6f/0x80 mm/kasan/report.c:409
memcpy+0x20/0x50 mm/kasan/kasan.c:302
memcpy include/linux/string.h:376 [inline]
leaf_paste_in_buffer+0x981/0xb80 fs/reiserfs/lbalance.c:1043
leaf_copy_dir_entries.isra.0+0x770/0x8f0 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+0x147e/0x3440 fs/reiserfs/lbalance.c:726
leaf_shift_left+0x9f/0x360 fs/reiserfs/lbalance.c:750
balance_leaf_left fs/reiserfs/do_balan.c:622 [inline]
balance_leaf+0x2b73/0xba30 fs/reiserfs/do_balan.c:1420
do_balance+0x282/0x630 fs/reiserfs/do_balan.c:1899
reiserfs_insert_item+0x95b/0xc70 fs/reiserfs/stree.c:2271
reiserfs_get_block+0xb54/0x36b0 fs/reiserfs/inode.c:876
__block_write_begin_int+0x35c/0x11d0 fs/buffer.c:2038
reiserfs_write_begin+0x2e3/0x8a0 fs/reiserfs/inode.c:2793
generic_perform_write+0x1d5/0x430 mm/filemap.c:3055
__generic_file_write_iter+0x227/0x590 mm/filemap.c:3180
generic_file_write_iter+0x36f/0x650 mm/filemap.c:3208
call_write_iter include/linux/fs.h:1780 [inline]
new_sync_write fs/read_write.c:469 [inline]
__vfs_write+0x44c/0x630 fs/read_write.c:482
__kernel_write+0xf5/0x330 fs/read_write.c:501
dump_emit+0x153/0x280 fs/coredump.c:806
elf_core_dump+0x2672/0x4410 fs/binfmt_elf.c:2308
do_coredump+0x1a43/0x29f0 fs/coredump.c:770
get_signal+0xc9f/0x1ca0 kernel/signal.c:2406
do_signal+0x7c/0x1550 arch/x86/kernel/signal.c:792
exit_to_usermode_loop+0x160/0x200 arch/x86/entry/common.c:160
prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x5e/0xd3

The buggy address belongs to the page:
page:ffffea00022c9080 count:2 mapcount:0 mapping:ffff8880a4c13b68 index:0x213
flags: 0xfff00000001064(referenced|lru|active|private)
raw: 00fff00000001064 ffff8880a4c13b68 0000000000000213 00000002ffffffff
raw: ffffea00022c9060 ffffea00022c2f20 ffff88808abf3348 ffff88823b3288c0
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff88823b3288c0

Memory state around the buggy address:
ffff88808b242f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88808b242f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88808b243000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
ffff88808b243080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88808b243100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Reply all
Reply to author
Forward
0 new messages