Re: [PATCH] x86/sev: Apply RMP table fixups for kexec.

From: Tom Lendacky
Date: Tue Apr 02 2024 - 11:55:02 EST


On 4/2/24 09:45, bp@xxxxxxxxxx wrote:
From: Borislav Petkov <bp@xxxxxxxxx>

On Tue, Mar 12, 2024 at 06:47:57PM +0000, Ashish Kalra wrote:
From: Ashish Kalra <ashish.kalra@xxxxxxx>

RMP table start and end physical range may not be aligned to 2MB in
the e820 tables

This already sounds fishy. Why may the range not be aligned? This is
BIOS, right? And BIOS can be fixed to align them properly.

There's no requirement from a hardware/RMP usage perspective that requires a 2MB alignment, so BIOS is not doing anything wrong. The problem occurs because kexec is initially using 2MB mappings that overlap the start and/or end of the RMP which then results in an RMP fault when memory within one of those 2MB mappings, that is not part of the RMP, is referenced.

Additionally, we have BIOSes out there since Milan that don't do this 2MB alignment. And do you really trust that BIOS will do this properly all the time?

I think it needs to be checked and mitigated in the kernel.

Thanks,
Tom