lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20374e3651cd61b7c25d13cb5f07af98da76fb13.camel@intel.com>
Date: Tue, 26 Nov 2024 05:37:51 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "seanjc@...gle.com" <seanjc@...gle.com>, "binbin.wu@...ux.intel.com"
	<binbin.wu@...ux.intel.com>
CC: "kvm@...r.kernel.org" <kvm@...r.kernel.org>, "Li, Xiaoyao"
	<xiaoyao.li@...el.com>, "Zhao, Yan Y" <yan.y.zhao@...el.com>,
	"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>, "Hunter, Adrian"
	<adrian.hunter@...el.com>, "Li, Xin3" <xin3.li@...el.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "Yang,
 Weijiang" <weijiang.yang@...el.com>, "Chatre, Reinette"
	<reinette.chatre@...el.com>, "dmatlack@...gle.com" <dmatlack@...gle.com>,
	"pbonzini@...hat.com" <pbonzini@...hat.com>, "Yamahata, Isaku"
	<isaku.yamahata@...el.com>, "nik.borisov@...e.com" <nik.borisov@...e.com>,
	"tony.lindgren@...ux.intel.com" <tony.lindgren@...ux.intel.com>, "Edgecombe,
 Rick P" <rick.p.edgecombe@...el.com>, "Gao, Chao" <chao.gao@...el.com>,
	"x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH 0/7] KVM: TDX: TD vcpu enter/exit

On Tue, 2024-11-26 at 13:29 +0800, Binbin Wu wrote:
> 
> 
> On 11/26/2024 11:52 AM, Huang, Kai wrote:
> > On Tue, 2024-11-26 at 09:44 +0800, Binbin Wu wrote:
> > > 
> > > On 11/26/2024 6:51 AM, Sean Christopherson wrote:
> > > 
> > > [...]
> > > > When an NMI happens in non-root, the NMI is acknowledged by the CPU prior to
> > > > performing VM-Exit.  In regular VMX, NMIs are blocked after such VM-Exits.  With
> > > > TDX, that blocking happens for SEAM root, but the SEAMRET back to VMX root will
> > > > load interruptibility from the SEAMCALL VMCS, and I don't see any code in the
> > > > TDX-Module that propagates that blocking to SEAMCALL VMCS.
> > > I see, thanks for the explanation!
> > > 
> > > > Hmm, actually, this means that TDX has a causality inversion, which may become
> > > > visible with FRED's NMI source reporting.  E.g. NMI X arrives in SEAM non-root
> > > > and triggers a VM-Exit.  NMI X+1 becomes pending while SEAM root is active.
> > > > TDX-Module SEAMRETs to VMX root, NMIs are unblocked, and so NMI X+1 is delivered
> > > > and handled before NMI X.
> > > This example can also cause an issue without FRED.
> > > 1. NMI X arrives in SEAM non-root and triggers a VM-Exit.
> > > 2. NMI X+1 becomes pending while SEAM root is active.
> > > 3. TDX-Module SEAMRETs to VMX root, NMIs are unblocked.
> > > 4. NMI X+1 is delivered and handled before NMI X.
> > >      (NMI handler could handle all NMI source events, including the source
> > >       triggered NMI X)
> > > 5. KVM calls exc_nmi() to handle the VM Exit caused by NMI X
> > > In step 5, because the source event caused NMI X has been handled, and NMI X
> > > will not be detected as a second half of back-to-back NMIs, according to
> > > Linux NMI handler, it will be considered as an unknown NMI.
> > I don't think KVM should call exc_nmi() anymore if NMI is unblocked upon
> > SEAMRET.
> 
> IIUC, KVM has to, because the NMI triggered the VM-Exit can't trigger the
> NMI handler to be invoked automatically even if NMI is unblocked upon SEAMRET.

Ah I missed this.  You mean unblocking NMI won't invoke NMI handler via IDT
descriptor 2.  Then I see why NMI X+1 is handled before NMI X.  Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ