diff options
| author | Sumukha Pk <sumukhapk46@gmail.com> | 2018-03-13 15:03:05 +0530 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-03-13 12:33:05 +0300 |
| commit | 08dacaa0b938aa2951de182c1dfe1862ebe2a20c (patch) | |
| tree | ffd5c74f8bf8bb77201e159dabde7007ff3b0d99 | |
| parent | f505ca4b5b3b9b595531a66f864a8c2843294c70 (diff) | |
netbsd.md: Changes made in file about missing clarity (#535)
* Changes made in the netbsd.md file, syzkaller made easier to install
* Name added to list of contributors
* Added name to CONTRIBUTORS file
* Changes in file regarding format issues
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | CONTRIBUTORS | 1 | ||||
| -rw-r--r-- | docs/netbsd.md | 62 |
3 files changed, 51 insertions, 13 deletions
@@ -17,3 +17,4 @@ Utkarsh Anand Tobias Klauser Tim Tianyang Chen Ed Maste +Sumukha PK diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 02f6ff554..6230a5387 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -28,3 +28,4 @@ Utkarsh Anand Tobias Klauser Tim Tianyang Chen Ed Maste +Sumukha PK diff --git a/docs/netbsd.md b/docs/netbsd.md index 4dee89196..b4e1b4c96 100644 --- a/docs/netbsd.md +++ b/docs/netbsd.md @@ -2,21 +2,42 @@ ## How to run syzkaller on NetBSD using qemu -So far the process is tested only on linux/amd64 host. To build Go binaries do: + +1. Steps to set up NetBSD on qemu: + * To create a .img file where the OS is stored: ( Here 30G indicates the size of .img file as 30gb. Anything above 10gb is fine) +``` qemu-img create -f raw NetBSD.img 30G +``` + * To install the .iso file in the .img: (Here NetBSD-7.0.2-amd64.iso is the iso file and NetBSD.img is the img file created in the first step) +``` + qemu-system-x86_64 -hda NetBSD.img -cdrom NetBSD-7.0.2-amd64.iso +``` + * To boot up every time to the .img file: (Have to be in the same directory as the .img file) +``` + qemu-system-x86_64 -hda NetBSD.img -redir tcp:10022::22 +``` +Here the -redir flag is redirecting the 10022 on host to 22 port on guest. + +2. So far the process is tested only on linux/amd64 host. To build Go binaries do: ``` make TARGETOS=netbsd ``` -To build C `syz-executor` binary, copy `executor/*` files to a NetBSD machine and build there with: + +3. To build C `syz-executor` binary, copy `executor/*` files to a NetBSD machine and build there with: ``` gcc executor/executor_NetBSD.cc -o syz-executor -O1 -lpthread -DGOOS=\"netbsd\" -DGIT_REVISION=\"CURRENT_GIT_REVISION\" ``` -Then, copy out the binary back to host into `bin/netbsd_amd64` dir. + +"scp host@ip:/directory-of-source /directory-of-destination" command can be used to copy the files from the host to the guest. + +4. Then, copy out the binary back to host into `bin/netbsd_amd64` dir.(Inside the syzkaller directory) Building/running on a NetBSD host should work as well, but currently our `Makefile` does not work there, so you will need to do its work manually. -Then, you need a NetBSD image with root ssh access with a key. General instructions can be found here [qemu instructions](https://wiki.qemu.org/Hosts/BSD). +(Anita steps are optional if the NetBSD OS is up and running, which it already is..) + +5. Then, you need a NetBSD image with root ssh access with a key. General instructions can be found here [qemu instructions](https://wiki.qemu.org/Hosts/BSD). -To prepare the image, use `anita`. (You need the python module `pexpect` installed, for using Anita) +6. To prepare the image, use `anita`. (You need the python module `pexpect` installed, for using Anita) ``` git clone https://github.com/utkarsh009/anita python anita/anita --workdir anitatemp install http://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-8/201710221410Z/amd64/ @@ -24,27 +45,37 @@ python anita/anita --workdir anitatemp install http://nycdn.netbsd.org/pub/NetBS NOTE: You can choose your own release tree from here: http://ftp.netbsd.org/pub/NetBSD/ URL for a daily build might not exist in future and new release trees keep coming out. -Then spin up an instance from the image generated inside `./anitatemp` directory +7. Then spin up an instance from the image generated inside `./anitatemp` directory ``` qemu-system-x86_64 -m 1024 -drive file=anitatemp/wd0.img,format=raw,media=disk -netdev user,id=mynet0,host=10.0.2.10,hostfwd=tcp:127.0.0.1:10022-:22 -device e1000,netdev=mynet0 -nographic ``` -Then create an ssh-keypair without a password and save it by the name, say, `netbsdkey` +8. Then create an ssh-keypair without a password and save it by the name, say, `netbsdkey` + +(This is done in the host OS until specified otherwise) ``` ssh-keygen -t rsa ``` -Then append the following to `/etc/rc.conf` + +(This is done in the Guest OS until specified otherwise) + +9. Then append the following to `/etc/rc.conf` ``` sshd=YES ifconfig_wm0="inet 10.0.2.15 netmask 255.255.255.0" ``` -Append this to `/etc/ssh/sshd_config` + +10. Append this to `/etc/ssh/sshd_config` ``` Port 22 ListenAddress 10.0.2.15 ``` -Then add your pubkey to `/root/.ssh/authorized_keys` and `reboot` the VM. -When you see the login prompt, open up another terminal on host and issue the following command + +11. Then add your pubkey to `/root/.ssh/authorized_keys` and `reboot` the VM. + +(Switch to host) + +12. When you see the login prompt, open up another terminal on host and issue the following command ``` ssh -i netbsdkey -p 10022 root@127.0.0.1 ``` @@ -70,11 +101,15 @@ If all of the above worked, `poweroff` the VM and create `netbsd.cfg` config fil } } ``` +(Above directories have to be specified to the exact locations and the ssh keys must be in a separate directory with chmod 700 permissions set to that directory and chmod 600 permissions to the files in both the guest and the host.) + -Then, start `syz-manager` with: +13. Then, start `syz-manager` with: (Inside the syzkaller folder where the netbsd.cfg file also exists) ``` bin/syz-manager -config netbsd.cfg ``` +Also, append ```PermitRootLogin without-password``` to .ssh/sshd_config in guest. + It should start printing output along the lines of: ``` booting test machines... @@ -85,7 +120,8 @@ executed 7921, cover 1239, crashes 0, repro 0 executed 32807, cover 1244, crashes 0, repro 0 executed 35803, cover 1248, crashes 0, repro 0 ``` -If something does not work, add `-debug` flag to `syz-manager`. + +14. If something does not work, add `-debug` flag to `syz-manager`. ## Missing things |
