Skip to content

infra: add support for custom LSAN_OPTIONS values #12275

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

Open
wants to merge 2 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
1 change: 1 addition & 0 deletions infra/base-images/base-runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ RUN git clone https://chromium.googlesource.com/chromium/src/tools/code_coverage
# shouldn't be changed unless a corresponding change is made on
# ClusterFuzz side as well.
ENV ASAN_OPTIONS="alloc_dealloc_mismatch=0:allocator_may_return_null=1:allocator_release_to_os_interval_ms=500:check_malloc_usable_size=0:detect_container_overflow=1:detect_odr_violation=0:detect_leaks=1:detect_stack_use_after_return=1:fast_unwind_on_fatal=0:handle_abort=1:handle_segv=1:handle_sigill=1:max_uar_stack_size_log=16:print_scariness=1:quarantine_size_mb=10:strict_memcmp=1:strip_path_prefix=/workspace/:symbolize=1:use_sigaltstack=1:dedup_token_length=3"
ENV LSAN_OPTIONS="max_leaks=0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I assign the default max_leaks value here to ensure that the LSAN_OPTIONS environment variable is defined when run_fuzzer runs.

This seems like the riskiest part of the PR because some scripts and fuzz targets may behave differently when LSAN_OPTIONS is always defined.

ENV MSAN_OPTIONS="print_stats=1:strip_path_prefix=/workspace/:symbolize=1:dedup_token_length=3"
ENV UBSAN_OPTIONS="print_stacktrace=1:print_summary=1:silence_unsigned_overflow=1:strip_path_prefix=/workspace/:symbolize=1:dedup_token_length=3"
ENV FUZZER_ARGS="-rss_limit_mb=2560 -timeout=25"
Expand Down
5 changes: 5 additions & 0 deletions infra/base-images/base-runner/run_fuzzer
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ if [ -f $OPTIONS_FILE ]; then
export ASAN_OPTIONS="$ASAN_OPTIONS:$custom_asan_options"
fi

custom_lsan_options=$(parse_options.py $OPTIONS_FILE lsan)
if [ ! -z $custom_lsan_options ]; then
export LSAN_OPTIONS="$LSAN_OPTIONS:$custom_lsan_options"
fi

custom_msan_options=$(parse_options.py $OPTIONS_FILE msan)
if [ ! -z $custom_msan_options ]; then
export MSAN_OPTIONS="$MSAN_OPTIONS:$custom_msan_options"
Expand Down
3 changes: 3 additions & 0 deletions projects/librsvg/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ cp target/x86_64-unknown-linux-gnu/release/render_document "$OUT/"
# Copy options files for fuzz targets
cp "$SRC"/*.options "$OUT/"

# Copy suppressions file for fuzz targets
cp "$SRC/librsvg/tools/lsan.supp" "$OUT/"

# Create dictionary files for fuzz targets
cat "$SRC/fuzzing/dictionaries/"{css,svg,xml}.dict > "$OUT/render_document.dict"

Expand Down
8 changes: 2 additions & 6 deletions projects/librsvg/render_document.options
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
[lsan]
# Suppress spurious leak reports:
# https://gnome.pages.gitlab.gnome.org/librsvg/devel-docs/memory_leaks.html

[asan]
detect_leaks = 0

[libfuzzer]
detect_leaks = 0
suppressions = lsan.supp
Loading