Re: [PATCH v5 07/12] x86/traps: Add #VE support for TDX guest

Borislav Petkov
2021-09-03T10:17:36Z

On Thu, Sep 02, 2021 at 08:24:53AM -0700, Kuppuswamy, Sathyanarayanan wrote:
> If MSR read/write failed in tdx_handle_virtualization_exception(), it will
> return non zero return value which in turn will trigger ve_raise_fault().
>
> If we don't call fixup_exception() for such case, it will trigger oops
> and eventually panic in TDX. For MSR read/write failures we don't want
> to panic.
>
> #VE MSR read/write
> -> exc_virtualization_exception()
> -> tdx_handle_virtualization_exception()
> ->tdx_write_msr_safe()
> -> ve_raise_fault
> -> fixup_exception()

Lemme see if I understand this correctly: you're relying on the kernel
exception handling fixup to end up in

ex_handler_{rd,wr}msr_unsafe()

which would warn but succeed so that you return from ve_raise_fault()
before die()ing?

If so, I could use a comment in ve_raise_fault() in case we touch the
fixup exception machinery, like we're currently doing.

> Reason for calling die_addr() is to trigger oops for failed #VE handling, which
> is desirable for TDX. Also sending die notification may be useful for debuggers.
>
> This sequence of calls are similar to exc_general_protection().

Ok.

--
Regards/Gruss,
Boris.