summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/esan/working_set.cpp
diff options
context:
space:
mode:
authorDerek Bruening <bruening@google.com>2016-06-13 15:42:39 +0000
committerDerek Bruening <bruening@google.com>2016-06-13 15:42:39 +0000
commit19a4b8d8f85b368d4bc72a40be8a1caa05dc7bd2 (patch)
tree955c29362c4a54582f32f6863b8e7e86d767949b /compiler-rt/lib/esan/working_set.cpp
parentac6617b288eda8958d060328163ae05050a59b25 (diff)
downloadbcm5719-llvm-19a4b8d8f85b368d4bc72a40be8a1caa05dc7bd2.tar.gz
bcm5719-llvm-19a4b8d8f85b368d4bc72a40be8a1caa05dc7bd2.zip
[sanitizer][esan] Add internal_sigaction_syscall
Summary: Adds a version of sigaction that uses a raw system call, to avoid circular dependencies and support calling sigaction prior to setting up interceptors. The new sigaction relies on an assembly sigreturn routine for its restorer, which is Linux x86_64-only for now. Uses the new sigaction to initialize the working set tool's shadow fault handler prior to libc interceptor being set up. This is required to support instrumentation invoked during interceptor setup, which happens with an instrumented tcmalloc or other allocator compiled with esan. Adds a test that emulates an instrumented allocator. Reviewers: aizatsky Subscribers: vitalybuka, tberghammer, zhaoqin, danalbert, kcc, srhines, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D21083 llvm-svn: 272553
Diffstat (limited to 'compiler-rt/lib/esan/working_set.cpp')
-rw-r--r--compiler-rt/lib/esan/working_set.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler-rt/lib/esan/working_set.cpp b/compiler-rt/lib/esan/working_set.cpp
index 9e7520f492e..622fd29e846 100644
--- a/compiler-rt/lib/esan/working_set.cpp
+++ b/compiler-rt/lib/esan/working_set.cpp
@@ -182,10 +182,13 @@ static void takeSample(void *Arg) {
}
}
-void initializeWorkingSet() {
+// Initialization that must be done before any instrumented code is executed.
+void initializeShadowWorkingSet() {
CHECK(getFlags()->cache_line_size == CacheLineSize);
registerMemoryFaultHandler();
+}
+void initializeWorkingSet() {
if (getFlags()->record_snapshots) {
for (u32 i = 0; i < NumFreq; ++i)
SizePerFreq[i].initialize(CircularBufferSizes[i]);
OpenPOWER on IntegriCloud