delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/03/03/15:28:35

X-Spam-Check-By: sourceware.org
Date: Fri, 3 Mar 2006 21:28:19 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
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
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
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019