-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from jcape/feature/panic-abort
Repo Setup and Aborting Panic Handler
- Loading branch information
Showing
10 changed files
with
204 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: cargo | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 |
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,24 @@ | ||
name: cargo-audit | ||
on: | ||
pull_request: | ||
paths: Cargo.lock | ||
push: | ||
branches: develop | ||
paths: Cargo.lock | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
security_audit: | ||
name: Security Audit | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Cache cargo bin | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cargo/bin | ||
key: ${{ runner.os }}-cargo-audit-v0.12 | ||
- uses: actions-rs/audit-check@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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,35 @@ | ||
name: panic-abort | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "panic/abort/**" | ||
- "Cargo.*" | ||
|
||
defaults: | ||
run: | ||
working-directory: "panic/abort" | ||
|
||
env: | ||
CARGO_INCREMENTAL: 0 | ||
RUSTFLAGS: "-Dwarnings" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
- nightly-2021-07-21 | ||
- nightly | ||
target: | ||
- x86_64-unknown-linux-gnu | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
target: ${{ matrix.target }} | ||
override: true | ||
profile: minimal | ||
- run: cargo build --release --target ${{ matrix.target }} | ||
|
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,36 @@ | ||
name: Workspace | ||
on: | ||
pull_request: | ||
paths-ignore: | ||
- README.md | ||
|
||
env: | ||
CARGO_INCREMENTAL: 0 | ||
RUSTFLAGS: "-Dwarnings" | ||
|
||
jobs: | ||
rustfmt: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
components: rustfmt | ||
override: true | ||
profile: minimal | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
clippy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
components: clippy | ||
override: true | ||
profile: minimal | ||
- run: cargo clippy --all --all-features -- -D warnings |
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,22 @@ | ||
[workspace] | ||
resolver = "2" | ||
members = [ | ||
"panic/abort", | ||
] | ||
|
||
[profile.dev] | ||
opt-level = 0 | ||
rpath = true | ||
lto = true | ||
|
||
[profile.release] | ||
opt-level = 3 | ||
rpath = false | ||
lto = true | ||
debug-assertions = false | ||
overflow-checks = false | ||
|
||
# Skip the need for LD_LIBRARY_PATH in `cargo test` | ||
[profile.test] | ||
rpath = true | ||
|
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 |
---|---|---|
@@ -1,2 +1,6 @@ | ||
# sgx | ||
# MobileCoin SGX | ||
|
||
SGX Libraries and Utilities | ||
|
||
[![dependency status](https://deps.rs/repo/github/mobilecoinfoundation/sgx/status.svg)](https://deps.rs/repo/github/mobilecoinfoundation/sgx) | ||
|
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,14 @@ | ||
[package] | ||
name = "mc-sgx-panic-abort" | ||
version = "0.1.0" | ||
authors = ["MobileCoin"] | ||
description = "Aborting panic handler for Intel-SGX enclaves." | ||
edition = "2018" | ||
repository = "https://github.com/mobilecoinfoundation/sgx.git" | ||
license = "GPLv3" | ||
keywords = ["no-std", "sgx", "mobilecoin", "panic-handler"] | ||
categories = ["hardware-support", "api-bindings"] | ||
readme = "README.md" | ||
|
||
[badges] | ||
maintenance = { status = "actively-developed" } |
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,29 @@ | ||
# MobileCoin SGX: Panic-Abort | ||
|
||
Aborting panic handler for Intel-SGX enclaves. | ||
|
||
[![crate][crate-image]][crate-link] | ||
[![Docs][docs-image]][docs-link] | ||
![GPLv3.0 Licensed][license-image] | ||
![Rust Version][rustc-image] | ||
[![Project Chat][chat-image]][chat-link] | ||
[![Crates.io Downloads][downloads-image]][crate-link] | ||
[![Build Status][build-image]][build-link] | ||
|
||
This crate provides a panic handler implementation intended to be executed inside an SGX enclave. Specifically, it will provide the required `rust_eh_personality()` and `#![panic_handler]` methods to satisfy the linker for a `#![no_std]` environment. As a result, this crate will | ||
|
||
This crate currently requires independent linkage to the `libsgx_trts.a` library, which provides the `abort()` call we use to mark the enclave dead. The goal for all crates in this repository is to handle the intricate linkage requirements of the Intel SGX SDK automagically, but that is not in place yet, so users of this crate will need to link it themselves for now. | ||
|
||
[//]: # (badges) | ||
|
||
[crate-image]: https://img.shields.io/crates/v/mc-sgx-panic-abort?style=for-the-badge | ||
[crate-link]: https://crates.io/crates/mc-sgx-panic-abort | ||
[docs-image]: https://img.shields.io/docsrs/mc-sgx-panic-abort/latest?style=for-the-badge | ||
[docs-link]: https://docs.rs/mc-sgx-panic-abort/ | ||
[license-image]: https://img.shields.io/github/license/mobilecoinfoundation/sgx?style=for-the-badge | ||
[rustc-image]: https://img.shields.io/badge/rustc-nightly-orange.svg?style=for-the-badge&logo=rust | ||
[chat-image]: https://img.shields.io/discord/844353360348971068.svg?style=for-the-badge | ||
[chat-link]: https://discord.gg/4kP8ftbVfA | ||
[downloads-image]: https://img.shields.io/crates/d/mc-sgx-panic-abort.svg?style=for-the-badge | ||
[build-image]: https://img.shields.io/github/workflow/status/mobilecoinfoundation/sgx/panic-abort?style=for-the-badge | ||
[build-link]: https://github.com/mobilecoinfoundation/sgx/actions |
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,29 @@ | ||
// Copyright 2021 MobileCoin Foundation | ||
|
||
#![doc = include_str!("../README.md")] | ||
#![no_std] | ||
#![feature(lang_items)] | ||
|
||
use core::panic::PanicInfo; | ||
|
||
/// The panic implementation. | ||
/// | ||
/// This is required by no_std libraries (on the rust side), and calls | ||
/// `abort()` in a previously imported `libsgx_tcxx.a` (on the SGX side). | ||
#[lang = "panic_impl"] | ||
#[no_mangle] | ||
pub extern "C" fn panic(_info: &PanicInfo) -> ! { | ||
extern "C" { | ||
fn abort() -> !; | ||
} | ||
|
||
unsafe { abort() } | ||
} | ||
|
||
/// Exception Handling Personality Language Item. | ||
/// | ||
/// This is required to inject panic-handling into an application with only | ||
/// libcore support. | ||
#[lang = "eh_personality"] | ||
#[no_mangle] | ||
pub extern "C" fn rust_eh_personality() {} |
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,3 @@ | ||
edition = "2018" | ||
wrap_comments = true | ||
imports_granularity = "Crate" |