Evgeniy Stepanov
7eeb02bd09
[asan] Read process name from /proc/self/cmdline on Linux.
...
Rename getBinaryBasename() to getProcessName() and, on Linux,
read it from /proc/self/cmdline instead of /proc/self/exe. The former
can be modified by the process. The main motivation is Android, where
application processes re-write cmdline to a package name. This lets
us setup per-application ASAN_OPTIONS through include=/some/path/%b.
llvm-svn: 243473
2015-07-28 20:27:51 +00:00
Evgeniy Stepanov
5a268b10b3
[sanitizer] Implement logging to syslog.
...
Previously, Android target had a logic of duplicating all sanitizer
output to logcat. This change extends it to all posix platforms via
the use of syslog, controlled by log_to_syslog flag. Enabled by
default on Android, off everywhere else.
A bit of cmake magic is required to allow Printf() to call a libc
function. I'm adding a stub implementation to support no-libc builds
like dfsan and safestack.
This is a second attempt. I believe I've fixed all the issues that
prompted the revert: Mac build, and all kinds of non-CMake builds
(there are 3 of those).
llvm-svn: 243051
2015-07-23 22:05:20 +00:00
Evgeniy Stepanov
ffbc4ec790
Revert r242975.
...
Breaks Mac build.
llvm-svn: 242978
2015-07-23 01:29:26 +00:00
Evgeniy Stepanov
4f03227fa2
[sanitizer] Implement logging to syslog.
...
Previously, Android target had a logic of duplicating all sanitizer
output to logcat. This change extends it to all posix platforms via
the use of syslog, controlled by log_to_syslog flag. Enabled by
default on Android, off everywhere else.
A bit of cmake magic is required to allow Printf() to call a libc
function. I'm adding a stub implementation to support no-libc builds
like dfsan and safestack.
llvm-svn: 242975
2015-07-22 23:57:19 +00:00
Yury Gribov
2d45554b82
[ASan] Add process basename to log name and error message to
...
simplify analysis of sanitized systems logs.
Differential Revision: http://reviews.llvm.org/D7333
llvm-svn: 239134
2015-06-05 06:08:23 +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
Kostya Serebryany
2dd74371b2
[asan] [mips] added support of asan for mips64/mips64el, patch by Kumar Sukhani
...
llvm-svn: 221800
2014-11-12 18:23:16 +00:00
Hans Wennborg
4834653872
sanitizer_printf.cc: guard the va_copy hack on _MSC_VER
...
llvm-svn: 215932
2014-08-18 20:23:16 +00:00
Hans Wennborg
a2d4b09a55
Revert "[ASan/Win] Remove a hack that seems not to be required with VS2013 anymore" (r215708)
...
This is still needed for VS2012.
llvm-svn: 215930
2014-08-18 19:55:35 +00:00
Timur Iskhodzhanov
cc01fad1d9
[ASan/Win] Remove a hack that seems not to be required with VS2013 anymore
...
llvm-svn: 215708
2014-08-15 13:45:23 +00:00
Evgeniy Stepanov
350fe4b1af
[asan] Android logging.
...
This change duplicates all ASan output to system log on Android.
llvm-svn: 199887
2014-01-23 11:34:41 +00:00
Evgeniy Stepanov
04c5a836a2
[sanitizer] Add a sanity check.
...
llvm-svn: 199880
2014-01-23 11:01:07 +00:00
Evgeniy Stepanov
29b7866c6c
[sanitizer] Add printf format attributes.
...
These were lost in a refactoring a long time ago.
llvm-svn: 199874
2014-01-23 08:58:34 +00:00
Alexey Samsonov
0714b7b31b
[Sanitizer] Support %.*s in internal printf implementation. Patch by Yuri Gribov.
...
llvm-svn: 199724
2014-01-21 10:59:44 +00:00
Sergey Matveev
9be70fbda9
[sanitizer] Introduce VReport and VPrintf macros and use them in sanitizer code.
...
Instead of "if (common_flags()->verbosity) Report(...)" we now have macros.
llvm-svn: 196497
2013-12-05 12:04:51 +00:00
Alexey Samsonov
4d369187ec
[Sanitizer] Print symbolized stack frame using a single Printf() call.
...
This reduces the number of "write" syscalls performed to print a single
stack frame description, and makes sanitizer output less intermixed with
program output. Also, add a number of unit tests.
llvm-svn: 194686
2013-11-14 09:41:24 +00:00
Dmitry Vyukov
4314e319ab
tsan: allow to override OnPrint() callback in Go runtime
...
llvm-svn: 192576
2013-10-14 09:52:40 +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
Sergey Matveev
9450108430
[sanitizer] Support padding with spaces in Printf.
...
llvm-svn: 185082
2013-06-27 15:30:44 +00:00
Dmitry Vyukov
e979c5467c
tsan: fix windows mingw build
...
llvm-svn: 183644
2013-06-10 10:02:02 +00:00
Timur Iskhodzhanov
cc61eefd4b
Fix MSVC W3 compiler warnings
...
llvm-svn: 182857
2013-05-29 14:11:44 +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
Dmitry Vyukov
93b2cba03b
asan: fix windows build
...
llvm-svn: 180788
2013-04-30 13:30:29 +00:00
Dmitry Vyukov
e8fa45a02c
asan/tsan: fix printf(), on the second pass it prints garbage and crashes on random pointer dereference
...
llvm-svn: 180784
2013-04-30 12:27:48 +00:00
Alexey Samsonov
1a6cfb46e5
[Sanitizer] Rework r176802: share code between Printf and Report and simplify it a bit
...
llvm-svn: 179755
2013-04-18 13:18:23 +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
Alexey Samsonov
87c2a87b50
[Sanitizer] Fix OnPrint weak hook. Disable weak hooks for gotsan.
...
llvm-svn: 178640
2013-04-03 13:22:54 +00:00
Dmitry Vyukov
f3bc56bb6b
asan/tsan: change SANITIZER_GO to more general SANITIZER_SUPPORTS_WEAK_HOOKS
...
llvm-svn: 178009
2013-03-26 12:07:04 +00:00
Dmitry Vyukov
7886253fee
asan/tsan: add Printf/Report hook
...
The hook can be overriden in frontend to print to e.g. a file.
llvm-svn: 177864
2013-03-25 12:58:09 +00:00
Evgeniy Stepanov
24aad9c0cb
Break a >80 char line.
...
llvm-svn: 176937
2013-03-13 08:17:39 +00:00
Alexander Potapenko
1f78ad5da4
[ASan] Reduce the local buffer size in Report() not to fail the check enforced when building TSan runtime.
...
llvm-svn: 176804
2013-03-11 13:36:39 +00:00
Alexander Potapenko
18c916c6c5
[ASan] Try to use a small (512 bytes) stack-local buffer in Report() for short messages, fall back to MmapOrDie() in the case of a failure.
...
This shall eliminate most of the cryptic "ERROR: failed to mmap" messages caused by recursively calling MmapOrDie() from MmapOrDie().
llvm-svn: 176802
2013-03-11 11:47:43 +00:00
Richard Smith
54fc2370f9
Don't escape %s in printf usage message; it's not written by printf.
...
llvm-svn: 170413
2012-12-18 05:49:49 +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
Alexey Samsonov
3a3488e4e1
[Sanitizer] replace while with internal_memset to make sure compiler won't replace it with library memset
...
llvm-svn: 168422
2012-11-21 11:12:57 +00:00
Richard Smith
05dce7e644
-fsanitize=undefined: Switch to using sanitizer_common for output. This gets us much closer to not depending on any system headers.
...
llvm-svn: 167888
2012-11-13 23:42:05 +00:00
Alexey Samsonov
ad9d65feb8
[TSan] finally remove TsanPrintf in favor of Printf from sanitizer_common
...
llvm-svn: 167294
2012-11-02 12:17:51 +00:00
Kostya Serebryany
5b0a8f3f53
[asan] fix the va_arg usage
...
llvm-svn: 163879
2012-09-14 06:52:46 +00:00
Kostya Serebryany
45d849c4bd
[asan] add asan option log_path=PATH to let users redirect asan reports to a file PATH.PID instead of stderr
...
llvm-svn: 163872
2012-09-14 04:35:14 +00:00
Kostya Serebryany
d0d96bfb86
[asan/tsan] use InternalScopedBuffer instead of stack arrays. Use mmap inseted of InternalAlloc in InternalScopedBuffer
...
llvm-svn: 162834
2012-08-29 08:40:36 +00:00
Kostya Serebryany
bb6f165952
[asan] get rid of AsanPrintf in favor of Printf from sanitizer_common
...
llvm-svn: 162746
2012-08-28 11:34:40 +00:00
Alexey Samsonov
e1cb524226
[Sanitizer] Renaming: SNPrintf -> internal_snprintf (and move it to sanitizer libc)
...
llvm-svn: 158710
2012-06-19 09:21:57 +00:00
Alexey Samsonov
40d5b772e5
[Sanitizer] Switch to common mmap/munmap routines in ASan run-time.
...
llvm-svn: 158078
2012-06-06 16:15:07 +00:00
Alexey Samsonov
51ae983718
[Sanitizer]: Introduce a common internal printf function. For now, also use tool-specific wrappers TsanPrintf (its output is controlled by TSan flags) and AsanPrintf (which copies its results to the ASan-private buffer). Supported formats: %[z]{d,u,x}, %s, %p. Re-write all format strings in TSan according to this format (this should have no effect on 64-bit platforms).
...
llvm-svn: 158065
2012-06-06 13:11:29 +00:00