diff options
| -rw-r--r-- | .github/workflows/ci.yml | 71 | ||||
| -rwxr-xr-x | .github/workflows/run.sh | 11 | ||||
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | .travis.yml | 48 | ||||
| -rw-r--r-- | Makefile | 55 | ||||
| -rw-r--r-- | README.md | 3 | ||||
| -rwxr-xr-x | tools/fuzzit.sh | 6 |
7 files changed, 115 insertions, 82 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..43c727f78 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,71 @@ +# Copyright 2020 syzkaller project authors. All rights reserved. +# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +# GitHub workflow reference: +# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions + +name: ci +on: [push, pull_request] +jobs: + smoke: + runs-on: ubuntu-latest + steps: + # Checks out syzkaller repo at the path. + - name: checkout + uses: actions/checkout@v2 + with: + path: gopath/src/github.com/google/syzkaller + # Caches everything in .cache dir, in partiuclar we want to cache go-build and golangci-lint stuff. + # For reference see: + # https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows#using-the-cache-action + - name: cache + uses: actions/cache@v1 + with: + path: .cache + key: cache + # Run make presubmit_smoke. + - name: run + run: gopath/src/github.com/google/syzkaller/.github/workflows/run.sh make presubmit_smoke + # Upload coverage report to codecov.io. + - name: codecov + uses: codecov/codecov-action@v1 + with: + file: gopath/src/github.com/google/syzkaller/.coverage.txt + arch: + runs-on: ubuntu-latest + needs: [smoke] + if: ${{ needs.smoke.result == 'success' }} + steps: + - name: checkout + uses: actions/checkout@v2 + with: + path: gopath/src/github.com/google/syzkaller + - name: cache + uses: actions/cache@v1 + with: + path: .cache + key: cache + - name: run + run: gopath/src/github.com/google/syzkaller/.github/workflows/run.sh make presubmit_arch + fuzzit: + runs-on: ubuntu-latest + needs: [smoke] + if: ${{ needs.smoke.result == 'success' }} + steps: + - name: checkout + uses: actions/checkout@v2 + with: + path: gopath/src/github.com/google/syzkaller + - name: cache + uses: actions/cache@v1 + with: + path: .cache + key: cache + - name: regression + if: ${{ github.event_name == 'pull_request' }} + run: gopath/src/github.com/google/syzkaller/.github/workflows/run.sh tools/fuzzit.sh local-regression + - name: fuzzing + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + env: + FUZZIT_API_KEY: ${{ secrets.FUZZIT_API_KEY }} + run: gopath/src/github.com/google/syzkaller/.github/workflows/run.sh tools/fuzzit.sh fuzzing diff --git a/.github/workflows/run.sh b/.github/workflows/run.sh new file mode 100755 index 000000000..82fc6fa05 --- /dev/null +++ b/.github/workflows/run.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# Copyright 2020 syzkaller project authors. All rights reserved. +# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +export HOME="$PWD" +mkdir -p .cache +set -o pipefail +# Run the specified command in syz-env and convert error messages to github format: +# https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message +gopath/src/github.com/google/syzkaller/tools/syz-env $@ | \ + sed -E 's#\s*(.+):([0-9]+):([0-9]+): (.+)#\0\n::error file=\1,line=\2,col=\3::\4#' diff --git a/.gitignore b/.gitignore index 63902676d..c9f0198d6 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,9 @@ dashboard/app/config_prod.go # stub file used by Makefile .descriptions +# coverage report created by make presubmit/test +.coverage.txt + # files generated by syz-sysgen sys/*/gen/*.go executor/defs.h diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 47a93ebf7..000000000 --- a/.travis.yml +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 2017 syzkaller project authors. All rights reserved. -# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. - -dist: xenial -language: go -go_import_path: github.com/google/syzkaller -go: - - "1.13" - - "1.14" - -cache: - directories: - - $HOME/.cache/go-build - - $HOME/gopath/pkg/mod - -before_install: - # xenial packages are broken and do no allow to cross-compile for both 386 and arm. - # 386 requires gcc-multilib installed and arm requires gcc-arm-linux-gnueabi, - # but these packages are conflicting. This is a hacky way to install 386 headers. - - sudo dpkg --add-architecture i386 - - sudo apt-get update - - sudo apt-get install -y -q linux-libc-dev:i386 lib32gcc-5-dev lib32stdc++-5-dev - -install: - - make install_prerequisites - -script: - - make install_prerequisites - - make presubmit - -after_success: - - curl -s https://codecov.io/bash | bash -s - -y tools/codecov.yml - -jobs: - include: - - stage: fuzzit.dev (regression) - if: branch = master AND type IN (pull_request) - go: 1.14 - script: - - tools/fuzzit.sh local-regression - - - stage: fuzzit.dev (fuzzing) - if: branch = master AND type IN (push) - go: 1.14 - env: - secure: "TEXvLRUk/cmNwksHLTihVVyBWoU76EhAXkCCdLbn1FtfqCOzzMnQm02oUYcufLrVWIuVDUEUa9Tq+BrS2LGN2oTJEzk8bdQxeiztiRwbPocRLY3y3BNWWk89Vvu/eC/nPPoeRKZ7k3VZDbAk/+cPyXNMVaxBO7rwMqrne90txgTunX9V7U9Rr7b2phECBEF+riWtO3kWumZZG9qGq6NRmEcsoMOHgF2WGmxeAkAaU8xKdYOYbbUIns3cSf+bGWnFKOxSDkVDOOyKxdAc6OufejbGU4rjspty6ueXaoL69Rq5+7GOUflqLTMO8WUhpc65DPY3+9G2iH1p7U4v10Vk2V6qbQw83DDeucjSH23zIbNkjjYHSV5IMNwAMcEG5fwANfmnmQeVQCJJkwRBZufD1T+CLf9gqVldLG9qUGPI+ySli2J0oVAQ1rvMhKgR44Ipb3FQm0XBYhYXa3i08ojVXEtG8PNGHgrmOJnhUzC/BA+m9QKncxqMuISsBdlRnuU37DD0HeHZ6NTWvGy7gv2mhnCHc7AWuveBsc3XDvSfK8U3tB9LxS2OdRKWQdhnJBKowjAZ55lvTP0AgagQL+mPBQ7qJ2N8OT/oDRtN6tkY+DIEi8JTie0XOitNbY9AaF4hRFcixpesthvTEdOzx//mURXZXiPYQwyrjf9u1dwEpfA=" - script: - - tools/fuzzit.sh fuzzing @@ -208,7 +208,8 @@ bin/syz-extract: # `generate` does *not* depend on any kernel sources, and generates everything # in one pass, for all arches. It can be run on a bare syzkaller checkout. -generate: descriptions +generate: + $(MAKE) descriptions $(MAKE) generate_go $(MAKE) format @@ -247,20 +248,10 @@ tidy: clang-tidy -quiet -header-filter=.* -checks=-*,misc-definitions-in-headers -warnings-as-errors=* \ -extra-arg=-DGOOS_$(TARGETOS)=1 -extra-arg=-DGOARCH_$(TARGETARCH)=1 \ executor/*.cc - # Just check for compiler warnings. - $(CC) executor/test_executor.cc -c -o /dev/null -Wparentheses -Wno-unused -Wall lint: golangci-lint run ./... -arch: arch_darwin_amd64_host arch_linux_amd64_host arch_freebsd_amd64_host \ - arch_netbsd_amd64_host arch_openbsd_amd64_host \ - arch_linux_amd64_target arch_linux_386_target \ - arch_linux_arm64_target arch_linux_arm_target arch_linux_ppc64le_target arch_linux_mips64le_target \ - arch_freebsd_amd64_target arch_freebsd_386_target \ - arch_netbsd_amd64_target arch_openbsd_amd64_target \ - arch_windows_amd64_target arch_test - arch_darwin_amd64_host: env HOSTOS=darwin HOSTARCH=amd64 $(MAKE) host @@ -315,40 +306,46 @@ arch_test: env TARGETOS=test TARGETARCH=32_shmem $(MAKE) executor env TARGETOS=test TARGETARCH=32_fork_shmem $(MAKE) executor -presubmit: descriptions +presubmit: + $(MAKE) presubmit_smoke + $(MAKE) presubmit_arch + +presubmit_smoke: $(MAKE) generate - $(MAKE) check_diff - $(MAKE) check_copyright - $(MAKE) check_links - $(MAKE) lint - # We used to run presubmit_parallel instead of the following, - # but currently it OOMs on CI (see #1699). - # $(MAKE) presubmit_parallel + $(MAKE) -j100 check_diff check_copyright check_links presubmit_build $(MAKE) test + +presubmit_build: + # Run go install before lint for better error messages if build is broken. + # This does not check build of test files, but running go test takes too long (even for building). + $(GO) install ./... + $(MAKE) lint + +presubmit_arch: $(MAKE) arch_linux_amd64_host $(MAKE) arch_freebsd_amd64_host $(MAKE) arch_netbsd_amd64_host $(MAKE) arch_openbsd_amd64_host $(MAKE) arch_linux_amd64_target + $(MAKE) arch_linux_386_target $(MAKE) arch_linux_arm64_target + $(MAKE) arch_linux_arm_target + $(MAKE) arch_linux_ppc64le_target + $(MAKE) arch_linux_mips64le_target $(MAKE) arch_freebsd_amd64_target + $(MAKE) arch_freebsd_386_target $(MAKE) arch_netbsd_amd64_target $(MAKE) arch_openbsd_amd64_target + $(MAKE) arch_darwin_amd64_host + $(MAKE) arch_windows_amd64_target $(MAKE) arch_test - echo LGTM - -presubmit_parallel: test test_race arch + $(MAKE) test_race test: descriptions -ifeq ("$(CI)$(shell go version | grep 1.13)", "true") - # Collect coverage report for codecov.io when testing Go 1.14 on CI (uploaded in .travis.yml). - env CGO_ENABLED=1 $(GO) test -short -coverprofile=coverage.txt ./... -else - # Executor tests use cgo. - env CGO_ENABLED=1 $(GO) test -short ./... -endif + $(GO) test -short -coverprofile=.coverage.txt ./... test_race: descriptions + # -race requires cgo env CGO_ENABLED=1 $(GO) test -race; if test $$? -ne 2; then \ env CGO_ENABLED=1 $(GO) test -race -short -bench=.* -benchtime=.2s ./... ;\ fi @@ -1,7 +1,8 @@ # syzkaller - kernel fuzzer -[](https://travis-ci.org/github/google/syzkaller/branches) +[](https://github.com/google/syzkaller/actions?query=workflow/ci) [](https://fuzzit.dev) +[](https://bugs.chromium.org/p/oss-fuzz/issues/list?q=label:Proj-syzkaller) [](https://goreportcard.com/report/github.com/google/syzkaller) [](https://codecov.io/gh/google/syzkaller) [](https://godoc.org/github.com/google/syzkaller) diff --git a/tools/fuzzit.sh b/tools/fuzzit.sh index a056397b2..a056b7c3a 100755 --- a/tools/fuzzit.sh +++ b/tools/fuzzit.sh @@ -2,7 +2,6 @@ # Copyright 2019 syzkaller project authors. All rights reserved. # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. - # Helper script for working with fuzzit.dev # https://github.com/fuzzitdev/example-go @@ -12,11 +11,10 @@ export TYPE="${1}" function target { go-fuzz-build -libfuzzer -func $3 -o fuzzer.a $2 clang -fsanitize=fuzzer fuzzer.a -o fuzzer - ./fuzzit create job --type "${TYPE}" --branch $TRAVIS_BRANCH --revision $TRAVIS_COMMIT syzkaller/$1 ./fuzzer + ./fuzzit create job --type "${TYPE}" --branch ${GITHUB_REF#refs/heads/} --revision ${GITHUB_SHA} syzkaller/$1 ./fuzzer } -go get -u github.com/dvyukov/go-fuzz/go-fuzz-build -wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.46/fuzzit_Linux_x86_64 +curl -L --output fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.77/fuzzit_Linux_x86_64 chmod a+x fuzzit make descriptions |
