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: <ceaf3545-42ce-e855-bd3a-ac470edb7e08@redhat.com>
Date:   Wed, 23 Jun 2021 18:54:01 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Sean Christopherson <seanjc@...gle.com>
Cc:     Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Yu Zhang <yu.c.zhang@...ux.intel.com>,
        Maxim Levitsky <mlevitsk@...hat.com>
Subject: Re: [PATCH 12/54] KVM: x86/mmu: Drop the intermediate "transient"
 __kvm_sync_page()

On 22/06/21 19:56, Sean Christopherson wrote:
> @@ -2008,10 +2001,19 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
>   			goto trace_get_page;
>   
>   		if (sp->unsync) {
> -			/* The page is good, but __kvm_sync_page might still end
> -			 * up zapping it.  If so, break in order to rebuild it.
> +			/*
> +			 * The page is good, but is stale.  "Sync" the page to
> +			 * get the latest guest state, but don't write-protect
> +			 * the page and don't mark it synchronized!  KVM needs
> +			 * to ensure the mapping is valid, but doesn't need to
> +			 * fully sync (write-protect) the page until the guest
> +			 * invalidates the TLB mapping.  This allows multiple
> +			 * SPs for a single gfn to be unsync.
> +			 *
> +			 * If the sync fails, the page is zapped.  If so, break
> +			 * If so, break in order to rebuild it.
>   			 */

This should be a separate patch I think.  In addition it should point out the
place where write protection does happen, which is mmu_unsync_children:

                         /*
                          * The page is good, but is stale.  kvm_sync_page does
                          * get the latest guest state, but (unlike mmu_unsync_children)
                          * it doesn't write-protect the page or mark it synchronized!
                          * This way the validity of the mapping is ensured, but the
                          * overhead of write protection is not incurred until the
                          * guest invalidates the TLB mapping.  This allows multiple
                          * SPs for a single gfn to be unsync.
                          *
                          * If the sync fails, the page is zapped.  If so, break
                          * in order to rebuild it.
                          */

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ