audk/ArmPkg/Library
Ard Biesheuvel 017564d637 ArmPkg/ArmMmuLib AARCH64: avoid EL0 accessible mappings
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
MacOS hypervisor framework, which enters EL1 with SCTLR_EL1.SPAN
enabled, causing 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>
Tested-by: Alexander Graf <agraf@csgraf.de>
Acked-by: Leif Lindholm <leif@nuviainc.com>
2022-02-01 23:09:01 +00:00
..
ArmArchTimerLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ArmCacheMaintenanceLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ArmDisassemblerLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ArmExceptionLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ArmGenericTimerPhyCounterLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ArmGenericTimerVirtCounterLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ArmGicArchLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ArmGicArchSecLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ArmHvcLib ArmPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00
ArmLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ArmMmuLib ArmPkg/ArmMmuLib AARCH64: avoid EL0 accessible mappings 2022-02-01 23:09:01 +00:00
ArmMtlNullLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ArmPsciResetSystemLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ArmSmcLib ArmPkg: Add SMC helper functions 2021-12-14 11:30:26 +00:00
ArmSmcLibNull ArmPkg: Add SMC helper functions 2021-12-14 11:30:26 +00:00
ArmSmcPsciResetSystemLib ArmPkg: Update SMC calls to use the new ArmCallSmc0/1/2/3 functions 2021-12-14 11:30:26 +00:00
ArmSoftFloatLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ArmSvcLib ArmPkg/ArmSvcLib: Return x4-x7 in output parameters 2021-02-23 15:40:37 +00:00
CompilerIntrinsicsLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DebugAgentSymbolsBaseLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DebugPeCoffExtraActionLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DefaultExceptionHandlerLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
GccLto ArmPkg: convert LFs to CRLF, expand hard TABs 2020-03-04 12:22:07 +00:00
LinuxBootBootManagerLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
OpteeLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiServicesTablePointerLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PlatformBootManagerLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
RvdPeCoffExtraActionLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SemiHostingDebugLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SemiHostingSerialPortLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SemihostLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
StandaloneMmMmuLib ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00