Re: First cut at git port to Cygwin
- From
- H. Peter Anvin <hpa@zytor.com>
- Date
- Oct 10, 2005, 20:52 UTC
- Message-ID
- <434AD48B.8070305@zytor.com>
- In-Reply-To
- <7vhdbp3yd7.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
Show 22 quoted lines
> "H. Peter Anvin" <hpa@zytor.com> writes: > > >>>>Junio C Hamano wrote: >>>> >>>> >>>>>PROT_WRITE is true, but we do MAP_PRIVATE, and if I recall >>>>>correctly we do not write file via mmap -- at least we do not >>>>>intend to. >>>>> >> >>In the above sentence, emphasis on "at least we do not intend to." If >>writes are done legitimately then that's fine, but we shouldn't have >>"accidental writes" -- those would be program bugs! > > > What I meant to say was "we do not intend to write back the > changes by expecting the modification on mapped area are written > back by mmap() mechanism -- the updates to index file is done by > creat - write - close - rename". So your saying "the overkill > being actively wrong" was technically correct, but that wrongly > written data was renamed out anyway and no real harm was done.
Well, it broke the atomicity of an operation, which *is* a real problem.
Anyway, malloc+read is a dead ringer for MAP_PRIVATE with PROT_WRITE, so that makes it even easier to mimic.
-hpa