KASAN: slab-out-of-bounds Read in z_erofs_unzip_lz4

5 views
Skip to first unread message

syzbot

unread,
Feb 15, 2023, 9:09:45 PM2/15/23
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=10434368c80000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=2de482438dced842e676
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)

Unfortunately, I don't have any reproducer for this issue yet.

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

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

erofs: read_super, device -> /dev/loop3
erofs: options ->
erofs: root inode @ nid 36
erofs: mounted on /dev/loop3 with opts: .
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:377 [inline]
BUG: KASAN: slab-out-of-bounds in customized_lz4_decompress_safe_partial drivers/staging/erofs/unzip_lz4.c:107 [inline]
BUG: KASAN: slab-out-of-bounds in z_erofs_unzip_lz4+0x778/0xa10 drivers/staging/erofs/unzip_lz4.c:232
Read of size 1790 at addr ffff8880b2d42ff1 by task syz-executor.3/12073

CPU: 1 PID: 12073 Comm: syz-executor.3 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
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
erofs: read_super, device -> /dev/loop2
kasan_report+0x8f/0xa0 mm/kasan/report.c:412
memcpy+0x20/0x50 mm/kasan/kasan.c:302
memcpy include/linux/string.h:377 [inline]
customized_lz4_decompress_safe_partial drivers/staging/erofs/unzip_lz4.c:107 [inline]
z_erofs_unzip_lz4+0x778/0xa10 drivers/staging/erofs/unzip_lz4.c:232
z_erofs_vle_unzip_fast_percpu+0xff/0x530 drivers/staging/erofs/unzip_vle_lz4.c:130
z_erofs_vle_unzip.isra.0+0x11fb/0x2460 drivers/staging/erofs/unzip_vle.c:960
erofs: options ->
erofs: unidentified requirements 1, please upgrade kernel version
z_erofs_vle_unzip_all drivers/staging/erofs/unzip_vle.c:1056 [inline]
z_erofs_submit_and_unzip.isra.0+0x10dc/0x1930 drivers/staging/erofs/unzip_vle.c:1339
__z_erofs_vle_normalaccess_readpages drivers/staging/erofs/unzip_vle.c:1420 [inline]
z_erofs_vle_normalaccess_readpages+0x6b0/0xa80 drivers/staging/erofs/unzip_vle.c:1435
read_pages.isra.0+0xf6/0x5d0 mm/readahead.c:123
__do_page_cache_readahead+0x5c6/0x6c0 mm/readahead.c:211
ra_submit mm/internal.h:66 [inline]
ondemand_readahead.isra.0+0x575/0xd40 mm/readahead.c:493
page_cache_sync_readahead mm/readahead.c:528 [inline]
page_cache_sync_readahead+0x275/0x520 mm/readahead.c:510
generic_file_buffered_read mm/filemap.c:2115 [inline]
generic_file_read_iter+0x1497/0x2b60 mm/filemap.c:2385
call_read_iter include/linux/fs.h:1815 [inline]
new_sync_read fs/read_write.c:406 [inline]
__vfs_read+0x518/0x750 fs/read_write.c:418
vfs_read+0x194/0x3c0 fs/read_write.c:452
kernel_read+0xa6/0x110 fs/read_write.c:431
prepare_binprm+0x64f/0x890 fs/exec.c:1596
__do_execve_file+0xfb8/0x2360 fs/exec.c:1815
do_execveat_common fs/exec.c:1879 [inline]
do_execve+0x35/0x50 fs/exec.c:1896
__do_sys_execve fs/exec.c:1977 [inline]
__se_sys_execve fs/exec.c:1972 [inline]
__x64_sys_execve+0x7c/0xa0 fs/exec.c:1972
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f5b16b500f9
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:00007f5b150c2168 EFLAGS: 00000246 ORIG_RAX: 000000000000003b
RAX: ffffffffffffffda RBX: 00007f5b16c6ff80 RCX: 00007f5b16b500f9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000000
RBP: 00007f5b16babae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffcc38964ff R14: 00007f5b150c2300 R15: 0000000000022000

The buggy address belongs to the page:
page:ffffea0002cb5080 count:3 mapcount:0 mapping:ffff888048c4db20 index:0x1
flags: 0xfff00000001008(uptodate|private)
raw: 00fff00000001008 dead000000000100 dead000000000200 ffff888048c4db20
raw: 0000000000000001 ffff888048c7cee0 00000003ffffffff ffff8880b59f68c0
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff8880b59f68c0

Memory state around the buggy address:
ffff8880b2d42f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880b2d42f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880b2d43000: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
^
ffff8880b2d43080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880b2d43100: 00 00 00 00 00 00 00 00 05 fc fc fc fc fc fc fc
==================================================================


---
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

unread,
Feb 15, 2023, 9:19:53 PM2/15/23
to syzkaller...@googlegroups.com
syzbot has found a reproducer for 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=1231f878c80000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=2de482438dced842e676
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16642d5f480000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17b950c8c80000
mounted in repro: https://storage.googleapis.com/syzbot-assets/2dbe1a60df25/mount_0.gz

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

erofs: read_super, device -> /dev/loop0
erofs: options ->
erofs: root inode @ nid 36
erofs: mounted on /dev/loop0 with opts: .
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:377 [inline]
BUG: KASAN: slab-out-of-bounds in customized_lz4_decompress_safe_partial drivers/staging/erofs/unzip_lz4.c:107 [inline]
BUG: KASAN: slab-out-of-bounds in z_erofs_unzip_lz4+0x778/0xa10 drivers/staging/erofs/unzip_lz4.c:232
Read of size 1790 at addr ffff8880a93d8ff1 by task syz-executor152/8097

CPU: 0 PID: 8097 Comm: syz-executor152 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
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]
customized_lz4_decompress_safe_partial drivers/staging/erofs/unzip_lz4.c:107 [inline]
z_erofs_unzip_lz4+0x778/0xa10 drivers/staging/erofs/unzip_lz4.c:232
z_erofs_vle_unzip_fast_percpu+0xff/0x530 drivers/staging/erofs/unzip_vle_lz4.c:130
z_erofs_vle_unzip.isra.0+0x11fb/0x2460 drivers/staging/erofs/unzip_vle.c:960
RIP: 0033:0x7fa1677da659
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 14 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:00007ffdf5085378 EFLAGS: 00000246 ORIG_RAX: 000000000000003b
RAX: ffffffffffffffda RBX: 00007ffdf50853b8 RCX: 00007fa1677da659
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 00007ffdf5085240 R11: 0000000000000246 R12: 00007ffdf50853b0
R13: 0000000000000000 R14: 431bde82d7b634db R15: 0000000000000000

The buggy address belongs to the page:
page:ffffea0002a4f600 count:3 mapcount:0 mapping:ffff88808ac78b20 index:0x1
flags: 0xfff00000001008(uptodate|private)
raw: 00fff00000001008 dead000000000100 dead000000000200 ffff88808ac78b20
raw: 0000000000000001 ffff88808ac79ee0 00000003ffffffff ffff8880b59f68c0
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff8880b59f68c0

Memory state around the buggy address:
ffff8880a93d9380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880a93d9400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880a93d9480: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc
^
ffff8880a93d9500: fc fc fc fc fc fc 00 00 00 00 00 00 00 00 00 00
ffff8880a93d9580: 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