summaryrefslogtreecommitdiffstats
path: root/include/linux/mm.h
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2023-01-02 17:08:55 +0100
committerAndrew Morton <akpm@linux-foundation.org>2023-01-18 17:12:57 -0800
commitb6b7a8faf05c709cd9f63d3b7d9c66bd91bc3b0d (patch)
treee9314f6d0ce7fd59966ee70989134666ed5b477a /include/linux/mm.h
parentfc4f4be9b5271e43eeb4c675d190fa9734de9ea3 (diff)
downloadlinux-stable-b6b7a8faf05c709cd9f63d3b7d9c66bd91bc3b0d.tar.gz
linux-stable-b6b7a8faf05c709cd9f63d3b7d9c66bd91bc3b0d.tar.bz2
linux-stable-b6b7a8faf05c709cd9f63d3b7d9c66bd91bc3b0d.zip
mm/nommu: don't use VM_MAYSHARE for MAP_PRIVATE mappings
Let's stop using VM_MAYSHARE for MAP_PRIVATE mappings and use VM_MAYOVERLAY instead. Rewrite determine_vm_flags() to make the whole logic easier to digest, and to cleanly separate MAP_PRIVATE vs. MAP_SHARED. No functional change intended. Link: https://lkml.kernel.org/r/20230102160856.500584-3-david@redhat.com Signed-off-by: David Hildenbrand <david@redhat.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jens Axboe <axboe@kernel.dk> Cc: Nicolas Pitre <nico@fluxnic.net> Cc: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r--include/linux/mm.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 791bac40bf8e..8a8563359946 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -276,7 +276,12 @@ extern unsigned int kobjsize(const void *objp);
#define VM_MAYSHARE 0x00000080
#define VM_GROWSDOWN 0x00000100 /* general info on the segment */
+#ifdef CONFIG_MMU
#define VM_UFFD_MISSING 0x00000200 /* missing pages tracking */
+#else /* CONFIG_MMU */
+#define VM_MAYOVERLAY 0x00000200 /* nommu: R/O MAP_PRIVATE mapping that might overlay a file mapping */
+#define VM_UFFD_MISSING 0
+#endif /* CONFIG_MMU */
#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */
#define VM_UFFD_WP 0x00001000 /* wrprotect pages tracking */
@@ -1358,7 +1363,7 @@ static inline bool is_nommu_shared_mapping(vm_flags_t flags)
* ptrace does not apply. Note that there is no mprotect() to upgrade
* write permissions later.
*/
- return flags & VM_MAYSHARE;
+ return flags & (VM_MAYSHARE | VM_MAYOVERLAY);
}
#endif