Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita509a66

Browse files
ardbiesheuvelctmarinas
authored andcommitted
arm64: permit ACPI core to map kernel memory used for table overrides
Jonathan reports that the strict policy for memory mapped by theACPI core breaks the use case of passing ACPI table overrides viainitramfs. This is due to the fact that the memory type used forloading the initramfs in memory is not recognized as a memory typethat is typically used by firmware to pass firmware tables.Since the purpose of the strict policy is to ensure that no AML orother ACPI code can manipulate any memory that is used by the kernelto keep its internal state or the state of user tasks, we can relaxthe permission check, and allow mappings of memory that is reservedand marked as NOMAP via memblock, and therefore not covered by thelinear mapping to begin with.Fixes:1583052 ("arm64/acpi: disallow AML memory opregions to access kernel memory")Fixes:325f558 ("arm64/acpi: disallow writeable AML opregion mapping for EFI code regions")Reported-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>Signed-off-by: Ard Biesheuvel <ardb@kernel.org>Tested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>Cc: Sudeep Holla <sudeep.holla@arm.com>Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>Link:https://lore.kernel.org/r/20200929132522.18067-1-ardb@kernel.orgSigned-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent75df529 commita509a66

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

‎arch/arm64/kernel/acpi.c‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,21 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
298298
caseEFI_BOOT_SERVICES_DATA:
299299
caseEFI_CONVENTIONAL_MEMORY:
300300
caseEFI_PERSISTENT_MEMORY:
301-
pr_warn(FW_BUG"requested region covers kernel memory @ %pa\n",&phys);
302-
returnNULL;
301+
if (memblock_is_map_memory(phys)||
302+
!memblock_is_region_memory(phys,size)) {
303+
pr_warn(FW_BUG"requested region covers kernel memory @ %pa\n",&phys);
304+
returnNULL;
305+
}
306+
/*
307+
* Mapping kernel memory is permitted if the region in
308+
* question is covered by a single memblock with the
309+
* NOMAP attribute set: this enables the use of ACPI
310+
* table overrides passed via initramfs, which are
311+
* reserved in memory using arch_reserve_mem_area()
312+
* below. As this particular use case only requires
313+
* read access, fall through to the R/O mapping case.
314+
*/
315+
fallthrough;
303316

304317
caseEFI_RUNTIME_SERVICES_CODE:
305318
/*
@@ -388,3 +401,8 @@ int apei_claim_sea(struct pt_regs *regs)
388401

389402
returnerr;
390403
}
404+
405+
voidarch_reserve_mem_area(acpi_physical_addressaddr,size_tsize)
406+
{
407+
memblock_mark_nomap(addr,size);
408+
}

‎include/linux/acpi.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
958958
acpi_statusacpi_os_prepare_extended_sleep(u8sleep_state,
959959
u32val_a,u32val_b);
960960

961-
#ifdefCONFIG_X86
961+
#ifndefCONFIG_IA64
962962
voidarch_reserve_mem_area(acpi_physical_addressaddr,size_tsize);
963963
#else
964964
staticinlinevoidarch_reserve_mem_area(acpi_physical_addressaddr,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp