https://bugs.winehq.org/show_bug.cgi?id=44699
Bug ID: 44699 Summary: Clang 6.0 fails to run under wine Product: Wine Version: 3.0 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: advapi32 Assignee: wine-bugs@winehq.org Reporter: martellmalone@gmail.com Distribution: ---
This is the current output when running clang under wine.
``` fixme:file:FindFirstFileExW flags not implemented 0x00000002 fixme:file:FindFirstFileExW flags not implemented 0x00000002 fixme:file:FindFirstFileExW flags not implemented 0x00000002 fixme:file:FindFirstFileExW flags not implemented 0x00000002 fixme:crypt:CRYPT_LoadProvider Failed to load dll L"C:\windows\system32\rsaenh.dll" LLVM ERROR: Could not acquire a cryptographic context: Unknown error (0x8009001D) ```
Here is the line it currently fails on. https://github.com/llvm-mirror/llvm/blob/release_60/lib/Support/Windows/Proc...
This could be possibly related to #44061
To reproduce this you can run the following docker build script which build llvm and clang and then cross compiles it for windows with mingw-w64. Executing the resulting clang on a simple c source file results in the error. https://github.com/martell/mingw-w64-clang/blob/master/Dockerfile
This is an x64 application.
https://bugs.winehq.org/show_bug.cgi?id=44699
Martell martellmalone@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.winehq.org/sho | |w_bug.cgi?id=44061
https://bugs.winehq.org/show_bug.cgi?id=44699
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |austinenglish@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=44699
--- Comment #1 from Martell martellmalone@gmail.com --- Copied the tool-chain across onto a windows 10 box and it ran fine. Looks like this is most likely a wine bug.
https://bugs.winehq.org/show_bug.cgi?id=44699
--- Comment #2 from Martell martellmalone@gmail.com --- The call stack from calling CryptAcquireContextW
0009:Call advapi32.CryptAcquireContextW(0112c8a0,00000000,00000000,00000001,f0000000) ret=141781bd4 0009:Call ntdll.RtlInitUnicodeString(0112c4f8,7fd6f153a0a0 L"Software\Microsoft\Cryptography") ret=7fd6f151038d 0009:Ret ntdll.RtlInitUnicodeString() retval=00000040 ret=7fd6f151038d 0009:Call ntdll.NtOpenKeyEx(0112c690,000f003f,0112c508,00000000) ret=7fd6f150e34a [0m[91m0009:Ret ntdll.NtOpenKeyEx() retval=c0000034 ret=7fd6f150e34a 0009:Call ntdll.RtlNtStatusToDosError(c0000034) ret=7fd6f15103a1 0009:Ret ntdll.RtlNtStatusToDosError() retval=00000002 ret=7fd6f15103a1 0009:Call KERNEL32.LocalAlloc(00000040,00000064) ret=7fd6f14ffe54 0009:Call ntdll.RtlAllocateHeap(00010000,00000008,00000064) ret=7b453b54 0009:Ret ntdll.RtlAllocateHeap() retval=000381b0 ret=7b453b54 0009:Ret KERNEL32.LocalAlloc() retval=000381b0 ret=7fd6f14ffe54 0009:Call ntdll.RtlInitUnicodeString(0112c4b8,000381b0 L"Software\Microsoft\Cryptography\Provider Type 001") ret=7fd6f151038d 0009:Ret ntdll.RtlInitUnicodeString() retval=00000064 ret=7fd6f151038d 0009:Call ntdll.NtOpenKeyEx(0112c690,02000000,0112c4c8,00000000) ret=7fd6f150e34a 0009:Ret ntdll.NtOpenKeyEx() retval=c0000034 ret=7fd6f150e34a 0009:Call ntdll.RtlNtStatusToDosError(c0000034) ret=7fd6f15103a1 [0m[91m0009:Ret ntdll.RtlNtStatusToDosError() retval=00000002 ret=7fd6f15103a1 0009:Call KERNEL32.LocalFree(000381b0) ret=7fd6f1500501 0009:Call ntdll.RtlLockHeap(00010000) ret=7b4544b0 0009:Ret ntdll.RtlLockHeap() retval=00000001 ret=7b4544b0 0009:Call ntdll.RtlFreeHeap(00010000,00000001,000381b0) ret=7b453b67 0009:Ret ntdll.RtlFreeHeap() retval=00000001 ret=7b453b67 0009:Call ntdll.RtlUnlockHeap(00010000) ret=7b454620 0009:Ret ntdll.RtlUnlockHeap() retval=00000001 ret=7b454620 0009:Ret KERNEL32.LocalFree() retval=00000000 ret=7fd6f1500501 0009:Call KERNEL32.LocalAlloc(00000040,00000082) ret=7fd6f14ffe54 0009:Call ntdll.RtlAllocateHeap(00010000,00000008,00000082) ret=7b453b54 0009:Ret ntdll.RtlAllocateHeap() retval=000381b0 ret=7b453b54 0009:Ret KERNEL32.LocalAlloc() retval=000381b0 ret=7fd6f14ffe54 0009:Call ntdll.RtlInitUnicodeString(0112c4b8,000381b0 L"Software\Microsoft\Cryptography\Defaults\Provider Types\Type 001") ret=7fd6f151038d 0009:Ret ntdll.RtlInitUnicodeString() retval=00000082 ret=7fd6f151038d 0009:Call ntdll.NtOpenKeyEx(0112c690,02000000,0112c4c8,00000000) ret=7fd6f150e34a [0m[91m0009:Ret ntdll.NtOpenKeyEx() retval=c0000034 ret=7fd6f150e34a 0009:Call ntdll.RtlNtStatusToDosError(c0000034) ret=7fd6f15103a1 0009:Ret ntdll.RtlNtStatusToDosError() retval=00000002 ret=7fd6f15103a1 0009:Call KERNEL32.LocalFree(000381b0) ret=7fd6f15005b0 0009:Call ntdll.RtlLockHeap(00010000) ret=7b4544b0 0009:Ret ntdll.RtlLockHeap() retval=00000001 ret=7b4544b0 0009:Call ntdll.RtlFreeHeap(00010000,00000001,000381b0) ret=7b453b67 0009:Ret ntdll.RtlFreeHeap() retval=00000001 ret=7b453b67 0009:Call ntdll.RtlUnlockHeap(00010000) ret=7b454620 0009:Ret ntdll.RtlUnlockHeap() retval=00000001 ret=7b454620 0009:Ret KERNEL32.LocalFree() retval=00000000 ret=7fd6f15005b0 0009:Call KERNEL32.LocalFree(00000000) ret=7fd6f1500e87 0009:Call ntdll.RtlLockHeap(00010000) ret=7b4544b0 0009:Ret ntdll.RtlLockHeap() retval=00000001 ret=7b4544b0 0009:Call ntdll.RtlFreeHeap(00010000,00000001,00000000) ret=7b453b67 0009:Ret ntdll.RtlFreeHeap() retval=00000001 ret=7b453b67 0009:Call ntdll.RtlUnlockHeap(00010000) ret=7b454620 0009:Ret ntdll.RtlUnlockHeap() retval=00000001 ret=7b454620 0009:Ret KERNEL32.LocalFree() retval=00000000 ret=7fd6f1500e87 0009:Call KERNEL32.LocalFree(00000000) ret=7fd6f1500e91 0009:Call ntdll.RtlLockHeap(00010000) ret=7b4544b0 0009:Ret ntdll.RtlLockHeap() retval=00000001 ret=7b4544b0 0009:Call ntdll.RtlFreeHeap(00010000,00000001,00000000) ret=7b453b67 0009:Ret ntdll.RtlFreeHeap() retval=00000001 ret=7b453b67 [0m[91m0009:Call ntdll.RtlUnlockHeap(00010000) ret=7b454620 0009:Ret ntdll.RtlUnlockHeap() retval=00000001 ret=7b454620 0009:Ret KERNEL32.LocalFree() retval=00000000 ret=7fd6f1500e91 0009:Call KERNEL32.LocalFree(00000000) ret=7fd6f1500e99 0009:Call ntdll.RtlLockHeap(00010000) ret=7b4544b0 0009:Ret ntdll.RtlLockHeap() retval=00000001 ret=7b4544b0 0009:Call ntdll.RtlFreeHeap(00010000,00000001,00000000) ret=7b453b67 [0m[91m0009:Ret ntdll.RtlFreeHeap() retval=00000001 ret=7b453b67 0009:Call ntdll.RtlUnlockHeap(00010000) ret=7b454620 0009:Ret ntdll.RtlUnlockHeap() retval=00000001 ret=7b454620 0009:Ret KERNEL32.LocalFree() retval=00000000 ret=7fd6f1500e99 0009:Call KERNEL32.LocalFree(00000000) ret=7fd6f1500ea1 0009:Call ntdll.RtlLockHeap(00010000) ret=7b4544b0 0009:Ret ntdll.RtlLockHeap() retval=00000001 ret=7b4544b0 0009:Call ntdll.RtlFreeHeap(00010000,00000001,00000000) ret=7b453b67 0009:Ret ntdll.RtlFreeHeap() retval=00000001 ret=7b453b67 0009:Call ntdll.RtlUnlockHeap(00010000) ret=7b454620 0009:Ret ntdll.RtlUnlockHeap() retval=00000001 ret=7b454620 0009:Ret KERNEL32.LocalFree() retval=00000000 ret=7fd6f1500ea1 0009:Call KERNEL32.LocalFree(00000000) ret=7fd6f1500ea9 0009:Call ntdll.RtlLockHeap(00010000) ret=7b4544b0 [0m[91m0009:Ret ntdll.RtlLockHeap() retval=00000001 ret=7b4544b0 0009:Call ntdll.RtlFreeHeap(00010000,00000001,00000000) ret=7b453b67 0009:Ret ntdll.RtlFreeHeap() retval=00000001 ret=7b453b67 0009:Call ntdll.RtlUnlockHeap(00010000) ret=7b454620 0009:Ret ntdll.RtlUnlockHeap() retval=00000001 ret=7b454620 0009:Ret KERNEL32.LocalFree() retval=00000000 ret=7fd6f1500ea9 0009:Ret advapi32.CryptAcquireContextW() retval=00000000 ret=141781bd4
https://bugs.winehq.org/show_bug.cgi?id=44699
--- Comment #3 from Martell martellmalone@gmail.com --- I was able to reproduce with this minimal example
``` #include <stdio.h> #include <windows.h> #include <wincrypt.h> // -ladvapi32
int main(int argc, char* argv[]) { HCRYPTPROV provider; if (!CryptAcquireContextW(&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { printf("failed world\n"); return -1; } printf("successful world\n"); return 0; } ```
I'm wondering if this could have anything to do with my host? I am running this under alpine linux which uses musl libc. https://github.com/alpinelinux/aports/blob/master/community/wine/APKBUILD
https://bugs.winehq.org/show_bug.cgi?id=44699
--- Comment #4 from Martell martellmalone@gmail.com --- Created attachment 60716 --> https://bugs.winehq.org/attachment.cgi?id=60716 CryptAcquireContextW PROV_RSA_FULL CRYPT_VERIFYCONTEXT TEST
``` #include <stdio.h> #include <windows.h> #include <wincrypt.h> // -ladvapi32
int main(int argc, char* argv[]) { HCRYPTPROV provider; if (!CryptAcquireContextW(&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { printf("failed world\n"); return -1; } printf("successful world\n"); return 0; }
compiled with `x86_64-w64-mingw32-clang test-crypto.c -o test-crypto-c-x86_64.exe -ladvapi32`
https://bugs.winehq.org/show_bug.cgi?id=44699
Mateusz Mikuła mati865@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mati865@gmail.com
--- Comment #5 from Mateusz Mikuła mati865@gmail.com --- Patch from https://bugs.winehq.org/show_bug.cgi?id=41703#c28 solves the issue.
https://bugs.winehq.org/show_bug.cgi?id=44699
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source
https://bugs.winehq.org/show_bug.cgi?id=44699
temp82@luukku.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |temp82@luukku.com
--- Comment #6 from temp82@luukku.com --- (In reply to Mateusz Mikuła from comment #5)
Patch from https://bugs.winehq.org/show_bug.cgi?id=41703#c28 solves the issue.
that bug is now marked fixed, is this fixed too?
https://bugs.winehq.org/show_bug.cgi?id=44699
--- Comment #7 from Austin English austinenglish@gmail.com --- The Dockerfile doesn't work here (granted, it's 6 years old; I suspect that some git references weren't pinned, but didn't look much further).
i686-w64-mingw32-clang -DHAVE_CONFIG_H -I. -I.. -m32 -masm=att -D__LIBMSVCRT__ -I../include "-I/include" -pipe -std=gnu99 -D_CRTBLD -D_WIN32_WINNT=0x0f00 -D__MSVCRT_VERSION__=0x700 -D__USE_MINGW_ANSI_STDIO=0 -Wall -Wextra -Wformat -Wstrict-aliasing -Wshadow -Wpacked -Winline -Wimplicit-function-declaration -Wmissing-noreturn -Wmissing-prototypes -g -O2 -MT misc/lib32_libcrtdll_extra_a-imaxabs.o -MD -MP -MF misc/.deps/lib32_libcrtdll_extra_a-imaxabs.Tpo -c -o misc/lib32_libcrtdll_extra_a-imaxabs.o `test -f 'misc/imaxabs.c' || echo '../'`misc/imaxabs.c ../misc/imaxabs.c:24:27: error: definition 'llabs' cannot also be an alias long long __attribute__ ((alias ("imaxabs"))) __cdecl llabs (long long); ^ ../misc/imaxabs.c:27:25: error: definition '_abs64' cannot also be an alias __int64 __attribute__ ((alias ("imaxabs"))) __cdecl _abs64 (__int64); ^ 2 errors generated. make[1]: *** [Makefile:28425: misc/lib32_libcrtdll_extra_a-imaxabs.o] Error 1 make[1]: Leaving directory '/build/mingw-w64/mingw-w64-crt/build-i686' make: *** [Makefile:13979: all] Error 2 The command '/bin/sh -c ./build-mingw-w64.sh $TOOLCHAIN_PREFIX $TOOLCHAIN_ARCHS' returned a non-zero code: 2
$ docker --version Docker version 20.10.25+dfsg1, build b82b9f3
https://bugs.winehq.org/show_bug.cgi?id=44699
Ken Sharp imwellcushtymelike@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |testcase
https://bugs.winehq.org/show_bug.cgi?id=44699
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED
--- Comment #8 from Austin English austinenglish@gmail.com --- I tried using the prebuilt binary from upstream: https://releases.llvm.org/6.0.0/LLVM-6.0.0-win64.exe
(In reply to Martell from comment #4)
Created attachment 60716 [details] CryptAcquireContextW PROV_RSA_FULL CRYPT_VERIFYCONTEXT TEST
#include <stdio.h> #include <windows.h> #include <wincrypt.h> // -ladvapi32 int main(int argc, char* argv[]) { HCRYPTPROV provider; if (!CryptAcquireContextW(&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { printf("failed world\n"); return -1; } printf("successful world\n"); return 0; } compiled with `x86_64-w64-mingw32-clang test-crypto.c -o test-crypto-c-x86_64.exe -ladvapi32`
I apparently missed the binary.
Yes, this is fixed:
austin@debian:~/Downloads$ /opt/oldwow64/wine-5.6/bin/wine test-crypto-c-x86_64.exe 000b:err:seh:setup_exception stack overflow 1856 bytes in thread 000b eip 000000007bcafe18 esp 0000000000130ed0 stack 0x130000-0x132000-0x230000 000f:err:seh:setup_exception stack overflow 1856 bytes in thread 000f eip 000000007bcafe18 esp 0000000000130ed0 stack 0x130000-0x132000-0x230000 failed world
austin@debian:~/Downloads$ /opt/oldwow64/wine-6.0/bin/wine test-crypto-c-x86_64.exe successful world
I'll leave it to someone else to bisect the actual fix, if they have time/interest.
https://bugs.winehq.org/show_bug.cgi?id=44699
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #9 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 9.7.