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
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
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
Alexander Potapenko
f8109dd0f8
[libsanitizer] Unmapping the old cache partially invalidates the memory layout, so add
...
a flag to skip cache update for cases when that's unacceptable (e.g. lsan).
Patch by Sergey Matveev (earthdok@google.com )
llvm-svn: 178000
2013-03-26 10:34:37 +00:00
Dmitry Vyukov
0954e9c01d
tsan: call fflush(0) on exit again
...
llvm-svn: 177522
2013-03-20 14:01:10 +00:00
Dmitry Vyukov
b62c158d81
tsan: special handling of .rodata (don't try to find races, don't keep shadow, dont' put into traces)
...
llvm-svn: 177517
2013-03-20 13:21:50 +00:00
Evgeniy Stepanov
95eaa21637
[sanitizer] More renamed macros.
...
llvm-svn: 177401
2013-03-19 14:54:17 +00:00
Evgeniy Stepanov
0af672326a
[sanitizer] Replace more platform checks with SANITIZER_ constants.
...
llvm-svn: 177400
2013-03-19 14:33:38 +00:00
Dmitry Vyukov
f123337275
tsan: better memory profiler
...
llvm-svn: 177286
2013-03-18 13:55:33 +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
06d3aa4884
[Sanitizer] Change MemoryMappingLayout methods to also report memory protection flags (for future use in leak checker). Patch by Sergey Matveev.
...
llvm-svn: 176931
2013-03-13 06:51:02 +00:00
Kostya Serebryany
3e62fe8c23
[tsan] use our own GetEnv instead of libc's getenv
...
llvm-svn: 175498
2013-02-19 08:19:13 +00:00
Dmitry Vyukov
effd98b0f4
tsan: intercept libc __res_iclose
...
this is required to catch close of file descriptors created in getaddrinfo()
llvm-svn: 174624
2013-02-07 15:27:45 +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
Dmitry Vyukov
f6d8021520
tsan: remove static reference to glibc internal _dl_get_tls_static_info()
...
(this breaks RPM packages)
llvm-svn: 171033
2012-12-24 13:43:53 +00:00
Dmitry Vyukov
11bb06039a
tsan: fix lint warnings
...
llvm-svn: 170877
2012-12-21 10:47:48 +00:00
Dmitry Vyukov
1859251df8
tsan: disable checks for limited address space and unlimited stack for Go
...
llvm-svn: 170876
2012-12-21 10:45:01 +00:00
Dmitry Vyukov
3e7ede230f
tsan: support MapThreadTrace() on all platforms
...
llvm-svn: 170113
2012-12-13 08:14:02 +00:00
Dmitry Vyukov
e1a7f338a3
tsan: dynamic history size
...
introduces history_size parameter that can be used to control trace size at startup
llvm-svn: 168786
2012-11-28 12:19:50 +00:00
Dmitry Vyukov
2429b02770
tsan: move traces from tls into dedicated storage at fixed address
...
helps to reduce tls size (it's weird to have multi-MB tls)
will help with dynamically adjustable trace size
llvm-svn: 168783
2012-11-28 10:35:31 +00:00
Dmitry Vyukov
9952b674ca
tsan: use GORACE env for options for Go
...
llvm-svn: 167575
2012-11-08 11:32:40 +00:00
Dmitry Vyukov
c015712992
tsan: lazily allocate shadow for Go
...
llvm-svn: 167464
2012-11-06 16:00:16 +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
Evgeniy Stepanov
f7f616ba66
Quick fix data/bss detection in TSan.
...
The old way breaks when a module's bss is adjacent to the [heap] vm area.
Both ways are not very reliable, though.
llvm-svn: 164772
2012-09-27 13:20:40 +00:00
Dmitry Vyukov
c7bcaf8512
tsan: fix Go build
...
llvm-svn: 164198
2012-09-19 04:39:36 +00:00
Alexey Samsonov
ff3f173e87
[TSan] If we detect an unlimited stack, try to re-exec with limited stack
...
llvm-svn: 164021
2012-09-17 09:14:11 +00:00
Alexey Samsonov
046248c509
[TSan] fix a bunch of warnings reported by pedantic gcc
...
llvm-svn: 163788
2012-09-13 11:54:41 +00:00
Alexey Samsonov
5c6b93bc33
[Sanitizer] Get rid of dependency between sanitizer_common and asan/tsan runtimes: implement tool-specific Die and CheckFailed functions via callbacks
...
llvm-svn: 163603
2012-09-11 09:44:48 +00:00
Dmitry Vyukov
7ea4c2ccfb
tsan: ignore destruction of global mutexes (causes a lot of non-interesting reports)
...
llvm-svn: 163400
2012-09-07 18:08:02 +00:00
Alexey Samsonov
cc62211fbf
[Sanitizer] Rename ProcessMaps to MemoryMappingLayout and fix Windows build by providing stub implementation
...
llvm-svn: 162671
2012-08-27 13:48:48 +00:00
Dmitry Vyukov
954fc8c3e4
tsan: switch to new allocator
...
llvm-svn: 161953
2012-08-15 15:35:15 +00:00
Dmitry Vyukov
5e5e36712b
tsan: fix build
...
llvm-svn: 160267
2012-07-16 13:25:47 +00:00
Dmitry Vyukov
03d32ecd4f
tsan: Go language support
...
llvm-svn: 159754
2012-07-05 16:18:28 +00:00
Alexey Samsonov
cf7d233ac0
[TSan] kill some linux-specific code in favor of code in common runtime: reuse wrappers for mmap routines, ProcessMaps iterator, thread stack calculation
...
llvm-svn: 158657
2012-06-18 09:42:39 +00:00
Alexey Samsonov
58a3c58ec9
[Sanitizer] move different wrappers from TSan to common sanitizer runtime
...
llvm-svn: 158655
2012-06-18 08:44:30 +00:00
Alexey Samsonov
3efd6fc26c
[Sanitizer] Use DEFINE_REAL macro in TSan runtime to call libc implementations of functions. Move strchr to sanitizer_libc.
...
llvm-svn: 158517
2012-06-15 12:24: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
Alexey Samsonov
ac4c290d02
[TSan] run some renaming as a preparation for factoring out Printf implementation.
...
llvm-svn: 158058
2012-06-06 10:13:27 +00:00
Alexey Samsonov
ee07290628
[Sanitizer] Move more functions/constants to sanitizer_common.
...
llvm-svn: 158056
2012-06-06 09:26:25 +00:00
Alexey Samsonov
ca2b5d7abb
[Sanitizer] move internal_filesize and internal_dup2 from TSan to sanitizer_common.
...
llvm-svn: 158052
2012-06-06 07:30:33 +00:00
Alexey Samsonov
bc3a7e3fe2
[Sanitizer] add sanitizer_common.h for routines shared between TSan and ASan runtimes. Use __sanitizer::Die() in TSan.
...
llvm-svn: 158050
2012-06-06 06:47:26 +00:00
Alexey Samsonov
8602c65719
[Sanitizer] remove using namespace __sanitizer lines
...
llvm-svn: 157999
2012-06-05 14:05:09 +00:00
Alexey Samsonov
ef2e2cfd33
[Sanitizer] Use common defines for ASan and TSan runtime. Split defines between interface defines (can be visible in user code that includes interface ASan/TSan headers) and internal defines.
...
llvm-svn: 157998
2012-06-05 13:50:57 +00:00
Alexey Samsonov
cc88531760
[TSan] Use internal_munmap from sanitizer_libc in TSan runtime.
...
llvm-svn: 157995
2012-06-05 09:55:24 +00:00
Alexey Samsonov
b8f35d9512
[TSan] make TSan runtime use internal_{close,read,write} from sanitizer_libc
...
llvm-svn: 157992
2012-06-05 09:00:36 +00:00
Alexey Samsonov
298dd7c361
[TSan] use __sanitizer::internal_open in TSan run-time
...
llvm-svn: 157988
2012-06-05 07:46:31 +00:00
Alexey Samsonov
11fff6df33
[TSan] use __sanitizer::internal_mmap in TSan run-time
...
llvm-svn: 157984
2012-06-05 06:19:00 +00:00
Alexey Samsonov
3b2f9f4c98
Remove file-type tags in .cc files in tsan/ and sanitizer_common/
...
llvm-svn: 157928
2012-06-04 13:55:19 +00:00
Dmitry Vyukov
d558530754
tsan: increase /proc/self/maps max size (1M is far not enough)
...
llvm-svn: 157570
2012-05-28 09:24:01 +00:00