]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/mmap: prevent pagefault handler from racing with mmu_notifier registration
authorSuren Baghdasaryan <surenb@google.com>
Mon, 27 Feb 2023 17:36:20 +0000 (09:36 -0800)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 28 Mar 2023 23:24:54 +0000 (16:24 -0700)
commitf8541d2e4906ce36ff4a03fb02e9afac9e5717b1
treee2657a34450ffe072f3f1fd516318fb23d84b9c7
parent1d8fb11a07e3a2a96681d578d2e7eb3e6d574400
mm/mmap: prevent pagefault handler from racing with mmu_notifier registration

Page fault handlers might need to fire MMU notifications while a new
notifier is being registered.  Modify mm_take_all_locks to write-lock all
VMAs and prevent this race with page fault handlers that would hold VMA
locks.  VMAs are locked before i_mmap_rwsem and anon_vma to keep the same
locking order as in page fault handlers.

Link: https://lkml.kernel.org/r/20230227173632.3292573-22-surenb@google.com
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mmap.c