From ec4026808b7fe798de3937f220889403e83611aa Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Wed, 6 May 2020 16:53:06 +0200 Subject: [PATCH] docs: move go install instructions to setup.md Also update go version requirement to 1.13. --- docs/contributing.md | 38 ++---------------------- docs/executing_syzkaller_programs.md | 6 ++-- docs/linux/external_fuzzing_usb.md | 18 ++++++------ docs/linux/setup.md | 43 ++++++++++++++++++++++++---- 4 files changed, 51 insertions(+), 54 deletions(-) diff --git a/docs/contributing.md b/docs/contributing.md index da670687..7ab59d12 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -42,45 +42,11 @@ Extending/improving [system call descriptions](syscall_descriptions.md) is alway Unassigned issues from the [bug tracker](https://github.com/google/syzkaller/issues) are worth doing, but some of them might be complicated. +If you want to contribute code or syscall descriptions, at the very least you need to be able to build and run syzkaller, see the instructions [here](/docs/setup.md). + If you want to work on something non-trivial, please briefly describe it on the [syzkaller@googlegroups.com](https://groups.google.com/forum/#!forum/syzkaller) mailing list first, so that there is agreement on high level approach and no duplication of work between contributors. -## Go - -`syzkaller` is written in [Go](https://golang.org), and `Go 1.11+` -toolchain is required for build. The toolchain can be installed with: - -``` -wget https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz -tar -xf go1.14.2.linux-amd64.tar.gz -mv go goroot -mkdir gopath -export GOPATH=`pwd`/gopath -export GOROOT=`pwd`/goroot -export PATH=$GOPATH/bin:$PATH -export PATH=$GOROOT/bin:$PATH -``` - -Then get and build `syzkaller`: - -``` bash -go get -u -d github.com/google/syzkaller/prog -cd gopath/src/github.com/google/syzkaller/ -make -``` - -As the result compiled binaries should appear in the `bin/` dir. - -Also see [Go Getting Started](https://golang.org/doc/install) for more details. - -Note: if you want to do cross-OS/arch testing, you need to specify `TARGETOS`, -`TARGETVMARCH` and `TARGETARCH` arguments to `make`. See the [Makefile](/Makefile) for details. - -Note: older versions of Go toolchain formatted code in a slightly -[different way](https://github.com/golang/go/issues/25161). -So if you are seeing unrelated code formatting diffs after running `make generate` -or `make format`, you may be using `Go 1.10` or older. In such case update to `Go 1.11+`. - ## How to create a pull request - First, you need an own git fork of syzkaller repository. Nagivate to diff --git a/docs/executing_syzkaller_programs.md b/docs/executing_syzkaller_programs.md index 70809b8a..d06c16ff 100644 --- a/docs/executing_syzkaller_programs.md +++ b/docs/executing_syzkaller_programs.md @@ -4,10 +4,10 @@ This page describes how to execute existing syzkaller programs for the purpose of bug reproduction. This way you can replay a single program or a whole execution log with several programs. -1. Setup Go toolchain (if you don't yet have it, you need version 1.11 or higher): -Download latest Go distribution from (https://golang.org/dl/). Unpack it to `$HOME/go1.11`. +1. Setup Go toolchain (if you don't yet have it, you need version 1.13 or higher): +Download latest Go distribution from (https://golang.org/dl/). Unpack it to `$HOME/goroot`. ``` bash -$ export GOROOT=$HOME/go1.11 +$ export GOROOT=$HOME/goroot $ export GOPATH=$HOME/gopath ``` diff --git a/docs/linux/external_fuzzing_usb.md b/docs/linux/external_fuzzing_usb.md index dc0d33a4..631d0b1b 100644 --- a/docs/linux/external_fuzzing_usb.md +++ b/docs/linux/external_fuzzing_usb.md @@ -137,14 +137,14 @@ These instructions describe how to set this up on a Raspberry Pi Zero W, but any 8. Download and install Go: ``` bash - curl https://dl.google.com/go/go1.10.8.linux-armv6l.tar.gz -o go1.10.8.linux-armv6l.tar.gz - tar -xf go1.10.8.linux-armv6l.tar.gz - mv go goroot-1.10.8 - mkdir gopath-1.10.8 - export GOPATH=~/gopath-1.10.8 - export GOROOT=~/goroot-1.10.8 - export PATH=~/goroot-1.10.8/bin:$PATH - export PATH=~/gopath-1.10.8/bin:$PATH + curl https://dl.google.com/go/go1.14.2.linux-armv6l.tar.gz -o go.linux-armv6l.tar.gz + tar -xf go.linux-armv6l.tar.gz + mv go goroot + mkdir gopath + export GOPATH=~/gopath + export GOROOT=~/goroot + export PATH=~/goroot/bin:$PATH + export PATH=~/gopath/bin:$PATH ``` 9. Download syzkaller, apply the patch below and build `syz-executor`: @@ -184,7 +184,7 @@ These instructions describe how to set this up on a Raspberry Pi Zero W, but any ``` bash go get -u -d github.com/google/syzkaller/prog - cd ~/gopath-1.10.8/src/github.com/google/syzkaller + cd ~/gopath/src/github.com/google/syzkaller # Put the patch above into ./syzkaller.patch git apply ./syzkaller.patch make executor diff --git a/docs/linux/setup.md b/docs/linux/setup.md index 67943e21..54bec7a2 100644 --- a/docs/linux/setup.md +++ b/docs/linux/setup.md @@ -15,15 +15,51 @@ Instructions for a particular VM type or kernel arch can be found on these pages The following components are needed to use syzkaller: + - Go compiler and syzkaller itself - C compiler with coverage support - Linux kernel with coverage additions - Virtual machine or a physical device - - syzkaller itself Generic steps to set up syzkaller are described below. If you encounter any troubles, check the [troubleshooting](/docs/troubleshooting.md) page. +### Go and syzkaller + +`syzkaller` is written in [Go](https://golang.org), and `Go 1.13+` +toolchain is required for build. The toolchain can be installed with: + +``` +wget https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz +tar -xf go1.14.2.linux-amd64.tar.gz +mv go goroot +mkdir gopath +export GOPATH=`pwd`/gopath +export GOROOT=`pwd`/goroot +export PATH=$GOPATH/bin:$PATH +export PATH=$GOROOT/bin:$PATH +``` + +Then get and build `syzkaller`: + +``` bash +go get -u -d github.com/google/syzkaller/prog +cd gopath/src/github.com/google/syzkaller/ +make +``` + +As the result compiled binaries should appear in the `bin/` dir. + +Also see [Go Getting Started](https://golang.org/doc/install) for more details. + +Note: if you want to do cross-OS/arch testing, you need to specify `TARGETOS`, +`TARGETVMARCH` and `TARGETARCH` arguments to `make`. See the [Makefile](/Makefile) for details. + +Note: older versions of Go toolchain formatted code in a slightly +[different way](https://github.com/golang/go/issues/25161). +So if you are seeing unrelated code formatting diffs after running `make generate` +or `make format`, you may be using `Go 1.10` or older. In such case update to `Go 1.13+`. + ### C Compiler Syzkaller is a coverage-guided fuzzer and therefore it needs the kernel to be built with coverage support, which requires a recent GCC version. @@ -63,8 +99,3 @@ The [create-image.sh](/tools/create-image.sh) script can be used to create a sui Detailed steps for setting up syzkaller with QEMU on a Linux host are avaialble for [x86-64](setup_ubuntu-host_qemu-vm_x86-64-kernel.md) and [arm64](setup_linux-host_qemu-vm_arm64-kernel.md) kernels. For some details on fuzzing the kernel on an Android device check out [this page](setup_linux-host_android-device_arm64-kernel.md) and the explicit instructions for an Odroid C2 board are available [here](setup_ubuntu-host_odroid-c2-board_arm64-kernel.md). - -### Syzkaller - -`syzkaller` is written in [Go](https://golang.org), a `Go 1.11+` toolchain is required for build. -See [this](/docs/contributing.md#go) for instructions on how to install Go and build syzkaller.