apache / incubator-teaclave-sgx-sdk

Apache Teaclave (incubating) SGX SDK helps developers to write Intel SGX applications in the Rust programming language, and also known as Rust SGX SDK.
https://teaclave.apache.org
Apache License 2.0
1.18k stars 265 forks source link

V2.0.0-perview supports Intel Linux SGX SDK 2.21 or later #454

Closed yangfh2004 closed 9 months ago

yangfh2004 commented 9 months ago

The V2.0.0 preview only supports Intel's SGX SDK 2.17.1, which does not support Ubuntu 22.04. We are looking forward to supporting newer versions of Intel's SGX SDK so that we have supports to the latest kernel, tool chains and DCAP drivers.

We are experimenting with the support on version 2.21 on our fork

The helloworld demo compiled OK but have issues with a segmentation fault on TCS initiation while it creates and memset a new piece of memory inside the enclave for a new TCS. We haven't digged into the root cause but it seems that there might be some difference in memory management in the newer version.

The same segmentation fault happens in all modes, including HW and SIM with or without optimization libraries. Since the memset function is provided by Intel, I don't believe the root cause is the fast or regular memset.

Screenshot 2024-02-13 at 5 47 50 PM

Where it crashes in the SIM mode, it will also crash in the HW mode at the same line of code.

Screenshot 2024-02-14 at 5 23 29 PM

Where it crashes the enclave with regular memset

Screenshot 2024-02-15 at 10 38 27 AM

Where it crashes the enclave with fast memset

yangfh2004 commented 9 months ago

@volcano0dr please take a look at our fork branch and your suggestions are welcome, thanks.

yangfh2004 commented 9 months ago

I see the typedef struct _thread_data_t has changes and would result different mapping in into the rust struct, which I believe might be the root cause of the problem.

yangfh2004 commented 9 months ago

I fixed it by updating the Tds struct in the global data

yangfh2004 commented 9 months ago

Still have some problems with heap allocation since the EDMM is missing. Please review our fork and leave comments so that we can improve, thanks!

ClawSeven commented 9 months ago

Hi, @yangfh2004, you could update the intel sgx sdk version with this script.