Hi Zhihao,
The syz-imagegen generates valid fs images to seed the fuzzing
process. It's expected that fsck.ext4 will succeed on all of them.
During fuzzing, syzkaller will start mutating corpus programs, which
eventually leads to mounts of corrupted images and kernel crashes
similar to the report you shared. You don't need to do anything
special to force that behavior, it's the default.
--
Aleksandr
On Tue, Nov 5, 2024 at 10:22 AM Zhihao Cheng
<
cheng...@huaweicloud.com> wrote:
>
> Hi, I have one question, how to generate random corrupted filesystem
> image by syzkaller?
>
> I noticed the tools/syz-imagegen, and it can generate kinds of fs images
> with different mkfs options, for example:
> [root@localhost syzkaller]$ ./bin/syz-imagegen -fs ext4 --keep
> generated images: 63/63
> [root@localhost syzkaller]$ ls sys/linux/test/syz_mount_image_ext4_*
> sys/linux/test/syz_mount_image_ext4_0
> sys/linux/test/syz_mount_image_ext4_28.img
> sys/linux/test/syz_mount_image_ext4_47.img
> sys/linux/test/syz_mount_image_ext4_0.img
> sys/linux/test/syz_mount_image_ext4_29
> sys/linux/test/syz_mount_image_ext4_48
>
> All *.img files can pass the check from fsck.ext4, and they can be
> mounted successfully. After looking through the
> code(tools/syz-imagegen/imagegen.go), I think syz-imagegen won't inject
> corruptions into fs images.
>
> So, how can I generate corrupted filesystem images by syzkaller? It
> looks like syzkaller can make it, because I did find the problem caused
> by corrupted syz image[1].
>
> [1]
https://syzkaller.appspot.com/bug?extid=ae688d469e36fb5138d0
>