delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/04/09/13:52:07

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Thu, 9 Apr 2009 19:51:40 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: [1.7] deleting in-use directories
Message-ID: <20090409175140.GK15443@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <loom DOT 20090409T154314-64 AT post DOT gmane DOT org> <20090409170228 DOT GA5231 AT calimero DOT vinschen DOT de> <loom DOT 20090409T172506-614 AT post DOT gmane DOT org>
MIME-Version: 1.0
In-Reply-To: <loom.20090409T172506-614@post.gmane.org>
User-Agent: Mutt/1.5.19 (2009-02-20)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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 Apr  9 17:30, Eric Blake wrote:
> Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes:
> 
> > Incredible but true.  It was an alignment problem with a local buffer
> > in the function which moves the directory to the bin when a sharing
> > violation occurs.
> 
> > BYTE infobuf[sizeof (FILE_NAME_INFORMATION) + 32767 * sizeof (WCHAR)]
> 
> That's an awfully big buffer to be stack-allocating.  It's bigger than a system 
> page, which means if you are nearing stack overflow, then call rmdir(), your 
> application could suffer from silent termination rather than orderly SIGSEGV 
> stack overflow when it accesses beyond the guard page.

Yes, I know.  I didn't use the TLS temporary path buffer because the
returned size is potentially a bit bigger than 64K (by the above sizeof
(FILE_NAME_INFORMATION)), which is the max.  buffer size for these temp
buffers.  I was already wondering when I fixed the alignment problem
if we should just ignore this potential problem.

Erm...

Actually the max size is 64K + 4 bytes.  Given that PATH_MAX is 4096,
maybe a temporary TLS buffer of 64K is sensible enough.

Hang on, I'll fix that in a minute.


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