/* * Only regions of type EFI_RUNTIME_SERVICES_CODE need to be * executable, everything else can be mapped with the XN bits * set. Also take the new (optional) RO/XP bits into account.
*/ static __init ptdesc_t create_mapping_protection(efi_memory_desc_t *md)
{
u64 attr = md->attribute;
u32 type = md->type;
if (type == EFI_MEMORY_MAPPED_IO) {
pgprot_t prot = __pgprot(PROT_DEVICE_nGnRE);
if (region_is_misaligned(md)) { staticbool __initdata code_is_misaligned;
/* * Regions that are not aligned to the OS page size cannot be * mapped with strict permissions, as those might interfere * with the permissions that are needed by the adjacent * region's mapping. However, if we haven't encountered any * misaligned runtime code regions so far, we can safely use * non-executable permissions for non-code regions.
*/
code_is_misaligned |= (type == EFI_RUNTIME_SERVICES_CODE);
/* * If this region is not aligned to the page size used by the OS, the * mapping will be rounded outwards, and may end up sharing a page * frame with an adjacent runtime memory region. Given that the page * table descriptor covering the shared page will be rewritten when the * adjacent region gets mapped, we must avoid block mappings here so we * don't have to worry about splitting them when that happens.
*/ if (region_is_misaligned(md))
page_mappings_only = true;
/* * Calling apply_to_page_range() is only safe on regions that are * guaranteed to be mapped down to pages. Since we are only called * for regions that have been mapped using efi_create_mapping() above * (and this is checked by the generic Memory Attributes table parsing * routines), there is no need to check that again here.
*/ return apply_to_page_range(mm, md->virt_addr,
md->num_pages << EFI_PAGE_SHIFT,
set_permissions, &data);
}
/* * UpdateCapsule() depends on the system being shutdown via * ResetSystem().
*/ bool efi_poweroff_required(void)
{ return efi_enabled(EFI_RUNTIME_SERVICES);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.