Make -fsanitize=scudo use scudo_standalone. Delete check-scudo.

Leaves the implementation and tests files in-place for right now, but
deletes the ability to build the old sanitizer-common based scudo. This
has been on life-support for a long time, and the newer scudo_standalone
is much better supported and maintained.

Also patches up some GWP-ASan wording, primarily related to the fact
that -fsanitize=scudo now is scudo_standalone, and therefore the way to
reference the GWP-ASan options through the environment variable has
changed.

Future follow-up patches will delete the original scudo, and migrate all
its tests over to be part of the scudo_standalone test suite.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D138157
This commit is contained in:
Mitch Phillips 2022-12-01 15:35:04 -08:00
parent b83711248c
commit c414bbefe4
9 changed files with 44 additions and 98 deletions

View File

@ -1034,10 +1034,7 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
SharedRuntimes.push_back("ubsan_standalone"); SharedRuntimes.push_back("ubsan_standalone");
} }
if (SanArgs.needsScudoRt() && SanArgs.linkRuntimes()) { if (SanArgs.needsScudoRt() && SanArgs.linkRuntimes()) {
if (SanArgs.requiresMinimalRuntime()) SharedRuntimes.push_back("scudo_standalone");
SharedRuntimes.push_back("scudo_minimal");
else
SharedRuntimes.push_back("scudo");
} }
if (SanArgs.needsTsanRt() && SanArgs.linkRuntimes()) if (SanArgs.needsTsanRt() && SanArgs.linkRuntimes())
SharedRuntimes.push_back("tsan"); SharedRuntimes.push_back("tsan");
@ -1134,15 +1131,9 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
RequiredSymbols.push_back("__sanitizer_stats_register"); RequiredSymbols.push_back("__sanitizer_stats_register");
} }
if (!SanArgs.needsSharedRt() && SanArgs.needsScudoRt() && SanArgs.linkRuntimes()) { if (!SanArgs.needsSharedRt() && SanArgs.needsScudoRt() && SanArgs.linkRuntimes()) {
if (SanArgs.requiresMinimalRuntime()) { StaticRuntimes.push_back("scudo_standalone");
StaticRuntimes.push_back("scudo_minimal"); if (SanArgs.linkCXXRuntimes())
if (SanArgs.linkCXXRuntimes()) StaticRuntimes.push_back("scudo_standalone_cxx");
StaticRuntimes.push_back("scudo_cxx_minimal");
} else {
StaticRuntimes.push_back("scudo");
if (SanArgs.linkCXXRuntimes())
StaticRuntimes.push_back("scudo_cxx");
}
} }
} }

View File

@ -183,7 +183,7 @@
// CHECK-SCUDO-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-SCUDO-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-SCUDO-X86: "-fsanitize=safe-stack,scudo" // CHECK-SCUDO-X86: "-fsanitize=safe-stack,scudo"
// CHECK-SCUDO-X86: "-pie" // CHECK-SCUDO-X86: "-pie"
// CHECK-SCUDO-X86: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.scudo.so" // CHECK-SCUDO-X86: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}fuchsia{{/|\\\\}}libclang_rt.scudo_standalone-x86_64.so"
// RUN: %clang -### %s --target=aarch64-unknown-fuchsia \ // RUN: %clang -### %s --target=aarch64-unknown-fuchsia \
// RUN: -fsanitize=scudo 2>&1 \ // RUN: -fsanitize=scudo 2>&1 \
@ -193,7 +193,7 @@
// CHECK-SCUDO-AARCH64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-SCUDO-AARCH64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-SCUDO-AARCH64: "-fsanitize=shadow-call-stack,scudo" // CHECK-SCUDO-AARCH64: "-fsanitize=shadow-call-stack,scudo"
// CHECK-SCUDO-AARCH64: "-pie" // CHECK-SCUDO-AARCH64: "-pie"
// CHECK-SCUDO-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-unknown-fuchsia{{/|\\\\}}libclang_rt.scudo.so" // CHECK-SCUDO-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}fuchsia{{/|\\\\}}libclang_rt.scudo_standalone-aarch64.so"
// RUN: %clang -### %s --target=x86_64-unknown-fuchsia \ // RUN: %clang -### %s --target=x86_64-unknown-fuchsia \
// RUN: -fsanitize=scudo -fPIC -shared 2>&1 \ // RUN: -fsanitize=scudo -fPIC -shared 2>&1 \
@ -202,7 +202,7 @@
// RUN: | FileCheck %s -check-prefix=CHECK-SCUDO-SHARED // RUN: | FileCheck %s -check-prefix=CHECK-SCUDO-SHARED
// CHECK-SCUDO-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-SCUDO-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-SCUDO-SHARED: "-fsanitize=safe-stack,scudo" // CHECK-SCUDO-SHARED: "-fsanitize=safe-stack,scudo"
// CHECK-SCUDO-SHARED: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.scudo.so" // CHECK-SCUDO-SHARED: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}fuchsia{{/|\\\\}}libclang_rt.scudo_standalone-x86_64.so"
// RUN: %clang -### %s --target=aarch64-unknown-fuchsia \ // RUN: %clang -### %s --target=aarch64-unknown-fuchsia \
// RUN: -fsanitize=leak 2>&1 \ // RUN: -fsanitize=leak 2>&1 \

View File

@ -852,23 +852,12 @@
// RUN: | FileCheck --check-prefix=CHECK-SCUDO-LINUX %s // RUN: | FileCheck --check-prefix=CHECK-SCUDO-LINUX %s
// CHECK-SCUDO-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-SCUDO-LINUX: "{{.*}}ld{{(.exe)?}}"
// CHECK-SCUDO-LINUX: "-pie" // CHECK-SCUDO-LINUX: "-pie"
// CHECK-SCUDO-LINUX: "--whole-archive" "{{.*}}libclang_rt.scudo-i386.a" "--no-whole-archive" // CHECK-SCUDO-LINUX: "--whole-archive" "{{.*}}libclang_rt.scudo_standalone-i386.a" "--no-whole-archive"
// CHECK-SCUDO-LINUX-NOT: "-lstdc++" // CHECK-SCUDO-LINUX-NOT: "-lstdc++"
// CHECK-SCUDO-LINUX: "-lpthread" // CHECK-SCUDO-LINUX: "-lpthread"
// CHECK-SCUDO-LINUX: "-ldl" // CHECK-SCUDO-LINUX: "-ldl"
// CHECK-SCUDO-LINUX: "-lresolv" // CHECK-SCUDO-LINUX: "-lresolv"
// RUN: %clang -fsanitize=scudo -fsanitize-minimal-runtime -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-SCUDO-MINIMAL-LINUX %s
// CHECK-SCUDO-MINIMAL-LINUX: "{{.*}}ld{{(.exe)?}}"
// CHECK-SCUDO-MINIMAL-LINUX: "-pie"
// CHECK-SCUDO-MINIMAL-LINUX: "--whole-archive" "{{.*}}libclang_rt.scudo_minimal-i386.a" "--no-whole-archive"
// CHECK-SCUDO-MINIMAL-LINUX: "-lpthread"
// CHECK-SCUDO-MINIMAL-LINUX: "-lresolv"
// RUN: %clang -### %s -o %t.so -shared 2>&1 \ // RUN: %clang -### %s -o %t.so -shared 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=scudo -shared-libsan \ // RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=scudo -shared-libsan \
// RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: -resource-dir=%S/Inputs/resource_dir \
@ -877,8 +866,8 @@
// //
// CHECK-SCUDO-SHARED-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-SCUDO-SHARED-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-SCUDO-SHARED-LINUX-NOT: "-lc" // CHECK-SCUDO-SHARED-LINUX-NOT: "-lc"
// CHECK-SCUDO-SHARED-LINUX-NOT: libclang_rt.scudo-i386.a" // CHECK-SCUDO-SHARED-LINUX-NOT: libclang_rt.scudo_standalone-i386.a"
// CHECK-SCUDO-SHARED-LINUX: libclang_rt.scudo-i386.so" // CHECK-SCUDO-SHARED-LINUX: libclang_rt.scudo_standalone-i386.so"
// CHECK-SCUDO-SHARED-LINUX-NOT: "-lpthread" // CHECK-SCUDO-SHARED-LINUX-NOT: "-lpthread"
// CHECK-SCUDO-SHARED-LINUX-NOT: "-lrt" // CHECK-SCUDO-SHARED-LINUX-NOT: "-lrt"
// CHECK-SCUDO-SHARED-LINUX-NOT: "-ldl" // CHECK-SCUDO-SHARED-LINUX-NOT: "-ldl"
@ -896,7 +885,7 @@
// CHECK-SCUDO-ANDROID: "-pie" // CHECK-SCUDO-ANDROID: "-pie"
// CHECK-SCUDO-ANDROID-NOT: "-lpthread" // CHECK-SCUDO-ANDROID-NOT: "-lpthread"
// CHECK-SCUDO-ANDROID-NOT: "-lresolv" // CHECK-SCUDO-ANDROID-NOT: "-lresolv"
// CHECK-SCUDO-ANDROID: libclang_rt.scudo-arm-android.so" // CHECK-SCUDO-ANDROID: libclang_rt.scudo_standalone-arm-android.so"
// CHECK-SCUDO-ANDROID-NOT: "-lpthread" // CHECK-SCUDO-ANDROID-NOT: "-lpthread"
// CHECK-SCUDO-ANDROID-NOT: "-lresolv" // CHECK-SCUDO-ANDROID-NOT: "-lresolv"
@ -907,7 +896,7 @@
// RUN: | FileCheck --check-prefix=CHECK-SCUDO-ANDROID-STATIC %s // RUN: | FileCheck --check-prefix=CHECK-SCUDO-ANDROID-STATIC %s
// CHECK-SCUDO-ANDROID-STATIC: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}" // CHECK-SCUDO-ANDROID-STATIC: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
// CHECK-SCUDO-ANDROID-STATIC: "-pie" // CHECK-SCUDO-ANDROID-STATIC: "-pie"
// CHECK-SCUDO-ANDROID-STATIC: "--whole-archive" "{{.*}}libclang_rt.scudo-arm-android.a" "--no-whole-archive" // CHECK-SCUDO-ANDROID-STATIC: "--whole-archive" "{{.*}}libclang_rt.scudo_standalone-arm-android.a" "--no-whole-archive"
// CHECK-SCUDO-ANDROID-STATIC-NOT: "-lstdc++" // CHECK-SCUDO-ANDROID-STATIC-NOT: "-lstdc++"
// CHECK-SCUDO-ANDROID-STATIC-NOT: "-lpthread" // CHECK-SCUDO-ANDROID-STATIC-NOT: "-lpthread"
// CHECK-SCUDO-ANDROID-STATIC-NOT: "-lrt" // CHECK-SCUDO-ANDROID-STATIC-NOT: "-lrt"

View File

@ -619,9 +619,6 @@ if(APPLE)
list_intersect(CFI_SUPPORTED_ARCH list_intersect(CFI_SUPPORTED_ARCH
ALL_CFI_SUPPORTED_ARCH ALL_CFI_SUPPORTED_ARCH
SANITIZER_COMMON_SUPPORTED_ARCH) SANITIZER_COMMON_SUPPORTED_ARCH)
list_intersect(SCUDO_SUPPORTED_ARCH
ALL_SCUDO_SUPPORTED_ARCH
SANITIZER_COMMON_SUPPORTED_ARCH)
list_intersect(SCUDO_STANDALONE_SUPPORTED_ARCH list_intersect(SCUDO_STANDALONE_SUPPORTED_ARCH
ALL_SCUDO_STANDALONE_SUPPORTED_ARCH ALL_SCUDO_STANDALONE_SUPPORTED_ARCH
SANITIZER_COMMON_SUPPORTED_ARCH) SANITIZER_COMMON_SUPPORTED_ARCH)
@ -661,7 +658,6 @@ else()
filter_available_targets(SAFESTACK_SUPPORTED_ARCH filter_available_targets(SAFESTACK_SUPPORTED_ARCH
${ALL_SAFESTACK_SUPPORTED_ARCH}) ${ALL_SAFESTACK_SUPPORTED_ARCH})
filter_available_targets(CFI_SUPPORTED_ARCH ${ALL_CFI_SUPPORTED_ARCH}) filter_available_targets(CFI_SUPPORTED_ARCH ${ALL_CFI_SUPPORTED_ARCH})
filter_available_targets(SCUDO_SUPPORTED_ARCH ${ALL_SCUDO_SUPPORTED_ARCH})
filter_available_targets(SCUDO_STANDALONE_SUPPORTED_ARCH ${ALL_SCUDO_STANDALONE_SUPPORTED_ARCH}) filter_available_targets(SCUDO_STANDALONE_SUPPORTED_ARCH ${ALL_SCUDO_STANDALONE_SUPPORTED_ARCH})
filter_available_targets(XRAY_SUPPORTED_ARCH ${ALL_XRAY_SUPPORTED_ARCH}) filter_available_targets(XRAY_SUPPORTED_ARCH ${ALL_XRAY_SUPPORTED_ARCH})
filter_available_targets(SHADOWCALLSTACK_SUPPORTED_ARCH filter_available_targets(SHADOWCALLSTACK_SUPPORTED_ARCH
@ -701,7 +697,7 @@ if(COMPILER_RT_SUPPORTED_ARCH)
endif() endif()
message(STATUS "Compiler-RT supported architectures: ${COMPILER_RT_SUPPORTED_ARCH}") message(STATUS "Compiler-RT supported architectures: ${COMPILER_RT_SUPPORTED_ARCH}")
set(ALL_SANITIZERS asan;dfsan;msan;hwasan;tsan;safestack;cfi;scudo;ubsan_minimal;gwp_asan) set(ALL_SANITIZERS asan;dfsan;msan;hwasan;tsan;safestack;cfi;scudo_standalone;ubsan_minimal;gwp_asan)
set(COMPILER_RT_SANITIZERS_TO_BUILD all CACHE STRING set(COMPILER_RT_SANITIZERS_TO_BUILD all CACHE STRING
"sanitizers to build if supported on the target (all;${ALL_SANITIZERS})") "sanitizers to build if supported on the target (all;${ALL_SANITIZERS})")
list_replace(COMPILER_RT_SANITIZERS_TO_BUILD all "${ALL_SANITIZERS}") list_replace(COMPILER_RT_SANITIZERS_TO_BUILD all "${ALL_SANITIZERS}")
@ -823,20 +819,16 @@ else()
endif() endif()
#TODO(kostyak): add back Android & Fuchsia when the code settles a bit. #TODO(kostyak): add back Android & Fuchsia when the code settles a bit.
if (SCUDO_STANDALONE_SUPPORTED_ARCH AND OS_NAME MATCHES "Linux" AND if (SCUDO_STANDALONE_SUPPORTED_ARCH AND
COMPILER_RT_BUILD_SANITIZERS AND
"scudo_standalone" IN_LIST COMPILER_RT_SANITIZERS_TO_BUILD AND
OS_NAME MATCHES "Linux" AND
COMPILER_RT_HAS_AUXV) COMPILER_RT_HAS_AUXV)
set(COMPILER_RT_HAS_SCUDO_STANDALONE TRUE) set(COMPILER_RT_HAS_SCUDO_STANDALONE TRUE)
else() else()
set(COMPILER_RT_HAS_SCUDO_STANDALONE FALSE) set(COMPILER_RT_HAS_SCUDO_STANDALONE FALSE)
endif() endif()
if (COMPILER_RT_HAS_SANITIZER_COMMON AND SCUDO_SUPPORTED_ARCH AND
OS_NAME MATCHES "Linux|Fuchsia")
set(COMPILER_RT_HAS_SCUDO TRUE)
else()
set(COMPILER_RT_HAS_SCUDO FALSE)
endif()
if (COMPILER_RT_HAS_SANITIZER_COMMON AND XRAY_SUPPORTED_ARCH AND if (COMPILER_RT_HAS_SANITIZER_COMMON AND XRAY_SUPPORTED_ARCH AND
OS_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD|Fuchsia") OS_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD|Fuchsia")
set(COMPILER_RT_HAS_XRAY TRUE) set(COMPILER_RT_HAS_XRAY TRUE)
@ -869,7 +861,10 @@ endif()
# calling malloc on first use. # calling malloc on first use.
# TODO(hctim): Enable this on Android again. Looks like it's causing a SIGSEGV # TODO(hctim): Enable this on Android again. Looks like it's causing a SIGSEGV
# for Scudo and GWP-ASan, further testing needed. # for Scudo and GWP-ASan, further testing needed.
if (GWP_ASAN_SUPPORTED_ARCH AND COMPILER_RT_BUILD_GWP_ASAN AND if (GWP_ASAN_SUPPORTED_ARCH AND
COMPILER_RT_BUILD_GWP_ASAN AND
COMPILER_RT_BUILD_SANITIZERS AND
"gwp_asan" IN_LIST COMPILER_RT_SANITIZERS_TO_BUILD AND
OS_NAME MATCHES "Linux") OS_NAME MATCHES "Linux")
set(COMPILER_RT_HAS_GWP_ASAN TRUE) set(COMPILER_RT_HAS_GWP_ASAN TRUE)
else() else()

View File

@ -24,12 +24,13 @@ endif()
function(compiler_rt_build_runtime runtime) function(compiler_rt_build_runtime runtime)
string(TOUPPER ${runtime} runtime_uppercase) string(TOUPPER ${runtime} runtime_uppercase)
if(COMPILER_RT_HAS_${runtime_uppercase}) if(COMPILER_RT_HAS_${runtime_uppercase})
add_subdirectory(${runtime})
if(${runtime} STREQUAL tsan) if(${runtime} STREQUAL tsan)
add_subdirectory(tsan/dd) add_subdirectory(tsan/dd)
endif() endif()
if(${runtime} STREQUAL scudo) if(${runtime} STREQUAL scudo_standalone)
add_subdirectory(scudo/standalone) add_subdirectory(scudo/standalone)
else()
add_subdirectory(${runtime})
endif() endif()
endif() endif()
endfunction() endfunction()

View File

@ -50,7 +50,11 @@ endif()
function(compiler_rt_test_runtime runtime) function(compiler_rt_test_runtime runtime)
string(TOUPPER ${runtime} runtime_uppercase) string(TOUPPER ${runtime} runtime_uppercase)
if(COMPILER_RT_HAS_${runtime_uppercase}) if(COMPILER_RT_HAS_${runtime_uppercase})
add_subdirectory(${runtime}) if (${runtime} STREQUAL scudo_standalone)
add_subdirectory(scudo/standalone)
else()
add_subdirectory(${runtime})
endif()
foreach(directory ${ARGN}) foreach(directory ${ARGN})
add_subdirectory(${directory}) add_subdirectory(${directory})
endforeach() endforeach()

View File

@ -1,35 +0,0 @@
set(SCUDO_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(SCUDO_LIT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(SCUDO_TESTSUITES)
set(SCUDO_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND SCUDO_TEST_DEPS scudo)
endif()
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
)
set(SCUDO_TEST_ARCH ${SCUDO_SUPPORTED_ARCH})
foreach(arch ${SCUDO_TEST_ARCH})
set(SCUDO_TEST_TARGET_ARCH ${arch})
string(TOLOWER "-${arch}" SCUDO_TEST_CONFIG_SUFFIX)
get_test_cc_for_arch(${arch} SCUDO_TEST_TARGET_CC SCUDO_TEST_TARGET_CFLAGS)
string(TOUPPER ${arch} ARCH_UPPER_CASE)
set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config)
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)
list(APPEND SCUDO_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
endforeach()
add_subdirectory(standalone)
add_lit_testsuite(check-scudo "Running the Scudo Hardened Allocator tests"
${SCUDO_TESTSUITES}
DEPENDS ${SCUDO_TEST_DEPS})
set_target_properties(check-scudo PROPERTIES FOLDER "Compiler-RT Misc")

View File

@ -10,12 +10,12 @@ if(COMPILER_RT_INCLUDE_TESTS AND COMPILER_RT_HAS_SCUDO_STANDALONE)
${CMAKE_CURRENT_BINARY_DIR}/unit/gwp_asan/lit.site.cfg.py) ${CMAKE_CURRENT_BINARY_DIR}/unit/gwp_asan/lit.site.cfg.py)
list(APPEND SCUDO_STANDALONE_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/unit/gwp_asan) list(APPEND SCUDO_STANDALONE_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/unit/gwp_asan)
endif() endif()
add_lit_testsuite(check-scudo_standalone
"Running Scudo Standalone tests"
${SCUDO_STANDALONE_TESTSUITES}
DEPENDS ${SCUDO_STANDALONE_TEST_DEPS})
set_target_properties(check-scudo_standalone
PROPERTIES FOLDER "Compiler-RT Tests")
endif() endif()
add_lit_testsuite(check-scudo_standalone
"Running Scudo Standalone tests"
${SCUDO_STANDALONE_TESTSUITES}
DEPENDS ${SCUDO_STANDALONE_TEST_DEPS})
set_target_properties(check-scudo_standalone
PROPERTIES FOLDER "Compiler-RT Tests")

View File

@ -143,9 +143,10 @@ several aspects of GWP-ASan to be configured through the following methods:
default visibility. This will override the compile time define; default visibility. This will override the compile time define;
- Depending on allocator support (Scudo has support for this mechanism): Through - Depending on allocator support (Scudo has support for this mechanism): Through
the environment variable ``GWP_ASAN_OPTIONS``, containing the options string an environment variable, containing the options string to be parsed. In Scudo,
to be parsed. Options defined this way will override any definition made this is through `SCUDO_OPTIONS=GWP_ASAN_${OPTION_NAME}=${VALUE}` (e.g.
through ``__gwp_asan_default_options``. `SCUDO_OPTIONS=GWP_ASAN_SampleRate=100`). Options defined this way will
override any definition made through ``__gwp_asan_default_options``.
The options string follows a syntax similar to ASan, where distinct options The options string follows a syntax similar to ASan, where distinct options
can be assigned in the same string, separated by colons. can be assigned in the same string, separated by colons.
@ -216,9 +217,9 @@ and provide us a detailed error report:
.. code:: console .. code:: console
$ clang++ -fsanitize=scudo -std=c++17 -g buggy_code.cpp $ clang++ -fsanitize=scudo -g buggy_code.cpp
$ for i in `seq 1 200`; do $ for i in `seq 1 500`; do
GWP_ASAN_OPTIONS="SampleRate=100" ./a.out > /dev/null; SCUDO_OPTIONS="GWP_ASAN_SampleRate=100" ./a.out > /dev/null;
done done
| |
| *** GWP-ASan detected a memory error *** | *** GWP-ASan detected a memory error ***