]> git.baikalelectronics.ru Git - kernel.git/commit
x86/mce: Fix set_mce_nospec() to avoid #GP fault
authorLuckTony <tony.luck@intel.com>
Fri, 31 Aug 2018 16:55:06 +0000 (09:55 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 1 Sep 2018 12:59:19 +0000 (14:59 +0200)
commit39bc8a7a3e9530793eb6b63ff65abad8359a2ae1
tree2ee0f08523889787829bf370b0f3566855dd0f01
parente81509b1c0e8b92d7051b45f11eb2792c600c3d0
x86/mce: Fix set_mce_nospec() to avoid #GP fault

The trick with flipping bit 63 to avoid loading the address of the 1:1
mapping of the poisoned page while the 1:1 map is updated used to work when
unmapping the page. But it falls down horribly when attempting to directly
set the page as uncacheable.

The problem is that when the cache mode is changed to uncachable, the pages
needs to be flushed from the cache first. But the decoy address is
non-canonical due to bit 63 flipped, and the CLFLUSH instruction throws a
#GP fault.

Add code to change_page_attr_set_clr() to fix the address before calling
flush.

Fixes: f989efbd1e3d ("x86/memory_failure: Introduce {set, clear}_mce_nospec()")
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Anvin <hpa@zytor.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: linux-edac <linux-edac@vger.kernel.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Link: https://lkml.kernel.org/r/20180831165506.GA9605@agluck-desk
arch/x86/mm/pageattr.c