Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1625536

[RFC PATCH] x86/mce: Check MCi_STATUS[MISCV] for usable addr on Intel only

From Borislav Petkov <bp@suse.de>
Newsgroups linux.kernel
Subject [RFC PATCH] x86/mce: Check MCi_STATUS[MISCV] for usable addr on Intel only
Date 2017-04-18 20:40 +0200
Message-ID <txGcG-140-31@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


mce_usable_address() does a bunch of basic sanity checks to verify
whether the address reported with the error is usable for further
processing. However, we do check MCi_STATUS[MISCV] and that is not
needed on AMD as that bit says that there's additional information about
the logged error in the MCi_MISCj banks.

But we don't need that to know whether the address is usable - we only
need to know whether the physical address is valid - i.e., ADDRV.

 [ On Intel the MISCV bit is needed to perform additional checks to
   determine whether the reported address is a physical one, etc. ]

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: "Ghannam, Yazen" <Yazen.Ghannam@amd.com>
---

Right, so I think we don't need to look at MISCV on AMD to check whether
the address is usable because ADDRV already denotes that MCi_ADDR has
the physical address. Yes?

 arch/x86/kernel/cpu/mcheck/mce.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index d409e21ec275..5abd4bf73d6e 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -480,17 +480,22 @@ static void mce_report_event(struct pt_regs *regs)
  */
 static int mce_usable_address(struct mce *m)
 {
-	if (!(m->status & MCI_STATUS_MISCV) || !(m->status & MCI_STATUS_ADDRV))
+	if (!(m->status & MCI_STATUS_ADDRV))
 		return 0;
 
 	/* Checks after this one are Intel-specific: */
 	if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
 		return 1;
 
+	if (!(m->status & MCI_STATUS_MISCV))
+		return 0;
+
 	if (MCI_MISC_ADDR_LSB(m->misc) > PAGE_SHIFT)
 		return 0;
+
 	if (MCI_MISC_ADDR_MODE(m->misc) != MCI_MISC_ADDR_PHYS)
 		return 0;
+
 	return 1;
 }
 
-- 
2.11.0


-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[RFC PATCH] x86/mce: Check MCi_STATUS[MISCV] for usable addr on  Intel only Borislav Petkov <bp@suse.de> - 2017-04-18 20:40 +0200
  RE: [RFC PATCH] x86/mce: Check MCi_STATUS[MISCV] for usable addr on  Intel only "Ghannam, Yazen" <Yazen.Ghannam@amd.com> - 2017-04-18 23:30 +0200
    Re: [RFC PATCH] x86/mce: Check MCi_STATUS[MISCV] for usable addr on  Intel only Borislav Petkov <bp@alien8.de> - 2017-04-19 00:20 +0200
  [tip:ras/core] x86/mce: Check MCi_STATUS[MISCV] for usable addr on  Intel only tip-bot for Borislav Petkov <tipbot@zytor.com> - 2017-04-19 12:20 +0200

csiph-web