Open elichai opened 5 years ago
Can you please check your stack size? https://unix.stackexchange.com/questions/127602/default-stack-size-for-pthreads
It says 8192
but I'll try increasing it while compiling.
why isn't this allocated on the heap?
and is this the same case in ecalls?
Inside enclave, the malloc is only able to be used to malloc trusted memory. Ecall is using trusted stack, you need to configure the stack size in the enclave configuration file.
This is to make the implementation simpler. Allocating on the heap will need another ocall to do the malloc in untrusted memory before current ocall.
I'm having the same issue after I updated to 2.7 version! sgx_ocalloc throws a segfault when it tries to allocate a buffer around 790KB. I did try increasing stack size through ulimit -S -s x to 16MB, 128MB, and 256MB, but it kept throwing the segfault. I really wanted to see where the abort() happens! I recompiled the SDK in debug mode and it did not happen again?
Does anyone have any suggestions on what can cause this? I really need to benchmark the code, so it would be best if it is linked against optimized libraries with no debug symbols in them.
@arefasvadi Do you tried sgx-gdb to stop the application when it crashed? If you did it, can you please attach the call trace at that time?
Does anyone have any solution to that? I am having same issue. I tried to increase both the stack size to 128 MB and the heap size to 6 GB. It successfully allocates the buffer in the enclave. But causing segmentation fault for only 10 MB buffer when writing to the outside enclave via ocall.
I am attaching the stack-trace using sgx-gdb.
`#0 0x00007ffef59779c1 in sgx_ocalloc_switchless ()
pSize=10480000, ret_status=0x7fff651be1c8) at Enclave/Enclave_t.c:1873
pos=0) at Enclave/BlockFile.cpp:68
p_recordLimit=2) at Enclave/synthetic_data.cpp:110
p_recordLimit=2) at Enclave/Enclave.cpp:193
from /app/sgxsdk/sdk_libs/libsgx_urts_sim.so
p_recordSize=52428800, p_recordLimit=2) at App/Enclave_u.c:535
at App/App.cpp:287
`
I have same issue too.
I find the solution by setting system stack size!
Hi, I'm trying to pass a big chunk of data through an ocall, and I get a segmentation fault when I pass around ~2MB. is a known thing? Trying to debug where exactly the SIGSEGV comes from leds me to it coming from the line:
__tmp = sgx_ocalloc(ocalloc_size);
inEnclave_t.c
withocalloc_size = 2196985
.The C code in Enclave_t looks as follow:
In the SIGSEGV instance it is called with these parameters:
#1 0x00007fff0002ae1d in ocall_save_to_memory (retval=0x7fff50c250b8, data_ptr=0x7fff02b2d718 "", data_len=2196961) at enclave/Enclave_t.c:1742
Any ideas if there's a cap on how much data can be passed through an ocall or is it something else that I'm missing?