arm64: efi: ignore EFI_MEMORY_XP attribute if RP and/or WP are set
PATCH 1/1 arm64: efi: ignore EFI_MEMORY_XP attribute if RP and/or WP are set
The UEFI memory map is a bit vague about how to interpret the EFI_MEMORY_XP attribute when it is combined with EFI_MEMORY_RP and/or EFI_MEMORY_WP, which have retroactively been redefined as cacheability attributes rather than permission attributes.
So let's ignore EFI_MEMORY_XP if _RP and/or _WP are also set. In this case, it is likely that they are being used to describe the capability of the region (i.e., whether it has the controls to reconfigure it as non-executable) rather than the nature of the contents of the region (i.e., whether it contains data that we will never attempt to execute)
--- arch/arm64/kernel/efi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm64/kernel/efi.c +3 -1
@@ -48,7 +48,9 @@ static __init pteval_t create_mapping_protection(efi_memory_desc_t *md)return pgprot_val (PAGE_KERNEL_ROX );/* RW- */ -if (attr &EFI_MEMORY_XP || type !=EFI_RUNTIME_SERVICES_CODE ) +if (((attr & (EFI_MEMORY_RP |EFI_MEMORY_WP |EFI_MEMORY_XP )) == +EFI_MEMORY_XP ) || + type !=EFI_RUNTIME_SERVICES_CODE )return pgprot_val (PAGE_KERNEL );/* RWX */
Signature · 1 line
2.11.0
PATCH 1/1 arm64: efi: ignore EFI_MEMORY_XP attribute if RP and/or WP are set
Quoted 1 line · Ard Biesheuvel
The UEFI memory map
*spec*
Quoted 36 lines
is a bit vague about how to interpret the
EFI_MEMORY_XPattribute when it is combined withEFI_MEMORY_RPand/orEFI_MEMORY_WP, which have retroactively been redefined as cacheability attributes rather than permission attributes.So let's ignore
EFI_MEMORY_XPif_RPand/or_WPare also set. In this case, it is likely that they are being used to describe the capability of the region (i.e., whether it has the controls to reconfigure it as non-executable) rather than the nature of the contents of the region (i.e., whether it contains data that we will never attempt to execute)Cc Stephen Boyd <[email protected]>Cc Matt Fleming <[email protected]>Signed-off-by Ard Biesheuvel <[email protected]>--- arch/arm64/kernel/efi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)arch/arm64/kernel/efi.c +3
-2@@ -48,7 +48,9 @@ static __init pteval_t create_mapping_protection(efi_memory_desc_t *md)return pgprot_val (PAGE_KERNEL_ROX );/* RW- */ -if (attr &EFI_MEMORY_XP || type !=EFI_RUNTIME_SERVICES_CODE ) +if (((attr & (EFI_MEMORY_RP |EFI_MEMORY_WP |EFI_MEMORY_XP )) == +EFI_MEMORY_XP ) || + type !=EFI_RUNTIME_SERVICES_CODE )return pgprot_val (PAGE_KERNEL );/* RWX */ --2.11.0
PATCH 1/1 arm64: efi: ignore EFI_MEMORY_XP attribute if RP and/or WP are set
In reply to Ard BiesheuvelQuoted 5 lines · Ard Biesheuvel
The UEFI memory map is a bit vague about how to interpret the
EFI_MEMORY_XPattribute when it is combined withEFI_MEMORY_RPand/orEFI_MEMORY_WP, which have retroactively been redefined as cacheability attributes rather than permission attributes.
Quoted 7 lines
So let's ignore
EFI_MEMORY_XPif_RPand/or_WPare also set. In this case, it is likely that they are being used to describe the capability of the region (i.e., whether it has the controls to reconfigure it as non-executable) rather than the nature of the contents of the region (i.e., whether it contains data that we will never attempt to execute)Cc Stephen Boyd <[email protected]>
I will test early next week and provide a tested-by. Thanks.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH 1/1 arm64: efi: ignore EFI_MEMORY_XP attribute if RP and/or WP are set
Quoted 12 lines · Stephen Boyd
Quoted 11 lines · Ard Biesheuvel
The UEFI memory map is a bit vague about how to interpret the
EFI_MEMORY_XPattribute when it is combined withEFI_MEMORY_RPand/orEFI_MEMORY_WP, which have retroactively been redefined as cacheability attributes rather than permission attributes.So let's ignore
EFI_MEMORY_XPif_RPand/or_WPare also set. In this case, it is likely that they are being used to describe the capability of the region (i.e., whether it has the controls to reconfigure it as non-executable) rather than the nature of the contents of the region (i.e., whether it contains data that we will never attempt to execute)
Quoted 6 lines
Quoted 1 line
Cc Stephen Boyd <[email protected]>Reported-by Stephen Boyd <[email protected]>I will test early next week and provide a tested-by. Thanks.
Great, thanks.
PATCH 1/1 arm64: efi: ignore EFI_MEMORY_XP attribute if RP and/or WP are set
Quoted 13 lines · Ard Biesheuvel
Quoted 12 lines · Stephen Boyd
Quoted 11 lines · Ard Biesheuvel
The UEFI memory map is a bit vague about how to interpret the
EFI_MEMORY_XPattribute when it is combined withEFI_MEMORY_RPand/orEFI_MEMORY_WP, which have retroactively been redefined as cacheability attributes rather than permission attributes.So let's ignore
EFI_MEMORY_XPif_RPand/or_WPare also set. In this case, it is likely that they are being used to describe the capability of the region (i.e., whether it has the controls to reconfigure it as non-executable) rather than the nature of the contents of the region (i.e., whether it contains data that we will never attempt to execute)
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
Cc Stephen Boyd <[email protected]>Reported-by Stephen Boyd <[email protected]>I will test early next week and provide a tested-by. Thanks.
Great, thanks.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project