Commit Graph

86 Commits

Author SHA1 Message Date
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
Timur Iskhodzhanov 4245f78fdd [ASan] Use less shadow on Win 32-bit
llvm-svn: 186393
2013-07-16 09:47:39 +00:00
Alexey Samsonov b0d92b3312 [Sanitizer] Rename InternalVector to InternalMmapVector
llvm-svn: 183972
2013-06-14 09:59:40 +00:00
Alexey Samsonov c8e7364763 [Sanitizer] support running external llvm-symbolizer on Mac
llvm-svn: 183730
2013-06-11 08:13:36 +00:00
Dmitry Vyukov e979c5467c tsan: fix windows mingw build
llvm-svn: 183644
2013-06-10 10:02:02 +00:00
Alexey Samsonov c30e2d6b3a Make InternalAlloc/InternalFree in sanitizer runtimes libc-free by switching to a custom allocator.
llvm-svn: 182836
2013-05-29 09:15:39 +00:00
Peter Collingbourne ffaf2eac4d [nolibc] Move all platforms to internal_getpid.
Before, we had an unused internal_getpid function for Linux, and a
platform-independent GetPid function.  To make the naming conventions
consistent for syscall-like functions, the GetPid syscall wrapper
in sanitizer_posix.cc is moved to sanitizer_mac.cc, and GetPid is
renamed to internal_getpid, bringing the Linux variant into use.

llvm-svn: 182132
2013-05-17 16:56:53 +00:00
Peter Collingbourne 6d4a7d3723 [nolibc] Begin moving sanitizer_common's libc-dependent code to a separate library
Introduce a new object library, RTSanitizerCommonLibc, which will contain
the subset of sanitizer_common with libc dependencies. RTSanitizerCommon
contains the remainder of sanitizer_common, and is intended to have no
libc dependencies. Begin moving code to RTSanitizerCommonLibc, starting
with sanitizer_common.cc, whose libc-dependent portion is moved to
sanitizer_common_libcdep.cc, the first member of the new library.

This split affects the CMake build only.  The makefile build continues
to produce the full sanitizer_common library.

llvm-svn: 182118
2013-05-17 16:17:19 +00:00
Sergey Matveev d9da20f56f [sanitizer] Generic sorting in sanitizer_common.
llvm-svn: 181698
2013-05-13 11:58:48 +00:00
Peter Collingbourne 6f4be19b57 [nolibc] Change internal syscall API to remove reliance on libc's errno.
This change moves to a model where the error value of a system call is
potentially contained in the return value itself rather than being
implicit in errno.  The helper function internal_iserror can be used
to extract the error value from a return value.  On platforms other
than Linux/x86_64 this still uses errno, but other platforms are free
to port their error handling to this new model.

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

llvm-svn: 181436
2013-05-08 14:43:49 +00:00
Sergey Matveev 954c6ef10f [sanitizer] Move GetThreadStackAndTls from TSan to sanitizer_common.
Move this function to sanitizer_common because LSan uses it too. Also, fix a bug
where the TLS range reported for main thread was off by the size of the thread
descriptor from libc (TSan doesn't care much, but for LSan it's critical).

llvm-svn: 181322
2013-05-07 14:41:43 +00:00
Sergey Matveev b2151b8200 Revert r180599 "[sanitizer] Clear LD_PRELOAD when forking an external symbolizer."
llvm-svn: 180602
2013-04-26 13:01:40 +00:00
Sergey Matveev 3c8fbe1013 [sanitizer] Clear LD_PRELOAD when forking an external symbolizer.
llvm-svn: 180599
2013-04-26 11:35:05 +00:00
Alexey Samsonov f36c5a8431 Revert r180082 and add a test for SetEnv function
llvm-svn: 180098
2013-04-23 12:49:12 +00:00
Alexey Samsonov e7540e3561 [Sanitizer] Delete unused function
llvm-svn: 180082
2013-04-23 08:18:09 +00:00
Alexey Samsonov 734aab4066 [Sanitizer] Use a common mutex to prevent mixing reports from different sanitizers. This fixes PR15516
llvm-svn: 178853
2013-04-05 07:30:29 +00:00
Alexander Potapenko 401bed0b9a [libsanitizer] Added data() and capacity() getters to InternalVector.
Same interface as in STL. Needed for LSan.

Patch by Sergey Matveev (earthdok@google.com)

llvm-svn: 178463
2013-04-01 13:55:34 +00:00
Alexey Samsonov 703a9870a2 [Sanitizer] Follow-up for r178238 - replace DCHECKs with regular CHECKs
llvm-svn: 178336
2013-03-29 08:03:01 +00:00
Alexey Samsonov cfe56d47da [Sanitizer] Minor enhancements in InternalVector container
llvm-svn: 178238
2013-03-28 15:37:11 +00:00
Dmitry Vyukov 510ad11800 tsan: add SetEnv() function that can be used in frontends
llvm-svn: 177857
2013-03-25 09:56:45 +00:00
Dmitry Vyukov 78693730a4 tsan: use a single background thread for memory profiler and memory flush (and later for symbolizer flush)
llvm-svn: 177627
2013-03-21 06:24:31 +00:00
Evgeniy Stepanov 0af672326a [sanitizer] Replace more platform checks with SANITIZER_ constants.
llvm-svn: 177400
2013-03-19 14:33:38 +00:00
Alexander Potapenko 845b575370 [libsanitizer] StopTheWorld in sanitizer_common
StopTheWorld puts the process in a suspended state before running the
user-supplied callback. To be used in TSan and in leak checking code.

Linux implementation provided.

Patch by Sergey Matveev (earthdok@google.com)

llvm-svn: 177156
2013-03-15 14:37:21 +00:00
Evgeniy Stepanov 5697b58ec4 [sanitizer] Move GetTlsSize code from TSan to sanitizer_common.
llvm-svn: 176938
2013-03-13 08:19:53 +00:00
Alexey Samsonov 434dde9996 [Sanitizer] Add methods back() and pop_back() to InternalVector. Patch by Sergey Matveev
llvm-svn: 176478
2013-03-05 11:58:25 +00:00
Kostya Serebryany a8cfb900dd [sanitizer] A low-level vector implementation to be used in leak checking code. Patch by Sergey Matveev
llvm-svn: 176089
2013-02-26 13:30:27 +00:00
Kostya Serebryany 459df6f167 [asan] a bit stricter lint for CHECK vs CHECK_XX (these CHECK_XX really help debugging!)
llvm-svn: 176085
2013-02-26 12:59:06 +00:00
Alexey Samsonov aadd1f2ad6 [Sanitizer] use raw syscall instead of _exit() function on Linux
llvm-svn: 175622
2013-02-20 13:54:32 +00:00
Alexey Samsonov 9211bd33ec [Sanitizer] Make temporary filename depend on user ID
llvm-svn: 175424
2013-02-18 07:17:12 +00:00
Timur Iskhodzhanov 659bca56a7 [ASan] Move functions using BitScan/clzl to sanitizer_common
llvm-svn: 174706
2013-02-08 11:45:04 +00:00
Kostya Serebryany b4c2c5c8a6 [asan] print a short one-line report summary after the full report. Currently, works only if symbolization happens in-process.
llvm-svn: 174501
2013-02-06 12:36:49 +00:00
Alexey Samsonov 39313b780d [Sanitizer] make internal_open have the same interface as libc version
llvm-svn: 174187
2013-02-01 15:58:46 +00:00
Kostya Serebryany bda64b4d40 [sanitizer] make the error messages from sanitizer_common contain the actual tool name
llvm-svn: 174059
2013-01-31 14:11:21 +00:00
Kostya Serebryany 6f604b5007 [asan/tsan] when unmapping a chunk of user memory, apply madvise(MADV_DONTNEED) to the corresponding chunk of shadow memory. Also update sanitizer_allocator64_testlib.cc
llvm-svn: 171144
2012-12-27 07:37:24 +00:00
Kostya Serebryany 7dfb168eb8 [asan] more asan_allocator2 code: actually un/poison shadow on malloc/free
llvm-svn: 170190
2012-12-14 12:15:09 +00:00
Kostya Serebryany 9806628792 [sanitizer] introduce MmapFixedOrDie and use it in SizeClassAllocator64
llvm-svn: 170099
2012-12-13 05:36:00 +00:00
Kostya Serebryany 90a59fafc0 [asan] more code for asan_allocator2: basic Allocate/Deallocate code
llvm-svn: 169864
2012-12-11 14:41:31 +00:00
Alexander Potapenko 1746f555ee Add a libsanitizer API __sanitizer_sandbox_on_notify(void* reserved), which should be used by
the client programs to notify the tools that sandboxing is about to be turned on.

llvm-svn: 169732
2012-12-10 13:10:40 +00:00
Kostya Serebryany 35f9e5e87b [sanitizer] implement SanitizerSetThreadName/SanitizerGetThreadName. Just for linux so far (using prctl(PR_GET_NAME))
llvm-svn: 169598
2012-12-07 11:27:24 +00:00
Kostya Serebryany 1e3d387459 [tsan] add MmapAlignedOrDie
llvm-svn: 169474
2012-12-06 06:10:31 +00:00
Kostya Serebryany dab61684ef [tsan] remove unused InternalAllocBlock as part of larger refactoring
llvm-svn: 169123
2012-12-03 11:57:01 +00:00
Kostya Serebryany df198db1aa [asan/tsan] get rid of kPageSize completely in favor of GetPageSizeCached(). This makes the code friendly to more platforms
llvm-svn: 168537
2012-11-24 05:03:11 +00:00
Kostya Serebryany f22c697f58 [asan] get rid of some of the uses of kPageSize. The intent is to get rid of it completely to support platforms with multiple possible page sizes.
llvm-svn: 168517
2012-11-23 15:38:49 +00:00
Kostya Serebryany 8bc5421ba0 [asan] get rid of kPageSizeBits
llvm-svn: 168426
2012-11-21 13:31:07 +00:00
Kostya Serebryany 734f1eb5f4 [asan/tsan] do not use __WORDSIZE macro, as it is glibc-private thing. Instead, define our own SANITIZER_WORDSIZE
llvm-svn: 168424
2012-11-21 12:38:58 +00:00
Kostya Serebryany 46de580003 [asan] more support for powerpc, patch by Peter Bergner
llvm-svn: 168356
2012-11-20 07:00:42 +00:00
Alexey Samsonov ae9b18b607 [Sanitizer] add sanity checks for communication with external symbolizer
llvm-svn: 167617
2012-11-09 14:45:30 +00:00
Alexey Samsonov 58358897a3 [Sanitizer] Add internal_isatty to sanitizer_libc and PrintsToTty to determine whether error reports are printed to terminal
llvm-svn: 167298
2012-11-02 15:18:34 +00:00
Dmitry Vyukov 56faa551b9 tsan: fix mac build
llvm-svn: 165004
2012-10-02 12:58:14 +00:00
Dmitry Vyukov 27d5b37c38 tsan: output tid's in reports
llvm-svn: 164998
2012-10-02 11:52:05 +00:00