From: Leif Lindholm <leif.lindholm@linaro.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: edk2-devel@lists.01.org, lersek@redhat.com
Subject: Re: [PATCH 4/5] ArmPkg/ArmMmuLib ARM: implement memory permission control routines
Date: Mon, 6 Mar 2017 16:11:53 +0000 [thread overview]
Message-ID: <20170306161153.GZ16034@bivouac.eciton.net> (raw)
In-Reply-To: <1488385903-30267-5-git-send-email-ard.biesheuvel@linaro.org>
On Wed, Mar 01, 2017 at 04:31:42PM +0000, Ard Biesheuvel wrote:
> Now that we have the prerequisite functionality available in ArmMmuLib,
> wire it up into ArmSetMemoryRegionNoExec, ArmClearMemoryRegionNoExec,
> ArmSetMemoryRegionReadOnly and ArmClearMemoryRegionReadOnly. This is
> used by the non-executable stack feature that is configured by DxeIpl.
>
> NOTE: The current implementation will not combine RO and XP attributes,
> i.e., setting/clearing a region no-exec will unconditionally
> clear the read-only attribute, and vice versa. Currently, we
> only use ArmSetMemoryRegionNoExec(), so for now, we should be
> able to live with this.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c
> index 1112660b434e..55601328d93e 100644
> --- a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c
> +++ b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c
> @@ -761,40 +761,40 @@ ArmSetMemoryAttributes (
> return Status;
> }
>
> -RETURN_STATUS
> +EFI_STATUS
Could these RETURN_->EFI_ fixes be folded into 1/5 instead (if you've
not already pushed it by the time you get here)?
> ArmSetMemoryRegionNoExec (
> IN EFI_PHYSICAL_ADDRESS BaseAddress,
> IN UINT64 Length
> )
> {
> - return RETURN_UNSUPPORTED;
> + return ArmSetMemoryAttributes (BaseAddress, Length, EFI_MEMORY_XP);
> }
>
> -RETURN_STATUS
> +EFI_STATUS
> ArmClearMemoryRegionNoExec (
> IN EFI_PHYSICAL_ADDRESS BaseAddress,
> IN UINT64 Length
> )
> {
> - return RETURN_UNSUPPORTED;
> + return ArmSetMemoryAttributes (BaseAddress, Length, 0);
I'd be slightly happier if there was a #define for that 0, throughout.
Alternatively, replace with a macro called ArmClearMemoryAttributes().
/
Leif
> }
>
> -RETURN_STATUS
> +EFI_STATUS
> ArmSetMemoryRegionReadOnly (
> IN EFI_PHYSICAL_ADDRESS BaseAddress,
> IN UINT64 Length
> )
> {
> - return RETURN_UNSUPPORTED;
> + return ArmSetMemoryAttributes (BaseAddress, Length, EFI_MEMORY_RO);
> }
>
> -RETURN_STATUS
> +EFI_STATUS
> ArmClearMemoryRegionReadOnly (
> IN EFI_PHYSICAL_ADDRESS BaseAddress,
> IN UINT64 Length
> )
> {
> - return RETURN_UNSUPPORTED;
> + return ArmSetMemoryAttributes (BaseAddress, Length, 0);
> }
>
> RETURN_STATUS
> --
> 2.7.4
>
next prev parent reply other threads:[~2017-03-06 16:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-01 16:31 [PATCH 0/5] ArmPkg, ArmVirtPkg ARM: enable non-executable stack Ard Biesheuvel
2017-03-01 16:31 ` [PATCH 1/5] ArmPkg/ArmMmuLib AARCH64: use correct return type for exported functions Ard Biesheuvel
2017-03-06 14:57 ` Leif Lindholm
2017-03-01 16:31 ` [PATCH 2/5] ArmPkg: move ARM version of SetMemoryAttributes to ArmMmuLib Ard Biesheuvel
2017-03-06 16:03 ` Leif Lindholm
2017-03-06 16:05 ` Ard Biesheuvel
2017-03-06 16:21 ` Leif Lindholm
2017-03-01 16:31 ` [PATCH 3/5] ArmPkg/ArmMmuLib: remove VirtualMask arg from ArmSetMemoryAttributes Ard Biesheuvel
2017-03-06 16:06 ` Leif Lindholm
2017-03-01 16:31 ` [PATCH 4/5] ArmPkg/ArmMmuLib ARM: implement memory permission control routines Ard Biesheuvel
2017-03-06 16:11 ` Leif Lindholm [this message]
2017-03-01 16:31 ` [PATCH 5/5] ArmVirtPkg: enable non-executable DXE stack for all platforms Ard Biesheuvel
2017-03-01 19:10 ` Laszlo Ersek
2017-03-01 19:10 ` Ard Biesheuvel
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=20170306161153.GZ16034@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