-
Notifications
You must be signed in to change notification settings - Fork 1.4k
sys/linux, executor: enable kvm fuzzing support for riscv64 #6552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Hi, I would like to share my current progress on enabling KVM fuzzing support Current work: syz_kvm_setup_cpu for RISC-V
The current implementation is intentionally minimal:
This is sufficient to reach basic KVM execution paths on RISC-V. Current blocker: syzlang text type Since syz_kvm_setup_cpu relies on embedding guest machine code, I am I would be very happy if there is any advice or help. |
|
Hi there, This is a great first step! |
Thanks again for your feedback. As a next step, I plan to first try porting syz_kvm_setup_cpu in order to familiarize myself with the implementation model of pseudo-syscalls. As you pointed out, it has some conceptual limitations, so SYZOS is the longer-term target where I expect to spend more effort. I’ve watched your LPC talk on SYZOS and found it very insightful. I agree that SYZOS is a strong improvement for KVM fuzzing, and I really appreciate you sharing your experience and design ideas there. Thanks for the guidance and suggestions. |
|
Hi all, I’d like to share a small progress update. I have now adapted syz_kvm_setup_cpu for riscv64 (see commit: 6eanut@bfd98d0). To validate the implementation, I added a test seed sys/linux/test/syz_kvm_setup_cpu_riscv64 and tested it following the procedure described in the documentation: https://github.com/google/syzkaller/blob/master/docs/syscall_descriptions.md#testing-of-descriptions Concretely, I ran: This set of changes also includes basic support for KVM_GET_ONE_REG on riscv64. As always, any feedback or suggestions are very welcome. |
c324447 to
9854e32
Compare
|
I think we're good to go. I rebased your patch, let's commit it once the checks pass. |
|
Thank you for your review. I will be preparing to submit the second patch. |

Currently, syzkaller is unable to test the kvm code under the RISC-V
architecture (as can be seen in the link
https://storage.googleapis.com/syzbot-assets/5522f9eefd80/ci-qemu2-riscv64-8f0b4cce.html,
the coverage for arch/riscv/kvm is 0). The reason is that previously,
due to the fact that RISC-V was not yet mature and stable in the KVM
aspect, the two files sys/linux/dev_kvm.txt and sys/linux/dev_kvm.txt.const
did not have compatibility with RISC-V.
With the development of RISC-V, a large number of RISC-V KVM codes have been merged into
the mainline of Linux (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git).
In order to enable syzkaller to test this part of the code, I attempted to adapt this task
myself. My workflow might be somewhat inefficient or clumsy in some parts.
If any friends could offer suggestions or guidance, I would be extremely grateful.
provided by syzbot (https://syzkaller.appspot.com/text?tag=KernelConfig&x=88cadb2aebdef7ea)
to cross-compile a riscv64 Linux kernel.
manually integrated it into the existing dev_kvm.txt and dev_kvm.txt.const.
Two additional points to note:
Although the current contents are not significantly different from dev_kvm_extra.txt, I plan
to add some pseudo system calls/RISC-V-specific operations for riscv64 in the future. If any
friends can offer suggestions in this regard, I would be very happy.
default version of syz_kvm_setup_cpu (mainly for successful compilation). In the future,
I plan to create common_kvm_riscv64.h to implement more content.
To test the adaptation effect, during the fuzz testing process, I restricted the use of only
some system calls related to kvm. The configuration file is as follows:
After testing for 24 hours, it can be observed that the code coverage of RISC-V KVM is no
longer zero.
If there are any areas that were not done well, please feel free to bring them up. I am
more than willing to make improvements.