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 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: <20090409170228 DOT GA5231 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.19 (2009-02-20) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: 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 Apr 9 17:30, Eric Blake wrote: > Corinna Vinschen 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/