summaryrefslogtreecommitdiff
path: root/lib/asan/asan_errors.h
Commit message (Collapse)AuthorAgeFilesLines
* Do not rely on that subject of ErrorAllocTypeMismatch is a heap address.Martin Liska2018-12-271-4/+3
| | | | | | | Differential Revision: https://reviews.llvm.org/D54856. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@350085 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASan] Linker-initialize static ScopedInErrorReport::current_error_.Alex Shlyapnikov2018-06-141-0/+1
| | | | | | | | | | | | | | | | | | | Summary: Static ScopedInErrorReport::current_error_ can be linker initialized to shave one global ctor call on application startup and be __asan_init-safe. Global constructors in ASan runtime are bad because __asan_init runs from preinit_array, before any such constructors. Issue: https://github.com/google/sanitizers/issues/194 Reviewers: eugenis, morehouse Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48141 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334748 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizers] Check alignment != 0 for aligned_alloc and posix_memalignAlex Shlyapnikov2018-06-081-0/+16
| | | | | | | | | | | | | | | Summary: Move the corresponding tests to the common folder (as all of the sanitizer allocators will support this feature soon) and add the checks specific to aligned_alloc to ASan and LSan allocators. Reviewers: vitalybuka Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D47924 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334316 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASan] NFC: make use of a new ErrorBase ctorAlex Shlyapnikov2018-04-091-117/+71
| | | | | | | | | | | | | | | Summary: Minor style changes to complement D44404: - make use of a new ErrorBase ctor - de-duplicate a comment about VS2013 support Reviewers: eugenis Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D45390 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@329586 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASan] Report proper ASan error on allocator failures instead of CHECK(0)-ingAlex Shlyapnikov2018-03-281-0/+110
| | | | | | | | | | | | | | | | | | Summary: Currently many allocator specific errors (OOM, for example) are reported as a text message and CHECK(0) termination, not stack, no details, not too helpful nor informative. To improve the situation, ASan detailed errors were defined and reported under the appropriate conditions. Issue: https://github.com/google/sanitizers/issues/887 Reviewers: eugenis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44404 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328722 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizers] ASan: detect new/delete calls with mismatched alignment.Alex Shlyapnikov2017-10-251-7/+9
| | | | | | | | | | | | | | | | | | | | ASan allocator stores the requested alignment for new and new[] calls and on delete and delete[] verifies that alignments do match. The representable alignments are: default alignment, 8, 16, 32, 64, 128, 256 and 512 bytes. Alignments > 512 are stored as 512, hence two different alignments > 512 will pass the check (possibly masking the bug), but limited memory requirements deemed to be a resonable tradeoff for relaxed conditions. The feature is controlled by new_delete_type_mismatch flag, the same one protecting new/delete matching size check. Differential revision: https://reviews.llvm.org/D38574 Issue: https://github.com/google/sanitizers/issues/799 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316595 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Remove ErrorStackOverflowVitaly Buka2017-09-141-27/+13
| | | | | | | | | | | | | | | | 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
* [compiler-rt] Use SignalContext in ErrorStackOverflow and ErrorDeadlySignalVitaly Buka2017-09-131-29/+9
| | | | | | | | | | | | Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl, filcab Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37793 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313168 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Add siginfo into SignalContextVitaly Buka2017-09-131-2/+2
| | | | | | | | | | | | | | | 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
* [asan] Provide bug descriptions for all reports (not just ErrorGeneric)Kuba Mracek2016-11-281-3/+15
| | | | | | | | Differential Revision: https://reviews.llvm.org/D27012 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288065 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Reify ErrorGenericFilipe Cabecinhas2016-09-211-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Finish work on PR30351 (last one, after D24551, D24552, and D24554 land) Also replace the old ReportData structure/variable with the current_error_ static member of the ScopedInErrorReport class. This has the following side-effects: - Move ASAN_ON_ERROR(); call to the start of the destructor, instead of in StartReporting(). - We only generate the error structure after the ScopedInErrorReport constructor finishes, so we can't call ASAN_ON_ERROR() during the constructor. I think this makes more sense, since we end up never running two of the ASAN_ON_ERROR() callback. This also works the same way as error reporting, since we end up having a lock around it. Otherwise we could end up with the ASAN_ON_ERROR() call for error 1, then the ASAN_ON_ERROR() call for error 2, and then lock the mutex for reporting error 1. - The __asan_get_report_* functions will be able to, in the future, provide information about other errors that aren't a "generic error". But we might want to rethink that API, since it's too restricted. Ideally we teach lldb about the current_error_ member of ScopedInErrorReport. Reviewers: vitalybuka, kcc, eugenis Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D24555 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282107 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Store full AddressDescription objects in ErrorInvalidPointerPairFilipe Cabecinhas2016-09-211-4/+11
| | | | | | | | | | Reviewers: kcc, vitalybuka, eugenis Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D24777 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282102 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Reify ErrorInvalidPointerPairFilipe Cabecinhas2016-09-151-1/+13
| | | | | | | | | | | | Summary: Continue work on PR30351 Reviewers: vitalybuka, kcc, eugenis Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D24554 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281593 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Reify ErrorODRViolationFilipe Cabecinhas2016-09-151-12/+29
| | | | | | | | | | | | Summary: Continue work on PR30351 Reviewers: vitalybuka, kcc, eugenis Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D24552 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281592 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Reify ErrorBadParamsToAnnotateContiguousContainerFilipe Cabecinhas2016-09-151-1/+23
| | | | | | | | | | | | Summary: Continue work on PR30351 Reviewers: vitalybuka, kcc, eugenis Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D24551 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281591 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Reify ErrorStringFunctionSizeOverflowFilipe Cabecinhas2016-09-141-1/+22
| | | | | | | | | | | | Summary: Continuing implementation mentioned in this thread: http://lists.llvm.org/pipermail/llvm-dev/2016-July/101933.html Reviewers: kcc, eugenis, vitalybuka Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D24394 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281444 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Reify ErrorStringFunctionMemoryRangesOverlapFilipe Cabecinhas2016-09-141-9/+38
| | | | | | | | | | | | Summary: Continuing implementation mentioned in this thread: http://lists.llvm.org/pipermail/llvm-dev/2016-July/101933.html Reviewers: kcc, eugenis, vitalybuka Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D24393 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281443 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Reify ErrorSanitizerGetAllocatedSizeNotOwnedFilipe Cabecinhas2016-09-131-1/+19
| | | | | | | | | | | | Summary: Continuing implementation mentioned in this thread: http://lists.llvm.org/pipermail/llvm-dev/2016-July/101933.html Reviewers: kcc, eugenis, vitalybuka Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D24392 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281392 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Reify ErrorMallocUsableSizeNotOwnedFilipe Cabecinhas2016-09-131-1/+18
| | | | | | | | | | | | Summary: Continuing implementation mentioned in this thread: http://lists.llvm.org/pipermail/llvm-dev/2016-July/101933.html Reviewers: kcc, eugenis, vitalybuka Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D24391 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281391 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Reify ErrorAllocTypeMismatchFilipe Cabecinhas2016-09-131-1/+23
| | | | | | | | | | | | Summary: Continuing implementation mentioned in this thread: http://lists.llvm.org/pipermail/llvm-dev/2016-July/101933.html Reviewers: kcc, eugenis, vitalybuka Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D24390 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281390 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Reify ErrorFreeNotMallocedFilipe Cabecinhas2016-09-131-1/+19
| | | | | | | | | | | | Summary: Continuing implementation mentioned in this thread: http://lists.llvm.org/pipermail/llvm-dev/2016-July/101933.html Reviewers: kcc, eugenis, vitalybuka Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D24389 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281389 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Ease dealing with tagged enum ErrorDescription with some macros.Filipe Cabecinhas2016-09-121-32/+27
| | | | | | | | | | | | | | | Summary: Added a macro to enumerate the (error name, error member name) pairs. This way, when adding an error, we only need to add the pair to one place (plus add its implementation, or course). Reviewers: kcc, samsonov Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D23875 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281237 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Cleanup: Move tid into ErrorBase, add const to BufferedStackTrace, be ↵Filipe Cabecinhas2016-09-121-21/+20
| | | | | | | | | | | | | | | | consistent in constructor arguments and member order. Summary: As mentioned in D24394, I'm moving tid to ErrorBase, since basically all errors need it. Also mentioned in the same review are other cleanups like adding const to BufferedStackTrace and make sure constructor orders are consistent. Reviewers: vitalybuka, kcc, eugenis Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D24455 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281236 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Reify ErrorDeadlySignalFilipe Cabecinhas2016-09-081-0/+50
| | | | | | | | | | | | 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
* [asan] Reify ErrorNewDeleteSizeMismatchFilipe Cabecinhas2016-09-071-0/+27
| | | | | | | | | | | | Summary: Keep reifying other errors. Reviewers: kcc, samsonov Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D23874 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280812 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove extra scariness.Clear() call.Filipe Cabecinhas2016-09-011-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280372 91177308-0d34-0410-b5e6-96231b3b80d8
* Clear scariness score when initializing ErrorDoubleFreeFilipe Cabecinhas2016-09-011-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280363 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the use of unitialized value while reporting double free in ASAN.Ivan Krasin2016-08-311-0/+1
| | | | | | | | | | | | | | | | Summary: This is a follow up to https://reviews.llvm.org/rL280201 where this issue was introduced. ASAN tests failed: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/25219/steps/run%20asan%20tests/logs/stdio Reviewers: filcab Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D24109 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280325 91177308-0d34-0410-b5e6-96231b3b80d8
* Reify ErrorDoubleFreeFilipe Cabecinhas2016-08-311-0/+25
| | | | | | | | | | | | Summary: Keep reifying other errors. Reviewers: kcc, samsonov Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D23717 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280201 91177308-0d34-0410-b5e6-96231b3b80d8
* Start reifying error descriptions (Re-do of D23672 supporting VS2013)Filipe Cabecinhas2016-08-301-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: @kcc: I know you've accepted the other revision, but since this is a non-trivial change, I'm updating it to show why D24029 would help. This commit sets up the infrastructure to use reified error descriptions, and moves ReportStackOverflow to the new system. After we convert all the errors, we'll be able to simplify ScopedInErrorReport and remove the older debugging mechanism which had some errors partly reified in some way. We'll be able to maintain the external API. ScopedInErrorReport will be able to track one of the reified errors at a time. The purpose of this is so we have its destructor actually print the error and possibly interface with the debugger (will depend on the platform, of course). Reviewers: kcc, samsonov, timurrrr Subscribers: kcc, llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D24030 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280111 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Start reifying error descriptions. Second try: Try to appease Visual ↵Filipe Cabecinhas2016-08-281-74/+0
| | | | | | | | | Studio." This reverts r279931. Will try it with the same Visual Studio version before committing again. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279932 91177308-0d34-0410-b5e6-96231b3b80d8
* Start reifying error descriptions. Second try: Try to appease Visual Studio.Filipe Cabecinhas2016-08-281-0/+74
| | | | | | | | | | | | | | | | | | | | | | Summary: This commit sets up the infrastructure to use reified error descriptions, and moves ReportStackOverflow to the new system. After we convert all the errors, we'll be able to simplify ScopedInErrorReport and remove the older debugging mechanism which had some errors partly reified in some way. We'll be able to maintain the external API. ScopedInErrorReport will be able to track one of the reified errors at a time. The purpose of this is so we have its destructor actually print the error and possibly interface with the debugger (will depend on the platform, of course). Reviewers: kcc, samsonov, timurrrr Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D23672 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279931 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Start reifying error descriptions"Filipe Cabecinhas2016-08-261-78/+0
| | | | | | This reverts r279862 to investigate VS failures. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279865 91177308-0d34-0410-b5e6-96231b3b80d8
* Start reifying error descriptionsFilipe Cabecinhas2016-08-261-0/+78
Summary: This commit sets up the infrastructure to use reified error descriptions, and moves ReportStackOverflow to the new system. After we convert all the errors, we'll be able to simplify ScopedInErrorReport and remove the older debugging mechanism which had some errors partly reified in some way. We'll be able to maintain the external API. ScopedInErrorReport will be able to track one of the reified errors at a time. The purpose of this is so we have its destructor actually print the error and possibly interface with the debugger (will depend on the platform, of course). Reviewers: kcc, samsonov, timurrrr Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D23672 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279862 91177308-0d34-0410-b5e6-96231b3b80d8