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

Triggering Ecall multiple times results Segmentation fault on 2.1.3/2.3 sdk

das__batsayan
New Contributor I
410 Views

In 2.1.3/2.3 sdk , observed that if I trigger a ecall multiple times by external application ( 20 times or so), "Segmentation fault (core dumped)" happens. Following is the signature of the ecall that I tried to trigger multiple times by external program. 

public void ecall_test([in, size=20480] char *in1, int len, [out, size=20480] char *out1, [out] int *out2)
{
return;
}

Noticed that in/out size has dependency on number of times ecall can be triggered before the Segmentation fault. 
The user guide says "automatically allocates space on the trusted stack to hold a copy of the structure" ,  Dose not the bridge routine that allocates memory frees up the memory when ecall ends/returns? If this is a problem ,then  what is the solution? 

Used following config for enclave
If I reduce the size from 20480 to 2048, 
<EnclaveConfiguration>
    <ProdID>0</ProdID>
    <ISVSVN>0</ISVSVN>
    <StackMaxSize>0x40000</StackMaxSize>
    <HeapMaxSize>0x100000</HeapMaxSize>
    <TCSNum>10</TCSNum>
    <TCSPolicy>1</TCSPolicy>
    <!-- Recommend changing 'DisableDebug' to 1 to make the enclave undebuggable for enclave release -->
    <DisableDebug>0</DisableDebug>
    <MiscSelect>0</MiscSelect>
    <MiscMask>0xFFFFFFFF</MiscMask>
</EnclaveConfiguration>
tcs_num 10, tcs_max_num 10, tcs_min_pool 1
The required memory is 4173824B.

0 Kudos
0 Replies
Reply