Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[X86/Funclets] Fix uninitalized values in SoftwareExceptionFrame::UpdateContextFromTransitionBlock #115065

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
Apr 26, 2025

Conversation

filipnavara
Copy link
Member

This could lead to -1 offset inadvertently not applied in SfiInit for control PC. As a consequence a throw at the very last instruction of try block may not be matched correctly.

…ateContextFromTransitionBlock

This could lead to -1 offset inadvertently not applied in `SfiInit` for control PC. As a consequence a `throw` at the very last instruction of `try` block may not be matched correctly.
@jkotas
Copy link
Member

jkotas commented Apr 25, 2025

This could lead to -1 offset inadvertently not applied in SfiInit for control PC.

Do you mean this one?

controlPC -= STACKWALK_CONTROLPC_ADJUST_OFFSET;

Where were the uninitialized values read on this path before this fix?

@filipnavara
Copy link
Member Author

filipnavara commented Apr 25, 2025

Do you mean this one?

Yes

Where were the uninitialized values read on this path before this fix?

HasFaulted in the if depends on ContextFlags which were uninitalized. I initialized them to a correct value so we don't accidentally end up with CONTEXT_EXCEPTION_ACTIVE flag there (from random garbage in the allocation that is not zero initialized). The other initializations are not strictly necessary but I think it's better to have them consistent.

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thanks

@jkotas jkotas merged commit a2779f6 into dotnet:main Apr 26, 2025
95 of 97 checks passed
@VSadov
Copy link
Member

VSadov commented Apr 26, 2025

@filipnavara the change makes sense.
Is this what you think was causing the trouble in async case, or just found along the way?

I could try cherrypicking just this change into async branch.
Not sure about a whole merge from main though as that often breaks other random scenarios.

@am11
Copy link
Member

am11 commented Apr 26, 2025

Is this what you think was causing the trouble in async case, or just found along the way?

@filipnavara posted here that this was causing the async test failure: dotnet/runtimelab#3100 (comment), so cherry-picking would do the trick.

@VSadov
Copy link
Member

VSadov commented Apr 26, 2025

Somehow i am notified of upstream changes/comments more urgently than about comments in labs.
This all makes me happier, either way!!

@filipnavara filipnavara deleted the patch-21 branch April 27, 2025 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-ExceptionHandling-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants