| Index: build/config/sanitizers/sanitizers.gni
|
| diff --git a/build/config/sanitizers/sanitizers.gni b/build/config/sanitizers/sanitizers.gni
|
| index 40ffb94d09885f6b6ed056860db472e0bc186bfe..931139248ae5fbf1863b93f18c8a164924f4877f 100644
|
| --- a/build/config/sanitizers/sanitizers.gni
|
| +++ b/build/config/sanitizers/sanitizers.gni
|
| @@ -2,144 +2,148 @@
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| -declare_args() {
|
| - # Compile for Address Sanitizer to find memory bugs.
|
| +if (current_toolchain == default_toolchain) {
|
| + declare_args() {
|
| + # Compile for Address Sanitizer to find memory bugs.
|
| + is_asan = false
|
| +
|
| + # Compile for Leak Sanitizer to find leaks.
|
| + is_lsan = false
|
| +
|
| + # Compile for Memory Sanitizer to find uninitialized reads.
|
| + is_msan = false
|
| +
|
| + # Compile for Thread Sanitizer to find threading bugs.
|
| + is_tsan = false
|
| +
|
| + # Compile for Undefined Behaviour Sanitizer to find various types of
|
| + # undefined behaviour (excludes vptr checks).
|
| + is_ubsan = false
|
| +
|
| + # Halt the program if a problem is detected.
|
| + is_ubsan_no_recover = false
|
| +
|
| + # Compile for Undefined Behaviour Sanitizer's null pointer checks.
|
| + is_ubsan_null = false
|
| +
|
| + # Compile for Undefined Behaviour Sanitizer's vptr checks.
|
| + is_ubsan_vptr = false
|
| +
|
| + # Track where uninitialized memory originates from. From fastest to slowest:
|
| + # 0 - no tracking, 1 - track only the initial allocation site, 2 - track the
|
| + # chain of stores leading from allocation site to use site.
|
| + msan_track_origins = 2
|
| +
|
| + # Use dynamic libraries instrumented by one of the sanitizers instead of the
|
| + # standard system libraries. Set this flag to download prebuilt binaries
|
| + # from GCS.
|
| + use_prebuilt_instrumented_libraries = false
|
| +
|
| + # Use dynamic libraries instrumented by one of the sanitizers instead of the
|
| + # standard system libraries. Set this flag to build the libraries from
|
| + # source.
|
| + use_locally_built_instrumented_libraries = false
|
| +
|
| + # Enable building with SyzyAsan which can find certain types of memory
|
| + # errors. Only works on Windows. See
|
| + # https://github.com/google/syzygy/wiki/SyzyASanHowTo
|
| + is_syzyasan = false
|
| +
|
| + # Compile with Control Flow Integrity to protect virtual calls and casts.
|
| + # See http://clang.llvm.org/docs/ControlFlowIntegrity.html
|
| + #
|
| + # TODO(pcc): Remove this flag if/when CFI is enabled in official builds.
|
| + is_cfi = false
|
| +
|
| + # Enable checks for bad casts: derived cast and unrelated cast.
|
| + # TODO(krasin): remove this when we're ready to add these checks by default.
|
| + # https://crbug.com/626794
|
| + use_cfi_cast = false
|
| +
|
| + # By default, Control Flow Integrity will crash the program if it detects a
|
| + # violation. Set this to true to print detailed diagnostics instead.
|
| + use_cfi_diag = false
|
| +
|
| + # Compile for fuzzing with LLVM LibFuzzer.
|
| + # See http://www.chromium.org/developers/testing/libfuzzer
|
| + use_libfuzzer = false
|
| +
|
| + # Compile for fuzzing with AFL.
|
| + use_afl = false
|
| +
|
| + # Enables core ubsan security features. Will later be removed once it
|
| + # matches is_ubsan.
|
| + is_ubsan_security = false
|
| +
|
| + # Compile for fuzzing with Dr. Fuzz
|
| + # See http://www.chromium.org/developers/testing/dr-fuzz
|
| + use_drfuzz = false
|
| +
|
| + # Helper variable for testing builds with disabled libfuzzer.
|
| + # Not for client use.
|
| + disable_libfuzzer = false
|
| +
|
| + # Value for -fsanitize-coverage flag. Setting this causes
|
| + # use_sanitizer_coverage to be enabled.
|
| + # Default value when unset and use_afl=true:
|
| + # trace-pc
|
| + # Default value when unset and use_sanitizer_coverage=true:
|
| + # edge,indirect-calls,8bit-counters
|
| + sanitizer_coverage_flags = ""
|
| + }
|
| +
|
| + # Args that are in turn dependent on other args must be in a separate
|
| + # declare_args block. User overrides are only applied at the end of a
|
| + # declare_args block.
|
| + declare_args() {
|
| + # Use libc++ (buildtools/third_party/libc++ and
|
| + # buildtools/third_party/libc++abi) instead of stdlibc++ as standard
|
| + # library. This is intended to be used for instrumented builds.
|
| + use_custom_libcxx =
|
| + (is_asan && is_linux && !is_chromeos) || is_tsan || is_msan ||
|
| + is_ubsan || is_ubsan_security || use_libfuzzer || use_afl
|
| +
|
| + # Enable -fsanitize-coverage.
|
| + use_sanitizer_coverage =
|
| + use_libfuzzer || use_afl || sanitizer_coverage_flags != ""
|
| +
|
| + # Detect overflow/underflow for global objects.
|
| + #
|
| + # Android build relies on -Wl,--gc-sections removing unreachable code.
|
| + # ASan instrumentation for globals inhibits this and results in a
|
| + # library with unresolvable relocations.
|
| + # TODO(eugenis): find a way to reenable this.
|
| + #
|
| + # Mac: http://crbug.com/352073
|
| + asan_globals = !is_android && !is_mac
|
| + }
|
| +} else {
|
| + # Disable sanitizers for non-default toolchains.
|
| is_asan = false
|
| -
|
| - # Compile for Leak Sanitizer to find leaks.
|
| is_lsan = false
|
| -
|
| - # Compile for Memory Sanitizer to find uninitialized reads.
|
| is_msan = false
|
| -
|
| - # Compile for Thread Sanitizer to find threading bugs.
|
| + is_syzyasan = false
|
| is_tsan = false
|
| -
|
| - # Compile for Undefined Behaviour Sanitizer to find various types of
|
| - # undefined behaviour (excludes vptr checks).
|
| is_ubsan = false
|
| -
|
| - # Halt the program if a problem is detected.
|
| is_ubsan_no_recover = false
|
| -
|
| - # Compile for Undefined Behaviour Sanitizer's null pointer checks.
|
| is_ubsan_null = false
|
| -
|
| - # Compile for Undefined Behaviour Sanitizer's vptr checks.
|
| is_ubsan_vptr = false
|
| -
|
| - # Track where uninitialized memory originates from. From fastest to slowest:
|
| - # 0 - no tracking, 1 - track only the initial allocation site, 2 - track the
|
| - # chain of stores leading from allocation site to use site.
|
| - msan_track_origins = 2
|
| -
|
| - # Use dynamic libraries instrumented by one of the sanitizers instead of the
|
| - # standard system libraries. Set this flag to download prebuilt binaries from
|
| - # GCS.
|
| + msan_track_origins = 0
|
| use_prebuilt_instrumented_libraries = false
|
| -
|
| - # Use dynamic libraries instrumented by one of the sanitizers instead of the
|
| - # standard system libraries. Set this flag to build the libraries from source.
|
| use_locally_built_instrumented_libraries = false
|
| -
|
| - # Enable building with SyzyAsan which can find certain types of memory
|
| - # errors. Only works on Windows. See
|
| - # https://github.com/google/syzygy/wiki/SyzyASanHowTo
|
| - is_syzyasan = false
|
| -
|
| - # Compile with Control Flow Integrity to protect virtual calls and casts.
|
| - # See http://clang.llvm.org/docs/ControlFlowIntegrity.html
|
| - #
|
| - # TODO(pcc): Remove this flag if/when CFI is enabled in official builds.
|
| is_cfi = false
|
| -
|
| - # Enable checks for bad casts: derived cast and unrelated cast.
|
| - # TODO(krasin): remove this, when we're ready to add these checks by default.
|
| - # https://crbug.com/626794
|
| use_cfi_cast = false
|
| -
|
| - # By default, Control Flow Integrity will crash the program if it detects a
|
| - # violation. Set this to true to print detailed diagnostics instead.
|
| use_cfi_diag = false
|
| -
|
| - # Compile for fuzzing with LLVM LibFuzzer.
|
| - # See http://www.chromium.org/developers/testing/libfuzzer
|
| use_libfuzzer = false
|
| -
|
| - # Compile for fuzzing with AFL.
|
| use_afl = false
|
| -
|
| - # Enables core ubsan security features. Will later be removed once it matches
|
| - # is_ubsan.
|
| is_ubsan_security = false
|
| -
|
| - # Compile for fuzzing with Dr. Fuzz
|
| - # See http://www.chromium.org/developers/testing/dr-fuzz
|
| use_drfuzz = false
|
| -
|
| - # Helper variable for testing builds with disabled libfuzzer.
|
| - # Not for client use.
|
| disable_libfuzzer = false
|
| -
|
| - # Value for -fsanitize-coverage flag. Setting this causes
|
| - # use_sanitizer_coverage to be enabled.
|
| - # Default value when unset and use_afl=true:
|
| - # trace-pc
|
| - # Default value when unset and use_sanitizer_coverage=true:
|
| - # edge,indirect-calls,8bit-counters
|
| sanitizer_coverage_flags = ""
|
| -}
|
| -
|
| -# Disable sanitizers for non-default toolchains.
|
| -if (current_toolchain != default_toolchain) {
|
| - is_asan = false
|
| - is_cfi = false
|
| - is_lsan = false
|
| - is_msan = false
|
| - is_syzyasan = false
|
| - is_tsan = false
|
| - is_ubsan = false
|
| - is_ubsan_null = false
|
| - is_ubsan_no_recover = false
|
| - is_ubsan_security = false
|
| - is_ubsan_vptr = false
|
| - msan_track_origins = 0
|
| - sanitizer_coverage_flags = ""
|
| - use_cfi_diag = false
|
| use_custom_libcxx = false
|
| - use_drfuzz = false
|
| - use_libfuzzer = false
|
| - use_prebuilt_instrumented_libraries = false
|
| - use_locally_built_instrumented_libraries = false
|
| use_sanitizer_coverage = false
|
| }
|
|
|
| -# Args that are in turn dependent on other args must be in a separate
|
| -# declare_args block. User overrides are only applied at the end of a
|
| -# declare_args block.
|
| -declare_args() {
|
| - # Use libc++ (buildtools/third_party/libc++ and
|
| - # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library.
|
| - # This is intended to be used for instrumented builds.
|
| - use_custom_libcxx =
|
| - (is_asan && is_linux && !is_chromeos) || is_tsan || is_msan || is_ubsan ||
|
| - is_ubsan_security || use_libfuzzer || use_afl
|
| -
|
| - # Enable -fsanitize-coverage.
|
| - use_sanitizer_coverage =
|
| - use_libfuzzer || use_afl || sanitizer_coverage_flags != ""
|
| -
|
| - # Detect overflow/underflow for global objects.
|
| - #
|
| - # Android build relies on -Wl,--gc-sections removing unreachable code.
|
| - # ASan instrumentation for globals inhibits this and results in a
|
| - # library with unresolvable relocations.
|
| - # TODO(eugenis): find a way to reenable this.
|
| - #
|
| - # Mac: http://crbug.com/352073
|
| - asan_globals = !is_android && !is_mac
|
| -}
|
| -
|
| if (use_afl && sanitizer_coverage_flags == "") {
|
| sanitizer_coverage_flags = "trace-pc"
|
| } else if (use_sanitizer_coverage && sanitizer_coverage_flags == "") {
|
|
|