linux-yocto/arch/arm64/mm
Kevin Brodsky 778f4e1730 arm64: poe: Handle spurious Overlay faults
[ Upstream commit 22f3a4f608 ]

We do not currently issue an ISB after updating POR_EL0 when
context-switching it, for instance. The rationale is that if the old
value of POR_EL0 is more restrictive and causes a fault during
uaccess, the access will be retried [1]. In other words, we are
trading an ISB on every context-switching for the (unlikely)
possibility of a spurious fault. We may also miss faults if the new
value of POR_EL0 is more restrictive, but that's considered
acceptable.

However, as things stand, a spurious Overlay fault results in
uaccess failing right away since it causes fault_from_pkey() to
return true. If an Overlay fault is reported, we therefore need to
double check POR_EL0 against vma_pkey(vma) - this is what
arch_vma_access_permitted() already does.

As it turns out, we already perform that explicit check if no
Overlay fault is reported, and we need to keep that check (see
comment added in fault_from_pkey()). Net result: the Overlay ISS2
bit isn't of much help to decide whether a pkey fault occurred.

Remove the check for the Overlay bit from fault_from_pkey() and
add a comment to try and explain the situation. While at it, also
add a comment to permission_overlay_switch() in case anyone gets
surprised by the lack of ISB.

[1] https://lore.kernel.org/linux-arm-kernel/ZtYNGBrcE-j35fpw@arm.com/

Fixes: 160a8e13de ("arm64: context switch POR_EL0 register")
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Link: https://lore.kernel.org/r/20250619160042.2499290-2-kevin.brodsky@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-07-17 18:37:04 +02:00
..
cache.S
context.c arm64: Ensure bits ASID[15:8] are masked out when the kernel uses 8-bit ASIDs 2024-12-14 20:03:22 +01:00
contpte.c mm: arm64: document why pte is not advanced in contpte_ptep_set_access_flags() 2024-09-06 12:28:33 +01:00
copypage.c
dma-mapping.c arm64: Properly clean up iommu-dma remnants 2024-05-10 09:04:25 +02:00
extable.c
fault.c arm64: poe: Handle spurious Overlay faults 2025-07-17 18:37:04 +02:00
fixmap.c - Sumanth Korikkar has taught s390 to allocate hotplug-time page frames 2024-03-14 17:43:30 -07:00
flush.c
hugetlbpage.c arm64: hugetlb: Fix huge_ptep_get_and_clear() for non-present ptes 2025-03-13 13:02:17 +01:00
init.c arm64/mm: Fix Boot panic on Ampere Altra 2025-03-07 18:25:39 +01:00
ioremap.c arm64: mm: Add confidential computing hook to ioremap_prot() 2024-08-30 16:30:41 +01:00
kasan_init.c - Sumanth Korikkar has taught s390 to allocate hotplug-time page frames 2024-03-14 17:43:30 -07:00
Makefile arm64: mm: Add top-level dispatcher for internal mem_encrypt API 2024-08-30 16:30:41 +01:00
mem_encrypt.c arm64: mm: Add top-level dispatcher for internal mem_encrypt API 2024-08-30 16:30:41 +01:00
mmap.c arm64: convert protection key into vm_flags and pgprot values 2024-09-04 12:52:41 +01:00
mmu.c arm64: Restrict pagetable teardown to avoid false warning 2025-06-27 11:11:39 +01:00
mteswap.c arm64: mm: swap: support THP_SWAP on hardware with MTE 2024-04-25 20:56:07 -07:00
pageattr.c arm64: hibernate: Fix level3 translation fault in swsusp_save() 2024-04-19 16:33:00 +01:00
pgd.c arm64: mm: Add support for folding PUDs at runtime 2024-02-16 12:42:41 +00:00
physaddr.c
proc.S arm64/mm: Drop TCR_SMP_FLAGS 2024-08-16 11:24:55 +01:00
ptdump_debugfs.c
ptdump.c arm64: ptdump: Don't override the level when operating on the stage-2 tables 2024-09-10 21:32:51 +01:00
trans_pgd-asm.S
trans_pgd.c arm64: trans_pgd: mark PTEs entries as valid to avoid dead kexec() 2024-09-04 16:30:23 +01:00