aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/asan/asan_intercepted_functions.h2
-rw-r--r--compiler-rt/lib/asan/asan_interceptors.cc10
2 files changed, 9 insertions, 3 deletions
diff --git a/compiler-rt/lib/asan/asan_intercepted_functions.h b/compiler-rt/lib/asan/asan_intercepted_functions.h
index 06d7577fc..60b05e6 100644
--- a/compiler-rt/lib/asan/asan_intercepted_functions.h
+++ b/compiler-rt/lib/asan/asan_intercepted_functions.h
@@ -41,8 +41,10 @@ using __sanitizer::uptr;
#if defined(__linux__)
# define ASAN_USE_ALIAS_ATTRIBUTE_FOR_INDEX 1
+# define ASAN_INTERCEPT_PRCTL 1
#else
# define ASAN_USE_ALIAS_ATTRIBUTE_FOR_INDEX 0
+# define ASAN_INTERCEPT_PRCTL 0
#endif
#if !defined(__APPLE__)
diff --git a/compiler-rt/lib/asan/asan_interceptors.cc b/compiler-rt/lib/asan/asan_interceptors.cc
index ef5f345..501fddf 100644
--- a/compiler-rt/lib/asan/asan_interceptors.cc
+++ b/compiler-rt/lib/asan/asan_interceptors.cc
@@ -177,10 +177,11 @@ INTERCEPTOR(void, siglongjmp, void *env, int val) {
}
#endif
+#if ASAN_INTERCEPT_PRCTL
#define PR_SET_NAME 15
-
-INTERCEPTOR(int, prctl, int option, unsigned long arg2, unsigned long arg3,
- unsigned long arg4, unsigned long arg5) {
+INTERCEPTOR(int, prctl, int option,
+ unsigned long arg2, unsigned long arg3, // NOLINT
+ unsigned long arg4, unsigned long arg5) { // NOLINT
int res = REAL(prctl(option, arg2, arg3, arg4, arg5));
if (option == PR_SET_NAME) {
AsanThread *t = asanThreadRegistry().GetCurrent();
@@ -193,6 +194,7 @@ INTERCEPTOR(int, prctl, int option, unsigned long arg2, unsigned long arg3,
}
return res;
}
+#endif
#if ASAN_INTERCEPT___CXA_THROW
INTERCEPTOR(void, __cxa_throw, void *a, void *b, void *c) {
@@ -737,7 +739,9 @@ void InitializeAsanInterceptors() {
#if ASAN_INTERCEPT_SIGLONGJMP
ASAN_INTERCEPT_FUNC(siglongjmp);
#endif
+#if ASAN_INTERCEPT_PRCTL
ASAN_INTERCEPT_FUNC(prctl);
+#endif
// Intercept exception handling functions.
#if ASAN_INTERCEPT___CXA_THROW