[PATCH 0/4] mm: avoid losing atomic VMA flags
From: Lorenzo Stoakes (ARM)
Date: Fri Oct 23 2026 - 09:55:08 EST
Since commit 2ab7f1bbafc9 ("mm/madvise: allow guard page install/remove
under VMA lock"), VMA_MAYBE_GUARD_BIT can be set atomically under the VMA
read lock.
However, a number of places wrongly assume the flags are stable under the
read lock, which can cause stale atomic VMA flags to overwrite existing
valid ones.
Additionally, one case in which VMA_SOFTDIRTY_BIT was overwritten is also
addressed.
This series addresses each of these, while keeping the logic inline with
existing conventions.
Each patch in this series is a hotfix.
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
---
David Hildenbrand (Arm) (2):
mm/vma: write lock source VMA before duplicating it in __split_vma()
mm/madvise: preserve VMA_SOFTDIRTY_BIT when changing anonymous names
Lorenzo Stoakes (ARM) (2):
mm: do not unintentionally overwrite atomic VMA flags
mm/vma: avoid losing atomic VMA flags when setting sticky VMA flags
include/linux/mm.h | 166 +++++++++++++++++++-------------------
mm/madvise.c | 10 +--
mm/mlock.c | 6 +-
mm/mprotect.c | 2 +-
mm/vma.c | 57 +++++++------
mm/vma_init.c | 3 +
tools/testing/vma/include/dup.h | 78 ++++++++++--------
tools/testing/vma/include/stubs.h | 2 +-
tools/testing/vma/shared.h | 16 ++--
9 files changed, 185 insertions(+), 155 deletions(-)
---
base-commit: 5f980b2d53abf3950caff5d77b5c69dc6ebb19b6
change-id: 20261022-fix-vma-atomic-8c910fd66a28
Cheers,
--
Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>