You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by rd...@apache.org on 2022/08/24 08:14:36 UTC

[incubator-teaclave-sgx-sdk] branch master updated: Support intel sgx sdk 2.17.1

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

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


The following commit(s) were added to refs/heads/master by this push:
     new c70a82f7 Support intel sgx sdk 2.17.1
c70a82f7 is described below

commit c70a82f708fd20e9fd0377990dde097d14024f7a
Author: volcano <vo...@163.com>
AuthorDate: Sat Aug 20 15:02:56 2022 +0800

    Support intel sgx sdk 2.17.1
---
 common/inc/string.h                   |  1 +
 dockerfile/03_sdk.sh                  |  4 +--
 dockerfile/Dockerfile.1804.nightly    |  2 +-
 dockerfile/Dockerfile.2004.nightly    |  2 +-
 dockerfile/Dockerfile.centos8.nightly |  2 +-
 sgx_tstd/src/thread/local.rs          | 58 +++--------------------------------
 6 files changed, 11 insertions(+), 58 deletions(-)

diff --git a/common/inc/string.h b/common/inc/string.h
index 1140fcc5..00a89fde 100644
--- a/common/inc/string.h
+++ b/common/inc/string.h
@@ -60,6 +60,7 @@ __BEGIN_DECLS
 
 void * _TLIBC_CDECL_ memchr(const void *, int, size_t);
 int    _TLIBC_CDECL_ memcmp(const void *, const void *, size_t);
+void * _TLIBC_CDECL_ memcpy_nochecks(void *, const void *, size_t);
 void * _TLIBC_CDECL_ memcpy(void *, const void *, size_t);
 void * _TLIBC_CDECL_ memcpy_verw(void *, const void *, size_t);
 void * _TLIBC_CDECL_ memmove(void *, const void *, size_t);
diff --git a/dockerfile/03_sdk.sh b/dockerfile/03_sdk.sh
index f5ff31d8..eb5d0152 100644
--- a/dockerfile/03_sdk.sh
+++ b/dockerfile/03_sdk.sh
@@ -10,10 +10,10 @@ else
     cd /root && \
     git clone --recursive https://github.com/intel/linux-sgx && \
     cd linux-sgx && \
-    git checkout sgx_2.17 && \
+    git checkout sgx_2.17.1 && \
     ./download_prebuilt.sh && \
     make -j "$(nproc)" sdk_install_pkg && \
-    echo -e 'no\n/opt' | ./linux/installer/bin/sgx_linux_x64_sdk_2.17.100.3.bin && \
+    echo -e 'no\n/opt' | ./linux/installer/bin/sgx_linux_x64_sdk_2.17.101.1.bin && \
     echo 'source /opt/sgxsdk/environment' >> /root/.bashrc && \
     cd /root && \
     rm -rf /root/linux-sgx
diff --git a/dockerfile/Dockerfile.1804.nightly b/dockerfile/Dockerfile.1804.nightly
index 7b7d5f65..cda69142 100644
--- a/dockerfile/Dockerfile.1804.nightly
+++ b/dockerfile/Dockerfile.1804.nightly
@@ -15,7 +15,7 @@ ADD 02_binutils.sh /root
 RUN bash /root/02_binutils.sh
 
 ENV SDK_DIST="INTEL_BUILT"
-ENV SDK_URL="https://download.01.org/intel-sgx/sgx-linux/2.17/distro/ubuntu18.04-server/sgx_linux_x64_sdk_2.17.100.3.bin"
+ENV SDK_URL="https://download.01.org/intel-sgx/sgx-linux/2.17.1/distro/ubuntu18.04-server/sgx_linux_x64_sdk_2.17.101.1.bin"
 #ENV SDK_DIST="SELF_BUILT"
 ADD 03_sdk.sh /root
 RUN bash /root/03_sdk.sh
diff --git a/dockerfile/Dockerfile.2004.nightly b/dockerfile/Dockerfile.2004.nightly
index a0b37c7d..ab393aa6 100644
--- a/dockerfile/Dockerfile.2004.nightly
+++ b/dockerfile/Dockerfile.2004.nightly
@@ -19,7 +19,7 @@ RUN bash /root/02_binutils.sh
 
 #ENV SDK_DIST="SELF_BUILT"
 ENV SDK_DIST="INTEL_BUILT"
-ENV SDK_URL="https://download.01.org/intel-sgx/sgx-linux/2.17/distro/ubuntu20.04-server/sgx_linux_x64_sdk_2.17.100.3.bin"
+ENV SDK_URL="https://download.01.org/intel-sgx/sgx-linux/2.17.1/distro/ubuntu20.04-server/sgx_linux_x64_sdk_2.17.101.1.bin"
 ADD 03_sdk.sh /root
 RUN bash /root/03_sdk.sh
 
diff --git a/dockerfile/Dockerfile.centos8.nightly b/dockerfile/Dockerfile.centos8.nightly
index 8439ac73..aeada924 100644
--- a/dockerfile/Dockerfile.centos8.nightly
+++ b/dockerfile/Dockerfile.centos8.nightly
@@ -13,7 +13,7 @@ ADD 02_binutils.sh /root
 RUN bash /root/02_binutils.sh
 
 ENV SDK_DIST="INTEL_BUILT"
-ENV SDK_URL="https://download.01.org/intel-sgx/sgx-linux/2.17/distro/centos-stream/sgx_linux_x64_sdk_2.17.100.3.bin"
+ENV SDK_URL="https://download.01.org/intel-sgx/sgx-linux/2.17.1/distro/centos-stream/sgx_linux_x64_sdk_2.17.101.1.bin"
 #ENV SDK_DIST="SELF_BUILT"
 ADD 03_sdk.sh /root
 RUN bash /root/03_sdk.sh
diff --git a/sgx_tstd/src/thread/local.rs b/sgx_tstd/src/thread/local.rs
index 430360df..6dd7a45c 100644
--- a/sgx_tstd/src/thread/local.rs
+++ b/sgx_tstd/src/thread/local.rs
@@ -217,17 +217,9 @@ macro_rules! __thread_local_inner {
             // If a dtor isn't needed we can do something "very raw" and
             // just get going.
             if !$crate::mem::needs_drop::<$t>() {
-                #[thread_local]
-                static mut VAL: $t = $init;
                 return Ok(&VAL)
             }
 
-            if $crate::thread::thread_policy() == $crate::thread::SgxThreadPolicy::Unbound  {
-                return Err($crate::thread::AccessError::new(
-                    "If TLS data needs to be destructed, TCS policy must be bound."
-                ));
-            }
-
             // 0 == dtor not registered
             // 1 == dtor registered, dtor not run
             // 2 == dtor registered and is running or has run
@@ -482,27 +474,6 @@ pub mod statik {
     }
 }
 
-cfg_if! {
-if #[cfg(feature = "thread")] {
-    use sgx_libc::{c_void, c_long};
-    use sgx_types::sgx_status_t;
-
-    #[repr(C)]
-    struct pthread_info {
-        m_pthread: *mut c_void,       // struct _pthread
-        m_local_storage: *mut c_void, // struct sgx_pthread_storage
-        m_mark: [c_long; 8],          // jmpbuf
-        m_state: sgx_status_t,
-    }
-
-    #[link(name = "sgx_pthread")]
-    extern "C" {
-        #[thread_local]
-        static pthread_info_tls: pthread_info;
-    }
-}
-} // cfg_if!
-
 #[cfg(feature = "thread")]
 pub mod fast {
     use super::lazy::LazyKeyInner;
@@ -511,7 +482,6 @@ pub mod fast {
     use crate::fmt;
     use crate::mem;
     use crate::sys::thread_local_dtor::register_dtor;
-    use crate::thread::{self, SgxThreadPolicy};
 
     #[derive(Copy, Clone)]
     enum DtorState {
@@ -582,30 +552,12 @@ pub mod fast {
         // LLVM issue: https://bugs.llvm.org/show_bug.cgi?id=41722
         #[inline(never)]
         unsafe fn try_initialize<F: FnOnce() -> T>(&self, init: F) -> Result<&'static T, AccessError> {
-            if mem::needs_drop::<T>() && thread::thread_policy() == SgxThreadPolicy::Unbound {
-                return Err(AccessError::new(
-                    "If TLS data needs to be destructed, TCS policy must be bound."
-                ));
-            }
-
-            if !super::pthread_info_tls.m_pthread.is_null() {
-                // Note:
-                // If the current thread was created by `pthread_create`, we should call
-                // the try_register_dtor function. You can know whether the current thread has
-                // been created by pthread_create() through the m_thread member of pthread_info
-                // (thread local storage) of pthread library in intel sgx sdk.
-                //
-                // Destructor will only be called when a thread created by `pthread_create` exits,
-                // because `sys_common::thread_local::StaticKey` does not call `pthread_key_delete`
-                // to trigger the destructor.
-                if !mem::needs_drop::<T>() || self.try_register_dtor() {
-                    // SAFETY: See comment above (his function doc).
-                    Ok(self.inner.initialize(init))
-                } else {
-                    Err(AccessError::new("Failed to register destructor."))
-                }
-            } else {
+            // SAFETY: See comment above (this function doc).
+            if !mem::needs_drop::<T>() || self.try_register_dtor() {
+                // SAFETY: See comment above (his function doc).
                 Ok(self.inner.initialize(init))
+            } else {
+                Err(AccessError::new("Failed to register destructor."))
             }
         }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org