[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXGP1k-FoG6GQ2u9ZRiGnxogO=3bLWPfcyOEUOfZG3TRJw@mail.gmail.com>
Date: Wed, 8 Mar 2023 11:28:55 +0100
From: Ard Biesheuvel <ardb@...nel.org>
To: Evgeniy Baskov <baskov@...ras.ru>
Cc: Borislav Petkov <bp@...en8.de>, Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Alexey Khoroshilov <khoroshilov@...ras.ru>,
Peter Jones <pjones@...hat.com>,
"Limonciello, Mario" <mario.limonciello@....com>,
joeyli <jlee@...e.com>, lvc-project@...uxtesting.org,
x86@...nel.org, linux-efi@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v4 08/26] x86/boot: Map memory explicitly
On Wed, 8 Mar 2023 at 10:38, Ard Biesheuvel <ardb@...nel.org> wrote:
>
> On Thu, 15 Dec 2022 at 13:38, Evgeniy Baskov <baskov@...ras.ru> wrote:
> >
> > Implicit mappings hide possible memory errors, e.g. allocations for
> > ACPI tables were not included in boot page table size.
> >
> > Replace all implicit mappings from page fault handler with
> > explicit mappings.
> >
>
> I agree with the motivation but this patch seems to break the boot
> under SeaBIOS/QEMU, and I imagine other legacy BIOS boot scenarios as
> well.
>
> Naively, I would assume that there is simply a legacy BIOS region that
> we fail to map here, but I am fairly clueless when it comes to non-EFI
> x86 boot so take this with a grain of salt.
>
The below seems to help - not sure why exactly, but apparently legacy
BIOS needs the bootparams struct to be mapped writable?
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -31,6 +31,7 @@
#include <linux/ctype.h>
#include <generated/utsversion.h>
#include <generated/utsrelease.h>
+#include <asm/shared/pgtable.h>
#define _SETUP
#include <asm/setup.h> /* For COMMAND_LINE_SIZE */
@@ -688,7 +689,7 @@ process_efi_entries(unsigned long minimum,
unsigned long image_size)
u32 nr_desc;
int i;
- kernel_add_identity_map((unsigned long)e, (unsigned long)(e + 1), 0);
+ kernel_add_identity_map((unsigned long)e, (unsigned long)(e +
1), MAP_WRITE);
signature = (char *)&e->efi_loader_signature;
if (strncmp(signature, EFI32_LOADER_SIGNATURE, 4) &&
Powered by blists - more mailing lists