Fix KVM and ring0 compatibility with Go toolchain X15 zeroing. - #14460
Open
copybara-service[bot] wants to merge 1 commit into
Open
Fix KVM and ring0 compatibility with Go toolchain X15 zeroing.#14460copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
Initialize FPU and XCR0 in assembly before entering Go code, switch %rip to the lower half before calling kernel syscall and exception trampolines, and zero X15 on assembly return paths. Zeroing X15 is necessary because after cl/970057336 it is now used for zeroing other memory. To support this, Go now reads runtime.x86HasAVX which is a RIP-relative load, which happens when calling into compiler-generated ABI0 wrappers. When executing from the upper half of the virtual address space where we don't have data pages mapped (like we do when calling kernelSyscall and kernelException), this becomes a problem so we need to transition to the lower half via jumpToUser. PiperOrigin-RevId: 972102646
copybara-service
Bot
requested review from
konstantin-s-bogom and
nixprime
as code owners
August 27, 2026 21:11
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.
Fix KVM and ring0 compatibility with Go toolchain X15 zeroing.
Initialize FPU and XCR0 in assembly before entering Go code, switch %rip
to the lower half before calling kernel syscall and exception
trampolines, and zero X15 on assembly return paths.
Zeroing X15 is necessary because after cl/970057336 it is now used for
zeroing other memory. To support this, Go now reads runtime.x86HasAVX which
is a RIP-relative load, which happens when calling into compiler-generated
ABI0 wrappers. When executing from the upper half of the virtual address space
where we don't have data pages mapped (like we do when calling kernelSyscall
and kernelException), this becomes a problem so we need to transition to the
lower half via jumpToUser.