linux/arch/arm64/mm
Andrea Parri 1fef816691 arm64: mm: Fix the break-before-make flush range for erratum 2645198
modify_prot_start_ptes() performs the break-before-make TLB invalidation
required by erratum 2645198 with __flush_tlb_range(), whose third
argument is the end address of the range.  It passes nr * PAGE_SIZE
instead of addr + nr * PAGE_SIZE, so __do_flush_tlb_range() computes the
page count as (nr * PAGE_SIZE - addr) >> PAGE_SHIFT.

For addr > nr * PAGE_SIZE that subtraction underflows, the page count
exceeds the batching limit and the flush degenerates to flush_tlb_mm(),
so a single-page mprotect broadcasts an ASID-wide invalidation and a
full-range mmu notifier call.

For addr <= nr * PAGE_SIZE only [addr, nr * PAGE_SIZE) is invalidated,
and when the cleared batch starts below nr * PAGE_SIZE the tail is left
in the TLB.  The workaround then no longer covers the whole batch, and
for addr == nr * PAGE_SIZE the flush is empty.

On affected Cortex-A715 CPUs, this can corrupt ESR_ELx and FAR_ELx on the
next instruction abort caused by a permission fault.

Pass addr + nr * PAGE_SIZE as the end address.

Fixes: 7efa1cd5f8 ("arm64: add batched versions of ptep_modify_prot_start/commit")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Reviewed-by: Dev Jain <dev.jain@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
History 2026-09-24 08:48:23 +00:00
..
cache.S arm64: Provide dcache_inval_poc_nosync helper 2026-03-13 23:47:16 +01:00
context.c arm64/mm: Directly use TTBRx_EL1_CnP 2026-03-14 16:12:27 +00:00
contpte.c arm64: cpufeature: Rename BBML2_NOABORT as BBML3 2026-08-06 12:15:30 +00:00
copypage.c arm64: mte: Do not warn if the page is already tagged in copy_highpage() 2025-10-23 17:34:58 +01:00
dma-mapping.c arm64: mm: Treat all devices as dma-coherent when CLIDR_EL1.LoC == 0 2026-08-02 09:16:39 +00:00
extable.c arm64: mm: Handle PAN faults on uaccess CPY* instructions 2025-03-07 18:28:29 +00:00
fault.c arm64: mm: Fix the lockless page-table walk in show_pte() 2026-09-03 12:58:12 +00:00
fixmap.c arm64: Rename page table BSS section to .bss..pgtbl 2026-06-05 11:44:09 +01:00
flush.c mm: introduce memdesc_flags_t 2025-09-13 16:55:07 -07:00
gcs.c arm64: gcs: use the new common vm_mmap_shadow_stack() helper 2026-04-05 13:53:05 -07:00
hugetlbpage.c arm64: make huge_ptep_get handled unaligned addresses 2026-07-22 11:44:47 +00:00
init.c dma-mapping updates for Linux 7.3: 2026-08-24 11:35:46 -07:00
ioremap.c arm64: io: Rename ioremap_prot() to __ioremap_prot() 2026-02-25 19:49:51 +00:00
kasan_init.c arm64: mm: remove unreachable invalid range check in kasan_init_shadow() 2026-07-01 09:22:40 +03:00
Makefile mm: rename GENERIC_PTDUMP and PTDUMP_CORE 2025-03-17 00:05:32 -07: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/mm: Rename ptdesc_t 2026-06-05 11:44:36 +01:00
mmu.c arm64: mm: Fix the break-before-make flush range for erratum 2645198 2026-09-24 08:48:23 +00:00
mteswap.c arm64: mm: swap: support THP_SWAP on hardware with MTE 2024-04-25 20:56:07 -07:00
pageattr.c arm64/mm: Rename ptdesc_t 2026-06-05 11:44:36 +01:00
pgd.c arm64/mm: Ensure PGD_SIZE is aligned to 64 bytes when PA_BITS = 52 2025-11-11 19:13:03 +00:00
physaddr.c arm64: mm: Don't use %pK through printk 2025-03-20 15:34:53 +00:00
proc.S Merge branch 'for-next/nmi' into for-next/core 2026-08-14 10:16:10 +00:00
ptdump.c arm64 fixes for -rc1 2026-08-28 09:02:04 -07:00
ptdump_debugfs.c mm/ptdump: take the memory hotplug lock inside ptdump_walk_pgd() 2025-07-09 22:42:20 -07:00
trans_pgd-asm.S arm64: kexec: configure EL2 vectors for kexec 2021-10-01 13:31:00 +01:00
trans_pgd.c arm64: mm: Handle invalid large leaf mappings correctly 2026-04-02 20:49:16 +01:00