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]
Date:   Tue, 21 Sep 2021 12:24:58 -0700
From:   Nathan Tempelman <natet@...gle.com>
To:     Peter Gonda <pgonda@...gle.com>
Cc:     kvm <kvm@...r.kernel.org>, Marc Orr <marcorr@...gle.com>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Sean Christopherson <seanjc@...gle.com>,
        Steve Rutherford <srutherford@...gle.com>,
        Brijesh Singh <brijesh.singh@....com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] KVM: SEV: Update svm_vm_copy_asid_from for SEV-ES

On Tue, Sep 21, 2021 at 8:03 AM Peter Gonda <pgonda@...gle.com> wrote:
>
> For mirroring SEV-ES the mirror VM will need more then just the ASID.
> The FD and the handle are required to all the mirror to call psp
> commands. The mirror VM will need to call KVM_SEV_LAUNCH_UPDATE_VMSA to
> setup its vCPUs' VMSAs for SEV-ES.
>
> Signed-off-by: Peter Gonda <pgonda@...gle.com>
> Cc: Marc Orr <marcorr@...gle.com>
> Cc: Nathan Tempelman <natet@...gle.com>
> Cc: Paolo Bonzini <pbonzini@...hat.com>
> Cc: Sean Christopherson <seanjc@...gle.com>
> Cc: Steve Rutherford <srutherford@...gle.com>
> Cc: Brijesh Singh <brijesh.singh@....com>
> Cc: kvm@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> ---
>  arch/x86/kvm/svm/sev.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index 75e0b21ad07c..08c53a4e060e 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -1715,8 +1715,7 @@ int svm_vm_copy_asid_from(struct kvm *kvm, unsigned int source_fd)
>  {
>         struct file *source_kvm_file;
>         struct kvm *source_kvm;
> -       struct kvm_sev_info *mirror_sev;
> -       unsigned int asid;
> +       struct kvm_sev_info source_sev, *mirror_sev;
>         int ret;
>
>         source_kvm_file = fget(source_fd);
> @@ -1739,7 +1738,8 @@ int svm_vm_copy_asid_from(struct kvm *kvm, unsigned int source_fd)
>                 goto e_source_unlock;
>         }
>
> -       asid = to_kvm_svm(source_kvm)->sev_info.asid;
> +       memcpy(&source_sev, &to_kvm_svm(source_kvm)->sev_info,
> +              sizeof(source_sev));
>
>         /*
>          * The mirror kvm holds an enc_context_owner ref so its asid can't
> @@ -1759,8 +1759,16 @@ int svm_vm_copy_asid_from(struct kvm *kvm, unsigned int source_fd)
>         /* Set enc_context_owner and copy its encryption context over */
>         mirror_sev = &to_kvm_svm(kvm)->sev_info;
>         mirror_sev->enc_context_owner = source_kvm;
> -       mirror_sev->asid = asid;
>         mirror_sev->active = true;
> +       mirror_sev->asid = source_sev.asid;
> +       mirror_sev->fd = source_sev.fd;
> +       mirror_sev->es_active = source_sev.es_active;
> +       mirror_sev->handle = source_sev.handle;
> +       /*
> +        * Do not copy ap_jump_table. Since the mirror does not share the same
> +        * KVM contexts as the original, and they may have different
> +        * memory-views.
> +        */
>
>         mutex_unlock(&kvm->lock);
>         return 0;
> --
> 2.33.0.464.g1972c5931b-goog
>
Looks good. Thanks for doing this Peter.

Reviewed-by: Nathan Tempelman <natet@...gle.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ