From b33c276c0d3c1cef9c9fef119efb8ecdf0400236 Mon Sep 17 00:00:00 2001 From: Max Moroz Date: Wed, 21 Aug 2019 11:06:59 -0700 Subject: [PATCH] [infra] Update base-builder image to support go-fuzz (#2714). (#2735) * [infra] Update base-builder image to support go-fuzz (#2714). * address review comments --- infra/base-images/base-builder/Dockerfile | 19 +++++++++++++++++++ projects/syzkaller/Dockerfile | 10 ---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/infra/base-images/base-builder/Dockerfile b/infra/base-images/base-builder/Dockerfile index 1aa4e6fe0ce1..87c3bb0983a6 100644 --- a/infra/base-images/base-builder/Dockerfile +++ b/infra/base-images/base-builder/Dockerfile @@ -27,6 +27,25 @@ RUN apt-get install -y git \ libblocksruntime-dev \ libc6-dev-i386 +# Download and install the latest stable Go. +ADD https://storage.googleapis.com/golang/getgo/installer_linux $SRC/ +RUN chmod +x $SRC/installer_linux && \ + SHELL="bash" $SRC/installer_linux && \ + rm $SRC/installer_linux + +# Set up Golang environment variables (copied from /root/.bash_profile). +ENV GOPATH /root/go + +# /root/.go/bin is for the standard Go binaries (i.e. go, gofmt, etc). +# $GOPATH/bin is for the binaries from the dependencies installed via "go get". +ENV PATH $PATH:/root/.go/bin:$GOPATH/bin + +# Dependency of go-fuzz. +RUN go get golang.org/x/tools/go/packages + +# go-fuzz-build is the tool that instruments Go files. +RUN go get github.com/dvyukov/go-fuzz/go-fuzz-build + # Default build flags for various sanitizers. ENV SANITIZER_FLAGS_address "-fsanitize=address -fsanitize-address-use-after-scope" diff --git a/projects/syzkaller/Dockerfile b/projects/syzkaller/Dockerfile index fb1e8e473c16..77bfde642730 100644 --- a/projects/syzkaller/Dockerfile +++ b/projects/syzkaller/Dockerfile @@ -16,19 +16,9 @@ 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/... -# Dependency of go-fuzz -RUN go get golang.org/x/tools/go/packages - -# go-fuzz-build is the tool that instruments Go files. -RUN go get github.com/dvyukov/go-fuzz/go-fuzz-build - # Dependency for one of the fuzz targets. RUN go get github.com/ianlancetaylor/demangle