Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#412 mingw-w64 incompatible with MS AppVerifier

v1.0 (example)
open
nobody
None
5
2015-02-14
2014-07-06
morous
No

I tried to use Microsoft's AppVerifier to validate usage of Win32API in my projects. However it seems binaries built with mingw-w64 are incompatible with it, as any program built with it crashes during process exit.

The verifier is available here:
http://www.microsoft.com/en-us/download/details.aspx?id=20028

My environment:
-- Windows 8.1 64-bit
-- gcc.exe (i686-win32-sjlj-rev2, Built by MinGW-W64 project) 4.9.0
(reproduced both when targeting 32-bit as well as 64-bit)

To reproduce:

(1) Build any program:

$ echo 'int main(int argc, char** argv) { return 0; }' > a.c
$ gcc -g -O0 -Wall a.c

(2) Setup App Verifier, keep default (i.e. some basic tests):
-- Add the app. (menu "File -> Add application").
-- Confirm with the button "Save" (right bottom corner).

(3) Run the app in debugger:

$ gdb a.exe
GNU gdb (GDB) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.exe...done.
(gdb) r
Starting program: d:\prj\a.exe
[New Thread 4612.0xd54]
warning: Page heap: pid 0x1204: page heap enabled with flags 0x3.
warning: AVRF: a.exe: pid 0x1204: flags 0x80643027: application verifier enabled
warning: Page heap: pid 0x1204: page heap enabled with flags 0x3.
warning: AVRF: a.exe: pid 0x1204: flags 0x80643027: application verifier enabled

Program received signal SIGSEGV, Segmentation fault.
0x77257db5 in ntdll!RtlWalkFrameChain () from C:\Windows\SYSTEM32\ntdll.dll
(gdb) bt
#0  0x77257db5 in ntdll!RtlWalkFrameChain () from C:\Windows\SYSTEM32\ntdll.dll
#1  0x77257d57 in ntdll!RtlCaptureStackBackTrace () from C:\Windows\SYSTEM32\ntdll.dll
#2  0x6a4ce877 in ?? () from C:\Windows\SysWOW64\vfbasics.dll
#3  0x6a4d3edc in ?? () from C:\Windows\SysWOW64\vfbasics.dll
#4  0x756d7f77 in KERNEL32!ExitProcess () from C:\Windows\SysWOW64\kernel32.dll
#5  0x6a4d3ee1 in ?? () from C:\Windows\SysWOW64\vfbasics.dll
#6  0x756d7f77 in KERNEL32!ExitProcess () from C:\Windows\SysWOW64\kernel32.dll
#7  0x6a4d3ee1 in ?? () from C:\Windows\SysWOW64\vfbasics.dll
#8  0x756d7f77 in KERNEL32!ExitProcess () from C:\Windows\SysWOW64\kernel32.dll
#9  0x6a4d3ee1 in ?? () from C:\Windows\SysWOW64\vfbasics.dll
#10 0x756d7f77 in KERNEL32!ExitProcess () from C:\Windows\SysWOW64\kernel32.dll
#11 0x6a4d3ee1 in ?? () from C:\Windows\SysWOW64\vfbasics.dll
#12 0x756d7f77 in KERNEL32!ExitProcess () from C:\Windows\SysWOW64\kernel32.dll
#13 0x6a4d3ee1 in ?? () from C:\Windows\SysWOW64\vfbasics.dll
#14 0x756d7f77 in KERNEL32!ExitProcess () from C:\Windows\SysWOW64\kernel32.dll
#15 0x6a4d3ee1 in ?? () from C:\Windows\SysWOW64\vfbasics.dll
...
#115791 0x6a4d3ee1 in ?? () from C:\Windows\SysWOW64\vfbasics.dll
#115792 0x756d7f77 in KERNEL32!ExitProcess () from C:\Windows\SysWOW64\kernel32.dll
#115793 0x6a4d3ee1 in ?? () from C:\Windows\SysWOW64\vfbasics.dll
#115794 0x756d7f77 in KERNEL32!ExitProcess () from C:\Windows\SysWOW64\kernel32.dll
#115795 0x6a4d3ee1 in ?? () from C:\Windows\SysWOW64\vfbasics.dll
#115796 0x756d7f77 in KERNEL32!ExitProcess () from C:\Windows\SysWOW64\kernel32.dll
#115797 0x6a4d3ee1 in ?? () from C:\Windows\SysWOW64\vfbasics.dll
#115798 0x75405736 in msvcrt!exit () from C:\Windows\SysWOW64\msvcrt.dll
#115799 0x75405472 in msvcrt!_flushall () from C:\Windows\SysWOW64\msvcrt.dll
#115800 0x00000000 in ?? ()

I.e. it seems there is an endless recursion in some CRT clean-up or something when the verifier is enabled for the given app.

Discussion