lkml.org 
[lkml]   [1999]   [Dec]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectPATCH: was Re: mmap bug in 2.2.13 (or in documentation)
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!--- 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;
\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.168 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site