I am trying to use the
syz-execprog tool of Syzkaller. To do that, I need to launch a VM manually using QEMU. My target is to fuzz KVM, so I need to have /dev/kvm on the VM.
The problem I have is that after launching the VM with QEMU, /dev/kvm does not exist. I built the kernel by setting CONFIG_KVM=y and CONFIG_KVM_INTEL=m. I expected that with this configuration, kvm will be loaded at boot time and I will be able to load kvm-intel, however, when I do lsmod, the result is empty and when I do modprobe kvm_intel, I get the error that says "modprobe: ERROR: could not insert 'kvm_intel': Operation not supported". When I check dmesg, I see "kvm: no hardware support".
I also created the file kvm.conf under /etc/modules-load.d. I wrote kvm in it, but kvm still wasn't loaded at boot time.
My question is, how can I launch the VM so that I eventually have /dev/kvm?
According to Syzkaller's
documentation, this is how I launch the VM
qemu-system-x86_64 \
-m 2G \
-smp 2 \
-kernel $KERNEL/arch/x86/boot/bzImage \
-append "console=ttyS0 root=/dev/sda earlyprintk=serial net.ifnames=0" \
-drive file=$IMAGE/stretch.img,format=raw \
-net user,host=10.0.2.10,hostfwd=tcp:127.0.0.1:10021-:22 \
-net nic,model=e1000 \
-enable-kvm \
-nographic \
-pidfile vm.pid \
2>&1 | tee vm.log
And this is how I ssh to it:
ssh -i $IMAGE/stretch.id_rsa -p 10021 -o "StrictHostKeyChecking no" root@localhost
I created the stretch image using the script create-image.sh that Syzkaller provides.