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: <Z6bBoZOynhI3eV+Q@yzhao56-desk.sh.intel.com>
Date: Sat, 8 Feb 2025 10:29: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 2/4] KVM: x86/tdp_mmu: Merge the prefetch into the
 is_access_allowed() check

On Fri, Feb 07, 2025 at 07:03:46AM -0800, Sean Christopherson wrote:
> On Fri, Feb 07, 2025, Yan Zhao wrote:
> > Merge the prefetch check into the is_access_allowed() check to determine a
> > spurious fault.
> > 
> > In the TDP MMU, a spurious prefetch fault should also pass the
> > is_access_allowed() check.
> 
> How so? 
> 
>   1. vCPU takes a write-fault on a swapped out page and queues an async #PF
>   2. A different task installs a writable SPTE
>   3. A third task write-protects the SPTE for dirty logging
>   4. Async #PF handler faults in the SPTE, encounters a read-only SPTE for its
>      write fault.
> 
> KVM shouldn't mark the gfn as dirty in this case.
Hmm, but when we prefetch an entry, if a gfn is not write-tracked, it allows to
mark the gfn as dirty, just like when there's no existing SPTE, a prefetch fault
also marks a gfn as dirty.
If a gfn is write-tracked, make_spte() will not grant write-permission to make
the gfn dirty.

However, I admit that making the new SPTE as not-accessed again is not desired.
What about below?

@@ -983,7 +983,7 @@ static int tdp_mmu_map_handle_target_level(struct kvm_vcpu *vcpu,
                return RET_PF_RETRY;

        if (is_shadow_present_pte(iter->old_spte) &&
-           is_access_allowed(fault, iter->old_spte) &&
+           (fault->prefetch || is_access_allowed(fault, iter->old_spte)) &&
            is_last_spte(iter->old_spte, iter->level))
                return RET_PF_SPURIOUS;



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ