Hi! > > Strictly speaking this is not a bug at least when sticking to regular > > files as POSIX which says that the change is not written out. In this > > case the file content is correct and forcing the data to be written out > > by msync() makes the test pass. The SHM mappings seems to preserve the > > content even after calling msync() which is, in my opinion, POSIX > > violation although a minor one. > > > > fsync implemented in SHM is noop_fsync. > May be we should extend it if needed. I'm entirely sure that would fix the interface correclty. The posix says: mmap: ... The system shall always zero-fill any partial page at the end of an object. Further, the system shall never write out any modified portions of the last page of an object which are beyond its end. ... msync: ... The effect of msync() on a shared memory object or a typed memory object is unspecified. ... Hmm, that is a little confusing and it looks like it depends on interpretation what 'write out' for SHM object means. And I guess that leaving the SHM part as it is is reasonable. Maybe worth of a note in manual page. On the other hand there seems to be several bugs in mmap() on regular files. For example mapping half of the page from a file doesn't fill the rest of the page with zeroes. And it looks like when half of page is mapped, the second half modified, then unmapped and then the whole page is mapped the content doesn't seem to be right, although this seems to change randomly. The reproducer for the first case attached. -- Cyril Hrubis chrubis@suse.cz