Repository navigation
Conversation
Contributor
Author
|
The problem recurred even after applying this fix. The cause may lie elsewhere. We are continuing our investigation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #90.
Calling
sgx_destroy_enclavewhile SGX-Step still holds/dev/sgx-stepopen wedges the process in uninterruptible D state, and a reboot is the only way out. As you already suspected in the thread, the culprit is the APIC mode. When the in-kernel driver'ssgx_releaseunregisters its mmu-notifier it waits onsynchronize_srcu, but SGX-Step has left the victim core's timer in one-shot mode with no pending tick, so the SRCU grace period never advances and the wait blocks forever.Closing
/dev/sgx-stepfixes this, sincestep_releaserestores the timer. The catch is the timing. libsgxstep closes the fd from adestructor, which runs aftermainreturns, i.e. long aftersgx_destroy_enclavehas already hung. So this splits the close out into a newstep_close()and calls it just beforesgx_destroy_enclaveinapp/bench, so the victim core is ticking normally again before the driver reachessynchronize_srcu. The destructor still callsstep_close(), so the crash-cleanup path is unchanged and the second close is a guarded no-op.Verification
On a Gemini Lake machine (Debian 12, kernel 6.1) the bench reliably wedged in D state at
sgx_destroy_enclaveon master. With this change it single-steps the NOP slide andsgx_destroy_enclavereturns normally, and the process exits cleanly.