Skip to content

Commit 5621f38

Browse files
ybogoapolukhin
authored andcommitted
fix phrd: disable phdr if asan is enabled
Closes: #1071 This fix adds a compile time check for address sanitizer (ASAN) as it also implemented for other sanitizers (MSAN, TSAN) --- Pull Request resolved: #1073 Co-authored-by: antoshkka <[email protected]> commit_hash:70f2a9a00a6a9f69fde49bf08aaf2bb7b38bee26
1 parent 0088beb commit 5621f38

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

core/src/engine/task/exception_hacks.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
#if __has_feature(memory_sanitizer)
77
#define HAS_MSAN 1
88
#endif
9+
#if __has_feature(address_sanitizer)
10+
#define HAS_ASAN 1
11+
#endif
912
#endif
1013

1114
// Thread Sanitizer uses dl_iterate_phdr function on initialization and fails if
@@ -14,7 +17,11 @@
1417
// Memory sanitizer gets crazy with uninstumented dl_phdr_info and conveniently
1518
// segfaults with stackoverflow trying to report the backtrace from within
1619
// dl_iterate_phdr.
17-
#if !defined(USERVER_DISABLE_PHDR_CACHE) && defined(__linux__) && !USERVER_IMPL_HAS_TSAN && !defined(HAS_MSAN)
20+
//
21+
// Address sanitizer also calls dl_iterate_phdr during its initialization
22+
// (before main and before static constructors), causing a crash.
23+
#if !defined(USERVER_DISABLE_PHDR_CACHE) && defined(__linux__) && !USERVER_IMPL_HAS_TSAN && !defined(HAS_MSAN) && \
24+
!defined(HAS_ASAN)
1825
#define USE_PHDR_CACHE 1 // NOLINT
1926
#endif
2027

0 commit comments

Comments
 (0)