From: David Woodhouse <dwmw2@infradead.org>
To: torvalds@transmeta.com (Linus Torvalds)
Cc: linux-kernel@vger.kernel.org
Subject: Re: RFC: mmap(PROT_READ, MAP_SHARED) fails if !writepage.
Date: Fri, 08 Nov 2002 23:50:19 +0000 [thread overview]
Message-ID: <25622.1036799419@passion.cambridge.redhat.com> (raw)
In-Reply-To: <aqhhft$19b$1@penguin.transmeta.com>
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
next prev parent reply other threads:[~2002-11-08 23:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-08 22:49 RFC: mmap(PROT_READ, MAP_SHARED) fails if !writepage David Woodhouse
2002-11-08 23:31 ` Linus Torvalds
2002-11-08 23:50 ` David Woodhouse [this message]
2002-11-09 2:46 ` Linus Torvalds
2002-11-09 16:36 ` David Woodhouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=25622.1036799419@passion.cambridge.redhat.com \
--to=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox