[PATCH] uml: fix fault handler on write
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Sat, 10 Sep 2005 17:44:57 +0000 (19:44 +0200)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sat, 10 Sep 2005 19:00:18 +0000 (12:00 -0700)
The UML fault handler was recently changed to enforce PROT_NONE protections,
by requiring VM_READ or VM_EXEC on VMA's.

However, by mistake, things were changed such that VM_READ is always checked,
also on write faults; so a VMA mapped with only PROT_WRITE is not readable
(unless it's prefaulted with MAP_POPULATE or with a write), which is different
from i386.

Discovered while testing remap_file_pages protection support.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/um/kernel/trap_kern.c

index b5fc89fe9eab8f2e51859e5a44c5f2bf5d226ab4..d20361dcd1274f165f385a1e7d09b687e40c5689 100644 (file)
@@ -57,7 +57,8 @@ good_area:
        if(is_write && !(vma->vm_flags & VM_WRITE)) 
                goto out;
 
-        if(!(vma->vm_flags & (VM_READ | VM_EXEC)))
+       /* Don't require VM_READ|VM_EXEC for write faults! */
+        if(!is_write && !(vma->vm_flags & (VM_READ | VM_EXEC)))
                 goto out;
 
        do {