• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# This Dockerfile for AFLplusplus uses Ubuntu 22.04 jammy and
3# installs LLVM 14 for afl-clang-lto support :-)
4#
5
6FROM ubuntu:22.04 AS aflplusplus
7LABEL "maintainer"="afl++ team <afl@aflplus.plus>"
8LABEL "about"="AFLplusplus docker image"
9
10ARG DEBIAN_FRONTEND=noninteractive
11
12env NO_ARCH_OPT 1
13
14RUN apt-get update && \
15    apt-get -y install --no-install-suggests --no-install-recommends \
16    automake \
17    cmake \
18    meson \
19    ninja-build \
20    bison flex \
21    build-essential \
22    git \
23    python3 python3-dev python3-setuptools python-is-python3 \
24    libtool libtool-bin \
25    libglib2.0-dev \
26    wget vim jupp nano bash-completion less \
27    apt-utils apt-transport-https ca-certificates gnupg dialog \
28    libpixman-1-dev \
29    gnuplot-nox \
30    && rm -rf /var/lib/apt/lists/*
31
32# TODO: reactivate in timely manner
33#RUN echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" >> /etc/apt/sources.list && \
34#    wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
35
36RUN echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu jammy main" >> /etc/apt/sources.list && \
37    apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 1E9377A2BA9EF27F
38
39RUN apt-get update && apt-get full-upgrade -y && \
40    apt-get -y install --no-install-suggests --no-install-recommends \
41    gcc-12 g++-12 gcc-12-plugin-dev gdb lcov \
42    clang-14 clang-tools-14 libc++1-14 libc++-14-dev \
43    libc++abi1-14 libc++abi-14-dev libclang1-14 libclang-14-dev \
44    libclang-common-14-dev libclang-cpp14 libclang-cpp14-dev liblld-14 \
45    liblld-14-dev liblldb-14 liblldb-14-dev libllvm14 libomp-14-dev \
46    libomp5-14 lld-14 lldb-14 llvm-14 llvm-14-dev llvm-14-runtime llvm-14-tools
47
48# arm64 doesn't have gcc-multilib, and it's only used for -m32 support on x86
49ARG TARGETPLATFORM
50RUN [ "$TARGETPLATFORM" = "linux/amd64" ] && \
51    apt-get -y install --no-install-suggests --no-install-recommends \
52    gcc-10-multilib gcc-multilib || true
53
54RUN rm -rf /var/lib/apt/lists/*
55
56RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 0
57RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 0
58
59ENV LLVM_CONFIG=llvm-config-14
60ENV AFL_SKIP_CPUFREQ=1
61ENV AFL_TRY_AFFINITY=1
62ENV AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1
63
64RUN git clone --depth=1 https://github.com/vanhauser-thc/afl-cov /afl-cov
65RUN cd /afl-cov && make install && cd ..
66
67COPY . /AFLplusplus
68WORKDIR /AFLplusplus
69
70RUN export CC=gcc-12 && export CXX=g++-12 && make clean && \
71    make distrib && make install && make clean
72
73RUN sh -c 'echo set encoding=utf-8 > /root/.vimrc'
74RUN echo '. /etc/bash_completion' >> ~/.bashrc
75RUN echo 'alias joe="joe --wordwrap --joe_state -nobackup"' >> ~/.bashrc
76RUN echo "export PS1='"'[afl++ \h] \w$(__git_ps1) \$ '"'" >> ~/.bashrc
77ENV IS_DOCKER="1"
78
79# Disabled as there are now better alternatives
80#COPY --from=aflplusplus/afl-dyninst /usr/local/lib/libdyninstAPI_RT.so /usr/local/lib/libdyninstAPI_RT.so
81#COPY --from=aflplusplus/afl-dyninst /afl-dyninst/libAflDyninst.so /usr/local/lib/libAflDyninst.so
82