google / syzkaller

syzkaller is an unsupervised coverage-guided kernel fuzzer
Apache License 2.0
5.24k stars 1.2k forks source link

sys/linux: kernel fuzzing lockdown #1622

Open xairy opened 4 years ago

xairy commented 4 years ago

A number of cases come up over time where we crash/reboot/corrupt kernel, but it's working-as-intended and it's hard/impossible to filter out such cases statically. The idea is to introduce a "fuzzing lockdown" config that will very selectively disable these bits of kernel logic. Originally proposed by Tetsuo Handa. A proposed patch and a discussion: https://lkml.org/lkml/2019/12/16/212 A lengthy discussion on kernel mailing lists: https://lore.kernel.org/lkml/20190825104858.GA119494@gmail.com/T/ Another one: https://groups.google.com/d/msg/syzkaller-bugs/1rVENJf9P4U/QtGpapRxAgAJ

Here is list of concrete cases:

dvyukov commented 4 years ago

Is there any simple way to prevent this? Turn off some config?

xairy commented 4 years ago

I don't see one. We could disable CONFIG_VT, but that will affect fuzzing of virtual terminals.

dvyukov commented 4 years ago

This may be another candidate for the "fuzzing lockdown" feature that Tetsuo proposed on kernel mailing lists. I think we need to start collecting all these cases in a single issue, they are spread across random mailing lists.

dvyukov commented 4 years ago

Let's re-purpose this as a broader issues since we don't have a simple solution anyway.

dvyukov commented 4 years ago

Amusingly this was already discovered before and forgotten. You may see this patch from Tetsuo mentions k_spec: https://lkml.org/lkml/2019/12/16/212

KumanekoSakura commented 4 years ago

@xairy Initial patches for this purpose arrived at linux-next-20200428 . Please add CONFIG_TWIST_KERNEL_BEHAVIOR=y and CONFIG_TWIST_FOR_SYZKALLER_TESTING=y to your kernel config, and let's check whether the frequency of "unexpected kernel reboot (3)" and "lost connection to test machine (5)" on linux-next is reduced.