[RFC][PATCH 1/6] mprotect patch for use by SLIM

From: Kylene Jo Hall
Date: Fri Jul 14 2006 - 13:23:59 EST


This small patch makes mprotect available for use by SLIM for
write revocation.

Signed-off-by: Mimi Zohar <zohar@xxxxxxxxxx>
Signed-off-by: Kylene Hall <kjhall@xxxxxxxxxx>
---
include/linux/mm.h | 2 ++
mm/mprotect.c | 14 ++++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)

Index: linux-2.6.17/mm/mprotect.c
===================================================================
--- linux-2.6.17.orig/mm/mprotect.c
+++ linux-2.6.17/mm/mprotect.c
@@ -19,6 +19,7 @@
#include <linux/mempolicy.h>
#include <linux/personality.h>
#include <linux/syscalls.h>
+#include <linux/module.h>
#include <linux/swap.h>
#include <linux/swapops.h>
#include <asm/uaccess.h>
@@ -179,8 +180,7 @@ fail:
return error;
}

-asmlinkage long
-sys_mprotect(unsigned long start, size_t len, unsigned long prot)
+int do_mprotect(unsigned long start, size_t len, unsigned long prot)
{
unsigned long vm_flags, nstart, end, tmp, reqprot;
struct vm_area_struct *vma, *prev;
@@ -278,3 +278,13 @@ out:
up_write(&current->mm->mmap_sem);
return error;
}
+EXPORT_SYMBOL_GPL(do_mprotect);
+
+asmlinkage long
+sys_mprotect(unsigned long start, size_t len, unsigned long prot)
+{
+ int ret;
+
+ ret = do_mprotect(start, len, prot);
+ return ret;
+}
Index: linux-2.6.17/include/linux/mm.h
===================================================================
--- linux-2.6.17.orig/include/linux/mm.h
+++ linux-2.6.17/include/linux/mm.h
@@ -138,6 +138,8 @@ extern unsigned int kobjsize(const void
#define VM_EXEC 0x00000004
#define VM_SHARED 0x00000008

+extern int do_mprotect(unsigned long start, size_t len, unsigned long prot);
+
/* mprotect() hardcodes VM_MAYREAD >> 4 == VM_READ, and so for r/w/x bits. */
#define VM_MAYREAD 0x00000010 /* limits for mprotect() etc */
#define VM_MAYWRITE 0x00000020


-
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/