tools/docker: add old-env

old-env is based on Ubuntu 16.04 and allows to test
executor build on older distributions.

Fixes #2055
This commit is contained in:
Dmitry Vyukov 2020-08-22 17:48:23 +02:00
parent 49a5a1ab2f
commit df5c8fa25f
7 changed files with 81 additions and 7 deletions

View File

@ -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]

View File

@ -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 ./...

View File

@ -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;

View File

@ -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;

View File

@ -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"]

View File

@ -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.

1
tools/syz-old-env Symbolic link
View File

@ -0,0 +1 @@
syz-env