>> It actually does use MAP_SHARED already, but only for reading.As noted above, one thing cyrus does which does seem to be plain "wrong" is that it mmaps a region greater the file size (rounds to an 8k boundary, but 8k-16k past the current end of the file) and then assumes that when it writes to the end of the file (but less than the end of the mmap region) that there's no need to remmap and that data is immediately available within the previous mmaped region. Apparently that works on most OS's (but is what this bug actually exposed), but according to the mmap docs: --- If the size of the mapped file changes after the call to mmap() as a result of some other operation on the mapped file, the effect of references to portions of the mapped region that correspond to added or removed portions of the file is unspecified. --- The way I read that, even if you mmap a file with a size past the end of the file currently, if you subsequently write to the end of that file, you shouldn't assume that written data is available in the region you previously mmaped, which cyrus definitely does do. Amazingly (apart from HP/UX) no OS actually seems to have a problem with this since there would be massive cyrus bug reports otherwise. Rob ---------- robm@fastmail.fm Sign up at http://fastmail.fm for fast, ad free, IMAP accessible email --
| Stephen Smalley | Re: [AppArmor 39/45] AppArmor: Profile loading and manipulation, pathname matching |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Robin Holt | Re: Linux 2.6.26-rc1 |
git: | |
| David Fenyes | sigsetmask()? (LINUX) |
| Theodore Ts'o | Re: SVGA-alphanum. modes |
| Rob Coleman | S3 |
| Ian Kluft | 2nd CFV and VOTE ACK: comp.os.linux reorganization |
