Subject: Re: port-i386/3927: mmap doens't behave rigth in linux emulation
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Manuel BOUYER <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 07/30/1997 13:13:07
[ follow-up to tech-kern ]
On Jul 30, der Mouse wrote
> It seems to me that NetBSD is doing it correctly; the "last page" does
> not have any file backing it, so you _should_ to get a SIGSEGV when
> accessing it. (Indeed, you really _ought_ to get a SIGSEGV when
> accessing bytes in the slop between EOF and the end of the page
> containing EOF, but while that's possible, it would probably be ugly to
> implement and highly inefficient when accessing bytes that _do_ exist
> on that last page, unless the VM hardware supports byte-granularity
> access permissions.)
I agree, and the way this program was written is ugly and non-portable.
>
> Do we really want to be _this_ bug-compatible with Linux? It seems to
> me (though admittedly I haven't looked at doing it either) that it
> would mean allocating two pagers, not one, for the mmap, one to back
> most of it, with the file, and one to back the "extra" page, with swap.
I think you only need to get an extra free page. The vnode
pager will handle it the same way it handles the extra bytes of the last
page when the file is not page-aligned. If it can't be done this way it may
not be worth implementing it, I don't think that this "feature" is
widely used.
> I'd say this should be reported to the Linux community as a bug in
> their mmap.
As fixing this bug will break at last one of their support tools,
I don't think they will accept it :)
--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel.Bouyer@lip6.fr
--