[syzkaller] Initial integration. (#2713)

* [syzkaller] Initial integration.

* clarify a comment

* download pre-built go and build 3 fuzzers out of 5
This commit is contained in:
Max Moroz 2019-08-16 21:29:04 -07:00 committed by GitHub
parent 4ce4bfbc40
commit b628847628
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,28 @@
# Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
FROM gcr.io/oss-fuzz-base/base-builder
MAINTAINER mmoroz@chromium.org
ADD https://dl.google.com/go/go1.12.9.linux-amd64.tar.gz go.tar.gz
RUN tar xzf go.tar.gz -C $SRC/
ENV GOPATH $SRC
ENV PATH $SRC/go/bin:$GOPATH/bin:$PATH
RUN go get -u -d github.com/google/syzkaller/...
RUN git clone --depth 1 https://github.com/google/syzkaller.git syzkaller
WORKDIR syzkaller
COPY build.sh $SRC/

45
projects/syzkaller/build.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/bash -eu
# Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
# Dependency of go-fuzz
go get golang.org/x/tools/go/packages
# go-fuzz-build is the tool that instruments Go files.
go get github.com/dvyukov/go-fuzz/go-fuzz-build
# Based on the function from oss-fuzz/projects/golang/build.sh script.
function compile_fuzzer {
path=$1
function=$2
fuzzer=$3
# Instrument all Go files relevant to this fuzzer
go-fuzz-build -libfuzzer -func $function -o $fuzzer.a $path
# Instrumented, compiled Go ($fuzzer.a) + fuzzing engine = fuzzer binary
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE $fuzzer.a -lpthread -o $OUT/$fuzzer
}
compile_fuzzer ./pkg/compiler Fuzz compiler_fuzzer
compile_fuzzer ./prog/test FuzzDeserialize prog_deserialize_fuzzer
compile_fuzzer ./prog/test FuzzParseLog prog_parselog_fuzzer
# This target fails to build.
# compile_fuzzer ./pkg/report Fuzz report_fuzzer
# This target is way too spammy and OOMs very quickly.
# compile_fuzzer ./tools/syz-trace2syz/proggen Fuzz trace2syz_fuzzer

View File

@ -0,0 +1,7 @@
homepage: "https://github.com/google/syzkaller.git"
primary_contact: "dvyukov@google.com"
auto_ccs:
- "andreyknvl@google.com"
- "mmoroz@chromium.org"
sanitizers:
- address