[lldb] Set MallocNanoZone for all sanitizers when running tests

Disabling MallocNanoZone is necessary for both ASan and TSan.
This commit is contained in:
Jonas Devlieghere
2024-11-06 09:58:32 -08:00
parent 8dd9f206b5
commit 4d4024e1ed
4 changed files with 8 additions and 9 deletions

View File

@@ -127,13 +127,13 @@ def delete_module_cache(path):
if is_configured("llvm_use_sanitizer"):
config.environment["MallocNanoZone"] = "0"
if "Address" in config.llvm_use_sanitizer:
config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
if "Darwin" in config.host_os:
config.environment["DYLD_INSERT_LIBRARIES"] = find_sanitizer_runtime(
"libclang_rt.asan_osx_dynamic.dylib"
)
config.environment["MallocNanoZone"] = "0"
if "Thread" in config.llvm_use_sanitizer:
config.environment["TSAN_OPTIONS"] = "halt_on_error=1"

View File

@@ -50,14 +50,10 @@ llvm_config.with_system_environment(
)
# Enable sanitizer runtime flags.
if "Address" in config.llvm_use_sanitizer:
if config.llvm_use_sanitizer:
config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
if platform.system() == "Darwin":
config.environment["MallocNanoZone"] = "0"
if "Thread" in config.llvm_use_sanitizer:
config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
config.environment["MallocNanoZone"] = "0"
if config.lldb_platform_url and config.cmake_sysroot and config.enable_remote:
if re.match(r".*-linux.*", config.target_triple):

View File

@@ -35,8 +35,10 @@ llvm_config.with_system_environment(
llvm_config.with_environment("PATH", os.path.dirname(sys.executable), append_path=True)
# Enable sanitizer runtime flags.
config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
if config.llvm_use_sanitizer:
config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
config.environment["MallocNanoZone"] = "0"
# testFormat: The test format to use to interpret tests.
config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, "Tests")

View File

@@ -9,6 +9,7 @@ config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
config.lldb_obj_root = "@LLDB_BINARY_DIR@"
config.lldb_src_root = "@LLDB_SOURCE_DIR@"
config.target_triple = "@LLVM_TARGET_TRIPLE@"
config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
config.python_executable = "@Python3_EXECUTABLE@"
import lit.llvm