intel / intel/confidential-computing.sgx.sdk

abort() causes illegal hardware instruction

Open
#5 6 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
2
Forks
3
PR merge metrics
No merged PRs in 30d

Description

According to the Developer Reference

> Abort Function
The abort() function is supported within an enclave but has a different behavior.
When a thread calls the abort function, it makes the enclave unusable by
setting the enclave state to a specific value that allows the tRTS and application
to detect and report this event. **The aborting thread generates an exception
and exits the enclave**, while other enclave threads continue running
normally until they exit the enclave. Once the enclave is in the unusable state,
subsequent enclave calls and OCALL returns generate the same error indicating
that the enclave is no longer usable. After all thread calls abort, the
enclave is locked and cannot be recovered. You have to destroy, reload and
reinitialize the enclave to use it again.

It reads that abort should cause a catchable exception and exit the enclave gracefully, but in the following sample code, it causes an illegal hardware instruction error and the enclave exits immediately. How am I suppose to handle abort/assert?

```
55 void ecall()
56 {
57 try {
58 assert(false) // calls abort();
59 }
60 catch(...) {
61 }
```
> [1] 15341 illegal hardware instruction (core dumped) ./app

Contributor guide

Open the contributing guide

Research direction

Start with the Developer Reference's Abort Function behavior and the sample ecall() shown in the issue; reproduce the assert(false) path and observe how the enclave and application report it. Compare the documented exception behavior with the illegal hardware instruction, and document the supported handling for abort/assert.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.