]> git.ipfire.org Git - thirdparty/linux.git/commit
alpha: fix user-space corruption during memory compaction
authorMagnus Lindholm <linmag7@gmail.com>
Fri, 2 Jan 2026 17:30:43 +0000 (18:30 +0100)
committerMagnus Lindholm <linmag7@gmail.com>
Sat, 24 Jan 2026 09:35:52 +0000 (10:35 +0100)
commitdd5712f3379cfe760267cdd28ff957d9ab4e51c7
tree69f5d8f539da3ee22fcbe37067d1e92ec93bb5ec
parent8f0b4cce4481fb22653697cced8d0d04027cb1e8
alpha: fix user-space corruption during memory compaction

Alpha systems can suffer sporadic user-space crashes and heap
corruption when memory compaction is enabled.

Symptoms include SIGSEGV, glibc allocator failures (e.g. "unaligned
tcache chunk"), and compiler internal errors. The failures disappear
when compaction is disabled or when using global TLB invalidation.

The root cause is insufficient TLB shootdown during page migration.
Alpha relies on ASN-based MM context rollover for instruction cache
coherency, but this alone is not sufficient to prevent stale data or
instruction translations from surviving migration.

Fix this by introducing a migration-specific helper that combines:
  - MM context invalidation (ASN rollover),
  - immediate per-CPU TLB invalidation (TBI),
  - synchronous cross-CPU shootdown when required.

The helper is used only by migration/compaction paths to avoid changing
global TLB semantics.

Additionally, update flush_tlb_other(), pte_clear(), to use
READ_ONCE()/WRITE_ONCE() for correct SMP memory ordering.

This fixes observed crashes on both UP and SMP Alpha systems.

Reviewed-by: Ivan Kokshaysky <ink@unseen.parts>
Tested-by: Matoro Mahri <matoro_mailinglist_kernel@matoro.tk>
Tested-by: Michael Cree <mcree@orcon.net.nz>
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
Link: https://lore.kernel.org/r/20260102173603.18247-2-linmag7@gmail.com
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
arch/alpha/include/asm/pgtable.h
arch/alpha/include/asm/tlbflush.h
arch/alpha/mm/Makefile
arch/alpha/mm/tlbflush.c [new file with mode: 0644]