Skip to content

Commit 08dacaa

Browse files
SUMUKHA-PKdvyukov
authored andcommitted
netbsd.md: Changes made in file about missing clarity (google#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
1 parent f505ca4 commit 08dacaa

File tree

3 files changed

+51
-13
lines changed

3 files changed

+51
-13
lines changed

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ Utkarsh Anand
1717
Tobias Klauser
1818
Tim Tianyang Chen
1919
Ed Maste
20+
Sumukha PK

CONTRIBUTORS

+1
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ Utkarsh Anand
2828
Tobias Klauser
2929
Tim Tianyang Chen
3030
Ed Maste
31+
Sumukha PK

docs/netbsd.md

+49-13
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,80 @@
22

33
## How to run syzkaller on NetBSD using qemu
44

5-
So far the process is tested only on linux/amd64 host. To build Go binaries do:
5+
6+
1. Steps to set up NetBSD on qemu:
7+
* 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)
8+
``` qemu-img create -f raw NetBSD.img 30G
9+
```
10+
* 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)
11+
```
12+
qemu-system-x86_64 -hda NetBSD.img -cdrom NetBSD-7.0.2-amd64.iso
13+
```
14+
* To boot up every time to the .img file: (Have to be in the same directory as the .img file)
15+
```
16+
qemu-system-x86_64 -hda NetBSD.img -redir tcp:10022::22
17+
```
18+
Here the -redir flag is redirecting the 10022 on host to 22 port on guest.
19+
20+
2. So far the process is tested only on linux/amd64 host. To build Go binaries do:
621
```
722
make TARGETOS=netbsd
823
```
9-
To build C `syz-executor` binary, copy `executor/*` files to a NetBSD machine and build there with:
24+
25+
3. To build C `syz-executor` binary, copy `executor/*` files to a NetBSD machine and build there with:
1026
```
1127
gcc executor/executor_NetBSD.cc -o syz-executor -O1 -lpthread -DGOOS=\"netbsd\" -DGIT_REVISION=\"CURRENT_GIT_REVISION\"
1228
```
13-
Then, copy out the binary back to host into `bin/netbsd_amd64` dir.
29+
30+
"scp host@ip:/directory-of-source /directory-of-destination" command can be used to copy the files from the host to the guest.
31+
32+
4. Then, copy out the binary back to host into `bin/netbsd_amd64` dir.(Inside the syzkaller directory)
1433

1534
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.
1635

17-
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).
36+
(Anita steps are optional if the NetBSD OS is up and running, which it already is..)
37+
38+
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).
1839

19-
To prepare the image, use `anita`. (You need the python module `pexpect` installed, for using Anita)
40+
6. To prepare the image, use `anita`. (You need the python module `pexpect` installed, for using Anita)
2041
```
2142
git clone https://github.com/utkarsh009/anita
2243
python anita/anita --workdir anitatemp install http://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-8/201710221410Z/amd64/
2344
```
2445
NOTE: You can choose your own release tree from here: http://ftp.netbsd.org/pub/NetBSD/
2546
URL for a daily build might not exist in future and new release trees keep coming out.
2647

27-
Then spin up an instance from the image generated inside `./anitatemp` directory
48+
7. Then spin up an instance from the image generated inside `./anitatemp` directory
2849
```
2950
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
3051
```
31-
Then create an ssh-keypair without a password and save it by the name, say, `netbsdkey`
3252

53+
8. Then create an ssh-keypair without a password and save it by the name, say, `netbsdkey`
54+
55+
(This is done in the host OS until specified otherwise)
3356
```
3457
ssh-keygen -t rsa
3558
```
36-
Then append the following to `/etc/rc.conf`
59+
60+
(This is done in the Guest OS until specified otherwise)
61+
62+
9. Then append the following to `/etc/rc.conf`
3763
```
3864
sshd=YES
3965
ifconfig_wm0="inet 10.0.2.15 netmask 255.255.255.0"
4066
```
41-
Append this to `/etc/ssh/sshd_config`
67+
68+
10. Append this to `/etc/ssh/sshd_config`
4269
```
4370
Port 22
4471
ListenAddress 10.0.2.15
4572
```
46-
Then add your pubkey to `/root/.ssh/authorized_keys` and `reboot` the VM.
47-
When you see the login prompt, open up another terminal on host and issue the following command
73+
74+
11. Then add your pubkey to `/root/.ssh/authorized_keys` and `reboot` the VM.
75+
76+
(Switch to host)
77+
78+
12. When you see the login prompt, open up another terminal on host and issue the following command
4879
```
4980
ssh -i netbsdkey -p 10022 [email protected]
5081
```
@@ -70,11 +101,15 @@ If all of the above worked, `poweroff` the VM and create `netbsd.cfg` config fil
70101
}
71102
}
72103
```
104+
(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.)
105+
73106

74-
Then, start `syz-manager` with:
107+
13. Then, start `syz-manager` with: (Inside the syzkaller folder where the netbsd.cfg file also exists)
75108
```
76109
bin/syz-manager -config netbsd.cfg
77110
```
111+
Also, append ```PermitRootLogin without-password``` to .ssh/sshd_config in guest.
112+
78113
It should start printing output along the lines of:
79114
```
80115
booting test machines...
@@ -85,7 +120,8 @@ executed 7921, cover 1239, crashes 0, repro 0
85120
executed 32807, cover 1244, crashes 0, repro 0
86121
executed 35803, cover 1248, crashes 0, repro 0
87122
```
88-
If something does not work, add `-debug` flag to `syz-manager`.
123+
124+
14. If something does not work, add `-debug` flag to `syz-manager`.
89125

90126
## Missing things
91127

0 commit comments

Comments
 (0)