[release/9.0-preview2] Fix unwound stack range check for the new EH#99043
Closed
github-actions[bot] wants to merge 1 commit intorelease/9.0-preview2from
Closed
[release/9.0-preview2] Fix unwound stack range check for the new EH#99043github-actions[bot] wants to merge 1 commit intorelease/9.0-preview2from
github-actions[bot] wants to merge 1 commit intorelease/9.0-preview2from
Conversation
With the old EH, the unwound stack range limits are using SP for each frame on x64 and a caller SP on arm64, arm, riscv64 and longsoon. The ExceptionTracker::IsInStackRegionUnwoundBySpecifiedException takes that into consideration when detecting whether a frame with a specific SP was already unwound or not. With the new EH though, the range is always based on the actual SP of the frame, so the check was being done incorrectly on non-x64 architectures. That lead to a crash in a test that has dynamic method code on stack and its frame was unwound. The bug has caused that method to not to be reported to GC, so the dynamic method was destroyed by GC. And later on, another GC stack walk has crashed while trying to get info on the method. This change fixes it by making the check with new EH enabled the same for all architectures, the same as it was for x64 in the old EH. Close #98914
This was referenced Feb 28, 2024
Member
|
Superseded by #99067 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 #99041 to release/9.0-preview2
/cc @janvorli
Customer Impact
When a customer code is using dynamic methods on ARM64, which can be indirect (e.g. by using reflection invoke at least in some cases), the GC stack walk can miss the dynamic method during exception handling and not report it to the GC. The method then gets collected, destroyed and a follow up GC / EH stack walk crashes when trying to get information on it.
Regression
#98570 - enables the new exception handling by default.
Testing
Local testing and debugging of the tests that have failed due to the problem. Without the fix, it was reproducing on almost every run of a coreclr test
Risk
Low, fixes a clearly incorrect range check.