Commit Graph

50 Commits

Author SHA1 Message Date
Sagar Thakur 7bec3a94c6 [LSAN] Fix test swapcontext.cc on MIPS
There is no frame validity check in the slow unwinder like there is in the fast unwinder due to which lsan reports a leak even for heap allocated coroutine in the test swapcontext.cc. Since mips/linux uses slow unwindwer instead of fast unwinder, the test fails for mips/linux. Therefore adding the checks before unwinding fixes the test for mips/linux.

Reviewed by aizatsky.
Differential: http://reviews.llvm.org/D19961

llvm-svn: 269882
2016-05-18 06:09:26 +00:00
Renato Golin e48f7e6f2d Revert "[LSAN] Fix test swapcontext.cc on MIPS"
This reverts commit r266716, as it breaks the self-hosting on Thumb2 buildbot.

llvm-svn: 267158
2016-04-22 14:56:30 +00:00
Sagar Thakur 2e17dd5882 [LSAN] Fix test swapcontext.cc on MIPS
Summary: There is no frame validity check in the slow unwinder like there is in the fast unwinder due to which lsan reports a leak even for heap allocated coroutine in the test swapcontext.cc. Since mips/linux uses slow unwindwer instead of fast unwinder, the test fails for mips/linux. Therefore adding the checks before unwinding fixes the test for mips/linux.

Reviewers: samsonov, earthdok, kcc
Subscribers: llvm-commits, mohit.bhakkad, jaydeep
Differential: http://reviews.llvm.org/D18690
llvm-svn: 266716
2016-04-19 06:00:35 +00:00
Alexander Potapenko b6a2537c60 [libsanitizer] Fix bugs and wiki links to point to GitHub.
llvm-svn: 254738
2015-12-04 17:50:03 +00:00
Adhemerval Zanella 19074450ee [MSan] Enable MSAN for aarch64
This patch enabled msan for aarch64 with 39-bit VMA and 42-bit VMA.
As defined by lib/msan/msan.h the memory layout used is for 39-bit is:

   00 0000 0000 - 40 0000 0000:  invalid
   40 0000 0000 - 43 0000 0000:  shadow
   43 0000 0000 - 46 0000 0000:  origin
   46 0000 0000 - 55 0000 0000:  invalid
   55 0000 0000 - 56 0000 0000:  app (low)
   56 0000 0000 - 70 0000 0000:  invalid
   70 0000 0000 - 80 0000 0000:  app (high)

And for 42-bit VMA:

   000 0000 0000 - 100 0000 0000:  invalid
   100 0000 0000 - 11b 0000 0000:  shadow
   11b 0000 0000 - 120 0000 0000:  invalid
   120 0000 0000 - 13b 0000 0000:  origin
   13b 0000 0000 - 2aa 0000 0000:  invalid
   2aa 0000 0000 - 2ab 0000 0000:  app (low)
   2ab 0000 0000 - 3f0 0000 0000:  invalid
   3f0 0000 0000 - 400 0000 0000:  app (high)

Most of tests are passing with exception of:

   * Linux/mallinfo.cc
   * chained_origin_limits.cc
   * dlerror.cc
   * param_tls_limit.cc
   * signal_stress_test.cc
   * nonnull-arg.cpp

The 'Linux/mallinfo.cc' is due the fact AArch64 returns the sret in 'x8'
instead of default first argument 'x1'.  So a function prototype that
aims  to mimic (by using first argument as the return of function) won't
work. For GCC one can make a register alias (register var asm ("r8")), but
for clang it detects is an unused variable and generate wrong code.

The 'chained_origin_limits' is probably due a wrong code generation,
since it fails only when origin memory is used
(-fsanitize-memory-track-origins=2) and only in the returned code
(return buf[50]).

The 'signal_streess_test' and 'nonnull-arg' are due currently missing variadic
argument handling in memory sanitizer code instrumentation on LLVM side.

Both 'dlerror' and 'param_tls_test' are unknown failures that require
further investigation.

All the failures are XFAIL for aarch64 for now.

llvm-svn: 247809
2015-09-16 15:12:25 +00:00
Bill Schmidt a32fa81c09 PowerPC's ABIs differ from those of other architectures in that the
callee-saved return address is stored in the caller's stack frame, not
the callee's.  This patch adjusts the logic to find the LR in the
correct place for PowerPC.

Patch joint with Bill Seurer.

llvm-svn: 243467
2015-07-28 19:41:49 +00:00
Evgeniy Stepanov d38af30b74 [msan] Better use-after-free reports.
By attaching an extra integer tag to heap origins, we are able
to distinguish between uninits
 - created by heap allocation,
 - created by heap deallocation (i.e. use-after-free),
 - created by __msan_allocated_memory call,
 - etc.

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

llvm-svn: 226821
2015-01-22 13:33:16 +00:00
Kostya Serebryany baae9d2df1 [sanitizer] fix a performance regression in sanitizer coverage: move a small perf-critical function to a header. ALso set the coverage guard to 1 before the early return from CoverageData::Add
llvm-svn: 224660
2014-12-20 01:45:28 +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
Viktor Kutuzov dc6cbfe859 [Sanitizers] Enable stack traces on FreeBSD
Differential Revision: http://reviews.llvm.org/D6086

llvm-svn: 221595
2014-11-10 15:22:04 +00:00
Alexey Samsonov 40733a8024 [TSan] Use StackTrace from sanitizer_common where applicable
Summary:
This change removes `__tsan::StackTrace` class. There are
now three alternatives:
  # Lightweight `__sanitizer::StackTrace`, which doesn't own a buffer
  of PCs. It is used in functions that need stack traces in read-only
  mode, and helps to prevent unnecessary allocations/copies (e.g.
  for StackTraces fetched from StackDepot).
  # `__sanitizer::BufferedStackTrace`, which stores buffer of PCs in
  a constant array. It is used in TraceHeader (non-Go version)
  # `__tsan::VarSizeStackTrace`, which owns buffer of PCs, dynamically
  allocated via TSan internal allocator.

Test Plan: compiler-rt test suite

Reviewers: dvyukov, kcc

Reviewed By: kcc

Subscribers: llvm-commits, kcc

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

llvm-svn: 221194
2014-11-03 22:23:44 +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
Alexey Samsonov 20c5c7b723 [UBSan] Get pc/bp for stack unwinding as early as possible.
This will ensure that stack frames in error reports will not
contain internal UBSan failures, and frame #0 will be the
actual place in the program where the error happens.

llvm-svn: 214245
2014-07-29 23:22:41 +00:00
Viktor Kutuzov 794d4dde48 Only use fast stack unwinding for sanitizers failure reports on FreeBSD
Differential Revision: http://reviews.llvm.org/D4420

llvm-svn: 212691
2014-07-10 09:11:15 +00:00
Kostya Serebryany c98ce28533 [sanitizer] AArch64 sanitizer support; patch by Christophe Lyon and Yvan Roux
llvm-svn: 201303
2014-02-13 07:50:20 +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 e676aadecf [asan] Enable frame pointer based unwinder on ARM.
This code works with AAPCS-style {fp, lr} frames. Unlike linux perf, it does
not unwind through code compiled with -mapcs-frame (which Clang does not
support anyway).

llvm-svn: 199725
2014-01-21 11:04:58 +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
Alexey Samsonov 3efe401db0 [Sanitizer] Delete unused StackTrace::PrintStack argument
llvm-svn: 197671
2013-12-19 11:14:26 +00:00
Richard Smith ab788cdc81 Unbreak build by adding an implementation of PopStackFrames function.
llvm-svn: 196809
2013-12-09 19:52:39 +00:00
Chandler Carruth 736f9fd229 Revert three patches which were committed without explicit contribution
by their authors.

This may break builds where others added code relying on these patches,
but please *do not* revert this commit. Instead, we will prepare patches
which fix the failures.

Reverts the following commits:
r168306: "[asan] support x32 mode in the fast stack unwinder. Patch by H.J. Lu"
r168356: "[asan] more support for powerpc, patch by Peter Bergner"
r196489: "[sanitizer] fix the ppc32 build (patch by Jakub Jelinek)"

llvm-svn: 196802
2013-12-09 19:25:51 +00:00
Alexey Samsonov a6e8322fb1 [Sanitizer] Make slow unwinder on Linux more robust
llvm-svn: 194805
2013-11-15 10:57:56 +00:00
Alexey Samsonov cf6ac12e23 [Sanitizer] Use same PC threshold in slow unwinder on all platforms
llvm-svn: 194580
2013-11-13 15:20:10 +00:00
Alexey Samsonov 9ff4598225 [ASan] Do not rely on malloc context in allocator reports.
Invoke a fatal stack trace unwinder when ASan prints allocator-relevant
error reports (double-free, alloc-dealloc-mismatch, invalid-free).
Thus we'll be able to print complete stack trace even if allocation/free
stacks are not stored (malloc_context_size=0).

Based on the patch by Yuri Gribov!

llvm-svn: 194579
2013-11-13 14:46:58 +00:00
Timur Iskhodzhanov 1f1c7ec400 [Sanitizers] Share some stack walking code between Windows and Linux
Reviewed at http://llvm-reviews.chandlerc.com/D2126

llvm-svn: 194326
2013-11-09 13:59:12 +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
Alexey Samsonov e13f775a63 [Sanitizer] Call Windows unwinder 'slow' and share StackTrace::Unwind across all platforms. No functionality change.
llvm-svn: 194193
2013-11-07 06:33:06 +00:00
Alexey Samsonov c5e1b16d0c [ASan] Kill use_stack_depot runtime flag and stack trace compression routines.
llvm-svn: 193868
2013-11-01 17:23:22 +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 a687d2593f [Sanitizer] Simplify StackTrace::PrintStack interface: prefer common flags to turn on/off the symbolization
llvm-svn: 193587
2013-10-29 05:31:25 +00:00
Alexey Samsonov c7ae7529e7 [Sanitizer] Return implementation of StackTrace::CopyFrom to header
llvm-svn: 192574
2013-10-14 07:36:10 +00:00
Alexey Samsonov 7f5823844a [Sanitizer] Remove StackTrace::max_depth field
llvm-svn: 192534
2013-10-12 12:40:47 +00:00
Alexey Samsonov c129e65661 [Sanitizer] Turn GetStackTrace() into StackTrace::Unwind()
llvm-svn: 192533
2013-10-12 12:23:00 +00:00
Alexey Samsonov 0cd96165f1 [Sanitizer] StackTrace: kill CopyTo and reimplement CopyFrom
llvm-svn: 192441
2013-10-11 11:14:20 +00:00
Alexey Samsonov 9d8385453b [Sanitizer] Simplify StackTrace::FastUnwindStack interface and fix a bug with one-frame stack traces
llvm-svn: 192428
2013-10-11 09:58:30 +00:00
Alexey Samsonov f2b811a618 Refactor the usage of strip_path_prefix option and make it more consistent across sanitizers
llvm-svn: 191943
2013-10-04 08:55:03 +00:00
Timur Iskhodzhanov eee13914e2 Define SANITIZER_INTERFACE_ATTRIBUTE on Windows and fix all the places where SANITIZER_INTERFACE_ATTRIBUTE or SANITIZER_ATTRIBUTE_WEAK are used
llvm-svn: 188261
2013-08-13 11:42:45 +00:00
Kostya Serebryany c1aa0e8f69 [asan] ASan Linux MIPS32 support (compiler-rt part), patch by Jyun-Yan Y
llvm-svn: 183105
2013-06-03 14:49:25 +00:00
Sergey Matveev af179b8d63 [sanitizer] Move GetStackTrace from ASan to sanitizer_common.
llvm-svn: 181424
2013-05-08 12:45:55 +00:00
Kostya Serebryany b4c2c5c8a6 [asan] print a short one-line report summary after the full report. Currently, works only if symbolization happens in-process.
llvm-svn: 174501
2013-02-06 12:36:49 +00:00
Alexey Samsonov f37c45c20d [Sanitizer] Expose StackTrace::GetPreviousInstructionPc() to get PC of call instruction from return address
llvm-svn: 170424
2012-12-18 09:57:34 +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
Kostya Serebryany 46de580003 [asan] more support for powerpc, patch by Peter Bergner
llvm-svn: 168356
2012-11-20 07:00:42 +00:00
Evgeniy Stepanov cb9cf0f907 Add a missing const qualifier.
llvm-svn: 164773
2012-09-27 13:21:08 +00:00
Kostya Serebryany f9caa28ccf [asan] increase max stack size to 256 (+test)
llvm-svn: 163308
2012-09-06 10:57:03 +00:00
Kostya Serebryany 3a6af66a0e [asan] fix the cmake build (hopefully)
llvm-svn: 162760
2012-08-28 14:48:28 +00:00
Kostya Serebryany 327d0a5666 [asan] actually doing 'svn add' helps
llvm-svn: 162759
2012-08-28 14:27:06 +00:00