syzkaller_with_ubuntu_host_and_freebsd_guest
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| syzkaller_with_ubuntu_host_and_freebsd_guest [2019/01/30 08:27] – msvoelker | syzkaller_with_ubuntu_host_and_freebsd_guest [2019/01/30 09:10] (current) – [Run syzkaller] msvoelker | ||
|---|---|---|---|
| Line 16: | Line 16: | ||
| ===== Create FreeBSD VM ===== | ===== Create FreeBSD VM ===== | ||
| - | create directory | + | ==== Create VM and install FreeBSD ==== |
| + | |||
| + | create directory | ||
| mkdir -p ~/ | mkdir -p ~/ | ||
| + | cd ~/ | ||
| + | sudo qemu-img create freebsd.img 16G | ||
| - | create qemu hard disk image | + | start vm and install FreeBSD (download iso from freebsd.org). Make sure FreeBSD source files are copied to /usr/src during installation. |
| - | sudo qemu-img create freebsd.img 8G | + | sudo qemu-system-x86_64 -enable-kvm -hda freebsd.img -m 2G -net user, |
| - | + | ||
| - | start vm and install FreeBSD (download iso from freebsd.org) | + | |
| - | sudo qemu-system-x86_64 -enable-kvm -hda freebsd.img -m 2G -net user, | + | |
| after installation let vm print to console -> add in / | after installation let vm print to console -> add in / | ||
| Line 29: | Line 30: | ||
| start vm without graphic and with network | start vm without graphic and with network | ||
| - | sudo qemu-system-x86_64 -hda freebsd.img -enable-kvm -m 2G -net user, | + | |
| * -net user let the vm uses a user mode network stack. Since hostfwd=tcp:: | * -net user let the vm uses a user mode network stack. Since hostfwd=tcp:: | ||
| < | < | ||
| Line 39: | Line 41: | ||
| | | ||
| * -nographic prints the console output of the vm directly into the console on the host | * -nographic prints the console output of the vm directly into the console on the host | ||
| + | |||
| + | ==== Enable KCOV support for FreeBSD ==== | ||
| + | |||
| + | By now, KCOV support is not enabled by default. Create a own kernel config file in the VM (/usr/src should contain the FreeBSD source files). | ||
| + | cd / | ||
| + | cp GENERIC KCOV | ||
| + | | ||
| + | In file KCOV, uncomment the lines | ||
| + | options | ||
| + | options | ||
| + | |||
| + | Build and install FreeBSD kernel as root, and restart | ||
| + | cd /usr/src | ||
| + | make -j4 kernel KERNCONF=KCOV | ||
| + | shutdown -r now | ||
| + | |||
| + | ==== Allow SSH root access to FreeBSD ==== | ||
| syzkaller needs root access to the OS in the VM via SSH. | syzkaller needs root access to the OS in the VM via SSH. | ||
| Line 45: | Line 64: | ||
| ssh-keygen -f freebsd_id_rsa | ssh-keygen -f freebsd_id_rsa | ||
| - | add public key on the host (from freebsd_id_rsa.pub) into / | + | add public key of the host (freebsd_id_rsa.pub) into / |
| allow ssh as root in vm. In / | allow ssh as root in vm. In / | ||
| Line 100: | Line 119: | ||
| ===== Run syzkaller ===== | ===== Run syzkaller ===== | ||
| + | |||
| + | To present code coverage, syzkaller needs FreeBSD source and object files. Start the VM with qemu and use scp on host to copy source and object files from target to host. | ||
| + | mkdir -p ~/ | ||
| + | scp -r -o " | ||
| + | scp -r -o " | ||
| create syz-manager config file (on host) ~/ | create syz-manager config file (on host) ~/ | ||
| Line 106: | Line 130: | ||
| " | " | ||
| " | " | ||
| - | " | + | " |
| - | " | + | " |
| " | " | ||
| + | " | ||
| + | " | ||
| " | " | ||
| " | " | ||
| Line 119: | Line 145: | ||
| " | " | ||
| ], | ], | ||
| - | " | + | " |
| " | " | ||
| " | " | ||
| " | " | ||
| - | " | + | " |
| " | " | ||
| - | " | + | " |
| } | } | ||
| } | } | ||
| Line 133: | Line 159: | ||
| sudo bin/ | sudo bin/ | ||
| | | ||
| + | For a status page, open http:// | ||
| ===== Links ===== | ===== Links ===== | ||
syzkaller_with_ubuntu_host_and_freebsd_guest.1548836871.txt.gz · Last modified: by msvoelker
