This is an automated email from the ASF dual-hosted git repository.

rduan pushed a commit to branch emm-dev
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-sgx-sdk.git


The following commit(s) were added to refs/heads/emm-dev by this push:
     new 1b804558 Fix ExceptionInfo alignment to 64 bytes
1b804558 is described below

commit 1b80455857b16fef02348a5b6db01f2888a49fd5
Author: volcano <[email protected]>
AuthorDate: Wed Sep 20 16:39:42 2023 +0800

    Fix ExceptionInfo alignment to 64 bytes
---
 sgx_trts/src/veh/exception.rs | 2 +-
 sgx_trts/src/veh/register.rs  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sgx_trts/src/veh/exception.rs b/sgx_trts/src/veh/exception.rs
index e55c0cd8..d24f11e2 100644
--- a/sgx_trts/src/veh/exception.rs
+++ b/sgx_trts/src/veh/exception.rs
@@ -115,7 +115,7 @@ pub fn handle(tcs: &mut Tcs) -> SgxResult {
     size += mem::size_of::<ExceptionInfo>();
     size += xsave_size;
     sp -= size;
-    sp &= !0xF;
+    sp &= !0x3F;
 
     // check the decreased sp to make sure it is in the trusted stack range
     try_error!(!tds.is_stack_addr(sp, 0), SgxStatus::StackOverRun);
diff --git a/sgx_trts/src/veh/register.rs b/sgx_trts/src/veh/register.rs
index 88a4d4f0..c72bad56 100644
--- a/sgx_trts/src/veh/register.rs
+++ b/sgx_trts/src/veh/register.rs
@@ -87,7 +87,7 @@ impl_struct! {
     }
 }
 
-#[repr(C)]
+#[repr(C, align(64))]
 #[derive(Debug)]
 pub struct ExceptionInfo {
     pub context: CpuContext,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to