diff options
-rw-r--r-- | compiler-rt/cmake/config-ix.cmake | 2 | ||||
-rw-r--r-- | compiler-rt/lib/msan/CMakeLists.txt | 5 | ||||
-rw-r--r-- | compiler-rt/lib/msan/msan_interceptors.cc | 2 | ||||
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc | 2 | ||||
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h | 2 | ||||
-rw-r--r-- | compiler-rt/test/msan/dtls_test.c | 2 | ||||
-rw-r--r-- | compiler-rt/test/msan/getutent.cc | 4 | ||||
-rw-r--r-- | compiler-rt/test/msan/iconv.cc | 2 | ||||
-rw-r--r-- | compiler-rt/test/msan/lit.cfg | 2 | ||||
-rw-r--r-- | compiler-rt/test/msan/pthread_getattr_np_deadlock.cc | 1 | ||||
-rw-r--r-- | compiler-rt/test/msan/pvalloc.cc | 1 | ||||
-rw-r--r-- | compiler-rt/test/msan/strlen_of_shadow.cc | 2 | ||||
-rw-r--r-- | compiler-rt/test/msan/textdomain.cc | 1 | ||||
-rw-r--r-- | compiler-rt/test/msan/tls_reuse.cc | 1 | ||||
-rw-r--r-- | compiler-rt/test/msan/tsearch.cc | 2 | ||||
-rw-r--r-- | compiler-rt/test/msan/tzset.cc | 1 |
16 files changed, 24 insertions, 8 deletions
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake index 1e04da7bb74..7f838df5f97 100644 --- a/compiler-rt/cmake/config-ix.cmake +++ b/compiler-rt/cmake/config-ix.cmake @@ -530,7 +530,7 @@ else() endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND MSAN_SUPPORTED_ARCH AND - OS_NAME MATCHES "Linux|NetBSD") + OS_NAME MATCHES "Linux|FreeBSD|NetBSD") set(COMPILER_RT_HAS_MSAN TRUE) else() set(COMPILER_RT_HAS_MSAN FALSE) diff --git a/compiler-rt/lib/msan/CMakeLists.txt b/compiler-rt/lib/msan/CMakeLists.txt index 598ae54588c..cdfcc6146be 100644 --- a/compiler-rt/lib/msan/CMakeLists.txt +++ b/compiler-rt/lib/msan/CMakeLists.txt @@ -17,8 +17,11 @@ set(MSAN_RTL_CXX_SOURCES set(MSAN_RTL_CFLAGS ${SANITIZER_COMMON_CFLAGS}) +append_list_if(COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC -ftls-model=initial-exec MSAN_RTL_CFLAGS) append_rtti_flag(OFF MSAN_RTL_CFLAGS) -append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE MSAN_RTL_CFLAGS) +if(NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE MSAN_RTL_CFLAGS) +endif() # Prevent clang from generating libc calls. append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding MSAN_RTL_CFLAGS) diff --git a/compiler-rt/lib/msan/msan_interceptors.cc b/compiler-rt/lib/msan/msan_interceptors.cc index 11088649456..1d33b5d2721 100644 --- a/compiler-rt/lib/msan/msan_interceptors.cc +++ b/compiler-rt/lib/msan/msan_interceptors.cc @@ -681,7 +681,7 @@ INTERCEPTOR(int, putenv, char *string) { return res; } -#if SANITIZER_NETBSD +#if SANITIZER_FREEBSD || SANITIZER_NETBSD INTERCEPTOR(int, fstat, int fd, void *buf) { ENSURE_MSAN_INITED(); int res = REAL(fstat)(fd, buf); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc index 7f6bc3412c0..dac3cfb4ad8 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc @@ -3590,7 +3590,7 @@ INTERCEPTOR(char *, strerror, int errnum) { // * GNU version returns message pointer, which points to either buf or some // static storage. #if ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE) || \ - SANITIZER_MAC || SANITIZER_ANDROID || SANITIZER_NETBSD + SANITIZER_MAC || SANITIZER_ANDROID || SANITIZER_NETBSD || SANITIZER_FREEBSD // POSIX version. Spec is not clear on whether buf is NULL-terminated. // At least on OSX, buf contents are valid even when the call fails. INTERCEPTOR(int, strerror_r, int errnum, char *buf, SIZE_T buflen) { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h index 2ed8afb2801..f89a11312d8 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h @@ -24,7 +24,7 @@ // FreeBSD's dlopen() returns a pointer to an Obj_Entry structure that // incorporates the map structure. # define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) \ - ((link_map*)((handle) == nullptr ? nullptr : ((char*)(handle) + 544))) + ((link_map*)((handle) == nullptr ? nullptr : ((char*)(handle) + 560))) // Get sys/_types.h, because that tells us whether 64-bit inodes are // used in struct dirent below. #include <sys/_types.h> diff --git a/compiler-rt/test/msan/dtls_test.c b/compiler-rt/test/msan/dtls_test.c index 49d95c44c1d..a69c45f07c2 100644 --- a/compiler-rt/test/msan/dtls_test.c +++ b/compiler-rt/test/msan/dtls_test.c @@ -5,6 +5,8 @@ Regression test for a bug in msan/glibc integration, see https://sourceware.org/bugzilla/show_bug.cgi?id=16291 and https://github.com/google/sanitizers/issues/547 + + XFAIL: freebsd */ #ifndef BUILD_SO diff --git a/compiler-rt/test/msan/getutent.cc b/compiler-rt/test/msan/getutent.cc index 36f9e1f1f7e..b57101068dd 100644 --- a/compiler-rt/test/msan/getutent.cc +++ b/compiler-rt/test/msan/getutent.cc @@ -1,14 +1,18 @@ // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t +#ifndef __FreeBSD__ #include <utmp.h> +#endif #include <utmpx.h> #include <sanitizer/msan_interface.h> int main(void) { +#ifndef __FreeBSD__ setutent(); while (struct utmp *ut = getutent()) __msan_check_mem_is_initialized(ut, sizeof(*ut)); endutent(); +#endif setutxent(); while (struct utmpx *utx = getutxent()) diff --git a/compiler-rt/test/msan/iconv.cc b/compiler-rt/test/msan/iconv.cc index 7beb6a01877..7713cb8e5f4 100644 --- a/compiler-rt/test/msan/iconv.cc +++ b/compiler-rt/test/msan/iconv.cc @@ -15,7 +15,7 @@ int main(void) { char inbuf_[100]; strcpy(inbuf_, "sample text"); char outbuf_[100]; -#if defined(__FreeBSD__) || defined(__NetBSD__) +#if defined(__NetBSD__) // Some OSes expect the 2nd argument of iconv(3) to be of type const char ** const char *inbuf = inbuf_; #else diff --git a/compiler-rt/test/msan/lit.cfg b/compiler-rt/test/msan/lit.cfg index cac26099987..550d04d0812 100644 --- a/compiler-rt/test/msan/lit.cfg +++ b/compiler-rt/test/msan/lit.cfg @@ -29,7 +29,7 @@ config.substitutions.append( ("%clangxx_msan ", build_invocation(clang_msan_cxxf # Default test suffixes. config.suffixes = ['.c', '.cc', '.cpp'] -if config.host_os not in ['Linux', 'NetBSD']: +if config.host_os not in ['Linux', 'NetBSD', 'FreeBSD']: config.unsupported = True # For mips64, mips64el we have forced store_context_size to 1 because these diff --git a/compiler-rt/test/msan/pthread_getattr_np_deadlock.cc b/compiler-rt/test/msan/pthread_getattr_np_deadlock.cc index 0f52280856c..98eaf14150b 100644 --- a/compiler-rt/test/msan/pthread_getattr_np_deadlock.cc +++ b/compiler-rt/test/msan/pthread_getattr_np_deadlock.cc @@ -1,6 +1,7 @@ // RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && %run %t // Regression test for a deadlock in pthread_getattr_np +// UNSUPPORTED: freebsd #include <assert.h> #include <pthread.h> diff --git a/compiler-rt/test/msan/pvalloc.cc b/compiler-rt/test/msan/pvalloc.cc index 7c406df79bb..649719a88cb 100644 --- a/compiler-rt/test/msan/pvalloc.cc +++ b/compiler-rt/test/msan/pvalloc.cc @@ -4,6 +4,7 @@ // RUN: MSAN_OPTIONS=allocator_may_return_null=0 not %run %t psm1 2>&1 | FileCheck %s // RUN: MSAN_OPTIONS=allocator_may_return_null=1 %run %t psm1 2>&1 +// pvalloc is Linux only // UNSUPPORTED: win32, freebsd, netbsd // Checks that pvalloc overflows are caught. If the allocator is allowed to diff --git a/compiler-rt/test/msan/strlen_of_shadow.cc b/compiler-rt/test/msan/strlen_of_shadow.cc index b9cf5f065d2..718cc08dc1f 100644 --- a/compiler-rt/test/msan/strlen_of_shadow.cc +++ b/compiler-rt/test/msan/strlen_of_shadow.cc @@ -2,6 +2,8 @@ // Check that strlen() and similar intercepted functions can be called on shadow // memory. +// The mem_to_shadow's part might need rework +// XFAIL: freebsd #include <assert.h> #include <stdint.h> diff --git a/compiler-rt/test/msan/textdomain.cc b/compiler-rt/test/msan/textdomain.cc index 0a81542319d..478b0993f83 100644 --- a/compiler-rt/test/msan/textdomain.cc +++ b/compiler-rt/test/msan/textdomain.cc @@ -1,4 +1,5 @@ // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t +// textdomain() is not a part of libc on FreeBSD and NetBSD. // UNSUPPORTED: netbsd, freebsd #include <libintl.h> diff --git a/compiler-rt/test/msan/tls_reuse.cc b/compiler-rt/test/msan/tls_reuse.cc index 78a328fa3ce..9c2ee975cb5 100644 --- a/compiler-rt/test/msan/tls_reuse.cc +++ b/compiler-rt/test/msan/tls_reuse.cc @@ -1,6 +1,7 @@ // RUN: %clangxx_msan -O0 %s -o %t && %run %t // Check that when TLS block is reused between threads, its shadow is cleaned. +// XFAIL: freebsd #include <pthread.h> #include <stdio.h> diff --git a/compiler-rt/test/msan/tsearch.cc b/compiler-rt/test/msan/tsearch.cc index 0d8ee8f35b2..50a2efb31fa 100644 --- a/compiler-rt/test/msan/tsearch.cc +++ b/compiler-rt/test/msan/tsearch.cc @@ -1,7 +1,7 @@ // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t // tdestroy is a GNU extension -// UNSUPPORTED: netbsd +// UNSUPPORTED: netbsd, freebsd #include <assert.h> #include <search.h> diff --git a/compiler-rt/test/msan/tzset.cc b/compiler-rt/test/msan/tzset.cc index 05915e047e1..86805cd56c5 100644 --- a/compiler-rt/test/msan/tzset.cc +++ b/compiler-rt/test/msan/tzset.cc @@ -1,4 +1,5 @@ // RUN: %clangxx_msan -O0 %s -o %t && %run %t +// XFAIL: freebsd #include <stdlib.h> #include <string.h> |