diff options
author | Kamil Rytarowski <n54@gmx.com> | 2018-03-03 11:43:11 +0000 |
---|---|---|
committer | Kamil Rytarowski <n54@gmx.com> | 2018-03-03 11:43:11 +0000 |
commit | eaf568bd2cb5fbdad146f6acf4f4220d2545afb4 (patch) | |
tree | 98b779b29f9cf22efb3b3061668c328450f539c5 /test/msan | |
parent | 6739538786f25e71206d34d7bd65d016b9d27d4d (diff) |
Adding Msan support to FreeBSD
Summary:
Enabling the memory sanitizer support for FreeBSD, most of unit tests are compatible.
- Adding fstat and stressor_r interceptors.
- Updating the struct link_map access since most likely the struct Obj_Entry had been updated since.
- Disabling few unit tests until further work is needed (or we can assume it can work in real world code).
Patch by: David CARLIER
Reviewers: vitalybuka, krytarowski
Reviewed By: vitalybuka
Subscribers: eugenis, dim, srhines, emaste, kubamracek, mgorny, fedor.sergeev, hintonda, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D43080
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326644 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/msan')
-rw-r--r-- | test/msan/dtls_test.c | 2 | ||||
-rw-r--r-- | test/msan/getutent.cc | 4 | ||||
-rw-r--r-- | test/msan/iconv.cc | 2 | ||||
-rw-r--r-- | test/msan/lit.cfg | 2 | ||||
-rw-r--r-- | test/msan/pthread_getattr_np_deadlock.cc | 1 | ||||
-rw-r--r-- | test/msan/pvalloc.cc | 1 | ||||
-rw-r--r-- | test/msan/strlen_of_shadow.cc | 2 | ||||
-rw-r--r-- | test/msan/textdomain.cc | 1 | ||||
-rw-r--r-- | test/msan/tls_reuse.cc | 1 | ||||
-rw-r--r-- | test/msan/tsearch.cc | 2 | ||||
-rw-r--r-- | test/msan/tzset.cc | 1 |
11 files changed, 16 insertions, 3 deletions
diff --git a/test/msan/dtls_test.c b/test/msan/dtls_test.c index 49d95c44c..a69c45f07 100644 --- a/test/msan/dtls_test.c +++ b/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/test/msan/getutent.cc b/test/msan/getutent.cc index 36f9e1f1f..b57101068 100644 --- a/test/msan/getutent.cc +++ b/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/test/msan/iconv.cc b/test/msan/iconv.cc index 7beb6a018..7713cb8e5 100644 --- a/test/msan/iconv.cc +++ b/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/test/msan/lit.cfg b/test/msan/lit.cfg index cac260999..550d04d08 100644 --- a/test/msan/lit.cfg +++ b/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/test/msan/pthread_getattr_np_deadlock.cc b/test/msan/pthread_getattr_np_deadlock.cc index 0f5228085..98eaf1415 100644 --- a/test/msan/pthread_getattr_np_deadlock.cc +++ b/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/test/msan/pvalloc.cc b/test/msan/pvalloc.cc index 7c406df79..649719a88 100644 --- a/test/msan/pvalloc.cc +++ b/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/test/msan/strlen_of_shadow.cc b/test/msan/strlen_of_shadow.cc index b9cf5f065..718cc08dc 100644 --- a/test/msan/strlen_of_shadow.cc +++ b/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/test/msan/textdomain.cc b/test/msan/textdomain.cc index 0a8154231..478b0993f 100644 --- a/test/msan/textdomain.cc +++ b/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/test/msan/tls_reuse.cc b/test/msan/tls_reuse.cc index 78a328fa3..9c2ee975c 100644 --- a/test/msan/tls_reuse.cc +++ b/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/test/msan/tsearch.cc b/test/msan/tsearch.cc index 0d8ee8f35..50a2efb31 100644 --- a/test/msan/tsearch.cc +++ b/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/test/msan/tzset.cc b/test/msan/tzset.cc index 05915e047..86805cd56 100644 --- a/test/msan/tzset.cc +++ b/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> |