From: "Jan Beulich" Subject: [PATCH] i386: fix full-value calculation of wrmsr handling for pv guests Date: Thu, 30 Jul 2009 16:00:54 +0100 Message-ID: <4A71D1C6020000780000D459@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org The call to mce_wrmsr() as well as the wrmsr handling of MSR_FAM10H_MMIO_CONF_BASE require that the full value written is being looked at; the type of that value was 'unsigned long', however. Signed-off-by: Jan Beulich --- 2009-07-10.orig/xen/arch/x86/traps.c 2009-07-15 12:07:19.0000000= 00 +0200 +++ 2009-07-10/xen/arch/x86/traps.c 2009-07-30 16:18:48.000000000 = +0200 @@ -1678,7 +1678,8 @@ static int is_cpufreq_controller(struct=20 static int emulate_privileged_op(struct cpu_user_regs *regs) { struct vcpu *v =3D current; - unsigned long *reg, eip =3D regs->eip, res; + unsigned long *reg, eip =3D regs->eip, value; + u64 res; u8 opcode, modrm_reg =3D 0, modrm_rm =3D 0, rep_prefix =3D 0, lock = =3D 0, rex =3D 0; enum { lm_seg_none, lm_seg_fs, lm_seg_gs } lm_ovr =3D lm_seg_none; int rc; @@ -2083,9 +2084,9 @@ static int emulate_privileged_op(struct=20 modrm_reg +=3D ((opcode >> 3) & 7) + (lock << 3); modrm_rm |=3D (opcode >> 0) & 7; reg =3D decode_register(modrm_rm, regs, 0); - if ( (res =3D do_get_debugreg(modrm_reg)) > (unsigned long)-256 ) + if ( (value =3D do_get_debugreg(modrm_reg)) > (unsigned long)-256 = ) goto fail; - *reg =3D res; + *reg =3D value; break; =20 case 0x22: /* MOV ,CR? */