Intel® Software Guard Extensions (Intel® SGX)
Discussion board focused on hardware-based isolation and memory encryption to provide extended code protection in solutions.

Help:A Simple_Enclave project Error

Shn_Y_
Beginner
1,587 Views

Hi,

I tried to use Intel Pin to analyze a simple enclave project.The project is able to run in VS2013 ,simulation mode ,x64.(SDK1.6,PSW1.6)

But it appears a problem when i use Pin,as the following shows. 

D:\tools\pin\source\tools\ManualExamples>pin -t obj-intel64\inscount0.dll -- obj-intel64\enclaveapp.exe

[sgx_create_enclavew ..\..\..\psw\urts\win\urts.cpp:83] Couldn't open file with CreateFile()

App: error 0x200f, failed to create enclave.

How could I solve this problem?

0 Kudos
8 Replies
Surenthar_S_Intel
1,587 Views

Hi,

Did you run the application through command prompt or Local SGX Debugger?

If you are using the Local SGX Debugger, Please make sure change the "current working directory" pointing to $(OutDir) instead of $(ProjectDir) (Both App and Enclave)

Configuration Properties --> Debugging --> Working Directory --> $(OutDir).

Please look into below link for more information 

-Surenthar

0 Kudos
Shn_Y_
Beginner
1,587 Views

Selvaraj, Surenthar (Intel) wrote:

Hi,

Did you run the application through command prompt or Local SGX Debugger?

If you are using the Local SGX Debugger, Please make sure change the "current working directory" pointing to $(OutDir) instead of $(ProjectDir) (Both App and Enclave)

Configuration Properties --> Debugging --> Working Directory --> $(OutDir).

Please look into below link for more information 

-Surenthar

hello

Thank you for your response.

I run the application through command prompt using intel pin.So how could I solve the problem...-_-

0 Kudos
Surenthar_S_Intel
1,587 Views

Hi,

Please Change the "current working directory" pointing to $(OutDir) instead of $(ProjectDir) (Both App and Enclave)

Configuration Properties --> Debugging --> Working Directory --> $(OutDir).

-Surenthar

0 Kudos
Shn_Y_
Beginner
1,587 Views

Selvaraj, Surenthar (Intel) wrote:

Hi,

Please Change the "current working directory" pointing to $(OutDir) instead of $(ProjectDir) (Both App and Enclave)

Configuration Properties --> Debugging --> Working Directory --> $(OutDir).

-Surenthar

Hello

Through Local sgx debugger ,I have changed  the "current working directory" pointing to $(OutDir) instead of $(ProjectDir) (Both App and Enclave) and it run without any problem.

But through command prompt using intel pin,the problem still exits.I wonder did anything go wrong there?

0 Kudos
Francisco_C_Intel
1,587 Views

You seem to be running:

> D:\tools\pin\source\tools\ManualExamples>pin -t obj-intel64\inscount0.dll -- obj-intel64\enclaveapp.exe

So the "working directory" is "D:\tools\pin\source\tools\ManualExamples"

If your enclave is not located in the "working directory" you need to use absolute paths when calling create enclave or "cd" to the directory where the enclave is located and then run pin from there (using absolute path of the pin executable or adding its path to the PATH env var).

0 Kudos
Shn_Y_
Beginner
1,587 Views

Francisco C. (Intel) wrote:

You seem to be running:

> D:\tools\pin\source\tools\ManualExamples>pin -t obj-intel64\inscount0.dll -- obj-intel64\enclaveapp.exe

So the "working directory" is "D:\tools\pin\source\tools\ManualExamples"

If your enclave is not located in the "working directory" you need to use absolute paths when calling create enclave or "cd" to the directory where the enclave is located and then run pin from there (using absolute path of the pin executable or adding its path to the PATH env var).

Hello

Actually my enclave was located in the "working directory" before.But I have used absolute paths when calling created enclave as you said.It runs without any problem.

Thank you.^_^

0 Kudos
袁__子欣
Beginner
1,587 Views

Hello Mr shn Y,

     Recently my research will use pintools to do some instruments on SGX program, but always get into trouble with "cant open Enclave file". I notice that you have done some related work. Could you please tell how do you do your work with pintools? Thanks a lot.

 

Regards,

Bruce Yuan

0 Kudos
Francisco_C_Intel
1,587 Views

In your code where you are creating enclaves, you should use the full path to the enclave file instead of only "enclave.signed.dll".

 

Francisco

0 Kudos
Reply