summaryrefslogtreecommitdiff
path: root/lib/asan/asan_linux.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2012-11-23 10:14:44 +0000
committerAlexey Samsonov <samsonov@google.com>2012-11-23 10:14:44 +0000
commitf3950c6d6acf53fe60735f6d38715c1ea6df814b (patch)
tree71bd7ad6e521c930c3b6044ea6b43ce13d7969b6 /lib/asan/asan_linux.cc
parent0870028410087e67a0049c76cb7c64f02c260d24 (diff)
downloadcompiler-rt-f3950c6d6acf53fe60735f6d38715c1ea6df814b.tar.gz
compiler-rt-f3950c6d6acf53fe60735f6d38715c1ea6df814b.tar.bz2
compiler-rt-f3950c6d6acf53fe60735f6d38715c1ea6df814b.tar.xz
[ASan] intercept swapcontext on Linux only
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@168509 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_linux.cc')
-rw-r--r--lib/asan/asan_linux.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/asan/asan_linux.cc b/lib/asan/asan_linux.cc
index 2e6934e0..a70adeee 100644
--- a/lib/asan/asan_linux.cc
+++ b/lib/asan/asan_linux.cc
@@ -170,6 +170,23 @@ void GetStackTrace(StackTrace *stack, uptr max_s, uptr pc, uptr bp) {
}
}
+#if !ASAN_ANDROID
+void ClearShadowMemoryForContext(void *context) {
+ ucontext_t *ucp = (ucontext_t*)context;
+ uptr sp = (uptr)ucp->uc_stack.ss_sp;
+ uptr size = ucp->uc_stack.ss_size;
+ // Align to page size.
+ uptr bottom = sp & ~(kPageSize - 1);
+ size += sp - bottom;
+ size = RoundUpTo(size, kPageSize);
+ PoisonShadow(bottom, size, 0);
+}
+#else
+void ClearShadowMemoryForContext(void *context) {
+ UNIMPLEMENTED();
+}
+#endif
+
} // namespace __asan
#endif // __linux__