aboutsummaryrefslogtreecommitdiffstats
path: root/docs/netbsd
diff options
context:
space:
mode:
authorKamil Rytarowski <n54@gmx.com>2020-02-09 10:14:07 +0100
committerKamil Rytarowski <n54@gmx.com>2020-02-09 10:14:07 +0100
commit6ece2ea51d6e315638f023b7475d7df9b32869d1 (patch)
tree1d4998db22c7b66ab970eb03aa8d86e4bbcda5f1 /docs/netbsd
parent06150bf1b39b70e521560bc943ac19b281903ebc (diff)
docs/netbsd: Improve wording.
Based on input from Maxime Villard (NetBSD).
Diffstat (limited to 'docs/netbsd')
-rw-r--r--docs/netbsd/README.md72
1 files changed, 35 insertions, 37 deletions
diff --git a/docs/netbsd/README.md b/docs/netbsd/README.md
index ed21efdc6..003723876 100644
--- a/docs/netbsd/README.md
+++ b/docs/netbsd/README.md
@@ -1,8 +1,8 @@
# NetBSD
-Instructions to set up syzkaller for a Linux Host and an amd64 NetBSD kernel.
+Instructions to set up syzkaller for a Linux host and a NetBSD guest.
-## Setup the NetBSD sources
+## Preparing the NetBSD sources
1. Get the NetBSD kernel source (preferably HEAD).
```sh
@@ -11,48 +11,47 @@ Instructions to set up syzkaller for a Linux Host and an amd64 NetBSD kernel.
$ git clone https://github.com/NetBSD/src.git
```
-2. Build the tools (You will have the toolchain in $HOME/netbsd/tools)
+2. Build the tools. You will have the toolchain in `$HOME/netbsd/tools`.
```sh
$ cd src
$ ./build.sh -m amd64 -U -T ../tools tools
```
-3. Build the Distribution (This might take a while)
+3. Build the distribution. This might take a while.
```sh
- $ ./build.sh -m amd64 -U -T ../tools -D ../dest distribution
- ```
+ $ ./build.sh -m amd64 -U -T ../tools -D ../dest distribution
+ ```
+
+At this point you should have a NetBSD distribution in `$HOME/netbsd/dest`.
-At this point you should have a NetBSD distribution at `$HOME/netbsd/dest`.
+## Installing and building syzkaller on Linux host
-## Installing and building Syzkaller on Linux Host
-
-1. Install all the dependencies for Syzkaller (Go distribution can be downloaded from https://golang.org/dl/)
+1. Install all the dependencies for syzkaller.
-2. Clone the Syzkaller Repository
+2. Clone the syzkaller repository.
```sh
- $ go get -u -d github.com/google/syzkaller/..
+ $ go get -u -d github.com/google/syzkaller/...
$ cd ~/go/src/github.com/google/syzkaller
```
-3. Compile Syzkaller for NetBSD
+3. Compile syzkaller for NetBSD.
```sh
$ make TARGETOS=netbsd SOURCEDIR=$HOME/netbsd/src
```
-The above steps should have built the Syzkaller binaries for NetBSD.
+The above steps should have built the syzkaller binaries for NetBSD.
You can see the compiled binaries in `bin/netbsd_amd64`.
-
-## Setting up a NetBSD VM with qemu
+## Setting up a NetBSD VM with qemu
You can use the script given [here](https://github.com/R3x/netbsd-fuzzing-aids/blob/master/install_netbsd.sh) to create a disk image with NetBSD installed.
-The script would also automatically give you a ssh key to ssh into the VM.
+The script would also automatically give you a ssh key to ssh into the VM.
-Alternatively, You can follow the tutorial given [here](https://wiki.qemu.org/Hosts/BSD#NetBSD) to
-setup a basic NetBSD VM with qemu.
+Alternatively, you can follow the tutorial given [here](https://wiki.qemu.org/Hosts/BSD#NetBSD) to
+set up a basic NetBSD VM with qemu.
-After installing and running the NetBSD VM on qemu please follow the steps below to
+After installing and running the NetBSD VM on qemu, please follow the steps below to
configure ssh.
1. Create a ssh-keypair on the host and save it as `netbsdkey`.
@@ -60,13 +59,13 @@ configure ssh.
$ ssh-keygen -f netbsdkey -t rsa -N ""
```
-2. Append the following lines to `/etc/rc.conf` on the guest. (use `vi` editor)
+2. Append the following lines to `/etc/rc.conf` on the guest. You can use the `vi` editor to do that.
```
sshd=YES
dhcpcd=YES
ifconfig_wm0="inet 10.0.2.15 netmask 255.255.255.0"
```
-
+
3. Append this to `/etc/ssh/sshd_config` on the guest.
```
Port 22
@@ -75,53 +74,52 @@ configure ssh.
PermitRootLogin without-password
```
-4. Now you should be able to ssh into the netbsd VM.
+4. Now you should be able to ssh into the NetBSD VM.
```sh
$ ssh -p 10022 root@127.0.0.1
```
-5. Copy and paste your public key to `/root/.ssh/authorized_keys` on the guest
+5. Copy and paste your public key to `/root/.ssh/authorized_keys` on the guest
and `reboot` the VM.
-
-6. After reboot make sure that the ssh is working properly. Replace the port with what
- you have configured.
+
+6. After reboot make sure that ssh is working properly. Replace the port with what
+ you have configured.
```sh
$ ssh -i path/to/netbsdkey -p 10022 root@127.0.0.1
```
If the last command returns a proper shell it means the VM has been configured.
-
## Compiling a NetBSD kernel (Optional)
You can compile a kernel with KASAN to increase the chances of finding bugs.
-1. Make a copy of the config file
+1. Make a copy of the config file.
```sh
$ cd $HOME/netbsd/src
- $ cp sys/arch/amd64/conf/GENERIC sys/arch/amd64/conf/SYZKALLER
+ $ cp sys/arch/amd64/conf/GENERIC sys/arch/amd64/conf/SYZKALLER
```
-2. Uncomment the following lines in `sys/arch/amd64/conf/SYZKALLER` to enable KASAN
+2. Uncomment the following lines in `sys/arch/amd64/conf/SYZKALLER` to enable KASAN.
```
#makeoptions KASAN=1 # Kernel Address Sanitizer
#options KASAN
#no options SVS
```
-3. Compile the kernel with KASAN (Assuming you have followed the inital steps to
- build tools)
+3. Compile the kernel with KASAN (assuming you have followed the initial steps to
+ build tools).
```sh
$ cd $HOME/netbsd/src
$ ./build.sh -m amd64 -U -T ../tools -j4 kernel=SYZKALLER
```
-4. At this point you should have the new compiled kernel image which can be found in
- `$HOME/netbsd/src/sys/arch/amd64/compile/SYZKALLER` and should have the name
+4. At this point you should have the new compiled kernel image which can be found in
+ `$HOME/netbsd/src/sys/arch/amd64/compile/SYZKALLER` and should have the name
`netbsd`. You need to copy it to the installed VM and reboot the VM.
-## Running Syzkaller
+## Running syzkaller
1. If all of the above worked, `poweroff` the VM and create `netbsd.cfg` config file with the following contents (alter paths as necessary):
```
@@ -149,7 +147,7 @@ You can compile a kernel with KASAN to increase the chances of finding bugs.
(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.)
-2. Then, start `syz-manager` with: (Inside the syzkaller folder where the netbsd.cfg file also exists)
+2. Then, inside the syzkaller folder where the `netbsd.cfg` file also exists, start `syz-manager` with:
```sh
$ bin/syz-manager -config netbsd.cfg
```