Repository navigation
Conversation
The zero-byte retry loop had a semicolon after the for header, so foreshadow_round() ran once while the counter still incremented. transient_access retried an all-zero result without a bound.
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.
Hello,
While reproducing
app/foreshadowwe ran into two small things on the zero-byte path. Both are local changes. Happy to rework either of them if you would rather handle this differently.foreshadow()retry. Theforthat is meant to remeasure0x00/0xffhas a semicolon after the header, soforeshadow_round()runs once. The increment clause still runs, sofs_zero_retriesincreases even though no additional measurement happens. Removing the semicolon makes the loop do what the comment above it describes.transient_accessretry.jz retryhas no bound. If the byte stays zero after the fault handler has made the page present again, that loop spins in user space. We saw this in an enclave-free harness that restores the mapping the same wayapp/foreshadowdoes. We did not see it in the stock enclave build. The patch caps the loop at 64. A non-zero byte still leaves on the first success. A real zero falls through withrax == 0(oracle slot 0), which callers already treat as no hit.Tested on an i3-6100, kernel 7.1.5, microcode 0xba, with
NO_SGX=1for the enclave-free harness.Thanks for the framework. It is what made the reproduction possible.