[asan] Fix signal interception on Android.
All supported version of Android provide both "signal" and "bsd_signal" libc exports. Binaries built for API level <21 call bsd_signal; newer binaries call signal. Simply intercept both. Fixes AddressSanitizer.SignalTest on Android/x86. llvm-svn: 246716
This commit is contained in:
parent
1a050c8aca
commit
b865f61ff9
|
|
@ -263,21 +263,21 @@ DEFINE_REAL_PTHREAD_FUNCTIONS
|
||||||
|
|
||||||
#if ASAN_INTERCEPT_SIGNAL_AND_SIGACTION
|
#if ASAN_INTERCEPT_SIGNAL_AND_SIGACTION
|
||||||
|
|
||||||
#if SANITIZER_ANDROID && !defined(_LP64)
|
#if SANITIZER_ANDROID
|
||||||
INTERCEPTOR(void*, bsd_signal, int signum, void *handler) {
|
INTERCEPTOR(void*, bsd_signal, int signum, void *handler) {
|
||||||
if (!IsDeadlySignal(signum) || common_flags()->allow_user_segv_handler) {
|
if (!IsDeadlySignal(signum) || common_flags()->allow_user_segv_handler) {
|
||||||
return REAL(bsd_signal)(signum, handler);
|
return REAL(bsd_signal)(signum, handler);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
#endif
|
||||||
|
|
||||||
INTERCEPTOR(void*, signal, int signum, void *handler) {
|
INTERCEPTOR(void*, signal, int signum, void *handler) {
|
||||||
if (!IsDeadlySignal(signum) || common_flags()->allow_user_segv_handler) {
|
if (!IsDeadlySignal(signum) || common_flags()->allow_user_segv_handler) {
|
||||||
return REAL(signal)(signum, handler);
|
return REAL(signal)(signum, 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) {
|
||||||
|
|
@ -769,11 +769,10 @@ 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 && !defined(_LP64)
|
#if SANITIZER_ANDROID
|
||||||
ASAN_INTERCEPT_FUNC(bsd_signal);
|
ASAN_INTERCEPT_FUNC(bsd_signal);
|
||||||
#else
|
|
||||||
ASAN_INTERCEPT_FUNC(signal);
|
|
||||||
#endif
|
#endif
|
||||||
|
ASAN_INTERCEPT_FUNC(signal);
|
||||||
#endif
|
#endif
|
||||||
#if ASAN_INTERCEPT_SWAPCONTEXT
|
#if ASAN_INTERCEPT_SWAPCONTEXT
|
||||||
ASAN_INTERCEPT_FUNC(swapcontext);
|
ASAN_INTERCEPT_FUNC(swapcontext);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue