Re: [PATCH] Fix mlockall for PROT_NONE mappings

From: Linus Torvalds
Date: Thu Oct 09 2003 - 10:41:57 EST



On Thu, 9 Oct 2003, Andi Kleen wrote:
>
> Ok, here's a new version.

Still won't work.

You need to call mlock_fixup() to split the vma properly (it might not
cover the whole vma, and we _do_ want to keep track of the VM_LOCKED flag
correctly.

I _think_ the proper fix is something trivial like this, but it's
obviously untested. Please verify

Linus

----
--- 1.6/mm/mlock.c Sun Sep 21 14:50:36 2003
+++ edited/mm/mlock.c Thu Oct 9 08:39:25 2003
@@ -43,7 +43,8 @@
pages = (end - start) >> PAGE_SHIFT;
if (newflags & VM_LOCKED) {
pages = -pages;
- ret = make_pages_present(start, end);
+ if (newflags & VM_READ)
+ ret = make_pages_present(start, end);
}

vma->vm_mm->locked_vm -= pages;

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