ia64/xen-unstable

changeset 8384:c9929c7c63f6

Prevent new potential features from being exposed to the
guests when not virtualized properly. Guests can attempt to set the
control registers, etc. (and get #GP and panic) if they are aware of the
new feature and the cpuid says it's available.

Signed-off-by: <jun.nakajima@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Dec 14 19:35:38 2005 +0100 (2005-12-14)
parents 25d0ba51338e
children 7ef59d40c26a
files xen/arch/x86/vmx.c
line diff
     1.1 --- a/xen/arch/x86/vmx.c	Wed Dec 14 12:52:02 2005 +0000
     1.2 +++ b/xen/arch/x86/vmx.c	Wed Dec 14 19:35:38 2005 +0100
     1.3 @@ -503,6 +503,8 @@ static void vmx_do_no_device_fault(void)
     1.4      __vm_clear_bit(EXCEPTION_BITMAP, EXCEPTION_BITMAP_NM);
     1.5  }
     1.6  
     1.7 +/* Reserved bits: [31:15], [12:11], [9], [6], [2:1] */
     1.8 +#define VMX_VCPU_CPUID_L1_RESERVED 0xffff9a46 
     1.9  
    1.10  static void vmx_vmexit_do_cpuid(unsigned long input, struct cpu_user_regs *regs)
    1.11  {
    1.12 @@ -537,6 +539,7 @@ static void vmx_vmexit_do_cpuid(unsigned
    1.13          }
    1.14  
    1.15          /* Unsupportable for virtualised CPUs. */
    1.16 +        ecx &= ~VMX_VCPU_CPUID_L1_RESERVED; /* mask off reserved bits */
    1.17          clear_bit(X86_FEATURE_VMXE & 31, &ecx);
    1.18          clear_bit(X86_FEATURE_MWAIT & 31, &ecx);
    1.19      }