From 6e9ad24d64212b4506a171b6a281d00c781bc8fc Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Mon, 15 Jul 2024 19:06:27 -0700 Subject: [PATCH] kvm: report OSXSAVE in cpuid only if xsave is supported Fixes #10625 PiperOrigin-RevId: 652665585 --- pkg/sentry/platform/kvm/kvm_amd64.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/sentry/platform/kvm/kvm_amd64.go b/pkg/sentry/platform/kvm/kvm_amd64.go index 2e682e8a6..208ec6de1 100644 --- a/pkg/sentry/platform/kvm/kvm_amd64.go +++ b/pkg/sentry/platform/kvm/kvm_amd64.go @@ -234,7 +234,9 @@ func updateGlobalOnce(fd int) error { // explicitly set OSXSAVE, since this does not come in the feature // entries, but can be provided when the relevant CR4 bit is set. s := &cpuidSupported - cpuid.X86FeatureOSXSAVE.Set(s) + if cpuid.HostFeatureSet().UseXsave() { + cpuid.X86FeatureOSXSAVE.Set(s) + } // Explicitly disable nested virtualization. Since we don't provide // any virtualization APIs, there is no need to enable this feature. cpuid.X86FeatureVMX.Unset(s)