Skip to content
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

Ensure that CONTEXT_XStateFeaturesMask is explicitly zeroed out on RtlCaptureContext #84012

Merged
merged 1 commit into from
Mar 28, 2023

Conversation

tannergooding
Copy link
Member

@tannergooding tannergooding commented Mar 28, 2023

We don't explicitly zero the CONTEXT structs we create before calling RtlCaptureContext and so it leaves these bits otherwise undefined.

This resolves the issue raised in #84000 (comment)

This resolves #84010

Comment on lines 82 to 86
LEAF_ENTRY RtlCaptureContext, _TEXT
mov DWORD PTR [rdi + CONTEXT_ContextFlags], (CONTEXT_AMD64 | CONTEXT_FULL | CONTEXT_SEGMENTS)
mov QWORD PTR [rdi + CONTEXT_XStateFeaturesMask], 0
jmp C_FUNC(CONTEXT_CaptureContext)
LEAF_END RtlCaptureContext, _TEXT
Copy link
Member Author

Choose a reason for hiding this comment

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

Just something else to note...

It seems that CONTEXT_CaptureContext doesn't currently and, as far as I can tell, has never captured the YMM state. Is this expected? Should it be capturing that state as part of the thread suspend/restore logic here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Will address this question separately once I hear back from @janvorli

Copy link
Member

Choose a reason for hiding this comment

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

@tannergooding the CONTEXT_CaptureContext is used only by the debugger code on Unix. It is not used for thread suspension. I am not sure if debugger stuff cares about the YMM registers or not.

@tannergooding
Copy link
Member Author

CC. @janvorli, @AndyAyersMS

@tannergooding tannergooding merged commit 39c02d9 into dotnet:main Mar 28, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Apr 27, 2023
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 System.Tests.StringTests.IndexOf_SingleLetter on osx-x64 Debug
3 participants