From: Sean Christopherson <seanjc@google.com>
To: Rick P Edgecombe <rick.p.edgecombe@intel.com>
Cc: Xiaoyao Li <xiaoyao.li@intel.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"pbonzini@redhat.com" <pbonzini@redhat.com>
Subject: Re: [RFC] TDX module configurability of 0x80000008
Date: Thu, 25 Apr 2024 15:53:13 -0700 [thread overview]
Message-ID: <Zire2UuF9lR2cmnQ@google.com> (raw)
In-Reply-To: <5bde4c96c26c6af1699f1922ea176daac61ab279.camel@intel.com>
On Thu, Apr 25, 2024, Rick P Edgecombe wrote:
> On Thu, 2024-04-25 at 14:39 -0700, Sean Christopherson wrote:
> > On Thu, Apr 25, 2024, Rick P Edgecombe wrote:
> > > On Thu, 2024-04-25 at 09:59 -0700, Sean Christopherson wrote:
> > > > > accessing a GPA beyond [23:16] is similar to accessing a GPA with no
> > > > > memslot.
> > > >
> > > > No, it's not. A GPA without a memslot has *very* well-defined
> > > > semantics in KVM, and KVM can provide those semantics for all
> > > > guest-legal GPAs regardless of hardware EPT/NPT support.
> > >
> > > Sorry, not following. Are we expecting there to be memslots above the guest
> > > maxpa 23:16? If there are no memslots in that region, it seems exactly like
> > > accessing a GPA with no memslots. What is the difference between before and
> > > after the introduction of guest MAXPA? (there will be normal VMs and TDX
> > > differences of course).
> >
> > If there are no memslots, nothing from a functional perspectives, just a
> > very slight increase in latency. Pre-TDX, KVM can always emulate in
> > reponse to an EPT violation on an unmappable GPA. I.e. as long as there is
> > no memslot, KVM doesn't *need* to create SPTEs, and so whether or not a GPA
> > is mappable is completely irrelevant.
>
> Right, although there are gaps in emulation that could fail. If the emulation
> succeeds and there is an MMIO exit targeting a totally unknown GPA, then I guess
> it's up to userspace to decide what to do.
>
> KVM's done its job.
Yep.
> But userspace still has to handle it. It can, but I was under the impression
> it didn't (maybe bad assumption).
I'm pretty sure QEMU handles accesses to non-existent MMIO with PCI abort semantics,
i.e. ignores writes and returns all FFs for reads.
> > > Also, it adds complexity for cases where KVM maps GPAs above guest maxpa
> > > anyway.
> >
> > That should be disallowed. If KVM tries to map an address that it told the
> > guest was impossible to map, then the TDX module should throw an error.
>
> Hmm. I'll mention this, but I don't see why KVM needs the TDX module to filter
> it. It seems in the range of userspace being allowed to create nonsense
> configurations that only hurt its own guest.
Because the whole point of TDX is to protect the guest from the bad, naughty host?
> If we think the TDX module should do it, then maybe we should have KVM sanity
> filter these out today in preparation.
Nope. KVM isn't in the guest's TCB, TDX is. KVM's stance is that userspace is
responsible for providing a sane vCPU model, because defining what is "sane" is
extremely difficult unless the definition is super prescriptive, a la TDX.
E.g. letting the host map something that TDX's spec says will cause #VE would
create a novel attack surface.
next prev parent reply other threads:[~2024-04-25 22:53 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-24 16:55 [RFC] TDX module configurability of 0x80000008 Edgecombe, Rick P
2024-04-25 15:09 ` Xiaoyao Li
2024-04-25 16:31 ` Edgecombe, Rick P
2024-04-25 16:59 ` Sean Christopherson
2024-04-25 18:20 ` Edgecombe, Rick P
2024-04-25 21:39 ` Sean Christopherson
2024-04-25 22:41 ` Edgecombe, Rick P
2024-04-25 22:53 ` Sean Christopherson [this message]
2024-04-25 23:08 ` Edgecombe, Rick P
2024-04-25 23:28 ` Sean Christopherson
2024-04-25 23:38 ` Edgecombe, Rick P
2024-05-06 18:40 ` Edgecombe, Rick P
2024-05-07 14:22 ` Chao Gao
2024-05-07 14:49 ` Edgecombe, Rick P
2024-05-07 16:21 ` Sean Christopherson
2024-05-07 16:41 ` Xiaoyao Li
2024-05-07 17:11 ` Sean Christopherson
2024-05-08 7:50 ` Xiaoyao Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zire2UuF9lR2cmnQ@google.com \
--to=seanjc@google.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=xiaoyao.li@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).