x86/MCE/AMD: Cache SMCA MISC block addresses
authorBorislav Petkov <bp@suse.de>
Thu, 17 May 2018 08:46:26 +0000 (10:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Jun 2018 09:41:55 +0000 (11:41 +0200)
commit4cbe6caa4c6c3e9099d73160c59fe3c11ca5b3c5
tree835e46dc44deae7cc86aaf8cfdb801b35895fd7e
parent5df3a1b9f87b62c66fb2fa39c7b22eb32303df36
x86/MCE/AMD: Cache SMCA MISC block addresses

commit 78ce241099bb363b19dbd0245442e66c8de8f567 upstream.

... into a global, two-dimensional array and service subsequent reads from
that cache to avoid rdmsr_on_cpu() calls during CPU hotplug (IPIs with IRQs
disabled).

In addition, this fixes a KASAN slab-out-of-bounds read due to wrong usage
of the bank->blocks pointer.

Fixes: 27bd59502702 ("x86/mce/AMD: Get address from already initialized block")
Reported-by: Johannes Hirte <johannes.hirte@datenkhaos.de>
Tested-by: Johannes Hirte <johannes.hirte@datenkhaos.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Yazen Ghannam <yazen.ghannam@amd.com>
Link: http://lkml.kernel.org/r/20180414004230.GA2033@probook
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/cpu/mcheck/mce_amd.c