Skip to content

Fix x86 exception handling edge case #113760

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

Merged
merged 1 commit into from
Mar 24, 2025
Merged

Conversation

janvorli
Copy link
Member

When a NULL reference exception occurs in a JIT helper or a VSD stub, runtime pretends the exception occurred in the managed caller. There is a bug on x86 Windows where the COMPlusThrowCallback considers that frame to be the frame where the exception actually occurred (based on the m_crawl.isFirst). In case the call to the helper is the last instruction in a try region, the exception handler lookup would reject that address and the exception may not get handled at the right place or at all.

This change fixes it by ensuring that the m_crawl.isFirst is not set when the frame is not the frame of the failure.

Close #113106

When a NULL reference exception occurs in a JIT helper or a VSD stub,
runtime pretends the exception occured in the managed caller. There is a
bug on x86 Windows where the COMPlusThrowCallback considers that frame
to be the frame where the exception actually occurred (based on the
m_crawl.isFirst). In case the call to the helper is the last instruction
in a try region, the exception handler lookup would reject that address
and the exception may not get handled at the right place or at all.

This change fixes it by ensuring that the m_crawl.isFirst is not set
when the frame is not the frame of the failure.

Close dotnet#113106
@janvorli janvorli requested a review from jkotas March 21, 2025 13:47
@janvorli janvorli self-assigned this Mar 21, 2025
@Copilot Copilot AI review requested due to automatic review settings March 21, 2025 13:47
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Files not reviewed (2)
  • src/coreclr/vm/excep.cpp: Language not supported
  • src/coreclr/vm/stackwalk.cpp: Language not supported

@janvorli
Copy link
Member Author

/ba-g the failure is #113785

@janvorli janvorli merged commit 83d1100 into dotnet:main Mar 24, 2025
96 of 98 checks passed
@janvorli janvorli deleted the fix-x86-hw-eh branch March 24, 2025 14:55
@github-actions github-actions bot locked and limited conversation to collaborators Apr 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test failure: Regressions/coreclr/GitHub_35000/test35000/test35000.cmd
2 participants