From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4FCBC4332F for ; Mon, 14 Nov 2022 09:09:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235669AbiKNJJj (ORCPT ); Mon, 14 Nov 2022 04:09:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235826AbiKNJJQ (ORCPT ); Mon, 14 Nov 2022 04:09:16 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D865330A; Mon, 14 Nov 2022 01:09:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=CmCkVP6XVasiawMWAc2MfoRTytUQFHnWEyNdl8YOQ2s=; b=sJPpFzwZM45thglm1Lcdyxo+hB /kqvQJXKkVETWLF3wT7rXwfO8CE/lwpxaayg0f9hTslmteCjyVriq71W1GMQrgyWKxT9p1tjrfzlX h8aN9mrCczTIN1mqdShxKbMeaJ3uPsgFeQliRvSUvmPeZwh4j32mfhRHIl98JloUN4FcvsTs6nL7Q yy6zxw1NnYlE93wllagjvtdqocPe+2BrzVqXwF/O+yr/xCpZHq8Y2fgQPqcPbrEXvrF1fRvsaJNr0 8alPAyIVFlxo9FTNHezy+JCEeN5Ln2onNVxA6C/vukjgqFqk5CLClrecLboV9ogydeVMV0oyYTywu 0ExVDnwg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ouVSd-00FNEY-ER; Mon, 14 Nov 2022 09:08:59 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id B08F2300282; Mon, 14 Nov 2022 10:08:51 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7BF392C8037C6; Mon, 14 Nov 2022 10:08:51 +0100 (CET) Date: Mon, 14 Nov 2022 10:08:51 +0100 From: Peter Zijlstra To: "Li, Xin3" Cc: Paolo Bonzini , "linux-kernel@vger.kernel.org" , "x86@kernel.org" , "kvm@vger.kernel.org" , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "hpa@zytor.com" , "Christopherson,, Sean" , "Tian, Kevin" Subject: Re: [RESEND PATCH 5/6] KVM: x86/VMX: add kvm_vmx_reinject_nmi_irq() for NMI/IRQ reinjection Message-ID: References: <6097036e-063f-5175-72b2-8935b12af853@redhat.com> <6fd26a70-3774-6ae7-73ea-4653aee106f0@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 14, 2022 at 04:39:40AM +0000, Li, Xin3 wrote: > > But what about NMIs, afaict this is all horribly broken for NMIs. > > > > So the whole VMX thing latches the NMI (which stops NMI recursion), right? > > > > But then you drop out of noinstr code, which means any random exception can > > happen (kprobes #BP, hw_breakpoint #DB, or even #PF due to random > > nonsense like *SAN). This exception will do IRET and clear the NMI latch, all > > before you get to run any of the NMI code. > > What you said here implies that we have this problem in the existing code. > Because a fake iret stack is created to call the NMI handler in the IDT NMI > descriptor, which lastly executes the IRET instruction. I can't follow; of course the IDT handler terminates with IRET, it has to no? And yes, the current code appears to suffer the same defect.