mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
x86/efi: Add support for EFI_MEMORY_ATTRIBUTES_TABLE
UEFI v2.6 introduces EFI_MEMORY_ATTRIBUTES_TABLE which describes memory protections that may be applied to the EFI Runtime code and data regions by the kernel. This enables the kernel to map these regions more strictly thereby increasing security. Presently, the only valid bits for the attribute field of a memory descriptor are EFI_MEMORY_RO and EFI_MEMORY_XP, hence use these bits to update the mappings in efi_pgd. The UEFI specification recommends to use this feature instead of EFI_PROPERTIES_TABLE and hence while updating EFI mappings we first check for EFI_MEMORY_ATTRIBUTES_TABLE and if it's present we update the mappings according to this table and hence disregarding EFI_PROPERTIES_TABLE even if it's published by the firmware. We consider EFI_PROPERTIES_TABLE only when EFI_MEMORY_ATTRIBUTES_TABLE is absent. Signed-off-by: Sai Praneeth Prakhya <[email protected]> Signed-off-by: Matt Fleming <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Fenghua Yu <[email protected]> Cc: Lee, Chun-Yi <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ravi Shankar <[email protected]> Cc: Ricardo Neri <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
a19ebf59e2
commit
18141e89a7
2 changed files with 58 additions and 11 deletions
|
|
@ -175,8 +175,11 @@ int __init efi_memattr_apply_permissions(struct mm_struct *mm,
|
|||
md.phys_addr + size - 1,
|
||||
efi_md_typeattr_format(buf, sizeof(buf), &md));
|
||||
|
||||
if (valid)
|
||||
if (valid) {
|
||||
ret = fn(mm, &md);
|
||||
if (ret)
|
||||
pr_err("Error updating mappings, skipping subsequent md's\n");
|
||||
}
|
||||
}
|
||||
memunmap(tbl);
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in a new issue