From: H. Peter Anvin Date: Mon, 10 Oct 2005 20:52:27 GMT Subject: Re: First cut at git port to Cygwin Message-ID: <434AD48B.8070305@zytor.com> In-Reply-To: <7vhdbp3yd7.fsf@assigned-by-dhcp.cox.net> Junio C Hamano wrote: > "H. Peter Anvin" 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