forked from OSchip/llvm-project
[asan] Enable signal and sigaction interceptors on Android.
Fixes AddressSanitizer.SignalTest breakage. llvm-svn: 201330
This commit is contained in:
parent
a238b17e76
commit
f79669a323
|
@ -186,6 +186,16 @@ INTERCEPTOR(int, pthread_create, void *thread,
|
||||||
#endif // ASAN_INTERCEPT_PTHREAD_CREATE
|
#endif // ASAN_INTERCEPT_PTHREAD_CREATE
|
||||||
|
|
||||||
#if ASAN_INTERCEPT_SIGNAL_AND_SIGACTION
|
#if ASAN_INTERCEPT_SIGNAL_AND_SIGACTION
|
||||||
|
|
||||||
|
#if SANITIZER_ANDROID
|
||||||
|
INTERCEPTOR(void*, bsd_signal, int signum, void *handler) {
|
||||||
|
if (!AsanInterceptsSignal(signum) ||
|
||||||
|
common_flags()->allow_user_segv_handler) {
|
||||||
|
return REAL(bsd_signal)(signum, handler);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
INTERCEPTOR(void*, signal, int signum, void *handler) {
|
INTERCEPTOR(void*, signal, int signum, void *handler) {
|
||||||
if (!AsanInterceptsSignal(signum) ||
|
if (!AsanInterceptsSignal(signum) ||
|
||||||
common_flags()->allow_user_segv_handler) {
|
common_flags()->allow_user_segv_handler) {
|
||||||
|
@ -193,6 +203,7 @@ INTERCEPTOR(void*, signal, int signum, void *handler) {
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
INTERCEPTOR(int, sigaction, int signum, const struct sigaction *act,
|
INTERCEPTOR(int, sigaction, int signum, const struct sigaction *act,
|
||||||
struct sigaction *oldact) {
|
struct sigaction *oldact) {
|
||||||
|
@ -754,8 +765,12 @@ void InitializeAsanInterceptors() {
|
||||||
ASAN_INTERCEPT_FUNC(longjmp);
|
ASAN_INTERCEPT_FUNC(longjmp);
|
||||||
#if ASAN_INTERCEPT_SIGNAL_AND_SIGACTION
|
#if ASAN_INTERCEPT_SIGNAL_AND_SIGACTION
|
||||||
ASAN_INTERCEPT_FUNC(sigaction);
|
ASAN_INTERCEPT_FUNC(sigaction);
|
||||||
|
#if SANITIZER_ANDROID
|
||||||
|
ASAN_INTERCEPT_FUNC(bsd_signal);
|
||||||
|
#else
|
||||||
ASAN_INTERCEPT_FUNC(signal);
|
ASAN_INTERCEPT_FUNC(signal);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#if ASAN_INTERCEPT_SWAPCONTEXT
|
#if ASAN_INTERCEPT_SWAPCONTEXT
|
||||||
ASAN_INTERCEPT_FUNC(swapcontext);
|
ASAN_INTERCEPT_FUNC(swapcontext);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
# define ASAN_INTERCEPT_SWAPCONTEXT 0
|
# define ASAN_INTERCEPT_SWAPCONTEXT 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !SANITIZER_ANDROID && !SANITIZER_WINDOWS
|
#if !SANITIZER_WINDOWS
|
||||||
# define ASAN_INTERCEPT_SIGNAL_AND_SIGACTION 1
|
# define ASAN_INTERCEPT_SIGNAL_AND_SIGACTION 1
|
||||||
#else
|
#else
|
||||||
# define ASAN_INTERCEPT_SIGNAL_AND_SIGACTION 0
|
# define ASAN_INTERCEPT_SIGNAL_AND_SIGACTION 0
|
||||||
|
|
Loading…
Reference in New Issue