Skip to content

Commit

Permalink
Review fix ups
Browse files Browse the repository at this point in the history
  • Loading branch information
Max K committed Jul 12, 2023
1 parent 796645a commit f0a9c61
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 3 additions & 2 deletions intel-sgx/enclave-runner/src/tcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,10 @@ pub(crate) fn coenter<T: Tcs>(
while !exiting.load(Ordering::SeqCst) && sgx_result != (Enclu::EExit as u32) {
asm!("
lea 1f(%rip), %rcx // set SGX AEP
xchg {0}, %rbx
push %rbx // store original rbx value on the stack
mov {0}, %rbx
enclu
1: xchg %rbx, {0}
1: pop %rbx // restore original rbx value in case we interrupt enclave during AEX
",
inout(reg) tcs.address() => _, // rbx is used internally by LLVM and cannot be used as an operand for inline asm (#84658)
inout("eax") sgx_result as u32 => sgx_result,
Expand Down
4 changes: 2 additions & 2 deletions intel-sgx/enclave-runner/src/usercalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ impl EnclaveState {
// Issuing a signal to return execution control back to the enclave-runner's worker thread.
// * In non-vdso case execution control is claimed during AEX using special handler provided by AEP address
// in coenter() function and signal is not required
unsafe { libc::pthread_kill(handler.as_pthread_t() as _, signal::SIGUSR1 as _); }
unsafe { libc::pthread_kill(handler.as_pthread_t() as _, signal::SIGHUP as _); }
}
let _ = handler.join();
}
Expand Down Expand Up @@ -1048,7 +1048,7 @@ impl EnclaveState {
entry: CoEntry::Initial(main.tcs, argv as _, argc as _, 0, 0, 0),
};

let num_of_worker_threads = num_cpus::get();
let num_of_worker_threads = num_cpus::get() + 1;

let kind = EnclaveKind::Command(Command {
panic_reason: Mutex::new(PanicReason {
Expand Down
2 changes: 0 additions & 2 deletions intel-sgx/fortanix-sgx-tools/src/bin/ftxsgx-runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ use nix::sys::signal;
use sgxs_loaders::isgx::Device as IsgxDevice;
#[cfg(windows)]
use sgxs_loaders::enclaveapi::Sgx as IsgxDevice;
#[cfg(unix)]
use libc::{ucontext_t, REG_RIP};
use clap::{App, Arg};

arg_enum!{
Expand Down

0 comments on commit f0a9c61

Please sign in to comment.