kvm: report OSXSAVE in cpuid only if xsave is supported

Fixes #10625

PiperOrigin-RevId: 652665585
This commit is contained in:
Andrei Vagin
2024-07-15 19:09:54 -07:00
committed by gVisor bot
parent e87ab0a301
commit 6e9ad24d64
+3 -1
View File
@@ -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)