PATCH: was Re: mmap bug in 2.2.13 (or in documentation)

Abramo Bagnara (abramo@alsa-project.org)
Fri, 31 Dec 1999 12:40:54 +0100


This is a multi-part message in MIME format.
--------------F97F1F4020F96D156EBDB297
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

James Manning wrote:
>
> [ Wednesday, December 29, 1999 ] Abramo Bagnara wrote:
> > Cause the fall through in do_mmap (around mm/mmap.c:223) all kind of
> > file mmap are denied with EACCES if file is not open for reading.
> > This is contrary to mmap(2):
> >
> > Another for me incomprehensible option is that mmap(2) is wrong... can
> > someone clarify this?
>
> I started a small lkml thread about this when I saw the same problem
> a couple of months back... since other OS's that I checked had the
> same restriction, and since replacing my creat()'s with open(O_RDWR)
> wasn't a big deal, I just tagged it as a doc bug... I couldn't think
> of a situation where you'd *want/need* to make write-only mmap'd area,
> so this seems fine to me (you could even #define your creat() if you
> don't want to change the code)

Ok, taken in account that nobody has taken back you, I assumed that your
interpretation is good (doc bug).
This is a patch to remove an useless (and confusing) check in mm/mmap.c.
Please apply.

-- 
Abramo Bagnara                       mailto:abramo@alsa-project.org

Opera Unica Via Emilia Interna, 140 Phone: +39.0546.656023 48014 Castel Bolognese (RA) - Italy Fax: +39.0546.656023

ALSA project is http://www.alsa-project.org sponsored by SuSE Linux http://www.suse.com

It sounds good! --------------F97F1F4020F96D156EBDB297 Content-Type: text/plain; charset=us-ascii; name="mmap.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mmap.diff"

--- mm/mmap.c.~1~ Thu Oct 21 17:04:37 1999 +++ mm/mmap.c Mon Dec 27 09:13:52 1999 @@ -258,8 +258,7 @@ vma->vm_flags = vm_flags(prot,flags) | mm->def_flags; if (file) { - if (file->f_mode & 1) - vma->vm_flags |= VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC; + vma->vm_flags |= VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC; if (flags & MAP_SHARED) { vma->vm_flags |= VM_SHARED | VM_MAYSHARE;

--------------F97F1F4020F96D156EBDB297--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/