Re: [RFC v2 16/32] x86/tdx: Handle MWAIT, MONITOR and WBINVD

From: Andi Kleen
Date: Mon May 10 2021 - 22:51:30 EST



On 5/10/2021 7:44 PM, Kuppuswamy, Sathyanarayanan wrote:


On 5/10/21 7:17 PM, Andi Kleen wrote:
To prevent TD guest from using MWAIT/MONITOR instructions,
support for these instructions are already disabled by TDX
module (SEAM). So CPUID flags for these instructions should
be in disabled state.
Why does this not result in a #UD if the instruction is disabled by
SEAM?

It's just the TDX module (SEAM is the execution mode used by the TDX module)

If it is disabled by the TDX Module, we should never execute it. But for some
reason, if we still come across this instruction (buggy TDX module?), we add
appropriate warning in  #VE handler.

I think the only case where it could happen is if the kernel jumps to a random address due to a bug and the destination happens to be these instruction bytes. Of course it is exceedingly unlikely.

Or we make some mistake, but that's hopefully fixed quickly.


-Andi