Fix x86 async frame generic type resolution in DBI#126915
Open
tommcdon wants to merge 2 commits intodotnet:mainfrom
Open
Fix x86 async frame generic type resolution in DBI#126915tommcdon wants to merge 2 commits intodotnet:mainfrom
tommcdon wants to merge 2 commits intodotnet:mainfrom
Conversation
CordbAsyncFrame::LoadGenericArgs was using SafeReadStruct<CORDB_ADDRESS> to read the generic arg token from the continuation object. CORDB_ADDRESS is ULONG64 (always 8 bytes), but on x86 targets the field is a 4-byte pointer. Reading 8 bytes pulled in adjacent memory, producing garbage pointer values that caused EnumerateTypeParameters to return E_INVALIDARG. Changed to SafeReadStruct<SIZE_T> which matches the target pointer size (4 bytes on x86, 8 bytes on x64), consistent with how CordbJITILFrame::LoadGenericArgs reads tokens via GetRegisterOrStackValue. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes incorrect generic type argument token reads for x86 async frames in the CoreCLR DBI by reading a pointer-sized value from the continuation object instead of an always-8-byte CORDB_ADDRESS, preventing adjacent-memory contamination and downstream E_INVALIDARG failures.
Changes:
- Update
CordbAsyncFrame::LoadGenericArgsto read the raw generic token asSIZE_Tand then widen toCORDB_ADDRESS. - Add explanatory comments aligning the logic with the existing “read raw token then resolve via DAC” pattern used elsewhere.
rcj1
approved these changes
Apr 14, 2026
hoyosjs
approved these changes
Apr 15, 2026
This was referenced Apr 15, 2026
Member
Author
|
/ba-g test failures are unrelated |
max-charlamb
approved these changes
Apr 15, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
CordbAsyncFrame::LoadGenericArgs was using SafeReadStruct<CORDB_ADDRESS> to read the generic arg token from the continuation object. CORDB_ADDRESS is ULONG64 (always 8 bytes), but on x86 targets the field is a 4-byte pointer. Reading 8 bytes pulled in adjacent memory, producing garbage pointer values that caused EnumerateTypeParameters to return E_INVALIDARG.
Changed to SafeReadStruct<SIZE_T> which matches the target pointer size (4 bytes on x86, 8 bytes on x64), consistent with how CordbJITILFrame::LoadGenericArgs reads tokens via GetRegisterOrStackValue.