Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Date | Thu, 4 Sep 2003 11:42:54 -0700 (PDT) | From | Linus Torvalds <> | Subject | Re: [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(¤t->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/
| ![\](/images/icornerr.gif) |