hiroki-chen opened a new issue, #432:
URL: https://github.com/apache/incubator-teaclave-sgx-sdk/issues/432

   Hi all, recently I am using SDK to develop a simple multi-threading program, 
but sometimes ECall would fail. The branch we use is `v2.0.0-preview`.
   
   # Steps to reproduce:
   
   I used a modified code from 
`incubator-teaclave-sgx-sdk/samplecode/helloworld/app/src/main.rs`:
   
   ```rust
   
   fn main() {
       let enclave = match SgxEnclave::create(ENCLAVE_FILE, true) {
           Ok(enclave) => {
               println!("[+] Init Enclave Successful {}!", enclave.eid());
               enclave
           }
           Err(err) => {
               println!("[-] Init Enclave Failed {}!", err.as_str());
               return;
           }
       };
   
       // let enclave = Arc::new(enclave);
   
       loop {
           let mut v = vec![];
           for _ in 0..16 {
               let eid = enclave.eid();
   
               let handle = thread::spawn(move || {
                   let input_string =
                       String::from("This is a normal world string passed into 
Enclave!\n");
                   let mut retval = SgxStatus::Success;
   
                   let result = unsafe {
                       say_something(
                           eid,
                           &mut retval,
                           input_string.as_ptr() as *const u8,
                           input_string.len(),
                       )
                   };
                   match result {
                       SgxStatus::Success => println!("[+] ECall Success..."),
                       _ => println!("[-] ECall Enclave Failed {}!", 
result.as_str()),
                   }
               });
               v.push(handle);
           }
   
           for handle in v {
               handle.join().unwrap();
           }
       }
   }
   ```
   
   The enclave's configuration is
   
   ```xml
   <EnclaveConfiguration>
     <ProdID>0</ProdID>
     <ISVSVN>0</ISVSVN>
     <StackMaxSize>0x40000</StackMaxSize>
     <HeapMaxSize>0x1000000</HeapMaxSize>
     <TCSNum>32</TCSNum>
     <TCSPolicy>1</TCSPolicy>
     <DisableDebug>0</DisableDebug>
     <MiscSelect>0</MiscSelect>
     <MiscMask>0xFFFFFFFF</MiscMask>
   </EnclaveConfiguration>
   ```
   
   The output is
   
   ```sh
   $ SGX_MOED=HW make && cd bin && ./app
   # Previous outputs omitted.
   This is a normal world string passed into Enclave!
   This is a normal world string passed into Enclave!
   This is a in-Enclave Rust string!
   [+] ECall Success...
   This is a in-Enclave Rust string!
   [+] ECall Success...
   [-] ECall Enclave Failed EnclaveLost!
   ```
   
   I wonder where the root cause of this issue is. Is this caused by Rust SGX 
SDK or Intel's SDK? Thanks in advance!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@teaclave.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@teaclave.apache.org
For additional commands, e-mail: notifications-h...@teaclave.apache.org

Reply via email to