summaryrefslogtreecommitdiff
path: root/lib/asan/asan_rtl.cc
AgeCommit message (Collapse)Author
2014-12-12[Sanitizer] Introduce Allocator::may_return_null bool flag.Alexey Samsonov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224148 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-12[ASan] Group all flag parsing code together. NFC.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224087 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05Implement AddressSanitizer suppressions.Kuba Brecka
Adds 3 new suppression types, "interceptor_name", "interceptor_via_fun", "interceptor_via_lib". Reviewed at http://reviews.llvm.org/D6280. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@223508 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05[ASan] Refactor thread starting code.Sergey Matveev
Move thread context creation into AsanThread::Create(). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@223483 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05[ASan, LSan] Improve tracking of thread creation.Sergey Matveev
In the current scheme of things, the call to ThreadStart() in the child thread is not synchronized with the parent thread. So, if a pointer is passed to pthread_create, there may be a window of time during which this pointer will not be discoverable by LSan. I.e. the pthread_create interceptor has already returneed and thus the pointer is no longer on the parent stack, but we don't yet know the location of the child stack. This has caused bogus leak reports (see http://llvm.org/bugs/show_bug.cgi?id=21621/). This patch makes the pthread_create interceptor wait until the child thread is properly registered before returning. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@223419 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25[asan] Improvements for asan deactivated mode: disable asan activation for ↵Yury Gribov
runtime library on Linux, disable malloc checks. Reviewed in http://reviews.llvm.org/D6265 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@222732 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-14[asan] Add fast_unwind_on_check flag.Evgeniy Stepanov
Allows to specify the unwinder to use for CHECK failures. Previous behaviour was to use the "fatal" unwinder. As compiler-rt is built without frame pointers, only the slow unwinder really makes sense here, and it is the default. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@219677 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-22[ASan] Introduce the dump_instruction_bytes flag to print the faulting ↵Alexander Potapenko
instruction upon SIGSEGV When dump_instruction_bytes=1 and the instruction pointer doesn't point to the zero page, ASan prints 16 bytes starting at the instruction point. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@218243 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-15[asan] Delay system log initialization on Android.Evgeniy Stepanov
Writing to system log requires libc interceptors to be initialized. Fixes crashes with verbosity=1 on newer Android builds. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@217764 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-10[Sanitizer] Get rid of Symbolizer::Get() and Symbolizer::GetOrNull().Alexey Samsonov
We may as well just use Symbolizer::GetOrInit() in all the cases. Don't call Symbolizer::Get() early in tools initialization: these days it doesn't do any important setup work, and we may as well create the symbolizer the first time it's actually needed. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@217558 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-29[asan] enable poison_array_cookie backKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@216705 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-28[asan] disable poison_array_cookie while I am investigating a false positive ↵Kostya Serebryany
on chromium (I suspect that LLVM looses nosanitizer metadata; no test yet) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@216684 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-18[LSan] Parse common flags from LSAN_OPTIONS even if LSan is combined withAlexey Samsonov
another sanitizer. A user may run both LSan and LSan+ASan. It is weird to pass path to leak suppression file (or other common sanitizer flags, like "verbosity") in "LSAN_OPTIONS" in the first case and in "ASAN_OPTIONS" in the second case. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@215949 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-12[TSan] Share the code the setup code calling getrlim/setrlim with ↵Alexey Samsonov
sanitizer_common git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@215481 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-12[Sanitizer] Make disable_coredump a common flag and use it in TSanAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@215479 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-12[Sanitizer] Kill deprecated allocator interfaces in ASan, MSan and TSan in ↵Alexey Samsonov
favor of a unified interface in <sanitizer/allocator_interface.h>. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@215469 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-04[asan] introduce __asan_poison_cxx_array_cookie. This is asan-rt part of ↵Kostya Serebryany
PR19838 (Left OOB accesses on new[]-allocated arrays with array cookies are not detected). No tests yet. They will follow once I commit the clang part. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@214711 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-30[asan] rename new-delete-size-mismatch to new-delete-type-mismatch and make ↵Kostya Serebryany
the report more verbose git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@214299 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-30[asan] add a feature to detect new-delete-size-mismatch (when used with ↵Kostya Serebryany
-Xclang -fsized-deallocation). Not yet on Mac. Also, remove some unused code. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@214296 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-26[Sanitizer] Simplify Symbolizer creation interface.Alexey Samsonov
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@214005 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-11[asan] fix x32 build, patch by H.J. LuKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212823 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-03[asan] enable detect_odr_violation=2; ↵Kostya Serebryany
https://code.google.com/p/address-sanitizer/wiki/OneDefinitionRuleViolation . This feature has been working quite well so far, found a few bugs and zero false positives. The main problem is that there could be lots of true positives and users will have to disable this checking until the bugs are fixed. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@210106 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-15Fix typosAlp Toker
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208841 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-14[asan] use some LIKELY/UNLIKELYKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208776 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-14[asan] Respect personality in kernel area detector, patch by Yuri GribovKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208760 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-12[ASan] Split static ASan runtime in two parts: asan and asan_cxx.Alexey Samsonov
asan_cxx containts replacements for new/delete operators, and should only be linked in C++ mode. We plan to start building this part with exception support to make new more standard-compliant. See https://code.google.com/p/address-sanitizer/issues/detail?id=295 for more details. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208609 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-12[ASan] Add references to the issue tracker about malloc/free/new/delete ↵Timur Iskhodzhanov
mismatch check on Mac and Windows git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208574 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-12[asan] Move the "coverage" flag to common flags.Sergey Matveev
The implementation lives in sanitizer_common and will need to access that flag. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208566 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-12[asan] one more attempt to enable lsan by default (PR19521)Kostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208545 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-06[ASan/Win] Don't crash when ASAN_OPTIONS have disable_core=1Timur Iskhodzhanov
Reviewed at http://reviews.llvm.org/D3610 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208070 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-30[asan] make AsanCoverage lock-free (and AS-safe)Kostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@207630 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-28[asan] split detect_odr_violation into two: =2 detects all ODR violations, ↵Kostya Serebryany
=1 detects only those where the variable sizes are different. BTW, the detector seems to be working well and finding nice bugs. Early adopters are welcome. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@207415 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-25[asan] implement an experimental detector of ODR violations. Not tested yet ↵Kostya Serebryany
outside of a tiny test, may need tuning. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@207210 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-23[asan] disable lsan back. :( -- It appears that quite a few lit tests have ↵Kostya Serebryany
leaks and they were not covered by out buildbot git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206955 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-22[asan] enable LeakSanitizer (LSan) by default in asan. This only affects ↵Kostya Serebryany
Linux x86_64. LSan has been used in various projects for more than half a year and we now consider it quite stable to be on by default. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206896 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-21[asan] add a run-time flag detect_container_overflow=true/falseKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206753 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-21[asan] implement __asan_loadN/__asan_storeN for out-lined asan checksKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206733 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-17[asan] fix a bug in outlined asan checks and in the corresponding test (ouch)Kostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206470 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-16[asan] add __asan_load1/__asan_store1/... callbacks to asan-rt; together ↵Kostya Serebryany
with -mllvm -asan-instrumentation-with-call-threshold=N this will be a workaround for PR17409 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206387 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-14[asan] added internal flag mmap_limit_mbKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206178 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-04[asan] fix a leak in __tls_get_addr handler; introduce a run-time flag to ↵Kostya Serebryany
disable this handler completely; remove a workaround for a bug fixed in glibc git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@205617 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-01[ASan] Optional support for dynamic ASan runtime on Linux.Alexey Samsonov
Based on http://llvm-reviews.chandlerc.com/D3042 by Yuri Gribov! git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@205308 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-27[asan] Do not sanitize kernel area on 32-bit targets, patch by Yuri GribovKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204897 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21[ASan] Move the flag descriptions from comments to ParseFlag arguments.Alexander Potapenko
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204440 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-20[libsanitizer] Introduce flag descriptions.Alexander Potapenko
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204339 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-27[asan] *experimental* implementation of invalid-pointer-pair detector (finds ↵Kostya Serebryany
when two unrelated pointers are compared or subtracted). This implementation has both false positives and false negatives and is not tuned for performance. A bug report for a proper implementation will follow. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@202389 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-11[sanitizer] Use system unwinder in signal handlers on Android.Evgeniy Stepanov
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201151 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-31[asan] Read extra flags from a system property on activation on Android.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@200550 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-31[ASan] Move the SIGSEGV/SIGBUS handling to sanitizer_commonAlexander Potapenko
This change is a part of refactoring intended to have common signal handling behavior in all tools. This particular CL moves InstallSignalHandlers() into sanitizer_common (making it InstallDeadlySignalHandlers()), but doesn't enable default signal handlers for any tool other than ASan. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@200542 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-28[ASan] Move the signal handling-related flags to sanitizer_common.Alexander Potapenko
This change is a part of refactoring intended to have common signal handling behavior in all tools. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@200295 91177308-0d34-0410-b5e6-96231b3b80d8