summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/asan_errors.cc
Commit message (Collapse)AuthorAgeFilesLines
* compiler-rt: Rename .cc file in lib/asan to .cppNico Weber2019-08-011-597/+0
| | | | | | Like r367463, but for asan. llvm-svn: 367558
* [sanitizer] Implement reallocarray.Evgeniy Stepanov2019-05-011-0/+13
| | | | | | | | | | | | | | | | 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
* [NFC][Sanitizer] Add new BufferedStackTrace::Unwind APIJulian Lettner2019-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | Retrying without replacing call sites in sanitizer_common (which might not have a symbol definition). Add new Unwind API. This is the final envisioned API with the correct abstraction level. It hides/slow fast unwinder selection from the caller and doesn't take any arguments that would leak that abstraction (i.e., arguments like stack_top/stack_bottom). GetStackTrace will become an implementation detail (private method) of the BufferedStackTrace class. Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58741 > llvm-svn: 355168 llvm-svn: 355172
* Revert "[NFC][Sanitizer] Add new BufferedStackTrace::Unwind API"Julian Lettner2019-03-011-1/+1
| | | | | | This reverts commit 6112f37e758ebf2405955e091a745f5003c1f562. llvm-svn: 355171
* [NFC][Sanitizer] Add new BufferedStackTrace::Unwind APIJulian Lettner2019-03-011-1/+1
| | | | | | | | | | | | | | | | Add new Unwind API. This is the final envisioned API with the correct abstraction level. It hides/slow fast unwinder selection from the caller and doesn't take any arguments that would leak that abstraction (i.e., arguments like stack_top/stack_bottom). GetStackTrace will become an implementation detail (private method) of the BufferedStackTrace class. Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58741 llvm-svn: 355168
* 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-3/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D54856. llvm-svn: 350085
* [ASan] Minor ASan error reporting cleanupAlex Shlyapnikov2018-07-091-60/+42
| | | | | | | | | | | | | | Summary: - use proper Error() decorator for error messages - refactor ASan thread id and name reporting Reviewers: eugenis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D49044 llvm-svn: 336573
* [Sanitizers] Remove OOM/BadRequest allocator error handling policies.Alex Shlyapnikov2018-06-201-8/+8
| | | | | | | | | | | | | | | | | | | Summary: Remove the generic error nadling policies and handle each allocator error explicitly. Although more verbose, it allows for more comprehensive, precise and actionable allocator related failure reports. This finishes up the series of changes of the particular sanitizer allocators, improves the internal allocator error reporting and removes now unused policies. Reviewers: vitalybuka, cryptoad Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48328 llvm-svn: 335147
* [Sanitizers] Check alignment != 0 for aligned_alloc and posix_memalignAlex Shlyapnikov2018-06-081-0/+22
| | | | | | | | | | | | | | | 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] Add a magic shadow value for shadw gapWalter Lee2018-05-161-0/+1
| | | | | | | | | This gives us something to insert into the shadow gap for systems that don't have memory protection turned on there (i.e. on Myriad). Differential Revision: https://reviews.llvm.org/D46457 llvm-svn: 332557
* [ASan] Report proper ASan error on allocator failures instead of CHECK(0)-ingAlex Shlyapnikov2018-03-281-0/+100
| | | | | | | | | | | | | | | | | | 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
* [sanitizer] Remove unused <signal.h> which conflicts with asan declarationsVitaly Buka2017-11-101-1/+0
| | | | llvm-svn: 317867
* [sanitizers] Rename GetStackTraceWithPcBpAndContextVitaly Buka2017-11-091-2/+1
| | | | | | Name does not need to enumerate arguments. llvm-svn: 317774
* [Sanitizers] ASan: detect new/delete calls with mismatched alignment.Alex Shlyapnikov2017-10-251-5/+23
| | | | | | | | | | | | | | | | | | | 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] Don't print rows of shadow bytes outside shadow memoryReid Kleckner2017-10-251-2/+7
| | | | | | | | | | | | | | | | | | | Summary: They might not be mapped on some platforms such as Win64. In particular, this happens if the user address is null. There will not be any shadow memory 5*16 bytes before the user address. This happens on Win64 in the error_report_callback.cc test case. It's not clear why this isn't a problem on Linux as well. Fixes PR35058 Reviewers: vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D39260 llvm-svn: 316589
* [asan] Remove ScopedDeadlySignalVitaly Buka2017-09-181-2/+8
| | | | | | | This is used only to make fast = true in GetStackTraceWithPcBpAndContext on SANITIZER_FREEBSD and SANITIZER_NETBSD and can be done explicitly. llvm-svn: 313517
* [sanitizer] Move stack overflow and signal reporting from Asan into common.Vitaly Buka2017-09-141-49/+14
| | | | | | | | | | | | Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek Differential Revision: https://reviews.llvm.org/D37844 llvm-svn: 313310
* [asan] Remove ErrorStackOverflowVitaly Buka2017-09-141-48/+48
| | | | | | | | | | | | | | | | 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-14/+19
| | | | | | | | | | | | 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] Move dump_instruction_bytes and dump_registers into ↵Vitaly Buka2017-09-131-31/+0
| | | | | | | | | | | | | | sanitizer_common Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37766 llvm-svn: 313117
* [compiler-rt] Cleanup decoratorsVitaly Buka2017-09-111-14/+14
| | | | | | | | | | | | | | Summary: Removed redundant End*() methods which defined same way. Removed redundant Warning() methods. Reviewers: eugenis Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37549 llvm-svn: 312950
* Add NetBSD support in asan_errors.ccKamil Rytarowski2017-08-071-1/+1
| | | | | | | | | | | | | | | | | | | Summary: Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas. Sponsored by <The NetBSD Foundation> Reviewers: joerg, fjricci, vitalybuka, filcab, kcc Reviewed By: vitalybuka Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D36374 llvm-svn: 310247
* Refactor MemoryMappingLayout::Next to use a single struct instead of output ↵Francis Ricci2017-07-111-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | parameters. NFC. Summary: This is the first in a series of patches to refactor sanitizer_procmaps to allow MachO section information to be exposed on darwin. In addition, grouping all segment information in a single struct is cleaner than passing it through a large set of output parameters, and avoids the need for annotations of NULL parameters for unneeded information. The filename string is optional and must be managed and supplied by the calling function. This is to allow the MemoryMappedSegment struct to be stored on the stack without causing overly large stack sizes. Reviewers: alekseyshl, kubamracek, glider Subscribers: emaste, llvm-commits Differential Revision: https://reviews.llvm.org/D35135 llvm-svn: 307688
* Restrict usage of MemoryMappingLayout to platforms which support itFilipe Cabecinhas2017-03-011-0/+2
| | | | llvm-svn: 296657
* Reapply r296419: [asan] Print a "PC is at a non-executable memory region" ↵Filipe Cabecinhas2017-03-011-0/+11
| | | | | | | | | | | | | | message if that's the case Summary: Points the user to look at function pointer assignments. Reviewers: kcc, eugenis, kubamracek Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D30432 llvm-svn: 296653
* Revert r296419 since the strings appear to need some tweaking.Filipe Cabecinhas2017-02-281-11/+0
| | | | llvm-svn: 296428
* [asan] Print a "PC is at a non-executable memory region" message if that's ↵Filipe Cabecinhas2017-02-281-0/+11
| | | | | | | | | | | | | | the case Summary: Points the user to look at function pointer assignments. Reviewers: kcc, eugenis, kubamracek Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D30432 llvm-svn: 296419
* [sanitizer] Move DescribeSignalOrException to sanitizer_common.Marcos Pividori2017-02-021-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D29459 llvm-svn: 293956
* [asan] Provide bug descriptions for all reports (not just ErrorGeneric)Kuba Mracek2016-11-281-23/+24
| | | | | | Differential Revision: https://reviews.llvm.org/D27012 llvm-svn: 288065
* [asan] Add a "dump_registers" flag to print out CPU registers after a SIGSEGVKuba Mracek2016-11-261-0/+6
| | | | | | | | This patch prints out all CPU registers after a SIGSEGV. These are available in the signal handler context. Only implemented for Darwin. Can be turned off with the dump_registers flag. Differential Revision: https://reviews.llvm.org/D11365 llvm-svn: 287957
* [asan] Reify ErrorGenericFilipe Cabecinhas2016-09-211-0/+212
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-3/+4
| | | | | | | | | | Reviewers: kcc, vitalybuka, eugenis Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D24777 llvm-svn: 282102
* [asan] Reify ErrorInvalidPointerPairFilipe Cabecinhas2016-09-151-0/+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-0/+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-0/+17
| | | | | | | | | | | | 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-0/+12
| | | | | | | | | | | | 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-0/+19
| | | | | | | | | | | | 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-0/+13
| | | | | | | | | | | | 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-0/+13
| | | | | | | | | | | | 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-0/+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-0/+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/D24389 llvm-svn: 281389
* [asan] Reify ErrorDeadlySignalFilipe Cabecinhas2016-09-081-0/+46
| | | | | | | | | | | | 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/+25
| | | | | | | | | | | | Summary: Keep reifying other errors. Reviewers: kcc, samsonov Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D23874 llvm-svn: 280812
* Fix buildbot bug: Wasn't printing scariness for DoubleFreeFilipe Cabecinhas2016-08-311-0/+1
| | | | llvm-svn: 280213
* Reify ErrorDoubleFreeFilipe Cabecinhas2016-08-311-0/+18
| | | | | | | | | | | | 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/+36
| | | | | | | | | | | | | | | | | | | | | | | | | 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-36/+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/+36
| | | | | | | | | | | | | | | | | | | | | | 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-36/+0
| | | | | | This reverts r279862 to investigate VS failures. llvm-svn: 279865
OpenPOWER on IntegriCloud