Commit Graph

125 Commits

Author SHA1 Message Date
Timur Iskhodzhanov 5df4d0471f Move more POSIX-specific functions to sanitizer_posix.h
llvm-svn: 234482
2015-04-09 12:54:06 +00:00
Timur Iskhodzhanov 864308a78d Introduce CloseFile to be used instead of internal_close on non-POSIX
llvm-svn: 234481
2015-04-09 12:37:05 +00:00
Timur Iskhodzhanov c2c9ea5525 [Sanitizer RT] Get rid of internal_isatty
llvm-svn: 234423
2015-04-08 17:42:57 +00:00
Timur Iskhodzhanov 3745303c5b Move some POSIX-specific functions from sanitizer_libc.h to a new sanitizer_posix.h
llvm-svn: 234418
2015-04-08 17:08:24 +00:00
Timur Iskhodzhanov daa9e2d4e8 [Sanitizers] Make OpenFile more portable
llvm-svn: 234410
2015-04-08 16:03:22 +00:00
Timur Iskhodzhanov 1931b62632 Minor follow-up fix to r234150
llvm-svn: 234151
2015-04-06 12:54:06 +00:00
Timur Iskhodzhanov b97bcc4981 [ASan] Unify handling of loaded modules between POSIX and Windows
Reviewed at http://reviews.llvm.org/D8805

llvm-svn: 234150
2015-04-06 12:49:30 +00:00
Timur Iskhodzhanov ad3ec82bb1 [ASan/Win] Minor improvements towards enabling coverage
llvm-svn: 233918
2015-04-02 14:48:08 +00:00
Timur Iskhodzhanov 89608af26d [ASan/Win] UnmapOrDie should not fail on zero address / size
llvm-svn: 233707
2015-03-31 16:39:20 +00:00
Alexander Potapenko 141e420a81 [ASan] Distinguish between read, write and read-write file access modes in OpenFile.
This is to fix mapping coverage files into memory on OSX.

llvm-svn: 232936
2015-03-23 10:10:46 +00:00
Dmitry Vyukov df01bdca70 asan: fix windows build after commit 230978
llvm-svn: 230980
2015-03-02 17:45:18 +00:00
Anna Zaks 2249049db2 [compiler-rt] Allow suppression file to be relative to the location of the executable
The ASanified executable could be launched from different locations. When we
cannot find the suppression file relative to the current directory, try to
see if the specified path is relative to the location of the executable.

llvm-svn: 230723
2015-02-27 03:12:19 +00:00
Dmitry Vyukov b3381fad11 tsan: exclude DumpProcessMap on windows
The function uses EnumProcessModules, which requires psapi.lib,
which is not linked with tsan on windows.

llvm-svn: 229390
2015-02-16 13:51:17 +00:00
Timur Iskhodzhanov 8ce4a069e4 [ASan/Win] NFC, just minor simplification of the code
llvm-svn: 228702
2015-02-10 16:29:05 +00:00
Yury Gribov 8f848ff5ed [ASan] Add use_madv_dontdump flag.
Differential Revision: http://reviews.llvm.org/D7294

llvm-svn: 227959
2015-02-03 10:15:15 +00:00
Timur Iskhodzhanov e5935ef0c4 [ASan/Win] Add some diagnostics to help investigate Mprotect failures
llvm-svn: 227803
2015-02-02 15:04:23 +00:00
Evgeniy Stepanov 8eb8204e3f [sanitizer] Fix windows build.
llvm-svn: 226825
2015-01-22 13:47:12 +00:00
Kostya Serebryany c6338ac943 [asan] use MADV_NOHUGEPAGE for shadow to reduce the actual memory usage
llvm-svn: 226636
2015-01-21 02:05:31 +00:00
Timur Iskhodzhanov a023e06618 Follow-up to r224987: fix a lint warning
llvm-svn: 224988
2014-12-30 15:30:19 +00:00
Timur Iskhodzhanov 64fc8e4a5a [ASan/Win] Sort the list of modules when we fail to reserve the shadow memory range
llvm-svn: 224987
2014-12-30 14:44:12 +00:00
Daniel Jasper 1e8eafd6c8 Escape ? to silence GCC warning about trigraphs.
llvm-svn: 224863
2014-12-26 18:21:34 +00:00
Timur Iskhodzhanov a04b33b9de [ASan/Win] Add basic support for MemoryRangeIsAvailable and DumpProcessMap to make it easier to debug startup shadow mapping failures
llvm-svn: 224856
2014-12-26 14:28:32 +00:00
Timur Iskhodzhanov b8373bc119 [ASan/Win] Suppress error messaging when Abort() is called
This will prevent ASan bots from hanging / timing out

llvm-svn: 224852
2014-12-26 12:25:54 +00:00
Hans Wennborg 7dd94570b0 Fix Win build after r224353: void function returning zero.
llvm-svn: 224366
2014-12-16 20:46:05 +00:00
Kostya Serebryany 43eb7735f2 [asan] new flag: hard_rss_limit_mb
llvm-svn: 224353
2014-12-16 19:13:01 +00:00
Alexey Samsonov 3a41ed1574 [Sanitizer] Fix report_path functionality:
Summary:
  - Make sure mmap() is never called inside RawWrite function.
  - Wrap a bunch of standalone globals in a ReportFile object.
  - Make sure accesses to these globals are thread-safe.
  - Fix report_path functionality on Windows, where
    __sanitizer_set_report_path() would break program.

I've started this yak shaving in order to make
"CommonFlags::mmap_limit_mb" immutable. Currently we drop this flag
to zero before printing an error message.

Test Plan: regression test suite

Reviewers: kcc, glider

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D6595

llvm-svn: 224031
2014-12-11 18:30:25 +00:00
Kostya Serebryany 6c54a6b5dd [asan] move GetRSS from tsan to sanitizer_common
llvm-svn: 223730
2014-12-09 01:22:59 +00:00
Yury Gribov ecfa592671 Removed r221896, it seems to break build in various ways.
llvm-svn: 221912
2014-11-13 19:37:30 +00:00
Yury Gribov 17072ef348 [ASan] Add process basename to log name and error message to simplify analysis of sanitized systems logs.
Reviewed at http://reviews.llvm.org/D5724

llvm-svn: 221896
2014-11-13 16:01:23 +00:00
Hans Wennborg f89a3f8623 Try to fix the Windows build after r220637
llvm-svn: 220643
2014-10-26 19:27:02 +00:00
Alexey Samsonov 9c85927012 [Sanitizer] Make StackTrace a lightweight reference to array of PCs, and
introduce a BufferedStackTrace class, which owns this array.

Summary:
This change splits __sanitizer::StackTrace class into a lightweight
__sanitizer::StackTrace, which doesn't own array of PCs, and BufferedStackTrace,
which owns it. This would allow us to simplify the interface of StackDepot,
and eventually merge __sanitizer::StackTrace with __tsan::StackTrace.

Test Plan: regression test suite.

Reviewers: kcc, dvyukov

Reviewed By: dvyukov

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D5985

llvm-svn: 220635
2014-10-26 03:35:14 +00:00
Alexey Samsonov 1947bf9921 PR20721: Don't let UBSan print inaccessible memory
Summary:
UBSan needs to check if memory snippet it's going to print resides
in addressable memory. Similar check might be helpful in ASan with
dump_instruction_bytes option (see http://reviews.llvm.org/D5167).

Instead of scanning /proc/self/maps manually, delegate this check to
the OS kernel: try to write this memory in a syscall and assume that
memory is inaccessible if the syscall failed (e.g. with EFAULT).

Fixes PR20721.

Test Plan: compiler-rt test suite

Reviewers: eugenis, glider

Reviewed By: glider

Subscribers: emaste, ygribov, llvm-commits, glider, rsmith

Differential Revision: http://reviews.llvm.org/D5253

llvm-svn: 217971
2014-09-17 17:56:15 +00:00
Dmitry Vyukov aa8fa60ba8 tsan: unbreak windows build
Currently it fails with:

# Testing race detector.
race_windows_amd64.syso:gotsan.cc:(.text+0x4d89): undefined reference to `__imp_SymGetModuleBase64'
race_windows_amd64.syso:gotsan.cc:(.text+0x4d90): undefined reference to `__imp_SymFunctionTableAccess64'
race_windows_amd64.syso:gotsan.cc:(.text+0x4dd8): undefined reference to `__imp_StackWalk64'
x86_64-w64-mingw32/bin/ld.exe: race_windows_amd64.syso
: bad reloc address 0x10 in section `.data'
collect2.exe: error: ld returned 1 exit status

llvm-svn: 216875
2014-09-01 11:44:59 +00:00
Alexey Samsonov 34e2b280da [TSan] Share the code the setup code calling getrlim/setrlim with sanitizer_common
llvm-svn: 215481
2014-08-12 22:31:19 +00:00
Timur Iskhodzhanov 19853dd28c [ASan/Win] Catch NULL derefs and page faults
Reviewed at http://reviews.llvm.org/D4471

llvm-svn: 212807
2014-07-11 11:57:41 +00:00
Evgeniy Stepanov a00ff194b7 [asan] Add a few stubs to fix windows build.
llvm-svn: 209717
2014-05-28 08:26:24 +00:00
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