From 2f3dac78ca9aa1abb9d27570bc9ece0f486ddb60 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Tue, 16 Mar 2021 09:15:03 -0700 Subject: kvm: prefault a floating point state before restoring it If physical pages of a memory region are not mapped yet, the kernel will trigger KVM_EXIT_MMIO and we will map physical pages in bluepillHandler(). An instruction that triggered a fault will not be re-executed, it will be emulated in the kernel, but it can't emulate complex instructions like xsave, xrstor. We can touch the memory with simple instructions to workaround this problem. --- pkg/sentry/arch/arch_aarch64.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pkg/sentry/arch/arch_aarch64.go') diff --git a/pkg/sentry/arch/arch_aarch64.go b/pkg/sentry/arch/arch_aarch64.go index fd73751e7..6b81e9708 100644 --- a/pkg/sentry/arch/arch_aarch64.go +++ b/pkg/sentry/arch/arch_aarch64.go @@ -88,15 +88,15 @@ func (f aarch64FPState) fork() aarch64FPState { } // FloatingPointData returns the raw data pointer. -func (f aarch64FPState) FloatingPointData() *FloatingPointData { - return (*FloatingPointData)(&f[0]) +func (f aarch64FPState) FloatingPointData() FloatingPointData { + return ([]byte)(f) } // NewFloatingPointData returns a new floating point data blob. // // This is primarily for use in tests. -func NewFloatingPointData() *FloatingPointData { - return (*FloatingPointData)(&(newAarch64FPState()[0])) +func NewFloatingPointData() FloatingPointData { + return ([]byte)(newAarch64FPState()) } // State contains the common architecture bits for aarch64 (the build tag of this -- cgit v1.2.3