Re: [syzbot] KASAN: use-after-free Read in z_erofs_transform_plain

From: Gao Xiang
Date: Mon Dec 05 2022 - 04:30:47 EST


On Mon, Dec 05, 2022 at 12:13:47AM -0800, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 97ee9d1c1696 Merge tag 'block-6.1-2022-12-02' of git://git..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=1786b2f5880000
> kernel config: https://syzkaller.appspot.com/x/.config?x=2325e409a9a893e1
> dashboard link: https://syzkaller.appspot.com/bug?extid=2ae90e873e97f1faf6f2
> compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=115e5c47880000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=170fa3d5880000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/6a6a9ff34dfa/disk-97ee9d1c.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/2a01a4182c2b/vmlinux-97ee9d1c.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/4371158e8c25/bzImage-97ee9d1c.xz
> mounted in repro: https://storage.googleapis.com/syzbot-assets/22dcea976d97/mount_0.gz
>

It seems another report due to mixed ztailpacking (inline) and
non-inlined pclusters at once.

(Although I need to add another check for mixed algorithm formats for
a single pcluster as well..)

#syz fix: erofs: Fix pcluster memleak when its block address is zero

> The issue was bisected to:
>
> commit dcbe6803fffd387f72b48c2373b5f5ed12a5804b
> Author: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx>
> Date: Thu May 12 11:58:33 2022 +0000
>
> erofs: fix buffer copy overflow of ztailpacking feature
>

It caused KASAN to begin to report, but it's not the root cause. Just
ignore it.

Thanks,
Gao Xiang