how to set CapturePFGPExceptions and in-enclave logging enable
Unhandled in-enclave exception. To get more information, configure the enclave with CapturePFGPExceptions=1 and enable the in-enclave logging. [openenclave-src/host/sgx/linux/exception.c:_host_signal_handler:101]
Hi, is this a production enclave ("debug": false in enclave.json)? You can't enable this for production enclaves for security reasons. For debug enclaves, it should be enabled by default.
After changing "debug: true", I do get closer to seeing stack:
ego run main
EGo v1.4.1 (8b99356398dd3bcb5f74e5194d20ce421f607404)
[erthost] loading enclave ...
[erthost] entering enclave ...
[ego] starting application ...
ERROR: Segmentation fault [openenclave-src/enclave/core/sgx/exception.c:oe_real_exception_dispatcher:469]
ERROR: Backtrace:
ERROR: main.main(): 0x7f3c41ec9c96
ERROR: runtime.main(): 0x7f3c411f3fa7
ERROR: runtime.goexit.abi0(): 0x7f3c41225141
ERROR: Backtrace:
ERROR: oe_abort_with_td(): 0x7f3c4087eab3
ERROR: oe_abort(): 0x7f3c4087d898
ERROR: oe_real_exception_dispatcher(): 0x7f3c40880fce
ERROR: main.main(): 0x7f3c41ec9c96
ERROR: runtime.main(): 0x7f3c411f3fa7
ERROR: runtime.goexit.abi0(): 0x7f3c41225141
ERROR: :OE_ENCLAVE_ABORTING [openenclave-src/host/calls.c:_call_enclave_function_impl:56]
ERROR: signal: aborted (core dumped)
Is there a way to see file/line numbers for these:
ERROR: main.main(): 0x7f3c41ec9c96
ERROR: runtime.main(): 0x7f3c411f3fa7
ERROR: runtime.goexit.abi0(): 0x7f3c41225141
?
Is there a way to get this output in production? Ie. with debug: false, to just get a stack trace when hitting null pointer exception?
Is there a way to see file/line numbers for these:
If you can reproduce this with ego-gdb attached, you'll see the file and line.
If not, you can try this:
- Open your executable with gdb (not ego-gdb)
- Exec
disas main.mainand guess what relative address belongs to the absolute address from the stack trace -
info line *0x...with the relative address gives you file and line.
Is there a way to get this output in production?
No. For security, logging of this and other messages is disabled in underlying Open Enclave.
Understood. I have created a fork and made necessary changes to be able to get stacks on crash.
We've documented a way to set Open Enclave settings like CapturePFGPExceptions. https://docs.edgeless.systems/ego/reference/config#advanced-users-tweak-underlying-enclave-configuration