Crash in g_file_monitor on 32-bit Cygwin

Yaakov Selkowitz yselkowitz@cygwin.com
Wed Oct 15 16:46:00 GMT 2014


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



More information about the Cygwin mailing list