lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 08 Mar 2023 19:09:34 +0300
From:   Evgeniy Baskov <baskov@...ras.ru>
To:     Ard Biesheuvel <ardb@...nel.org>
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 2023-03-08 13:28, Ard Biesheuvel wrote:
> 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?

I think I got too eager adding mappings to everything.
In the process_efi_entries() bootparams should already be mapped, so
I will just remove the call. And AFAIK bootparams is indeed gets
written to.

> 
> --- 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) &&

Thanks,
Evgeniy Baskov

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ