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: <CAMkAt6oPijfkPjT4ARpVmXfdczChf2k3ACBwK0YZeuGOxMAE8Q@mail.gmail.com>
Date:   Wed, 15 Sep 2021 10:10:31 -0600
From:   Peter Gonda <pgonda@...gle.com>
To:     Paolo Bonzini <pbonzini@...hat.com>
Cc:     Sean Christopherson <seanjc@...gle.com>,
        kvm list <kvm@...r.kernel.org>, Marc Orr <marcorr@...gle.com>,
        Nathan Tempelman <natet@...gle.com>,
        Brijesh Singh <brijesh.singh@....com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: SEV: Disable KVM_CAP_VM_COPY_ENC_CONTEXT_FROM for SEV-ES

On Wed, Sep 15, 2021 at 2:44 AM Paolo Bonzini <pbonzini@...hat.com> wrote:
>
> On 14/09/21 20:49, Sean Christopherson wrote:
> > On Tue, Sep 14, 2021, Peter Gonda wrote:
> >> I do not think so. You cannot call KVM_SEV_LAUNCH_UPDATE_VMSA on the mirror
> >> because svm_mem_enc_op() blocks calls from the mirror. So either you have to
> >> update vmsa from the mirror or have the original VM read through its mirror's
> >> vCPUs when calling KVM_SEV_LAUNCH_UPDATE_VMSA. Not sure which way is better
> >> but I don't see a way to do this without updating KVM.
> >
> > Ah, right, I forgot all of the SEV ioctls are blocked on the mirror.  Put something
> > to that effect into the changelog to squash any argument about whether or not this
> > is the correct KVM behavior.
>
> Indeed, at least KVM_SEV_LAUNCH_UPDATE_VMSA would have to be allowed in
> the mirror VM.  Do you think anything else would be necessary?

Thanks Paolo. Yes I think that only the KVM_SEV_LAUNCH_UPDATE_VMSA
ioctl needs to be allowed on the mirror VM. But I don't think that's
the only changes needed. Additionally the mirror VM will need the sev
'handle' and the sev device 'fd' copied in vm_vm_copy_asid_from(). The
handle is needed for KVM_SEV_LAUNCH_UPDATE_VMSA, the fd is required
for sev_issue_cmd(). Also you you'd need to mirror es_active bool. (I
think its quite confusing that svm_vm_copy_asid_from() only copies
some of the metadata in sev_info but I can see why as the locked pages
and cg group metadata shouldn't be copied.)  I *think* that would be
all that's needed but I haven't tried or tested this in any way.

svm_vm_copy_asid_from() {

   asid = to_kvm_svm(source_kvm)->sev_info.asid;
+ handle = to_kvm_svm(source_kvm)->sev_info.handle;
+ fd = to_kvm_svm(source_kvm)->sev_info.fd;
+ es_active = to_kvm_svm(source_kvm)->sev_info.es_active;

...

    /* 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->handle = handle;
+  mirror_sev->fd = fd;
+ mirror_sev->es_active = es_active;

Paolo would you prefer a patch to enable ES mirroring or continue with
this patch to disable it for now?

>
> Paolo
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ