summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/asan_errors.h
Commit message (Collapse)AuthorAgeFilesLines
* Reland "[ASan] Do not misrepresent high value address dereferences as null ↵Julian Lettner2019-10-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | dereferences" Updated: Removed offending TODO comment. Dereferences with addresses above the 48-bit hardware addressable range produce "invalid instruction" (instead of "invalid access") hardware exceptions (there is no hardware address decoding logic for those bits), and the address provided by this exception is the address of the instruction (not the faulting address). The kernel maps the "invalid instruction" to SEGV, but fails to provide the real fault address. Because of this ASan lies and says that those cases are null dereferences. This downgrades the severity of a found bug in terms of security. In the ASan signal handler, we can not provide the real faulting address, but at least we can try not to lie. rdar://50366151 Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D68676 > llvm-svn: 374265 llvm-svn: 374384
* Revert "[ASan] Do not misrepresent high value address dereferences as null ↵Russell Gallop2019-10-101-2/+1
| | | | | | | | | | dereferences" As it was breaking bots running sanitizer lint check This reverts r374265 (git b577efe4567f1f6a711ad36e1d17280dd1c4f009) llvm-svn: 374308
* [ASan] Do not misrepresent high value address dereferences as null dereferencesJulian Lettner2019-10-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | Dereferences with addresses above the 48-bit hardware addressable range produce "invalid instruction" (instead of "invalid access") hardware exceptions (there is no hardware address decoding logic for those bits), and the address provided by this exception is the address of the instruction (not the faulting address). The kernel maps the "invalid instruction" to SEGV, but fails to provide the real fault address. Because of this ASan lies and says that those cases are null dereferences. This downgrades the severity of a found bug in terms of security. In the ASan signal handler, we can not provide the real faulting address, but at least we can try not to lie. rdar://50366151 Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D68676 llvm-svn: 374265
* [asan] clang-format parent patchVitaly Buka2019-05-211-3/+3
| | | | llvm-svn: 361305
* [asan] Replace assignments with internal_memcpy ErrorDescriptionVitaly Buka2019-05-211-2/+4
| | | | | | For consistency with nearby code and to avoid interceptors during reports. llvm-svn: 361304
* [sanitizer] Implement reallocarray.Evgeniy Stepanov2019-05-011-0/+16
| | | | | | | | | | | | | | | | Summary: It's a cross of calloc and realloc. Sanitizers implement calloc-like check for size overflow. Reviewers: vitalybuka, kcc Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61108 llvm-svn: 359708
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* 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. llvm-svn: 350085
* [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 llvm-svn: 334748
* [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 llvm-svn: 334316
* [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 llvm-svn: 329586
* [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 llvm-svn: 328722
* [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 llvm-svn: 316595
* [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 llvm-svn: 313309
* [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 llvm-svn: 313168
* [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 llvm-svn: 313167
* [asan] Provide bug descriptions for all reports (not just ErrorGeneric)Kuba Mracek2016-11-281-3/+15
| | | | | | Differential Revision: https://reviews.llvm.org/D27012 llvm-svn: 288065
* [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 llvm-svn: 282107
* [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 llvm-svn: 282102
* [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 llvm-svn: 281593
* [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 llvm-svn: 281592
* [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 llvm-svn: 281591
* [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 llvm-svn: 281444
* [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 llvm-svn: 281443
* [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 llvm-svn: 281392
* [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 llvm-svn: 281391
* [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 llvm-svn: 281390
* [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 llvm-svn: 281389
* [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 llvm-svn: 281237
* [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 llvm-svn: 281236
* [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 llvm-svn: 280930
* [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 llvm-svn: 280812
* Remove extra scariness.Clear() call.Filipe Cabecinhas2016-09-011-1/+0
| | | | llvm-svn: 280372
* Clear scariness score when initializing ErrorDoubleFreeFilipe Cabecinhas2016-09-011-0/+1
| | | | llvm-svn: 280363
* 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 llvm-svn: 280325
* 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 llvm-svn: 280201
* 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 llvm-svn: 280111
* 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. llvm-svn: 279932
* 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 llvm-svn: 279931
* Revert "Start reifying error descriptions"Filipe Cabecinhas2016-08-261-78/+0
| | | | | | This reverts r279862 to investigate VS failures. llvm-svn: 279865
* 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 llvm-svn: 279862
OpenPOWER on IntegriCloud