Re: [PATCH v11 19/23] KVM: x86: Enable CET virtualization for VMX and advertise to userspace
From: Sean Christopherson
Date: Tue Jul 22 2025 - 10:25:09 EST
On Tue, Jul 22, 2025, Mathias Krause wrote:
> On 21.07.25 19:45, Sean Christopherson wrote:
> > On Mon, Jul 21, 2025, Mathias Krause wrote:
> >> Can we please make CR4.CET a guest-owned bit as well (sending a patch in
> >> a second)? It's a logical continuation to making CR0.WP a guest-owned
> >> bit just that it's even easier this time, as no MMU role bits are
> >> involved and it still makes a big difference, at least for grsecurity
> >> guest kernels.
> >
> > Out of curiosity, what's the use case for toggling CR4.CET at runtime?
>
> Plain and simple: architectural requirements to be able to toggle CR0.WP.
Ugh, right. That was less fun than I as expecting :-)
> > E.g. at one point CR4.LA57 was a guest-owned bit, and the code was buggy. Fixing
> > things took far more effort than it should have there was no justification for
> > the logic (IIRC, it was done purely on the whims of the original developer).
> >
> > KVM has had many such cases, where some weird behavior was never documented/justified,
> > and I really, really want to avoid committing the same sins that have caused me
> > so much pain :-)
>
> I totally understand your reasoning, "just because" shouldn't be the
> justification. In this case, however, not making it a guest-owned bit
> has a big performance impact for grsecurity, we would like to address.
Oh, I'm not objecting to the change, at all. I just want to make sure we capture
the justification in the changelog.