summaryrefslogtreecommitdiff
path: root/lib/asan/asan_errors.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@317867 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09[sanitizers] Rename GetStackTraceWithPcBpAndContextVitaly Buka
Name does not need to enumerate arguments. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317774 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25[Sanitizers] ASan: detect new/delete calls with mismatched alignment.Alex Shlyapnikov
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
2017-10-25[asan] Don't print rows of shadow bytes outside shadow memoryReid Kleckner
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316589 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[sanitizer] Move stack overflow and signal reporting from Asan into common.Vitaly Buka
Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek Differential Revision: https://reviews.llvm.org/D37844 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313310 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-13[compiler-rt] Use SignalContext in ErrorStackOverflow and ErrorDeadlySignalVitaly Buka
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
2017-09-13[compiler-rt] Move dump_instruction_bytes and dump_registers into ↵Vitaly Buka
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313117 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-11[compiler-rt] Cleanup decoratorsVitaly Buka
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312950 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-07Add NetBSD support in asan_errors.ccKamil Rytarowski
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310247 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11Refactor MemoryMappingLayout::Next to use a single struct instead of output ↵Francis Ricci
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@307688 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-01Restrict usage of MemoryMappingLayout to platforms which support itFilipe Cabecinhas
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@296657 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-01Reapply r296419: [asan] Print a "PC is at a non-executable memory region" ↵Filipe Cabecinhas
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@296653 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28Revert r296419 since the strings appear to need some tweaking.Filipe Cabecinhas
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@296428 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28[asan] Print a "PC is at a non-executable memory region" message if that's ↵Filipe Cabecinhas
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@296419 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-11-28[asan] Provide bug descriptions for all reports (not just ErrorGeneric)Kuba Mracek
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
2016-11-26[asan] Add a "dump_registers" flag to print out CPU registers after a SIGSEGVKuba Mracek
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@287957 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21[asan] Reify ErrorGenericFilipe Cabecinhas
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
2016-09-21[asan] Store full AddressDescription objects in ErrorInvalidPointerPairFilipe Cabecinhas
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
2016-09-15[asan] Reify ErrorInvalidPointerPairFilipe Cabecinhas
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
2016-09-15[asan] Reify ErrorODRViolationFilipe Cabecinhas
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
2016-09-15[asan] Reify ErrorBadParamsToAnnotateContiguousContainerFilipe Cabecinhas
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
2016-09-14[asan] Reify ErrorStringFunctionSizeOverflowFilipe Cabecinhas
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
2016-09-14[asan] Reify ErrorStringFunctionMemoryRangesOverlapFilipe Cabecinhas
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
2016-09-13[asan] Reify ErrorSanitizerGetAllocatedSizeNotOwnedFilipe Cabecinhas
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
2016-09-13[asan] Reify ErrorMallocUsableSizeNotOwnedFilipe Cabecinhas
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
2016-09-13[asan] Reify ErrorAllocTypeMismatchFilipe Cabecinhas
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
2016-09-13[asan] Reify ErrorFreeNotMallocedFilipe Cabecinhas
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
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[asan] Reify ErrorNewDeleteSizeMismatchFilipe Cabecinhas
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
2016-08-31Fix buildbot bug: Wasn't printing scariness for DoubleFreeFilipe Cabecinhas
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280213 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-31Reify ErrorDoubleFreeFilipe Cabecinhas
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
2016-08-30Start reifying error descriptions (Re-do of D23672 supporting VS2013)Filipe Cabecinhas
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
2016-08-28Revert "Start reifying error descriptions. Second try: Try to appease Visual ↵Filipe Cabecinhas
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
2016-08-28Start reifying error descriptions. Second try: Try to appease Visual Studio.Filipe Cabecinhas
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
2016-08-26Revert "Start reifying error descriptions"Filipe Cabecinhas
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
2016-08-26Start reifying error descriptionsFilipe Cabecinhas
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