[release/6.0] Fix exception propagation over HW exception frame on macOS arm64 #64262
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.
Backport of #63596 to release/6.0
/cc @janvorli
There is a bug in hardware exception handling on macOS arm64 in setting up
the fake stack frame for the PAL_DispatchExceptionWrapper. Unwinding
while propagating an exception through the frame that caused the hardware
exception restores incorrect value of the LR register.
Customer Impact
Attempt to throw a new exception or rethrow from a catch handler of a NullReferenceException that stemmed from a virtual call on a
null
reference results in a SIGSEGV crash of the process on macOS arm64.Testing
coreclr and libraries tests, targeted regression test.
Risk
Low. With the change, the unwind gets an exact copy of the frame of the hardware exception that was reported by the OS. So it is correct by definition.