[compiler-rt] eb0e331 - [sanitizer] Don't call dlerror() after swift_demangle lookup through dlsym

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 19 00:07:56 PDT 2022


Author: serge-sans-paille
Date: 2022-07-19T09:07:30+02:00
New Revision: eb0e3319bf94934b09f7b67ca09606dad55bf24f

URL: https://github.com/llvm/llvm-project/commit/eb0e3319bf94934b09f7b67ca09606dad55bf24f
DIFF: https://github.com/llvm/llvm-project/commit/eb0e3319bf94934b09f7b67ca09606dad55bf24f.diff

LOG: [sanitizer] Don't call dlerror() after swift_demangle lookup through dlsym

Because the call to `dlerror()` may actually want to print something, which turns into a deadlock
as showcased in #49223.

Instead rely on further call to dlsym to clear `dlerror` internal state if they
need to check the return status.

Differential Revision: https://reviews.llvm.org/D128992

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
index 8be7709b6038b..b223f6cd01e34 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
@@ -72,7 +72,6 @@ static swift_demangle_ft swift_demangle_f;
 // symbolication.
 static void InitializeSwiftDemangler() {
   swift_demangle_f = (swift_demangle_ft)dlsym(RTLD_DEFAULT, "swift_demangle");
-  (void)dlerror(); // Cleanup error message in case of failure
 }
 
 // Attempts to demangle a Swift name. The demangler will return nullptr if a


        


More information about the llvm-commits mailing list