-
Couldn't load subscription status.
- Fork 15k
[scudo] Add specific die functions for linux specific failures. #68650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d73d324
[scudo] Add specific Report functions for linux specific failures.
cferris1000 8bf77d2
Update for comments.
cferris1000 3450a33
Fix names in report_linux.{cpp,h}.
cferris1000 cce09f4
Run clang-format.
cferris1000 f47feee
Adding report_linux.h to list of headers.
cferris1000 c72edbb
Add TRUSTY for report_linux.{cpp,h}.
cferris1000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| //===-- report_linux.cpp ----------------------------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "platform.h" | ||
|
|
||
| #if SCUDO_LINUX || SCUDO_TRUSTY | ||
|
|
||
| #include "common.h" | ||
| #include "internal_defs.h" | ||
| #include "report.h" | ||
| #include "report_linux.h" | ||
| #include "string_utils.h" | ||
|
|
||
| #include <errno.h> | ||
| #include <stdlib.h> | ||
| #include <string.h> | ||
|
|
||
| namespace scudo { | ||
|
|
||
| // Fatal internal map() error (potentially OOM related). | ||
| void NORETURN reportMapError(uptr SizeIfOOM) { | ||
| char Error[128] = "Scudo ERROR: internal map failure\n"; | ||
| if (SizeIfOOM) { | ||
| formatString( | ||
| Error, sizeof(Error), | ||
| "Scudo ERROR: internal map failure (NO MEMORY) requesting %zuKB\n", | ||
| SizeIfOOM >> 10); | ||
| } | ||
| reportRawError(Error); | ||
| } | ||
|
|
||
| void NORETURN reportUnmapError(uptr Addr, uptr Size) { | ||
| char Error[128]; | ||
| formatString(Error, sizeof(Error), | ||
| "Scudo ERROR: internal unmap failure (error desc=%s) Addr 0x%zx " | ||
| "Size %zu\n", | ||
| strerror(errno), Addr, Size); | ||
| reportRawError(Error); | ||
| } | ||
|
|
||
| void NORETURN reportProtectError(uptr Addr, uptr Size, int Prot) { | ||
| char Error[128]; | ||
| formatString( | ||
| Error, sizeof(Error), | ||
| "Scudo ERROR: internal protect failure (error desc=%s) Addr 0x%zx " | ||
| "Size %zu Prot %x\n", | ||
| strerror(errno), Addr, Size, Prot); | ||
| reportRawError(Error); | ||
| } | ||
|
|
||
| } // namespace scudo | ||
|
|
||
| #endif // SCUDO_LINUX || SCUDO_TRUSTY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| //===-- report_linux.h ------------------------------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef SCUDO_REPORT_LINUX_H_ | ||
| #define SCUDO_REPORT_LINUX_H_ | ||
|
|
||
| #include "platform.h" | ||
|
|
||
| #if SCUDO_LINUX || SCUDO_TRUSTY | ||
|
|
||
| #include "internal_defs.h" | ||
|
|
||
| namespace scudo { | ||
|
|
||
| // Report a fatal error when a map call fails. SizeIfOOM shall | ||
| // hold the requested size on an out-of-memory error, 0 otherwise. | ||
| void NORETURN reportMapError(uptr SizeIfOOM = 0); | ||
|
|
||
| // Report a fatal error when an unmap call fails. | ||
| void NORETURN reportUnmapError(uptr Addr, uptr Size); | ||
|
|
||
| // Report a fatal error when a mprotect call fails. | ||
| void NORETURN reportProtectError(uptr Addr, uptr Size, int Prot); | ||
|
|
||
| } // namespace scudo | ||
|
|
||
| #endif // SCUDO_LINUX || SCUDO_TRUSTY | ||
|
|
||
| #endif // SCUDO_REPORT_LINUX_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.