From d5a0419aecd169af9f26b6f7254ff2ef555e497f Mon Sep 17 00:00:00 2001 From: Derek Bruening Date: Mon, 13 Jun 2016 15:42:39 +0000 Subject: [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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272553 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/esan/working_set.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/esan/working_set.cpp') diff --git a/lib/esan/working_set.cpp b/lib/esan/working_set.cpp index 9e7520f49..622fd29e8 100644 --- a/lib/esan/working_set.cpp +++ b/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]); -- cgit v1.2.3