Commit Graph

610 Commits

Author SHA1 Message Date
Viktor Kutuzov 0181812bf6 [Msan] Fix strlen() and strnlen() interceptors to work on FreeBSD
Differential Revision: http://reviews.llvm.org/D6928

llvm-svn: 225986
2015-01-14 14:59:46 +00:00
Viktor Kutuzov b4b05017cf [Msan] Fix use of mmap(MAP_ANONYMOUS) in the unit tests on FreeBSD
Differential Revision: http://reviews.llvm.org/D6929

llvm-svn: 225688
2015-01-12 20:18:38 +00:00
Viktor Kutuzov 6aba5098fd [Msan] Fix tests reading /proc files on FreeBSD
Differential Revision: http://reviews.llvm.org/D6926

llvm-svn: 225686
2015-01-12 20:15:33 +00:00
Alexey Samsonov 03499e920b [Sanitizer] Change the runtime flag representation.
This mirrors r225239 to all the rest sanitizers:
ASan, DFSan, LSan, MSan, TSan, UBSan.

Now the runtime flag type, name, default value and
description is located in the single place in the
.inc file.

llvm-svn: 225327
2015-01-07 00:38:00 +00:00
Alexey Samsonov 6239ebc1c2 [Sanitizer] Improve unit tests in COMPILER_RT_DEBUG=ON mode.
Propagate -DSANITIZER_DEBUG definition to unit tests.
Make sure unit tests depend on compiler-rt headers.

llvm-svn: 225298
2015-01-06 20:58:40 +00:00
Alexey Samsonov c426c337ed Revert "Revert r224736: "[Sanitizer] Make CommonFlags immutable after initialization.""
Fix test failures by introducing CommonFlags::CopyFrom() to make sure
compiler doesn't insert memcpy() calls into runtime code.

Original commit message:
Protect CommonFlags singleton by adding const qualifier to
common_flags() accessor. The only ways to modify the flags are
SetCommonFlagsDefaults(), ParseCommonFlagsFromString() and
OverrideCommonFlags() functions, which are only supposed to be
called during initialization.

llvm-svn: 225088
2015-01-02 21:28:37 +00:00
Chandler Carruth 6173e869eb Revert r224736: "[Sanitizer] Make CommonFlags immutable after initialization."
We've got some internal users that either aren't compatible with this or
have found a bug with it. Either way, this is an isolated cleanup and so
I'm reverting it to un-block folks while we investigate. Alexey and
I will be working on fixing everything up so this can be re-committed
soon. Sorry for the noise and any inconvenience.

llvm-svn: 225079
2015-01-02 09:59:38 +00:00
Evgeniy Stepanov 05dc4be0dc [asan] Allow enabling coverage at activation.
This is a re-commit of r224838 + r224839, previously reverted in r224850.
Test failures were likely (still can not reproduce) caused by two lit tests
using the same name for an intermediate build target.

llvm-svn: 224853
2014-12-26 12:32:32 +00:00
Evgeniy Stepanov f8c7e25560 Revert r224838, r224839.
Flaky failures on the build bots.

llvm-svn: 224850
2014-12-26 10:19:56 +00:00
Evgeniy Stepanov be9a53fec6 [asan] Allow enabling coverage at activation.
llvm-svn: 224838
2014-12-25 14:26:45 +00:00
Alexey Samsonov b430f6e17a [Sanitizer] Make CommonFlags immutable after initialization.
Summary:
Protect CommonFlags singleton by adding const qualifier to
common_flags() accessor. The only ways to modify the flags are
SetCommonFlagsDefaults(), ParseCommonFlagsFromString() and
OverrideCommonFlags() functions, which are only supposed to be
called during initialization.

Test Plan: regression test suite

Reviewers: kcc, eugenis, glider

Subscribers: llvm-commits

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

llvm-svn: 224736
2014-12-22 21:46:10 +00:00
Viktor Kutuzov 54c7590073 [Msan] Fix msan_test.cc inclusions to build the unit tests on FreeBSD
Differential Revision: http://reviews.llvm.org/D6757

llvm-svn: 224724
2014-12-22 19:14:23 +00:00
Viktor Kutuzov 2a5b81dd7f [Msan] Fix uname() interception on FreeBSD
Differential Revision: http://reviews.llvm.org/D6738

llvm-svn: 224708
2014-12-22 14:42:24 +00:00
Alexey Samsonov 2f8c8d59b2 [Sanitizer] Refactor CommonFlags interface. NFC.
Add CommonFlags::SetDefaults() and CommonFlags::ParseFromString(),
so that this object can be easily tested. Enforce
that ParseCommonFlagsFromString() and SetCommonFlagsDefaults()
work only with singleton CommonFlags, shared across all sanitizer
runtimes.

llvm-svn: 224617
2014-12-19 21:40:04 +00:00
Evgeniy Stepanov 372deb091e [msan] Stop calling pthread_getspecific in signal handlers.
pthread_getspecific is not async-signal-safe.

MsanThread pointer is now stored in a TLS variable, and the TSD slot
is used only for its destructor, and never from a signal handler.

This should fix intermittent CHECK failures in MsanTSDSet.

llvm-svn: 224423
2014-12-17 10:30:06 +00:00
Alexey Samsonov 6334f46db8 [Sanitizer] Introduce Allocator::may_return_null bool flag.
Summary:
Turn "allocator_may_return_null" common flag into an
Allocator::may_return_null bool flag. We want to make sure
that common flags are immutable after initialization. There
are cases when we want to change this flag in the allocator
at runtime: e.g. in unit tests and during ASan activation
on Android.

Test Plan: regression test suite, real-life applications

Reviewers: kcc, eugenis

Subscribers: llvm-commits

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

llvm-svn: 224148
2014-12-12 20:07:35 +00:00
Evgeniy Stepanov 3a9be641d5 [msan] Intercept wcsto*.
Intercept wcstod, wcstof, wcstold, wcstol, wcstoul, wcstoll, wcstoull.

llvm-svn: 223650
2014-12-08 10:41:28 +00:00
Kostya Serebryany 29a2236c7d [msan] allow -fsanitize-coverage=N together with -fsanitize=memory, compiler-rt part
llvm-svn: 223314
2014-12-03 23:29:14 +00:00
Evgeniy Stepanov 7395cae005 [msan] Change the way origin ids are built.
Previously, all origin ids were "chained" origins, i.e values of
ChainedOriginDepot. This added a level of indirection for simple
stack and heap allocation, which were represented as chains of
length 1. This costs both RAM and CPU, but provides a joined 2**29
origin id space. It also made function (any instrumented function)
entry non-async-signal-safe, but that does not really matter because
memory stores in track-origins=2 mode are not async-signal-safe anyway.

With this change, the type of the origin is encoded in origin id.
See comment in msan_origin.h for more details. This reduces chained and stack
origin id range to 2**28 each, but leaves extra 2**31 for heap origins.

This change should not have any user-visible effects.

llvm-svn: 223233
2014-12-03 13:58:40 +00:00
Evgeniy Stepanov 340347a83f [msan] Re-enable one test.
It has been fixed a long time ago.

llvm-svn: 223226
2014-12-03 12:11:33 +00:00
Viktor Kutuzov 30bd345613 [Msan] Generalize mapping facilities to add FreeBSD support
Differential Revision: http://reviews.llvm.org/D6387

llvm-svn: 222919
2014-11-28 11:42:55 +00:00
Viktor Kutuzov d977985e43 [Msan] Fix some interceptors to pass initialization on FreeBSD
Differential Revision: http://reviews.llvm.org/D6417

llvm-svn: 222885
2014-11-27 14:28:57 +00:00
Viktor Kutuzov 38ec0481d2 [Msan] Exclude non-FreeBSD interceptors on FreeBSD
Differential Revision: http://reviews.llvm.org/D6404

llvm-svn: 222822
2014-11-26 10:51:49 +00:00
Viktor Kutuzov 3e4542eac4 [Msan] Check returning value of DTLS_Get()
Differential Revision: http://reviews.llvm.org/D6403

llvm-svn: 222818
2014-11-26 10:42:02 +00:00
Evgeniy Stepanov 089c066bd6 [msan] Remove leftover MSanDR bits in tests.
llvm-svn: 222762
2014-11-25 15:00:23 +00:00
Eric Fiselier 909deebfc8 [compiler-rt] Make the MSAN wmemset intercepter call wmemset instead of memset. Fixes PR 21579
Summary:
Exactly what the title says. I've tested this change against the libc++ test failures and it solves all of them. The check-msan rule also still passes.
I'm not sure why it called memset originally. 

I can add tests if requested but currently there are no tests involving wide chars and they are a c++11 features.

Reviewers: kcc, eugenis

Reviewed By: eugenis

Subscribers: llvm-commits

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

llvm-svn: 222673
2014-11-24 18:17:04 +00:00
Alexey Samsonov de13018874 [MSan] [MIPS] Adding support for MIPS64 (patch by Mohit Bhakkad).
Reviewed at http://reviews.llvm.org/D5906

llvm-svn: 222388
2014-11-19 21:42:33 +00:00
Evgeniy Stepanov 7555f5ed1f [msan] Remove MSanDR and supporting code.
MSanDR is a dynamic instrumentation tool that can instrument the code
(prebuilt libraries and such) that could not be instrumented at compile time.

This code is unused (to the best of our knowledge) and unmaintained, and
starting to bit-rot.

llvm-svn: 222232
2014-11-18 10:33:15 +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
Richard Trieu b6b141d601 delete => delete[] for arrays.
llvm-svn: 221769
2014-11-12 04:19:57 +00:00
Alexey Samsonov e853b4f2e4 [Sanitizer] Return code that calculates hash for stacktrace back to StackDepot implementation
llvm-svn: 220663
2014-10-27 03:10:27 +00:00
Alexey Samsonov 3741ab82ba Change StackDepot interface to use StackTrace more extensively
llvm-svn: 220637
2014-10-26 06:23:07 +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
Evgeniy Stepanov 35eb265421 [msan] Handle param-tls overflow.
ParamTLS (shadow for function arguments) is of limited size. This change
makes all arguments that do not fit unpoisoned, and avoids writing
past the end of a TLS buffer.

llvm-svn: 220351
2014-10-22 00:12:40 +00:00
Kuba Brecka 14c0c5901d [compiler-rt] compiler-rt's CMake append_if function clashes with LLVM's, let's rename it to append_list_if
Doing s/append_if/append_list_if/, no functional change.

http://reviews.llvm.org/D5739

llvm-svn: 219860
2014-10-15 22:47:54 +00:00
Evgeniy Stepanov bb91e02efd [msan] Make origin tracking fork-safe.
Chained origins make plain memory stores async-signal-unsafe.
We already disable it inside signal handlers.
This change grabs all origin-related locks before fork() and releases
them after fork() to avoid a deadlock in the child process.

llvm-svn: 217140
2014-09-04 10:36:14 +00:00
Evgeniy Stepanov f1741f52ad [msan] Fix origin_history_per_stack_limit=0 behavior.
It disables the per-stack limit.

llvm-svn: 217030
2014-09-03 12:15:59 +00:00
Kostya Serebryany 74bd6bc9f9 [sanitizer] move mlock interceptor from asan/tsan/msan to common; no functionality change intended
llvm-svn: 216407
2014-08-25 20:57:59 +00:00
Alexey Samsonov 5a32f79af3 [MSan] Disable coredump for 64-bit binaries.
llvm-svn: 215482
2014-08-12 22:37:47 +00:00
Alexey Samsonov b9ec65cd4d [Sanitizer] Kill deprecated allocator interfaces in ASan, MSan and TSan in favor of
a unified interface in <sanitizer/allocator_interface.h>.

llvm-svn: 215469
2014-08-12 20:28:20 +00:00
Evgeniy Stepanov 37e069c2ac [msan] Fix fcvt interceptor.
fcvt() result can be heap-allocated and must be unpoisoned.

llvm-svn: 215106
2014-08-07 12:45:55 +00:00
Alexey Samsonov 1440105338 [Sanitizer] Simplify Symbolizer creation interface.
Get rid of Symbolizer::Init(path_to_external) in favor of
thread-safe Symbolizer::GetOrInit(), and use the latter version
everywhere. Implicitly depend on the value of external_symbolizer_path
runtime flag instead of passing it around manually.

No functionality change.

llvm-svn: 214005
2014-07-26 01:37:23 +00:00
Alexey Samsonov d6906e4ffe [MSan] Fix strncpy interceptor
llvm-svn: 213590
2014-07-22 00:10:08 +00:00
Evgeniy Stepanov 465466e80c [msan] Stop demangling function name in the stack origin report.
This was done by calling __cxa_demangle directly, which is bad
when c++abi library is instrumented. The following line always
contains the demangled name (when running with a symbolizer) anyway.

llvm-svn: 212929
2014-07-14 09:35:27 +00:00
Evgeniy Stepanov 9c62621c4b [msan] A comment for the chained-origin-depot hash function.
llvm-svn: 212801
2014-07-11 09:09:37 +00:00
Evgeniy Stepanov db298121e0 [msan] Use real memset/memcpy/memmove in interceptors.
Our versions are not exactly as fast as libc's, and
MSan uses them heavily (even compared to other sanitizers).

This will break if libc version of mem* are instrumented,
but they never are, and if they are, we should be able
to fix it on libc side.

llvm-svn: 212799
2014-07-11 08:57:57 +00:00
Evgeniy Stepanov 8fc7e1fb13 [msan] Fix performance issue in fast_memset.
Fast path was never triggered when called from __msan_poison.

llvm-svn: 212715
2014-07-10 12:45:56 +00:00
Evgeniy Stepanov c2c435f95d [msan] Switch chained origins hash to murmur2.
llvm-svn: 212704
2014-07-10 11:02:33 +00:00
Evgeniy Stepanov eb893a1fd6 [msan] Fix out of bounds access in origin copying.
llvm-svn: 212534
2014-07-08 14:15:23 +00:00
Alexey Samsonov 91bb8e0e3a Generalize sanitizer allocator public interface.
Introduce new public header <sanitizer/allocator_interface.h> and a set
of functions __sanitizer_get_ownership(), __sanitizer_malloc_hook() etc.
that will eventually replace their tool-specific equivalents
(__asan_get_ownership(), __msan_get_ownership() etc.). Tool-specific
functions are now deprecated and implemented as stubs redirecting
to __sanitizer_ versions (which are implemented differently in each tool).

Replace all uses of __xsan_ versions with __sanitizer_ versions in unit
and lit tests.

llvm-svn: 212469
2014-07-07 17:39:31 +00:00
Evgeniy Stepanov f0831ee8d2 [msan] Increase hash table size for chained origins.
llvm-svn: 212448
2014-07-07 10:45:15 +00:00
Evgeniy Stepanov 037f77092e [msan] Better hash function for chained origins.
llvm-svn: 212440
2014-07-07 08:31:55 +00:00
Evgeniy Stepanov 50498e114f [msan] Reformat one source file.
llvm-svn: 212329
2014-07-04 10:07:39 +00:00
Kostya Serebryany 7c163a44aa [sanitizer] support c11 aligned_alloc, Linux only for now
llvm-svn: 212322
2014-07-04 07:30:34 +00:00
Alexey Samsonov e3a401a12b [MSan] Fixup r212082: enable tests for _mm_ intrinsics if and only if the
unit test source file is compiled with Clang.

llvm-svn: 212121
2014-07-01 19:58:41 +00:00
Alexey Samsonov c0fda339e2 Add the way to disable MSan unit tests for _mm_* intrinsics
llvm-svn: 212082
2014-07-01 01:38:52 +00:00
Evgeniy Stepanov 4e2d5edb0c [msan] Limit stack origin chain length.
Stack origins were created with unlimited length by mistake.

llvm-svn: 212036
2014-06-30 11:22:42 +00:00
Evgeniy Stepanov c935ca8c3c [msan] Add store_context_size= flag.
A new flag to control stack trace size for store event (in
track-origins=2 mode) independently of malloc_context_size.

llvm-svn: 211896
2014-06-27 12:48:01 +00:00
Evgeniy Stepanov 7d3c68a9cf [msan] Fix truncated stack trace in chained origin reports.
This is a leftover from the times when the next (chained) origin id
was stored as the last frame of a stack trace.

llvm-svn: 211878
2014-06-27 07:32:08 +00:00
Evgeniy Stepanov b163f0276f [msan] Fix bad interaction between with-calls mode and chained origin tracking.
Origin history should only be recorded for uninitialized values, because it is
meaningless otherwise. This change moves __msan_chain_origin to the runtime
library side and makes it conditional on the corresponding shadow value.

Previous code was correct, but _very_ inefficient.

llvm-svn: 211700
2014-06-25 14:41:57 +00:00
Evgeniy Stepanov 7ad0bde843 [msan] Fix false positive on dynamic tls.
Use existing DTLS code in sanitizer_tls_get_addr.{h,cc} to unpoison DTLS
blocks both on allocation and deallocation.

https://code.google.com/p/memory-sanitizer/issues/detail?id=44

llvm-svn: 211683
2014-06-25 11:30:35 +00:00
Evgeniy Stepanov 8717fec9af [msan] Fix origin copying.
Conditions for the first and the last origin value in range were wrong.

llvm-svn: 211585
2014-06-24 11:50:26 +00:00
Evgeniy Stepanov ad8065f01a [msan] Print stats even on successful run with atexit=1.
llvm-svn: 211574
2014-06-24 09:04:06 +00:00
Evgeniy Stepanov 4ea1647e8b [msan] Handle X86 *.psad.* and *.pmadd.* intrinsics.
llvm-svn: 211156
2014-06-18 12:02:29 +00:00
Evgeniy Stepanov 9959915890 [msan] Intercept __strto*_internal.
This should fix strtoimax/strtoumax on newer glibc.
https://code.google.com/p/memory-sanitizer/issues/detail?id=36

llvm-svn: 210463
2014-06-09 10:41:22 +00:00
Evgeniy Stepanov 66c6a18d39 [msan] Add a test for mmx.packuswb.
llvm-svn: 210458
2014-06-09 08:58:41 +00:00
Evgeniy Stepanov aaaf74f9fb [msan] Simplify tests.
llvm-svn: 210457
2014-06-09 08:57:40 +00:00
Evgeniy Stepanov ee98fb197b [msan] Fix wrong endianness when printing shadow.
llvm-svn: 210335
2014-06-06 14:06:14 +00:00
Evgeniy Stepanov 3e810b01c3 [msan] Partial revert of r210331.
Bots did not like it.

llvm-svn: 210332
2014-06-06 13:35:25 +00:00
Evgeniy Stepanov 9438bf1f62 [msan] Better diagnostic for invalid origin id.
llvm-svn: 210331
2014-06-06 12:58:44 +00:00
Sergey Matveev dcd9bba602 [sanitizer] Make LSan/MSan/TSan honor the "color" flag.
Based on a patch by Stephan Bergmann.

llvm-svn: 210199
2014-06-04 16:57:03 +00:00
Evgeniy Stepanov d425a2b169 [msan] Handle x86 vector pack intrinsics.
llvm-svn: 210020
2014-06-02 12:31:44 +00:00
Dmitry Vyukov 5864ac39ee tsan: do not use 64-bit atomics in allocator code
64-bit atomics make porting of asan to 32-bits platforms problematic.

llvm-svn: 209744
2014-05-28 15:22:12 +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
Sergey Matveev a531058d2b [MSan] Implement __sanitizer_print_stack_trace().
llvm-svn: 209625
2014-05-26 13:08:08 +00:00
Evgeniy Stepanov bce21acf25 [msan] Implement MSAN_OPTIONS=print_stats=1.
llvm-svn: 209287
2014-05-21 09:56:28 +00:00
Evgeniy Stepanov 208aae8ee0 [msan] Chained origins re-design.
Generalize StackDepot and create a new specialized instance of it to
efficiently (i.e. without duplicating stack trace data) store the
origin history tree.

This reduces memory usage for chained origins roughly by an order of
magnitude.

Most importantly, this new design allows us to put two limits on
stored history data (exposed in MSAN_OPTIONS) that help avoid
exponential growth in used memory on certain workloads.

See comments in lib/msan/msan_origin.h for more details.

llvm-svn: 209284
2014-05-21 09:02:13 +00:00
Alexey Samsonov eacb4d8417 [CMake] Use ExternalProject to build MSan-ified version of libcxx for unit tests.
This change lets MSan rely on libcxx's own build system instead of manually
compiling its sources and setting up all the necessary compile flags. It would
also simplify compiling libcxx with another sanitizers (in particular, TSan).

The tricky part is to make sure libcxx is reconfigured/rebuilt when Clang or
MSan runtime library is changed. "clobber" step used in this patch works well
for me, but it's possible it would break for other configurations - will
watch the buildbots.

llvm-svn: 208451
2014-05-09 22:11:03 +00:00
Evgeniy Stepanov c5e51926dc [msan] Intercept strxfrm.
llvm-svn: 208303
2014-05-08 12:04:01 +00:00
Evgeniy Stepanov ac030ffb69 [msan] Switch to common printf interceptors.
Format string parsing is disabled by default.
This is not expected to meaningfully change the tool behavior.
With this change, check_printf flag could be used to evaluate printf format
string parsing in MSan.

llvm-svn: 208295
2014-05-08 09:50:59 +00:00
Alexey Samsonov 2fccdfbe70 [MSan] Fixup for r206983: MsanThread may be unavailable in signal handler: signals may be raised while thread is being destroyed
llvm-svn: 208250
2014-05-07 21:23:12 +00:00
Evgeniy Stepanov 7d46040ff2 [sanitizer] Replace a macro with a function.
llvm-svn: 208207
2014-05-07 13:24:28 +00:00
Evgeniy Stepanov 8dd62dc3be [msan] Fix __msan_check_mem_is_initialized and prettify its output.
llvm-svn: 208195
2014-05-07 11:50:14 +00:00
Evgeniy Stepanov fe250b0014 [msan] Prettify __msan_print_shadow.
Makes __msan_print_shadow output much more readable, adds origin info.

llvm-svn: 207622
2014-04-30 09:50:30 +00:00
Evgeniy Stepanov 5a7c364343 [msan] Disable chained origins in signal handlers.
StackDepot is not async-signal-safe; storing a new origin to it can deadlock.

llvm-svn: 206983
2014-04-23 14:01:57 +00:00
Evgeniy Stepanov 474011d55d [msan] Add missing quotes.
llvm-svn: 206589
2014-04-18 13:03:54 +00:00
Evgeniy Stepanov 191ebd874f [msan] Run msan_test in the new with-calls mode.
llvm-svn: 206587
2014-04-18 12:19:28 +00:00
Evgeniy Stepanov 83477cb93b [msan] Missing declarations for the new interface functions.
llvm-svn: 206586
2014-04-18 12:18:00 +00:00
Evgeniy Stepanov 8f41674719 [msan] Add new MSan callbacks for instrumentation-with-calls mode.
llvm-svn: 206584
2014-04-18 12:15:24 +00:00
Evgeniy Stepanov 9ce9a6cdf6 [msan] Intercept wcsftime().
llvm-svn: 206179
2014-04-14 14:59:42 +00:00
Evgeniy Stepanov d326c81117 [msan] mprotect() more memory to detect user code outside of application range.
llvm-svn: 206028
2014-04-11 12:04:29 +00:00
Evgeniy Stepanov f653cda269 [msan] Introduce MsanThread. Move thread-local allocator cache out of TLS.
This reduces .tbss from 109K down to almost nothing.

llvm-svn: 205618
2014-04-04 09:47:41 +00:00
Evgeniy Stepanov 2dcb5c0a2c [msan] Kill __msan_print_param_shadow.
It does not do what it's name says, and what it actually does is hard to
describe, and is not useful at all.

llvm-svn: 205415
2014-04-02 11:55:24 +00:00
Evgeniy Stepanov 80cb930c09 [msan] Add __msan_check_mem_is_initialized.
An assert()-like function that checks that a memory range is fully initialized.

llvm-svn: 205413
2014-04-02 11:50:42 +00:00
Evgeniy Stepanov a55fcd35e9 [msan] Precise origin handling in __unaligned_(load|store)*.
llvm-svn: 205412
2014-04-02 11:06:35 +00:00
Evgeniy Stepanov 8dbf3faa16 [msan] clang-format several unit tests
llvm-svn: 205410
2014-04-02 09:17:55 +00:00
Evgeniy Stepanov 3c95744de8 [msan] Remove an extra top frame from track-origins=2 reports.
llvm-svn: 205192
2014-03-31 14:18:55 +00:00
Alexey Samsonov 78a8435fd6 [CMake] Rename add_compiler_rt_static_runtime to add_compiler_rt_runtime.
Soon there will be an option to build compiler-rt parts as shared libraries
on Linux. Extracted from http://llvm-reviews.chandlerc.com/D3042
by Yuri Gribov.

llvm-svn: 205183
2014-03-31 13:45:36 +00:00
Evgeniy Stepanov 86a4d2c32b [sanitizer] Intercept fgetpwent / fgetgrent.
These interceptors require deep unpoisoning of return values.
While at it, we do the same for all other pw/gr interceptors to
reduce dependency on libc implementation details.

llvm-svn: 205004
2014-03-28 13:03:55 +00:00
Evgeniy Stepanov 74e77756ef [sanitizer] Intercept getpwent/getgrent.
llvm-svn: 205000
2014-03-28 10:56:07 +00:00
Evgeniy Stepanov 89602651e8 [msan] Implement __msan_set_death_callback.
llvm-svn: 204926
2014-03-27 14:04:58 +00:00
Evgeniy Stepanov 9dcd5a353a [msan] Intercept several malloc-related functions.
llvm-svn: 204923
2014-03-27 13:29:29 +00:00
Rafael Espindola 5e46070516 Avoid aliases to weak aliases in interceptors.
The interceptors had code that after macro expansion ended up looking like

extern "C" void memalign()
    __attribute__((weak, alias("__interceptor_memalign")));
extern "C" void __interceptor_memalign() {}
extern "C" void __interceptor___libc_memalign()
    __attribute__((alias("memalign")));

That is,
* __interceptor_memalign is a function
* memalign is a weak alias to __interceptor_memalign
* __interceptor___libc_memalign is an alias to memalign

Both gcc and clang produce assembly that look like

__interceptor_memalign:
...
        .weak   memalign
memalign = __interceptor_memalign
        .globl  __interceptor___libc_memalign
__interceptor___libc_memalign = memalign

What it means in the end is that we have 3 symbols pointing to the
same position in the file, one of which is weak:

     8: 0000000000000000     1 FUNC    GLOBAL DEFAULT    1
__interceptor_memalign
     9: 0000000000000000     1 FUNC    WEAK   DEFAULT    1 memalign
    10: 0000000000000000     1 FUNC    GLOBAL DEFAULT    1
__interceptor___libc_memalign

In particular, note that __interceptor___libc_memalign will always
point to __interceptor_memalign, even if we do link in a strong symbol
for memalign. In fact, the above code produces exactly the same binary
as

extern "C" void memalign()
    __attribute__((weak, alias("__interceptor_memalign")));
extern "C" void __interceptor_memalign() {}
extern "C" void __interceptor___libc_memalign()
    __attribute__((alias("__interceptor_memalign")));

If nothing else, this patch makes it more obvious what is going on.

llvm-svn: 204823
2014-03-26 15:48:59 +00:00
Evgeniy Stepanov 1382fabd97 [msan] Enable SelectPartial test.
Fixed in r204716.

llvm-svn: 204717
2014-03-25 13:09:14 +00:00
Evgeniy Stepanov 517ff05ffb [msan] Fix compiler warning in msan_test.cc.
llvm-svn: 204708
2014-03-25 10:03:39 +00:00
Evgeniy Stepanov 90384ad60e [msan] A disabled test for inexact "select" instrumentation.
llvm-svn: 204707
2014-03-25 09:36:15 +00:00
Alexey Samsonov c41ca6d31a [CMake] Rename the variable
llvm-svn: 204602
2014-03-24 13:29:20 +00:00
Alexey Samsonov 1847401332 [CMake] Respect CMAKE_CXX_FLAGS in custom clang_compile commands
llvm-svn: 204593
2014-03-24 09:42:12 +00:00
Alexey Samsonov 8c956460d3 Make MSan unittest -Werror=sign-compare clean
llvm-svn: 204592
2014-03-24 09:41:11 +00:00
Sergey Matveev fa76f3b3a5 [MSan] Add __msan_unpoison_string() to the public interface.
Using __msan_unpoison() on null-terminated strings is awkward because
strlen() can't be called on a poisoned string. This case warrants a special
interface function.

llvm-svn: 204448
2014-03-21 10:12:17 +00:00
Alexander Potapenko 1296436cbf [libsanitizer] Introduce flag descriptions.
Extend ParseFlag to accept the |description| parameter, add dummy values for all existing flags.
As the flags are parsed their descriptions are stored in a global linked list.
The tool can later call __sanitizer::PrintFlagDescriptions() to dump all the flag names and their descriptions.
Add the 'help' flag and make ASan, TSan and MSan print the flags if 'help' is set to 1.

llvm-svn: 204339
2014-03-20 12:52:52 +00:00
Alexey Samsonov 17703c1092 [CMake] Build sanitizer unit tests with -std=c++11
llvm-svn: 204234
2014-03-19 13:57:33 +00:00
Evgeniy Stepanov 412d973980 [msan] Origin tracking with history, compiler-rt part.
Compiler-rt part of MSan implementation of advanced origin tracking,
when we record not only creation point, but all locations where
an uninitialized value was stored to memory, too.

llvm-svn: 204152
2014-03-18 13:45:19 +00:00
Evgeniy Stepanov 9fa9a49853 [msan] Test for aggregates passing through ellipsis.
llvm-svn: 203795
2014-03-13 13:18:15 +00:00
Alexey Samsonov 32956d651a [CMake] Make append_if semantics similar to those used in LLVM
llvm-svn: 203773
2014-03-13 09:31:36 +00:00
Evgeniy Stepanov 72a9d25060 [sanitizer] Simplify interceptors with user callbacks.
Get rid of the context argument in UNPOISON_PARAM and INITIALIZE_RANGE.
Get rid of all the thread-local contexts in interceptors.

llvm-svn: 203119
2014-03-06 13:26:09 +00:00
Alexey Samsonov 6dece3c99f Add common interceptors for memchr/memrchr
llvm-svn: 202972
2014-03-05 13:25:32 +00:00
Alexey Samsonov d964e7cd81 [CMake] Test for libdl and libpthread presence
llvm-svn: 202847
2014-03-04 13:28:21 +00:00
Evgeniy Stepanov f7abc8dff6 [msan] Tests for X86 SIMD bitshift intrinsic support.
llvm-svn: 202713
2014-03-03 13:52:36 +00:00
Joerg Sonnenberger 9d09e2fe90 Reapply r201910. MSVC gets __func__ defined explicitly, even though it
can't build anything here.

llvm-svn: 202297
2014-02-26 20:33:22 +00:00
Kostya Serebryany cf5d8e4f29 AdjustStackSizeLinux() is used in Lsan, Tsan and Msan non-Linux-specific code so it seems it should have more generic name and moved to a common scope.
Renamed to AdjustStackSize.
Patch by Viktor Kutuzov.

llvm-svn: 202011
2014-02-24 08:53:26 +00:00
Reid Kleckner 324eee45a7 Revert "Replace __FUNCTION__ with __func__, the latter being standard C99/C++11."
This reverts commit r201910.

While __func__ may be standard in C++11, it was only recently added to
MSVC in 2013 CTP, and LLVM supports MSVC 2012.  __FUNCTION__ may not be
standard, but it's *very* portable.

llvm-svn: 201916
2014-02-22 00:37:45 +00:00
Joerg Sonnenberger b15779f307 Replace __FUNCTION__ with __func__, the latter being standard C99/C++11.
llvm-svn: 201910
2014-02-21 23:55:15 +00:00
Alexey Samsonov 11705b2f10 [CMake] break dependency between unit tests and runtimes in standalone build
llvm-svn: 201778
2014-02-20 12:03:56 +00:00
Alexey Samsonov cd8535a96d [CMake] Introduce COMPILER_RT_INCLUDE_TESTS option
llvm-svn: 201666
2014-02-19 11:18:47 +00:00
Alexey Samsonov 63a4af7346 [CMake] Add top-level target for each compiler-rt library, and add 'compiler-rt' target encompassing them all.
llvm-svn: 201556
2014-02-18 09:33:45 +00:00
Alexey Samsonov 878a9a5de2 [CMake] Check for -fPIE and -ffreestanding flags for consistency
llvm-svn: 201549
2014-02-18 08:07:09 +00:00
Alexey Samsonov b73db72a17 [CMake] Simplify setting compile flag disabling RTTI
llvm-svn: 201547
2014-02-18 07:52:40 +00:00
Alexey Samsonov 8434e60f7e Move MSan lit-tests under test/msan
llvm-svn: 201412
2014-02-14 13:02:58 +00:00
Evgeniy Stepanov a21280307f [sanitizer] Fix getpwuid_r (and similar) interceptors missing one of the arguments.
llvm-svn: 201410
2014-02-14 12:32:15 +00:00
Evgeniy Stepanov 05938a23f5 [sanitizer] Use mmap to zero-fill large shadow regions.
This is covered by existing ASan test.
This does not change anything for TSan by default (but provides a flag to 
change the threshold size).
Based on a patch by florent.bruneau here:
  https://code.google.com/p/address-sanitizer/issues/detail?id=256

llvm-svn: 201400
2014-02-14 11:41:26 +00:00
Alexey Samsonov 81a2b466e9 Move shared configs for lit test suites to test/ and unittests/ directories
llvm-svn: 201399
2014-02-14 11:00:07 +00:00
Evgeniy Stepanov fb74ea80dc [msan] Replicate mmap-below-shadow check in mmap64 interceptor.
llvm-svn: 201397
2014-02-14 09:49:29 +00:00
Evgeniy Stepanov 769d46f373 [sanitizer] Use system unwinder in signal handlers on Android.
Because of the way Bionic sets up signal stack frames, libc unwinder is unable
to step through it, resulting in broken SEGV stack traces.

Luckily, libcorkscrew.so on Android implements an unwinder that can start with
a signal context, thus sidestepping the issue.

llvm-svn: 201151
2014-02-11 13:38:57 +00:00
Evgeniy Stepanov 791a7e1603 [msan] Return EINVAL instead of crashing from mmap of an invalid address.
llvm-svn: 201074
2014-02-10 09:37:03 +00:00
Nick Lewycky af2064f7ab Add throw() specifiers to more redeclarations of operator delete and operator delete[].
llvm-svn: 201016
2014-02-08 01:42:08 +00:00
Sergey Matveev 4a03fa4f60 [sanitizer] Intercept if_indextoname() and if_nametoindex().
llvm-svn: 200945
2014-02-06 20:39:33 +00:00
Sergey Matveev 544d07f861 [sanitizer] One does not simply intercept getifaddrs().
Upgrade the interceptor, and attempt to fix the Android build.

llvm-svn: 200936
2014-02-06 18:48:23 +00:00
Sergey Matveev 07802a090a [sanitizer] Intercept getifaddrs().
llvm-svn: 200926
2014-02-06 17:42:36 +00:00
Sergey Matveev 0c62992d6e [sanitizer] Intercept getresuid and getresgid.
llvm-svn: 200925
2014-02-06 15:12:56 +00:00
Sergey Matveev c5c84a1d86 [sanitizer] Implement ioctl decoding.
When an unknown ioctl is encountered, try to guess the parameter size from the
request id.

llvm-svn: 200872
2014-02-05 19:35:24 +00:00
Evgeniy Stepanov 04e841c047 [msan] Fix a typo.
Spotted by Keno Fischer.

llvm-svn: 200682
2014-02-03 07:27:01 +00:00
Sergey Matveev c18b36625e [sanitizer] Partial revert of recent ioctl changes.
Some build environments are missing the required headers.
This reverts r200544, r200547, r200551. This does not revert the change that
introduced READWRITE ioctl type.

llvm-svn: 200567
2014-01-31 19:19:45 +00:00
Sergey Matveev dffda4cfec [sanitizer] Attempt to fix Android build.
llvm-svn: 200547
2014-01-31 14:28:32 +00:00
Sergey Matveev 6b3397546e [sanitizer] Support most ioctls from /usr/include/sound/.
llvm-svn: 200544
2014-01-31 14:02:21 +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
Sergey Matveev be68311660 [msan] Intercept *getxattr and *listxattr.
llvm-svn: 200464
2014-01-30 12:21:12 +00:00
Sergey Matveev 1394f2da85 [msan] Rewrite strto* interceptors and add a few more.
Express the strto* interceptors though macros. This removes a lot of
duplicate code and fixes a couple of copypasto bugs (where "res" was declared of
a different type than the actual return type). Also, add a few more interceptors
for strto*_l.

llvm-svn: 200316
2014-01-28 13:45:58 +00:00
Evgeniy Stepanov 0b09c623c1 [msan] Replace assert() with GTest ASSERT_* in msan_test.
llvm-svn: 200293
2014-01-28 08:51:39 +00:00
Evgeniy Stepanov 067f54718f [msan] Disable mmap outside of application address range.
llvm-svn: 200200
2014-01-27 09:12:22 +00:00
Kostya Serebryany e402b431c0 [msan] add __libc_memalign interceptor; add a regression test for the existing bug with dtls support in msan
llvm-svn: 199980
2014-01-24 09:14:11 +00:00
Evgeniy Stepanov b1fa81047a [msan] Fix GCC warnings.
warning: ISO C99 requires rest arguments to be used [enabled by default]
 INTERCEPTOR(char *, dlerror) {

warning: invoking macro INTERCEPTOR argument 3: empty macro arguments are undefined in ISO C90 and ISO C++98 [enabled by default]
llvm-svn: 199873
2014-01-23 08:43:12 +00:00
Alexey Samsonov 00cd273c46 Sanitize printf functions.
Intercept and sanitize arguments passed to printf functions in ASan and TSan
(don't do this in MSan for now). The checks are controlled by runtime flag
(off by default for now).

Patch http://llvm-reviews.chandlerc.com/D2480 by Yuri Gribov!

llvm-svn: 199729
2014-01-21 11:58:33 +00:00
Evgeniy Stepanov 3ee789cbbb [msan] Temporarily disable two tests that are failing with new glibc.
llvm-svn: 198919
2014-01-10 07:34:16 +00:00
Alexey Samsonov 6322e036aa [Sanitizer] Replace Symbolizer::IsAvailable and Symbolizer::IsExternalAvailable with Symbolizer::CanReturnFileLineInfo.
Remove now redundant checks in symbolizer initialization in TSan and MSan.

llvm-svn: 198000
2013-12-25 07:09:44 +00:00
Evgeniy Stepanov 09021e02bc [msan] Add missing visibility attribute to MSan new/delete interceptors.
llvm-svn: 197809
2013-12-20 13:18:07 +00:00
Evgeniy Stepanov 42cebb00da [sanitizer] Use the new sanitizer_interception.h header in all interceptors.
llvm-svn: 197808
2013-12-20 13:17:31 +00:00
Evgeniy Stepanov 66297cac72 [msan] Wrap indirect calls to REAL(x) in interceptors.
llvm-svn: 197806
2013-12-20 12:20:15 +00:00
Evgeniy Stepanov 61628196e4 [msan] Replace wrap_indirect_calls runtime flag with an interface method.
llvm-svn: 197799
2013-12-20 11:05:19 +00:00
Alexey Samsonov f2c7659cf8 [ASan] Get rid of ASan-specific functions for printing stack traces
llvm-svn: 197672
2013-12-19 11:25:05 +00:00
Evgeniy Stepanov a164bf5e89 [msan] Disable DynamoRio detection.
This code is not robust enough and triggers when simply linking with
libdynamorio.so, without any code translation at all. Disabling it is safe
(i.e. we may unpoison too much memory and see false negatives, but never false
positives).

llvm-svn: 197568
2013-12-18 13:25:45 +00:00
Evgeniy Stepanov cb98c5f6f0 [msan] Relax gethostbyname_r test condition.
Apparently, its return value depends on the glibc version.

llvm-svn: 197390
2013-12-16 15:01:31 +00:00
Evgeniy Stepanov 43fc44007d [msan] Fix gethostbyname_r and similar interceptors.
*h_errno is written not on success, but on failure.
In fact, it seems like it can be written even when return value signals
success, so we just unpoison it in all cases.

llvm-svn: 197383
2013-12-16 13:24:33 +00:00
Evgeniy Stepanov 3158ec4002 [msan] Fix strncat interceptor, add missing tests.
llvm-svn: 197244
2013-12-13 16:31:59 +00:00
Evgeniy Stepanov 879c552dd9 [msan] Wrap indirect calls from sanitizer rtl when running under DR.
llvm-svn: 197226
2013-12-13 13:13:46 +00:00
Evgeniy Stepanov c8ccef49cc [msan] Add a check for recursive __msan_init.
llvm-svn: 197218
2013-12-13 09:11:14 +00:00
Evgeniy Stepanov 86d8fb5ba1 [msan] Clean stack and TLS shadow on thread exit.
llvm-svn: 197156
2013-12-12 13:48:47 +00:00
Evgeniy Stepanov cd07898cf8 [msan] Get stack limits with pthread_create interceptor.
Before we did it lazily on the first stack unwind in the thread.
It resulted in deadlock when the unwind was caused by memory allocation
inside pthread_getattr_np:
  pthread_getattr_np   <<< not reentable
  GetThreadStackTopAndBottom
  __interceptor_realloc
  pthread_getattr_np
  

llvm-svn: 197026
2013-12-11 10:55:42 +00:00
Evgeniy Stepanov 67bbf967b0 [msan] Allow strlen() (and similar functions) of shadow memory.
llvm-svn: 196572
2013-12-06 09:19:07 +00:00
Alexey Samsonov 2d42b1d693 Run TSan/MSan lit tests only on 64-bit platforms
llvm-svn: 196501
2013-12-05 12:53:36 +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
Evgeniy Stepanov c0378e72d1 [sanitizer] Intercept textdomain.
Patch by Alexander Taran.

llvm-svn: 196098
2013-12-02 13:43:26 +00:00
Evgeniy Stepanov b56c5cd95e [sanitizer] Intercept times.
llvm-svn: 195918
2013-11-28 14:41:22 +00:00
Evgeniy Stepanov 9c1f8323ae [sanitizer] Intercept iconv.
llvm-svn: 195917
2013-11-28 14:14:48 +00:00
Evgeniy Stepanov b76b687628 [sanitizer] Intercept __xpg_strerror_r.
llvm-svn: 195839
2013-11-27 12:29:10 +00:00
Dmitry Vyukov 7bd319cc08 tsan: fix flags parsing
- running_on_valgrind was not parsed in some contexts
- refactor code a bit
- add comprehensive tests for flags parsing

llvm-svn: 195831
2013-11-27 09:54:10 +00:00
Dmitry Vyukov ee882ba4a1 tsan: support synchronization by means of linux aio
http://llvm-reviews.chandlerc.com/D2269

llvm-svn: 195830
2013-11-27 09:10:47 +00:00
Evgeniy Stepanov 1bdf5c93e1 [msan] Test for r195349.
llvm-svn: 195350
2013-11-21 12:01:07 +00:00
Evgeniy Stepanov 0958ecca7e [msan] Tweak io_submit syscall hook.
llvm-svn: 195246
2013-11-20 13:04:23 +00:00
Evgeniy Stepanov 584fd96e9e [msan] Unpoison memory that is returned to the OS and flush its shadow.
llvm-svn: 195244
2013-11-20 12:51:14 +00:00
Evgeniy Stepanov bfb2016c83 [msan] Fix origin tracking in unaligned load/store.
llvm-svn: 195130
2013-11-19 14:47:56 +00:00
Evgeniy Stepanov 5912fa4c4b [msan] A test for r194697.
llvm-svn: 194699
2013-11-14 12:31:18 +00:00
Alexey Samsonov 6345150992 [Sanitizer] Specify a default value for each common runtime flag
llvm-svn: 194479
2013-11-12 13:59:08 +00:00
Evgeniy Stepanov 5a29068b97 [msan] One more test for r194374.
llvm-svn: 194375
2013-11-11 13:38:24 +00:00
Evgeniy Stepanov b69699eb58 [sanitizer] Warn if interception fails.
This includes a clang-format pass over common interceptors.

llvm-svn: 194372
2013-11-11 11:28:30 +00:00
Evgeniy Stepanov bfdb9b2ec6 [msan] Sanity check for non-PIE.
llvm-svn: 194370
2013-11-11 09:27:20 +00:00
Alexey Samsonov b3d939902a [Sanitizer] Make StackTrace::Unwind the only public way to unwind a stack trace.
llvm-svn: 194196
2013-11-07 07:28:33 +00:00
Evgeniy Stepanov 1c8c3fe4b4 [msan] Fix a very unfortunate typo in origin copying.
It was causing randomly missing origins.

llvm-svn: 194036
2013-11-05 01:24:38 +00:00
Evgeniy Stepanov a6b5eec757 [sanitizer] Intercept strptime.
llvm-svn: 193903
2013-11-02 01:01:35 +00:00
Evgeniy Stepanov 365bd0c88c [msan] Intercept memccpy.
llvm-svn: 193897
2013-11-01 23:49:48 +00:00
Alexey Samsonov 5dc6cff06a [Sanitizer] Unify summary reporting across all sanitizers.
This change unifies the summary printing across sanitizers:
now each tool uses specific version of ReportErrorSummary() method,
which deals with symbolization of the top frame and formatting a
summary message. This change modifies the summary line for ASan+LSan mode:
now the summary mentions "AddressSanitizer" instead of "LeakSanitizer".

llvm-svn: 193864
2013-11-01 17:02:14 +00:00
Evgeniy Stepanov 170d70be68 [msan] Check that address is an app region before printing shadow.
llvm-svn: 193863
2013-11-01 15:53:25 +00:00
Evgeniy Stepanov 2335879ff1 [sanitizer] Enhance io_submti syscall handler.
llvm-svn: 193848
2013-11-01 01:20:39 +00:00
Alexey Samsonov 4708c5912b Consistently use StackTrace::PrintStack in ASan, LSan and MSan
llvm-svn: 193834
2013-11-01 00:19:46 +00:00
Alexey Samsonov 627e2c0dd7 [Sanitizer] Add Symbolizer::AddHooks() and use it in TSan and MSan.
Summary:
TSan and MSan need to know if interceptor was called by the
user code or by the symbolizer and use pre- and post-symbolization hooks
for that. Make Symbolizer class responsible for calling these hooks instead.
This would ensure the hooks are only called when necessary (during
in-process symbolization, they are not needed for out-of-process) and
save specific sanitizers from tracing all places in the code where symbolization
will be performed.

Reviewers: eugenis, dvyukov

Reviewed By: eugenis

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2067

llvm-svn: 193807
2013-10-31 21:44:07 +00:00
Evgeniy Stepanov 13322c6eda [msan] Intercept dlerror.
llvm-svn: 193760
2013-10-31 16:58:44 +00:00
Evgeniy Stepanov a7add488ae [msan] Disable mlock/mlockall to work around a linux kernel bug.
The same logic is present in ASan and TSan.

llvm-svn: 193755
2013-10-31 15:51:22 +00:00
Evgeniy Stepanov 1cb37c4ee5 [sanitizer] Intercept getline, getdelim.
llvm-svn: 193730
2013-10-31 01:17:41 +00:00