diff --git a/deps/rust-sgx-sdk b/deps/rust-sgx-sdk index e61c9a5c..ae7ec590 160000 --- a/deps/rust-sgx-sdk +++ b/deps/rust-sgx-sdk @@ -1 +1 @@ -Subproject commit e61c9a5ce5e4a0161696e9c1a75807fef105c9aa +Subproject commit ae7ec5901c75b41626011a9e3c87b4a9b194f598 diff --git a/src/libos/Cargo.lock b/src/libos/Cargo.lock index 727d6ab0..7eaafba0 100644 --- a/src/libos/Cargo.lock +++ b/src/libos/Cargo.lock @@ -232,7 +232,7 @@ dependencies = [ [[package]] name = "hashbrown_tstd" -version = "0.9.0" +version = "0.11.2" [[package]] name = "ident_case" @@ -588,11 +588,11 @@ dependencies = [ [[package]] name = "sgx_alloc" -version = "1.1.3" +version = "1.1.4" [[package]] name = "sgx_backtrace_sys" -version = "1.1.3" +version = "1.1.4" dependencies = [ "cc", "sgx_build_helper", @@ -601,11 +601,11 @@ dependencies = [ [[package]] name = "sgx_build_helper" -version = "0.1.3" +version = "1.1.4" [[package]] name = "sgx_cov" -version = "1.1.3" +version = "1.1.4" dependencies = [ "lazy_static", "profiler_builtins", @@ -617,18 +617,18 @@ dependencies = [ [[package]] name = "sgx_demangle" -version = "1.1.3" +version = "1.1.4" [[package]] name = "sgx_libc" -version = "1.1.3" +version = "1.1.4" dependencies = [ "sgx_types", ] [[package]] name = "sgx_rand" -version = "1.1.3" +version = "1.1.4" dependencies = [ "sgx_trts", "sgx_tstd", @@ -637,14 +637,14 @@ dependencies = [ [[package]] name = "sgx_tcrypto" -version = "1.1.3" +version = "1.1.4" dependencies = [ "sgx_types", ] [[package]] name = "sgx_tprotected_fs" -version = "1.1.3" +version = "1.1.4" dependencies = [ "sgx_trts", "sgx_types", @@ -652,7 +652,7 @@ dependencies = [ [[package]] name = "sgx_trts" -version = "1.1.3" +version = "1.1.4" dependencies = [ "sgx_libc", "sgx_types", @@ -660,14 +660,14 @@ dependencies = [ [[package]] name = "sgx_tse" -version = "1.1.3" +version = "1.1.4" dependencies = [ "sgx_types", ] [[package]] name = "sgx_tstd" -version = "1.1.3" +version = "1.1.4" dependencies = [ "hashbrown_tstd", "sgx_alloc", @@ -682,11 +682,11 @@ dependencies = [ [[package]] name = "sgx_types" -version = "1.1.3" +version = "1.1.4" [[package]] name = "sgx_unwind" -version = "0.1.1" +version = "1.1.4" dependencies = [ "sgx_build_helper", ] diff --git a/src/libos/rust-toolchain b/src/libos/rust-toolchain index 148ed93d..7b9ce474 100644 --- a/src/libos/rust-toolchain +++ b/src/libos/rust-toolchain @@ -1 +1 @@ -nightly-2020-10-25 +nightly-2021-09-13 diff --git a/src/libos/src/lib.rs b/src/libos/src/lib.rs index 2c3f04c0..3e26fb76 100644 --- a/src/libos/src/lib.rs +++ b/src/libos/src/lib.rs @@ -14,7 +14,6 @@ #![feature(negative_impls)] // for may_dangle in rw_lock #![feature(dropck_eyepatch)] -#![feature(option_expect_none)] // for UntrustedSliceAlloc in slice_alloc #![feature(slice_ptr_get)] #![feature(maybe_uninit_extra)] @@ -23,6 +22,7 @@ #![feature(test)] #![feature(atomic_from_mut)] #![feature(btree_drain_filter)] +#![feature(bench_black_box)] #[macro_use] extern crate alloc; diff --git a/src/libos/src/process/thread/mod.rs b/src/libos/src/process/thread/mod.rs index 3d04a246..468a6816 100644 --- a/src/libos/src/process/thread/mod.rs +++ b/src/libos/src/process/thread/mod.rs @@ -214,11 +214,12 @@ impl Thread { ) .unwrap(); - THREAD_NOTIFIERS - .lock() - .unwrap() - .insert(self.tid(), eventfd) - .expect_none("this thread should not have an eventfd before start"); + let event_file = THREAD_NOTIFIERS.lock().unwrap().insert(self.tid(), eventfd); + + assert!( + event_file.is_none(), + "this thread should not have an eventfd before start" + ); #[cfg(feature = "syscall_timing")] self.profiler() diff --git a/src/libos/src/untrusted/alloc.rs b/src/libos/src/untrusted/alloc.rs index ec56a659..128a8dca 100644 --- a/src/libos/src/untrusted/alloc.rs +++ b/src/libos/src/untrusted/alloc.rs @@ -1,5 +1,5 @@ use super::*; -use std::alloc::{AllocError, AllocRef, Layout}; +use std::alloc::{AllocError, Allocator, Layout}; use std::ptr::{self, write_bytes, NonNull}; /// The global memory allocator for untrusted memory @@ -7,8 +7,8 @@ pub static mut UNTRUSTED_ALLOC: UntrustedAlloc = UntrustedAlloc; pub struct UntrustedAlloc; -unsafe impl AllocRef for UntrustedAlloc { - fn alloc(&self, layout: Layout) -> std::result::Result, AllocError> { +unsafe impl Allocator for UntrustedAlloc { + fn allocate(&self, layout: Layout) -> std::result::Result, AllocError> { if layout.size() == 0 { return Err(AllocError); } @@ -43,7 +43,7 @@ unsafe impl AllocRef for UntrustedAlloc { .unwrap()) } - unsafe fn dealloc(&self, ptr: NonNull, layout: Layout) { + unsafe fn deallocate(&self, ptr: NonNull, layout: Layout) { // Pre-condition: out-of-enclave debug_assert!(sgx_trts::trts::rsgx_raw_is_outside_enclave( ptr.as_ptr(), diff --git a/src/libos/src/untrusted/slice_alloc.rs b/src/libos/src/untrusted/slice_alloc.rs index 5a309925..a79d830b 100644 --- a/src/libos/src/untrusted/slice_alloc.rs +++ b/src/libos/src/untrusted/slice_alloc.rs @@ -1,5 +1,5 @@ use super::*; -use std::alloc::{AllocError, AllocRef, Layout}; +use std::alloc::{AllocError, Allocator, Layout}; use std::ptr::NonNull; use std::sync::atomic::{AtomicUsize, Ordering}; @@ -26,7 +26,7 @@ impl UntrustedSliceAlloc { } let layout = Layout::from_size_align(buf_size, 1)?; - let buf_ptr = unsafe { UNTRUSTED_ALLOC.alloc(layout)?.as_mut_ptr() }; + let buf_ptr = unsafe { UNTRUSTED_ALLOC.allocate(layout)?.as_mut_ptr() }; let buf_pos = AtomicUsize::new(0); Ok(Self { @@ -72,7 +72,7 @@ impl Drop for UntrustedSliceAlloc { let layout = Layout::from_size_align(self.buf_size, 1).unwrap(); unsafe { - UNTRUSTED_ALLOC.dealloc(NonNull::new(self.buf_ptr).unwrap(), layout); + UNTRUSTED_ALLOC.deallocate(NonNull::new(self.buf_ptr).unwrap(), layout); } } }