github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/tools/docker/syzbot/Dockerfile (about)

     1  # Copyright 2021 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  # See /tools/docker/README.md for details.
     5  
     6  FROM debian:bookworm
     7  
     8  RUN apt-get update
     9  RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
    10  	# Build essentials:
    11  	gcc g++ binutils make ccache \
    12  	# Some common utilities:
    13  	unzip curl sudo procps psmisc nano vim git bzip2 dh-autoreconf software-properties-common \
    14  	# These are needed to build Linux kernel:
    15  	flex bison bc gawk dwarves cpio texinfo texi2html lzop lbzip2 \
    16  	zlib1g-dev libelf-dev libncurses-dev libmpc-dev libssl-dev \
    17  	apt-transport-https curl gnupg python-is-python3 \
    18  	# Needed for building Cuttlefish images.
    19  	rsync libarchive-tools \
    20  	# Needed for buiding gVisor.
    21  	crossbuild-essential-amd64 crossbuild-essential-arm64 libbpf-dev
    22  RUN test "$(uname -m)" != x86_64 && exit 0 || \
    23          DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
    24  	  libc6-dev-i386 libc6-dev-i386-amd64-cross lib32gcc-12-dev lib32stdc++-12-dev \
    25  	  # Cross-compilation:
    26  	  g++-arm-linux-gnueabi g++-aarch64-linux-gnu g++-powerpc64le-linux-gnu \
    27  	  g++-mips64el-linux-gnuabi64 g++-s390x-linux-gnu g++-riscv64-linux-gnu
    28  
    29  RUN curl https://dl.google.com/go/go1.21.4.linux-$(uname -m | sed 's/aarch64/arm64/;s/x86_64/amd64/').tar.gz | tar -C /usr/local -xz
    30  ENV PATH /usr/local/go/bin:$PATH
    31  
    32  # The default clang-14 is too old, install the latest one.
    33  RUN apt-get install -y -q gnupg software-properties-common apt-transport-https
    34  RUN curl https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
    35  RUN add-apt-repository "deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-15 main"
    36  RUN apt-get update --allow-releaseinfo-change
    37  RUN apt-get install -y -q --no-install-recommends llvm-15 clang-15 clang-format-15 clang-tidy-15 lld-15
    38  RUN apt autoremove -y -q
    39  RUN sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100
    40  RUN sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 100
    41  RUN sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-15 100
    42  RUN sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-15 100
    43  RUN sudo update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/lld-15 100
    44  RUN sudo update-alternatives --install /usr/bin/llvm-nm llvm-nm /usr/bin/llvm-nm-15 100
    45  RUN sudo update-alternatives --install /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-15 100
    46  RUN sudo update-alternatives --install /usr/bin/llvm-objcopy llvm-objcopy /usr/bin/llvm-objcopy-15 100
    47  RUN sudo update-alternatives --install /usr/bin/llvm-objdump llvm-objdump /usr/bin/llvm-objdump-15 100
    48  RUN sudo update-alternatives --install /usr/bin/llvm-addr2line llvm-addr2line /usr/bin/llvm-addr2line-15 100
    49  
    50  # Not really GRTE, but it's enough to run some scripts that hardcode the path.
    51  RUN mkdir -p /usr/grte/v5/bin && ln -s /usr/bin/python3 /usr/grte/v5/bin/python2.7
    52  
    53  # Install bazel
    54  # Download the official bazel binary. The APT repository isn't used because there is not packages for arm64.
    55  RUN sh -c 'curl -o /usr/local/bin/bazel https://releases.bazel.build/7.1.2/release/bazel-7.1.2-linux-$(uname -m | sed s/aarch64/arm64/) && chmod ugo+x /usr/local/bin/bazel'
    56  
    57  # Install qemu from the backports.
    58  # The currently stable version (7.4) cannot properly run arm64-MTE kernels.
    59  RUN add-apt-repository "deb http://deb.debian.org/debian bookworm-backports main"
    60  RUN DEBIAN_FRONTEND=noninteractive apt-get install -t bookworm-backports -y -q \
    61  # This is required to run alien arch binaries in pkg/cover tests:
    62  	qemu-user
    63  RUN test "$(uname -m)" != x86_64 && exit 0 || \
    64      DEBIAN_FRONTEND=noninteractive apt-get install -t bookworm-backports -y -q \
    65      # These are required to run foreign arch kernels:
    66      qemu-utils qemu-system-misc qemu-system-x86 qemu-system-arm qemu-system-aarch64  \
    67      qemu-system-s390x qemu-system-mips qemu-system-ppc
    68  
    69  # pkg/osutil uses syzkaller user for sandboxing.
    70  RUN useradd --create-home syzkaller
    71  RUN echo "export PS1='\n\W🤖 '" >> /root/.bashrc