summaryrefslogtreecommitdiff
path: root/include/linux/mman.h
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2019-11-25 20:27:06 +0300
committerCatalin Marinas <catalin.marinas@arm.com>2020-09-04 14:46:07 +0300
commitc462ac288f2c97e0c1d9ff6a65955317e799f958 (patch)
treeac7e3391d1688a5520c0f182fc60dd038b8033b6 /include/linux/mman.h
parent9f3419315f3cdc41a7318e4d50ba18a592b30c8c (diff)
downloadlinux-c462ac288f2c97e0c1d9ff6a65955317e799f958.tar.xz
mm: Introduce arch_validate_flags()
Similarly to arch_validate_prot() called from do_mprotect_pkey(), an architecture may need to sanity-check the new vm_flags. Define a dummy function always returning true. In addition to do_mprotect_pkey(), also invoke it from mmap_region() prior to updating vma->vm_page_prot to allow the architecture code to veto potentially inconsistent vm_flags. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include/linux/mman.h')
-rw-r--r--include/linux/mman.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/mman.h b/include/linux/mman.h
index 6fa15c9b12af..629cefc4ecba 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -108,6 +108,19 @@ static inline bool arch_validate_prot(unsigned long prot, unsigned long addr)
#define arch_validate_prot arch_validate_prot
#endif
+#ifndef arch_validate_flags
+/*
+ * This is called from mmap() and mprotect() with the updated vma->vm_flags.
+ *
+ * Returns true if the VM_* flags are valid.
+ */
+static inline bool arch_validate_flags(unsigned long flags)
+{
+ return true;
+}
+#define arch_validate_flags arch_validate_flags
+#endif
+
/*
* Optimisation macro. It is equivalent to:
* (x & bit1) ? bit2 : 0