X-Spam-Check-By: sourceware.org Date: Fri, 3 Mar 2006 21:28:19 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: ls.exe hangs on inaccessible directory if ntsec is turned off Message-ID: <20060303202819.GD3184@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <1FFDId-1bRebI0 AT fwd35 DOT aul DOT t-online DOT de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1FFDId-1bRebI0@fwd35.aul.t-online.de> User-Agent: Mutt/1.4.2i Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: 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 Mar 3 17:38, Christian Franke wrote: > Hi, > > with the current cygwin1.dll 20050203, ls.exe hangs on access of an > inaccessible directory if ntsec is turned off. > > Steps to reproduce on XP Prof: > > $ CYGWIN=ntsec ls "/cygdrive/c/System Volume Information" > ls: /cygdrive/c/System Volume Information: Permission denied > # OK > > $ CYGWIN=nontsec ls "/cygdrive/c/System Volume Information" > ls: /cygdrive/c/System Volume Information: Permission denied > # *** ls hangs with 100% CPU *** > > Bug is present since cygwin1.dll 20050128, 20050127 was OK. Boy, that was a tricky one. Your "nontsec" lead me to an entirely wrong track first. The problem was this: At one point in opendir() a file handler is added to the descriptor table. This happened at a point at which it was already clear that opendir would succeed. Due to my changes from end of January this wasn't true anymore. The entry in the descriptor table was filled and *then* opendir tries to open the directory with NtOpenFile. This in turn leads to opendir deleting the file handler structure. No problem... until the process exits and Cygwin tries to delete the file handler entry again in the cleanup code. Or, with a lot less words: Cygwin called free twice on the same address. The reason that this only happens with nontsec is the fact that with ntsec a directory access check is made before doing anything serious. Therefore opendir fails much earlier with ntsec on. I've applied a fix. Please test. Thanks for the report, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/