This is an automated email from the ASF dual-hosted git repository.
mssun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git
The following commit(s) were added to refs/heads/master by this push:
new 17b4e87 Force to call enclave destory when receiving signals (#413)
17b4e87 is described below
commit 17b4e87849efdb1d7a0755f819adf90370939cc3
Author: Mingshen Sun <[email protected]>
AuthorDate: Tue Sep 1 19:34:09 2020 -0700
Force to call enclave destory when receiving signals (#413)
---
binder/src/binder.rs | 4 ++++
cmake/scripts/Enclave.lds | 2 ++
services/access_control/app/src/main.rs | 3 +++
services/authentication/app/src/main.rs | 3 +++
services/execution/app/src/main.rs | 3 +++
services/frontend/app/src/main.rs | 3 +++
services/management/app/src/main.rs | 3 +++
services/scheduler/app/src/main.rs | 3 +++
services/storage/app/src/main.rs | 3 +++
services/utils/service_app_utils/src/lib.rs | 4 ++++
10 files changed, 31 insertions(+)
diff --git a/binder/src/binder.rs b/binder/src/binder.rs
index 82c9fd3..baa6593 100644
--- a/binder/src/binder.rs
+++ b/binder/src/binder.rs
@@ -76,6 +76,10 @@ impl TeeBinder {
Err(e) => error!("{:?}", e),
}
}
+
+ pub unsafe fn destroy(&self) {
+ let _ = sgx_destroy_enclave(self.enclave.geteid());
+ }
}
impl Drop for TeeBinder {
diff --git a/cmake/scripts/Enclave.lds b/cmake/scripts/Enclave.lds
index e3d9d0e..73fe252 100644
--- a/cmake/scripts/Enclave.lds
+++ b/cmake/scripts/Enclave.lds
@@ -3,6 +3,8 @@ enclave.so
global:
g_global_data_sim;
g_global_data;
+ g_peak_heap_used;
+ g_peak_rsrv_mem_committed;
enclave_entry;
local:
*;
diff --git a/services/access_control/app/src/main.rs
b/services/access_control/app/src/main.rs
index f4a66dc..4cd86f4 100644
--- a/services/access_control/app/src/main.rs
+++ b/services/access_control/app/src/main.rs
@@ -48,6 +48,9 @@ fn main() -> Result<()> {
}
launcher.finalize();
+ unsafe {
+ launcher.destroy(); // force to destroy the enclave
+ }
Ok(())
}
diff --git a/services/authentication/app/src/main.rs
b/services/authentication/app/src/main.rs
index f4a66dc..4cd86f4 100644
--- a/services/authentication/app/src/main.rs
+++ b/services/authentication/app/src/main.rs
@@ -48,6 +48,9 @@ fn main() -> Result<()> {
}
launcher.finalize();
+ unsafe {
+ launcher.destroy(); // force to destroy the enclave
+ }
Ok(())
}
diff --git a/services/execution/app/src/main.rs
b/services/execution/app/src/main.rs
index 0a67c24..cf8dc24 100644
--- a/services/execution/app/src/main.rs
+++ b/services/execution/app/src/main.rs
@@ -51,6 +51,9 @@ fn main() -> Result<()> {
}
launcher.finalize();
+ unsafe {
+ launcher.destroy(); // force to destroy the enclave
+ }
Ok(())
}
diff --git a/services/frontend/app/src/main.rs
b/services/frontend/app/src/main.rs
index f4a66dc..4cd86f4 100644
--- a/services/frontend/app/src/main.rs
+++ b/services/frontend/app/src/main.rs
@@ -48,6 +48,9 @@ fn main() -> Result<()> {
}
launcher.finalize();
+ unsafe {
+ launcher.destroy(); // force to destroy the enclave
+ }
Ok(())
}
diff --git a/services/management/app/src/main.rs
b/services/management/app/src/main.rs
index f4a66dc..4cd86f4 100644
--- a/services/management/app/src/main.rs
+++ b/services/management/app/src/main.rs
@@ -48,6 +48,9 @@ fn main() -> Result<()> {
}
launcher.finalize();
+ unsafe {
+ launcher.destroy(); // force to destroy the enclave
+ }
Ok(())
}
diff --git a/services/scheduler/app/src/main.rs
b/services/scheduler/app/src/main.rs
index f4a66dc..4cd86f4 100644
--- a/services/scheduler/app/src/main.rs
+++ b/services/scheduler/app/src/main.rs
@@ -48,6 +48,9 @@ fn main() -> Result<()> {
}
launcher.finalize();
+ unsafe {
+ launcher.destroy(); // force to destroy the enclave
+ }
Ok(())
}
diff --git a/services/storage/app/src/main.rs b/services/storage/app/src/main.rs
index f4a66dc..4cd86f4 100644
--- a/services/storage/app/src/main.rs
+++ b/services/storage/app/src/main.rs
@@ -48,6 +48,9 @@ fn main() -> Result<()> {
}
launcher.finalize();
+ unsafe {
+ launcher.destroy(); // force to destroy the enclave
+ }
Ok(())
}
diff --git a/services/utils/service_app_utils/src/lib.rs
b/services/utils/service_app_utils/src/lib.rs
index a5297af..382dbdc 100644
--- a/services/utils/service_app_utils/src/lib.rs
+++ b/services/utils/service_app_utils/src/lib.rs
@@ -53,6 +53,10 @@ impl TeaclaveServiceLauncher {
pub fn finalize(&self) {
self.tee.finalize();
}
+
+ pub unsafe fn destroy(&self) {
+ self.tee.destroy();
+ }
}
pub fn register_signals(term: Arc<AtomicBool>) -> Result<()> {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]