summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlexander Richardson <arichardson.kde@gmail.com>2019-07-31 16:31:55 +0000
committerAlexander Richardson <arichardson.kde@gmail.com>2019-07-31 16:31:55 +0000
commit6d5cda641b895899809a95812717bbb8d39b4ad9 (patch)
tree69e17a3bd6d524731b5b99826511c5d1e1e38e32 /test
parent3d84eae21abfae854cd174dbea032a0d34897711 (diff)
downloadcompiler-rt-6d5cda641b895899809a95812717bbb8d39b4ad9.tar.gz
[Sanitizer][ASAN][MSAN] Fix infinite recursion on FreeBSD
Summary: MSAN was broken on FreeBSD by https://reviews.llvm.org/D55703: after this change accesses to the key variable call __tls_get_addr, which is intercepted. The interceptor then calls GetCurrentThread which calls MsanTSDGet which again calls __tls_get_addr, etc... Using the default implementation in the SANITIZER_FREEBSD case fixes MSAN for me. I then applied the same change to ASAN (introduced in https://reviews.llvm.org/D55596) but that did not work yet. In the ASAN case, we get infinite recursion again during initialization, this time because calling pthread_key_create() early on results in infinite recursion. pthread_key_create() calls sysctlbyname() which is intercepted but COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED returns true, so the interceptor calls internal_sysctlbyname() which then ends up calling the interceptor again. I fixed this issue by using dlsym() to get the libc version of sysctlbyname() instead. This fixes https://llvm.org/PR40761 Reviewers: vitalybuka, krytarowski, devnexen, dim, bsdjhb, #sanitizers, MaskRay Reviewed By: MaskRay Subscribers: MaskRay, emaste, kubamracek, jfb, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D65221 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@367442 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/asan/TestCases/Posix/fread_fwrite.cc3
-rw-r--r--test/asan/TestCases/Posix/tsd_dtor_leak.cc2
-rw-r--r--test/msan/tzset.cc1
3 files changed, 0 insertions, 6 deletions
diff --git a/test/asan/TestCases/Posix/fread_fwrite.cc b/test/asan/TestCases/Posix/fread_fwrite.cc
index 640248860..c06292604 100644
--- a/test/asan/TestCases/Posix/fread_fwrite.cc
+++ b/test/asan/TestCases/Posix/fread_fwrite.cc
@@ -1,9 +1,6 @@
// RUN: %clangxx_asan -g %s -o %t
// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-FWRITE
// RUN: not %run %t 1 2>&1 | FileCheck %s --check-prefix=CHECK-FREAD
-//
-// On FreeBSD stack overflow error instead
-// XFAIL: freebsd
#include <stdio.h>
#include <stdlib.h>
diff --git a/test/asan/TestCases/Posix/tsd_dtor_leak.cc b/test/asan/TestCases/Posix/tsd_dtor_leak.cc
index 26109fe1a..860f3459e 100644
--- a/test/asan/TestCases/Posix/tsd_dtor_leak.cc
+++ b/test/asan/TestCases/Posix/tsd_dtor_leak.cc
@@ -3,8 +3,6 @@
// RUN: %clangxx_asan -O1 %s -pthread -o %t
// RUN: %env_asan_opts=quarantine_size_mb=0 %run %t
// XFAIL: x86_64-netbsd
-// Assertion fails
-// XFAIL: x86_64-freebsd
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/test/msan/tzset.cc b/test/msan/tzset.cc
index 86805cd56..05915e047 100644
--- a/test/msan/tzset.cc
+++ b/test/msan/tzset.cc
@@ -1,5 +1,4 @@
// RUN: %clangxx_msan -O0 %s -o %t && %run %t
-// XFAIL: freebsd
#include <stdlib.h>
#include <string.h>