Dmitry Vyukov
8a3934f85b
sanitizer_common: fix function w/o return
...
When SANITIZER_USES_CANONICAL_LINUX_SYSCALLS the function misses return statement.
llvm-svn: 222532
2014-11-21 13:55:19 +00:00
Alexey Samsonov
4925fd4b05
Fix -Wcast-qual warnings in sanitizers
...
llvm-svn: 221936
2014-11-13 22:40: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
Evgeniy Stepanov
bc496dab07
[asan] Delay system log initialization on Android.
...
Writing to system log requires libc interceptors to be initialized.
Fixes crashes with verbosity=1 on newer Android builds.
llvm-svn: 217764
2014-09-15 11:37:40 +00:00
Viktor Kutuzov
d0907ae222
Fix getting environment variables for sanitizers needs on FreeBSD
...
Differential Revision: http://reviews.llvm.org/D4229
llvm-svn: 212690
2014-07-10 08:53:29 +00:00
Dmitry Vyukov
f9c22916d5
tsan: fix freebsd build
...
freebsd does not have /proc/self/environ
llvm-svn: 211417
2014-06-20 22:49:41 +00:00
Dmitry Vyukov
3fc095e031
tsan: remove unused header include
...
llvm-svn: 211385
2014-06-20 18:28:34 +00:00
Viktor Kutuzov
9cd9b4ce0c
Support getting executable's name for sanitizers needs on FreeBSD
...
llvm-svn: 209805
2014-05-29 12:12:42 +00:00
Alexey Samsonov
5bcd1d8a8f
[Sanitizer] Always prefer cached contents of /proc/self/exe if it's available
...
llvm-svn: 209773
2014-05-28 21:23:53 +00:00
Evgeniy Stepanov
567e516015
[asancov] Write coverage directly to a memory-mapped file.
...
This way does not require a __sanitizer_cov_dump() call. That's
important on Android, where apps can be killed at arbitrary time.
We write raw PCs to disk instead of module offsets; we also write
memory layout to a separate file. This increases dump size by the
factor of 2 on 64-bit systems.
llvm-svn: 209653
2014-05-27 12:37:52 +00:00
Greg Fitzgerald
7b15cf8884
On AArch64, use clone() instead of fork()
...
Patch by Gideon Billings.
Differential Revision: http://reviews.llvm.org/D3903
llvm-svn: 209641
2014-05-26 23:44:55 +00:00
Kostya Serebryany
b9aa538db1
[sanitizer] fix linux_dirent for SANITIZER_X32; based on patch by H.J. Lu
...
llvm-svn: 209281
2014-05-21 08:21:13 +00:00
Kostya Serebryany
84019ff7e5
Cast pointers to uptr when calling internal_syscall
...
For Linux/x86-64, pointers passed to internal_syscall should be casted
to uptr first. Otherwise, they won't be properly extended to 64-bit for
x32.
Patch by H.J. Lu
llvm-svn: 209278
2014-05-21 07:49:03 +00:00
Sergey Matveev
6d8b9a747c
[sanitizer] Fix go build following r209121.
...
llvm-svn: 209136
2014-05-19 16:08:53 +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
Alexander Potapenko
291b827890
[libsanitizer] Fix the return type of internal_fork
...
llvm-svn: 208714
2014-05-13 17:31:09 +00:00
Alexander Potapenko
4a6cac4382
[libsanitizer] Use internal_fork() to spawn the symbolizer process.
...
This should fix https://code.google.com/p/thread-sanitizer/issues/detail?id=61
llvm-svn: 208707
2014-05-13 16:17:54 +00:00
Alexey Samsonov
18adbc361a
Remove sanitizer_linux_libcdep.cc from TSan-Go build
...
llvm-svn: 203238
2014-03-07 13:17:32 +00:00
Alexey Samsonov
78a6d2073f
[FreeBSD] Port sanitizers' syscalls.
...
Patch by Viktor Kutuzov!
llvm-svn: 203227
2014-03-07 10:03:54 +00:00
Evgeniy Stepanov
f4dcf77623
[asan] Fix printing of long reports to logcat on Android.
...
__android_log_write has an implicit message length limit.
Print one line at a time.
llvm-svn: 202250
2014-02-26 09:39:55 +00:00
Kostya Serebryany
c98ce28533
[sanitizer] AArch64 sanitizer support; patch by Christophe Lyon and Yvan Roux
...
llvm-svn: 201303
2014-02-13 07:50:20 +00:00
Evgeniy Stepanov
01cd8ae204
[asan] Read extra flags from a system property on activation on Android.
...
llvm-svn: 200550
2014-01-31 14:36:55 +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
e925e53114
Fix compilation: don't convert NULL to a pointer-incompatible type.
...
llvm-svn: 200536
2014-01-31 11:44:15 +00:00
Alexander Potapenko
d5802fe548
Make signal-related functions use __sanitizer_* structures instead of __sanitizer_kernel_* ones.
...
Also rename internal_sigaction() into internal_sigaction_norestorer(), as this function doesn't fully
implement the sigaction() functionality on Linux.
This change is a part of refactoring intended to have common signal handling behavior in all tools.
llvm-svn: 200535
2014-01-31 11:29:51 +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
Alexey Samsonov
2f392d237c
[Sanitizer] Move OS-specific code for MemoryMappingLayout into separate source files.
...
llvm-svn: 198003
2013-12-25 08:01:16 +00:00
Kostya Serebryany
82d0679e92
[asan] attempting to fix x32 build (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59018 )
...
llvm-svn: 194155
2013-11-06 17:47:39 +00:00
Peter Collingbourne
791e65dcfb
Overhaul the symbolizer interface.
...
This moves away from creating the symbolizer object and initializing the
external symbolizer as separate steps. Those steps now always take place
together.
Sanitizers with a legacy requirement to specify their own symbolizer path
should use InitSymbolizer to initialize the symbolizer with the desired
path, and GetSymbolizer to access the symbolizer. Sanitizers with no
such requirement (e.g. UBSan) can use GetOrInitSymbolizer with no need for
initialization.
The symbolizer interface has been made thread-safe (as far as I can
tell) by protecting its member functions with mutexes.
Finally, the symbolizer interface no longer relies on weak externals, the
introduction of which was probably a mistake on my part.
Differential Revision: http://llvm-reviews.chandlerc.com/D1985
llvm-svn: 193448
2013-10-25 23:03:29 +00:00
Peter Collingbourne
b745eec4e4
Use internal_memset to initialize this variable.
...
Otherwise, the compiler may use memset in non-optimized builds, which is
forbidden in the nolibc part of the runtime.
llvm-svn: 193098
2013-10-21 18:11:57 +00:00
Dmitry Vyukov
f54835f768
tsan: move kernel struct definition from sanitizer_linux.h to sanitizer_platform_limits_posix.h
...
llvm-svn: 192695
2013-10-15 12:57:59 +00:00
Dmitry Vyukov
59c850de6d
tsan: implement internal syscall-based versions of sigaction/sigprocmask
...
use them in stoptheworld
fixes applications that intercept sigaction/sigprocmask
llvm-svn: 192686
2013-10-15 11:31:51 +00:00
Sergey Matveev
398fb700a2
[sanitizer] Do not break the CFI unwind chain in clone().
...
Fixes build on clang 3.2, which doesn't support cfi_undefined. This change
doesn't seem to break the slow unwinder. Even if it does, the worst thing that
could happen is that we would not see a backtrace when a fatal error happens
under StopTheWorld.
llvm-svn: 192196
2013-10-08 16:38:39 +00:00
Nick Lewycky
885136d3b6
Check the function we just called for errors, not an incoming argument. Noticed
...
by inspection.
llvm-svn: 190828
2013-09-17 00:23:28 +00:00
Alexey Samsonov
4a2447fd81
[TSan] Use --whole-archive around TSan runtime in old TSan makefiles. Fix a Go build
...
llvm-svn: 190513
2013-09-11 11:06:06 +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
Alexander Potapenko
94377c337b
[libsanitizer] Remove an unused variable introduced in r189789
...
llvm-svn: 189790
2013-09-03 11:30:07 +00:00
Alexander Potapenko
7e1c51988d
[TSan] Move the /proc/self/maps parsing logic to sanitizer_common
...
Provide a generic way for the tools to generate memory profiles from contents of /proc/self/maps
llvm-svn: 189789
2013-09-03 11:09:16 +00:00
Sergey Matveev
69931c5841
[sanitizer_common] Add internal_clone().
...
Add a wrapper for the clone syscall for use in StopTheWorld. We
implement it only for x86_64, so stop building StopTheWorld for other platforms
(no one uses it outside x86_64 anyway).
See https://code.google.com/p/address-sanitizer/issues/detail?id=214 for why we
can't use the glibc clone() wrapper.
llvm-svn: 189753
2013-09-02 11:36:19 +00:00
Peter Collingbourne
de8e3a097c
Conditionalise inclusion of link.h on !SANITIZER_ANDROID.
...
Hopefully fixes the Android build.
Differential Revision: http://llvm-reviews.chandlerc.com/D1551
llvm-svn: 189696
2013-08-30 20:50:12 +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
Evgeniy Stepanov
573ba3499e
[sanitizer] Disable ForEachMappedRegion on Android.
...
It needs interface that is missing from the NDK, and it is not used on Android anyway.
llvm-svn: 187407
2013-07-30 08:39:16 +00:00
Peter Collingbourne
e572e17a8e
Fix warning.
...
llvm-svn: 187373
2013-07-29 20:13:41 +00:00
Peter Collingbourne
9058c07c95
Move UnpoisonMappedDSO to sanitizer_common.
...
This is so DFSan will be able to use it.
Differential Revision: http://llvm-reviews.chandlerc.com/D1206
llvm-svn: 187372
2013-07-29 19:09:49 +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
Kostya Serebryany
3a7c6d689d
[asan] workaround for the quemu bug in proc maps ( http://code.google.com/p/address-sanitizer/issues/detail?id=160 )
...
llvm-svn: 182922
2013-05-30 11:00:08 +00:00
Peter Collingbourne
112e5ba281
[nolibc] Unweak SymbolizerPrepareForSandboxing and move it to libc-independent part.
...
Fixes the Go build.
Differential Revision: http://llvm-reviews.chandlerc.com/D877
llvm-svn: 182851
2013-05-29 12:11:43 +00:00
Peter Collingbourne
fb1a9f17e3
[nolibc] Make SymbolizerPrepareForSandboxing weak and optional.
...
Differential Revision: http://llvm-reviews.chandlerc.com/D872
llvm-svn: 182765
2013-05-28 11:05:05 +00:00
Alexander Potapenko
6535f510a3
[ASan] Introduce SymbolizerPrepareForSandboxing(), which is a no-op on every platform except Linux (because we don't support sandboxing anywhere else yet)
...
On Linux we pre-cache the value of readlink("/proc/self/exe"), so that it can be later used when the sandbox has been turned on.
llvm-svn: 182579
2013-05-23 11:53:36 +00:00