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

Work-around an issue in Arm64 regarding the isolated use of CONTEXT_CONTROL. #313

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pmsjt
Copy link
Member

@pmsjt pmsjt commented Mar 28, 2024

Work-around an issue in Arm64 (and Arm64EC) in which LR and FP registers may become zeroed when CONTEXT_CONTROL is used without CONTEXT_INTEGER.

The addition of the CONTEXT_INTEGER flag does not translate to any real overhead: The kernel performs relatively expensive stack unwind operations for Get and Set ThreadContext touching and scanning over large unwind info datastructures. In scenario the extra few integers register copies (which share cache lines with CONTEXT_CONTROL) can't be observed in the scale and the noise.

This change is adding CONTEXT_INTEGER to the Get and SetThread context calls for both Arm64 and x86_64 so that Arm64EC is also addressed.

This issue is being addressed in the OS as well, but it will take time to disseminate the fix and backport it to all released versions. When the fix is out, this change can arguably be considered redundant, but given there is no real downside, I don't see an objective reason to not add it or making diligent plans to remove it.

…ers may become zeroed when CONTEXT_CONTROL is used without CONTEXT_INTEGER.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant