Commit Graph

2768 Commits

Author SHA1 Message Date
Peter Collingbourne 187a169603 [dfsan] Add custom function for dl_iterate_phdr.
Differential Revision: http://llvm-reviews.chandlerc.com/D1505

llvm-svn: 189503
2013-08-28 20:18:25 +00:00
Peter Collingbourne 3e5524d6c5 [dfsan] Add custom function for pthread_create.
Differential Revision: http://llvm-reviews.chandlerc.com/D1504

llvm-svn: 189502
2013-08-28 20:18:22 +00:00
Hans Wennborg f8e56278ed cmake: Add /Oy- (don't omit frame pointer) to compile flags
llvm-svn: 189488
2013-08-28 16:14:59 +00:00
Will Dietz f967d1f947 sanitizer_common: Use PYTHON_EXECUTABLE to choose appropriate python.
Fixes build on systems where 'python' is not python2.

llvm-svn: 189486
2013-08-28 15:53:17 +00:00
Alexey Samsonov dd1d1b2c79 Make lint checker script more robust
llvm-svn: 189479
2013-08-28 12:15:03 +00:00
Alexey Samsonov d875c39be6 Check code style in check-sanitizer command
llvm-svn: 189475
2013-08-28 11:27:31 +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
Kostya Serebryany fab9336413 [asan]: fix a CHECK failure in use-after-return mode; enable and fix stack-use-after-return.cc; add a test for UAR mode in asan_noinst_test
llvm-svn: 189457
2013-08-28 08:59:23 +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
Alexey Samsonov 614a5ea990 Revert r189347: it breaks on machines w/o installed debug versions of system libraries
llvm-svn: 189350
2013-08-27 14:04:01 +00:00
Alexey Samsonov ea0ef986e2 LSan: Check that dynamic linker library is properly symbolized
llvm-svn: 189347
2013-08-27 13:39:33 +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
Hans Wennborg 67c6e5041b cmake: fix the compiler-rt build with MSVC
This sets flags and excludes things that aren't working with MSVC yet,
allowing us to build the ASan runtime as part of the cmake build.

Differential Revision: http://llvm-reviews.chandlerc.com/D1525

llvm-svn: 189304
2013-08-27 01:24:01 +00:00
Sergey Matveev 9e3e80208f [sanitizer] Add a fast version of StackDepotGet() for use in LSan.
Add a class that holds a snapshot of the StackDepot optimized for querying by
ID. This allows us to speed up LSan dramatically.

llvm-svn: 189217
2013-08-26 13:24:43 +00:00
Sergey Matveev ef7db73e11 [sanitizer] Handle Die() in StopTheWorld.
Handle calls to Die() from the tracer thread. Fixes a bug where a CHECK
could fail in the tracer thread, resulting in a call to AsanDie. The tracer
thread then exited and the parent process continued execution despite its
address space being in an unusable state.

llvm-svn: 189216
2013-08-26 13:20:31 +00:00
Peter Collingbourne 469c056299 [dfsan] Integration test for the equal-labels case
llvm-svn: 189134
2013-08-23 18:45:22 +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
Alexey Samsonov 903c3250d2 Slightly improve lint checker script and fix a few style issues
llvm-svn: 189092
2013-08-23 07:43:56 +00:00
Sergey Matveev 5371e90f7a [lsan] Add a regression test for building C code.
llvm-svn: 189016
2013-08-22 14:48:44 +00:00
Evgeniy Stepanov 251080b0eb [sanitizer] Fix build when scanf interceptors are enabled, and __isoc99_*scanf are not.
Fixes PR16916.

llvm-svn: 189015
2013-08-22 13:59:15 +00:00
Sergey Matveev f6ca04d468 [lsan] Add a stress test.
llvm-svn: 189012
2013-08-22 13:32:10 +00:00
Sergey Matveev e38dd3ff4e [lsan] Follow-up to r189010 - do the same in Makefile build.
llvm-svn: 189011
2013-08-22 13:30:01 +00:00
Sergey Matveev bed55036a9 [lsan] Build standalone LSan with -fno-rtti.
Fix issue where C code could not be built with -fsanitize=leak.

llvm-svn: 189010
2013-08-22 13:23:22 +00:00
Bill Wendling 4f20f51090 Add missing ']'.
llvm-svn: 188927
2013-08-21 20:12:27 +00:00
Bob Wilson e7ca6f9359 For Darwin builds, locate tools using xcrun when available.
The make/platform/darwin_bni.mk file already has similar code but we
apparently neglected to add it to the clang_darwin.mk file.

llvm-svn: 188864
2013-08-21 04:42:56 +00:00
Alexey Samsonov 287fca44af [LSan] Add support for building standalone LSan runtime to Make build (compiler-rt part)
llvm-svn: 188804
2013-08-20 14:49:01 +00:00
Chandler Carruth 6b8d17bf35 It appears that glibc 2.13 has the same thread descriptor size as 2.11,
bump up the inflection point to 2.14. If someone can tell me how to
actually figure out value for this, that would be awesome.

Anyways, this takes me to one ASan failure, one LSan failure, and three
TSan failures for 'check-all' on Linux.

llvm-svn: 188635
2013-08-18 10:04:51 +00:00
Chandler Carruth 022a3d4e88 Revert r188369 (and r188455) which breaks the build on at least some
Linux systems. I've replied on the original commit thread with details
of the problem.

llvm-svn: 188628
2013-08-18 08:47:06 +00:00
Joerg Sonnenberger 9dce26947e Fix endian conditions on Solaris. From Alexander Esilevich.
llvm-svn: 188613
2013-08-17 22:32:10 +00:00
Timur Iskhodzhanov 10286e1e59 [ASan/RTL] Disable colored reporting on Windows
llvm-svn: 188545
2013-08-16 11:26:26 +00:00
Dmitry Vyukov f6ea6a5a19 tsan: better report formatting for Go
Say that gorotuine 1 is main goroutine.
Remove excessive new line.

llvm-svn: 188542
2013-08-16 11:15:14 +00:00
Timur Iskhodzhanov 51cda144ae [ASan/RTL] Disable alloc_dealloc_mismatch by default on Windows
llvm-svn: 188541
2013-08-16 11:04:59 +00:00
Peter Collingbourne 12b0809eb1 [dfsan] Initial set of custom functions and interceptors for libc.
Differential Revision: http://llvm-reviews.chandlerc.com/D1397

llvm-svn: 188490
2013-08-15 21:18:53 +00:00
Peter Collingbourne ae52ac7479 [dfsan] Runtime support for -dfsan-debug-nonzero-labels feature.
Reviewers: eugenis

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1406

llvm-svn: 188471
2013-08-15 18:51:07 +00:00
Evgeniy Stepanov a1d44d4d8f [sanitizer] Add missing include.
llvm-svn: 188455
2013-08-15 10:20:30 +00:00
Peter Collingbourne 64308d92c0 [dfsan] New __dfsan_set_label runtime function.
Differential Revision: http://llvm-reviews.chandlerc.com/D1396

llvm-svn: 188411
2013-08-14 20:51:33 +00:00
Peter Collingbourne 0e51eda83b [dfsan] Runtime support for ABI list functionality; can now run integration tests with args ABI.
Differential Revision: http://llvm-reviews.chandlerc.com/D1351

llvm-svn: 188401
2013-08-14 18:54:06 +00:00
Evgeniy Stepanov 0bb7577d89 [sanitizer] Split platform_limits_posix into system- and kernel-dependent parts.
This change moves everything depending on kernel headers (mostly ioctl types
and ids) into a separate source file. This will reduce the possibility of
header conflict on various platforms (most importantly, older glibc versions).

This change also removes 2 deprecated ioctls, and symbolic ids for other bunch
of ambiguous ioctls (i.e. same id is shared by ioctls with different memory
behavior).

llvm-svn: 188369
2013-08-14 13:34:14 +00:00
Peter Collingbourne 7da504faa4 [dfsan] Introduce dfsan_read_label runtime function.
Differential Revision: http://llvm-reviews.chandlerc.com/D1349

llvm-svn: 188319
2013-08-13 22:15:40 +00:00
Dmitry Vyukov 4ba287f328 dfsan: fix lint warning
llvm-svn: 188292
2013-08-13 16:52:07 +00:00
Dmitry Vyukov 8cff61f29e tsan: intercept getaddrinfo
This is necessary to prevent false positives, see:
https://code.google.com/p/thread-sanitizer/issues/detail?id=25

llvm-svn: 188291
2013-08-13 16:51:27 +00:00
Timur Iskhodzhanov 9dc34adf36 [ASan/Win] Oops, forgot to add the attributes to the memory allocations functions
llvm-svn: 188290
2013-08-13 16:48: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 7757073c21 [ASan/Win] Hook some memory allocation functions; passes simple sanity test now
llvm-svn: 188278
2013-08-13 15:29:42 +00:00
Timur Iskhodzhanov 3fdabf8965 [ASan/Win] Add the first version of the RTL thunk that should be linked with instrumented DLLs
llvm-svn: 188267
2013-08-13 13:47:03 +00:00
Timur Iskhodzhanov dd052cedf8 Add a FIXME to check_lint
llvm-svn: 188266
2013-08-13 13:44:02 +00:00
Timur Iskhodzhanov 82a6647755 [*San/RTL] One more minor fix
llvm-svn: 188263
2013-08-13 12:16:43 +00:00
Timur Iskhodzhanov 45e82d12b0 [*San/RTL] Fix minor breakage
Grumbling: this hasn't been caught by running 'make check-{a,l,t}san check-sanitizer'
llvm-svn: 188262
2013-08-13 12:03:51 +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
Peter Collingbourne da71ea2598 [dfsan] Remove the unused __dfsan_memcpy function.
Differential Revision: http://llvm-reviews.chandlerc.com/D1350

llvm-svn: 188238
2013-08-13 00:16:18 +00:00
Peter Collingbourne a3dc875198 [dfsan] Begin a private header and move shadow_for there.
Differential Revision: http://llvm-reviews.chandlerc.com/D1348

llvm-svn: 188231
2013-08-12 23:51:33 +00:00
Peter Collingbourne 21b2929aca [dfsan] Introduce dfsan_union runtime function.
Differential Revision: http://llvm-reviews.chandlerc.com/D1347

llvm-svn: 188229
2013-08-12 23:47:37 +00:00
Rui Ueyama 633ec6848b Add "CHECK-" prefix to un-break buildbot failure.
After r188221, the prefix given by --check-prefix must match with the label
as a whole. Substring is not considered to be a correct label anymore.

llvm-svn: 188227
2013-08-12 23:43:19 +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 beadec4afd [tests] Add one more lit rename update I missed.
llvm-svn: 188117
2013-08-09 22:23:23 +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 7f915cf8a5 [sanitizer] Fix handling of %n in scanf interceptor.
%n does not increase the input item count. The new code emits writes to %n
arguments even if it has run out of input items.

llvm-svn: 188069
2013-08-09 12:58:35 +00:00
Evgeniy Stepanov 3bf5439a9d [sanitizer] Limit scandir interceptor to Linux.
Implementation uses __thread not available on certain platforms.

llvm-svn: 187983
2013-08-08 14:04:36 +00:00
Evgeniy Stepanov 564215d949 [sanitizer] Intercept scandir/scandir64.
llvm-svn: 187982
2013-08-08 13:57:15 +00:00
Dmitry Vyukov 87bf47894c tsan: better diagnostics for invalid addresses passed to free()
llvm-svn: 187980
2013-08-08 13:47:50 +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
Alexey Samsonov f49c076ff7 Simplify (and fix) check-dfsan configs
llvm-svn: 187968
2013-08-08 08:26:39 +00:00
Peter Collingbourne 5cbab07d02 DataFlowSanitizer; compiler-rt changes.
DataFlowSanitizer is a generalised dynamic data flow analysis.

Unlike other Sanitizer tools, this tool is not designed to detect a
specific class of bugs on its own.  Instead, it provides a generic
dynamic data flow analysis framework to be used by clients to help
detect application-specific issues within their own code.

Differential Revision: http://llvm-reviews.chandlerc.com/D967

llvm-svn: 187924
2013-08-07 22:47:26 +00:00
Alexander Potapenko 0443f1ac72 [TSan] Fix free_race.c by removing `not` from the test invocation that doesn't fail.
llvm-svn: 187889
2013-08-07 13:54:27 +00:00
Alexander Potapenko ce32410097 [TSan] Let the users suppress use-after-free errors using the "race:" suppressions.
If there's a race between a memory access and a free() call in the client program,
it can be reported as a use-after-free (if the access occurs after the free()) or an ordinary race
(if free() occurs after the access).
We've decided to use a single "race:" prefix for both cases instead of introducing a "use-after-free:" one,
because in many cases this allows us to keep a single suppression for both the use-after-free and free-after-use.

This may be misleading if the use-after-free occurs in a non-racy way (e.g. in a single-threaded program).
But normally such bugs shall not be suppressed.

llvm-svn: 187885
2013-08-07 12:39:00 +00:00
Alexey Samsonov f502fd75ab ASan: fix one more test case for pipefail
llvm-svn: 187881
2013-08-07 10:41:49 +00:00
Alexey Samsonov 15d5eefc65 Distinguish 32-bit ASan from 64-bit ASan in lit configs
llvm-svn: 187878
2013-08-07 09:31:28 +00:00
Alexey Samsonov 4431d2d566 Enable pipefail for ASan tests
llvm-svn: 187877
2013-08-07 09:14:30 +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
Alexey Samsonov b6c8b3de70 Enable pipefail for TSan tests
llvm-svn: 187875
2013-08-07 09:02:37 +00:00
Alexey Samsonov fd078b9405 Enable pipefail for LSan tests
llvm-svn: 187873
2013-08-07 08:46:09 +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
Alexander Potapenko 8c6cd93123 [libsanitizer] Drive-by fix for -Wempty-body in sanitizer_common_syscalls.inc
This makes the file consistently use { } around the if statements containing the PRE_/POST_ macros.

llvm-svn: 187797
2013-08-06 14:07:46 +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
Alexey Samsonov b42ea7ef21 Lint fixes
llvm-svn: 187726
2013-08-05 13:20:39 +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
Sergey Matveev 6459a370a7 [lsan] Add leak_check_at_exit flag.
We needed a way to tell LSan to invoke leak checking only if __do_leak_check()
is called explicitly. This can now be achieved by setting
leak_check_at_exit=false.

llvm-svn: 187578
2013-08-01 14:57:07 +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 3feb17c452 [sanitizer] Tweak read syscall handler signature for consistency.
llvm-svn: 187417
2013-07-30 13:16:52 +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
Evgeniy Stepanov d8a1798b47 [asan] Limit fake stack size to a reasonable value when running with unlimited stack.
llvm-svn: 187411
2013-07-30 11:50:26 +00:00
Evgeniy Stepanov f3e218a021 [asan] Raise thread stack size limit.
It's a sanity check, mostly, and we've seen threads with >256Mb stack.

llvm-svn: 187408
2013-07-30 09:01:18 +00:00
Evgeniy Stepanov 573ba3499e [sanitizer] Disable ForEachMappedRegion on Android.
It needs interface that is missing from the NDK, and it is not used on Android anyway.

llvm-svn: 187407
2013-07-30 08:39:16 +00:00
Peter Collingbourne e572e17a8e Fix warning.
llvm-svn: 187373
2013-07-29 20:13:41 +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
Rafael Espindola 3cf7eb50a9 Disable pipefail for lsan.
llvm-svn: 187274
2013-07-26 23:42:16 +00:00