Evgeniy Stepanov
74e77756ef
[sanitizer] Intercept getpwent/getgrent.
...
llvm-svn: 205000
2014-03-28 10:56:07 +00:00
Evgeniy Stepanov
89602651e8
[msan] Implement __msan_set_death_callback.
...
llvm-svn: 204926
2014-03-27 14:04:58 +00:00
Evgeniy Stepanov
9dcd5a353a
[msan] Intercept several malloc-related functions.
...
llvm-svn: 204923
2014-03-27 13:29:29 +00:00
Rafael Espindola
5e46070516
Avoid aliases to weak aliases in interceptors.
...
The interceptors had code that after macro expansion ended up looking like
extern "C" void memalign()
__attribute__((weak, alias("__interceptor_memalign")));
extern "C" void __interceptor_memalign() {}
extern "C" void __interceptor___libc_memalign()
__attribute__((alias("memalign")));
That is,
* __interceptor_memalign is a function
* memalign is a weak alias to __interceptor_memalign
* __interceptor___libc_memalign is an alias to memalign
Both gcc and clang produce assembly that look like
__interceptor_memalign:
...
.weak memalign
memalign = __interceptor_memalign
.globl __interceptor___libc_memalign
__interceptor___libc_memalign = memalign
What it means in the end is that we have 3 symbols pointing to the
same position in the file, one of which is weak:
8: 0000000000000000 1 FUNC GLOBAL DEFAULT 1
__interceptor_memalign
9: 0000000000000000 1 FUNC WEAK DEFAULT 1 memalign
10: 0000000000000000 1 FUNC GLOBAL DEFAULT 1
__interceptor___libc_memalign
In particular, note that __interceptor___libc_memalign will always
point to __interceptor_memalign, even if we do link in a strong symbol
for memalign. In fact, the above code produces exactly the same binary
as
extern "C" void memalign()
__attribute__((weak, alias("__interceptor_memalign")));
extern "C" void __interceptor_memalign() {}
extern "C" void __interceptor___libc_memalign()
__attribute__((alias("__interceptor_memalign")));
If nothing else, this patch makes it more obvious what is going on.
llvm-svn: 204823
2014-03-26 15:48:59 +00:00
Evgeniy Stepanov
1382fabd97
[msan] Enable SelectPartial test.
...
Fixed in r204716.
llvm-svn: 204717
2014-03-25 13:09:14 +00:00
Evgeniy Stepanov
517ff05ffb
[msan] Fix compiler warning in msan_test.cc.
...
llvm-svn: 204708
2014-03-25 10:03:39 +00:00
Evgeniy Stepanov
90384ad60e
[msan] A disabled test for inexact "select" instrumentation.
...
llvm-svn: 204707
2014-03-25 09:36:15 +00:00
Alexey Samsonov
c41ca6d31a
[CMake] Rename the variable
...
llvm-svn: 204602
2014-03-24 13:29:20 +00:00
Alexey Samsonov
1847401332
[CMake] Respect CMAKE_CXX_FLAGS in custom clang_compile commands
...
llvm-svn: 204593
2014-03-24 09:42:12 +00:00
Alexey Samsonov
8c956460d3
Make MSan unittest -Werror=sign-compare clean
...
llvm-svn: 204592
2014-03-24 09:41:11 +00:00
Sergey Matveev
fa76f3b3a5
[MSan] Add __msan_unpoison_string() to the public interface.
...
Using __msan_unpoison() on null-terminated strings is awkward because
strlen() can't be called on a poisoned string. This case warrants a special
interface function.
llvm-svn: 204448
2014-03-21 10:12:17 +00:00
Alexander Potapenko
1296436cbf
[libsanitizer] Introduce flag descriptions.
...
Extend ParseFlag to accept the |description| parameter, add dummy values for all existing flags.
As the flags are parsed their descriptions are stored in a global linked list.
The tool can later call __sanitizer::PrintFlagDescriptions() to dump all the flag names and their descriptions.
Add the 'help' flag and make ASan, TSan and MSan print the flags if 'help' is set to 1.
llvm-svn: 204339
2014-03-20 12:52:52 +00:00
Alexey Samsonov
17703c1092
[CMake] Build sanitizer unit tests with -std=c++11
...
llvm-svn: 204234
2014-03-19 13:57:33 +00:00
Evgeniy Stepanov
412d973980
[msan] Origin tracking with history, compiler-rt part.
...
Compiler-rt part of MSan implementation of advanced origin tracking,
when we record not only creation point, but all locations where
an uninitialized value was stored to memory, too.
llvm-svn: 204152
2014-03-18 13:45:19 +00:00
Evgeniy Stepanov
9fa9a49853
[msan] Test for aggregates passing through ellipsis.
...
llvm-svn: 203795
2014-03-13 13:18:15 +00:00
Alexey Samsonov
32956d651a
[CMake] Make append_if semantics similar to those used in LLVM
...
llvm-svn: 203773
2014-03-13 09:31:36 +00:00
Evgeniy Stepanov
72a9d25060
[sanitizer] Simplify interceptors with user callbacks.
...
Get rid of the context argument in UNPOISON_PARAM and INITIALIZE_RANGE.
Get rid of all the thread-local contexts in interceptors.
llvm-svn: 203119
2014-03-06 13:26:09 +00:00
Alexey Samsonov
6dece3c99f
Add common interceptors for memchr/memrchr
...
llvm-svn: 202972
2014-03-05 13:25:32 +00:00
Alexey Samsonov
d964e7cd81
[CMake] Test for libdl and libpthread presence
...
llvm-svn: 202847
2014-03-04 13:28:21 +00:00
Evgeniy Stepanov
f7abc8dff6
[msan] Tests for X86 SIMD bitshift intrinsic support.
...
llvm-svn: 202713
2014-03-03 13:52:36 +00:00
Joerg Sonnenberger
9d09e2fe90
Reapply r201910. MSVC gets __func__ defined explicitly, even though it
...
can't build anything here.
llvm-svn: 202297
2014-02-26 20:33:22 +00:00
Kostya Serebryany
cf5d8e4f29
AdjustStackSizeLinux() is used in Lsan, Tsan and Msan non-Linux-specific code so it seems it should have more generic name and moved to a common scope.
...
Renamed to AdjustStackSize.
Patch by Viktor Kutuzov.
llvm-svn: 202011
2014-02-24 08:53:26 +00:00
Reid Kleckner
324eee45a7
Revert "Replace __FUNCTION__ with __func__, the latter being standard C99/C++11."
...
This reverts commit r201910.
While __func__ may be standard in C++11, it was only recently added to
MSVC in 2013 CTP, and LLVM supports MSVC 2012. __FUNCTION__ may not be
standard, but it's *very* portable.
llvm-svn: 201916
2014-02-22 00:37:45 +00:00
Joerg Sonnenberger
b15779f307
Replace __FUNCTION__ with __func__, the latter being standard C99/C++11.
...
llvm-svn: 201910
2014-02-21 23:55:15 +00:00
Alexey Samsonov
11705b2f10
[CMake] break dependency between unit tests and runtimes in standalone build
...
llvm-svn: 201778
2014-02-20 12:03:56 +00:00
Alexey Samsonov
cd8535a96d
[CMake] Introduce COMPILER_RT_INCLUDE_TESTS option
...
llvm-svn: 201666
2014-02-19 11:18:47 +00:00
Alexey Samsonov
63a4af7346
[CMake] Add top-level target for each compiler-rt library, and add 'compiler-rt' target encompassing them all.
...
llvm-svn: 201556
2014-02-18 09:33:45 +00:00
Alexey Samsonov
878a9a5de2
[CMake] Check for -fPIE and -ffreestanding flags for consistency
...
llvm-svn: 201549
2014-02-18 08:07:09 +00:00
Alexey Samsonov
b73db72a17
[CMake] Simplify setting compile flag disabling RTTI
...
llvm-svn: 201547
2014-02-18 07:52:40 +00:00
Alexey Samsonov
8434e60f7e
Move MSan lit-tests under test/msan
...
llvm-svn: 201412
2014-02-14 13:02:58 +00:00
Evgeniy Stepanov
a21280307f
[sanitizer] Fix getpwuid_r (and similar) interceptors missing one of the arguments.
...
llvm-svn: 201410
2014-02-14 12:32:15 +00:00
Evgeniy Stepanov
05938a23f5
[sanitizer] Use mmap to zero-fill large shadow regions.
...
This is covered by existing ASan test.
This does not change anything for TSan by default (but provides a flag to
change the threshold size).
Based on a patch by florent.bruneau here:
https://code.google.com/p/address-sanitizer/issues/detail?id=256
llvm-svn: 201400
2014-02-14 11:41:26 +00:00
Alexey Samsonov
81a2b466e9
Move shared configs for lit test suites to test/ and unittests/ directories
...
llvm-svn: 201399
2014-02-14 11:00:07 +00:00
Evgeniy Stepanov
fb74ea80dc
[msan] Replicate mmap-below-shadow check in mmap64 interceptor.
...
llvm-svn: 201397
2014-02-14 09:49:29 +00:00
Evgeniy Stepanov
769d46f373
[sanitizer] Use system unwinder in signal handlers on Android.
...
Because of the way Bionic sets up signal stack frames, libc unwinder is unable
to step through it, resulting in broken SEGV stack traces.
Luckily, libcorkscrew.so on Android implements an unwinder that can start with
a signal context, thus sidestepping the issue.
llvm-svn: 201151
2014-02-11 13:38:57 +00:00
Evgeniy Stepanov
791a7e1603
[msan] Return EINVAL instead of crashing from mmap of an invalid address.
...
llvm-svn: 201074
2014-02-10 09:37:03 +00:00
Nick Lewycky
af2064f7ab
Add throw() specifiers to more redeclarations of operator delete and operator delete[].
...
llvm-svn: 201016
2014-02-08 01:42:08 +00:00
Sergey Matveev
4a03fa4f60
[sanitizer] Intercept if_indextoname() and if_nametoindex().
...
llvm-svn: 200945
2014-02-06 20:39:33 +00:00
Sergey Matveev
544d07f861
[sanitizer] One does not simply intercept getifaddrs().
...
Upgrade the interceptor, and attempt to fix the Android build.
llvm-svn: 200936
2014-02-06 18:48:23 +00:00
Sergey Matveev
07802a090a
[sanitizer] Intercept getifaddrs().
...
llvm-svn: 200926
2014-02-06 17:42:36 +00:00
Sergey Matveev
0c62992d6e
[sanitizer] Intercept getresuid and getresgid.
...
llvm-svn: 200925
2014-02-06 15:12:56 +00:00
Sergey Matveev
c5c84a1d86
[sanitizer] Implement ioctl decoding.
...
When an unknown ioctl is encountered, try to guess the parameter size from the
request id.
llvm-svn: 200872
2014-02-05 19:35:24 +00:00
Evgeniy Stepanov
04e841c047
[msan] Fix a typo.
...
Spotted by Keno Fischer.
llvm-svn: 200682
2014-02-03 07:27:01 +00:00
Sergey Matveev
c18b36625e
[sanitizer] Partial revert of recent ioctl changes.
...
Some build environments are missing the required headers.
This reverts r200544, r200547, r200551. This does not revert the change that
introduced READWRITE ioctl type.
llvm-svn: 200567
2014-01-31 19:19:45 +00:00
Sergey Matveev
dffda4cfec
[sanitizer] Attempt to fix Android build.
...
llvm-svn: 200547
2014-01-31 14:28:32 +00:00
Sergey Matveev
6b3397546e
[sanitizer] Support most ioctls from /usr/include/sound/.
...
llvm-svn: 200544
2014-01-31 14:02:21 +00:00
Alexander Potapenko
d5802fe548
Make signal-related functions use __sanitizer_* structures instead of __sanitizer_kernel_* ones.
...
Also rename internal_sigaction() into internal_sigaction_norestorer(), as this function doesn't fully
implement the sigaction() functionality on Linux.
This change is a part of refactoring intended to have common signal handling behavior in all tools.
llvm-svn: 200535
2014-01-31 11:29:51 +00:00
Sergey Matveev
be68311660
[msan] Intercept *getxattr and *listxattr.
...
llvm-svn: 200464
2014-01-30 12:21:12 +00:00
Sergey Matveev
1394f2da85
[msan] Rewrite strto* interceptors and add a few more.
...
Express the strto* interceptors though macros. This removes a lot of
duplicate code and fixes a couple of copypasto bugs (where "res" was declared of
a different type than the actual return type). Also, add a few more interceptors
for strto*_l.
llvm-svn: 200316
2014-01-28 13:45:58 +00:00
Evgeniy Stepanov
0b09c623c1
[msan] Replace assert() with GTest ASSERT_* in msan_test.
...
llvm-svn: 200293
2014-01-28 08:51:39 +00:00
Evgeniy Stepanov
067f54718f
[msan] Disable mmap outside of application address range.
...
llvm-svn: 200200
2014-01-27 09:12:22 +00:00
Kostya Serebryany
e402b431c0
[msan] add __libc_memalign interceptor; add a regression test for the existing bug with dtls support in msan
...
llvm-svn: 199980
2014-01-24 09:14:11 +00:00
Evgeniy Stepanov
b1fa81047a
[msan] Fix GCC warnings.
...
warning: ISO C99 requires rest arguments to be used [enabled by default]
INTERCEPTOR(char *, dlerror) {
warning: invoking macro INTERCEPTOR argument 3: empty macro arguments are undefined in ISO C90 and ISO C++98 [enabled by default]
llvm-svn: 199873
2014-01-23 08:43:12 +00:00
Alexey Samsonov
00cd273c46
Sanitize printf functions.
...
Intercept and sanitize arguments passed to printf functions in ASan and TSan
(don't do this in MSan for now). The checks are controlled by runtime flag
(off by default for now).
Patch http://llvm-reviews.chandlerc.com/D2480 by Yuri Gribov!
llvm-svn: 199729
2014-01-21 11:58:33 +00:00
Evgeniy Stepanov
3ee789cbbb
[msan] Temporarily disable two tests that are failing with new glibc.
...
llvm-svn: 198919
2014-01-10 07:34:16 +00:00
Alexey Samsonov
6322e036aa
[Sanitizer] Replace Symbolizer::IsAvailable and Symbolizer::IsExternalAvailable with Symbolizer::CanReturnFileLineInfo.
...
Remove now redundant checks in symbolizer initialization in TSan and MSan.
llvm-svn: 198000
2013-12-25 07:09:44 +00:00
Evgeniy Stepanov
09021e02bc
[msan] Add missing visibility attribute to MSan new/delete interceptors.
...
llvm-svn: 197809
2013-12-20 13:18:07 +00:00
Evgeniy Stepanov
42cebb00da
[sanitizer] Use the new sanitizer_interception.h header in all interceptors.
...
llvm-svn: 197808
2013-12-20 13:17:31 +00:00
Evgeniy Stepanov
66297cac72
[msan] Wrap indirect calls to REAL(x) in interceptors.
...
llvm-svn: 197806
2013-12-20 12:20:15 +00:00
Evgeniy Stepanov
61628196e4
[msan] Replace wrap_indirect_calls runtime flag with an interface method.
...
llvm-svn: 197799
2013-12-20 11:05:19 +00:00
Alexey Samsonov
f2c7659cf8
[ASan] Get rid of ASan-specific functions for printing stack traces
...
llvm-svn: 197672
2013-12-19 11:25:05 +00:00
Evgeniy Stepanov
a164bf5e89
[msan] Disable DynamoRio detection.
...
This code is not robust enough and triggers when simply linking with
libdynamorio.so, without any code translation at all. Disabling it is safe
(i.e. we may unpoison too much memory and see false negatives, but never false
positives).
llvm-svn: 197568
2013-12-18 13:25:45 +00:00
Evgeniy Stepanov
cb98c5f6f0
[msan] Relax gethostbyname_r test condition.
...
Apparently, its return value depends on the glibc version.
llvm-svn: 197390
2013-12-16 15:01:31 +00:00
Evgeniy Stepanov
43fc44007d
[msan] Fix gethostbyname_r and similar interceptors.
...
*h_errno is written not on success, but on failure.
In fact, it seems like it can be written even when return value signals
success, so we just unpoison it in all cases.
llvm-svn: 197383
2013-12-16 13:24:33 +00:00
Evgeniy Stepanov
3158ec4002
[msan] Fix strncat interceptor, add missing tests.
...
llvm-svn: 197244
2013-12-13 16:31:59 +00:00
Evgeniy Stepanov
879c552dd9
[msan] Wrap indirect calls from sanitizer rtl when running under DR.
...
llvm-svn: 197226
2013-12-13 13:13:46 +00:00
Evgeniy Stepanov
c8ccef49cc
[msan] Add a check for recursive __msan_init.
...
llvm-svn: 197218
2013-12-13 09:11:14 +00:00
Evgeniy Stepanov
86d8fb5ba1
[msan] Clean stack and TLS shadow on thread exit.
...
llvm-svn: 197156
2013-12-12 13:48:47 +00:00
Evgeniy Stepanov
cd07898cf8
[msan] Get stack limits with pthread_create interceptor.
...
Before we did it lazily on the first stack unwind in the thread.
It resulted in deadlock when the unwind was caused by memory allocation
inside pthread_getattr_np:
pthread_getattr_np <<< not reentable
GetThreadStackTopAndBottom
__interceptor_realloc
pthread_getattr_np
llvm-svn: 197026
2013-12-11 10:55:42 +00:00
Evgeniy Stepanov
67bbf967b0
[msan] Allow strlen() (and similar functions) of shadow memory.
...
llvm-svn: 196572
2013-12-06 09:19:07 +00:00
Alexey Samsonov
2d42b1d693
Run TSan/MSan lit tests only on 64-bit platforms
...
llvm-svn: 196501
2013-12-05 12:53:36 +00:00
Sergey Matveev
9be70fbda9
[sanitizer] Introduce VReport and VPrintf macros and use them in sanitizer code.
...
Instead of "if (common_flags()->verbosity) Report(...)" we now have macros.
llvm-svn: 196497
2013-12-05 12:04:51 +00:00
Evgeniy Stepanov
c0378e72d1
[sanitizer] Intercept textdomain.
...
Patch by Alexander Taran.
llvm-svn: 196098
2013-12-02 13:43:26 +00:00
Evgeniy Stepanov
b56c5cd95e
[sanitizer] Intercept times.
...
llvm-svn: 195918
2013-11-28 14:41:22 +00:00
Evgeniy Stepanov
9c1f8323ae
[sanitizer] Intercept iconv.
...
llvm-svn: 195917
2013-11-28 14:14:48 +00:00
Evgeniy Stepanov
b76b687628
[sanitizer] Intercept __xpg_strerror_r.
...
llvm-svn: 195839
2013-11-27 12:29:10 +00:00
Dmitry Vyukov
7bd319cc08
tsan: fix flags parsing
...
- running_on_valgrind was not parsed in some contexts
- refactor code a bit
- add comprehensive tests for flags parsing
llvm-svn: 195831
2013-11-27 09:54:10 +00:00
Dmitry Vyukov
ee882ba4a1
tsan: support synchronization by means of linux aio
...
http://llvm-reviews.chandlerc.com/D2269
llvm-svn: 195830
2013-11-27 09:10:47 +00:00
Evgeniy Stepanov
1bdf5c93e1
[msan] Test for r195349.
...
llvm-svn: 195350
2013-11-21 12:01:07 +00:00
Evgeniy Stepanov
0958ecca7e
[msan] Tweak io_submit syscall hook.
...
llvm-svn: 195246
2013-11-20 13:04:23 +00:00
Evgeniy Stepanov
584fd96e9e
[msan] Unpoison memory that is returned to the OS and flush its shadow.
...
llvm-svn: 195244
2013-11-20 12:51:14 +00:00
Evgeniy Stepanov
bfb2016c83
[msan] Fix origin tracking in unaligned load/store.
...
llvm-svn: 195130
2013-11-19 14:47:56 +00:00
Evgeniy Stepanov
5912fa4c4b
[msan] A test for r194697.
...
llvm-svn: 194699
2013-11-14 12:31:18 +00:00
Alexey Samsonov
6345150992
[Sanitizer] Specify a default value for each common runtime flag
...
llvm-svn: 194479
2013-11-12 13:59:08 +00:00
Evgeniy Stepanov
5a29068b97
[msan] One more test for r194374.
...
llvm-svn: 194375
2013-11-11 13:38:24 +00:00
Evgeniy Stepanov
b69699eb58
[sanitizer] Warn if interception fails.
...
This includes a clang-format pass over common interceptors.
llvm-svn: 194372
2013-11-11 11:28:30 +00:00
Evgeniy Stepanov
bfdb9b2ec6
[msan] Sanity check for non-PIE.
...
llvm-svn: 194370
2013-11-11 09:27:20 +00:00
Alexey Samsonov
b3d939902a
[Sanitizer] Make StackTrace::Unwind the only public way to unwind a stack trace.
...
llvm-svn: 194196
2013-11-07 07:28:33 +00:00
Evgeniy Stepanov
1c8c3fe4b4
[msan] Fix a very unfortunate typo in origin copying.
...
It was causing randomly missing origins.
llvm-svn: 194036
2013-11-05 01:24:38 +00:00
Evgeniy Stepanov
a6b5eec757
[sanitizer] Intercept strptime.
...
llvm-svn: 193903
2013-11-02 01:01:35 +00:00
Evgeniy Stepanov
365bd0c88c
[msan] Intercept memccpy.
...
llvm-svn: 193897
2013-11-01 23:49:48 +00:00
Alexey Samsonov
5dc6cff06a
[Sanitizer] Unify summary reporting across all sanitizers.
...
This change unifies the summary printing across sanitizers:
now each tool uses specific version of ReportErrorSummary() method,
which deals with symbolization of the top frame and formatting a
summary message. This change modifies the summary line for ASan+LSan mode:
now the summary mentions "AddressSanitizer" instead of "LeakSanitizer".
llvm-svn: 193864
2013-11-01 17:02:14 +00:00
Evgeniy Stepanov
170d70be68
[msan] Check that address is an app region before printing shadow.
...
llvm-svn: 193863
2013-11-01 15:53:25 +00:00
Evgeniy Stepanov
2335879ff1
[sanitizer] Enhance io_submti syscall handler.
...
llvm-svn: 193848
2013-11-01 01:20:39 +00:00
Alexey Samsonov
4708c5912b
Consistently use StackTrace::PrintStack in ASan, LSan and MSan
...
llvm-svn: 193834
2013-11-01 00:19:46 +00:00
Alexey Samsonov
627e2c0dd7
[Sanitizer] Add Symbolizer::AddHooks() and use it in TSan and MSan.
...
Summary:
TSan and MSan need to know if interceptor was called by the
user code or by the symbolizer and use pre- and post-symbolization hooks
for that. Make Symbolizer class responsible for calling these hooks instead.
This would ensure the hooks are only called when necessary (during
in-process symbolization, they are not needed for out-of-process) and
save specific sanitizers from tracing all places in the code where symbolization
will be performed.
Reviewers: eugenis, dvyukov
Reviewed By: eugenis
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2067
llvm-svn: 193807
2013-10-31 21:44:07 +00:00
Evgeniy Stepanov
13322c6eda
[msan] Intercept dlerror.
...
llvm-svn: 193760
2013-10-31 16:58:44 +00:00
Evgeniy Stepanov
a7add488ae
[msan] Disable mlock/mlockall to work around a linux kernel bug.
...
The same logic is present in ASan and TSan.
llvm-svn: 193755
2013-10-31 15:51:22 +00:00
Evgeniy Stepanov
1cb37c4ee5
[sanitizer] Intercept getline, getdelim.
...
llvm-svn: 193730
2013-10-31 01:17:41 +00:00
Evgeniy Stepanov
0bd1f00ec6
[sanitizer] Intercept drand48_r, lrand48_r.
...
llvm-svn: 193655
2013-10-29 22:25:27 +00:00
Evgeniy Stepanov
bf60342d47
[sanitizer] Intercept sincos, remquo, lgamma, lgamma_r.
...
llvm-svn: 193645
2013-10-29 19:49:35 +00:00
Evgeniy Stepanov
477f8b73a5
[sanitizer] Ptrace syscall handler.
...
llvm-svn: 193633
2013-10-29 17:59:45 +00:00
Dmitry Vyukov
3e8432ee6c
tsan/asan: support pthread_setname_np to set thread names
...
llvm-svn: 193602
2013-10-29 10:30:39 +00:00
Alexey Samsonov
a687d2593f
[Sanitizer] Simplify StackTrace::PrintStack interface: prefer common flags to turn on/off the symbolization
...
llvm-svn: 193587
2013-10-29 05:31:25 +00:00
Evgeniy Stepanov
451c8de2d8
[msan] Intercept shmat.
...
llvm-svn: 193581
2013-10-29 02:48:49 +00:00
Evgeniy Stepanov
d828208713
[msan] Fix a typo and enable poison_in_free flag.
...
llvm-svn: 193529
2013-10-28 18:53:37 +00:00
Dmitry Vyukov
cf7259c094
asan/msan: separate different report blocks with new lines
...
this makes the reports consistent with tsan, and much more readable.
llvm-svn: 193520
2013-10-28 13:05:32 +00:00
Peter Collingbourne
791e65dcfb
Overhaul the symbolizer interface.
...
This moves away from creating the symbolizer object and initializing the
external symbolizer as separate steps. Those steps now always take place
together.
Sanitizers with a legacy requirement to specify their own symbolizer path
should use InitSymbolizer to initialize the symbolizer with the desired
path, and GetSymbolizer to access the symbolizer. Sanitizers with no
such requirement (e.g. UBSan) can use GetOrInitSymbolizer with no need for
initialization.
The symbolizer interface has been made thread-safe (as far as I can
tell) by protecting its member functions with mutexes.
Finally, the symbolizer interface no longer relies on weak externals, the
introduction of which was probably a mistake on my part.
Differential Revision: http://llvm-reviews.chandlerc.com/D1985
llvm-svn: 193448
2013-10-25 23:03:29 +00:00
Evgeniy Stepanov
94042e1ff2
[sanitizer] Intercept tmpnam, tmpnam_r, tempnam.
...
llvm-svn: 193415
2013-10-25 15:51:48 +00:00
Evgeniy Stepanov
2acb2470f9
[sanitizer] Remove pthread_attr_getstackaddr interceptor.
...
The function is deprecated.
llvm-svn: 193409
2013-10-25 14:27:00 +00:00
Evgeniy Stepanov
07507ffab4
[msan] Zerofill initstate_r buffer in random_r test.
...
llvm-svn: 193406
2013-10-25 13:03:20 +00:00
Evgeniy Stepanov
c2b6cb0747
[sanitizer] Intercept pthread_attr_get*.
...
llvm-svn: 193405
2013-10-25 13:01:31 +00:00
Evgeniy Stepanov
ced9fede02
[msan] Separate access and origin blocks in msan reports with an extra whiteline.
...
llvm-svn: 193401
2013-10-25 11:17:54 +00:00
Evgeniy Stepanov
be9cdbb58c
[sanitizer] Intercept random_r.
...
llvm-svn: 193396
2013-10-25 08:58:13 +00:00
Evgeniy Stepanov
f312b480e2
[sanitizer] Intercept shmctl.
...
llvm-svn: 193348
2013-10-24 14:47:34 +00:00
Evgeniy Stepanov
7edb87a92c
[msan] Unpoison errno in common interceptors.
...
llvm-svn: 193343
2013-10-24 13:20:34 +00:00
Evgeniy Stepanov
d280ee48e8
[msan] Fix invalid origin copying.
...
Origin copying may destroy valid origin info. This is caused by
__msan_copy_origin widening the address range to the nearest 4-byte aligned
addresses both on the left and on the right. If the target buffer is
uninitialized and the source is fully initialized, this will result in
overriding valid origin of target buffer with stale (possibly 0) origin of the
source buffer.
With this change the widened origin is copied only if corresponding shadow
values are non zero.
llvm-svn: 193338
2013-10-24 11:56:03 +00:00
Evgeniy Stepanov
f2fd459a5b
[msan] Change wording in the invalid origin message.
...
llvm-svn: 193335
2013-10-24 11:52:48 +00:00
Evgeniy Stepanov
3e6064f9d2
[sanitizer] Intercept ether_* functions.
...
llvm-svn: 193241
2013-10-23 13:57:47 +00:00
Evgeniy Stepanov
2794c47243
[msan] Drain allocator cache when leaving thread.
...
llvm-svn: 193163
2013-10-22 14:31:30 +00:00
Evgeniy Stepanov
0229c09d43
[sanitizer] Intercept initgroups.
...
llvm-svn: 193158
2013-10-22 12:24:48 +00:00
Evgeniy Stepanov
3cb9df042e
[sanitizer] Move statfs/fstatfs to common interceptors and add statvfs/fstatvfs.
...
llvm-svn: 192965
2013-10-18 11:14:16 +00:00
Evgeniy Stepanov
70d5abfba2
[sanitizer] Intercept getmntent, getmntent_r.
...
llvm-svn: 192959
2013-10-18 09:41:43 +00:00
Evgeniy Stepanov
4bbf273173
[sanitizer] Fix unpoisoning of msghdr::msg_name in recvmsg interceptor.
...
llvm-svn: 192886
2013-10-17 11:32:30 +00:00
Alexey Samsonov
bc7c87a8cb
[Sanitizer] Move pthread_cond_signal and pthread_cond_broadcast to common interceptors
...
llvm-svn: 192876
2013-10-17 09:24:03 +00:00
Evgeniy Stepanov
8df08225e5
[msan] Handle origins in __sanitizer_unaligned_(load|store)*.
...
llvm-svn: 192776
2013-10-16 08:25:13 +00:00
Alexey Samsonov
edecc38395
Make some pthread_mutex_* and pthread_cond_* interceptors common.
...
Reviewers: eugenis, dvyukov
Reviewed By: dvyukov
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1937
llvm-svn: 192774
2013-10-16 08:20:31 +00:00
Dmitry Vyukov
7502a3a90c
tsan: use verbosity flag in sanitizer_common code directly
...
now it's available from common_flags()
llvm-svn: 192705
2013-10-15 14:12:26 +00:00
Dmitry Vyukov
52ca74ec61
tsan: move verbosity flag to CommonFlags
...
llvm-svn: 192701
2013-10-15 13:28:51 +00:00
Evgeniy Stepanov
7a2bbc30a2
[msan] Remove CallocOverflow test.
...
This behaviour depends on MSAN_OPTIONS.
All interesting combinations are covered by lit_tests/allocator_returns_null.cc.
llvm-svn: 192691
2013-10-15 12:20:16 +00:00
Evgeniy Stepanov
113c646c56
[msan] Implement allocator_may_return_null=1 in MemorySanitizer.
...
llvm-svn: 192687
2013-10-15 11:33:48 +00:00
Evgeniy Stepanov
251d1e5d21
[msan] Test for r192599.
...
llvm-svn: 192600
2013-10-14 15:17:05 +00:00
Evgeniy Stepanov
7d7768e032
[msan] Remove a long-outdated comment.
...
llvm-svn: 192592
2013-10-14 13:30:40 +00:00
Evgeniy Stepanov
7aacd9c172
[msan] Intercept strto(d|f|ld)_l and glibc-specific __strto(d|f|ld)_l.
...
llvm-svn: 192583
2013-10-14 11:52:40 +00:00
Evgeniy Stepanov
054d533d8d
[msan] Regression test for r192575.
...
llvm-svn: 192577
2013-10-14 09:53:39 +00:00
Alexey Samsonov
9d8385453b
[Sanitizer] Simplify StackTrace::FastUnwindStack interface and fix a bug with one-frame stack traces
...
llvm-svn: 192428
2013-10-11 09:58:30 +00:00
Alexey Samsonov
f2b811a618
Refactor the usage of strip_path_prefix option and make it more consistent across sanitizers
...
llvm-svn: 191943
2013-10-04 08:55:03 +00:00
Dmitry Vyukov
19a1302046
asan/msan: fix "unused function 'OnExit'" warning
...
llvm-svn: 191904
2013-10-03 15:43:59 +00:00
Dmitry Vyukov
fdfb2ade8f
asan/msan/tsan: move _exit interceptor to common interceptors
...
llvm-svn: 191903
2013-10-03 15:22:29 +00:00
Dmitry Vyukov
83ebd022d7
tsan: fix false positive in localtime()
...
llvm-svn: 191899
2013-10-03 14:12:09 +00:00
Evgeniy Stepanov
c907a60ffb
[sanitizer] Fix localtime and gmtime interceptors to clean tm->tm_zone.
...
llvm-svn: 191827
2013-10-02 14:30:03 +00:00
Dmitry Vyukov
af335eddfe
msan: fix compiler warnings about unused variables
...
llvm-svn: 191821
2013-10-02 14:02:08 +00:00
Evgeniy Stepanov
01781722b6
[sanitizer] Intercept backtrace, backtrace_symbols.
...
llvm-svn: 191516
2013-09-27 12:40:23 +00:00
Evgeniy Stepanov
022235cf04
[msan] Unpoison argument shadow for C++ module destructors.
...
Fixes PR17377.
llvm-svn: 191508
2013-09-27 11:32:21 +00:00
Evgeniy Stepanov
8f27f6b549
[sanitizer] A bunch of libc interceptors.
...
sigwait
sigwaitinfo
sigtimedwait
sigemptyset
sigfillset
sigpending
sigprocmask
llvm-svn: 191374
2013-09-25 14:47:43 +00:00
Evgeniy Stepanov
2761ee0409
[sanitizer] Intercept wordexp.
...
llvm-svn: 191305
2013-09-24 14:38:22 +00:00
Evgeniy Stepanov
46901f613b
[msan] Test for atomic handling in MSan.
...
llvm-svn: 191288
2013-09-24 11:21:16 +00:00
Evgeniy Stepanov
ce72b2c20b
[msan] Fix a WTF in r191196.
...
llvm-svn: 191197
2013-09-23 13:34:26 +00:00
Evgeniy Stepanov
f497bfee76
[msan] Allow nested symbolizer and loader scopes.
...
llvm-svn: 191196
2013-09-23 13:26:31 +00:00
Alexey Samsonov
786ee9b1ad
[MSan] Fix -Wempty-body warning
...
llvm-svn: 190994
2013-09-19 08:35:16 +00:00
Evgeniy Stepanov
08d649c024
[msan] Check return value of main: compiler-rt tests.
...
llvm-svn: 190783
2013-09-16 13:25:26 +00:00
Evgeniy Stepanov
65562f5281
[msan] Fix origin of deallocated memory.
...
MSan poisons deallocated memory but it used to give it an invalid origin value,
resulting in confusing reports. This change associates deallocation stack trace
with such memory.
Note that MSan does not have quarantine, and use-after-free detection is very
limited.
llvm-svn: 190781
2013-09-16 11:03:31 +00:00
Evgeniy Stepanov
0da35401ce
[msan] Add source file:line to stack origin reports.
...
Test.
llvm-svn: 190690
2013-09-13 12:55:07 +00:00
Evgeniy Stepanov
ac5ac34cf7
[msan] Add source file:line to stack origin reports.
...
Runtime library part.
llvm-svn: 190686
2013-09-13 12:49:13 +00:00
Evgeniy Stepanov
9be91e970e
[msan] Intercept tzset.
...
llvm-svn: 190682
2013-09-13 11:27:38 +00:00
Alexey Samsonov
7a36e6126b
[Sanitizer] Refactor symbolization interface: use class instead of several functions. Move some code around to get rid of extra source files
...
llvm-svn: 190410
2013-09-10 14:36:16 +00:00
Evgeniy Stepanov
df96e863de
[msan] bool -> int to make msan_interface.h C-compatible.
...
llvm-svn: 190402
2013-09-10 11:04:37 +00:00
Evgeniy Stepanov
842fa3f80d
[msan] Intercept fstatat / fstatat64.
...
llvm-svn: 190306
2013-09-09 13:40:41 +00:00
Evgeniy Stepanov
5c1035e7fa
[sanitizer] A bunch of linux system call handlers.
...
llvm-svn: 190157
2013-09-06 14:20:01 +00:00
Kostya Serebryany
6c5b034d7b
[msan] make calloc crash instead of returning 0 on overflow (controlled by the allocator_may_return_null flag)
...
llvm-svn: 190132
2013-09-06 10:58:55 +00:00
Sergey Matveev
b9d34443f2
[lsan] Colorize LSan reports.
...
llvm-svn: 189804
2013-09-03 13:31:03 +00:00
Alexey Samsonov
5b5c99d219
ASan, LSan, MSan: try to find llvm-symbolizer binary in PATH if it is not provided. Now we don't need to explicitly set the location of llvm-symbolizer in lit test configs.
...
llvm-svn: 189801
2013-09-03 13:22:51 +00:00
Evgeniy Stepanov
499d480be5
[msan] Another regression test for r189786.
...
llvm-svn: 189787
2013-09-03 10:08:14 +00:00
Evgeniy Stepanov
f9ddb43975
[msan] A regression test for r189785.
...
llvm-svn: 189786
2013-09-03 10:05:45 +00:00
Evgeniy Stepanov
e3eaa7bb35
[msan] Intercept memalign, valloc, pvalloc.
...
PR17039
llvm-svn: 189750
2013-09-02 09:24:53 +00:00
Alexey Samsonov
ef643ce471
[sanitizer] fix code style
...
llvm-svn: 189474
2013-08-28 11:26:09 +00:00
Evgeniy Stepanov
4f961de94e
[msan] Remove extra backup/restore calls.
...
llvm-svn: 189461
2013-08-28 09:17:47 +00:00
Alexey Samsonov
0803953cea
Generate list of symbols exported from sanitizer runtimes only on 64-bit Unix
...
llvm-svn: 189454
2013-08-28 08:07:04 +00:00
Alexey Samsonov
acab30e927
Properly generate lists of exported symbols for sanitizer runtimes
...
This change adds a Python script that is invoked for
the just-built sanitizer runtime to generate the list of exported symbols
passed to the linker. By default, it contains interceptors and sanitizer
interface functions, but can be extended with tool-specific lists.
llvm-svn: 189356
2013-08-27 15:08:02 +00:00
Evgeniy Stepanov
cb22c67a21
[msan] Save/restore va_arg_overflow_tls in signal handlers.
...
llvm-svn: 189351
2013-08-27 14:08:15 +00:00
Evgeniy Stepanov
c41798152f
[msan] Unpoison all TLS shadow when leaving a signal handler.
...
llvm-svn: 189343
2013-08-27 12:59:39 +00:00
Evgeniy Stepanov
bb25af5f7b
[msan] Fix a data race in signal/sigaction interceptors.
...
llvm-svn: 189342
2013-08-27 11:34:05 +00:00
Evgeniy Stepanov
82185980c4
[msan] A test for ppoll() interceptor.
...
llvm-svn: 189339
2013-08-27 11:10:20 +00:00
Evgeniy Stepanov
a40a058ff1
[sanitizer] Simplify sigaction and sigset_t handling.
...
llvm-svn: 189338
2013-08-27 11:10:04 +00:00
Evgeniy Stepanov
0d13c707d5
[msan] Extend VAArgTLSOverwrite test.
...
This test now covers LLVM r189104.
llvm-svn: 189105
2013-08-23 12:13:18 +00:00
Dmitry Vyukov
97f0eae0a5
tsan/msan: add halt_on_error flag
...
If halt_on_error==true, program terminates after reporting first error.
llvm-svn: 188279
2013-08-13 15:33:00 +00:00
Timur Iskhodzhanov
eee13914e2
Define SANITIZER_INTERFACE_ATTRIBUTE on Windows and fix all the places where SANITIZER_INTERFACE_ATTRIBUTE or SANITIZER_ATTRIBUTE_WEAK are used
...
llvm-svn: 188261
2013-08-13 11:42:45 +00:00
Evgeniy Stepanov
64cace0687
[sanitizer] Intercept poll/ppoll.
...
llvm-svn: 188177
2013-08-12 13:19:53 +00:00
Evgeniy Stepanov
98c39a184e
[sanitizer] Intercept getgroups.
...
llvm-svn: 188167
2013-08-12 11:01:40 +00:00
Daniel Dunbar
bc5dbc435e
[tests] Update to use lit_config and lit package, as appropriate.
...
llvm-svn: 188116
2013-08-09 22:14:01 +00:00
Evgeniy Stepanov
564215d949
[sanitizer] Intercept scandir/scandir64.
...
llvm-svn: 187982
2013-08-08 13:57:15 +00:00
Evgeniy Stepanov
233455cba8
[sanitizer] Intercept strerror and strerror_r.
...
llvm-svn: 187978
2013-08-08 11:44:05 +00:00
Evgeniy Stepanov
7ea4795ed3
[sanitizer] ASan/MSan tests for r187967.
...
r187967: Disable inlining between sanitized and non-sanitized functions.
llvm-svn: 187971
2013-08-08 09:23:19 +00:00
Evgeniy Stepanov
04b7bff1fe
[sanitizer] Intercept sched_getaffinity.
...
Re-applying with a more reliable test case.
llvm-svn: 187876
2013-08-07 09:10:16 +00:00
David Blaikie
787e2b6499
Revert "[sanitizer] Intercept sched_getaffinity."
...
This reverts commit r187788.
The test case is unreliable (as the test may be run in a situation in
which it has no affinity with cpu0). This can be recommitted with a more
reliable test - possibly using CPU_COUNT != 0 instead (I wasn't entirely
sure that a process was guaranteed to have at least one affinity, though
it seems reasonable, or I'd have made the change myself).
llvm-svn: 187841
2013-08-07 00:37:26 +00:00
Evgeniy Stepanov
03c0281a17
[sanitizer] Fix NULL arg handling in setitimer/getitimer interceptors.
...
llvm-svn: 187789
2013-08-06 09:54:33 +00:00
Evgeniy Stepanov
9f05e5e533
[sanitizer] Intercept sched_getaffinity.
...
llvm-svn: 187788
2013-08-06 09:29:01 +00:00
Evgeniy Stepanov
44b77c26e4
[msan] Allocator statistics interface and malloc hooks.
...
llvm-svn: 187653
2013-08-02 14:26:58 +00:00
Evgeniy Stepanov
90daaf9132
[msan] Fix unused function warning in the tests.
...
llvm-svn: 187648
2013-08-02 09:09:02 +00:00
Evgeniy Stepanov
5dbedf6c2a
[msan] Intercept setenv, putenv.
...
llvm-svn: 187575
2013-08-01 11:14:14 +00:00
Evgeniy Stepanov
1ea380f693
[msan] Fix msan tests with pipefail option.
...
llvm-svn: 187485
2013-07-31 09:14:55 +00:00
Evgeniy Stepanov
9fbd981f99
[sanitizer] read() syscall hook.
...
llvm-svn: 187414
2013-07-30 13:04:43 +00:00
Evgeniy Stepanov
807e131261
[msan] Intercept pthread_join.
...
llvm-svn: 187413
2013-07-30 12:54:34 +00:00
Evgeniy Stepanov
da9fd25603
[msan] Intercept confstr.
...
llvm-svn: 187412
2013-07-30 12:46:59 +00:00
Peter Collingbourne
9058c07c95
Move UnpoisonMappedDSO to sanitizer_common.
...
This is so DFSan will be able to use it.
Differential Revision: http://llvm-reviews.chandlerc.com/D1206
llvm-svn: 187372
2013-07-29 19:09:49 +00:00
Chandler Carruth
d45abe12a6
Turn off pipefail on msan tests to match the other sanitizers until
...
someone can go through and update the RUN lines appropriately for the
new pipefail behavior.
llvm-svn: 187298
2013-07-27 10:30:39 +00:00
Hans Wennborg
2e304b6ffd
Use --driver-mode=g++ instead of -ccc-cxx; required after Clang r186605
...
llvm-svn: 186607
2013-07-18 20:48:50 +00:00
Alexey Samsonov
9916aa2d95
[Sanitizer] move strcpy and strncpy to common interceptors
...
llvm-svn: 186408
2013-07-16 12:51:53 +00:00
Timur Iskhodzhanov
d7eb67774e
Fix check_lint warnings in sanitizers' runtime libraries
...
llvm-svn: 186328
2013-07-15 16:11:39 +00:00
Alexey Samsonov
fde429ba69
[Sanitizer] Revert some parts of r186109 related to mbstowcs-and-friends interceptors
...
llvm-svn: 186155
2013-07-12 11:59:58 +00:00