Skip to content

[lldb][lit] Add MallocNanoZone envvar to Darwin ASan builds #88431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

chelcassanova
Copy link
Contributor

When builds on Darwin are configured with ASan, running tests will emit a warning about malloc's nano zone that can interfere with the test output and cause failures. Setting the environment variable MallocNanoZone to 0 will remove this warning and allow the tests to run as normal.

When builds are Darwin are configured with ASan, running tests will emit
a warning that can interfere with the test output and cause failures.
Setting the environment variable `MallocNanoZone` to 0 will remove this
warning and allow the tests to run as normal.
@llvmbot
Copy link
Member

llvmbot commented Apr 11, 2024

@llvm/pr-subscribers-lldb

Author: Chelsea Cassanova (chelcassanova)

Changes

When builds on Darwin are configured with ASan, running tests will emit a warning about malloc's nano zone that can interfere with the test output and cause failures. Setting the environment variable MallocNanoZone to 0 will remove this warning and allow the tests to run as normal.


Full diff: https://github.com/llvm/llvm-project/pull/88431.diff

2 Files Affected:

  • (modified) lldb/test/API/lit.cfg.py (+1)
  • (modified) lldb/test/Shell/lit.cfg.py (+2)
diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index f9497b632fc504..9ea389c639a013 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -121,6 +121,7 @@ def delete_module_cache(path):
             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"
diff --git a/lldb/test/Shell/lit.cfg.py b/lldb/test/Shell/lit.cfg.py
index 31afe5151c0661..345627835d2bf2 100644
--- a/lldb/test/Shell/lit.cfg.py
+++ b/lldb/test/Shell/lit.cfg.py
@@ -52,6 +52,8 @@
 # Enable sanitizer runtime flags.
 config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
 config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
+if "Darwin" in config.host_os:
+    config.environment["MallocNanoZone"] = "0"
 
 # Support running the test suite under the lldb-repro wrapper. This makes it
 # possible to capture a test suite run and then rerun all the test from the

Copy link
Member

@medismailben medismailben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! It would be nice to may be put a link to a bot that shows those warnings

@JDevlieghere
Copy link
Member

LGTM! It would be nice to may be put a link to a bot that shows those warnings

Those logs get recycled pretty quickly so that would only be valuable for a handful of days.

@chelcassanova
Copy link
Contributor Author

chelcassanova commented Apr 11, 2024

If that's the case then I'll just merge this in with a note on what the error says exactly.

@chelcassanova chelcassanova merged commit 4df854e into llvm:main Apr 11, 2024
chelcassanova added a commit that referenced this pull request Apr 11, 2024
…88436)

Reverts #88431. A config variable for the host OS is
unrecognized on the Linux builds and is causing a build failure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants