X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	 q=dns; s=default; b=AdpVMA4XEP721/mQMC/StA8nNvtOQNt0QuR9vDFuyZj
	JwqsJYyVFPQ3XGV7bT11zUBVlnsYOTG6B+tmOfc46oHwdw67G0D3sGcuQXcxVkmq
	64BoVG31xvAk60Ib8vUefQbYsxtjEPWdcXNwRqRrxb3pMxMTDkv5u91plrdgUp2o
	=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	 s=default; bh=g1FQpysn/YZKSAkwA5myQrJfTXo=; b=hEIDegh6b/nxcgdWh
	sqZwcrDUYiP775VnV9HjZ0ed9km4SJ/3coW2C7tVuxf+ZTTcRtOZ6cxgXFmOt4zO
	da3taB9BPPf8Jm1DwPaCUx+0uo9WXZMGdpA/ivsUZzNrdz63clM7NFttZw/iG+5M
	Mokjl/o0cqmWxXeH8kYieh/3Ww=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2
X-HELO: mx1.redhat.com
Message-ID: <543EA4CD.4090305@cygwin.com>
Date: Wed, 15 Oct 2014 11:46:05 -0500
From: Yaakov Selkowitz <yselkowitz@cygwin.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: Crash in g_file_monitor on 32-bit Cygwin
References: <53AB82AB.5000304@cornell.edu> <53ADA5B5.10404@cornell.edu> <53ADAF68.2020703@cygwin.com> <53AEA23A.8030306@cornell.edu> <543D4ED3.6020605@cornell.edu> <543D6BB9.3030009@cornell.edu>
In-Reply-To: <543D6BB9.3030009@cornell.edu>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

On 2014-10-14 13:30, Ken Brown wrote:
> I stepped into gam_check_not_fat (which I should have done to begin
> with) and narrowed this down further.  The stack location in question
> gets clobbered by the call to GetVolumeInformation:
[snip]
> Here's the code near the call to GetVolumeInformation, followed by what
> I think is the relevant disassembly:
>
>    if (!GetVolumeInformation (root, volname, MAX_PATH, NULL,
>                               NULL, NULL, fsname, MAX_PATH))
>      {
>        fprintf (stderr, "GetVolumeInformation: %d\n", GetLastError ());
>        return 0;
>      }
>
>     0x00405b3a <+840>:    movl   $0x104,0x1c(%esp) <<<<<<<<<<<<<<<<
>     0x00405b42 <+848>:    lea    -0x120(%ebp),%eax
>     0x00405b48 <+854>:    mov    %eax,0x18(%esp)
>     0x00405b4c <+858>:    movl   $0x0,0x14(%esp)
>     0x00405b54 <+866>:    movl   $0x0,0x10(%esp)
>     0x00405b5c <+874>:    movl   $0x0,0xc(%esp)
>     0x00405b64 <+882>:    movl   $0x104,0x8(%esp)  <<<<<<<<<<<<<<<<
>     0x00405b6c <+890>:    lea    -0x224(%ebp),%eax
>     0x00405b72 <+896>:    mov    %eax,0x4(%esp)
>     0x00405b76 <+900>:    lea    -0x328(%ebp),%eax
>     0x00405b7c <+906>:    mov    %eax,(%esp)
>     0x00405b7f <+909>:    call   *0x41248c    <----- GetVolumeInformation?
>     0x00405b85 <+915>:    sub    $0x20,%esp
>     0x00405b88 <+918>:    test   %eax,%eax
>     0x00405b8a <+920>:    jne    0x405bb5 <gam_server_create+963>
>     0x00405b8c <+922>:    call   *0x412480    <----- GetLastError?
>     0x00405b92 <+928>:    mov    %eax,%esi
>     0x00405b94 <+930>:    call   0x408df0 <__getreent>
>     0x00405b99 <+935>:    mov    %esi,0x8(%esp)
>     0x00405b9d <+939>:    movl   $0x40c70f,0x4(%esp)
>     0x00405ba5 <+947>:    mov    0xc(%eax),%eax
>     0x00405ba8 <+950>:    mov    %eax,(%esp)
>     0x00405bab <+953>:    call   0x408df8 <fprintf>
>     0x00405bb0 <+958>:    jmp    0x406073 <gam_server_create+2177>
>
> Note the two marked movl instructions involving 0x104; I guess one of
> these is the culprit, but I don't really know what's going on.

While it should be purely academic now, the issue might have been a 
failure to mark pGVPN as WINAPI (IOW __stdcall on x86):

-  BOOL (*pGVPN)(LPCTSTR, LPTSTR, DWORD);
+  BOOL (WINAPI *pGVPN)(LPCTSTR, LPTSTR, DWORD);

Something must have changed in gcc's optimization that this triggered; 
it certainly wasn't an issue when the code was first introduced.

Thanks for tracking this down; gamin-0.1.10-15 uses more modern features 
to test for FAT that weren't available back in 2006.


Yaakov


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

