Commit Graph

291 Commits

Author SHA1 Message Date
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 2c27df9a33 [msan] Intercept __getdelim.
llvm-svn: 211162
2014-06-18 13:35:13 +00:00
Evgeniy Stepanov df187feae4 [msan] Fix handling of multiplication by a constant with a number of trailing zeroes.
Multiplication by an integer with a number of trailing zero bits leaves
the same number of lower bits of the result initialized to zero.
This change makes MSan take this into account in the case of multiplication by
a compile-time constant.

We don't handle the general, non-constant, case because
(a) it's not going to be cheap (computation-wise);
(b) multiplication by a partially uninitialized value in user code is
    a bad idea anyway.

Constant case must be handled because it appears from LLVM optimization of a
completely valid user code, as the test case in compiler-rt demonstrates.

llvm-svn: 211092
2014-06-17 09:23:12 +00:00
Evgeniy Stepanov 2be29929be Fix line numbers for code inlined from __nodebug__ functions.
Instructions from __nodebug__ functions don't have file:line
information even when inlined into no-nodebug functions. As a result,
intrinsics (SSE and other) from <*intrin.h> clang headers _never_
have file:line information.

With this change, an instruction without !dbg metadata gets one from
the call instruction when inlined.

Fixes PR19001.

llvm-svn: 210459
2014-06-09 09:09:19 +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 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
Evgeniy Stepanov 5680a26b0b [msan] Better open_memstream support.
Move fflush and fclose interceptors to sanitizer_common.
Use a metadata map to keep information about the external locations
that must be updated when the file is written to.

llvm-svn: 208676
2014-05-13 08:36:31 +00:00
Alexey Samsonov 0bef819f9f [Sanitizer] Add the machinery to run the same test under several sanitizers
llvm-svn: 208378
2014-05-09 00:28:18 +00:00
Alexey Samsonov 35744c4753 Fixup for r208066. Properly get values of PTRACE_GETREGSET/PTRACE_SETREGSET.
llvm-svn: 208363
2014-05-08 22:11:20 +00:00
Evgeniy Stepanov c5e51926dc [msan] Intercept strxfrm.
llvm-svn: 208303
2014-05-08 12:04:01 +00:00
Evgeniy Stepanov 9c20cb1a7c [msan] Fix potential infinite recursion in a test.
If printf is intercepted (it is not atm), REAL(printf) call in the interceptor
would get redirected back to my_lgamma, resulting in infinite recursion.

llvm-svn: 208294
2014-05-08 09:37:36 +00:00
Evgeniy Stepanov 55590227f8 [sanitizer] Intercept obstack.
llvm-svn: 208196
2014-05-07 11:50:56 +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 06475bf752 [msan] Fix print_shadow test.
llvm-svn: 208069
2014-05-06 08:15:50 +00:00
Greg Fitzgerald b8aae5405b Add %run to all lit tests
llvm-svn: 207709
2014-04-30 21:34:17 +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 f3d5d119a8 [sanitizer] Intercept a bunch of stdio calls.
Add move fopen/freopen interceptors from TSan to common.

llvm-svn: 207224
2014-04-25 13:26:21 +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 a7f9071f25 [sanitizer] Intercept tsearch.
llvm-svn: 206755
2014-04-21 14:21:51 +00:00
Evgeniy Stepanov 24c8d92fec [sanitizer] Intercept a subset of sunrpc interface (xdr_*).
llvm-svn: 205627
2014-04-04 14:51:23 +00:00
Evgeniy Stepanov 6d8f71f928 Revert r205613.
llvm-svn: 205614
2014-04-04 08:58:16 +00:00
Evgeniy Stepanov fe82d5f849 [msan] Fix compilation of a disabled test.
llvm-svn: 205613
2014-04-04 08:39:50 +00:00
Evgeniy Stepanov 6cc687541f [msan] Add missing test for r205413.
llvm-svn: 205417
2014-04-02 12:38:13 +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
Evgeniy Stepanov 92bee36b3e [sanitizer] Intercept rand_r.
llvm-svn: 205001
2014-03-28 11:21:45 +00:00
Evgeniy Stepanov 2e972f63b5 [sanitizer] Intercept mktime.
llvm-svn: 204994
2014-03-28 09:02:57 +00:00
Evgeniy Stepanov 7b44e1ad42 [sanitizer] Intercept ftime.
llvm-svn: 204991
2014-03-28 08:33:32 +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
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
Evgeniy Stepanov d17b061eed [msan] Use new -fsanitize-memory-track-origins= flag in MSan tests.
llvm-svn: 204347
2014-03-20 15:00:39 +00:00
Evgeniy Stepanov a57750482f [msan] Fix line numbers in test.
This corresponds to a fix in llvm::SplitBlockAndInsertIfThen.

llvm-svn: 204229
2014-03-19 12:56:38 +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
Sergey Matveev 8bf42919e6 [msan] Make up for missing interceptor in getxattr() test.
llvm-svn: 202846
2014-03-04 13:13:34 +00:00
Sergey Matveev e7b3e4c2ae [msan] Add missing line to getxattr() test.
llvm-svn: 202841
2014-03-04 12:41:18 +00:00
Alexey Samsonov 5e6d83258e [CMake] lit tests shouldn't depend on runtimes in standalone build
llvm-svn: 201771
2014-02-20 09:47:18 +00:00
Alexey Samsonov 31043152d3 Add rudimentary support for running compiler-rt lit tests with GCC
llvm-svn: 201680
2014-02-19 15:13:14 +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 1c9b9bcb5c Simplify defining Clang compile flags in lit configs
llvm-svn: 201513
2014-02-17 13:08:10 +00:00
Alexey Samsonov 8434e60f7e Move MSan lit-tests under test/msan
llvm-svn: 201412
2014-02-14 13:02:58 +00:00