Commit Graph

6439 Commits

Author SHA1 Message Date
Mike Aizatsky cc56ac3669 [sancov] adding internal function
llvm-svn: 256806
2016-01-05 02:09:54 +00:00
Mike Aizatsky 54fc6575c5 [sancov] coverage pc buffer
Differential Revision: http://reviews.llvm.org/D15871

llvm-svn: 256804
2016-01-05 01:49:39 +00:00
Xinliang David Li 74ec5db4bd [PGO] Sync up template file with master
llvm-svn: 256722
2016-01-04 01:22:55 +00:00
Xinliang David Li 4eb2cd64ff [PGO] Sync up template file with master
llvm-svn: 256711
2016-01-03 18:36:30 +00:00
Xinliang David Li 3e0e6e75d7 [PGO]: Eliminate custom typedefs in the FreeBSD case
Patch by: Sean Bruno 

Use o/s provided sys/types.h to bring in Profiling types.

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

llvm-svn: 256647
2015-12-30 19:18:55 +00:00
Xinliang David Li cda3bc2062 [PGO]: Refactor VP data writer
Extract the buffered filer writer code used by value profile 
writer and turn it into common/sharable buffered fileIO 
interfaces. Added a test case for the buffered file writer and
rewrite the VP dumping using the new APIs.

llvm-svn: 256604
2015-12-29 23:54:41 +00:00
Dimitry Andric 2d82f915c2 For the asan_symbolize.py script, use addr2line as the default system
symbolizer on FreeBSD too.  This allows the asan-symbolize-bad-path.cc
test to succeed.

llvm-svn: 256578
2015-12-29 21:36:34 +00:00
Xinliang David Li 54dd683726 [PGO]: Do not update Data->Value field during profile write.
The profile reader no longer depends on this field to be updated and point
to owning func's vp data. The VP data also no longer needs to be allocated
in a contiguous memory space.

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

llvm-svn: 256543
2015-12-29 07:13:59 +00:00
Xinliang David Li 69773fb0d2 Add more testing checks
llvm-svn: 256538
2015-12-29 06:42:12 +00:00
Xinliang David Li ebc4c25a50 [PGO] Make the test case more robust
Make the testing results not depending on function 
output order. This allows more strict result check.

llvm-svn: 256537
2015-12-29 06:28:44 +00:00
Xinliang David Li c30c88a240 Check test results more strictly (NFC)
llvm-svn: 256536
2015-12-29 06:26:43 +00:00
Bill Seurer 8a39ce8d32 [power] Fix test case target checks
Several test cases that used to fail on both power LE and BE
now run correctly on LE.

llvm-svn: 256391
2015-12-24 20:21:36 +00:00
Nico Weber 95ef4b3bf0 XFAIL ubsan suppressions.cpp test on Windows for now.
llvm-svn: 256307
2015-12-23 00:30:32 +00:00
Evgeniy Stepanov f02b782aa7 [cfi] Fix handling of uninstrumented libraries.
CFI shadow for non-CFI libraries should be "unchecked", not "invalid".

llvm-svn: 256285
2015-12-22 21:40:09 +00:00
Xinliang David Li baf55d8266 [PGO] Move buffer write callback to a common file
This is a NFC refactoring enabling code sharing by file writer.

llvm-svn: 256264
2015-12-22 18:57:15 +00:00
Nico Weber 6341a79387 fix a gcc warning
llvm-svn: 256256
2015-12-22 17:22:25 +00:00
Evgeniy Stepanov ed61ae6cde [asan] Add mincore test.
ASan does not really do anything interesting with mincore, but this
test verifies that the function still works correctly.

llvm-svn: 256207
2015-12-21 22:35:03 +00:00
Adhemerval Zanella b2910ea67e [compiler-rt] [tsan] Add support for PIE build on AArch64
This patch adds PIE executable support for aarch64-linux.  It adds
two more segments:

- 0x05500000000-0x05600000000: 39-bits PIE program segments
- 0x2aa00000000-0x2ab00000000: 42-bits PIE program segments

Fortunately it is possible to use the same transformation formula for
the new segments range with some adjustments in shadow to memory
formula (it adds a constant offset based on the VMA size).

A simple testcase is also added, however it is disabled on x86 due the
fact it might fail on newer kernels [1].

[1] https://git.kernel.org/linus/d1fd836dcf00d2028c700c7e44d2c23404062c90

llvm-svn: 256184
2015-12-21 19:27:57 +00:00
Kostya Serebryany 1d1be3dd88 [asan] fix fopen interceptor to not crash if path is NULL
llvm-svn: 256182
2015-12-21 19:22:26 +00:00
Xinliang David Li d1c84b078a [PGO] testing _WIN64 instead of _WIN32
llvm-svn: 256129
2015-12-20 19:55:15 +00:00
Xinliang David Li f82944db76 [PGO] Implement BOOL_CMPXCHG for Windows
llvm-svn: 256128
2015-12-20 19:11:44 +00:00
Xinliang David Li f48a1f54dd [PGO] Fix build failure with MSVC
llvm-svn: 256103
2015-12-19 19:16:32 +00:00
Alexey Samsonov 081a24e3a7 [UBSan] Implement runtime suppressions (PR25066).
Summary:
Add the ability to suppress UBSan reports for files/functions/modules
at runtime. The user can now pass UBSAN_OPTIONS=suppressions=supp.txt
with the contents of the form:

signed-integer-overflow:file-with-known-overflow.cpp
alignment:function_doing_unaligned_access
vptr:shared_object_with_vptr_failures.so

Suppression categories match the arguments passed to -fsanitize=
flag (although, see below). There is no overhead if suppressions are
not provided. Otherwise there is extra overhead for symbolization.

Limitations:
1) sometimes suppressions need debug info / symbol table to function
   properly (although sometimes frontend generates enough info to
   do the match).
2) it's only possible to suppress recoverable UB kinds - if you've
   built the code with -fno-sanitize-recover=undefined, suppressions
   will not work.
3) categories are fine-grained check kinds, not groups like "undefined"
   or "integer", so you can't write "undefined:file_with_ub.cc".

Reviewers: rsmith, kcc

Subscribers: cfe-commits

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

llvm-svn: 256018
2015-12-18 19:56:42 +00:00
Kuba Brecka 3aac36ad01 Revert r255996 ("[tsan] Add a DCHECK to verify __tsan_read* and __tsan_write function aren't called from ScopedInterceptor").
There are some test failures on the Linux buildbots.

llvm-svn: 255997
2015-12-18 13:52:08 +00:00
Kuba Brecka 15dd456236 [tsan] Add a DCHECK to verify __tsan_read* and __tsan_write function aren't called from ScopedInterceptor
Interceptors using ScopedInteceptor should never call into user's code before the ScopedInterceptor is out of scope (and its destructor is called). Let's add a DCHECK to enforce that.

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

llvm-svn: 255996
2015-12-18 13:08:15 +00:00
Kuba Brecka f9cc9d7392 [tsan] Fix scoping of ScopedInteceptor in libdispatch support
Some interceptors in tsan_libdispatch_mac.cc currently wrongly use TSAN_SCOPED_INTERCEPTOR/ScopedInterceptor. Its constructor can start ignoring memory accesses, and the destructor the stops this -- however, e.g. dispatch_sync can call user's code, so the ignoring will extend to user's code as well. This is not expected and we should only limit the scope of ScopedInterceptor to TSan code.  This patch introduces annotations that mark the beginning and ending of a callback into user's code.

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

llvm-svn: 255995
2015-12-18 11:16:24 +00:00
Xinliang David Li 01d06100dd Fix typo in MSC path
llvm-svn: 255938
2015-12-17 23:37:30 +00:00
Xinliang David Li abfd553c2b [PGO] cleanup: unify prefix for portability macros
llvm-svn: 255748
2015-12-16 03:29:15 +00:00
Evgeniy Stepanov 72b0111ce6 [cfi] Exclude ubsan runtime library from non-diag CFI builds.
Split the CFI runtime in two: cfi and cfi_diag. The latter includes
UBSan runtime to allow printing diagnostics.

llvm-svn: 255735
2015-12-16 00:38:41 +00:00
Evgeniy Stepanov 702a773988 [cfi] Fix GCC build.
llvm-svn: 255733
2015-12-16 00:34:30 +00:00
Evgeniy Stepanov 65c3a4b9c0 [cfi] Limit cross-dso tests to Linux.
Mac is missing the driver support to link the CFI runtime library.

llvm-svn: 255730
2015-12-16 00:24:18 +00:00
Evgeniy Stepanov b99d6c8b2a [cfi] Fix shadow sanity check.
The current check may break if the starting address in fill_shadow is
not page-aligned.

llvm-svn: 255725
2015-12-16 00:18:04 +00:00
Evgeniy Stepanov da1cf9287c Cross-DSO control flow integrity (compiler-rt part).
This is an initial version of the runtime cross-DSO CFI support
library.

It contains a number of FIXMEs, ex. it does not support the
diagnostic mode nor dlopen/dlclose, but it works and can be tested.
Diagnostic mode, in particular, would require some refactoring (we'd
like to gather all CFI hooks in the UBSan library into one function
so that we could easier pass the diagnostic information down to
__cfi_check). It will be implemented later.

Once the diagnostic mode is in, I plan to create a second test
configuration to run all existing tests in both modes. For now, this
patch includes only a few new cross-DSO tests.

llvm-svn: 255695
2015-12-15 23:00:33 +00:00
Xinliang David Li 1fbae3b76a [PGO] Improve prof library portability
Patch by: Johan Engelen

Introduce LLVM_LIBRARY_WEAK macro. Define LLVM_LIBRARY_WEAK
and LLVM_LIBRARY_VISIBIITY for MSVC

llvm-svn: 255688
2015-12-15 22:38:18 +00:00
Xinliang David Li be49271399 [PGO] Open file with explict binary mode
Patch by: Johan Engelen

On windows, opening in text mode will result in
line ending chars to be appended leading to
profile corruption.

llvm-svn: 255684
2015-12-15 22:18:11 +00:00
Kostya Serebryany 48b840dda1 [asan] try to fix ARM bots
llvm-svn: 255594
2015-12-15 01:05:35 +00:00
Kostya Serebryany 354bbb2ccd [asan] add option: handle_sigill
llvm-svn: 255588
2015-12-15 00:33:45 +00:00
Evgeniy Stepanov 04621bd888 [msan] Intercept ctermid, ctermid_r.
llvm-svn: 255566
2015-12-14 22:57:49 +00:00
Bill Schmidt e193989c17 [TSAN, PPC64] Fix obvious typo of supported virtual memory sizes
llvm-svn: 255507
2015-12-14 16:26:00 +00:00
Adhemerval Zanella ac764fabb8 [compiler-rt] [msan] Variadic support for AArch64
Now with variadic support for msan on aarch6 there is no need for
XFAIL signal_stress_test anymore.  Also to garantee aligned stores
for the FP/SIMD arguments enforce the '__msan_va_arg_tls' alignment
to sizeof the SIMD register (16).

llvm-svn: 255496
2015-12-14 14:15:32 +00:00
Kuba Brecka 2cdb522a5a [tsan] Update dispatch_group support to avoid using a disposed group object
We're using the dispatch group itself to synchronize (to call Release() and Acquire() on it), but in dispatch group notifications, the group can already be disposed/deallocated. This causes a later assertion failure at `DCHECK_EQ(*meta, 0);` in `MetaMap::AllocBlock` when the same memory is reused (note that the failure only happens in debug builds).

Fixing this by retaining the group and releasing it in the notification. Adding a stress test case that reproduces this.

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

llvm-svn: 255494
2015-12-14 13:32:57 +00:00
Adhemerval Zanella c974545cde [compiler-rt] [safestack] Silent overflow.c test on aarch64
The safestack overflow.c test is currently failing on an aarch64
buildbot with a segfault, but it is currently passing on other
configuration.

This patch silent the issue for now on aarch64 by setting to all
supported architectures the 'stable-runtime' configure and set
the test to requires it.

llvm-svn: 255491
2015-12-14 11:58:43 +00:00
Adhemerval Zanella eaf1162687 [compiler-rt] [safestack] Enable for aarch64
This patch enables the safestack for aarch64. The frontend already have
it enabled on all supported architectures and no adjustment is required
in llvm.

The compiler-rt adjustments are basically add on the cmake configuration
to enable the tests and fix the pagesize debug check by getting its
value at runtime (since aarch64 has multiple pagesize depending of
kernel configuration).

llvm-svn: 255345
2015-12-11 17:38:38 +00:00
Xinliang David Li dad2b8f79a [PGO] add a test case in profiler runtime
Add a test case to cover profile dumping of functions with no
value sites, functions with value sites but no dynamic VP data, 
and functions with runtime VP data.

llvm-svn: 255327
2015-12-11 05:43:55 +00:00
Xinliang David Li 449133d8b4 [PGO] Split value profiling runtime into its own file
Value profile runtime depends on libc which breaks
buffer API implemenation with current file organization.

Test case is also updated to check more symbols.

llvm-svn: 255294
2015-12-10 20:24:09 +00:00
Xinliang David Li 060037e0d2 Sync up with master
llvm-svn: 255293
2015-12-10 20:14:13 +00:00
Xinliang David Li 497c51cb8a [PGO] Move impl specific decl to InstrProfilingInternal.h (NFC)
llvm-svn: 255290
2015-12-10 19:50:04 +00:00
Alexey Samsonov c63c0d1cc0 [TSan] Try harder to avoid compiler-generated memcpy calls.
check_memcpy test added in r254959 fails on some configurations due to
memcpy() calls inserted by Clang. Try harder to avoid them by using
internal_memcpy() where applicable.

llvm-svn: 255287
2015-12-10 19:24:27 +00:00
Xinliang David Li e8c18a1bd1 [PGO] Move target-dependent macro to InstrProfilingPort.h (NFC)
llvm-svn: 255285
2015-12-10 19:20:25 +00:00
Xinliang David Li 26bcd193a8 [PGO] Header file cleanup (NFC)
InstrProfiling.h file declares profile runtime public APIs.
It has become a dumping place for many different things, which
needs cleanups. In this change, core type declarations and 
portability macros are moved to a new file InstrProfilingPort.h.

llvm-svn: 255270
2015-12-10 18:17:01 +00:00