diff mbox series

efi: Allow EFI_MEMORY_XP and EFI_MEMORY_RO both to be cleared

Message ID 8986e4ad-cd60-8e40-b0d5-9165a15c0cb0@gmail.com
State Accepted
Commit 45add3cc99feaaf57d4b6f01d52d532c16a1caee
Headers show
Series efi: Allow EFI_MEMORY_XP and EFI_MEMORY_RO both to be cleared | expand

Commit Message

Heiner Kallweit April 30, 2021, 2:22 p.m. UTC
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>
---
 drivers/firmware/efi/memattr.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Ard Biesheuvel May 7, 2021, 5:33 p.m. UTC | #1
On Fri, 30 Apr 2021 at 16:23, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>

> 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>


Thanks, I'll queue this up after the merge window.

> ---

>  drivers/firmware/efi/memattr.c | 5 -----

>  1 file changed, 5 deletions(-)

>

> diff --git a/drivers/firmware/efi/memattr.c b/drivers/firmware/efi/memattr.c

> index 5737cb0fc..0a9aba5f9 100644

> --- a/drivers/firmware/efi/memattr.c

> +++ b/drivers/firmware/efi/memattr.c

> @@ -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))) {

> --

> 2.31.1

>
diff mbox series

Patch

diff --git a/drivers/firmware/efi/memattr.c b/drivers/firmware/efi/memattr.c
index 5737cb0fc..0a9aba5f9 100644
--- a/drivers/firmware/efi/memattr.c
+++ b/drivers/firmware/efi/memattr.c
@@ -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))) {