[patch 04/14] remap_file_pages protection support: disallow mprotect() on manyprots mappings

From: blaisorblade
Date: Sun Apr 30 2006 - 13:33:45 EST


From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx>

For now we (I and Hugh) have found no agreement on which behavior to implement
here. So, at least as a stop-gap, return an error here.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx>
Index: linux-2.6.git/mm/mprotect.c
===================================================================
--- linux-2.6.git.orig/mm/mprotect.c
+++ linux-2.6.git/mm/mprotect.c
@@ -217,6 +217,13 @@ sys_mprotect(unsigned long start, size_t
error = -ENOMEM;
if (!vma)
goto out;
+
+ /* If a need is felt, an appropriate behaviour may be implemented for
+ * this case. We haven't agreed yet on which behavior is appropriate. */
+ error = -EACCES;
+ if (vma->vm_flags & VM_MANYPROTS)
+ goto out;
+
if (unlikely(grows & PROT_GROWSDOWN)) {
if (vma->vm_start >= end)
goto out;

--
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/