Commit Graph

7109 Commits

Author SHA1 Message Date
Kostya Serebryany 5a7159c416 [asan] add an interface function __sanitizer_print_memory_profile (a basic memory profiler; asan/Linux-only for now)
llvm-svn: 271463
2016-06-02 01:21:52 +00:00
Xinliang David Li 96dad78963 [profile] Fix PR/27917
Skip the last (possibly) incomplete node from padding bytes.

llvm-svn: 271349
2016-05-31 23:12:13 +00:00
Qin Zhao 9e39638375 [esan|cfrag] Add the skeleton to handle the cfrag argument
Summary:
Adds the struct declaration for the cache-fragmentation tool variable
passed to the runtime library.

Updates test struct-simple.cpp.

Reviewers: aizatsky, bruening

Subscribers: filcab, kubabrecka, bruening, kcc, vitalybuka, eugenis, llvm-commits, zhaoqin

Differential Revision: http://reviews.llvm.org/D20542

llvm-svn: 271337
2016-05-31 21:27:39 +00:00
Chris Bieneman 5c3112cebe [CMake] Update to requiring CMake 3.4.3
Summary:
This is as per the discussions on developer lists:

http://lists.llvm.org/pipermail/llvm-dev/2016-April/098780.html
http://lists.llvm.org/pipermail/llvm-dev/2016-May/100058.html

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D20824

llvm-svn: 271327
2016-05-31 20:21:42 +00:00
Mehdi Amini 42b0c352c1 Fix test for Darwin: ASAN is calling abort by default on Darwin, which not detects as a crash
llvm-svn: 271323
2016-05-31 20:09:56 +00:00
Xinliang David Li b6d5f0b86f Local var name change /NFC
llvm-svn: 271304
2016-05-31 17:41:06 +00:00
Derek Bruening b7e38d8821 [esan] Add circular buffer data structure
Summary:
Adds a new class, CircularBuffer, for holding a wrap-around fixed-size
sequence of a primitive data type.  This will be used initially by the
working set tool.

Adds a unit test for CircularBuffer, including infrastructure support to
include esan headers and to link with the esan library by pretending to
want the working set tool.

Reviewers: aizatsky, filcab

Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka

Differential Revision: http://reviews.llvm.org/D20579

llvm-svn: 271286
2016-05-31 14:44:49 +00:00
Derek Bruening 8ef3f0fa5b [esan|wset] Iterate all memory to compute the total working set
Summary:
Adds iteration of all application memory in an efficient manner using
shadow faults.  Shadow memory starts out inaccessible and we mark it
writable one page at a time on each fault when the instrumentation touches
it.  This allows iteration over just the mapped shadow memory, saving
significant time.

Adds a process-end iteration and pretty-printing of the final result.

Adds a new test and updates the existing tests.

Reviewers: aizatsky, filcab

Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka

Differential Revision: http://reviews.llvm.org/D20578

llvm-svn: 271277
2016-05-31 13:41:07 +00:00
Derek Bruening 8e74c1084b [esan] Intercept and chain signal handlers
Summary:
In preparation for fault-based shadow memory iteration, we add support for
our own signal handler by adding app signal handler interception as well as
chaining for SIGSEGV.  This is done in a simple manner: we do not honor the
app's alternate stack nor any sigaction flags for SIGSEGV.

Adds a new test of transparency in app signal handling.

Reviewers: aizatsky

Subscribers: filcab, kubabrecka, vitalybuka, zhaoqin, kcc, eugenis, llvm-commits

Differential Revision: http://reviews.llvm.org/D20577

llvm-svn: 271272
2016-05-31 13:21:03 +00:00
Benjamin Kramer d53e3655e2 __builtin_ia32_storeups is no more. Replace it with xmmintrin.h intrinsic.
llvm-svn: 271257
2016-05-31 09:16:40 +00:00
Kuba Brecka 75b3da75b5 [asan] Fix a deadlock halt_on_error-signals.c when `reporting_thread_tid_` is 0
A signal can be delivered after TryLock but before StartReporting in ScopedInErrorReport, causing a deadlock.  Fixing this by statically initializing reporting_thread_tid_ to kInvalidTid.

Differential Revision: http://reviews.llvm.org/D20524

llvm-svn: 271256
2016-05-31 08:47:18 +00:00
Benjamin Kramer 1539cd326e Update asan_win_dll_thunk.cc to fix the windows buildbot.
llvm-svn: 271203
2016-05-30 10:00:54 +00:00
Benjamin Kramer 4acc312e47 Add __sanitizer_set_report_fd to the internal list of symbols.
Otherwise it will get the wrong visibility in the resulting library.

llvm-svn: 271202
2016-05-30 09:39:47 +00:00
Xinliang David Li 9ab45cf1eb Move test only for the relevant platform
llvm-svn: 271098
2016-05-28 04:26:06 +00:00
Kostya Serebryany e31e778160 [sanitizers] introduce a common run-time option dedup_token_length to help with report deduplication, off by default for now. See https://github.com/google/sanitizers/issues/684
llvm-svn: 271085
2016-05-28 01:25:44 +00:00
Derek Bruening 909d32955b [esan] Add handling of large stack size rlimits
Summary:
Adds detection of large stack size rlimits (over 1 TB or unlimited), which
results in an mmap location that our shadow mapping does not support.  We
re-exec the application in this situation.  Adds a test of this behavior.

Adds general detection of mmap regions outside of our app regions.  In the
future we want to try to adaptively handle these but for now we abort.

Moves the existing Linux-specific mmap code into a platform-specific file
where the new rlimit code lives.

Reviewers: eugenis

Subscribers: vitalybuka, zhaoqin, kcc, aizatsky, llvm-commits, kubabrecka

Differential Revision: http://reviews.llvm.org/D20745

llvm-svn: 271079
2016-05-28 00:25:16 +00:00
Kostya Serebryany d9a451ab0d [sanitizer] Move termination functions in their own file
Summary:
As suggested by kcc@ in http://reviews.llvm.org/D20084#441418, move the CheckFailed and Die functions, and their associated callback functionalities in their own separate file.
I expended the build rules to include a new rule that would not include those termination functions, so that another project can define their own.
The tests check-{a,t,m,ub,l,e,df}san are all passing.

Reviewers: llvm-commits, kcc

Subscribers: kubabrecka

Differential Revision: http://reviews.llvm.org/D20742

llvm-svn: 271055
2016-05-27 21:57:17 +00:00
Kostya Serebryany 54b7162692 [sanitizers] trying to fix Windows build
llvm-svn: 271050
2016-05-27 21:35:58 +00:00
Etienne Bergeron 00f3f6e296 This patch is activating the build of Asan on Windows 64-bits.
It's fixing compilation errors. The runtime is not yet working.

Missing features:

OverrideFunction for x64
an equiv function for inline asm (atomic_compare_exchange_strong)
shadow memory offset needs to be adjusted
RoundUpToInstrBoundary for x64
They will be implemented by subsequent patches.

Patch by Wei Wang.

Differential revision: http://reviews.llvm.org/D20455

llvm-svn: 271049
2016-05-27 21:29:31 +00:00
Kostya Serebryany 1508f591b3 [sanitizers] introduce __sanitizer_set_report_fd so that we can re-route the sanitizer logging to another fd from inside the process
llvm-svn: 271046
2016-05-27 21:23:05 +00:00
Xinliang David Li c3fdce3f1d [profile] Add a test to ensure runtime allocator is not invoked
llvm-svn: 271017
2016-05-27 16:49:29 +00:00
Sean Silva e5e819b7d7 [profile] Avoid unused variable warning.
llvm-svn: 270969
2016-05-27 06:15:13 +00:00
Derek Bruening 850d47ce64 [esan] Fix workingset-memset test failure
Fixes an esan workingset-memset test failure by switching to malloc to
avoid a shadow mapping issue with mmap in certain situations that will be
fully fixed separately.

llvm-svn: 270949
2016-05-27 01:47:27 +00:00
Xinliang David Li 753279e054 Add missing test case changes
llvm-svn: 270930
2016-05-26 22:20:39 +00:00
Xinliang David Li 274cb1d224 Add portable macro in common header
llvm-svn: 270928
2016-05-26 22:15:12 +00:00
Xinliang David Li b033220085 Add segment prefix for darwin
llvm-svn: 270875
2016-05-26 17:21:24 +00:00
Vitaly Buka 132639120a Init tsan with .preinit_array section
Summary: Some libraries, like OpenSSL, runs code from .init section.

Reviewers: kcc, eugenis

Subscribers: kubabrecka, llvm-commits

Differential Revision: http://reviews.llvm.org/D20646

llvm-svn: 270873
2016-05-26 17:05:36 +00:00
Xinliang David Li a290c9b47a Fix windows bot failure
llvm-svn: 270864
2016-05-26 16:21:11 +00:00
Xinliang David Li 555cf5efbd [profile] pre-allocate a small counter set in profile runtime
Tested with relavant benchmarks in SPEC2006

Differential Revision: http://reviews.llvm.org/D20651

llvm-svn: 270862
2016-05-26 16:06:36 +00:00
Kuba Brecka 6d8873b8bc [sanitizer] Fix a typo in config-ix.cmake causing all Darwin embedded platforms to be built with the 'iossim' SDK.
llvm-svn: 270840
2016-05-26 11:18:22 +00:00
Hal Finkel 678635e010 Fix columns for member function calls
After r270775, Clang is smarter about the generating the locations for
member-function calls. Update some ubsan tests accordingly.

llvm-svn: 270801
2016-05-25 23:47:34 +00:00
Xinliang David Li 65971297a0 [profile] Add early checking to bypass node pointer update
llvm-svn: 270766
2016-05-25 21:27:02 +00:00
Sean Silva 5cf73b09cd [profile] Don't return `Node` when it is null.
The max warning check was masking the "return 0" codepath.

See the thread "Warnings and compile-time failure on 458.sjeng" for more
info.

llvm-svn: 270762
2016-05-25 21:08:38 +00:00
Qin Zhao 7e4933f430 [esan][cfrag] Add skeleton for cache fragmentation tool support
Summary:
Adds cache_frag.h and cache_frag.cpp for the cache fragmentation tool.

Updates test struct-simple.cpp.

Reviewers: aizatsky

Subscribers: filcab, zhaoqin, llvm-commits, eugenis, vitalybuka, kcc, bruening, kubabrecka

Differential Revision: http://reviews.llvm.org/D20538

llvm-svn: 270737
2016-05-25 17:49:00 +00:00
Xinliang David Li 7f08d12b0b [profile] Further cleanup/refactor file handling code
Also get rid of the redundant strncpy calls.

llvm-svn: 270730
2016-05-25 17:30:15 +00:00
Kuba Brecka f5f140db28 [tsan] Change some OS X tests to include system headers (xpc.h, mman.h) more explicitly.
llvm-svn: 270713
2016-05-25 16:04:24 +00:00
Teresa Johnson c249167e90 Fix braced initializer list (NFC)
After r270617 I am getting an error when building:

projects/compiler-rt/lib/profile/InstrProfilingFile.c:33:36:
error: missing field 'PidChars' initializer
[-Werror,-Wmissing-field-initializers]
lprofFilename lprofCurFilename = {0};
                                   ^

Fix the aggregate initializer.

llvm-svn: 270697
2016-05-25 13:58:54 +00:00
Derek Bruening 88639859db Add working set base runtime library
Summary:
Adds the base runtime library for the working set tool.
Adds slowpath code for updating the shadow memory.

To be added in the future:
+ Scan memory and report the total size.
+ Take samples for intermediate values.

Reviewers: aizatsky

Subscribers: kubabrecka, vitalybuka, zhaoqin, kcc, eugenis, llvm-commits

Differential Revision: http://reviews.llvm.org/D20485

llvm-svn: 270650
2016-05-25 02:04:04 +00:00
Derek Bruening 515c15c207 [esan|cfrag] Add test struct-simple.cpp
Summary: Adds a new test struct-simple.cpp for testing the
cache-fragmentation tool with a multi-compilation-unit application.

Patch by Qin Zhao.

Reviewers: bruening

Subscribers: kubabrecka, kcc, vitalybuka, eugenis, aizatsky, llvm-commits, zhaoqin

Differential Revision: http://reviews.llvm.org/D20599

llvm-svn: 270631
2016-05-24 23:03:52 +00:00
Derek Bruening 7004e06b80 [esan] Add compilation unit init/exit routines.
Summary:
Adds processCompilationUnitInit and processCompilationUnitExit
for compilation unit init/exit.

Adds a tool-specific argument passed to esan_init.

Adds the dtor and esan_exit called from the dtor.

A test will be added separately (adding it here results in failure until
the corresponding compilation patch is in place).

Reviewers: aizatsky

Subscribers: kubabrecka, bruening, kcc, vitalybuka, eugenis, llvm-commits

Differential Revision: http://reviews.llvm.org/D20486

llvm-svn: 270624
2016-05-24 22:22:20 +00:00
Xinliang David Li 315e49d213 [profile] clean up profile file handling code
Differentianl Revision: http://reviews.llvm.org/D20572

llvm-svn: 270617
2016-05-24 21:29:18 +00:00
Evgeniy Stepanov 7b6f275b6a [asan] Workaround LD_PRELOAD bug in the Android linker.
llvm-svn: 270616
2016-05-24 21:25:00 +00:00
Xinliang David Li 41518945e3 Fix typo in comment
llvm-svn: 270524
2016-05-24 02:37:07 +00:00
Xinliang David Li 51fe002e67 [profile] clean up file initialization code
Also added more documentation.

llvm-svn: 270519
2016-05-24 01:23:09 +00:00
Xinliang David Li 66a891962b [profile] clean up runtime warnings.
o make warning message more meaningful to users.
 o add suggestion to fix the problem
 o limit the max number of output.

llvm-svn: 270483
2016-05-23 20:08:58 +00:00
Kuba Brecka 83460cfe74 [sanitizer] Don't use -fomit-frame-pointer in COMPILER_RT_DEBUG=On builds
Using -fomit-frame-pointer sometimes makes a crash log miss some frames. Let's not use this optimization in debug builds.

Differential Revision: http://reviews.llvm.org/D20425

llvm-svn: 270376
2016-05-22 19:59:06 +00:00
Xinliang David Li 7b41393497 [profile] initialize static pool properly
Remove dependency on runtime initializer to avoid
issues related to initialization order.

llvm-svn: 270371
2016-05-22 16:36:03 +00:00
Xinliang David Li 9235d9f6d7 bug fix: trim section specifier name length
llvm-svn: 270350
2016-05-22 01:21:31 +00:00
Xinliang David Li 31023d3061 Fix a typo (darwin only)
llvm-svn: 270339
2016-05-21 23:27:18 +00:00
Xinliang David Li 2a99857e1a Fix typo
llvm-svn: 270338
2016-05-21 23:06:39 +00:00