Skip to content

Commit 4d4024e

Browse files
committed
[lldb] Set MallocNanoZone for all sanitizers when running tests
Disabling MallocNanoZone is necessary for both ASan and TSan.
1 parent 8dd9f20 commit 4d4024e

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

lldb/test/API/lit.cfg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ def delete_module_cache(path):
127127

128128

129129
if is_configured("llvm_use_sanitizer"):
130+
config.environment["MallocNanoZone"] = "0"
130131
if "Address" in config.llvm_use_sanitizer:
131132
config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
132133
if "Darwin" in config.host_os:
133134
config.environment["DYLD_INSERT_LIBRARIES"] = find_sanitizer_runtime(
134135
"libclang_rt.asan_osx_dynamic.dylib"
135136
)
136-
config.environment["MallocNanoZone"] = "0"
137137

138138
if "Thread" in config.llvm_use_sanitizer:
139139
config.environment["TSAN_OPTIONS"] = "halt_on_error=1"

lldb/test/Shell/lit.cfg.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,10 @@
5050
)
5151

5252
# Enable sanitizer runtime flags.
53-
if "Address" in config.llvm_use_sanitizer:
53+
if config.llvm_use_sanitizer:
5454
config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
55-
if platform.system() == "Darwin":
56-
config.environment["MallocNanoZone"] = "0"
57-
58-
if "Thread" in config.llvm_use_sanitizer:
5955
config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
60-
56+
config.environment["MallocNanoZone"] = "0"
6157

6258
if config.lldb_platform_url and config.cmake_sysroot and config.enable_remote:
6359
if re.match(r".*-linux.*", config.target_triple):

lldb/test/Unit/lit.cfg.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@
3535
llvm_config.with_environment("PATH", os.path.dirname(sys.executable), append_path=True)
3636

3737
# Enable sanitizer runtime flags.
38-
config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
39-
config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
38+
if config.llvm_use_sanitizer:
39+
config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
40+
config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
41+
config.environment["MallocNanoZone"] = "0"
4042

4143
# testFormat: The test format to use to interpret tests.
4244
config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, "Tests")

lldb/test/Unit/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
99
config.lldb_obj_root = "@LLDB_BINARY_DIR@"
1010
config.lldb_src_root = "@LLDB_SOURCE_DIR@"
1111
config.target_triple = "@LLVM_TARGET_TRIPLE@"
12+
config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
1213
config.python_executable = "@Python3_EXECUTABLE@"
1314

1415
import lit.llvm

0 commit comments

Comments
 (0)