Re: [PATCH v5 11/12] x86/tdx: Don't write CSTAR MSR on Intel

Sean Christopherson
2021-08-04T21:45:07Z

On Wed, Aug 04, 2021, Kuppuswamy, Sathyanarayanan wrote:
>
> On 8/4/21 11:31 AM, Sean Christopherson wrote:
> > > On Intel CPUs writing the CSTAR MSR is not really needed. Syscalls
> > > from 32bit work using SYSENTER and 32bit SYSCALL is an illegal opcode.
> > > But the kernel did write it anyways even though it was ignored by
> > > the CPU. Inside a TDX guest this actually leads to a #GP. While the #GP
> > > is caught and recovered from, it prints an ugly message at boot.
> > > Do not write the CSTAR MSR on Intel CPUs.
> > Not that it really matters, but...
> >
> > Is #GP the actual TDX-Module behavior? If so, isn't that a contradiction with
>
> No, #GP is triggered by guest.

#GP is not triggered by the guest, it's not even reported by the guest. From
patch 7, the #VE handler escalates unhandled #VEs "similar to #GP handler", but
it still reports #VE as the actual vector.

Now, that particular behavior could change, e.g. setting tsk->thread.trap_nr to
#VE might confuse userspace, but at no point does this "trigger" a #GP.