lkml.org 
[lkml]   [2003]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] Alternate futex non-page-pinning and COW fix

[ Oops. Forgot the actual patch. ]

On Thu, 4 Sep 2003, Linus Torvalds wrote:
>
> How about something like this [ ... ]

THIS.

Linus

===== mm/mprotect.c 1.23 vs edited =====
--- 1.23/mm/mprotect.c Wed Jul 2 21:22:38 2003
+++ edited/mm/mprotect.c Thu Sep 4 11:12:09 2003
@@ -224,7 +224,7 @@
asmlinkage long
sys_mprotect(unsigned long start, size_t len, unsigned long prot)
{
- unsigned long nstart, end, tmp;
+ unsigned long flags, nstart, end, tmp;
struct vm_area_struct * vma, * next, * prev;
int error = -EINVAL;

@@ -239,6 +239,12 @@
if (end == start)
return 0;

+ /*
+ * FIXME! This assumes that PROT_xxx == VM_xxxx for READ, WRITE, EXEC
+ * That does happen to be true, but it's ugly.. mmap() gets this right.
+ */
+ flags = prot & (VM_READ | VM_WRITE | VM_EXEC);
+
down_write(&current->mm->mmap_sem);

vma = find_vma_prev(current->mm, start, &prev);
@@ -257,7 +263,7 @@
goto out;
}

- newflags = prot | (vma->vm_flags & ~(PROT_READ | PROT_WRITE | PROT_EXEC));
+ newflags = flags | (vma->vm_flags & ~(VM_READ | VM_WRITE | VM_EXEC));
if ((newflags & ~(newflags >> 4)) & 0xf) {
error = -EACCES;
goto out;
-
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/

\
 
 \ /
  Last update: 2009-11-18 23:46    [W:0.087 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site