syzbot


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

Status: upstream: reported C repro on 2023/02/16 02:09
Subsystems: erofs
[Documentation on labels]
Reported-by: syzbot+2de482438dced842e676@syzkaller.appspotmail.com
First crash: 217d, last: 217d

Sample crash report:
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
 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: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
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/16 02:19 linux-4.19.y 3f8a27f9e27b 6be0f1f5 .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: slab-out-of-bounds Read in z_erofs_unzip_lz4
2023/02/16 02:08 linux-4.19.y 3f8a27f9e27b 6be0f1f5 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: slab-out-of-bounds Read in z_erofs_unzip_lz4
* Struck through repros no longer work on HEAD.