]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
MCE: Fix vm86 handling for 32bit mce handler
authorAndi Kleen <andi@firstfloor.org>
Fri, 19 Nov 2010 12:16:22 +0000 (13:16 +0100)
committerTony Luck <tony.luck@intel.com>
Wed, 23 May 2012 21:22:37 +0000 (14:22 -0700)
When running on 32bit the mce handler could misinterpret
vm86 mode as ring 0. This can affect whether it does recovery
or not; it was possible to panic when recovery was actually
possible.

Fix this by always forcing vm86 to look like ring 3.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Tony Luck <tony.luck@intel.com>
arch/x86/kernel/cpu/mcheck/mce.c

index 66e1c51be084907d17584e5111eef77866f8f869..5f793e6c854bb095e65890c6968fcbd10aeb9fc3 100644 (file)
@@ -437,6 +437,14 @@ static inline void mce_gather_info(struct mce *m, struct pt_regs *regs)
                if (m->mcgstatus & (MCG_STATUS_RIPV|MCG_STATUS_EIPV)) {
                        m->ip = regs->ip;
                        m->cs = regs->cs;
+
+                       /*
+                        * When in VM86 mode make the cs look like ring 3
+                        * always. This is a lie, but it's better than passing
+                        * the additional vm86 bit around everywhere.
+                        */
+                       if (v8086_mode(regs))
+                               m->cs |= 3;
                }
                /* Use accurate RIP reporting if available. */
                if (rip_msr)