mm-update-vma_modify_flags-to-handle-residual-flags-document.patch removed from -mm tree
The quilt patch titled
Subject: mm: update vma_modify_flags() to handle residual flags, document
has been removed from the -mm tree. Its filename was
mm-update-vma_modify_flags-to-handle-residual-flags-document.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Lorenzo Stoakes <[email protected]>
Subject: mm: update vma_modify_flags() to handle residual flags, document
Date: Tue, 18 Nov 2025 10:17:45 +0000
The vma_modify_*() family of functions each either perform splits, a merge or no changes at all in preparation for the requested modification to occur.
When doing so for a VMA flags change, we currently don't account for any flags which may remain (for instance, VM_SOFTDIRTY) despite the requested change in the case that a merge succeeded.
This is made more important by subsequent patches which will introduce the concept of sticky VMA flags which rely on this behaviour.
This patch fixes this by passing the VMA flags parameter as a pointer and updating it accordingly on merge and updating callers to accommodate for this.
Additionally, while we are here, we add kdocs for each of the vma_modify_*() functions, as the fact that the requested modification is not performed is confusing so it is useful to make this abundantly clear.
We also update the VMA userland tests to account for this change.
---
mm/madvise.c | 2 mm/mlock.c | 2 mm/mprotect.c | 2 mm/mseal.c | 9 +- mm/vma.c | 56 ++++++++------- mm/vma.h | 138 ++++++++++++++++++++++++++++---------- tools/testing/vma/vma.c | 3 7 files changed, 143 insertions(+), 69 deletions(-)
mm/madvise.c renamed from mm/madvise.c~mm-update-vma_modify_flags-to-handle-residual-flags-document +1 -1
@@ -167,7 +167,7 @@ static int madvise_update_vma(vm_flags_t range->start, range->end, anon_name); else vma =vma_modify_flags (&vmi, madv_behavior->prev, vma, - range->start, range->end, new_flags); + range->start, range->end, &new_flags);if (IS_ERR (vma))return PTR_ERR (vma);
mm/mlock.c renamed from mm/mlock.c~mm-update-vma_modify_flags-to-handle-residual-flags-document +1 -1
@@ -478,7 +478,7 @@ static int mlock_fixup(struct vma_iterat/* don't set VM_LOCKED or VM_LOCKONFAULT and don't count */ goto out; - vma =vma_modify_flags (vmi, *prev, vma, start, end, newflags); + vma =vma_modify_flags (vmi, *prev, vma, start, end, &newflags);if (IS_ERR (vma)) { ret =PTR_ERR (vma); goto out;
mm/mprotect.c renamed from mm/mprotect.c~mm-update-vma_modify_flags-to-handle-residual-flags-document +1 -1
@@ -756,7 +756,7 @@ mprotect_fixup(struct vma_iterator *vmi, newflags &= ~VM_ACCOUNT ; } - vma =vma_modify_flags (vmi, *pprev, vma, start, end, newflags); + vma =vma_modify_flags (vmi, *pprev, vma, start, end, &newflags);if (IS_ERR (vma)) { error =PTR_ERR (vma); goto fail;
mm/mseal.c renamed from mm/mseal.c~mm-update-vma_modify_flags-to-handle-residual-flags-document +5 -4
@@ -66,12 +66,13 @@ static int mseal_apply(struct mm_struct prev = vma;for_each_vma_range (vmi, vma, end) { -unsigned long curr_end =MIN (vma->vm_end, end); +const unsigned long curr_end =MIN (vma->vm_end, end);if (!(vma->vm_flags &VM_SEALED )) { - vma =vma_modify_flags (&vmi, prev, vma, - curr_start, curr_end, - vma->vm_flags |VM_SEALED ); +vm_flags_t vm_flags = vma->vm_flags |VM_SEALED ; + + vma =vma_modify_flags (&vmi, prev, vma, curr_start, + curr_end, &vm_flags);if (IS_ERR (vma))return PTR_ERR (vma);vm_flags_set (vma,VM_SEALED );
mm/vma.c renamed from mm/vma.c~mm-update-vma_modify_flags-to-handle-residual-flags-document +30 -26
81 lines not on this page · raw message
mm/vma.h renamed from mm/vma.h~mm-update-vma_modify_flags-to-handle-residual-flags-document +103 -35
150 lines not on this page · raw message
tools/testing/vma/vma.c renamed from tools/testing/vma/vma.c~mm-update-vma_modify_flags-to-handle-residual-flags-document +2 -1
@@ -339,6 +339,7 @@ static bool test_simple_modify(void)struct mm_struct mm = {};struct vm_area_struct *init_vma =alloc_vma (&mm,0 ,0x3000 ,0 , vm_flags);VMA_ITERATOR (vmi, &mm,0x1000 ); +vm_flags_t flags =VM_READ |VM_MAYREAD ;ASSERT_FALSE (attach_vma (&mm, init_vma));
@@ -347,7 +348,7 @@ static bool test_simple_modify(void)* performs the merge/split only. */ vma =vma_modify_flags (&vmi, init_vma, init_vma, -0x1000 ,0x2000 ,VM_READ |VM_MAYREAD ); +0x1000 ,0x2000 , &flags);ASSERT_NE (vma,NULL );/* We modify the provided VMA, and on split allocate new VMAs. */ ASSERT_EQ (vma, init_vma);
_
Patches currently in -mm which might be from [email protected] are
mm-correctly-handle-uffd-pte-markers.patch mm-introduce-leaf-entry-type-and-use-to-simplify-leaf-entry-logic.patch mm-avoid-unnecessary-uses-of-is_swap_pte.patch mm-eliminate-is_swap_pte-when-softleaf_from_pte-suffices.patch mm-use-leaf-entries-in-debug-pgtable-remove-is_swap_pte.patch fs-proc-task_mmu-refactor-pagemap_pmd_range.patch mm-avoid-unnecessary-use-of-is_swap_pmd.patch mm-huge_memory-refactor-copy_huge_pmd-non-present-logic.patch mm-huge_memory-refactor-change_huge_pmd-non-present-logic.patch mm-replace-pmd_to_swp_entry-with-softleaf_from_pmd.patch mm-introduce-pmd_is_huge-and-use-where-appropriate.patch mm-remove-remaining-is_swap_pmd-users-and-is_swap_pmd.patch mm-remove-non_swap_entry-and-use-softleaf-helpers-instead.patch mm-remove-is_hugetlb_entry_.patch mm-eliminate-further-swapops-predicates.patch mm-replace-remaining-pte_to_swp_entry-with-softleaf_from_pte.patch