summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2015-08-05 15:17:59 +0000
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2015-08-05 15:17:59 +0000
commit925201613a92897de9019c1b5fd0199622820012 (patch)
treede96d35ac1091b384743fdc90c0ec645a666d35e /lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
parent05e761714b3b67a43cc9a0c67bc6750d7994d7ef (diff)
[tsan] Enable tsan for aarch64
This patch enabled TSAN for aarch64 with 39-bit VMA layout. As defined by tsan_platform.h the layout used is: 0000 4000 00 - 0200 0000 00: main binary 2000 0000 00 - 4000 0000 00: shadow memory 4000 0000 00 - 5000 0000 00: metainfo 5000 0000 00 - 6000 0000 00: - 6000 0000 00 - 6200 0000 00: traces 6200 0000 00 - 7d00 0000 00: - 7d00 0000 00 - 7e00 0000 00: heap 7e00 0000 00 - 7fff ffff ff: modules and main thread stack Which gives it about 8GB for main binary, 4GB for heap and 8GB for modules and main thread stack. Most of tests are passing, with the exception of: * ignore_lib0, ignore_lib1, ignore_lib3 due a kernel limitation for no support to make mmap page non-executable. * longjmp tests due missing specialized assembly routines. These tests are xfail for now. The only tsan issue still showing is: rtl/TsanRtlTest/Posix.ThreadLocalAccesses Which still required further investigation. The test is disable for aarch64 for now. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@244055 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc27
1 files changed, 23 insertions, 4 deletions
diff --git a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
index 47b27e7e5..b5139ecad 100644
--- a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
@@ -14,7 +14,8 @@
#include "sanitizer_platform.h"
-#if SANITIZER_LINUX && (defined(__x86_64__) || defined(__mips__))
+#if SANITIZER_LINUX && (defined(__x86_64__) || defined(__mips__) || \
+ defined(__aarch64__))
#include "sanitizer_stoptheworld.h"
@@ -27,6 +28,8 @@
#include <sys/prctl.h> // for PR_* definitions
#include <sys/ptrace.h> // for PTRACE_* definitions
#include <sys/types.h> // for pid_t
+#include <sys/uio.h> // for iovec
+#include <elf.h> // for NT_PRSTATUS
#if SANITIZER_ANDROID && defined(__arm__)
# include <linux/user.h> // for pt_regs
#else
@@ -469,6 +472,11 @@ typedef pt_regs regs_struct;
typedef struct user regs_struct;
#define REG_SP regs[EF_REG29]
+#elif defined(__aarch64__)
+typedef struct user_pt_regs regs_struct;
+#define REG_SP sp
+#define ARCH_IOVEC_FOR_GETREGSET
+
#else
#error "Unsupported architecture"
#endif // SANITIZER_ANDROID && defined(__arm__)
@@ -479,8 +487,18 @@ int SuspendedThreadsList::GetRegistersAndSP(uptr index,
pid_t tid = GetThreadID(index);
regs_struct regs;
int pterrno;
- if (internal_iserror(internal_ptrace(PTRACE_GETREGS, tid, NULL, &regs),
- &pterrno)) {
+#ifdef ARCH_IOVEC_FOR_GETREGSET
+ struct iovec regset_io;
+ regset_io.iov_base = &regs;
+ regset_io.iov_len = sizeof(regs_struct);
+ bool isErr = internal_iserror(internal_ptrace(PTRACE_GETREGSET, tid,
+ (void*)NT_PRSTATUS, (void*)&regset_io),
+ &pterrno);
+#else
+ bool isErr = internal_iserror(internal_ptrace(PTRACE_GETREGS, tid, NULL,
+ &regs), &pterrno);
+#endif
+ if (isErr) {
VReport(1, "Could not get registers from thread %d (errno %d).\n", tid,
pterrno);
return -1;
@@ -496,4 +514,5 @@ uptr SuspendedThreadsList::RegisterCount() {
}
} // namespace __sanitizer
-#endif // SANITIZER_LINUX && (defined(__x86_64__) || defined(__mips__))
+#endif // SANITIZER_LINUX && (defined(__x86_64__) || defined(__mips__)
+ // || defined(__aarch64__)