summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_common_interceptors.inc
diff options
context:
space:
mode:
authorDan Liew <dan@su-root.co.uk>2018-12-17 21:42:55 +0000
committerDan Liew <dan@su-root.co.uk>2018-12-17 21:42:55 +0000
commit4b81a4542b7b4baef0528036433ccf05956f0365 (patch)
treebe0fc2f8638981b2dbcd4b380bf485f92afd26da /lib/sanitizer_common/sanitizer_common_interceptors.inc
parentdda1670dd59a62d487d2c3ab6a3e921afaa78f74 (diff)
downloadcompiler-rt-4b81a4542b7b4baef0528036433ccf05956f0365.tar.gz
Don't trigger sanitizer initialization from `sysctlbyname` and `sysctl` interceptor.
Summary: This fixes the `ThreadSanitizer-x86_64-iossim` testsuite which broke when r348770 (https://reviews.llvm.org/D55473) landed. The root cause of the problem is that early-on during the iOS simulator init process a call to `sysctlbyname` is issued. If the TSan initializer is triggered at this point it will eventually trigger a call to `__cxa_at_exit(...)`. This call then aborts because the library implementing this function is not yet had its initialization function called. rdar://problem/46696934 Reviewers: kubamracek, george.karpenkov, devnexen, vitalybuka, krytarowski Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D55711 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@349402 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_common_interceptors.inc')
-rw-r--r--lib/sanitizer_common/sanitizer_common_interceptors.inc4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_common_interceptors.inc b/lib/sanitizer_common/sanitizer_common_interceptors.inc
index 09fd17ef6..37743a0fe 100644
--- a/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -7539,6 +7539,8 @@ INTERCEPTOR(int, fts_close, void *ftsp) {
INTERCEPTOR(int, sysctl, int *name, unsigned int namelen, void *oldp,
SIZE_T *oldlenp, void *newp, SIZE_T newlen) {
void *ctx;
+ if (COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED)
+ return internal_sysctl(name, namelen, oldp, oldlenp, newp, newlen);
COMMON_INTERCEPTOR_ENTER(ctx, sysctl, name, namelen, oldp, oldlenp, newp,
newlen);
if (name)
@@ -7561,6 +7563,8 @@ INTERCEPTOR(int, sysctl, int *name, unsigned int namelen, void *oldp,
INTERCEPTOR(int, sysctlbyname, char *sname, void *oldp, SIZE_T *oldlenp,
void *newp, SIZE_T newlen) {
void *ctx;
+ if (COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED)
+ return internal_sysctlbyname(sname, oldp, oldlenp, newp, newlen);
COMMON_INTERCEPTOR_ENTER(ctx, sysctlbyname, sname, oldp, oldlenp, newp,
newlen);
if (sname)