Commit Graph

186 Commits

Author SHA1 Message Date
Mike Aizatsky aaa637001a [sancov] __sanitizer_dump_coverage api
Subscribers: kubabrecka, mgorny

Differential Revision: https://reviews.llvm.org/D26758

llvm-svn: 289498
2016-12-12 23:45:38 +00:00
Mike Aizatsky 0d98da7c1f [sanitizers] __sanitizer_get_module_and_offset_for_pc interface function
Summary: The function computes full module name and coverts pc into offset.

Reviewers: kcc

Subscribers: kubabrecka

Differential Revision: https://reviews.llvm.org/D26820

llvm-svn: 288711
2016-12-05 21:45:14 +00:00
Dean Michael Berris bad8f0feb4 [XRay] Support AArch64 in compiler-rt
This patch adds XRay support in compiler-rt for AArch64 targets.
This patch is one of a series:

LLVM: https://reviews.llvm.org/D26412
Clang: https://reviews.llvm.org/D26415

Author: rSerge

Reviewers: rengolin, dberris

Subscribers: aemerson, mgorny, llvm-commits, iid_iunknown

Differential Revision: https://reviews.llvm.org/D26413

llvm-svn: 287517
2016-11-21 03:20:43 +00:00
Dean Michael Berris 1b09aae82a [compiler-rt][XRay] Support tail call sleds
Summary:
This change depends on D23986 which adds tail call-specific sleds. For
now we treat them first as normal exits, and in the future leave room
for implementing this as a different kind of log entry.

The reason for deferring the change is so that we can keep the naive
logging implementation more accurate without additional complexity for
reading the log. The accuracy is gained in effectively interpreting call
stacks like:

  A()
    B()
      C()

Which when tail-call merged will end up not having any exit entries for
A() nor B(), but effectively in turn can be reasoned about as:

  A()
  B()
  C()

Although we lose the fact that A() had called B() then had called C()
with the naive approach, a later iteration that adds the explicit tail
call entries would be a change in the log format and thus necessitate a
version change for the header. We can do this later to have a chance at
releasing some tools (in D21987) that are able to handle the naive log
format, then support higher version numbers of the log format too.

Reviewers: echristo, kcc, rSerge, majnemer

Subscribers: mehdi_amini, llvm-commits, dberris

Differential Revision: https://reviews.llvm.org/D23988

llvm-svn: 284178
2016-10-13 23:56:54 +00:00
Kostya Serebryany e923a1a486 [sanitizer-coverage] remove stale code, second attempt after failed r282994
llvm-svn: 283185
2016-10-04 04:18:30 +00:00
Dmitry Vyukov b3587836bc [ASAN] Pass previous stack information through __sanitizer_finish_switch_fiber
This patch extends __sanitizer_finish_switch_fiber method to optionally return previous stack base and size.

This solves the problem of coroutines/fibers library not knowing the original stack context from which the library is used. It's incorrect to assume that such context is always the default stack of current thread (e.g. one such library may be used from a fiber/coroutine created by another library). Bulding a separate stack tracking mechanism would not only duplicate AsanThread, but also require each coroutines/fibers library to integrate with it.

Author: Andrii Grynenko (andriigrynenko)
Reviewed in: https://reviews.llvm.org/D24628

llvm-svn: 282582
2016-09-28 12:28:16 +00:00
Kostya Serebryany f0ca160ea2 [sanitizer] rename __sanitizer_symbolize_data to __sanitizer_symbolize_global (to avoid conflict with another definition)
llvm-svn: 281902
2016-09-19 14:18:16 +00:00
Kostya Serebryany 88b93166dc [sanitizer] add __sanitizer_symbolize_data (can only print the names of the globals for now)
llvm-svn: 281886
2016-09-19 05:10:32 +00:00
Dean Michael Berris f50eb93da7 [compiler-rt][XRay] Initial per-thread inmemory logging implementation
Depends on D21612 which implements the building blocks for the compiler-rt
implementation of the XRay runtime. We use a naive in-memory log of fixed-size
entries that get written out to a log file when the buffers are full, and when
the thread exits.

This implementation lays some foundations on to allowing for more complex XRay
records to be written to the log in subsequent changes. It also defines the format
that the function call accounting tool in D21987 will start building upon.

Once D21987 lands, we should be able to start defining more tests using that tool
once the function call accounting tool becomes part of the llvm distribution.

Reviewers: echristo, kcc, rnk, eugenis, majnemer, rSerge

Subscribers: sdardis, rSerge, dberris, tberghammer, danalbert, srhines, majnemer, llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D21982

llvm-svn: 279805
2016-08-26 06:39:33 +00:00
Kostya Serebryany 9aab75f697 [sanitizer] add __sanitizer_symbolize_pc. https://github.com/google/sanitizers/issues/322
llvm-svn: 279780
2016-08-25 21:35:29 +00:00
Mike Aizatsky 04897dcc3d [sanitizers] trace buffer API to use user-allocated buffer.
Subscribers: kubabrecka

Differential Revision: https://reviews.llvm.org/D23186

llvm-svn: 277858
2016-08-05 20:09:42 +00:00
Dean Michael Berris 17a586e6de [compiler-rt][XRay] Address follow-up comments to initial interface and initialisation code
This addresses some comments from D21612, which contains the following changes:

- Update __xray_patch() and __xray_unpatch() API documentation to not imply asynchrony.
- Introduce a scope cleanup mechanism to make sure we can roll-back changes to the XRayPatching global atomic.
- Introduce a few more comments for potential extension points for other platforms (for the implementation details of patching and un-patching).

Reviewers: eugenis, rnk, kcc, echristo, majnemer

Subscribers: llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D22911

llvm-svn: 277124
2016-07-29 07:11:58 +00:00
Dean Michael Berris 938c5031ab [compiler-rt][XRay] re-submitting r276117, with fixes for build breakage due to extraneous and missing dependencies and attempts to build on unsupported OSes
Summary:
This is a fixed-up version of D21612, to address failure identified post-commit.

Original commit description:

This patch implements the initialisation and patching routines for the XRay runtime, along with the necessary trampolines for function entry/exit handling. For now we only define the basic hooks for allowing an implementation to define a handler that gets run on function entry/exit. We expose a minimal API for controlling the behaviour of the runtime (patching, cleanup, and setting the handler to invoke when instrumenting).

Fixes include:
- Gating XRay build to only Linux x86_64 and with the right dependencies in case it is the only library being built
- Including <cstddef> to fix std::size_t issue

Reviewers: kcc, rnk, echristo

Subscribers: mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D22611

llvm-svn: 276251
2016-07-21 07:39:55 +00:00
Hans Wennborg ae4e6fe990 Revert r276117 "[XRay] Basic initialization and flag definition for XRay runtime"
and also the follow-up "[xray] Only build xray on Linux for now"

Two build errors were reported on the llvm-commits list:

	[ 88%] Building CXX object lib/xray/CMakeFiles/clang_rt.xray-x86_64.dir/xray_flags.cc.o
	/mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/lib/xray/xray_init.cc:23:10: fatal error: 'llvm/Support/ELF.h' file not found
  #include "llvm/Support/ELF.h"
					 ^

and

	In file included from /w/src/llvm.org/projects/compiler-rt/lib/xray/xray_interface.cc:16:
	/w/src/llvm.org/projects/compiler-rt/lib/xray/xray_interface_internal.h:36:8: error:
				no type named 'size_t' in namespace 'std'
		std::size_t Entries;
		~~~~~^

llvm-svn: 276186
2016-07-20 21:37:38 +00:00
Dean Michael Berris e1c81d10d7 [compiler-rt] [XRay] Basic initialization and flag definition for XRay runtime
Summary:
This patch implements the initialisation and patching routines for the XRay runtime, along with the necessary trampolines for function entry/exit handling. For now we only define the basic hooks for allowing an implementation to define a handler that gets run on function entry/exit. We expose a minimal API for controlling the behaviour of the runtime (patching, cleanup, and setting the handler to invoke when instrumenting).

Depends on D19904

Reviewers: echristo, kcc, rnk

Subscribers: rnk, mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D21612

llvm-svn: 276117
2016-07-20 14:14:50 +00:00
Derek Bruening 0fc992442c [esan|wset] Fix flaky sampling tests
Adds a new esan public interface routine __esan_get_sample_count() and uses
it to ensure that tests of sampling receive the minimum number of samples.

llvm-svn: 275948
2016-07-19 05:06:48 +00:00
Kostya Serebryany ad0724692e [sanitizers] add interceptor for memmem; add weak hooks for strncasecmp, strcasecmp, strstr, strcasestr, memmem
llvm-svn: 275621
2016-07-15 21:28:58 +00:00
Etienne Bergeron ab42f4ddba [compiler-rt] Fix VisualStudio virtual folders layout
Summary:
This patch is a refactoring of the way cmake 'targets' are grouped.
It won't affect non-UI cmake-generators.

Clang/LLVM are using a structured way to group targets which ease
navigation through Visual Studio UI. The Compiler-RT projects
differ from the way Clang/LLVM are grouping targets.

This patch doesn't contain behavior changes.

Reviewers: kubabrecka, rnk

Subscribers: wang0109, llvm-commits, kubabrecka, chrisha

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

llvm-svn: 275111
2016-07-11 21:51:56 +00:00
Derek Bruening dec4bd0838 [esan] Add __esan_report for mid-run data
Summary:
Adds a new public interface routine __esan_report() which can be used to
request profiling results prior to abnormal termination (e.g., for a server
process killed by its parent where the normal exit does not allow for
normal result reporting).

Implements this for the working-set tool.  The cache frag tool is left
unimplemented as it requires missing iteration capabilities.

Adds a new test.

Reviewers: aizatsky

Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka

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

llvm-svn: 274964
2016-07-09 04:13:25 +00:00
Evgeniy Stepanov c8679985ed [sanitizer] Add syscall handlers for sigaction and rt_sigaction.
llvm-svn: 273746
2016-06-24 23:09:44 +00:00
Dmitry Vyukov 47b7c5c912 [asan] add primitives that allow coroutine implementations
This patch adds the __sanitizer_start_switch_fiber and
__sanitizer_finish_switch_fiber methods inspired from what can be found here
2ea64dd249 .

These methods are needed when the compiled software needs to implement
coroutines, fibers or the like. Without a way to annotate them, when the program
jumps to a stack that is not the thread stack, __asan_handle_no_return shows a
warning about that, and the fake stack mechanism may free fake frames that are
still in use.

Author: blastrock (Philippe Daouadi)
Reviewed in http://reviews.llvm.org/D20913

llvm-svn: 273260
2016-06-21 12:29:18 +00:00
Kostya Serebryany bf6a04fde8 [sanitizers] introduce yet another API function: __sanitizer_install_malloc_and_free_hooks
llvm-svn: 272943
2016-06-16 20:06:06 +00:00
Kostya Serebryany 3e7bf586f8 [asan] fix arm build
llvm-svn: 271474
2016-06-02 04:01:58 +00:00
Kostya Serebryany 5a7159c416 [asan] add an interface function __sanitizer_print_memory_profile (a basic memory profiler; asan/Linux-only for now)
llvm-svn: 271463
2016-06-02 01:21:52 +00:00
Kostya Serebryany 1508f591b3 [sanitizers] introduce __sanitizer_set_report_fd so that we can re-route the sanitizer logging to another fd from inside the process
llvm-svn: 271046
2016-05-27 21:23:05 +00:00
Kostya Serebryany e3580956ea [libFuzzer] extend the weak memcmp/strcmp/strncmp interceptors to receive the result of the computations. With that, don't do any mutations if memcmp/etc returned 0
llvm-svn: 257423
2016-01-12 00:43:42 +00:00
Mike Aizatsky 54fc6575c5 [sancov] coverage pc buffer
Differential Revision: http://reviews.llvm.org/D15871

llvm-svn: 256804
2016-01-05 01:49:39 +00:00
Mike Aizatsky 1e41784f20 Asan: utility function to determine first wrongly poisoned byte in
container.

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

llvm-svn: 252071
2015-11-04 19:56:03 +00:00
Kostya Serebryany e3d25c3873 [sanitizer-coverage] introduce __sanitizer_get_total_unique_caller_callee_pairs
llvm-svn: 251071
2015-10-22 22:06:41 +00:00
Evgeniy Stepanov c7ee62c561 [msan] Add __msan_copy_shadow interface function.
This can be used to annotate copies of memory that are not observed by MSan.

llvm-svn: 250124
2015-10-12 23:20:24 +00:00
Alexey Samsonov 540ac1aab4 [MSan] Deprecate __msan_set_death_callback() in favor of __sanitizer_set_death_callback().
llvm-svn: 245754
2015-08-21 22:45:12 +00:00
Alexey Samsonov bb79b06f4e [Sanitizers] Unify the semantics and usage of "exitcode" runtime flag across all sanitizers.
Summary:
Merge "exitcode" flag from ASan, LSan, TSan and "exit_code" from MSan
into one entity. Additionally, make sure sanitizer_common now uses the
value of common_flags()->exitcode when dying on error, so that this
flag will automatically work for other sanitizers (UBSan and DFSan) as
well.

User-visible changes:
* "exit_code" MSan runtime flag is now deprecated. If explicitly
  specified, this flag will take precedence over "exitcode".
  The users are encouraged to migrate to the new version.
* __asan_set_error_exit_code() and __msan_set_exit_code() functions
  are removed. With few exceptions, we don't support changing runtime
  flags during program execution - we can't make them thread-safe.
  The users should use __sanitizer_set_death_callback()
  that would call _exit() with proper exit code instead.
* Plugin tools (LSan and UBSan) now inherit the exit code of the parent
  tool. In particular, this means that ASan would now crash the program
  with exit code "1" instead of "23" if it detects leaks.

Reviewers: kcc, eugenis

Subscribers: llvm-commits

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

llvm-svn: 245734
2015-08-21 20:49:37 +00:00
Kostya Serebryany 66a75c54be [sanitizer] add a weak hook for strncmp interceptor, both to dfsan and other sanitizers. Hide the declaration and the calls in better macros
llvm-svn: 243610
2015-07-30 02:32:51 +00:00
Kostya Serebryany d99f2b3291 [sanitizer] add a weak hook for memcmp interceptor, to be used primarily for fuzzing. More hooks will be added later. So far this is a Linux-only feature
llvm-svn: 243601
2015-07-30 01:19:17 +00:00
Naomi Musgrave 9a5e3922bf re-added changes due to svn config setting issues
llvm-svn: 242589
2015-07-17 23:28:00 +00:00
Kostya Serebryany 13c03581ac Add dfsan_weak_hook_memcmp
Summary:
Add a weak hook to be called from dfsan's custom memcmp.
The primary user will be lib/Fuzzer.
If this works well we'll add more hooks (strcmp, etc).

Test Plan: Will be covered by lib/Fuzzer tests.

Reviewers: pcc

Reviewed By: pcc

Subscribers: llvm-commits

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

llvm-svn: 236679
2015-05-07 00:04:39 +00:00
Sergey Matveev cbdd0dc88a [lsan] Add an interface function for on-demand leak checking.
Summary:
Add an interface function which can be used to periodically trigger
leak detection in a long-running process.

NB: The meaning of the kIgnored tag has been changed to allow easy clean-up
between subsequent leak checks. Previously, this tag was applied to explicitly
ignored (i.e. with __lsan_disable() or __lsan_ignore_object()) chunks *and* any
chunks only reachable from those. With this change, it's only applied to
explicitly ignored chunks.

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

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

llvm-svn: 235728
2015-04-24 16:53:15 +00:00
Sergey Matveev 4fedac85ee Revert r235726 "interface"
Accidentally committed from local branch. :(

llvm-svn: 235727
2015-04-24 16:51:21 +00:00
Sergey Matveev a409f28b8e interface
llvm-svn: 235726
2015-04-24 16:49:04 +00:00
Kostya Serebryany be5e0ed919 [sanitizer/coverage] Add AFL-style coverage counters (search heuristic for fuzzing).
Introduce -mllvm -sanitizer-coverage-8bit-counters=1
which adds imprecise thread-unfriendly 8-bit coverage counters.

The run-time library maps these 8-bit counters to 8-bit bitsets in the same way
AFL (http://lcamtuf.coredump.cx/afl/technical_details.txt) does:
counter values are divided into 8 ranges and based on the counter
value one of the bits in the bitset is set.
The AFL ranges are used here: 1, 2, 3, 4-7, 8-15, 16-31, 32-127, 128+.

These counters provide a search heuristic for single-threaded
coverage-guided fuzzers, we do not expect them to be useful for other purposes.

Depending on the value of -fsanitize-coverage=[123] flag,
these counters will be added to the function entry blocks (=1),
every basic block (=2), or every edge (=3).

Use these counters as an optional search heuristic in the Fuzzer library.
Add a test where this heuristic is critical.

llvm-svn: 231166
2015-03-03 23:27:02 +00:00
Evgeniy Stepanov 504f0987fe [msan] Fix MsanTest to pass in track_origins=2 mode.
llvm-svn: 230639
2015-02-26 15:19:33 +00:00
Kostya Serebryany cc0c773f76 [sanitizer] move the coverage interface into a separate header, <sanitizer/coverage_interface.h>. NFC, except for the header name change. This may break existing users, but in this case it's better this way (not too many users so far)
llvm-svn: 228017
2015-02-03 19:40:53 +00:00
Kostya Serebryany 21a1a23790 [sanitizer] allow to reset the bb/edge coverage data inside the process while it is running (single-threaded). Also expose the current coverage set to the process.
llvm-svn: 227387
2015-01-28 22:39:44 +00:00
Evgeniy Stepanov 84adb5d1d0 [msan] Refactor shadow operations.
Move a bunch of functions to a new source file and rename some of them for
consistency. No functional changes.

llvm-svn: 226673
2015-01-21 16:42:30 +00:00
Kostya Serebryany 42102b110e [asan] introduce __sanitizer_set_death_callback, deprecate __asan_set_death_callback
llvm-svn: 224286
2014-12-15 23:02:57 +00:00
Lorenzo Martignoni 101f1d82ff [DFSan] Add flag to dump the labels when the program terminates.
Differential Revision: http://reviews.llvm.org/D6306

llvm-svn: 222425
2014-11-20 10:01:08 +00:00
Kostya Serebryany 183cb6e35d [asan] add interface function __sanitizer_get_total_unique_coverage; useful for coverage-guided in-process fuzzers
llvm-svn: 222060
2014-11-14 23:15:55 +00:00
Filipe Cabecinhas 830c45e5de Fix minor typos in comments.
llvm-svn: 219632
2014-10-13 21:40:52 +00:00
Kuba Brecka 7e38e429b7 [compiler-rt] recommit of r218481: ASan debugging API for report info extraction and locating addresses
Reviewed at http://reviews.llvm.org/D4527

Fixed a test case failure on 32-bit Linux, I did right shift on intptr_t, instead it should have been uintptr_t.

llvm-svn: 218538
2014-09-26 19:15:32 +00:00
Kuba Brecka db22cd1721 [compiler-rt] revert r218481 due to test failure on sanitizer-x86_64-linux
llvm-svn: 218501
2014-09-26 05:25:37 +00:00
Kuba Brecka e37e089b66 [compiler-rt] ASan debugging API for report info extraction and locating addresses
Reviewed at http://reviews.llvm.org/D4527

This patch is part of an effort to implement a more generic debugging API, as proposed in http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-July/074656.html, with first part reviewed at http://reviews.llvm.org/D4466. Now adding several new APIs: __asan_report_present, __asan_get_report_{pc,bp,sp,address,type,size,description}, __asan_locate_address. These return whether an asan report happened yet, the PC, BP, SP, address, access type (read/write), access size and bug description (e.g. "heap-use-after-free"), __asan_locate_address takes a pointer and tries to locate it, i.e. say whether it is a heap pointer, a global or a stack, or whether it's a pointer into the shadow memory. If global or stack, tries to also return the variable name, address and size. If heap, tries to return the chunk address and size. Generally these should serve as an alternative to "asan_describe_address", which only returns all the data in text form. Having an API to get these data could allow having debugging scripts/extensions that could show additional information about a variable/expression/pointer. Test cases in test/asan/TestCases/debug_locate.cc and test/asan/TestCasea/debug_report.cc.

llvm-svn: 218481
2014-09-25 23:53:57 +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
Kuba Brecka 58f44dce96 [ASan] Add ASan debugging API to get malloc/free stack traces and shadow memory mapping info
Reviewed at http://reviews.llvm.org/D4466

llvm-svn: 213080
2014-07-15 17:33: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
Sergey Matveev 83f91e786c [sanitizer] Add __sanitizer_maybe_open_cov_file().
Summary: Add a new interface function required for coverage sandboxing support.
llvm-svn: 209298
2014-05-21 13:43:52 +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
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
Kostya Serebryany 7a733480c8 [asan] introduce interface function __sanitizer_verify_contiguous_container to verify annotations in vector-like containers
llvm-svn: 208092
2014-05-06 14:41:01 +00:00
Kostya Serebryany 8b530e10a1 [asan] make AsanCoverage lock-free (and AS-safe)
llvm-svn: 207630
2014-04-30 10:40:48 +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
Peter Collingbourne 16f2f18105 Add user-defined callback on write() calls.
Add dfsan_set_write_callback(), which sets a callback to be invoked when
a write() call is invoked within DFSan instrumented code.

Patch by Sam Kerner!

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

llvm-svn: 207131
2014-04-24 17:42:16 +00:00
Kostya Serebryany 90527cb324 [asan] don't use bool in public interface, make sure the interface headers are usable in plain C
llvm-svn: 206160
2014-04-14 11:16:53 +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 89602651e8 [msan] Implement __msan_set_death_callback.
llvm-svn: 204926
2014-03-27 14:04:58 +00:00
Peter Collingbourne 5d167dae7d Add function to get the number of DFSan labels allocated.
Expose the number of DFSan labels allocated by adding function dfsan_get_label_count().

Patch by Sam Kerner!

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

llvm-svn: 204854
2014-03-26 21:09:53 +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 e0e980c748 [msan] Remove stubs for non-instrumented code from msan interface header.
llvm-svn: 201777
2014-02-20 11:43:00 +00:00
Alexey Samsonov 1181a104e6 [CMake] Rename several variables
llvm-svn: 201575
2014-02-18 14:28:53 +00:00
Kostya Serebryany 1ee681305f [asan] introduce two functions that will allow implementations of C++ garbage colection to work with asan's fake stack
llvm-svn: 200908
2014-02-06 06:56:22 +00:00
Kostya Serebryany 06222915cf [lsan] remove LeakSanitizerIsTurnedOffForTheCurrentProcess (this was a bad idea), leave __lsan_is_turned_off
llvm-svn: 199304
2014-01-15 08:04:21 +00:00
Evgeniy Stepanov fc0ba53531 [msan] Fix an incorrect comment.
llvm-svn: 199300
2014-01-15 06:49:40 +00:00
Sergey Matveev 3a47244c94 [lsan] Add __lsan_default_suppressions() to the public interface header.
llvm-svn: 199121
2014-01-13 17:26:57 +00:00
Kostya Serebryany e8699fcd8e [sanitizer] fix comment
llvm-svn: 199112
2014-01-13 15:06:20 +00:00
Kostya Serebryany 27f5b8800d [lsan] rename __lsan_is_turned_off to LeakSanitizerIsTurnedOffForTheCurrentProcess (leave the old variant for now for compatibility)
llvm-svn: 198921
2014-01-10 07:58:25 +00:00
Alexey Samsonov cef2e14382 [ASan] Get rid of __asan_symbolize function
llvm-svn: 197670
2013-12-19 11:08:47 +00:00
Sergey Matveev 7237879926 [lsan] Introduce __lsan_(un)register_root_region().
Add an interface for telling LSan that a region of memory is to be treated as a
source of live pointers. Useful for code which stores pointers in mapped memory.

llvm-svn: 197489
2013-12-17 11:11:23 +00:00
Alexey Samsonov 4fc8098979 [TSan] Move declarations of __tsan_atomic functions to a public header
llvm-svn: 197015
2013-12-11 08:18:50 +00:00
Sergey Matveev d8fb4d8f91 [sanitizer] Expose __sanitizer_print_stack_trace().
Expose a new interface function for debugging code built with sanitizer tools.
Add an ASan implementation.

llvm-svn: 196302
2013-12-03 18:24:28 +00:00
Kostya Serebryany 3771a3dd73 [asan] remove a fixed FIXME; extend the comment around __sanitizer_annotate_contiguous_container
llvm-svn: 195131
2013-11-19 14:54:14 +00:00
Kostya Serebryany 7b664299f0 [asan] new shadow poison magic for contiguous-container-buffer-overflow, addressed Alexey Samsonov's comments for r195011
llvm-svn: 195117
2013-11-19 08:40:07 +00:00
Kostya Serebryany 3d97c2040d [asan] introduce __sanitizer_annotate_contiguous_container
llvm-svn: 195011
2013-11-18 14:02:05 +00:00
Alexey Samsonov 1011fe6a6e CMake: make sure compiler-rt headers are copied to build tree if 'compilrer-rt' target is built
llvm-svn: 195002
2013-11-18 10:57:36 +00:00
Bob Wilson a08e9ac927 Reapply asan coverage changes 194702-194704.
I still don't know what is causing our bootstrapped LTO buildbots to fail,
but llvm r194701 seems to be OK and I can't imagine that these changes could
cause the problem.

llvm-svn: 194790
2013-11-15 07:18:15 +00:00
Bob Wilson abc91eacac Speculatively revert asan coverage changes 194702-194704.
Apple's bootstrapped LTO builds have been failing, and these changes (along
with llvm 194701) are the only things on the blamelist.  I will either reapply
these changes or help debug the problem, depending on whether this fixes the
buildbots.

llvm-svn: 194779
2013-11-15 03:26:28 +00:00
Kostya Serebryany c46f281f83 [asan] unbreak dfsan, which includes sanitizer/common_interface_defs.h into internal sources (although it shoudn't)
llvm-svn: 194704
2013-11-14 13:44:43 +00:00
Kostya Serebryany 91c52d9552 [asan] Poor man's coverage that works with ASan (compiler-rt part)
llvm-svn: 194702
2013-11-14 13:28:17 +00:00
Dmitry Vyukov 2346c7a511 tsan: fix linux syscall hooks
the file references non-existent arguments and breaks build

llvm-svn: 193234
2013-10-23 08:40:19 +00:00
Dmitry Vyukov 67a1eef05b tsan: remove __sanitizer_set_report_fd function from public interface
__sanitizer_set_report_path now accepts two special values - stderr and stdout
logging to other file descriptors is not supported anymore,
it's fragile in presence of multiple processes, fork, etc

llvm-svn: 192706
2013-10-15 14:14:34 +00:00
Dmitry Vyukov 1da6b4d5c8 tsan: intercept fork syscall
llvm-svn: 191144
2013-09-21 20:59:04 +00:00
Evgeniy Stepanov 2b31d7186e [msan] Make all pointers in msan_interface "const volatile void *".
This way msan annotations can be used with both normal and volatile memory.

llvm-svn: 190403
2013-09-10 11:54:51 +00:00
Evgeniy Stepanov df96e863de [msan] bool -> int to make msan_interface.h C-compatible.
llvm-svn: 190402
2013-09-10 11:04:37 +00:00
Evgeniy Stepanov 5c1035e7fa [sanitizer] A bunch of linux system call handlers.
llvm-svn: 190157
2013-09-06 14:20:01 +00:00
Peter Collingbourne 7da504faa4 [dfsan] Introduce dfsan_read_label runtime function.
Differential Revision: http://llvm-reviews.chandlerc.com/D1349

llvm-svn: 188319
2013-08-13 22:15:40 +00:00
Dmitry Vyukov 4ba287f328 dfsan: fix lint warning
llvm-svn: 188292
2013-08-13 16:52:07 +00:00
Peter Collingbourne 21b2929aca [dfsan] Introduce dfsan_union runtime function.
Differential Revision: http://llvm-reviews.chandlerc.com/D1347

llvm-svn: 188229
2013-08-12 23:47:37 +00:00
Peter Collingbourne 5cbab07d02 DataFlowSanitizer; compiler-rt changes.
DataFlowSanitizer is a generalised dynamic data flow analysis.

Unlike other Sanitizer tools, this tool is not designed to detect a
specific class of bugs on its own.  Instead, it provides a generic
dynamic data flow analysis framework to be used by clients to help
detect application-specific issues within their own code.

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

llvm-svn: 187924
2013-08-07 22:47:26 +00:00
Alexey Samsonov b42ea7ef21 Lint fixes
llvm-svn: 187726
2013-08-05 13:20:39 +00:00
Evgeniy Stepanov 44b77c26e4 [msan] Allocator statistics interface and malloc hooks.
llvm-svn: 187653
2013-08-02 14:26:58 +00:00
Evgeniy Stepanov 3feb17c452 [sanitizer] Tweak read syscall handler signature for consistency.
llvm-svn: 187417
2013-07-30 13:16:52 +00:00