Re: [PATCH v7 03/20] x86/virt/tdx: Disable TDX if X2APIC is not enabled

From: Dave Hansen
Date: Mon Nov 21 2022 - 18:47:21 EST


On 11/20/22 16:26, Kai Huang wrote:
> The MMIO/xAPIC interface has some problems, most notably the APIC LEAK
> [1]. This bug allows an attacker to use the APIC MMIO interface to
> extract data from the SGX enclave.
>
> TDX is not immune from this either. Early check X2APIC and disable TDX
> if X2APIC is not enabled, and make INTEL_TDX_HOST depend on X86_X2APIC.

This makes no sense.

This is TDX host code. TDX hosts are untrusted. Zero of the TDX
security guarantees are provided by the host.

What is the benefit of disabling TDX from the host if x2APIC is not
enabled? It can't be for security reasons since the host does not help
provide TDX security guarantees. It also can't be for SGX because SGX
doesn't depend on the OS doing anything in order to be secure.

So, this boils down to the most fundamental of questions you need to
answer about every patch:

What does this code do?

What end-user-visible effect is there if this code is not present?