X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Thu, 9 Apr 2009 19:51:40 +0200
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: [1.7] deleting in-use directories
Message-ID: <20090409175140.GK15443@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <loom.20090409T154314-64@post.gmane.org> <20090409170228.GA5231@calimero.vinschen.de> <loom.20090409T172506-614@post.gmane.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <loom.20090409T172506-614@post.gmane.org>
User-Agent: Mutt/1.5.19 (2009-02-20)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.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/

