RE: [PATCH v5 22/34] x86/fred: FRED initialization code

From: Li, Xin3
Date: Wed Mar 22 2023 - 01:41:15 EST


> >> If there is no other concrete reason other than overflowing for assigning NMI
> and
> >> #DB with a stack level > 0, #VE should also be assigned with a stack level > 0,
> and
> >> #BP too. #VE can happen anytime and anywhere, so it is subject to
> overflowing too.
> > With IDT, both #VE and #BP do not use IST, but NMI, #DB, #MC and #DF do.
> >
> > Let's keep this "secret" logic for now, i.e., not change the stack levels
> > for #VE and #BP at this point. We can do "optimization", i.e., change them
> > later 😄.
>
> #VE also can't happen anywhere. There is some documentation about it in
> here:
>
> https://docs.kernel.org/x86/tdx.html#linux-ve-handler
>
> But, basically, the only halfway sane thing a guest might do to hit a
> #VE is touch some "MMIO". The host can *not* cause them in arbitrary
> places because of the SEPT_VE_DISABLE attribute.
>
> #VE's also can't nest until after the guest retrieves the "VE info".
> That means that the #VE handler at _least_ reaches C code before it's
> subject to another #VE and that second one would still need to be
> induced by something the guest does explicitly.

Thanks a lot for the detailed background!