X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org X-USANET-Received: from gateout02.mbox.net [127.0.0.1] by gateout02.mbox.net via mtad (C8.MAIN.3.65C) with ESMTP id 021oimuuB5024Mo2; Mon, 13 Sep 2010 20:20:02 -0000 X-USANET-Source: 165.212.120.254 IN aeolus AT electric-cloud DOT com s1hub4.EXCHPROD.USA.NET X-USANET-MsgId: XID079oimuuc2310Xo2 From: John Carey To: "cygwin AT cygwin DOT com" Date: Mon, 13 Sep 2010 20:16:29 +0000 Subject: RE: 1.7.5: Occasional failure of CreatePipe or signal handing due to thread-unsafe code in cwdstuff::set Message-ID: <3C031C390CBF1E4A8CE1F74DE7ECAF3A15945FDD7A@MBX8.EXCHPROD.USA.NET> References: <3C031C390CBF1E4A8CE1F74DE7ECAF3A140684F0AA AT MBX8 DOT EXCHPROD DOT USA DOT NET> <20100811084926 DOT GC26152 AT calimero DOT vinschen DOT de> <3C031C390CBF1E4A8CE1F74DE7ECAF3A140684F0B0 AT MBX8 DOT EXCHPROD DOT USA DOT NET> <20100812081151 DOT GT14202 AT calimero DOT vinschen DOT de> <3C031C390CBF1E4A8CE1F74DE7ECAF3A158EDA702A AT MBX8 DOT EXCHPROD DOT USA DOT NET> <20100903073740 DOT GA1749 AT calimero DOT vinschen DOT de> <3C031C390CBF1E4A8CE1F74DE7ECAF3A158EDA702D AT MBX8 DOT EXCHPROD DOT USA DOT NET> <20100904092626 DOT GE16534 AT calimero DOT vinschen DOT de> <3C031C390CBF1E4A8CE1F74DE7ECAF3A158EDA704C AT MBX8 DOT EXCHPROD DOT USA DOT NET>,<20100911103010 DOT GM16534 AT calimero DOT vinschen DOT de>,<3C031C390CBF1E4A8CE1F74DE7ECAF3A15945FDD78 AT MBX8 DOT EXCHPROD DOT USA DOT NET> In-Reply-To: <3C031C390CBF1E4A8CE1F74DE7ECAF3A15945FDD78@MBX8.EXCHPROD.USA.NET> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Sep 13 12:47, John Carey wrote: > On Sep 11 03:30, Corinna Vinschen: > > Can't we find Cwd by scanning the .data segment of ntdll.h for the > > address we inferred from the Params.CurrentDirectoryName.Buffer value? >=20 > Nice; that might work. But there would need to be some kind of rule > to pick a winner among multiple matching words, in case by coincidence > some other non-pointer word just happens to have the same bit pattern. > I can see two alternatives for the multiple-match case: >=20 > 1. Code scanning, as suggested earlier. There would need to be a > unit test of the code scanner itself so that incompatible changes to > ntdll.dll could be detected deterministically, instead of only after > a multiple-match coincidence. >=20 > 2. Call SetCurrentDirectory() and recheck the previously-matching > addresses to see which one matches the new value. Place some limit > (like 4) on the number of such retries, in case some new version of > ntdll.dll intentionally duplicates the pointer every time. > (Not sure what to do in that case; fall back to code scanning?) Sorry, I just realized that while Cygwin might do all this to find &Cwd, it will not work for &CwdCS. There must be plenty of critical sections floating around. Still, reducing the number of addresses that must be discovered by code scanning might still help future-proof things. -- John -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple