Commit Graph

89 Commits

Author SHA1 Message Date
Sergey Matveev 6cb47a083b [sanitizer] Support sandboxing in sanitizer coverage.
Summary:
Sandboxed code may now pass additional arguments to
__sanitizer_sandbox_on_notify() to force all coverage data to be dumped to a
single file (the default is one file per module). The user may supply a file or
socket to write to. The latter option can be used to broker out the file writing
functionality. If -1  is passed, we pre-open a file.

llvm-svn: 209121
2014-05-19 12:53:03 +00:00
Timur Iskhodzhanov 7d5c81db0a [ASan/Win] Don't crash when ASAN_OPTIONS have disable_core=1
Reviewed at http://reviews.llvm.org/D3610

llvm-svn: 208070
2014-05-06 08:21:50 +00:00
Timur Iskhodzhanov 364b8b8fe5 [ASan] Print mmap errno/GetLastError in a readable and consistent way
Reviewed at http://llvm-reviews.chandlerc.com/D3107

llvm-svn: 204218
2014-03-19 08:23:00 +00:00
Alexey Samsonov 3e8467b8b9 Avoid doing any work when unwinding stack traces with 0 or 1 frame
llvm-svn: 202837
2014-03-04 12:21:28 +00:00
Evgeniy Stepanov e5a447d947 [asan] Fix Windows build.
llvm-svn: 201154
2014-02-11 13:57:17 +00:00
Timur Iskhodzhanov aeefb6abce [ASan/Win] Fall back to stdout if we can't print the reports to stderr
llvm-svn: 200804
2014-02-04 23:28:30 +00:00
Dmitry Vyukov a538aac8ce tsan: fix windows build
llvm-svn: 200778
2014-02-04 17:27:29 +00:00
Alexander Potapenko ea4a0dbb8d [ASan] Implement __sanitizer::InstallDeadlySignalHandlers() and __asan::AsanOnSIGSEGV() on Windows.
llvm-svn: 200554
2014-01-31 15:11:11 +00:00
Alexander Potapenko 789e3e1b7c [ASan] Move the SIGSEGV/SIGBUS handling to sanitizer_common
This change is a part of refactoring intended to have common signal handling behavior in all tools.
This particular CL moves InstallSignalHandlers() into sanitizer_common (making it InstallDeadlySignalHandlers()), but doesn't enable default signal handlers for any tool other than ASan.

llvm-svn: 200542
2014-01-31 13:10:07 +00:00
Alexander Potapenko d8d490ed50 [ASan] Move the sigaltstack() bits to sanitizer_common.
This change is a part of refactoring intended to have common signal handling behavior in all tools.
Note that this particular change doesn't enable use_sigaltstack support in every tool.

llvm-svn: 200310
2014-01-28 11:12:29 +00:00
Kostya Serebryany 57bfdb080b [asan] add flag uar_noreserve to use noreserve mmap for fake stack. uar_noreserve=1 will save some memory but also negatively affect performance
llvm-svn: 197233
2013-12-13 15:03:49 +00:00
Timur Iskhodzhanov 89a346c2a1 [ASan] Fix StackTrace::SlowUnwindStack on Windows
llvm-svn: 196894
2013-12-10 08:30:39 +00:00
Timur Iskhodzhanov 895392d03f [ASan] Use ExitProcess rather than _exit on Windows to avoid calling global dtors etc
llvm-svn: 195723
2013-11-26 09:40:39 +00:00
Timur Iskhodzhanov e87f5701bb Remove a FIXME now that I can't reproduce the problem
llvm-svn: 194331
2013-11-09 15:01:23 +00:00
Timur Iskhodzhanov 1f1c7ec400 [Sanitizers] Share some stack walking code between Windows and Linux
Reviewed at http://llvm-reviews.chandlerc.com/D2126

llvm-svn: 194326
2013-11-09 13:59:12 +00:00
Alexey Samsonov 5d350b2ab6 [Sanitizer] Presumable fix stack trace unwinding on Windows
llvm-svn: 194195
2013-11-07 06:53:41 +00:00
Alexey Samsonov e13f775a63 [Sanitizer] Call Windows unwinder 'slow' and share StackTrace::Unwind across all platforms. No functionality change.
llvm-svn: 194193
2013-11-07 06:33:06 +00:00
Alexey Samsonov 7f5823844a [Sanitizer] Remove StackTrace::max_depth field
llvm-svn: 192534
2013-10-12 12:40:47 +00:00
Alexey Samsonov c129e65661 [Sanitizer] Turn GetStackTrace() into StackTrace::Unwind()
llvm-svn: 192533
2013-10-12 12:23:00 +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
Reid Kleckner d483c072af sanitizers: Make sure Visual Studio gets error reports
Visual Studio appears to close stderr before launching a non-console
win32 program.  This means we don't see any sanitizer reports.  If
stderr printing fails, call OutputDebugStringA to get the reports into
the Visual Studio debugger console.

llvm-svn: 190030
2013-09-05 03:19:57 +00:00
Timur Iskhodzhanov 2eea5894fe [asan] Hopefully un-break the RTL on Windows
llvm-svn: 189821
2013-09-03 15:50:13 +00:00
Alexey Samsonov de647ddc8b [Sanitizer] Add the way to find binary in PATH
llvm-svn: 189799
2013-09-03 13:20:48 +00:00
Timur Iskhodzhanov 4245f78fdd [ASan] Use less shadow on Win 32-bit
llvm-svn: 186393
2013-07-16 09:47:39 +00:00
Dmitry Vyukov 7e4a18c4fb tsan: fix merge bug
llvm-svn: 183648
2013-06-10 11:11:29 +00:00
Dmitry Vyukov b278f1235f tsan: fix windows crash (incorrect stack boundaries)
llvm-svn: 183646
2013-06-10 10:30:54 +00:00
Dmitry Vyukov e979c5467c tsan: fix windows mingw build
llvm-svn: 183644
2013-06-10 10:02:02 +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 53caf563a9 Try to fix Windows build too
llvm-svn: 181457
2013-05-08 18:15:01 +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 af179b8d63 [sanitizer] Move GetStackTrace from ASan to sanitizer_common.
llvm-svn: 181424
2013-05-08 12:45:55 +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
Timur Iskhodzhanov 2dee3dd61c Add a GetTid() implementation for Windows
llvm-svn: 177927
2013-03-25 22:04:29 +00:00
Evgeniy Stepanov 0af672326a [sanitizer] Replace more platform checks with SANITIZER_ constants.
llvm-svn: 177400
2013-03-19 14:33:38 +00:00
Alexey Samsonov a097f7b1e3 [Sanitizer] Add default constructor for BlockingMutex
llvm-svn: 177072
2013-03-14 13:30:56 +00:00
Alexey Samsonov 7d2385419a [Sanitizer] fix compilation for Windows
llvm-svn: 177054
2013-03-14 11:29:06 +00:00
Alexey Samsonov 83e7622df6 [Sanitizer] Write a slightly better implementation of GetEnv() function on Windows
llvm-svn: 177051
2013-03-14 11:10:23 +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 db7d9656bb [Sanitizer] Implement BlockingMutex::CheckLocked()
llvm-svn: 176805
2013-03-11 15:45:20 +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 167f9e4395 [ASan] Switch Windows to allocator v2, also fixing some build errors
llvm-svn: 174707
2013-02-08 12:02:00 +00:00
Dmitry Vyukov fa67ed47e1 asan/tsan: fix failing CHECK on windows
llvm-svn: 174319
2013-02-04 10:42:38 +00:00
Alexey Samsonov 2c5cbd2b38 [Sanitizer] extend internal libc with stat/fstat/lstat functions
llvm-svn: 174316
2013-02-04 10:16:50 +00:00
Dmitry Vyukov 7981ea8baa asan/tsan: fix compilation errors/bugs on Windows where long is 32-bit even in 64-bit mode
llvm-svn: 174312
2013-02-04 08:07:45 +00:00
Alexey Samsonov 4985b8766e [Sanitizer] use u32 instead of mode_t, which is defined in Darwin headers
llvm-svn: 174189
2013-02-01 16:32:18 +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
Dmitry Vyukov ff19809a3d asan: fix windows build
llvm-svn: 172415
2013-01-14 14:28:06 +00:00
Dmitry Vyukov f22982bf0a asan/tsan: move blocking mutex from asan to sanitizer_common
llvm-svn: 172380
2013-01-14 07:51:39 +00:00
Alexey Samsonov 35ed02ebf1 [Sanitizer] add missing header on Windows
llvm-svn: 170514
2012-12-19 08:51:39 +00:00