Commit Graph

2615 Commits

Author SHA1 Message Date
Sergey Matveev 540338259d [sanitizer] Change strip_path_prefix flag behavior.
Previously (in tools other than TSan) the entire prefix of the path had to mach
the argument. With this change, only some suffix of the prefix has to match.
This is the same way this flag works in TSan.

llvm-svn: 186837
2013-07-22 16:14:38 +00:00
Sergey Matveev 9c012165ad [lsan] Make __lsan_do_leak_check() honor the detect_leaks flag.
Also move detect_leaks to common flags.

llvm-svn: 186821
2013-07-22 12:38:17 +00:00
Sergey Matveev 1ac4824841 [lsan] Print direct leaks first.
Direct leaks are higher priority, so it makes sense to have them on top.

llvm-svn: 186819
2013-07-22 11:18:32 +00:00
Hans Wennborg cb445d882e Fix another instance of -ccc-cxx vs. --driver-mode=g++
llvm-svn: 186609
2013-07-18 21:09:03 +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
Sergey Matveev 655bd0d08c [lsan] Add __lsan_do_leak_check() to the public interface.
Let users override the normal behavior to run leak checking earlier in
the process. Also fix a couple nits here and there.

llvm-svn: 186581
2013-07-18 14:06:07 +00:00
Dmitry Vyukov e9c456e15f tsan: treat SIGSYS as synchronous signal
It is required for chromium sandboxing code.
From the description it seems to be indeed synchronous -- called back on syscall with incorrect arguments,
but seems to be unused in practice. So this should be fine.

llvm-svn: 186579
2013-07-18 13:14:11 +00:00
Alexey Samsonov 79d79da0e1 [ASan] Fix leaks in ASan tests found by LSan
llvm-svn: 186577
2013-07-18 12:59:52 +00:00
Alexey Samsonov 3122deb65c [Sanitizer] Always provide --default-arch argument to llvm-symbolizer
llvm-svn: 186513
2013-07-17 15:02:43 +00:00
Dmitry Vyukov c2e4e95580 tsan: disable one more interceptor that causes recursion
llvm-svn: 186497
2013-07-17 07:10:47 +00:00
Dmitry Vyukov 46cbc2ed50 tsan: fix unitialized read warning under newer gcc (it does not have visibility into asm)
llvm-svn: 186495
2013-07-17 06:56:47 +00:00
Anton Korobeynikov ec42bd9700 Give compiler-rt a chance to compile with mingw-w64.
Patch by C. Bergström!

llvm-svn: 186463
2013-07-16 22:37:55 +00:00
Dmitry Vyukov d4060fd281 tsan: extend suppressions format with ^ and $ symbols
not it's possible to write more precise suppressions,
e.g. "^foo$" won't match "blafoobar"

llvm-svn: 186424
2013-07-16 16:44:15 +00:00
Alexey Samsonov af4806f719 [ASan] Bump min supported Mac OS X version to 10.6 - makefile build
llvm-svn: 186410
2013-07-16 13:16:15 +00:00
Alexey Samsonov 9916aa2d95 [Sanitizer] move strcpy and strncpy to common interceptors
llvm-svn: 186408
2013-07-16 12:51:53 +00:00
Alexey Samsonov eb7973246f [ASan] Bump min supported Mac OS X version to 10.6
llvm-svn: 186404
2013-07-16 11:54:40 +00:00
Dmitry Vyukov 1a0c76fa55 tsan: support sigsuspend() call
Intercepting it makes it process pending signal before return.

llvm-svn: 186400
2013-07-16 11:28:04 +00:00
Timur Iskhodzhanov 4245f78fdd [ASan] Use less shadow on Win 32-bit
llvm-svn: 186393
2013-07-16 09:47:39 +00:00
Alexander Potapenko 27155281db [ASan] Cache the OSX version to avoid calling sysctl() on every GetMacosVersion() call.
llvm-svn: 186389
2013-07-16 09:29:48 +00:00
Alexander Potapenko b137ca157b [ASan] Add support for OS X Mavericks to GetMacosVersion.
llvm-svn: 186386
2013-07-16 08:35:42 +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 0048a248bd Completely revert all mbstowcs-and-friends changes from r186109. They were unintentional
llvm-svn: 186158
2013-07-12 12:33:23 +00:00
Sergey Matveev 28dc98ab0d [lsan] Increase the hardcoded limit on number of leaks.
We never expected to see so many leaks in the real world. Until we did.

llvm-svn: 186157
2013-07-12 12:31:22 +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
Chandler Carruth 1a48dc5ed6 Fix a veritable conucopia of bugs in the readdir_r interceptors.
First, the reason I came here: I forgot to look at readdir64_r which had
the exact same bug as readdir_r. However, upon applying the same
quick-fix and testing it I discovered that it still didn't work at all.
As a consequence, I spent some time studying the code and thinking about
it and fixed several other problems.

Second, the code was checking for a null entry and result pointer, but
there is no indication that null pointers are viable here. Certainly,
the spec makes it extremely clear that there is no non-error case where
the implementation of readdir_r fails to dereference the 'result'
pointer and store NULL to it. Thus, our checking for a non-null 'result'
pointer before reflecting that write in the instrumentation was
trivially dead. Remove it.

Third, the interceptor was marking the write to the actual dirent struct
by looking at the entry pointer, but nothing in the spec requires that
the dirent struct written is actually written into the entry structure
provided. A threadlocal buffer would be just as conforming, and the spec
goes out of its way to say the pointer to the *actual* result dirent
struct is stored into *result, so *that* is where the interceptor should
reflect a write occuring. This also obviates the need to even consider
whether the 'entry' parameter is null.

Fourth, I got to the bottom of why nothing at all worked in readdir64_r
-- the interceptor structure for dirent64 was completely wrong in that
it was the same as dirent. I fixed this struct to be correct (64-bit
inode and 64-bit offset! just a 64-bit offset isn't enough!) and added
several missing tests for the size and layout of this struct.

llvm-svn: 186109
2013-07-11 18:51:40 +00:00
Sergey Matveev 29e787d456 [sanitizer] Remove optional arguments from clone() invocation.
Unbreaks compilation on older systems. Patch by Andy Jost.

llvm-svn: 186103
2013-07-11 16:37:44 +00:00
Evgeniy Stepanov 9240838655 [sanitizer] More checks in mbstowcs-like interceptors.
llvm-svn: 186004
2013-07-10 14:17:46 +00:00
Evgeniy Stepanov 123fdb3413 [sanitizer] Fix handling of edge cases in mbstowcs-like interceptors.
llvm-svn: 186002
2013-07-10 14:01:51 +00:00
Chandler Carruth 28c1b294b8 Fix a bug in the readdir_r interceptor: when we reach the end of the
directory stream, the entry is not written to, instead *result is set to
NULL and the entry is not written to at all.

I'm still somewhat suspicious of the correct instrumention here --
I feel like it should be marking the written range as the pointer in
*result and the length (*result)->d_reclen in case the implementation
decides not to use the passed-in entry (if that's even allowed).
Finally, the definition of 'struct dirent' analog used in the
interceptor is wrong in 32-bit mode with _FILE_OFFSET_BITS=64 as it hard
codes the use of a pointer-sized offset.

I've added a somewhat goofy test for the bug I fixed via ASan --
suggestions on how to better test the interceptor logic itself welcome.

llvm-svn: 185998
2013-07-10 09:50:29 +00:00
Peter Collingbourne 2c60538ddd [asan] Update blacklists to use categories.
Differential Revision: http://llvm-reviews.chandlerc.com/D1094

llvm-svn: 185980
2013-07-09 22:04:28 +00:00
Evgeniy Stepanov 7160fb6511 [sanitizer] Update glob64 interceptor to handle GLOB_ALTDIRFUNC as well.
llvm-svn: 185935
2013-07-09 12:34:25 +00:00
Evgeniy Stepanov faba61a7bc [sanitizer] Support GLOB_ALTDIRFUNC in glob interceptor.
llvm-svn: 185932
2013-07-09 12:07:59 +00:00
Evgeniy Stepanov 77ef78a0a5 [sanitizer] Intercept realpath and canonicalize_file_name.
Handle realpath(path, NULL) form.

llvm-svn: 185921
2013-07-09 09:53:37 +00:00
Evgeniy Stepanov f60c75a644 [sanitizer] Wrap lines >80 chars.
llvm-svn: 185920
2013-07-09 09:47:36 +00:00
Evgeniy Stepanov 8495b84076 [asan] Fix windows build.
llvm-svn: 185917
2013-07-09 09:29:19 +00:00
Evgeniy Stepanov f7f252d025 [sanitizer] Syscall handlers for clock_gettime and clock_getres.
llvm-svn: 185913
2013-07-09 08:54:59 +00:00
Sergey Matveev ddd7b6a1c8 [lsan] Fix test.
llvm-svn: 185817
2013-07-08 14:08:05 +00:00
Sergey Matveev bdeff959a1 [lsan] Handle fork() correctly.
Update the main thread's os_id on every pthread_create, and before
initiating leak checking. This ensures that we have the correct os_id even if we
have forked after Init().

llvm-svn: 185815
2013-07-08 12:57:24 +00:00
Alexey Samsonov 852d8a4c18 [LSan] Use overridable hook to report error summary
llvm-svn: 185805
2013-07-08 10:59:52 +00:00
Evgeniy Stepanov c2e3ba9eed [sanitizer] Fix mac build.
llvm-svn: 185706
2013-07-05 15:04:56 +00:00
Evgeniy Stepanov 628d727749 [msan] Intercept pthread_key_create.
llvm-svn: 185693
2013-07-05 12:31:07 +00:00
Evgeniy Stepanov 0d1d35aeba [sanitizer] Disable ptrace interception on non-x86(_64).
Patch by Hal Finkel.

llvm-svn: 185686
2013-07-05 08:57:47 +00:00
Alexander Potapenko 4f73dea69d [ASan] Close stderr before launching atos in asan_symbolize.py
llvm-svn: 185631
2013-07-04 14:21:49 +00:00
Evgeniy Stepanov 717e0cd2a7 [sanitizer] Intercept tcgetattr.
llvm-svn: 185626
2013-07-04 14:03:31 +00:00
Evgeniy Stepanov db615c186f [sanitizer] More interceptors.
bcopy
strtoimax, strtoumax
mbstowcs, mbsrtowcs, mbsnrtowcs
wcstombs, wcsrtombs, wcsnrtombs

llvm-svn: 185624
2013-07-04 13:19:41 +00:00
Alexander Potapenko d0c91acb58 [ASan] Do not protect the malloc zone created by malloc_zone_create() on Snow Leopard and earlier systems.
Fixes https://code.google.com/p/address-sanitizer/issues/detail?id=208

llvm-svn: 185621
2013-07-04 10:16:12 +00:00
Sergey Matveev 22614e5e3f [sanitizer] Fix memory leak in sanitizer_common discovered by LeakSanitizer.
llvm-svn: 185536
2013-07-03 13:45:13 +00:00
Evgeniy Stepanov 1bd0fe447f [sanitizer] Fix Android build.
llvm-svn: 185432
2013-07-02 14:51:31 +00:00
Evgeniy Stepanov aa23bd83e5 [msan] Intercept mempcpy, wmempcpy.
llvm-svn: 185431
2013-07-02 14:49:24 +00:00
Evgeniy Stepanov 69a387e6ae [sanitizer] Fix GLOB_NOMATCH behaviour and refactor the interceptor a bit.
llvm-svn: 185428
2013-07-02 14:08:52 +00:00