diff --git a/compiler-rt/lib/asan/asan_posix.cc b/compiler-rt/lib/asan/asan_posix.cc --- a/compiler-rt/lib/asan/asan_posix.cc +++ b/compiler-rt/lib/asan/asan_posix.cc @@ -39,7 +39,7 @@ // ---------------------- TSD ---------------- {{{1 -#if SANITIZER_NETBSD || SANITIZER_FREEBSD +#if SANITIZER_NETBSD // Thread Static Data cannot be used in early init on NetBSD and FreeBSD. // Reuse the Asan TSD API for compatibility with existing code // with an alternative implementation. diff --git a/compiler-rt/lib/msan/msan_linux.cc b/compiler-rt/lib/msan/msan_linux.cc --- a/compiler-rt/lib/msan/msan_linux.cc +++ b/compiler-rt/lib/msan/msan_linux.cc @@ -174,7 +174,7 @@ // ---------------------- TSD ---------------- {{{1 -#if SANITIZER_NETBSD || SANITIZER_FREEBSD +#if SANITIZER_NETBSD // Thread Static Data cannot be used in early init on NetBSD and FreeBSD. // Reuse the MSan TSD API for compatibility with existing code // with an alternative implementation. diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc @@ -777,9 +777,15 @@ } #if SANITIZER_FREEBSD +using syctlbyname_ptr = int (*)(const char *sname, void *oldp, size_t *oldlenp, + const void *newp, size_t newlen); int internal_sysctlbyname(const char *sname, void *oldp, uptr *oldlenp, const void *newp, uptr newlen) { - return sysctlbyname(sname, oldp, (size_t *)oldlenp, newp, (size_t)newlen); + static syctlbyname_ptr real_sysctlbyname = nullptr; + if (!real_sysctlbyname) + real_sysctlbyname = (syctlbyname_ptr)dlfunc(RTLD_NEXT, "sysctlbyname"); + CHECK(real_sysctlbyname); + return real_sysctlbyname(sname, oldp, (size_t *)oldlenp, newp, (size_t)newlen); } #endif #endif diff --git a/compiler-rt/test/asan/TestCases/Posix/fread_fwrite.cc b/compiler-rt/test/asan/TestCases/Posix/fread_fwrite.cc --- a/compiler-rt/test/asan/TestCases/Posix/fread_fwrite.cc +++ b/compiler-rt/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 #include diff --git a/compiler-rt/test/asan/TestCases/Posix/tsd_dtor_leak.cc b/compiler-rt/test/asan/TestCases/Posix/tsd_dtor_leak.cc --- a/compiler-rt/test/asan/TestCases/Posix/tsd_dtor_leak.cc +++ b/compiler-rt/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 #include #include diff --git a/compiler-rt/test/msan/tzset.cc b/compiler-rt/test/msan/tzset.cc --- a/compiler-rt/test/msan/tzset.cc +++ b/compiler-rt/test/msan/tzset.cc @@ -1,5 +1,4 @@ // RUN: %clangxx_msan -O0 %s -o %t && %run %t -// XFAIL: freebsd #include #include