[compiler-rt] r343812 - [Esan] Port cache frag to FreeBSD
David Carlier via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 4 13:58:18 PDT 2018
Author: devnexen
Date: Thu Oct 4 13:58:18 2018
New Revision: 343812
URL: http://llvm.org/viewvc/llvm-project?rev=343812&view=rev
Log:
[Esan] Port cache frag to FreeBSD
Data involving struct accesses accounting work (plan to support only efficiency-cache-frag flag in the frontend side).
Reviewers: krytarowski, vitalybuka, jfb
Reviewed By : vitalybuka
Differential Revision: https://reviews.llvm.org/D52608
Modified:
compiler-rt/trunk/cmake/config-ix.cmake
compiler-rt/trunk/lib/esan/CMakeLists.txt
compiler-rt/trunk/lib/esan/esan_interceptors.cpp
compiler-rt/trunk/lib/esan/esan_shadow.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.h
compiler-rt/trunk/test/esan/TestCases/large-stack-linux.c
compiler-rt/trunk/test/esan/TestCases/workingset-early-fault.c
compiler-rt/trunk/test/esan/TestCases/workingset-memset.cpp
compiler-rt/trunk/test/esan/TestCases/workingset-midreport.cpp
compiler-rt/trunk/test/esan/TestCases/workingset-samples.cpp
compiler-rt/trunk/test/esan/TestCases/workingset-signal-posix.cpp
compiler-rt/trunk/test/esan/TestCases/workingset-simple.cpp
compiler-rt/trunk/test/esan/lit.cfg
Modified: compiler-rt/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=343812&r1=343811&r2=343812&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/config-ix.cmake Thu Oct 4 13:58:18 2018
@@ -625,7 +625,7 @@ else()
endif()
if (COMPILER_RT_HAS_SANITIZER_COMMON AND ESAN_SUPPORTED_ARCH AND
- OS_NAME MATCHES "Linux")
+ OS_NAME MATCHES "Linux|FreeBSD")
set(COMPILER_RT_HAS_ESAN TRUE)
else()
set(COMPILER_RT_HAS_ESAN FALSE)
Modified: compiler-rt/trunk/lib/esan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/esan/CMakeLists.txt?rev=343812&r1=343811&r2=343812&view=diff
==============================================================================
--- compiler-rt/trunk/lib/esan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/esan/CMakeLists.txt Thu Oct 4 13:58:18 2018
@@ -14,6 +14,7 @@ set(ESAN_SOURCES
esan_interceptors.cpp
esan_linux.cpp
esan_sideline_linux.cpp
+ esan_sideline_bsd.cpp
cache_frag.cpp
working_set.cpp
working_set_posix.cpp)
Modified: compiler-rt/trunk/lib/esan/esan_interceptors.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/esan/esan_interceptors.cpp?rev=343812&r1=343811&r2=343812&view=diff
==============================================================================
--- compiler-rt/trunk/lib/esan/esan_interceptors.cpp (original)
+++ compiler-rt/trunk/lib/esan/esan_interceptors.cpp Thu Oct 4 13:58:18 2018
@@ -327,7 +327,7 @@ INTERCEPTOR(int, rmdir, char *path) {
// Signal-related interceptors
//===----------------------------------------------------------------------===//
-#if SANITIZER_LINUX
+#if SANITIZER_LINUX || SANITIZER_FREEBSD
typedef void (*signal_handler_t)(int);
INTERCEPTOR(signal_handler_t, signal, int signum, signal_handler_t handler) {
void *ctx;
@@ -344,7 +344,7 @@ INTERCEPTOR(signal_handler_t, signal, in
#define ESAN_MAYBE_INTERCEPT_SIGNAL
#endif
-#if SANITIZER_LINUX
+#if SANITIZER_LINUX || SANITIZER_FREEBSD
DECLARE_REAL(int, sigaction, int signum, const struct sigaction *act,
struct sigaction *oldact)
INTERCEPTOR(int, sigaction, int signum, const struct sigaction *act,
@@ -363,7 +363,11 @@ int real_sigaction(int signum, const voi
if (REAL(sigaction) == nullptr) {
// With an instrumented allocator, this is called during interceptor init
// and we need a raw syscall solution.
+#if SANITIZER_LINUX
return internal_sigaction_syscall(signum, act, oldact);
+#else
+ return internal_sigaction(signum, act, oldact);
+#endif
}
return REAL(sigaction)(signum, (const struct sigaction *)act,
(struct sigaction *)oldact);
@@ -376,7 +380,7 @@ int real_sigaction(int signum, const voi
#define ESAN_MAYBE_INTERCEPT_SIGACTION
#endif
-#if SANITIZER_LINUX
+#if SANITIZER_LINUX || SANITIZER_FREEBSD
INTERCEPTOR(int, sigprocmask, int how, __sanitizer_sigset_t *set,
__sanitizer_sigset_t *oldset) {
void *ctx;
Modified: compiler-rt/trunk/lib/esan/esan_shadow.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/esan/esan_shadow.h?rev=343812&r1=343811&r2=343812&view=diff
==============================================================================
--- compiler-rt/trunk/lib/esan/esan_shadow.h (original)
+++ compiler-rt/trunk/lib/esan/esan_shadow.h Thu Oct 4 13:58:18 2018
@@ -30,7 +30,7 @@ struct ApplicationRegion {
bool ShadowMergedWithPrev;
};
-#if SANITIZER_LINUX && defined(__x86_64__)
+#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && defined(__x86_64__)
// Linux x86_64
//
// Application memory falls into these 5 regions (ignoring the corner case
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=343812&r1=343811&r2=343812&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Thu Oct 4 13:58:18 2018
@@ -906,8 +906,18 @@ bool internal_sigismember(__sanitizer_si
const uptr bit = signum % (sizeof(k_set->sig[0]) * 8);
return k_set->sig[idx] & (1 << bit);
}
-#endif // SANITIZER_LINUX
-#endif // !SANITIZER_SOLARIS && !SANITIZER_NETBSD
+#elif SANITIZER_FREEBSD
+void internal_sigdelset(__sanitizer_sigset_t *set, int signum) {
+ sigset_t *rset = reinterpret_cast<sigset_t *>(set);
+ sigdelset(rset, signum);
+}
+
+bool internal_sigismember(__sanitizer_sigset_t *set, int signum) {
+ sigset_t *rset = reinterpret_cast<sigset_t *>(set);
+ return sigismember(rset, signum);
+}
+#endif
+#endif // !SANITIZER_SOLARIS
#if !SANITIZER_NETBSD
// ThreadLister implementation.
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.h?rev=343812&r1=343811&r2=343812&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.h Thu Oct 4 13:58:18 2018
@@ -69,6 +69,8 @@ void internal_sigdelset(__sanitizer_sigs
uptr internal_clone(int (*fn)(void *), void *child_stack, int flags, void *arg,
int *parent_tidptr, void *newtls, int *child_tidptr);
#endif
+#elif SANITIZER_FREEBSD
+void internal_sigdelset(__sanitizer_sigset_t *set, int signum);
#endif // SANITIZER_LINUX
// This class reads thread IDs from /proc/<pid>/task using only syscalls.
Modified: compiler-rt/trunk/test/esan/TestCases/large-stack-linux.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/esan/TestCases/large-stack-linux.c?rev=343812&r1=343811&r2=343812&view=diff
==============================================================================
--- compiler-rt/trunk/test/esan/TestCases/large-stack-linux.c (original)
+++ compiler-rt/trunk/test/esan/TestCases/large-stack-linux.c Thu Oct 4 13:58:18 2018
@@ -1,5 +1,7 @@
// RUN: %clang_esan_wset -O0 %s -o %t 2>&1
// RUN: %env_esan_opts="verbosity=1 record_snapshots=0" %run %t %t 2>&1 | FileCheck %s
+// Stucks at init and no clone feature equivalent.
+// UNSUPPORTED: freebsd
#include <assert.h>
#include <stdio.h>
Modified: compiler-rt/trunk/test/esan/TestCases/workingset-early-fault.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/esan/TestCases/workingset-early-fault.c?rev=343812&r1=343811&r2=343812&view=diff
==============================================================================
--- compiler-rt/trunk/test/esan/TestCases/workingset-early-fault.c (original)
+++ compiler-rt/trunk/test/esan/TestCases/workingset-early-fault.c Thu Oct 4 13:58:18 2018
@@ -3,6 +3,8 @@
//
// RUN: %clang_esan_wset %s -o %t
// RUN: %run %t 2>&1 | FileCheck %s
+// Stucks at init and no clone feature equivalent.
+// UNSUPPORTED: freebsd
#include <stdio.h>
#include <stdlib.h>
Modified: compiler-rt/trunk/test/esan/TestCases/workingset-memset.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/esan/TestCases/workingset-memset.cpp?rev=343812&r1=343811&r2=343812&view=diff
==============================================================================
--- compiler-rt/trunk/test/esan/TestCases/workingset-memset.cpp (original)
+++ compiler-rt/trunk/test/esan/TestCases/workingset-memset.cpp Thu Oct 4 13:58:18 2018
@@ -1,5 +1,7 @@
// RUN: %clang_esan_wset -O0 %s -o %t 2>&1
// RUN: %run %t 2>&1 | FileCheck %s
+// Stucks at init and no clone feature equivalent.
+// UNSUPPORTED: freebsd
#include <stdlib.h>
#include <string.h>
Modified: compiler-rt/trunk/test/esan/TestCases/workingset-midreport.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/esan/TestCases/workingset-midreport.cpp?rev=343812&r1=343811&r2=343812&view=diff
==============================================================================
--- compiler-rt/trunk/test/esan/TestCases/workingset-midreport.cpp (original)
+++ compiler-rt/trunk/test/esan/TestCases/workingset-midreport.cpp Thu Oct 4 13:58:18 2018
@@ -6,6 +6,8 @@
// FIXME: Re-enable once PR33590 is fixed.
// UNSUPPORTED: x86_64
+// Stucks at init and no clone feature equivalent.
+// UNSUPPORTED: freebsd
#include <sanitizer/esan_interface.h>
#include <sched.h>
Modified: compiler-rt/trunk/test/esan/TestCases/workingset-samples.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/esan/TestCases/workingset-samples.cpp?rev=343812&r1=343811&r2=343812&view=diff
==============================================================================
--- compiler-rt/trunk/test/esan/TestCases/workingset-samples.cpp (original)
+++ compiler-rt/trunk/test/esan/TestCases/workingset-samples.cpp Thu Oct 4 13:58:18 2018
@@ -3,6 +3,8 @@
// FIXME: Re-enable once PR33590 is fixed.
// UNSUPPORTED: x86_64
+// Stucks at init and no clone feature equivalent.
+// UNSUPPORTED: freebsd
#include <sanitizer/esan_interface.h>
#include <sched.h>
Modified: compiler-rt/trunk/test/esan/TestCases/workingset-signal-posix.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/esan/TestCases/workingset-signal-posix.cpp?rev=343812&r1=343811&r2=343812&view=diff
==============================================================================
--- compiler-rt/trunk/test/esan/TestCases/workingset-signal-posix.cpp (original)
+++ compiler-rt/trunk/test/esan/TestCases/workingset-signal-posix.cpp Thu Oct 4 13:58:18 2018
@@ -1,5 +1,7 @@
// RUN: %clang_esan_wset -O0 %s -o %t 2>&1
// RUN: %run %t 2>&1 | FileCheck %s
+// Stucks at init and no clone feature equivalent.
+// UNSUPPORTED: freebsd
#include <assert.h>
#include <setjmp.h>
Modified: compiler-rt/trunk/test/esan/TestCases/workingset-simple.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/esan/TestCases/workingset-simple.cpp?rev=343812&r1=343811&r2=343812&view=diff
==============================================================================
--- compiler-rt/trunk/test/esan/TestCases/workingset-simple.cpp (original)
+++ compiler-rt/trunk/test/esan/TestCases/workingset-simple.cpp Thu Oct 4 13:58:18 2018
@@ -3,6 +3,8 @@
// FIXME: Re-enable once PR33590 is fixed.
// UNSUPPORTED: x86_64
+// Stucks at init and no clone feature equivalent.
+// UNSUPPORTED: freebsd
#include <stdlib.h>
#include <string.h>
Modified: compiler-rt/trunk/test/esan/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/esan/lit.cfg?rev=343812&r1=343811&r2=343812&view=diff
==============================================================================
--- compiler-rt/trunk/test/esan/lit.cfg (original)
+++ compiler-rt/trunk/test/esan/lit.cfg Thu Oct 4 13:58:18 2018
@@ -39,6 +39,5 @@ config.substitutions.append(('%env_esan_
# Default test suffixes.
config.suffixes = ['.c', '.cpp']
-# EfficiencySanitizer tests are currently supported on Linux x86-64 only.
-if config.host_os not in ['Linux'] or config.target_arch not in ['x86_64', 'mips64'] :
+if config.host_os not in ['Linux', 'FreeBSD'] or config.target_arch not in ['x86_64', 'mips64'] :
config.unsupported = True
More information about the llvm-commits
mailing list