Bug 1592250 - Disable libFuzzer instrumentation in TSan builds. r=dmajor

Differential Revision: https://phabricator.services.mozilla.com/D50922

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Christian Holler 2019-10-29 14:03:40 +00:00
Родитель ab7587b94a
Коммит 4c144ccda1
2 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -2340,8 +2340,17 @@ add_old_configure_assignment('FUZZING_INTERFACES', enable_fuzzing_interfaces)
@depends(c_compiler.try_compile(flags=['-fsanitize=fuzzer-no-link'],
when=enable_fuzzing,
check_msg='whether the C compiler supports -fsanitize=fuzzer-no-link'))
def libfuzzer_flags(value):
check_msg='whether the C compiler supports -fsanitize=fuzzer-no-link'), tsan)
def libfuzzer_flags(value, tsan):
if tsan:
# With ThreadSanitizer, we should not use any libFuzzer instrumentation because
# it is incompatible (e.g. there are races on global sanitizer coverage counters).
# Instead we use an empty set of flags here but still build the fuzzing targets.
# With this setup, we can still run files through these targets in TSan builds,
# e.g. those obtained from regular fuzzing.
# This code can be removed once libFuzzer has been made compatible with TSan.
return namespace(no_link_flag_supported=False, use_flags=[])
if value:
no_link_flag_supported = True
# recommended for (and only supported by) clang >= 6

Просмотреть файл

@ -67,6 +67,7 @@ endif
rustflags_sancov =
ifdef FUZZING_INTERFACES
ifndef MOZ_TSAN
# These options should match what is implicitly enabled for `clang -fsanitize=fuzzer`
# here: https://github.com/llvm/llvm-project/blob/release/8.x/clang/lib/Driver/SanitizerArgs.cpp#L354
#
@ -74,8 +75,11 @@ ifdef FUZZING_INTERFACES
# -sanitizer-coverage-level=4 Enable coverage for all blocks, critical edges, and indirect calls.
# -sanitizer-coverage-trace-compares Tracing of CMP and similar instructions.
# -sanitizer-coverage-pc-table Create a static PC table.
#
# In TSan builds, we must not pass any of these, because sanitizer coverage is incompatible with TSan.
rustflags_sancov += -Cpasses=sancov -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-trace-compares -Cllvm-args=-sanitizer-coverage-pc-table
endif
endif
rustflags_override = $(MOZ_RUST_DEFAULT_FLAGS) $(rustflags_neon)