Re: [PATCH RESEND V2 1/2] x86/mce: Fix missing address mask in recovery for errors in TDX/SEAM non-root mode
From: Borislav Petkov
Date: Tue Aug 19 2025 - 17:33:33 EST
On Tue, Aug 19, 2025 at 07:24:34PM +0300, Adrian Hunter wrote:
> Commit 8a01ec97dc066 ("x86/mce: Mask out non-address bits from machine
> check bank") introduced a new #define MCI_ADDR_PHYSADDR for the mask of
> valid physical address bits within the machine check bank address register.
>
> This is particularly needed in the case of errors in TDX/SEAM non-root mode
> because the reported address contains the TDX KeyID. Refer to TDX and
> TME-MK documentation for more information about KeyIDs.
>
> Commit 7911f145de5fe ("x86/mce: Implement recovery for errors in TDX/SEAM
> non-root mode") uses the address to mark the affected page as poisoned, but
> omits to use the aforementioned mask.
>
> Investigation of user space expectations has concluded it would be more
> correct for the address to contain only address bits in the first place.
> Refer https://lore.kernel.org/r/807ff02d-7af0-419d-8d14-a4d6c5d5420d@xxxxxxxxx
>
> Mask the address when it is read from the machine check bank address
> register. Do not use MCI_ADDR_PHYSADDR because that will be removed in a
> later patch.
Why is this patch talking about TDX-something but doing "global" changes to
mce.addr?
Why don't you simply do a TDX-specific masking out when you're running on
in TDX env and leave the rest as is?
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette