-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Use CopyContext to restore saved context on X86 #65490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2577,7 +2577,13 @@ int RedirectedHandledJITCaseExceptionFilter( | |
| pFrame->Pop(); | ||
|
|
||
| // Copy the saved context record into the EH context; | ||
| ReplaceExceptionContextRecord(pExcepPtrs->ContextRecord, pCtx); | ||
| // NB: cannot use ReplaceExceptionContextRecord here. | ||
| // these contexts may contain extended registers and may have different format | ||
| // for reasons such as alignment or context compaction | ||
| // | ||
| // REVIEW: CopyContext may fail. in theory. How should we handle that? FailFast? | ||
| CONTEXT* pTarget = pExcepPtrs->ContextRecord; | ||
| CopyContext(pTarget, pTarget->ContextFlags, pCtx); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems it would make sense to modify the ReplaceExceptionContextRecord to use CopyContext instead.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was not sure if
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not readily obvious but it's always guarded by
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also wonder if
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I have tried moving the fix into |
||
|
|
||
| DWORD espValue = pCtx->Esp; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, FailFast is appropriate for failure here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, be careful calling new functions from this function. If they have destructors and the compiler chooses to inline them, the runtime will start crashing.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of code like:
Would that fit here?
It is highly unlikely that copy would fail, but it'd be nice to have some diagnostics if that start happenning.