-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a panic handler that will log the panic info from an SGX enclave to the host
- Loading branch information
1 parent
7d70100
commit 01e877c
Showing
4 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -6,6 +6,7 @@ members = [ | |
] | ||
exclude = [ | ||
"panic/abort", | ||
"panic/log", | ||
"test_enclave", | ||
] | ||
|
||
|
This file contains 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,15 @@ | ||
[package] | ||
name = "mc-sgx-panic-log" | ||
version = "0.1.0" | ||
edition = "2021" | ||
authors = ["MobileCoin"] | ||
rust-version = "1.62.1" | ||
license = "Apache-2.0" | ||
readme = "README.md" | ||
repository = "https://github.com/mobilecoinfoundation/sgx-std" | ||
description = "Panic handler for an SGX enclave that logs to the untrusted (host)" | ||
categories = ["hardware-support", "no-std"] | ||
keywords = ["sgx", "no-std", "panic"] | ||
|
||
[dependencies] | ||
mc-sgx-io = { path = "../../io", version = "0.1.0" } |
This file contains 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,21 @@ | ||
# MobileCoin SGX: Panic handler that logs to untrusted (host) | ||
|
||
[![Project Chat][chat-image]][chat-link]<!-- | ||
-->![License][license-image]<!-- | ||
-->![Target][target-image]<!-- | ||
-->[![Crates.io][crate-image]][crate-link]<!-- | ||
-->[![Docs Status][docs-image]][docs-link]<!-- | ||
-->[![Dependency Status][deps-image]][deps-link] | ||
|
||
Panic handler for an SGX enclave that logs to the untrusted (host) | ||
|
||
[chat-image]: https://img.shields.io/discord/844353360348971068?style=flat-square | ||
[chat-link]: https://mobilecoin.chat | ||
[license-image]: https://img.shields.io/crates/l/mc-sgx-panic-log?style=flat-square | ||
[target-image]: https://img.shields.io/badge/target-sgx-red?style=flat-square | ||
[crate-image]: https://img.shields.io/crates/v/mc-sgx-panic-log.svg?style=flat-square | ||
[crate-link]: https://crates.io/crates/mc-sgx-panic-log | ||
[docs-image]: https://img.shields.io/docsrs/mc-sgx-panic-log?style=flat-square | ||
[docs-link]: https://docs.rs/crate/mc-sgx-panic-log | ||
[deps-image]: https://deps.rs/crate/mc-sgx-panic-log/0.1.0/status.svg?style=flat-square | ||
[deps-link]: https://deps.rs/crate/mc-sgx-panic-log/0.1.0 |
This file contains 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,21 @@ | ||
// Copyright (c) 2022 The MobileCoin Foundation | ||
|
||
#![doc = include_str!("../README.md")] | ||
#![deny(missing_docs, missing_debug_implementations)] | ||
#![no_std] | ||
|
||
extern crate alloc; | ||
use alloc::string::ToString; | ||
use core::panic::PanicInfo; | ||
use mc_sgx_io::StdError; | ||
|
||
#[panic_handler] | ||
fn panic(info: &PanicInfo) -> ! { | ||
let stderr = StdError; | ||
|
||
// Ignore the result, we're already panicking we can't really do much if | ||
// `write_all()` fails | ||
let _ = stderr.write_all(info.to_string().as_bytes()); | ||
|
||
loop {} | ||
} |