[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sun, 2 Feb 2020 13:18:53 -0500
From: Arvind Sankar <nivedita@...m.mit.edu>
To: Ard Biesheuvel <ard.biesheuvel@...aro.org>
Cc: Arvind Sankar <nivedita@...m.mit.edu>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>, Ard Biesheuvel <ardb@...nel.org>,
linux-efi <linux-efi@...r.kernel.org>,
the arch/x86 maintainers <x86@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 2/7] efi/x86: Don't depend on firmware GDT layout
On Sun, Feb 02, 2020 at 06:54:48PM +0100, Ard Biesheuvel wrote:
> On Sun, 2 Feb 2020 at 18:13, Arvind Sankar <nivedita@...m.mit.edu> wrote:
> >
> > At handover entry in efi32_stub_entry, the firmware's GDT is still
> > installed. We save the GDTR for later use in __efi64_thunk but we are
> > assuming that descriptor 2 (__KERNEL_CS) is a valid 32-bit code segment
> > descriptor and that descriptor 3 (__KERNEL_DS/__BOOT_DS) is a valid data
> > segment descriptor.
> >
> > This happens to be true for OVMF (it actually uses descriptor 1 for data
> > segments, but descriptor 3 is also setup as data), but we shouldn't
> > depend on this being the case.
> >
> > Fix this by saving the code and data selectors in addition to the GDTR
> > in efi32_stub_entry, and restoring them in __efi64_thunk before calling
> > the firmware. The UEFI specification guarantees that selectors will be
> > flat, so using the DS selector for all the segment registers should be
> > enough.
> >
> > We also need to install our own GDT before initializing segment
> > registers in startup_32, so move the GDT load up to the beginning of the
> > function.
> >
> > Signed-off-by: Arvind Sankar <nivedita@...m.mit.edu>
>
> It might be useful to mention /somewhere/ in the commit log that this
> applies to mixed mode
>
Good point. I'll wait for comments from the x86 guys and include that in
the next re-spin.
Powered by blists - more mailing lists