Re: [PATCH 1/1] alpha: fix user-space corruption during memory compaction

From: Ivan Kokshaysky
Date: Sat Jan 03 2026 - 09:15:49 EST


On Fri, Jan 02, 2026 at 06:30:43PM +0100, Magnus Lindholm wrote:
> 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.
>
> Signed-off-by: Magnus Lindholm <linmag7@xxxxxxxxx>

Impressive work! Spot on, I guess.

Reviewed-by: Ivan Kokshaysky <ink@unseen.parts>

Ivan.