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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXGd8a-ZrSj4N=F9NZgAXcvNNHvF86aEs9smSwu66D85+Q@mail.gmail.com>
Date: Fri, 16 Feb 2024 00:40:07 +0100
From: Ard Biesheuvel <ardb@...nel.org>
To: Boqun Feng <boqun.feng@...il.com>, Oliver Smith-Denny <osde@...ux.microsoft.com>
Cc: stable@...r.kernel.org, linux-efi@...r.kernel.org, 
	linux-kernel@...r.kernel.org, 
	Linux ARM <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [RFC] efi: Add ACPI_MEMORY_NVS into the linear map

On Fri, 16 Feb 2024 at 00:21, Ard Biesheuvel <ardb@...nel.org> wrote:
>
> (cc Oliver)
>
> On Thu, 15 Feb 2024 at 23:51, Boqun Feng <boqun.feng@...il.com> wrote:
> >
> > Currently ACPI_MEMORY_NVS is omitted from the linear map, which causes
> > a trouble with the following firmware memory region setup:
> >
> >         [..] efi:   0x0000dfd62000-0x0000dfd83fff [ACPI Reclaim|...]
> >         [..] efi:   0x0000dfd84000-0x0000dfd87fff [ACPI Mem NVS|...]
> >
>
> Which memory types were listed here?
>
> > , on ARM64 with 64k page size, the whole 0x0000dfd80000-0x0000dfd8ffff
> > range will be omitted from the the linear map due to 64k round-up. And
> > a page fault happens when trying to access the ACPI_RECLAIM_MEMORY:
> >
> >         [...] Unable to handle kernel paging request at virtual address ffff0000dfd80000
> >
>
> You trimmed all the useful information here. ACPI reclaim memory is
> reclaimable, but we don't actually do so in Linux. So this is not
> general purpose memory, it is used for a specific purpose, and the
> code that accesses it is assuming that it is accessible via the linear
> map. There are reason why this may not be the case, so the fix might
> be to use memremap() in the access instead.
>

Please try the below if the caller is already using memremap(). It
might misidentify the region because the start is in the linear map
but the end is not.


diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm/ioremap.c
index 269f2f63ab7d..fef0281e223c 100644
--- a/arch/arm64/mm/ioremap.c
+++ b/arch/arm64/mm/ioremap.c
@@ -31,7 +31,6 @@ void __init early_ioremap_init(void)
 bool arch_memremap_can_ram_remap(resource_size_t offset, size_t size,
                                 unsigned long flags)
 {
-       unsigned long pfn = PHYS_PFN(offset);
-
-       return pfn_is_map_memory(pfn);
+       return pfn_is_map_memory(PHYS_PFN(offset)) &&
+              pfn_is_map_memory(PHYS_PFN(offset + size - 1));
 }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ