Peter Collingbourne
0c8df4e1d8
[nolibc] Move libc-dependent sanitizer_linux.cc code to sanitizer_linux_libcdep.cc.
...
llvm-svn: 182292
2013-05-20 15:57:44 +00:00
Peter Collingbourne
d5169edc36
[nolibc] Make GetArgsAndEnv libc-independent.
...
__libc_stack_end is made into a weak symbol if possible. If libc is
not linked, read args and environment from /proc.
llvm-svn: 182276
2013-05-20 14:25:32 +00:00
Sergey Matveev
af05543c86
[sanitizer] LibraryNameIs in sanitizer_linux
...
llvm-svn: 181787
2013-05-14 13:24:46 +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
3704453368
[sanitizer] Fixed InitTlsSize for Android.
...
llvm-svn: 181330
2013-05-07 16:29:26 +00:00
Sergey Matveev
88d0c664ef
[sanitizer] Fixed includes in sanitizer_linux.cc for Android.
...
llvm-svn: 181327
2013-05-07 15:38:53 +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
Evgeniy Stepanov
517118e6b4
[sanitizer] Sanitizer __internal_*stat interface.
...
With this change, __internal_*stat always expect a "struct stat *" argument.
This avoids stat/stat64 caller-side confusion (sanitizer_common tests already
made this mistake), and allows the use of __internal_fstat() as a drop-in
replacement for libc's fstat().
llvm-svn: 181311
2013-05-07 12:47:04 +00:00
Sergey Matveev
b2151b8200
Revert r180599 "[sanitizer] Clear LD_PRELOAD when forking an external symbolizer."
...
llvm-svn: 180602
2013-04-26 13:01:40 +00:00
Sergey Matveev
3c8fbe1013
[sanitizer] Clear LD_PRELOAD when forking an external symbolizer.
...
llvm-svn: 180599
2013-04-26 11:35:05 +00:00
Alexey Samsonov
f36c5a8431
Revert r180082 and add a test for SetEnv function
...
llvm-svn: 180098
2013-04-23 12:49:12 +00:00
Alexey Samsonov
e7540e3561
[Sanitizer] Delete unused function
...
llvm-svn: 180082
2013-04-23 08:18:09 +00:00
Alexey Samsonov
46b8665ea4
Remove InternalAlloc/InternalFree calls from StopTheWorld. Patch by Sergey Matveev.
...
llvm-svn: 178855
2013-04-05 07:41:21 +00:00
Alexey Samsonov
a0e28a7aaa
[Sanitizer] Kill the remainders of platform defines in favor of SANITIZER_ defines
...
llvm-svn: 178627
2013-04-03 07:24:35 +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
510ad11800
tsan: add SetEnv() function that can be used in frontends
...
llvm-svn: 177857
2013-03-25 09:56:45 +00:00
Dmitry Vyukov
78693730a4
tsan: use a single background thread for memory profiler and memory flush (and later for symbolizer flush)
...
llvm-svn: 177627
2013-03-21 06:24:31 +00:00
Dmitry Vyukov
b6eace8a2f
tsan: add internal_unlink() function
...
llvm-svn: 177510
2013-03-20 10:28:36 +00:00
Evgeniy Stepanov
0af672326a
[sanitizer] Replace more platform checks with SANITIZER_ constants.
...
llvm-svn: 177400
2013-03-19 14:33:38 +00:00
Evgeniy Stepanov
6d02c1c598
[sanitizer] Avoid use of uintptr_t.
...
llvm-svn: 177384
2013-03-19 09:39:15 +00:00
Evgeniy Stepanov
b4a218db34
[sanitizer] Don't adjust the size of the user-allocated stack.
...
Moved this code to sanitizer_common.
llvm-svn: 177383
2013-03-19 09:30:52 +00:00
Alexey Samsonov
a097f7b1e3
[Sanitizer] Add default constructor for BlockingMutex
...
llvm-svn: 177072
2013-03-14 13:30:56 +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
d38aceda4e
[Sanitizer] Fix a typo in function name
...
llvm-svn: 176932
2013-03-13 06:55:02 +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
Alexey Samsonov
db7d9656bb
[Sanitizer] Implement BlockingMutex::CheckLocked()
...
llvm-svn: 176805
2013-03-11 15:45:20 +00:00
Alexey Samsonov
49b86b354a
[Sanitizer] don't include missing header on Android
...
llvm-svn: 176183
2013-02-27 13:03:35 +00:00
Kostya Serebryany
f0b8f989e9
add Linux syscall wrappers and ThreadLister to sanitizer_common
...
ThreadLister is a Linux-specific class for obtaining the thread IDs of a process from procfs (/proc/<pid>/task/). It will be used by leak checking code.
Also add several syscall wrappers which will be required by the same code that uses ThreadLister, but are not used in ThreadLister itself.
Patch by Sergey Matveev
llvm-svn: 176179
2013-02-27 11:22:40 +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
Evgeniy Stepanov
adaca58526
[msan] Fix ReExec on linux.
...
execle(argv[0], ...) is wrong, because argv[0] may contain a PATH-resolvable
program name. Execute /proc/self/exe instead.
llvm-svn: 175504
2013-02-19 11:09:29 +00:00
Evgeniy Stepanov
2a25bfe06a
[sanitizer] Get full argv and envp on glibc.
...
/proc/$PID/cmdline is clipped to 4Kb.
Locate argv and envp on the main thread stack.
llvm-svn: 175163
2013-02-14 14:40:03 +00:00
Evgeniy Stepanov
763b2981b4
[sanitizer] Raise argv limit for ReExec.
...
We are still limited by /proc/*/cmdline size (4Kb max on Linux!).
llvm-svn: 175145
2013-02-14 08:22:06 +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
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
00e0236665
asan/tsan: manually define FUTEX constants, because <linux/futes.h> header is broken on some linux distributions
...
llvm-svn: 173933
2013-01-30 14:39:27 +00:00
Peter Collingbourne
6600516a58
Have ReExec read environment from /proc/self/environ
...
It is possible for ReExec to be called before the C standard library
has initialised itself sufficiently for execv to work properly.
Fix this by parsing the environment ourselves and using execve.
Differential Revision: http://llvm-reviews.chandlerc.com/D304
llvm-svn: 172748
2013-01-17 19:50:42 +00:00
Kostya Serebryany
c4bb752e3b
[sanitizer] hide PR_SET_NAME under an ifdef (for older kernels)
...
llvm-svn: 172523
2013-01-15 09:03:23 +00:00
Dmitry Vyukov
064c739cea
asan: fix Android build
...
llvm-svn: 172389
2013-01-14 08:48:26 +00:00
Dmitry Vyukov
8d15db4a1e
tsan: fix cmake warning (unused private field)
...
llvm-svn: 172387
2013-01-14 08:21:34 +00:00
Dmitry Vyukov
af4b0b084a
asan: fix compilation errors in mutex
...
llvm-svn: 172385
2013-01-14 08:01:58 +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
Kostya Serebryany
864ef315c0
[asan] make the slow unwinder a bit more robust. The unittests pass with fast_unwind_on_fatal=0, but I still observe some differences between the two unwinders
...
llvm-svn: 171973
2013-01-09 13:55:00 +00:00
Dmitry Vyukov
5b375d84c0
tsan: fix build
...
llvm-svn: 170191
2012-12-14 12:24:11 +00:00
Kostya Serebryany
bb69879d09
[asan] pop the internal stack frames in SlowUnwindStack, extend the test to check this
...
llvm-svn: 170124
2012-12-13 12:31:55 +00:00
Kostya Serebryany
baf583c443
[asan] add two asan flags: fast_unwind_on_fatal and fast_unwind_on_malloc to allow using the slow CFI-based unwinder
...
llvm-svn: 170117
2012-12-13 09:34:23 +00:00
Alexander Potapenko
1746f555ee
Add a libsanitizer API __sanitizer_sandbox_on_notify(void* reserved), which should be used by
...
the client programs to notify the tools that sandboxing is about to be turned on.
llvm-svn: 169732
2012-12-10 13:10:40 +00:00
Dmitry Vyukov
3a2046b3a6
tsan: fix lint warnings
...
llvm-svn: 169606
2012-12-07 16:20:06 +00:00
Kostya Serebryany
35f9e5e87b
[sanitizer] implement SanitizerSetThreadName/SanitizerGetThreadName. Just for linux so far (using prctl(PR_GET_NAME))
...
llvm-svn: 169598
2012-12-07 11:27:24 +00:00
Dmitry Vyukov
dd95cd148b
tsan: fix lint warnings
...
llvm-svn: 169369
2012-12-05 10:16:02 +00:00