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] [day] [month] [year] [list]
Message-ID: <Z6ry1SRznsBr0I6G@yzhao56-desk.sh.intel.com>
Date: Tue, 11 Feb 2025 14:48:53 +0800
From: Yan Zhao <yan.y.zhao@...el.com>
To: Sean Christopherson <seanjc@...gle.com>
CC: <pbonzini@...hat.com>, <rick.p.edgecombe@...el.com>,
	<linux-kernel@...r.kernel.org>, <kvm@...r.kernel.org>
Subject: Re: [PATCH 3/4] KVM: x86/mmu: Make sure pfn is not changed for
 spurious fault

On Mon, Feb 10, 2025 at 02:23:38PM -0800, Sean Christopherson wrote:
> On Sat, Feb 08, 2025, Yan Zhao wrote:
> > On Fri, Feb 07, 2025 at 07:07:06AM -0800, Sean Christopherson wrote:
> > > On Fri, Feb 07, 2025, Yan Zhao wrote:
> > > > Make sure pfn is not changed for a spurious fault by warning in the TDP
> > > > MMU. For shadow path, only treat a prefetch fault as spurious when pfn is
> > > > not changed, since the rmap removal and add are required when pfn is
> > > > changed.
> > > 
> > > I like sanity checks, but I don't like special casing "prefetch" faults like this.
> > > KVM should _never_ change the PFN of a shadow-present SPTE.  The TDP MMU already
> > > BUG()s on this, and mmu_spte_update() WARNs on the transition.
> > However, both TDP MMU and mmu_set_spte() return RET_PF_SPURIOUS directly before
> > the BUG() in TDP MMU or mmu_spte_update() could be hit.
> 
> Ah, that's very different than treating a prefetch fault as !spurious though.  I
> would be a-ok with this:
> 
> 	if (is_shadow_present_pte(iter->old_spte) &&
> 	    (fault->prefetch || is_access_allowed(fault, iter->old_spte)) &&
> 	    is_last_spte(iter->old_spte, iter->level)) {
> 		WARN_ON_ONCE(fault->pfn != spte_to_pfn(iter->old_spte));
> 		return RET_PF_SPURIOUS;
> 	}

Thanks!
Will also update the shadow MMU part as below.

	if (is_shadow_present_pte(*sptep)) {
		if (prefetch && is_last_spte(*sptep, level)) {
			WARN_ON_ONCE(pfn != spte_to_pfn(*sptep));
			return RET_PF_SPURIOUS;
		}
	}



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ