[Bug 47226] New: Incorrect crash information displayed for unimplemented function stubs when 64-bit Wine builtins are cross-compiled in PE format (Mingw-w64, MS x64 calling convention)
wine-bugs at winehq.org
wine-bugs at winehq.org
Sat May 18 09:55:32 CDT 2019
https://bugs.winehq.org/show_bug.cgi?id=47226
Bug ID: 47226
Summary: Incorrect crash information displayed for
unimplemented function stubs when 64-bit Wine builtins
are cross-compiled in PE format (Mingw-w64, MS x64
calling convention)
Product: Wine
Version: 4.8
Hardware: x86-64
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: build-env
Assignee: wine-bugs at winehq.org
Reporter: focht at gmx.net
Distribution: ---
Hello folks,
as it says. Example from bug 47220 which is dupe of bug 43546
https://web.archive.org/web/20190518075044/https://www.easyhdr.com/download/easyHDR_3130_setup-demo.exe
With Wine builtins cross-compiled in PE-format:
--- snip ---
$ pwd
/home/focht/.wine/drive_c/Program Files/easyHDR 3 Demo
$ wine ./easyHDR3.exe
...
wine: Call from 0x7b452f3c to unimplemented function (null).932, aborting
wine: Call from 0x7b452f3c to unimplemented function (null).932, aborting
wine: Call from 0x7b452f3c to unimplemented function (null).932, aborting
wine: Call from 0x7b452f3c to unimplemented function (null).932, aborting
wine: Call from 0x7b452f3c to unimplemented function (null).932, aborting
wine: Call from 0x7b452f3c to unimplemented function (null).932, aborting
wine: Call from 0x7b452f3c to unimplemented function (null).932, aborting
wine: Call from 0x7b452f3c to unimplemented function (null).932, aborting
wine: Unimplemented function (null).932 called at address 0x7b452f3c (thread
006d), starting debugger...
Unhandled exception: unimplemented function .932 called in 64-bit code
(0x000000007b452f3c).
...
Register dump:
rip:000000007b452f3c rsp:000000001bf8faa0 rbp:000000001bf8fb70 eflags:00000206
( - -- I - -P- )
rax:000000001bf8fac0 rbx:0000000080000100 rcx:000000001bf8fac0
rdx:000000001bf8fae0
rsi:000000001bf8fbb0 rdi:000000001bf8faf0 r8:0000000000000002
r9:000000001bf8fba0 r10:0000000000000000
r11:000000001bf8fc98 r12:000000001ba7f874 r13:0000000017ef5680
r14:0000000000000002 r15:0000000000000002
Stack dump:
...
Backtrace:
=>0 0x000000007b452f3c RaiseException+0x6c(code=<is not available>, flags=<is
not available>, nbargs=<is not available>, args=<is not available>)
[/home/focht/projects/wine/mainline-src/dlls/kernel32/except.c:86] in kernel32
(0x000000001bf8fb70)
0x000000007b452f3c RaiseException+0x6c
[/home/focht/projects/wine/mainline-src/dlls/kernel32/except.c:86] in kernel32:
leaq 0xfffffffffffffff0(%rbp),%rsp
86 }
Modules:
Module Address Debug info Name (160 modules)
PE 130000- 13d000 Deferred ilmthread-2_2
PE 250000- 29b000 Deferred qt5winextras
PE 2a0000- 6f7000 Deferred qt5gui
PE 700000- 8f3000 Deferred libglesv2
PE 900000- e51000 Deferred qt5widgets
PE e60000- e7e000 Deferred zlibwapi
PE e80000- ef6000 Deferred lcms2
PE f00000- 11c2000 Deferred ilmimf-2_2
PE 11d0000- 1219000 Deferred half
PE 1220000- 1236000 Deferred iex-2_2
PE 1240000- 1258000 Deferred imath-2_2
PE 1260000- 1389000 Deferred libraw
PE 15f0000- 1721000 Deferred qwindows
PE 1840000- 184d000 Deferred qico
PE 1850000- 1890000 Deferred qjpeg
PE 1890000- 18ec000 Deferred qtiff
PE 61000000- 61034000 Deferred qt5xml
PE 64000000- 640d3000 Deferred qt5network
PE 65100000- 651a7000 Deferred msvcp110
PE 66500000- 66523000 Deferred vcomp110
PE 67000000- 67551000 Deferred qt5core
ELF 7a800000- 7aa10000 Deferred opengl32<elf>
\-PE 7a850000- 7aa10000 \ opengl32
ELF 7b400000- 7b85b000 Dwarf kernel32<elf>
\-PE 7b420000- 7b85b000 \ kernel32
ELF 7bc00000- 7bd54000 Deferred ntdll<elf>
\-PE 7bc20000- 7bd54000 \ ntdll
ELF 7c000000- 7c004000 Deferred <wine-loader>
PE 140000000- 1403ee000 Deferred easyhdr3
PE 180000000- 18004a000 Deferred openjp2
...
ELF 7f86d5ec7000- 7f86d5ef3000 Deferred version<elf>
\-PE 7f86d5ed0000- 7f86d5ef3000 \ version
ELF 7f86d5ef3000- 7f86d6298000 Dwarf libwine.so.1
ELF 7f86d629a000- 7f86d64c3000 Deferred
ld-linux-x86-64.so.2
ELF 7ffc37f2a000- 7ffc37f2b000 Deferred [vdso].so
Threads:
process tid prio (all id:s are in hex)
...
00000058 (D) C:\Program Files\easyHDR 3 Demo\easyHDR3.exe
...
00000070 0 <==
...
--- snip ---
--- snip ---
PE 66500000- 66523000 Deferred vcomp110
--- snip ---
Same thing without builtins cross-compiled to PE:
--- snip ---
$ pwd
/home/focht/.wine/drive_c/Program Files/easyHDR 3 Demo
$ wine ./easyHDR3.exe
...
wine: Call from 0x7b452d3c to unimplemented function
vcomp110.dll._vcomp_for_static_simple_init_i8, aborting
wine: Call from 0x7b452d3c to unimplemented function
vcomp110.dll._vcomp_for_static_simple_init_i8, aborting
wine: Call from 0x7b452d3c to unimplemented function
vcomp110.dll._vcomp_for_static_simple_init_i8, aborting
wine: Unimplemented function vcomp110.dll._vcomp_for_static_simple_init_i8
called at address 0x7b452d3c (thread 0076), starting debugger...
wine: Call from 0x7b452d3c to unimplemented function
vcomp110.dll._vcomp_for_static_simple_init_i8, aborting
wine: Call from 0x7b452d3c to unimplemented function
vcomp110.dll._vcomp_for_static_simple_init_i8, aborting
wine: Call from 0x7b452d3c to unimplemented function
vcomp110.dll._vcomp_for_static_simple_init_i8, aborting
wine: Call from 0x7b452d3c to unimplemented function
vcomp110.dll._vcomp_for_static_simple_init_i8, aborting
wine: Call from 0x7b452d3c to unimplemented function
vcomp110.dll._vcomp_for_static_simple_init_i8, aborting
Unhandled exception: unimplemented function
vcomp110.dll._vcomp_for_static_simple_init_i8 called in 64-bit code
(0x000000007b452d3c).
Register dump:
rip:000000007b452d3c rsp:000000002136faa0 rbp:000000002136fb70 eflags:00000206
( - -- I - -P- )
rax:000000002136fac0 rbx:0000000080000100 rcx:000000002136fac0
rdx:000000002136fae0
rsi:000000002136fbb0 rdi:000000002136faf0 r8:0000000000000002
r9:000000002136fba0 r10:0000000000000000
r11:000000002136fc98 r12:0000000020a1f874 r13:000000001cdf9630
r14:0000000000000002 r15:0000000000000002
Stack dump:
...
Backtrace:
=>0 0x000000007b452d3c RaiseException+0x6c(code=<is not available>, flags=<is
not available>, nbargs=<is not available>, args=<is not available>)
[/home/focht/projects/wine/mainline-src/dlls/kernel32/except.c:86] in kernel32
(0x000000002136fb70)
1 0x00007f1600587499 __wine_spec_unimplemented_stub+0x38(module=<is not
available>, function=<is not available>)
[/home/focht/projects/wine/mainline-src/dlls/winecrt0/stub.c:34] in vcomp110
(0x000000002136fba0)
2 0x00007f16005871e7 __wine_stub__vcomp_for_static_simple_init_i8+0x16() in
vcomp110 (0x000000002136fcf0)
3 0x0000000140181145 in easyhdr3 (+0x181144) (0x000000002136fcf0)
4 0x00007f15f09b7b34 _vcomp_fork_call_wrapper+0x43() in vcomp
(0x000000002136fcf0)
5 0x00007f15f09b861d _vcomp_fork_worker+0xcc(param=0x1cdf9600)
[/home/focht/projects/wine/mainline-src/dlls/vcomp/main.c:1422] in vcomp
(0x000000002136fdf0)
6 0x000000007bca7018 call_thread_func+0xe7(entry=0x7f15f09b8550,
arg=0x1cdf9600)
[/home/focht/projects/wine/mainline-src/dlls/ntdll/signal_x86_64.c:4454] in
ntdll (0x000000002136ffd0)
0x000000007b452d3c RaiseException+0x6c
[/home/focht/projects/wine/mainline-src/dlls/kernel32/except.c:86] in kernel32:
leaq 0xfffffffffffffff0(%rbp),%rsp
86 }
Modules:
Module Address Debug info Name (160 modules)
PE 240000- 28b000 Deferred qt5winextras
PE 290000- 6e7000 Deferred qt5gui
PE 6f0000- 8e3000 Deferred libglesv2
PE 8f0000- 90e000 Deferred zlibwapi
PE 910000- 986000 Deferred lcms2
PE 990000- c52000 Deferred ilmimf-2_2
PE c60000- ca9000 Deferred half
PE cb0000- cc6000 Deferred iex-2_2
PE cd0000- ce8000 Deferred imath-2_2
PE cf0000- cfd000 Deferred ilmthread-2_2
PE d00000- e29000 Deferred libraw
PE f80000- 10b1000 Deferred qwindows
PE 11d0000- 11dd000 Deferred qico
PE 11e0000- 1220000 Deferred qjpeg
PE 1220000- 127c000 Deferred qtiff
PE 61000000- 61034000 Deferred qt5xml
PE 64000000- 640d3000 Deferred qt5network
PE 65000000- 65551000 Deferred qt5widgets
PE 67000000- 67551000 Deferred qt5core
ELF 7a800000- 7aa10000 Deferred opengl32<elf>
\-PE 7a850000- 7aa10000 \ opengl32
ELF 7b400000- 7b85b000 Dwarf kernel32<elf>
\-PE 7b420000- 7b85b000 \ kernel32
ELF 7bc00000- 7bd51000 Dwarf ntdll<elf>
\-PE 7bc20000- 7bd51000 \ ntdll
ELF 7c000000- 7c004000 Deferred <wine-loader>
PE 140000000- 1403ee000 Export easyhdr3
PE 180000000- 18004a000 Deferred openjp2
...
ELF 7f15f21e1000- 7f15f2305000 Deferred msvcr110<elf>
\-PE 7f15f2200000- 7f15f2305000 \ msvcr110
...
ELF 7f1600575000- 7f160058b000 Dwarf vcomp110<elf>
\-PE 7f1600580000- 7f160058b000 \ vcomp110
ELF 7f160058b000- 7f16005b7000 Deferred version<elf>
\-PE 7f1600590000- 7f16005b7000 \ version
ELF 7f16005b7000- 7f160095c000 Dwarf libwine.so.1
ELF 7f160095e000- 7f1600b87000 Deferred
ld-linux-x86-64.so.2
ELF 7ffcb794a000- 7ffcb794b000 Deferred [vdso].so
Threads:
process tid prio (all id:s are in hex)
...
0000005c (D) C:\Program Files\easyHDR 3 Demo\easyHDR3.exe
0000007d 0 <==
...
Host version: 5.0.13-100.fc28.x86_64
--- snip ---
--- snip ---
ELF 7f1600575000- 7f160058b000 Dwarf vcomp110<elf>
\-PE 7f1600580000- 7f160058b000 \ vcomp110
--- snip ---
Generated code for '__wine_stub__vcomp_for_static_simple_init_i8':
--- snip ---
00000000665014C0 sub rsp, 8
00000000665014C4 lea rdi, module ; "vcomp110.dll"
00000000665014CB lea rsi, a_vcomp_for_s_0 ;
"_vcomp_for_static_simple_init_i8"
00000000665014D2 call __wine_spec_unimplemented_stub
00000000665014D7 nop
--- snip ---
Wine source for reference:
https://source.winehq.org/git/wine.git/blob/HEAD:/tools/winebuild/import.c#l1184
--- snip ---
1184 /*******************************************************************
1185 * output_stubs
1186 *
1187 * Output the functions for stub entry points
1188 */
1189 void output_stubs( DLLSPEC *spec )
1190 {
1191 const char *name, *exp_name;
1192 int i;
1193
1194 if (!has_stubs( spec )) return;
1195
1196 output( "\n/* stub functions */\n\n" );
1197 output( "\t.text\n" );
1198
1199 for (i = 0; i < spec->nb_entry_points; i++)
1200 {
1201 ORDDEF *odp = &spec->entry_points[i];
1202 if (odp->type != TYPE_STUB) continue;
1203
1204 name = get_stub_name( odp, spec );
1205 exp_name = odp->name ? odp->name : odp->export_name;
1206 output( "\t.align %d\n", get_alignment(4) );
1207 output( "\t%s\n", func_declaration(name) );
1208 output( "%s:\n", asm_name(name) );
1209 output_cfi( ".cfi_startproc" );
1210
1211 switch (target_cpu)
1212 {
...
1252 case CPU_x86_64:
1253 output( "\tsubq $8,%%rsp\n" );
1254 output_cfi( ".cfi_adjust_cfa_offset 8" );
1255 output( "\tleaq .L__wine_spec_file_name(%%rip),%%rdi\n" );
1256 if (exp_name)
1257 output( "leaq .L%s_string(%%rip),%%rsi\n", name );
1258 else
1259 output( "\tmovq $%d,%%rsi\n", odp->ordinal );
1260 output( "\tcall %s\n",
asm_name("__wine_spec_unimplemented_stub") );
1261 break;
...
--- snip ---
Generated code for '__wine_spec_unimplemented_stub' (cross-compiled with
MinGW):
--- snip ---
0000000066501580 args = qword ptr -28h
0000000066501580
0000000066501580 module = rcx ; const char *
0000000066501580 function = rdx ; const char *
0000000066501580 push rsi
0000000066501581 push rbx
0000000066501582 sub rsp, 38h
0000000066501586 mov ebx, 80000100h
000000006650158B lea rsi, [rsp+48h+args] ; dwExceptionFlags
0000000066501590 mov [rsp+48h+args], module
0000000066501595 mov [rsp+48h+args+8], function
000000006650159A nop word ptr [rax+rax+00h]
00000000665015A0 mov r9, rsi
00000000665015A3 mov r8d, 2
00000000665015A9 mov edx, 1 ; nNumberOfArguments
00000000665015AE mov ecx, ebx ; lpArguments
00000000665015B0 call RaiseException
00000000665015B5 jmp short loc_665015A0
--- snip ---
Wine source for reference:
https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/winecrt0/stub.c#l26
--- snip ---
26 void DECLSPEC_HIDDEN __wine_spec_unimplemented_stub( const char *module,
const char *function )
27 {
28 ULONG_PTR args[2];
29
30 args[0] = (ULONG_PTR)module;
31 args[1] = (ULONG_PTR)function;
32 for (;;) RaiseException( EXCEPTION_WINE_STUB,
EXCEPTION_NONCONTINUABLE, 2, args );
33 }
--- snip ---
MinGW assumes the caller passed the two arguments via RCX and RDX (MS x64 ABI).
Although unnecessary, debugger session for completeness:
--- snip ---
Wine-gdb> bt
#0 0x0000000066501580 in ?? () ; __wine_spec_unimplemented_stub
#1 0x00000000665014d7 in ?? () ; __wine_stub__vcomp_for_static_simple_init_i8
#2 0x0000000000000000 in ?? ()
Wine-gdb> x/10i $pc
=> 0x66501580: push %rsi
0x66501581: push %rbx
0x66501582: sub $0x38,%rsp
0x66501586: mov $0x80000100,%ebx
0x6650158b: lea 0x20(%rsp),%rsi
0x66501590: mov %rcx,0x20(%rsp) ; args[0]
0x66501595: mov %rdx,0x28(%rsp) ; args[1]
0x6650159a: nopw 0x0(%rax,%rax,1)
0x665015a0: mov %rsi,%r9
0x665015a3: mov $0x2,%r8d
Wine-gdb> info reg
rax 0x2108f560 554235232
rbx 0x2108f898 554236056
rcx 0x0 0
rdx 0x3a4 932
rsi 0x665040a4 1716535460
rdi 0x66504000 1716535296
rbp 0x2108f620 0x2108f620
rsp 0x2108f4f8 0x2108f4f8
r8 0x2 2
r9 0x1 1
r10 0x0 0
r11 0x2108f5c8 554235336
r12 0x2108f874 554236020
r13 0x1100c0 1114304
r14 0x2 2
r15 0x2 2
rip 0x66501580 0x66501580
eflags 0x206 [ PF IF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
--- snip ---
Mingw-w64 specs:
--- snip ---
$ (mingw64-env && $CC -v)
Using built-in specs.
COLLECT_GCC=/usr/bin/x86_64-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-w64-mingw32/7.3.0/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../configure --prefix=/usr --bindir=/usr/bin
--includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info
--datadir=/usr/share --build=x86_64-redhat-linux-gnu
--host=x86_64-redhat-linux-gnu --with-gnu-as --with-gnu-ld --verbose
--without-newlib --disable-multilib --disable-plugin --with-system-zlib
--disable-nls --without-included-gettext --disable-win32-registry
--enable-languages=c,c++,objc,obj-c++,fortran
--with-bugurl=http://bugzilla.redhat.com/bugzilla --with-cloog
--enable-threads=posix --enable-libgomp --target=x86_64-w64-mingw32
--with-sysroot=/usr/x86_64-w64-mingw32/sys-root
--with-gxx-include-dir=/usr/x86_64-w64-mingw32/sys-root/mingw/include/c++
Thread model: posix
gcc version 7.3.0 20180125 (Fedora MinGW 7.3.0-1.fc28) (GCC)
--- snip ---
$ sha1sum easyHDR_3130_setup-demo.exe
2002238e64859a290abdd523cb0755262ffa8e4e easyHDR_3130_setup-demo.exe
$ du -sh easyHDR_3130_setup-demo.exe
34M easyHDR_3130_setup-demo.exe
$ wine --version
wine-4.8-202-g61aea5a987
Regards
--
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.
More information about the wine-bugs
mailing list