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-next>] [day] [month] [year] [list]
Date: Thu, 15 Feb 2024 14:51:06 -0800
From: Boqun Feng <boqun.feng@...il.com>
To: linux-arm-kernel@...r.kernel.org
Cc: Boqun Feng <boqun.feng@...il.com>,
	stable@...r.kernel.org,
	Ard Biesheuvel <ardb@...nel.org>,
	linux-efi@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [RFC] efi: Add ACPI_MEMORY_NVS into the linear map

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|...]

, 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

To fix this, add ACPI_MEMORY_NVS into the linear map.

Signed-off-by: Boqun Feng <boqun.feng@...il.com>
Cc: stable@...r.kernel.org # 5.15+
---
We hit this in an ARM64 Hyper-V VM when using 64k page size, although
this issue may also be fixed if the efi memory regions are all 64k
aligned, but I don't find this memory region setup is invalid per UEFI
spec, also I don't find that spec disallows ACPI_MEMORY_NVS to be mapped
in the OS linear map, but if there is any better way or I'm reading the
spec incorrectly, please let me know.

It's Cced stable since 5.15 because that's when Hyper-V ARM64 support is
added, and Hyper-V is the only one that hits the problem so far.

 drivers/firmware/efi/efi-init.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/efi/efi-init.c b/drivers/firmware/efi/efi-init.c
index a00e07b853f2..9a1b9bc66d50 100644
--- a/drivers/firmware/efi/efi-init.c
+++ b/drivers/firmware/efi/efi-init.c
@@ -139,6 +139,7 @@ static __init int is_usable_memory(efi_memory_desc_t *md)
 	case EFI_LOADER_CODE:
 	case EFI_LOADER_DATA:
 	case EFI_ACPI_RECLAIM_MEMORY:
+	case EFI_ACPI_MEMORY_NVS:
 	case EFI_BOOT_SERVICES_CODE:
 	case EFI_BOOT_SERVICES_DATA:
 	case EFI_CONVENTIONAL_MEMORY:
@@ -202,8 +203,12 @@ static __init void reserve_regions(void)
 			if (!is_usable_memory(md))
 				memblock_mark_nomap(paddr, size);
 
-			/* keep ACPI reclaim memory intact for kexec etc. */
-			if (md->type == EFI_ACPI_RECLAIM_MEMORY)
+			/*
+			 * keep ACPI reclaim and NVS memory and intact for kexec
+			 * etc.
+			 */
+			if (md->type == EFI_ACPI_RECLAIM_MEMORY ||
+			    md->type == EFI_ACPI_MEMORY_NVS)
 				memblock_reserve(paddr, size);
 		}
 	}
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ