-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Adjust IP after an AV during an STEP with FEATURE_EMULATE_SINGLESTEP enabled #105633
Changes from all commits
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 |
---|---|---|
|
@@ -5426,6 +5426,17 @@ BOOL IsSafeToCallExecutionManager() | |
|
||
BOOL IsSafeToHandleHardwareException(PCONTEXT contextRecord, PEXCEPTION_RECORD exceptionRecord) | ||
{ | ||
#ifdef FEATURE_EMULATE_SINGLESTEP | ||
Thread *pThread = GetThreadNULLOk(); | ||
if (pThread && pThread->IsSingleStepEnabled() && | ||
exceptionRecord->ExceptionCode != STATUS_BREAKPOINT && | ||
exceptionRecord->ExceptionCode != STATUS_SINGLE_STEP && | ||
exceptionRecord->ExceptionCode != STATUS_STACK_OVERFLOW) | ||
{ | ||
pThread->HandleSingleStep(contextRecord, exceptionRecord->ExceptionCode); | ||
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. The updated version of the change looks like it still calls HandleSingleStep from two different places, once here and once over in HandleHardwareException. I was suggesting that we converge those into a single call here. Is there a reason we need two different calls? If yes it would be great to add a comment saying why we have both, and if not it would be nice to get rid of the HandleHardwareException portion and do it all here. |
||
} | ||
#endif | ||
|
||
PCODE controlPc = GetIP(contextRecord); | ||
|
||
if (IsIPInWriteBarrierCodeCopy(controlPc)) | ||
|
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.
Any reason why we only invoke pThread->HandleSingleStep() in some cases and not others? Could we do something like this in IsSafeToHandleHardwareException() and remove the HandleSingleStep call from HandleHardwareException?
It feels easier to understand if we always invoke it from one place rather than conditionally invoke it from two different place.