Skip to content

Commit 325f558

Browse files
ardbiesheuvelctmarinas
authored andcommitted
arm64/acpi: disallow writeable AML opregion mapping for EFI code regions
Given that the contents of EFI runtime code and data regions are provided by the firmware, as well as the DSDT, it is not unimaginable that AML code exists today that accesses EFI runtime code regions using a SystemMemory OpRegion. There is nothing fundamentally wrong with that, but since we take great care to ensure that executable code is never mapped writeable and executable at the same time, we should not permit AML to create writable mapping. Signed-off-by: Ard Biesheuvel <[email protected]> Acked-by: Lorenzo Pieralisi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 1583052 commit 325f558

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

arch/arm64/kernel/acpi.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,15 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
301301
pr_warn(FW_BUG "requested region covers kernel memory @ %pa\n", &phys);
302302
return NULL;
303303

304+
case EFI_RUNTIME_SERVICES_CODE:
305+
/*
306+
* This would be unusual, but not problematic per se,
307+
* as long as we take care not to create a writable
308+
* mapping for executable code.
309+
*/
310+
prot = PAGE_KERNEL_RO;
311+
break;
312+
304313
case EFI_ACPI_RECLAIM_MEMORY:
305314
/*
306315
* ACPI reclaim memory is used to pass firmware tables

0 commit comments

Comments
 (0)