Re: [patch] threading fix, tid-2.5.47-A3

From: Ingo Molnar (mingo@elte.hu)
Date: Mon Nov 18 2002 - 07:26:25 EST


and we have VM_DONTCOPY already, which is used by the DRM code. So it
would only be a question of exporting this API to userspace. The attached
patch adds MAP_DONTCOPY. I made it unpriviledged, i doubt it has any
security impact.

        Ingo

--- linux/include/asm-i386/mman.h.orig2 2002-11-18 13:07:16.000000000 +0100
+++ linux/include/asm-i386/mman.h 2002-11-18 13:07:44.000000000 +0100
@@ -20,6 +20,7 @@
 #define MAP_NORESERVE 0x4000 /* don't check for reservations */
 #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
 #define MAP_NONBLOCK 0x10000 /* do not block on IO */
+#define MAP_DONTCOPY 0x20000 /* do not block on IO */
 
 #define MS_ASYNC 1 /* sync memory asynchronously */
 #define MS_INVALIDATE 2 /* invalidate the caches */
--- linux/mm/mmap.c.orig2 2002-11-18 13:08:03.000000000 +0100
+++ linux/mm/mmap.c 2002-11-18 13:08:44.000000000 +0100
@@ -450,6 +450,11 @@
          */
         vm_flags = calc_vm_flags(prot,flags) | mm->def_flags | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
 
+ /*
+ * Copy the mapping on fork?
+ */
+ if (flags & MAP_DONTCOPY)
+ vm_flags |= VM_DONTCOPY;
         if (flags & MAP_LOCKED) {
                 if (!capable(CAP_IPC_LOCK))
                         return -EPERM;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Nov 23 2002 - 22:00:21 EST