mmap bug?

Giorgos Keramidas keramida at freebsd.org
Sun Jul 31 20:19:05 GMT 2005


On 2005-07-31 23:45, Joseph Koshy <joseph.koshy at gmail.com> wrote:
> gk> That's something I didn't test.  No, the 'extra' data
> gk> disappears.
>
> So the 'extra' data isn't reaching the FS and is probably
> being served up from a cached VM data the second time your
> test program ran.
>
> This is still a bug though: the mmap(2) manual page
> says:
>     ...
>     If len is not a multiple of
>     the page-size, the mapped region may extend past the
>     specified range.  Any such extension beyond the end of the
>     mapped object will be zero-filled.
>     ...
>
> We are clearly not doing the zero-filling.

The mapping is allocated as MAP_SHARED, so when I unmap() it from a
process that has attached to the specific object/file/whatever that is,
it shouldn't be zeroed.

The bug seems to be elsewhere, namely to the fact that the filesystem
code never realizes the file has changed size after I use mmap() to map
a region beyond its current size and write past its current end.


More information about the freebsd-current mailing list