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

Update libfuzzer to LLVM 18 #2035

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
15 changes: 12 additions & 3 deletions fuzzers/libfuzzer/builder.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,21 @@
ARG parent_image
FROM $parent_image

# Install dependencies.
RUN apt-get update && \
apt-get remove -y llvm-* clang-* && \
apt-get install -y \
build-essential \
lsb-release wget software-properties-common gnupg && \
wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh 18
Copy link
Contributor

@tokatoka tokatoka Aug 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will install binaries into /usr/bin but won't make /usr/bin/clang point to /usr/bin/clang-18

so if you run clang after the install, then the older one, if it exists, will still be used
to fix this you need something like this https://gist.github.com/tokatoka/26f4ba95991c6e33139999976332aa8e or use update-alternative (since this is ubuntu


RUN git clone https://github.com/llvm/llvm-project.git /llvm-project && \
cd /llvm-project && \
git checkout 5cda4dc7b4d28fcd11307d4234c513ff779a1c6f && \
cd compiler-rt/lib/fuzzer && \
git checkout 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff

RUN cd /llvm-project/compiler-rt/lib/fuzzer && \
(for f in *.cpp; do \
clang++ -stdlib=libc++ -fPIC -O2 -std=c++11 $f -c & \
clang++ -stdlib=libc++ -fPIC -O2 -std=c++17 $f -c & \
done && wait) && \
ar r libFuzzer.a *.o && \
cp libFuzzer.a /usr/lib
5 changes: 5 additions & 0 deletions fuzzers/libfuzzer/fuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ def run_fuzzer(input_corpus, output_corpus, target_binary, extra_flags=None):
os.makedirs(crashes_dir)
os.makedirs(output_corpus)

if 'ASAN_OPTIONS' in os.environ:
os.environ['ASAN_OPTIONS'] += ':detect_container_overflow=0'
else:
os.environ['ASAN_OPTIONS'] = 'detect_container_overflow=0'

# Enable symbolization if needed.
# Note: if the flags are like `symbolize=0:..:symbolize=1` then
# only symbolize=1 is respected.
Expand Down
100 changes: 0 additions & 100 deletions fuzzers/libfuzzer/patch.diff

This file was deleted.

Loading