This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ls.exe hangs on inaccessible directory if ntsec is turned off

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 Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]