Skip to content

[LSAN] Add extra suppressions on Apple Aarch64 #117478

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

madsmtm
Copy link
Contributor

@madsmtm madsmtm commented Nov 24, 2024

  • _fetchInitializingClassList for startup code in dyld.
  • dyld4::RuntimeState::_instantiateTLVs for thread locals.

Fixes #115992, now it shows the following instead (in a project using thread locals):

-----------------------------------------------------
Suppressions used:
  count      bytes template
      3        120 *_fetchInitializingClassList*
      1        104 *dyld4::RuntimeState::_instantiateTLVs*
-----------------------------------------------------

@llvmbot
Copy link
Member

llvmbot commented Nov 24, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Mads Marquart (madsmtm)

Changes
  • _fetchInitializingClassList for startup code in dyld.
  • dyld4::RuntimeState::_instantiateTLVs for thread locals.

Fixes #115992.


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

1 Files Affected:

  • (modified) compiler-rt/lib/lsan/lsan_common.cpp (+7)
diff --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp
index 7ab9e4ff2ac9fd..56b943fa05b459 100644
--- a/compiler-rt/lib/lsan/lsan_common.cpp
+++ b/compiler-rt/lib/lsan/lsan_common.cpp
@@ -120,7 +120,14 @@ static const char kStdSuppressions[] =
 #  endif  // SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT
 #  if SANITIZER_APPLE
     // For Darwin and os_log/os_trace: https://reviews.llvm.org/D35173
+#   if SANITIZER_ARM64
+    // Apple Aarch64 leaks on startup in _fetchInitializingClassList and when
+    // using thread locals in dyld4::RuntimeState::_instantiateTLVs.
+    // See https://github.com/llvm/llvm-project/issues/115992.
+    "leak:*_os_trace*\nleak:*_fetchInitializingClassList*\nleak:*dyld4::RuntimeState::_instantiateTLVs*\n"
+#   else
     "leak:*_os_trace*\n"
+#   endif
 #  endif
     // TLS leak in some glibc versions, described in
     // https://sourceware.org/bugzilla/show_bug.cgi?id=12650.

Copy link

github-actions bot commented Nov 24, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@madsmtm madsmtm force-pushed the fix-lsan-apple-aarch64 branch from 4a1855f to eec7727 Compare November 24, 2024 12:50
- _fetchInitializingClassList for startup code in dyld.
- dyld4::RuntimeState::_instantiateTLVs for thread locals.
@madsmtm madsmtm force-pushed the fix-lsan-apple-aarch64 branch from eec7727 to dee3070 Compare November 24, 2024 12:57
@hkratz
Copy link

hkratz commented Nov 24, 2024

FYI: _fetchInitializingClassList is actually related to some special-cased thread locals as well, the allocation is here, _objc_fetch_pthread_data has the TLS access.

@vitalybuka vitalybuka requested review from yln, wrotki and zmodem November 25, 2024 08:18
@calvin2021y
Copy link

Is this will merge into 19.1.6 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[LSAN] LeakSanitizer false positive on macOS Aarch64
4 participants