From: Leif Lindholm <leif.lindholm@linaro.org>
To: Jiewen Yao <jiewen.yao@intel.com>
Cc: edk2-devel@lists.01.org,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Andrew Fish <afish@apple.com>
Subject: Re: [PATCH 2/3] ArmPkg/CpuDxe: Correct EFI_MEMORY_RO usage
Date: Thu, 26 Jan 2017 12:11:05 +0000 [thread overview]
Message-ID: <20170126121105.GW25883@bivouac.eciton.net> (raw)
In-Reply-To: <1485419955-26652-3-git-send-email-jiewen.yao@intel.com>
On Thu, Jan 26, 2017 at 04:39:14PM +0800, Jiewen Yao wrote:
> Current Arm CpuDxe driver uses EFI_MEMORY_WP for write protection,
> according to UEFI spec, we should use EFI_MEMORY_RO for write protection.
> The EFI_MEMORY_WP is the cache attribute instead of memory attribute.
Hi Jiewen,
The change looks sane, given the clarification of the specification,
but there are several instances of EFI_MEMORY_WP in comments left
around from Andrew Fish's original ARM implementation. I think they
should be updated too.
Andrew: can you confirm what the below snipped from
ArmPkg/Drivers/CpuDxe/Arm/Mmu.c was meant to convey?
---
case TT_DESCRIPTOR_SECTION_AP_NO_NO: // no read, no write
//*GcdAttributes |= EFI_MEMORY_WP | EFI_MEMORY_RP;
---
Regards,
Leif
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
> ---
> ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c | 2 +-
> ArmPkg/Drivers/CpuDxe/Arm/Mmu.c | 5 +----
> 2 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
> index d8bb419..4703b33 100644
> --- a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
> +++ b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
> @@ -224,7 +224,7 @@ EfiAttributeToArmAttribute (
> ArmAttributes |= TT_AF;
>
> // Determine protection attributes
> - if (EfiAttributes & EFI_MEMORY_WP) {
> + if (EfiAttributes & EFI_MEMORY_RO) {
> ArmAttributes |= TT_AP_RO_RO;
> }
>
> diff --git a/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c b/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c
> index 14fc22d..e375cbe 100644
> --- a/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c
> +++ b/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c
> @@ -730,9 +730,6 @@ EfiAttributeToArmAttribute (
> ArmAttributes = TT_DESCRIPTOR_SECTION_CACHE_POLICY_WRITE_BACK_ALLOC; // TEX [2:0] = 001, C=1, B=1
> break;
>
> - case EFI_MEMORY_WP:
> - case EFI_MEMORY_XP:
> - case EFI_MEMORY_RP:
> case EFI_MEMORY_UCE:
> default:
> // Cannot be implemented UEFI definition unclear for ARM
> @@ -743,7 +740,7 @@ EfiAttributeToArmAttribute (
> }
>
> // Determine protection attributes
> - if (EfiAttributes & EFI_MEMORY_WP) {
> + if (EfiAttributes & EFI_MEMORY_RO) {
> ArmAttributes |= TT_DESCRIPTOR_SECTION_AP_RO_RO;
> } else {
> ArmAttributes |= TT_DESCRIPTOR_SECTION_AP_RW_RW;
> --
> 2.7.4.windows.1
>
next prev parent reply other threads:[~2017-01-26 12:11 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-26 8:39 [PATCH 0/3] DXE Memory Protection Jiewen Yao
2017-01-26 8:39 ` [PATCH 1/3] UefiCpuPkg/CpuDxe: Add memory attribute setting Jiewen Yao
2017-02-03 8:51 ` Gao, Liming
2017-02-04 0:42 ` Yao, Jiewen
2017-02-06 3:27 ` Fan, Jeff
2017-02-06 3:58 ` Yao, Jiewen
2017-02-06 5:26 ` Fan, Jeff
2017-02-06 5:28 ` Yao, Jiewen
2017-01-26 8:39 ` [PATCH 2/3] ArmPkg/CpuDxe: Correct EFI_MEMORY_RO usage Jiewen Yao
2017-01-26 12:11 ` Leif Lindholm [this message]
2017-01-26 12:17 ` Yao, Jiewen
2017-01-26 8:39 ` [PATCH 3/3] MdeModulePkg/DxeCore: Add UEFI image protection Jiewen Yao
2017-02-03 8:39 ` Gao, Liming
2017-02-04 0:41 ` Yao, Jiewen
2017-02-04 3:39 ` Gao, Liming
2017-02-06 1:07 ` Tian, Feng
2017-02-06 1:39 ` Yao, Jiewen
2017-02-06 14:34 ` Ard Biesheuvel
2017-02-06 14:51 ` Yao, Jiewen
2017-02-06 14:52 ` Ard Biesheuvel
2017-02-06 17:52 ` Kinney, Michael D
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170126121105.GW25883@bivouac.eciton.net \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox