summaryrefslogtreecommitdiff
path: root/libsanitizer
diff options
context:
space:
mode:
authorkcc <kcc@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-15 10:31:14 +0000
committerkcc <kcc@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-15 10:31:14 +0000
commit0e4cc8fad645fe7e3bec9676cf728285261ef205 (patch)
tree55a8a644f67e68d67a602e8ebb34bdfcf419c187 /libsanitizer
parent5037630b5905208c661b055440d4725296dd4e08 (diff)
downloadgcc-0e4cc8fad645fe7e3bec9676cf728285261ef205.tar.gz
fix PR sanitizer/58994
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204838 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libsanitizer')
-rw-r--r--libsanitizer/ChangeLog8
-rw-r--r--libsanitizer/asan/asan_interceptors.cc16
2 files changed, 18 insertions, 6 deletions
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index 47f93db4e7d..a0a8a8e6db0 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,11 @@
+2013-11-15 Kostya Serebryany <kcc@google.com>
+
+ PR sanitizer/58994
+ Backport from upstream revision 194573
+ * asan/asan_interceptors.cc (COMMON_INTERCEPTOR_ENTER): Fall
+ back to the original functions in the common libsanitizer
+ interceptors and the __cxa_atexit() interceptor on Darwin.
+
2013-11-13 Peter Bergner <bergner@vnet.ibm.com>
PR sanitizer/59009
diff --git a/libsanitizer/asan/asan_interceptors.cc b/libsanitizer/asan/asan_interceptors.cc
index 6fa968da0a3..72f7aae814a 100644
--- a/libsanitizer/asan/asan_interceptors.cc
+++ b/libsanitizer/asan/asan_interceptors.cc
@@ -106,12 +106,13 @@ DECLARE_REAL_AND_INTERCEPTOR(void, free, void *)
#define COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ptr, size) \
ASAN_WRITE_RANGE(ptr, size)
#define COMMON_INTERCEPTOR_READ_RANGE(ctx, ptr, size) ASAN_READ_RANGE(ptr, size)
-#define COMMON_INTERCEPTOR_ENTER(ctx, func, ...) \
- do { \
- if (asan_init_is_running) return REAL(func)(__VA_ARGS__); \
- ctx = 0; \
- (void) ctx; \
- ENSURE_ASAN_INITED(); \
+#define COMMON_INTERCEPTOR_ENTER(ctx, func, ...) \
+ do { \
+ if (asan_init_is_running) return REAL(func)(__VA_ARGS__); \
+ ctx = 0; \
+ (void) ctx; \
+ if (SANITIZER_MAC && !asan_inited) return REAL(func)(__VA_ARGS__); \
+ ENSURE_ASAN_INITED(); \
} while (false)
#define COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd) \
do { \
@@ -634,6 +635,9 @@ static void AtCxaAtexit(void *unused) {
#if ASAN_INTERCEPT___CXA_ATEXIT
INTERCEPTOR(int, __cxa_atexit, void (*func)(void *), void *arg,
void *dso_handle) {
+#if SANITIZER_MAC
+ if (!asan_inited) return REAL(__cxa_atexit)(func, arg, dso_handle);
+#endif
ENSURE_ASAN_INITED();
int res = REAL(__cxa_atexit)(func, arg, dso_handle);
REAL(__cxa_atexit)(AtCxaAtexit, 0, 0);