lkml.org 
[lkml]   [2003]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: 2.5.55-rmk1: user space lossage
On Thu, 23 Jan 2003, Andrew Morton wrote:
>
> We cannot clear VM_MAYWRITE in there - it turns writeable MAP_PRIVATE
> mappings into readonly ones.
>
> So change it back to the 2.4 form - disallow a writeable MAP_SHARED mapping
> against filesystems which do no implement ->writepage().

Sorry for late quibbles, but wouldn't patch below be better? Linus
did intend that change to the occasionally criticized 2.4 behaviour,
this preserves that change while avoiding the bug which hit David.

You may notice I've sneaked a ~VM_SHARED in there too. Not because
I can say it's necessary, but the VM_MAYWRITE, VM_SHARED treatment
is already weird, I'd feel safer if we keep to the same combination
as already exists in the !FMODE_WRITE case (see do_mmap_pgoff).

Hugh

--- 2.5.59-mm2/mm/filemap.c Sat Jan 18 10:37:36 2003
+++ linux/mm/filemap.c Thu Jan 23 16:50:34 2003
@@ -1310,9 +1310,11 @@

int generic_file_readonly_mmap(struct file *file, struct vm_area_struct *vma)
{
- if ((vma->vm_flags & VM_SHARED) && (vma->vm_flags & VM_WRITE))
- return -EINVAL;
- vma->vm_flags &= ~VM_MAYWRITE;
+ if (vma->vm_flags & VM_SHARED) {
+ if (vma->vm_flags & VM_WRITE)
+ return -EINVAL;
+ vma->vm_flags &= ~(VM_MAYWRITE | VM_SHARED);
+ }
return generic_file_mmap(file, vma);
}
#else
-
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: 2005-03-22 13:32    [W:0.050 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site