Messages in this thread | | | From | David Woodhouse <> | Subject | Re: RFC: mmap(PROT_READ, MAP_SHARED) fails if !writepage. | Date | Fri, 08 Nov 2002 23:50:19 +0000 |
| |
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/
| |