public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Alexander Graf" <agraf@csgraf.de>
To: Ard Biesheuvel <ardb@kernel.org>, devel@edk2.groups.io
Cc: leif@nuviainc.com, peter.maydell@linaro.org
Subject: Re: [PATCH] ArmPkg/ArmMmuLib AARCH64: avoid EL0 accessible mappings
Date: Wed, 22 Sep 2021 20:27:21 +0200	[thread overview]
Message-ID: <56616761-e314-af79-caba-d76a77b8bfe4@csgraf.de> (raw)
In-Reply-To: <20210922161954.627616-1-ardb@kernel.org>


On 22.09.21 18:19, Ard Biesheuvel wrote:
> We never run any code at EL0, and so it would seem that any access
> permissions set for EL0 (via the AP[1] attribute in the page tables) are
> irrelevant. We currently set EL0 and EL1 permissions to the same value
> arbitrarily.
>
> However, this causes problems on hardware like the Apple M1 running the
> hypervisor framework, which enters EL1 with SCTLR_EL1.SPAN enabled,
> which causes the Privileged Access Never (PAN) feature to be enabled on
> any exception taken to EL1, including the IRQ exceptions that handle our
> timer interrupt. When PAN is enabled, EL1 has no access to any mappings
> that are also accessible to EL0, causing the firmware to crash if it
> attempts to access such a mapping.
>
> Even though it is debatable whether or not SCTLR_EL1.SPAN should be
> disabled at entry or whether the firmware should put all UNKNOWN bits in
> all system registers in a consistent state (which it should), using EL0
> permissions serves no purpose whatsoever so let's fix that regardless.
>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>


I can confirm that this unbreaks HVF guests running on M1 with
SCTLR_EL1.SPAN=0 as reset state.


Tested-by: Alexander Graf <agraf@csgraf.de>

Alex




      parent reply	other threads:[~2021-09-22 18:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-22 16:19 [PATCH] ArmPkg/ArmMmuLib AARCH64: avoid EL0 accessible mappings Ard Biesheuvel
2021-09-22 16:57 ` Leif Lindholm
2021-09-22 18:27 ` Alexander Graf [this message]

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=56616761-e314-af79-caba-d76a77b8bfe4@csgraf.de \
    --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