Re: [PATCH v5 13/25] mm: Introduce arch_validate_flags()

From
Andrew Morton <akpm@linux-foundation.org>
Date
2020-06-24 18:38:17
Also in
linux-arch, linux-mm
Reply to
Catalin Marinas, 2020-06-24
On Wed, 24 Jun 2020 18:52:32 +0100 Catalin Marinas [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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.

...
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -103,6 +103,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
Again, please let's nail down where the arch should define this.

Otherwise, Acked-by: Andrew Morton [off-list ref]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thread (46 messages) 46 messages, 6 authors, last reply 2020-07-03
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help