]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/mmap: write-lock VMAs before merging, splitting or expanding them
authorSuren Baghdasaryan <surenb@google.com>
Sat, 11 Jun 2022 05:37:08 +0000 (22:37 -0700)
committerSuren Baghdasaryan <surenb@google.com>
Wed, 23 Nov 2022 02:09:45 +0000 (02:09 +0000)
commitc46000458d573c6cb0ff57c969d27c7f689e57d8
treed1e968100979d4edad23e4a8829bcf41f22377b7
parent3a719cc9aa00866bb2fddf99bf39a84a83dae276
mm/mmap: write-lock VMAs before merging, splitting or expanding them

Decisions about whether VMAs can be merged, split or expanded must be
made while VMAs are protected from the changes which can affect that
decision. For example, merge_vma uses vma->anon_vma in its decision
whether the VMA can be merged. Meanwhile, page fault handler changes
vma->anon_vma during COW operation.
Write-lock all VMAs which might be affected by a merge or split operation
before making decision how such operations should be performed.

Not sure if expansion really needs this, just being paranoid. Otherwise
mmap_region and vm_brk_flags might not locking.

Signed-off-by: Suren Baghdasaryan <surenb@google.com>
mm/mmap.c