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

Re: No results from the sgx_emmt tool.

Li__Xiaoguo
Beginner
819 Views

Hi,

I also encounter the same problem in Ubuntu 18.08 after enabling sgx_emmt when I use the sgx-gdb for debugging my program.

It prints the stack used normally. However, the heap used cannot print normally. Please refer to the following output.  

--------output---------------

[Peak stack used]: 7 KB
[Can't get peak heap used]: You may use version script to control symbol export. Please export 'g_peak_heap_used' in your version script.
[Can't get peak committed reserved memory]: You may use version script to control symbol export. Please export 'g_peak_rsrv_mem_committed' in your version script.

-----------output ---------------

Should I modify the python script ( sgx_emmt.py )?

0 Kudos
1 Solution
JesusG_Intel
Moderator
791 Views

Hello Li_Xiaoguo,


According to the section Enclave Memory Measurement Tool of the Intel SGX Developer Reference Guide for Linux, you must export g_peak_heap_used and g_peak_rsrv_mem_committed in the version script of the enclave.


In the SGX SDK sample, SampleEnclave, the enclave version script is /SampleEnclave/Enclave/Enclave.lds and its content is:


enclave.so

{

  global:

    g_global_data_sim;

    g_global_data;

    enclave_entry;

    g_peak_heap_used;

    g_peak_rsrv_mem_committed;

  local:

    *;

};


The Makefile must reference the version scrypt and define the symbol __ImageBase, similar to:

$ ld -o enclave.so file1.o file2.o \

-pie -eenclave_entry -nostdlib -nodefaultlibs –nostartfiles --no-undefined \

--whole-archive –lsgx_trts --no-whole-archive \

--start-group –lsgx_tstdc ––lsgx_tservice -lsgx_crypto -

-end-group \

-Bstatic -Bsymbolic --defsym=__ImageBase=0 --exportdynamic \

--version-script=enclave.lds


The SampleEnclave provided in the SGX SDK already has all of this in place so you can reuse its Makefile and version script.


Sincerely,

Jesus G.

Intel Customer Support


View solution in original post

0 Kudos
2 Replies
JesusG_Intel
Moderator
792 Views

Hello Li_Xiaoguo,


According to the section Enclave Memory Measurement Tool of the Intel SGX Developer Reference Guide for Linux, you must export g_peak_heap_used and g_peak_rsrv_mem_committed in the version script of the enclave.


In the SGX SDK sample, SampleEnclave, the enclave version script is /SampleEnclave/Enclave/Enclave.lds and its content is:


enclave.so

{

  global:

    g_global_data_sim;

    g_global_data;

    enclave_entry;

    g_peak_heap_used;

    g_peak_rsrv_mem_committed;

  local:

    *;

};


The Makefile must reference the version scrypt and define the symbol __ImageBase, similar to:

$ ld -o enclave.so file1.o file2.o \

-pie -eenclave_entry -nostdlib -nodefaultlibs –nostartfiles --no-undefined \

--whole-archive –lsgx_trts --no-whole-archive \

--start-group –lsgx_tstdc ––lsgx_tservice -lsgx_crypto -

-end-group \

-Bstatic -Bsymbolic --defsym=__ImageBase=0 --exportdynamic \

--version-script=enclave.lds


The SampleEnclave provided in the SGX SDK already has all of this in place so you can reuse its Makefile and version script.


Sincerely,

Jesus G.

Intel Customer Support


0 Kudos
JesusG_Intel
Moderator
769 Views

This thread has been marked as answered and Intel will no longer monitor this thread. If you want a response from Intel in a follow-up question, please open a new thread.


0 Kudos
Reply