aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-08-22 17:48:23 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-08-22 21:42:13 +0200
commitdf5c8fa25ff3ed977df7bc12ac25b1e6b8ef2b21 (patch)
tree89291e396fea9518de14487c98ca4d4245828e26
parent49a5a1ab2f94353aa29edebdabc9eda5b168020b (diff)
tools/docker: add old-env
old-env is based on Ubuntu 16.04 and allows to test executor build on older distributions. Fixes #2055
-rw-r--r--.github/workflows/ci.yml17
-rw-r--r--Makefile13
-rw-r--r--executor/common_linux.h2
-rw-r--r--pkg/csource/generated.go2
-rw-r--r--tools/docker/old-env/Dockerfile51
-rwxr-xr-xtools/syz-env2
l---------tools/syz-old-env1
7 files changed, 81 insertions, 7 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index aab76bb79..d1cdda31b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -41,7 +41,6 @@ jobs:
flags: unittests
dashboard:
runs-on: ubuntu-latest
- needs: [smoke]
steps:
- name: checkout
uses: actions/checkout@v2
@@ -61,7 +60,6 @@ jobs:
flags: dashboard
arch:
runs-on: ubuntu-latest
- needs: [smoke]
steps:
- name: checkout
uses: actions/checkout@v2
@@ -76,7 +74,6 @@ jobs:
run: gopath/src/github.com/google/syzkaller/.github/workflows/run.sh syz-big-env make presubmit_arch
race:
runs-on: ubuntu-latest
- needs: [smoke]
steps:
- name: checkout
uses: actions/checkout@v2
@@ -89,6 +86,20 @@ jobs:
key: cache
- name: run
run: gopath/src/github.com/google/syzkaller/.github/workflows/run.sh syz-env make presubmit_race
+ old:
+ runs-on: ubuntu-latest
+ 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 syz-old-env make presubmit_old
fuzzit:
runs-on: ubuntu-latest
needs: [smoke]
diff --git a/Makefile b/Makefile
index bf3f11276..56102c65d 100644
--- a/Makefile
+++ b/Makefile
@@ -94,7 +94,7 @@ ifeq ("$(TARGETOS)", "trusty")
TARGETGOARCH := $(HOSTARCH)
endif
-.PHONY: all host target \
+.PHONY: all clean host target \
manager runtest fuzzer executor \
ci hub \
execprog mutate prog2c trace2syz stress repro upgrade db \
@@ -103,7 +103,7 @@ endif
extract generate generate_go generate_sys \
format format_go format_cpp format_sys \
tidy test test_race check_copyright check_language check_links check_diff check_commits \
- presubmit presubmit_parallel clean
+ presubmit presubmit_smoke presubmit_build presubmit_arch presubmit_big presubmit_race presubmit_old
all: host target
host: manager runtest repro mutate prog2c db upgrade
@@ -315,6 +315,15 @@ presubmit_race: descriptions
env CGO_ENABLED=1 $(GO) test -race -short -bench=.* -benchtime=.2s ./... ;\
fi
+presubmit_old: descriptions
+ # Binaries we can compile in syz-old-env. 386 is broken, riscv64 is missing.
+ TARGETARCH=amd64 $(MAKE) target
+ TARGETARCH=arm64 $(MAKE) target
+ TARGETARCH=arm $(MAKE) target
+ TARGETARCH=ppc64le $(MAKE) target
+ TARGETARCH=mips64le $(MAKE) target
+ TARGETARCH=s390x $(MAKE) target
+
test: descriptions
$(GO) test -short -coverprofile=.coverage.txt ./...
diff --git a/executor/common_linux.h b/executor/common_linux.h
index 244707191..68be3eeff 100644
--- a/executor/common_linux.h
+++ b/executor/common_linux.h
@@ -864,7 +864,7 @@ static void netlink_wireguard_setup(void)
.sin6_port = htons(listen_c)};
endpoint_c_v6.sin6_addr = in6addr_loopback;
const struct in_addr first_half_v4 = {0};
- const struct in_addr second_half_v4 = {htonl(128 << 24)};
+ const struct in_addr second_half_v4 = {(uint32)htonl(128 << 24)};
const struct in6_addr first_half_v6 = {{{0}}};
const struct in6_addr second_half_v6 = {{{0x80}}};
const uint8 half_cidr = 1;
diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go
index fae8005ae..867cfa183 100644
--- a/pkg/csource/generated.go
+++ b/pkg/csource/generated.go
@@ -3062,7 +3062,7 @@ static void netlink_wireguard_setup(void)
.sin6_port = htons(listen_c)};
endpoint_c_v6.sin6_addr = in6addr_loopback;
const struct in_addr first_half_v4 = {0};
- const struct in_addr second_half_v4 = {htonl(128 << 24)};
+ const struct in_addr second_half_v4 = {(uint32)htonl(128 << 24)};
const struct in6_addr first_half_v6 = {{{0}}};
const struct in6_addr second_half_v6 = {{{0x80}}};
const uint8 half_cidr = 1;
diff --git a/tools/docker/old-env/Dockerfile b/tools/docker/old-env/Dockerfile
new file mode 100644
index 000000000..1d87853aa
--- /dev/null
+++ b/tools/docker/old-env/Dockerfile
@@ -0,0 +1,51 @@
+# 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.
+
+# The image provides dev environment suitable for syzkaller development/testing.
+# It includes Go toolchain and C/C++ cross-compilers.
+
+# The image is available as gcr.io/syzkaller/old-env.
+
+# To download and run locally:
+# docker pull gcr.io/syzkaller/old-env
+# docker run -it gcr.io/syzkaller/old-env
+
+# To build and push new version:
+# docker build -t gcr.io/syzkaller/old-env tools/docker/old-env
+# gcloud auth login && gcloud auth configure-docker
+# docker push gcr.io/syzkaller/old-env
+
+FROM ubuntu:16.04
+
+LABEL homepage="https://github.com/google/syzkaller"
+
+RUN dpkg --add-architecture i386 && \
+ apt-get update && \
+ DEBIAN_FRONTEND=noninteractive apt-get install -y -q --no-install-recommends \
+ sudo make nano git curl ca-certificates g++ \
+ g++-arm-linux-gnueabi g++-aarch64-linux-gnu g++-powerpc64le-linux-gnu \
+ g++-mips64el-linux-gnuabi64 g++-s390x-linux-gnu \
+ linux-libc-dev:i386 lib32gcc-5-dev lib32stdc++-5-dev \
+ && \
+ apt-get -y autoremove && \
+ apt-get clean autoclean && \
+ rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
+
+RUN curl https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz | tar -C /usr/local -xz
+ENV PATH /usr/local/go/bin:/gopath/bin:$PATH
+ENV GOPATH /gopath
+
+# Pre-create dirs for syz-env.
+# This is necessary to make docker work with the current user,
+# otherwise --volume will create these dirs under root and then
+# the current user won't have access to them.
+RUN mkdir -p /syzkaller/gopath/src/github.com/google/syzkaller && \
+ mkdir -p /syzkaller/.cache && \
+ chmod -R 0777 /syzkaller
+
+# The default Docker prompt is too ugly and takes the whole line:
+# I have no name!@0f3331d2fb54:~/gopath/src/github.com/google/syzkaller$
+RUN echo "export PS1='syz-old-env⌛ '" > /syzkaller/.bashrc
+ENV SYZ_OLD_ENV yes
+
+ENTRYPOINT ["bash"]
diff --git a/tools/syz-env b/tools/syz-env
index 07cc32186..11e24e424 100755
--- a/tools/syz-env
+++ b/tools/syz-env
@@ -50,6 +50,8 @@ SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)"
IMAGE="env"
if [ "$(basename -- "$0")" == "syz-big-env" ]; then
IMAGE="big-env"
+elif [ "$(basename -- "$0")" == "syz-old-env" ]; then
+ IMAGE="old-env"
fi
# Run everything as the host user, this is important for created/modified files.
diff --git a/tools/syz-old-env b/tools/syz-old-env
new file mode 120000
index 000000000..f0d710eb1
--- /dev/null
+++ b/tools/syz-old-env
@@ -0,0 +1 @@
+syz-env \ No newline at end of file