efi: Allow EFI_MEMORY_XP and EFI_MEMORY_RO both to be cleared
authorHeiner Kallweit <hkallweit1@gmail.com>
Fri, 30 Apr 2021 14:22:51 +0000 (16:22 +0200)
committerArd Biesheuvel <ardb@kernel.org>
Sat, 22 May 2021 12:05:13 +0000 (14:05 +0200)
UEFI spec 2.9, p.108, table 4-1 lists the scenario that both attributes
are cleared with the description "No memory access protection is
possible for Entry". So we can have valid entries where both attributes
are cleared, so remove the check.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Fixes: 10f0d2f577053 ("efi: Implement generic support for the Memory Attributes table")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/memattr.c

index 5737cb0fcd44efbbbe3c6b3e84b93ede544af6a3..0a9aba5f9ceff0bff6c4507382afe487378afcd1 100644 (file)
@@ -67,11 +67,6 @@ static bool entry_is_valid(const efi_memory_desc_t *in, efi_memory_desc_t *out)
                return false;
        }
 
-       if (!(in->attribute & (EFI_MEMORY_RO | EFI_MEMORY_XP))) {
-               pr_warn("Entry attributes invalid: RO and XP bits both cleared\n");
-               return false;
-       }
-
        if (PAGE_SIZE > EFI_PAGE_SIZE &&
            (!PAGE_ALIGNED(in->phys_addr) ||
             !PAGE_ALIGNED(in->num_pages << EFI_PAGE_SHIFT))) {