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 ; 22 Jan 2019 04:36:01 -0000 Received: from userp2120.oracle.com ([156.151.31.85]) by Galois.linutronix.de with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1glnn5-0003gN-Ua for speck@linutronix.de; Tue, 22 Jan 2019 05:36:00 +0100 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0M4XpK4052942 for ; Tue, 22 Jan 2019 04:35:52 GMT Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2q3vhrh7bg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 22 Jan 2019 04:35:52 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x0M4ZpgP004300 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 22 Jan 2019 04:35:51 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x0M4ZpIr026309 for ; Tue, 22 Jan 2019 04:35:51 GMT Date: Mon, 21 Jan 2019 23:35:50 -0500 From: Konrad Rzeszutek Wilk Subject: [MODERATED] Re: [PATCH v5 05/27] MDSv5 21 Message-ID: <20190122043550.GG12859@char.us.oracle.com> References: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Fri, Jan 18, 2019 at 04:50:20PM -0800, speck for Andi Kleen wrote: > From: Andi Kleen > Subject: x86/speculation/mds: Support mds=full for NMIs > > NMIs don't go through the normal exit code when exiting > to user space. Normally we consider NMIs not sensitive anyways, > but they need special handling with mds=full. > So add an explicit check to do_nmi to clear the CPU with mds=full s/to do_nmi/in do_nmi/ > > Suggested-by: Josh Poimboeuf His email got lost? > Signed-off-by: Andi Kleen > --- > arch/x86/kernel/nmi.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c > index 18bc9b51ac9b..eb6e39238d1d 100644 > --- a/arch/x86/kernel/nmi.c > +++ b/arch/x86/kernel/nmi.c > @@ -494,7 +494,7 @@ do_nmi(struct pt_regs *regs, long error_code) > { > if (this_cpu_read(nmi_state) != NMI_NOT_RUNNING) { > this_cpu_write(nmi_state, NMI_LATCHED); > - return; > + goto out; > } > this_cpu_write(nmi_state, NMI_EXECUTING); > this_cpu_write(nmi_cr2, read_cr2()); > @@ -533,6 +533,10 @@ do_nmi(struct pt_regs *regs, long error_code) > write_cr2(this_cpu_read(nmi_cr2)); > if (this_cpu_dec_return(nmi_state)) > goto nmi_restart; > + > +out: > + if (static_key_enabled(&force_cpu_clear)) > + clear_cpu(); > } > NOKPROBE_SYMBOL(do_nmi); > > -- > 2.17.2