Fix a use-after-free condition of single-instance TAs#784
Open
sangho2 wants to merge 8 commits into
Open
Conversation
1b2491d to
4ee95b3
Compare
4ee95b3 to
6cd446a
Compare
6cd446a to
85f20ae
Compare
ab19e6e to
6d28883
Compare
13fa1bf to
e755d5e
Compare
added 6 commits
May 5, 2026 22:52
e755d5e to
fae6d03
Compare
wdcui
reviewed
May 13, 2026
| /// should first check whether `dead == true` and if it is, bail without | ||
| /// touching `task_page_table_id`. `shim` and `loaded_program` remain | ||
| /// valid until the last `Arc` is dropped. | ||
| pub dead: bool, |
Member
There was a problem hiding this comment.
Let's change dead to a friendly name such as closed or unloaded or something else. Also, do we need atomic access to this field?
Contributor
Author
There was a problem hiding this comment.
let me use closed or something else. This data structure is behind mutex.
wdcui
reviewed
May 13, 2026
|
|
||
| // Safety: We are about to tear down this TA instance; | ||
| // no references to user-space memory will be held afterwards. | ||
| unsafe { teardown_ta_page_table(&shim, task_pt_id) }; |
Member
There was a problem hiding this comment.
Do we need to mark the instance as "dead" here?
Contributor
Author
There was a problem hiding this comment.
TaInstance is not yet created at this point.
Member
|
I left some comments above and shared with you offline the review comments by Claude. |
993b28c to
28872a2
Compare
|
🤖 SemverChecks 🤖 Click for details |
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.
This PR fixes a use-after-free condition of single-instance TAs where a CPU core attempts to open a session with a single-instance TA with a cached instance in memory while another is tearing down it (due to session close, TA crash/panic, ...). This PR gets rid of such condition by re-checking whether a cached instance is valid or not. Also, this PR removes a fast path for single-instance TA opening which is racy with less meaningful performance benefit.