Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix wrong CONTEXT_UNWOUND_TO_CALL from special APC on ARM64 (#103731)
While testing an unrelated change, I've noticed that some coreclr tests were crashing on arm64 Windows with GCStress 3 intermittently. In all the cases, the special user mode APC callback was on the stack. It turned out that the context that the callback gets from the OS has the CONTEXT_UNWOUND_TO_CALL flag set, which is incorrect, as the context is the location of where the execution was interrupted is not unwound to call. That flag resulted in adjustment of the PC to the previous instruction. In the crashing cases, it adjusted it to a location of a "ret", so the unwinding just loaded PC from LR, which got an incorrect result. The effect of it was that in this case GC stack walk ended up prematurely, which resulted in GC holes. The fix is to clear the flag on the context we get from Windows.
- Loading branch information