Subject: mmap() and page alignment
To: None <friedl@informatik.uni-kl.de>
From: Gordon W. Ross <gwr@mc.com>
List: tech-kern
Date: 07/12/1995 20:24:12
> From: friedl@informatik.uni-kl.de
> Date: Wed, 12 Jul 95 13:07:07 MET DST

>    From: Frank van der Linden <frank@fwi.uva.nl>
> 
>    vm_mmap first creates a map with the unrounded size, and then allocates
>    in that map with the rounded up size, so it always fails.  [...]
> 
> The problem is that the last page of the data is not padded with zero.
> Therefor the start of the bss segment, which follows the data segment,
> is not initialized to zero.
> 
> A fix would be to allow mapping of ranges, where the end in not page
> aligned.  When the last page of such a range is loaded, the first part
> of the page has to be read from file, while the end of the page has to
> be cleared.

It is a definite bug if the VM system leaves garbage in any part
of such a page.  If the page crosses an end-of-file boundary, the
vnode pager should zero out the part of the page not initialized.
Other pagers probably all give you a whole page or nothing.
[Sorry, I don't have time to look right now...]

Gordon