diff options
author | Lokesh Gidra <lokeshgidra@google.com> | 2024-02-15 10:27:54 -0800 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2024-02-22 15:27:20 -0800 |
commit | 5e4c24a57b0c126686534b5b159a406c5dd02400 (patch) | |
tree | bbaccee6eabcbd472fe81ac67f3d3dbf790eb55d /include/net/fou.h | |
parent | f91e6b41dd11daffb138e3afdb4804aefc3d4e1b (diff) | |
download | linux-stable-5e4c24a57b0c126686534b5b159a406c5dd02400.tar.gz linux-stable-5e4c24a57b0c126686534b5b159a406c5dd02400.tar.bz2 linux-stable-5e4c24a57b0c126686534b5b159a406c5dd02400.zip |
userfaultfd: protect mmap_changing with rw_sem in userfaulfd_ctx
Increments and loads to mmap_changing are always in mmap_lock critical
section. This ensures that if userspace requests event notification for
non-cooperative operations (e.g. mremap), userfaultfd operations don't
occur concurrently.
This can be achieved by using a separate read-write semaphore in
userfaultfd_ctx such that increments are done in write-mode and loads in
read-mode, thereby eliminating the dependency on mmap_lock for this
purpose.
This is a preparatory step before we replace mmap_lock usage with per-vma
locks in fill/move ioctls.
Link: https://lkml.kernel.org/r/20240215182756.3448972-3-lokeshgidra@google.com
Signed-off-by: Lokesh Gidra <lokeshgidra@google.com>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Brian Geffon <bgeffon@google.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jann Horn <jannh@google.com>
Cc: Kalesh Singh <kaleshsingh@google.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Nicolas Geoffray <ngeoffray@google.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Tim Murray <timmurray@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include/net/fou.h')
0 files changed, 0 insertions, 0 deletions