xcp-1.6-updates/xen-4.1.hg

changeset 23301:a9c0a89c08f2

x86-64: detect processors subject to AMD erratum #121 and refuse to boot

Processors with this erratum are subject to a DoS attack by unprivileged
guest users.

This is XSA-9 / CVE-2012-2934.

Signed-off-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-unstable changeset: 25481:422880dc94a4
xen-unstable date: Tue Jun 12 11:33:42 2012 +0100
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Jan Beulich <JBeulich@suse.com>
date Tue Jun 12 11:42:57 2012 +0100 (2012-06-12)
parents 0fec1afa4638
children acbd36176913
files xen/arch/x86/cpu/amd.c xen/include/asm-x86/amd.h
line diff
     1.1 --- a/xen/arch/x86/cpu/amd.c	Tue Jun 12 11:46:11 2012 +0100
     1.2 +++ b/xen/arch/x86/cpu/amd.c	Tue Jun 12 11:42:57 2012 +0100
     1.3 @@ -32,6 +32,9 @@
     1.4  static char opt_famrev[14];
     1.5  string_param("cpuid_mask_cpu", opt_famrev);
     1.6  
     1.7 +static int opt_allow_unsafe;
     1.8 +boolean_param("allow_unsafe", opt_allow_unsafe);
     1.9 +
    1.10  static inline void wrmsr_amd(unsigned int index, unsigned int lo, 
    1.11  		unsigned int hi)
    1.12  {
    1.13 @@ -620,6 +623,11 @@ static void __devinit init_amd(struct cp
    1.14  		clear_bit(X86_FEATURE_MCE, c->x86_capability);
    1.15  
    1.16  #ifdef __x86_64__
    1.17 +	if (cpu_has_amd_erratum(c, AMD_ERRATUM_121) && !opt_allow_unsafe)
    1.18 +		panic("Xen will not boot on this CPU for security reasons.\n"
    1.19 +		      "Pass \"allow_unsafe\" if you're trusting all your"
    1.20 +		      " (PV) guest kernels.\n");
    1.21 +
    1.22  	/* AMD CPUs do not support SYSENTER outside of legacy mode. */
    1.23  	clear_bit(X86_FEATURE_SEP, c->x86_capability);
    1.24  
     2.1 --- a/xen/include/asm-x86/amd.h	Tue Jun 12 11:46:11 2012 +0100
     2.2 +++ b/xen/include/asm-x86/amd.h	Tue Jun 12 11:42:57 2012 +0100
     2.3 @@ -127,6 +127,9 @@
     2.4  #define AMD_MODEL_RANGE_START(range)    (((range) >> 12) & 0xfff)
     2.5  #define AMD_MODEL_RANGE_END(range)      ((range) & 0xfff)
     2.6  
     2.7 +#define AMD_ERRATUM_121                                                 \
     2.8 +    AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x0f, 0x0, 0x0, 0x3f, 0xf))
     2.9 +
    2.10  #define AMD_ERRATUM_170                                                 \
    2.11      AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x0f, 0x0, 0x0, 0x67, 0xf))
    2.12