https://bugs.winehq.org/show_bug.cgi?id=50622
Bug ID: 50622 Summary: wldap32 calls Linux libraries with wrong conventions Product: Wine Version: 6.0-rc6 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wldap32 Assignee: wine-bugs@winehq.org Reporter: gmascellani@codeweavers.com Distribution: ---
The code generated by dlls/wldap32/ber.c calls liblber with wrong calling conventions. For example, looking at the object disassembly I see stuff like:
1d5bf: 48 8d 54 24 26 lea 0x26(%rsp),%rdx 1d5c4: 48 89 d9 mov %rbx,%rcx 1d5c7: e8 e4 9c ff ff callq 172b0 ber_printf@plt
Clearly it is trying to call the Linux ber_printf with Microsoft calling conventions (while liblber expects SYSV calling conventions, using RDI, RSI and such). This causes adsldp tests to fail on my computer, in a 64-only Wine build:
../../../../libraries/liblber/encode.c:513: ber_printf: asserzione "LBER_VALID( ber )" non riuscita. wine: Assertion failed at address 00007FAF632F8CE1 (thread 0024), starting debugger... 185335.931000:00f8:00fc:trace:gio:dlls/ntdll/unix/loader.c:1463:dump_argv Starting command winedbg --auto 32 132 Unhandled exception: assertion failed in 64-bit code (0x00007faf632f8ce1). Register dump: rip:00007faf632f8ce1 rsp:000000000031f630 rbp:00007faf605dd5e1 eflags:00000246 ( - -- I Z- -P- ) rax:0000000000000000 rbx:00007faf632ba740 rcx:00007faf632f8ce1 rdx:0000000000000000 rsi:000000000031f630 rdi:0000000000000002 r8:0000000000000000 r9:000000000031f630 r10:0000000000000008 r11:0000000000000246 r12:00007faf609614f8 r13:0000000000000201 r14:00007faf60961033 r15:000000007d9dc330 Stack dump: 0x000000000031f630: 0000000000000000 00007faf6333a6c6 0x000000000031f640: 01000000fbad8000 000000007dad2f10 0x000000000031f650: 000000007dad2f75 000000007dad2f10 0x000000000031f660: 000000007dad2f10 000000007dad2f75 0x000000000031f670: 000000007dad303c 000000007dad2f10 0x000000000031f680: 000000007dad303c 0000000000000000 0x000000000031f690: 0000000000000000 0000000000000000 0x000000000031f6a0: 0000000000000000 0000000000000000 0x000000000031f6b0: fffffffe7fffffff ffffffffffffffff 0x000000000031f6c0: ffffffffffffffff ffffffffffffffff 0x000000000031f6d0: ffffffffffffffff ffffffffffffffff 0x000000000031f6e0: ffffffffffffffff ffffffffffffffff Backtrace: =>0 0x00007faf632f8ce1 execlp+0xffffffffffffffff() in libc.so.6 (0x00007faf605dd5e1) 1 0x00007faf632e2537 execlp+0xffffffffffffffff() in libc.so.6 (0x00007faf605dd5e1) 2 0x00007faf632e240f execlp+0xffffffffffffffff() in libc.so.6 (0x00007faf605dd5e1) 3 0x00007faf632f1662 execlp+0xffffffffffffffff() in libc.so.6 (0x00007faf60961033) 4 0x00007faf6095c60a ber_write+0xffffffffffffffff() in liblber-2.4.so.2 (0x00007faf60a5e75e) 5 0x00007faf60a356f6 WLDAP32_ber_printf+0x2f5(berelement=0x7d9dc330, fmt="i}") [Z:\home\giovanni\progetti\windows\wine\build64-simple..\wine\dlls\wldap32\ber.c:392] in wldap32 (0x000000000031fa90) 6 0x0000000064342bcd search_SetSearchPreference+0x30c(iface=0xc7f010, prefs=<is not available>, count=<is not available>) [Z:\home\giovanni\progetti\windows\wine\build64-simple..\wine\dlls\adsldp\adsldp.c:1197] in adsldp (0x0000000000c7f010) 7 0x00000000004023f8 func_ldap+0xbd7() [Z:\home\giovanni\progetti\windows\wine\build64-simple\include\iads.h:2777] in adsldp_test (0x000000000031fc20) 8 0x000000000040562e main+0x21d(argc=<is not available>, argv=<is not available>) [Z:\home\giovanni\progetti\windows\wine\build64-simple..\wine\include\wine\test.h:569] in adsldp_test (0x0000000000c61160) 9 0x0000000000404577 mainCRTStartup+0x66() [Z:\home\giovanni\progetti\windows\wine\build64-simple..\wine\dlls\msvcrt\crt_main.c:58] in adsldp_test (0x0000000000000000) 10 0x000000007b62dd49 BaseThreadInitThunk+0x8(unknown=<is not available>, entry=<is not available>, arg=<is not available>) [Z:\home\giovanni\progetti\windows\wine\build64-simple..\wine\dlls\kernel32\thread.c:59] in kernel32 (0x0000000000000000) 11 0x000000007bc5c043 RtlUserThreadStart+0x82(entry=0x404510, arg=0x7fffffdaf000) [Z:\home\giovanni\progetti\windows\wine\build64-simple..\wine\dlls\ntdll\thread.c:179] in ntdll (0x0000000000000000) 0x00007faf632f8ce1 execlp+0xffffffffffffffff in libc.so.6: movq 0x0000000000000108(%rsp),%rax
https://bugs.winehq.org/show_bug.cgi?id=50622
--- Comment #1 from Hans Leidekker hans@meelstraat.net --- We're using Windows headers where we should be using Unix headers. The problem with including both is that there will be many conflicts. We could solve that with preprocessor tricks like we do for winsock, but that isn't pretty.
Perhaps we can avoid that by splitting this dll in Unix and PE parts, if we want to go that way?
https://bugs.winehq.org/show_bug.cgi?id=50622
--- Comment #2 from Giovanni Mascellani gmascellani@codeweavers.com --- BTW, I forgot to mention that dlls/wldap32/page.c also calls (for example) ber_printf, and uses the right conventions. Correspondingly it has different headers. I tried to mess up with headers, but I couldn't work out a way to make it compile (except in the original configuration, which is broken anyway), then I didn't want to spend too much time on it and passed to something else.
https://bugs.winehq.org/show_bug.cgi?id=50622
--- Comment #3 from Hans Leidekker hans@meelstraat.net --- Created attachment 69336 --> https://bugs.winehq.org/attachment.cgi?id=69336 patch
The patch fixes the calling convention. It also introduces conversion for berval structures, which are not compatible on 64-bit.
https://bugs.winehq.org/show_bug.cgi?id=50622
Hans Leidekker hans@meelstraat.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |0631cecd524fe99999cd71cc8bb | |30b1f0be1c95a Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED
--- Comment #4 from Hans Leidekker hans@meelstraat.net --- Fixed with 0631cecd524fe99999cd71cc8bb30b1f0be1c95a.
https://bugs.winehq.org/show_bug.cgi?id=50622
--- Comment #5 from Giovanni Mascellani gmascellani@codeweavers.com --- Thanks!
https://bugs.winehq.org/show_bug.cgi?id=50622
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #6 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 6.2.