From: Paolo 'Blaisorblade' Giarrusso Date: Sat, 10 Sep 2005 17:44:57 +0000 (+0200) Subject: [PATCH] uml: fix fault handler on write X-Git-Tag: v2.6.14-rc1~131 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d129f31236c241c07e583e8bc695c382365d02ce;p=linux-2.6 [PATCH] uml: fix fault handler on write 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 Signed-off-by: Linus Torvalds --- diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap_kern.c index b5fc89fe9e..d20361dcd1 100644 --- a/arch/um/kernel/trap_kern.c +++ b/arch/um/kernel/trap_kern.c @@ -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 {