Re: [PATCH] x86/boot/compressed/64: Do not corrupt EDX on EFER.LME=1 setting

From: Kirill A. Shutemov
Date: Wed Feb 06 2019 - 10:48:03 EST


On Wed, Feb 06, 2019 at 03:21:41PM +0000, Borislav Petkov wrote:
> On Wed, Feb 06, 2019 at 02:52:53PM +0300, Kirill A. Shutemov wrote:
> > RDMSR in the trampoline code overrides EDX, but we use the register to
> > indicate if 5-level paging has to enabled. It leads to failure to boot
> > on a 5-level paging machine.
> >
> > Preserve EDX on the stack while we are dealing with EFER.
>
> Comment says:
>
> * Non zero RDX on return means we need to enable 5-level paging.
>
> Is that per-chance refering to struct paging_config which
> paging_prepare() returns and on that return rdx contains
> paging_config.l5_required which is 1 when 5 level is to be enabled?

Yes.

> If so, is that written somewhere explicitly? Because it is not
> immediately clear at least to me why that RDX is live...

What about this: