Skip to content

Commit 4454b1c

Browse files
committed
refactor(config): Align ubuntu-24-04 images with legacy setup
This change standardizes the Ubuntu 24.04 image configurations to ensure they only update the base OS version, without altering tool versions or core logic, maintaining consistency with the legacy images. Key changes include: - Reverted AFL++ installation to the legacy version in the base-builder. - Synchronized the honggfuzz precompilation script. - Added missing ccache, patchelf, and other configurations to the base-builder Dockerfile. - Removed redundant Fuzz Introspector installation and aligned CFLAGS in the base-clang Dockerfile. - Removed Python dependency version upgrades from the fuzzbench image setup.
1 parent 0370e8f commit 4454b1c

File tree

4 files changed

+37
-16
lines changed

4 files changed

+37
-16
lines changed

infra/base-images/base-builder-fuzzbench/fuzzbench_install_dependencies_ubuntu_24_04

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ else
2121
apt-get update && apt-get install -y gcc gfortran python3-dev libopenblas-dev liblapack-dev cython3 libpq-dev
2222
fi
2323
wget -O /tmp/requirements.txt https://raw.githubusercontent.com/google/fuzzbench/master/requirements.txt
24-
sed -i 's/pytype==2022.10.13/pytype==2024.4.11/' /tmp/requirements.txt
25-
sed -i 's/Orange3==3.33.0/Orange3==3.39.0/' /tmp/requirements.txt
2624
pip3 install pip --upgrade
2725
CFLAGS= CXXFLAGS= pip3 install -r /tmp/requirements.txt
2826
rm /tmp/requirements.txt

infra/base-images/base-builder/precompile_honggfuzz_ubuntu_24_04

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -eu
1+
#!/bin/bash -eux
22
# Copyright 2019 Google Inc.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,7 +33,8 @@ make clean
3333
# These CFLAGs match honggfuzz's default, with the exception of -mtune to
3434
# improve portability and `-D_HF_LINUX_NO_BFD` to remove assembly instructions
3535
# from the filenames.
36-
CC=clang CFLAGS="-O3 -funroll-loops -D_HF_LINUX_NO_BFD -fPIE" LDFLAGS="-no-pie" make
36+
sed -i 's/-Werror//g' Makefile
37+
CC=clang CFLAGS="-O3 -funroll-loops -D_HF_LINUX_NO_BFD -Wno-unterminated-string-initialization -Wno-error" make
3738

3839
# libhfuzz.a will be added by CC/CXX linker directly during linking,
3940
# but it's defined here to satisfy the build infrastructure
@@ -42,4 +43,4 @@ popd > /dev/null
4243

4344
apt-get remove -y --purge ${PACKAGES[@]}
4445
apt-get autoremove -y
45-
echo "Done."
46+
echo "Done."

infra/base-images/base-builder/ubuntu-24-04.Dockerfile

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,12 @@ ENV FUZZER_LDFLAGS ""
122122

123123
WORKDIR $SRC
124124

125+
COPY afl_llvm22_patch.diff $SRC/
125126
RUN git clone https://github.com/AFLplusplus/AFLplusplus.git aflplusplus && \
126127
cd aflplusplus && \
127-
git checkout daaefcddc063b356018c29027494a00bcfc3e240 && \
128+
git checkout eadc8a2a7e0fa0338802ee6254bf296489ce4fd7 && \
128129
wget --no-check-certificate -O oss.sh https://raw.githubusercontent.com/vanhauser-thc/binary_blobs/master/oss.sh && \
130+
git apply $SRC/afl_llvm22_patch.diff && \
129131
rm -rf .git && \
130132
chmod 755 oss.sh
131133

@@ -198,4 +200,33 @@ COPY indexer /opt/indexer
198200
COPY --from=gcr.io/oss-fuzz-base/indexer /indexer/build/indexer /opt/indexer/indexer
199201
RUN chmod a+x /opt/indexer/indexer /opt/indexer/index_build.py
200202

203+
COPY llvmsymbol.diff $SRC
204+
COPY detect_repo.py /opt/cifuzz/
205+
COPY bazel.bazelrc /root/.bazelrc
206+
207+
# Set up ccache binary and cache directory.
208+
# /ccache/bin will contain the compiler wrappers, and /ccache/cache will
209+
# contain the actual cache, which can be saved.
210+
# To use this, set PATH=/ccache/bin:$PATH.
211+
RUN mkdir -p /ccache/bin && mkdir -p /ccache/cache && \
212+
ln -s /usr/local/bin/ccache /ccache/bin/clang && \
213+
ln -s /usr/local/bin/ccache /ccache/bin/clang++ && \
214+
ln -s /usr/local/bin/ccache /ccache/bin/clang-jcc && \
215+
ln -s /usr/local/bin/ccache /ccache/bin/clang++-jcc
216+
ENV CCACHE_DIR /ccache/cache
217+
218+
# Don't check that the compiler is the same, so we can switch between jcc and
219+
# clang under the hood and re-use the same build cache.
220+
ENV CCACHE_COMPILERCHECK none
221+
ENV CCACHE_COMPILERTYPE clang
222+
223+
# Build newer patchelf than the one available from Ubuntu.
224+
RUN cd /tmp && git clone https://github.com/NixOS/patchelf && \
225+
apt-get update && apt-get install -y autoconf && \
226+
cd patchelf && git checkout 523f401584d9584e76c9c77004e7abeb9e6c4551 && \
227+
unset CFLAGS && export CXXFLAGS='-stdlib=libc++' && export LDFLAGS='-lpthread' && \
228+
./bootstrap.sh && ./configure && make && \
229+
cp /tmp/patchelf/src/patchelf /usr/local/bin && \
230+
rm -rf /tmp/patchelf && apt-get remove -y autoconf
231+
201232
CMD ["compile"]

infra/base-images/base-clang/ubuntu-24-04.Dockerfile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@ RUN apt-get update && apt-get install -y wget sudo && \
3333
SUDO_FORCE_REMOVE=yes apt-get autoremove --purge -y wget sudo && \
3434
rm -rf /usr/local/doc/cmake /usr/local/bin/cmake-gui
3535

36-
RUN apt-get update && apt-get install -y git && \
37-
git clone https://github.com/ossf/fuzz-introspector.git fuzz-introspector && \
38-
cd fuzz-introspector && \
39-
git checkout 332d674f00b8abc4c9ebf10e9c42e5b72b331c63 && \
40-
git submodule init && \
41-
git submodule update && \
42-
apt-get autoremove --purge -y git && \
43-
rm -rf .git
44-
4536
COPY checkout_build_install_llvm_ubuntu_24_04.sh /root/
4637
RUN chmod +x /root/checkout_build_install_llvm_ubuntu_24_04.sh
4738
# Keep all steps in the same script to decrease the number of intermediate
@@ -68,12 +59,12 @@ ENV CCC "clang++"
6859
ENV CFLAGS -O1 \
6960
-fno-omit-frame-pointer \
7061
-gline-tables-only \
71-
-Wno-error=enum-constexpr-conversion \
7262
-Wno-error=incompatible-function-pointer-types \
7363
-Wno-error=int-conversion \
7464
-Wno-error=deprecated-declarations \
7565
-Wno-error=implicit-function-declaration \
7666
-Wno-error=implicit-int \
67+
-Wno-error=unknown-warning-option \
7768
-Wno-error=vla-cxx-extension \
7869
-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
7970
ENV CXXFLAGS_EXTRA "-stdlib=libc++"

0 commit comments

Comments
 (0)