Re: [PATCH v4 0/5] Enable Shadow Stack Virtualization for SVM

Sean Christopherson
2025-09-15T16:46:50Z

On Mon, Sep 15, 2025, John Allen wrote:
> On Fri, Sep 12, 2025 at 03:54:31PM -0700, Sean Christopherson wrote:
> > On Mon, Sep 08, 2025, John Allen wrote:
> > > This series adds support for shadow stack in SVM guests
> > ^
> > |
> > some
> >
> > I mean, who cares about nested, right?
> >
> > Sorry for being snippy, but I am more than a bit peeved that we're effectively
> > on revision 6 of this series, and apparently no one has thought to do even basic
> > tested of nested SVM.
>
> Hi Sean,
>
> I have been testing nested with this feature (or so I thought).

The issue here is that Linux only supports shadow stacks at CPL3, i.e. only
exercises MSR_IA32_U_CET, and for whatever reason the KVM-Unit-Test only tests
MSR_IA32_U_CET too (and is stupidly not compatible with AMD due to requiring
SHSTK *and* IBT). So just running those in nested won't provide any coverage
for S_CET.

> Can you explain what you did to test and what wasn't working?

Read/write MSR_IA32_S_CET to a non-zero value from L2 by running the proposed
selftest[*] in L1. Because KVM doesn't propagate S_CET to/from vmcb12, the
writes from L2 are effectively lost.

An ever better way to cover this would be a selftest or KUT test to explicitly
read/write MSRs in L2, and/or fill vmcs12/vmcb12 from L1 and verify L2 sees the
desired value.

https://lore.kernel.org/all/20250912232319.429659-37-seanjc@google.com

> Apologies, and thanks for taking the time to look into the problem.

No worries, I didn't intend to single you out, I was essentially just yelling at
everyone involved :-)