summaryrefslogtreecommitdiff
path: root/lib/asan/asan_posix.cc
AgeCommit message (Collapse)Author
2017-11-10[sanitizer] Remove unused <signal.h> which conflicts with asan declarationsVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317871 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18[asan] Remove ScopedDeadlySignalVitaly Buka
This is used only to make fast = true in GetStackTraceWithPcBpAndContext on SANITIZER_FREEBSD and SANITIZER_NETBSD and can be done explicitly. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313517 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-14[asan] Remove ErrorStackOverflowVitaly Buka
Summary: The only difference from ErrorDeadlySignal is reporting code and it lives in sanitizer common. Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl, filcab Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D37868 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313309 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-14[sanitizer] Move IsStackOverflow into SignalContextVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313227 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-14[compiler-rt] Cleanup SignalContext initializationVitaly Buka
Reviewers: eugenis, alekseyshl Subscribers: kubamracek, dberris Differential Revision: https://reviews.llvm.org/D37827 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313223 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-13[compiler-rt] Add siginfo into SignalContextVitaly Buka
Summary: Information stored there is often been passed along with SignalContext. Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37792 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313167 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-13[compiler-rt] Move *Sanitizer:DEADLYSIGNAL printing into common partVitaly Buka
Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37764 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313115 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-12[compiler-rt] Move IsStackOverflow from asan into sanitizer_commonVitaly Buka
Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D37536 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312987 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-12Revert "[compiler-rt] Move IsStackOverflow from asan into sanitizer_common"Vitaly Buka
Windows is broken. This reverts commit r312951 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312984 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-11[compiler-rt] Move IsStackOverflow from asan into sanitizer_commonVitaly Buka
Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D37536 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312951 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-09[asan] Use more generic string in error messageVitaly Buka
Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D37609 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312858 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05fix trivial typos in comments; NFCHiroshi Inoue
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@307124 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02[sanitizer] Move DescribeSignalOrException to sanitizer_common.Marcos Pividori
Differential Revision: https://reviews.llvm.org/D29459 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293956 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-08[asan] Handle SIGBART signal description. (found by buildbot)Filipe Cabecinhas
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280934 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-08[asan] Reify ErrorDeadlySignalFilipe Cabecinhas
Summary: Keep reifying other errors. Reviewers: kcc, samsonov Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D23873 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280930 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07[sanitizer] Fix a conflict between abort_on_error and handle_abort.Evgeniy Stepanov
Reset the SIGABRT signal handler before calling abort(). Also, change the error message when catching SIGABRT to say "ABRT" instead of "SEGV". git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280885 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27[sanitizers] introduce __sanitizer_set_report_fd so that we can re-route the ↵Kostya Serebryany
sanitizer logging to another fd from inside the process git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271046 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18[asan] [SystemZ] Add slop for stack address detection.Marcin Koscielnicki
On s390, siginfo reports the faulting address with page granularity - we need to mask off the low bits of sp before comparison. Differential Revision: http://reviews.llvm.org/D19112 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@266593 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-15[asan] add option: handle_sigillKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@255588 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-06[sanitizer] 2-nd attempt. Add the flag handle_sigfpe that is default true to ↵Kostya Serebryany
handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski. This time the test is enabled only on x86-64 (it broke on ARM) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@244234 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-06Revert "[sanitizer] Add the flag handle_sigfpe that is default true to ↵Renato Golin
handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski" This reverts commit r244136, it was breaking the ARM bots for too long. We should investigate it offline. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@244210 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05[sanitizer] Add the flag handle_sigfpe that is default true to handle SIGFPE ↵Kostya Serebryany
crashes same as SIGSEV crashes, patch by Karl Skomski git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@244136 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09Use WriteToFile instead of internal_write in non-POSIX codeTimur Iskhodzhanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@234487 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02asan: fix signal handling during stoptheworldDmitry Vyukov
The problem is that without SA_RESTORER flag, kernel ignores the handler. So tracer actually did not setup any handler. Add SA_RESTORER flag when setting up handlers. Add a test that causes SIGSEGV in stoptheworld callback. Move SignalContext from asan to sanitizer_common to print better diagnostics about signal in the tracer thread. http://reviews.llvm.org/D8005 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@230978 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25[Asan] Pack signal context into a structureViktor Kutuzov
Differential Revision: http://reviews.llvm.org/D6148 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@222756 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-15As a follow up to r222001, Peter Bergner pointed out that there isJay Foad
nothing 64-bit-specific about the PowerPC stack overflow detection. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@222084 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14[ASan] Improved stack overflow detection for PowerPC64Jay Foad
Summary: AsanOnSIGSEGV has some heuristics for detecting stack overflow, but they don't cope with a PowerPC store-with-update instruction which modifies sp and stores to the modified address in one instruction. This patch adds some PowerPC-specific code to check for this case. This fixes the last few cases of the stack-overflow test. Reviewers: kcc, samsonov, eugenis Reviewed By: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6253 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@222001 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-10[Sanitizers] Enable stack traces on FreeBSDViktor Kutuzov
Differential Revision: http://reviews.llvm.org/D6086 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221595 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-08[ASan] Fix stack-overflow test for PowerPCJay Foad
Summary: Tweak the asan stack overflow heuristics to cope with PowerPC64 redzones, which are larger than on x86-64: 288 bytes for big-endian and 512 bytes for little-endian. Reviewers: kcc, willschm, samsonov, eugenis Reviewed By: samsonov, eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6168 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221578 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-11[ASan/Win] Catch NULL derefs and page faultsTimur Iskhodzhanov
Reviewed at http://reviews.llvm.org/D4471 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212807 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04A set of trivial changes to support sanitizers on FreeBSD.Alexey Samsonov
Patch by Viktor Kutuzov! git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@202801 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-19[asan] A different way of detectinb stack overflow.Evgeniy Stepanov
Instead of checking stack limits that are not well defined for the main thread, we rely on siginfo::si_code and distance from SP. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201673 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] 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] Fix compilation.Alexander Potapenko
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@200312 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-28[ASan] Move the sigaltstack() bits to sanitizer_common.Alexander Potapenko
This change is a part of refactoring intended to have common signal handling behavior in all tools. Note that this particular change doesn't enable use_sigaltstack support in every tool. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@200310 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
2013-12-05[sanitizer] Introduce VReport and VPrintf macros and use them in sanitizer code.Sergey Matveev
Instead of "if (common_flags()->verbosity) Report(...)" we now have macros. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@196497 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-15tsan: move verbosity flag to CommonFlagsDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@192701 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-14[asan] Improve thread lifetime tracking on POSIX systems.Sergey Matveev
Call AsanThread::Destroy() from a late-running TSD destructor. Previously we called it before any user-registered TSD destructors, which caused false positives in LeakSanitizer. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@192585 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-05[sanitizer] found a bug by code inspection: CHECK(a=b) instead of ↵Kostya Serebryany
CHECK(a==b). Was puzzled why lint did not catch it. Turns out this check was disabled for asan source. fix all cases and enable the check git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@178872 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03[ASan] Kill the remainders of platform defines in favor of SANITIZER_ definesAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@178629 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-21[ASan] Switch ASan to generic ThreadRegistry from sanitizer_common. Delete ↵Alexey Samsonov
ASan-specific AsanThreadRegistry. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177634 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-20[ASan] Move GetCurrentThread/SetCurrentThread from AsanThreadRegistry class ↵Alexey Samsonov
into plain functions: they don't actually use registry git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177501 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19[sanitizer] Replace more platform checks with SANITIZER_ constants.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177400 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-23[ASan] intercept swapcontext on Linux onlyAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@168509 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-23[ASan] Add interceptor for swapcontext to fight with false positives in some ↵Alexey Samsonov
of its use cases. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@168508 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09[ASan] Create new files asan_report.{h,cc} as a preparation for refactoring ↵Alexey Samsonov
of ASan error reporting code. Currently ASan reports many kinds of errors, and the code that actually prints error messages can be found inside allocator, OS-specific files, interceptors code etc. An example of maintenance troubles this situation causes: There is currently an ASan interface function that registers callback which should take the char buffer with error report printed by ASan. This function is now broken, as one has to insert callback calls to all the places in ASan code where the error reports are printed, surprisingly it is not only "__asan_report_error" function... git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@161568 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-09[ASan] Use common flags parsing machinery.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@159933 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-15[Sanitizer] move ShadowRangeIsAvailable and several defines to common runtimeAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@158499 91177308-0d34-0410-b5e6-96231b3b80d8