[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGtprH9YE50RtqhW-U+wK0Vv6aKfqqtOPn8q4s8or=UZwPXZoA@mail.gmail.com>
Date: Thu, 10 Aug 2023 16:57:36 -0700
From: Vishal Annapurve <vannapurve@...gle.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Ackerley Tng <ackerleytng@...gle.com>, pbonzini@...hat.com,
maz@...nel.org, oliver.upton@...ux.dev, chenhuacai@...nel.org,
mpe@...erman.id.au, anup@...infault.org, paul.walmsley@...ive.com,
palmer@...belt.com, aou@...s.berkeley.edu, willy@...radead.org,
akpm@...ux-foundation.org, paul@...l-moore.com, jmorris@...ei.org,
serge@...lyn.com, kvm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.linux.dev,
linux-mips@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
kvm-riscv@...ts.infradead.org, linux-riscv@...ts.infradead.org,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-security-module@...r.kernel.org,
linux-kernel@...r.kernel.org, chao.p.peng@...ux.intel.com,
tabba@...gle.com, jarkko@...nel.org, yu.c.zhang@...ux.intel.com,
mail@...iej.szmigiero.name, vbabka@...e.cz, david@...hat.com,
qperret@...gle.com, michael.roth@....com, wei.w.wang@...el.com,
liam.merwick@...cle.com, isaku.yamahata@...il.com,
kirill.shutemov@...ux.intel.com
Subject: Re: [RFC PATCH v11 12/29] KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for
guest-specific backing memory
On Tue, Aug 8, 2023 at 2:13 PM Sean Christopherson <seanjc@...gle.com> wrote:
> ...
> > + When binding a memslot to the file, if a kvm pointer exists, it must
> > be the same kvm as the one in this binding
> > + When the binding to the last memslot is removed from a file, NULL the
> > kvm pointer.
>
> Nullifying the KVM pointer isn't sufficient, because without additional actions
> userspace could extract data from a VM by deleting its memslots and then binding
> the guest_memfd to an attacker controlled VM. Or more likely with TDX and SNP,
> induce badness by coercing KVM into mapping memory into a guest with the wrong
> ASID/HKID.
>
TDX/SNP have mechanisms i.e. PAMT/RMP tables to ensure that the same
memory is not assigned to two different VMs. Deleting memslots should
also clear out the contents of the memory as the EPT tables will be
zapped in the process and the host will reclaim the memory.
Regards,
Vishal
Powered by blists - more mailing lists