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:18] – msvoelker | syzkaller_with_ubuntu_host_and_freebsd_guest [2019/01/30 09:10] (current) – [Run syzkaller] msvoelker | ||
|---|---|---|---|
| Line 8: | Line 8: | ||
| The first task is to create VM with target OS. The second one is to build syzkaller (requires go) and the third and last one is to create a config in order to run syzkaller. | The first task is to create VM with target OS. The second one is to build syzkaller (requires go) and the third and last one is to create a config in order to run syzkaller. | ||
| + | |||
| + | My environment: | ||
| + | * Host: Ubuntu 18.04.1 LTS (amd64) | ||
| + | * Target: FreeBSD-13.0-CURRENT-amd64-20190110 | ||
| + | * QEMU emulator version 2.11.1 | ||
| ===== Create FreeBSD VM ===== | ===== Create FreeBSD VM ===== | ||
| - | create directory on host for vm | + | ==== Create VM and install FreeBSD ==== |
| - | mkdir -p ~/ | + | |
| - | create qemu hard disk image | + | create |
| - | sudo qemu-img create freebsd.img | + | mkdir -p ~/ |
| + | cd ~/ | ||
| + | sudo qemu-img create freebsd.img | ||
| - | start vm and install FreeBSD (download iso from freebsd.org) | + | start vm and install FreeBSD (download iso from freebsd.org). Make sure FreeBSD source files are copied to /usr/src during installation. |
| - | sudo qemu-system-x86_64 -enable-kvm -hda freebsd.img -m 2G -net user, | + | 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 24: | 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 34: | 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 40: | 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 95: | 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 101: | Line 130: | ||
| " | " | ||
| " | " | ||
| - | " | + | " |
| - | " | + | " |
| " | " | ||
| + | " | ||
| + | " | ||
| " | " | ||
| " | " | ||
| Line 114: | Line 145: | ||
| " | " | ||
| ], | ], | ||
| - | " | + | " |
| " | " | ||
| " | " | ||
| " | " | ||
| - | " | + | " |
| " | " | ||
| - | " | + | " |
| } | } | ||
| } | } | ||
| Line 128: | Line 159: | ||
| sudo bin/ | sudo bin/ | ||
| | | ||
| + | For a status page, open http:// | ||
| ===== Links ===== | ===== Links ===== | ||
| - | Documentation | + | github repository |
syzkaller_with_ubuntu_host_and_freebsd_guest.1548836324.txt.gz · Last modified: by msvoelker
