From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 12 Jan 2019 01:36:10 -0000 Received: from mga05.intel.com ([192.55.52.43]) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gi87S-0002Kx-Ek for speck@linutronix.de; Sat, 12 Jan 2019 02:29:50 +0100 From: Andi Kleen Subject: [MODERATED] [PATCH v4 08/28] MDSv4 19 Date: Fri, 11 Jan 2019 17:29:21 -0800 Message-Id: <7da7ec0940e362ea937690352eaa421e1b12b8b9.1547256470.git.ak@linux.intel.com> In-Reply-To: References: In-Reply-To: References: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 To: speck@linutronix.de Cc: Andi Kleen List-ID: The main kernel exits on 32bit kernels are already handled by earlier patches. But for NMIs we need to clear in the assembler code because NMIs don't go through C code on exit, but they still might need to clear due to mds=full This could be handled with a static key like 64bit, but for now just add an unconditional cpu clear on NMI exit. Signed-off-by: Andi Kleen --- arch/x86/entry/entry_32.S | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S index d309f30cf7af..28b640f37f8d 100644 --- a/arch/x86/entry/entry_32.S +++ b/arch/x86/entry/entry_32.S @@ -45,6 +45,7 @@ #include #include #include +#include #include "calling.h" @@ -1446,6 +1447,11 @@ ENTRY(nmi) movl %ebx, %esp .Lnmi_return: + /* + * Only needed with mds=full + * But for now do it unconditionally. + */ + CLEAR_CPU CHECK_AND_APPLY_ESPFIX RESTORE_ALL_NMI cr3_reg=%edi pop=4 jmp .Lirq_return -- 2.17.2