Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools/docker/syzbot: follow best practices #5375

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 20 additions & 22 deletions tools/docker/syzbot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@

FROM debian:bookworm

RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y -q \
# Build essentials:
gcc g++ binutils make ccache \
# Some common utilities:
unzip curl sudo procps psmisc nano vim git bzip2 dh-autoreconf software-properties-common \
# These are needed to build Linux kernel:
flex bison bc gawk dwarves cpio texinfo texi2html lzop lbzip2 \
zlib1g-dev libelf-dev libncurses-dev libmpc-dev libssl-dev \
apt-transport-https curl gnupg python-is-python3 \
apt-transport-https gnupg python-is-python3 \
# Needed for building Cuttlefish images.
rsync libarchive-tools \
# Needed for buiding gVisor.
crossbuild-essential-amd64 crossbuild-essential-arm64 libbpf-dev
RUN test "$(uname -m)" != x86_64 && exit 0 || \
DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
RUN test "$(uname -m)" != x86_64 && exit 0 || apt-get install -y -q \
libc6-dev-i386 libc6-dev-i386-amd64-cross lib32gcc-12-dev lib32stdc++-12-dev \
# Cross-compilation:
g++-arm-linux-gnueabi g++-aarch64-linux-gnu g++-powerpc64le-linux-gnu \
Expand All @@ -30,22 +30,21 @@ RUN curl https://dl.google.com/go/go1.22.7.linux-$(uname -m | sed 's/aarch64/arm
ENV PATH /usr/local/go/bin:$PATH

# The default clang-14 is too old, install the latest one.
RUN apt-get install -y -q gnupg software-properties-common apt-transport-https
RUN curl https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
RUN add-apt-repository "deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-15 main"
RUN apt-get update --allow-releaseinfo-change
RUN apt-get install -y -q --no-install-recommends llvm-15 clang-15 clang-format-15 clang-tidy-15 lld-15
RUN apt autoremove -y -q
RUN sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100
RUN sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 100
RUN sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-15 100
RUN sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-15 100
RUN sudo update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/lld-15 100
RUN sudo update-alternatives --install /usr/bin/llvm-nm llvm-nm /usr/bin/llvm-nm-15 100
RUN sudo update-alternatives --install /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-15 100
RUN sudo update-alternatives --install /usr/bin/llvm-objcopy llvm-objcopy /usr/bin/llvm-objcopy-15 100
RUN sudo update-alternatives --install /usr/bin/llvm-objdump llvm-objdump /usr/bin/llvm-objdump-15 100
RUN sudo update-alternatives --install /usr/bin/llvm-addr2line llvm-addr2line /usr/bin/llvm-addr2line-15 100
RUN apt-get update --allow-releaseinfo-change \
&& apt-get install -y -q --no-install-recommends llvm-15 clang-15 clang-format-15 clang-tidy-15 lld-15 \
&& apt autoremove -y -q
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100 \
&& update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 100 \
&& update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-15 100 \
&& update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-15 100 \
&& update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/lld-15 100 \
&& update-alternatives --install /usr/bin/llvm-nm llvm-nm /usr/bin/llvm-nm-15 100 \
&& update-alternatives --install /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-15 100 \
&& update-alternatives --install /usr/bin/llvm-objcopy llvm-objcopy /usr/bin/llvm-objcopy-15 100 \
&& update-alternatives --install /usr/bin/llvm-objdump llvm-objdump /usr/bin/llvm-objdump-15 100 \
&& update-alternatives --install /usr/bin/llvm-addr2line llvm-addr2line /usr/bin/llvm-addr2line-15 100

# Not really GRTE, but it's enough to run some scripts that hardcode the path.
RUN mkdir -p /usr/grte/v5/bin && ln -s /usr/bin/python3 /usr/grte/v5/bin/python2.7
Expand All @@ -57,11 +56,10 @@ RUN sh -c 'curl -o /usr/local/bin/bazel https://releases.bazel.build/7.1.2/relea
# Install qemu from the backports.
# The currently stable version (7.4) cannot properly run arm64-MTE kernels.
RUN add-apt-repository "deb http://deb.debian.org/debian bookworm-backports main"
RUN DEBIAN_FRONTEND=noninteractive apt-get install -t bookworm-backports -y -q \
RUN apt-get update && apt-get install -t bookworm-backports -y -q \
# This is required to run alien arch binaries in pkg/cover tests:
qemu-user
RUN test "$(uname -m)" != x86_64 && exit 0 || \
DEBIAN_FRONTEND=noninteractive apt-get install -t bookworm-backports -y -q \
RUN test "$(uname -m)" != x86_64 && exit 0 || apt-get install -t bookworm-backports -y -q \
# These are required to run foreign arch kernels:
qemu-utils qemu-system-misc qemu-system-x86 qemu-system-arm qemu-system-aarch64 \
qemu-system-s390x qemu-system-mips qemu-system-ppc
Expand Down
Loading