Skip to content

Fix KVM and ring0 compatibility with Go toolchain X15 zeroing. - #14460

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test/cl972102646
Open

Fix KVM and ring0 compatibility with Go toolchain X15 zeroing.#14460
copybara-service[bot] wants to merge 1 commit into
masterfrom
test/cl972102646

Conversation

@copybara-service

Copy link
Copy Markdown

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.

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 copybara-service Bot added the exported Issue was exported automatically label Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Issue was exported automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant