[llvm-branch-commits] [LSan] skip leaks from dlerror (PR #142876)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jun 4 16:43:44 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

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

Author: Florian Mayer (fmayer)

<details>
<summary>Changes</summary>

We have known false positives, and the return value is never
user-managed anyway.


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


2 Files Affected:

- (modified) compiler-rt/lib/lsan/lsan_common.cpp (+2-1) 
- (modified) compiler-rt/test/hwasan/TestCases/Posix/dlerror.cpp (+2-2) 


``````````diff
diff --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp
index 7ab9e4ff2ac9f..b17a17e1193bc 100644
--- a/compiler-rt/lib/lsan/lsan_common.cpp
+++ b/compiler-rt/lib/lsan/lsan_common.cpp
@@ -124,7 +124,8 @@ static const char kStdSuppressions[] =
 #  endif
     // TLS leak in some glibc versions, described in
     // https://sourceware.org/bugzilla/show_bug.cgi?id=12650.
-    "leak:*tls_get_addr*\n";
+    "leak:*tls_get_addr*\n"
+    "leak:*dlerror*\n";
 
 void InitializeSuppressions() {
   CHECK_EQ(nullptr, suppression_ctx);
diff --git a/compiler-rt/test/hwasan/TestCases/Posix/dlerror.cpp b/compiler-rt/test/hwasan/TestCases/Posix/dlerror.cpp
index 15455ba5af780..b6e486b291f3a 100644
--- a/compiler-rt/test/hwasan/TestCases/Posix/dlerror.cpp
+++ b/compiler-rt/test/hwasan/TestCases/Posix/dlerror.cpp
@@ -2,7 +2,6 @@
 // This is currently not implemented, so this test is XFAIL.
 
 // RUN: %clangxx_hwasan -O0 %s -o %t && HWASAN_OPTIONS=detect_leaks=1 %run %t
-// XFAIL: *
 
 #include <assert.h>
 #include <dlfcn.h>
@@ -12,7 +11,8 @@
 #include <string.h>
 #include <unistd.h>
 
-constexpr auto kKeys = 500;
+// musl only has  128 keys
+constexpr auto kKeys = 100;
 
 int main(int argc, char **argv) {
   __hwasan_enable_allocator_tagging();

``````````

</details>


https://github.com/llvm/llvm-project/pull/142876


More information about the llvm-branch-commits mailing list