lkml.org 
[lkml]   [2002]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: RFC: mmap(PROT_READ, MAP_SHARED) fails if !writepage.
Date


torvalds@transmeta.com said:
> This is broken. Since it has VM_MAYWRITE, a subsequent mprotect() may
> mark it writable, and you you went boom.

Er, we clear VM_MAYWRITE...

+ if (vma->vm_flags & VM_WRITE)
return -EINVAL;
+ else
+ vma->vm_flags &= ~VM_MAYWRITE;

> If you really want a shared mapping, you'd better open with O_RDONLY,
> at which point the existing code should be perfectly happy and does
> the right thing.

It's a read-only mapping. Whether it's shared or private is not relevant,
surely, since those affect only the behaviour if we write to it -- which we
can't.

I don't _really_ want a shared mapping; all I want is for the fsx-linux
stress test to run, and find interesting breakage on my file system to keep
me from getting bored (what are Friday nights for, after all?).

As shipped, fsx-linux uses PROT_READ, MAP_SHARED on its test file, which
definitely needs to be opened for write. For now, I've just changed it to
use MAP_PRIVATE. I'm just a bit concerned about having to change the test to
get it to work though, and don't see why a _readonly_ mmap should fail due
to lack of writepage.

--
dwmw2


-
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:30    [W:1.179 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site