Re: mmap bug?

From: Garrett Wollman <wollman_at_csail.mit.edu>
Date: Sun, 31 Jul 2005 21:32:12 -0400
<<On Mon, 1 Aug 2005 01:46:01 +0300, Giorgos Keramidas <keramida_at_freebsd.org> said:

> Is the fact that the data written to the mapped region visible after the
> close (by mapping the same region) expected too?

No, that's a bug.  (It's not a particularly surprising one, although
I'm no VM expert and I have no idea how difficult it would be to fix.)
The problem is that the VM system has no efficient way of telling that
you modified the part of the page that's after the end of the file, so
when you close the file, the dirty but only partially valid page is
cached.  Because you did a MAP_SHARED, mmap() can't use an anonymous
page -- it has to use the actual page from the file.  If the page
isn't in cache, it will correctly zero-fill the parts beyond the end
of the file, but it doesn't appear to do this for cached pages on
0->1 refcount transitions.

-GAWollman
Received on Sun Jul 31 2005 - 23:32:14 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:40 UTC