]> 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)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 4 Jan 2023 20:59:25 +0000 (15:59 -0500)
commit1615cac6fc393965aee08c3a6e4a643724c4294a
treecf4089a83f591eea4aadb7cf587ad82ca2283aa4
parenta53ac71cadc27e7e6ef3cebc1670ca9e930840c4
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