]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.3.8/x86-mce-fix-check-for-processor-context-when-machine-check-was-taken.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.3.8 / x86-mce-fix-check-for-processor-context-when-machine-check-was-taken.patch
CommitLineData
4706c5bc
GKH
1From 875e26648cf9b6db9d8dc07b7959d7c61fb3f49c Mon Sep 17 00:00:00 2001
2From: Tony Luck <tony.luck@intel.com>
3Date: Wed, 23 May 2012 14:14:22 -0700
4Subject: x86/mce: Fix check for processor context when machine check was taken.
5
6From: Tony Luck <tony.luck@intel.com>
7
8commit 875e26648cf9b6db9d8dc07b7959d7c61fb3f49c upstream.
9
10Linus pointed out that there was no value is checking whether m->ip
11was zero - because zero is a legimate value. If we have a reliable
12(or faked in the VM86 case) "m->cs" we can use it to tell whether we
13were in user mode or kernelwhen the machine check hit.
14
15Reported-by: Linus Torvalds <torvalds@linuxfoundation.org>
16Signed-off-by: Tony Luck <tony.luck@intel.com>
17Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18
19---
20 arch/x86/kernel/cpu/mcheck/mce-severity.c | 16 ++++++++++------
21 1 file changed, 10 insertions(+), 6 deletions(-)
22
23--- a/arch/x86/kernel/cpu/mcheck/mce-severity.c
24+++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c
25@@ -145,15 +145,19 @@ static struct severity {
26 };
27
28 /*
29- * If the EIPV bit is set, it means the saved IP is the
30- * instruction which caused the MCE.
31+ * If mcgstatus indicated that ip/cs on the stack were
32+ * no good, then "m->cs" will be zero and we will have
33+ * to assume the worst case (IN_KERNEL) as we actually
34+ * have no idea what we were executing when the machine
35+ * check hit.
36+ * If we do have a good "m->cs" (or a faked one in the
37+ * case we were executing in VM86 mode) we can use it to
38+ * distinguish an exception taken in user from from one
39+ * taken in the kernel.
40 */
41 static int error_context(struct mce *m)
42 {
43- if (m->mcgstatus & MCG_STATUS_EIPV)
44- return (m->ip && (m->cs & 3) == 3) ? IN_USER : IN_KERNEL;
45- /* Unknown, assume kernel */
46- return IN_KERNEL;
47+ return ((m->cs & 3) == 3) ? IN_USER : IN_KERNEL;
48 }
49
50 int mce_severity(struct mce *m, int tolerant, char **msg)