Skip to content

Commit fe90b9d

Browse files
authored
[ASan] Limits the conditions of the deadlock patch (#137127)
PR #131756 introduced a patch to fix a deadlock between LSan and ASan. The relevant deadlock only occurs when LSan is enabled and `dl_iterate_phdr` is used for Stop-the-World, i.e., under the condition `CAN_SANITIZE_LEAKS && (SANITIZER_LINUX || SANITIZER_NETBSD)`. Therefore, this commit also sets the effective condition of this patch to the above condition, avoiding unnecessary problems in other environments, e.g., stack overflow on MSVC/Windows.
1 parent 72b2d4d commit fe90b9d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler-rt/lib/asan/asan_report.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "asan_scariness_score.h"
2222
#include "asan_stack.h"
2323
#include "asan_thread.h"
24+
#include "lsan/lsan_common.h"
2425
#include "sanitizer_common/sanitizer_common.h"
2526
#include "sanitizer_common/sanitizer_flags.h"
2627
#include "sanitizer_common/sanitizer_interface_internal.h"
@@ -149,7 +150,7 @@ class ScopedInErrorReport {
149150
// 2. Subsequent error reporting avoids nested lock acquisition patterns.
150151
// 3. Eliminates the lock order inversion risk between libdl and ASan's
151152
// thread registry.
152-
#if !SANITIZER_SYMBOLIZER_MARKUP
153+
#if CAN_SANITIZE_LEAKS && (SANITIZER_LINUX || SANITIZER_NETBSD)
153154
Symbolizer::GetOrInit()->GetRefreshedListOfModules();
154155
#endif
155156

0 commit comments

Comments
 (0)