Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Shohei_K_
Beginner
221 Views

Where is saved register information in untrusted

Jump to solution

Hi,I'm Shohei.I'm studying intel SGX in Japan.

I tried to get untrusted-stack information from enclave, but I couldn't do it.

When EENTER is called, where is saved register information in untrusted world. Is saved in Enclave?

Thank you

Shohei

0 Kudos
1 Solution
yunfeng7854
New Contributor I
221 Views

The enclaves and the outside have different stacks. On EENTER, the outside stack pointer RSP, RBP are saved in the state save area (SSA) frame of the current thread's TCS, for later restore on AEX. It is saved in the GPRSGX region of SSA frame. Here is the reference manual: https://software.intel.com/sites/default/files/managed/48/88/329298-002.pdf Sec. 2.9.1, Table 2-8.

Wenhao

View solution in original post

4 Replies
yunfeng7854
New Contributor I
222 Views

The enclaves and the outside have different stacks. On EENTER, the outside stack pointer RSP, RBP are saved in the state save area (SSA) frame of the current thread's TCS, for later restore on AEX. It is saved in the GPRSGX region of SSA frame. Here is the reference manual: https://software.intel.com/sites/default/files/managed/48/88/329298-002.pdf Sec. 2.9.1, Table 2-8.

Wenhao

View solution in original post

Shohei_K_
Beginner
221 Views

Thank you for your answer. That information is good for me.

But I have another question. When I tried, I call GPRSGX region of SSA frame from enclave.Here is that code.

  _thread_data_t *thread_data;
  thread_data = get_thread_data();

  ssa_gpr_t *ssa_gpr = reinterpret_cast<ssa_gpr_t *>(thread_data->first_ssa_gpr);
  unsigned long addbp = ssa_gpr->REG(bp_u);

But addbp points enclave's stack ebp not uEBP. Where do you think there were mistakes?

Thank you

Shohei

yunfeng7854
New Contributor I
221 Views

I tried your code and I believe it returned an address outside the enclave. Could you try again?

I am using Intel SDK version 1.8, with gcc version 5.4.0 on a Ubuntu 16.04 system.

Wenhao

Shohei_K_
Beginner
221 Views

Thanks

That address is outside Enclave stack address? My code returns enclave stack ebp.

I tried this code in /Samplecode/SampleEnclave/Enclave/Trustedlibrary/Libc.cpp on SDK.

So I will check address outside the enclave again, and SDK, gcc, Ubuntu version.

Thanks a lot!

Shohei

Reply