Skip to content
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

Investigate unreachable being reached #86

Closed
jethrogb opened this issue Jan 29, 2019 · 1 comment · Fixed by rust-lang/rust#59613
Closed

Investigate unreachable being reached #86

jethrogb opened this issue Jan 29, 2019 · 1 comment · Fixed by rust-lang/rust#59613
Assignees
Labels
bug std/rustc Requires changes in Rust std/rustc

Comments

@jethrogb
Copy link
Member

jethrogb commented Jan 29, 2019

Enclave code:

use std::process::abort;
use std::thread;

fn main() {
    std::env::set_var("RUST_BACKTRACE", "1");
    thread::spawn(|| loop {}).join();
}

Modify runner so wait returns a bogus value, e.g.

diff --git a/enclave-runner/src/usercalls/mod.rs b/enclave-runner/src/usercalls/mod.rs
index 290ff73..5c10e68 100644
--- a/enclave-runner/src/usercalls/mod.rs
+++ b/enclave-runner/src/usercalls/mod.rs
@@ -778,6 +778,7 @@ impl RunningTcs {
 
     #[inline(always)]
     fn wait(&mut self, event_mask: u64, timeout: u64) -> IoResult<u64> {
+        let timeout = 1;
         let wait = match timeout {
             WAIT_NO => false,
             WAIT_INDEFINITE => true,

Observe SIGILL (ud2) in the enclave in Condvar/MPSC logic.

@jethrogb
Copy link
Member Author

jethrogb commented Feb 13, 2019

Simpler test case, doesn't require modification of enclave-runner:

fn main() {
    let (_tx, rx) = std::sync::mpsc::channel::<()>();
    let _ = rx.recv_timeout(std::time::Duration::from_millis(1));
}

And this one deadlocks:

fn main() {
    let (tx, rx) = std::sync::mpsc::channel::<()>();
    let _ = tx.clone();
    let _ = rx.recv_timeout(std::time::Duration::from_millis(1));
}

@jethrogb jethrogb self-assigned this Feb 17, 2019
Centril added a commit to Centril/rust that referenced this issue Apr 1, 2019
…r=alexcrichton

SGX target: convert a bunch of panics to aborts

Fixes fortanix/rust-sgx#86, fortanix/rust-sgx#103 and in general protect preemptively against Iago attacks by aborting instead of unwinding in potentially unexpected situations.
Centril added a commit to Centril/rust that referenced this issue Apr 2, 2019
…r=alexcrichton

SGX target: convert a bunch of panics to aborts

Fixes fortanix/rust-sgx#86, fortanix/rust-sgx#103 and in general protect preemptively against Iago attacks by aborting instead of unwinding in potentially unexpected situations.
@jethrogb jethrogb closed this as completed Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug std/rustc Requires changes in Rust std/rustc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant