[lvc-project] [PATCH v4 08/26] x86/boot: Map memory explicitly
Ard Biesheuvel
ardb at kernel.org
Wed Mar 8 13:28:55 MSK 2023
On Wed, 8 Mar 2023 at 10:38, Ard Biesheuvel <ardb at kernel.org> wrote:
>
> On Thu, 15 Dec 2022 at 13:38, Evgeniy Baskov <baskov at ispras.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) &&
More information about the lvc-project
mailing list