https://bugs.winehq.org/show_bug.cgi?id=41703
Bug ID: 41703 Summary: LdrUnloadDll is not suit for musl(musl lacks unload support though it has a dlclose()) Product: Wine Version: unspecified Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: ntdll Assignee: wine-bugs@winehq.org Reporter: xw897002528@gmail.com Distribution: ---
Created attachment 56111 --> https://bugs.winehq.org/attachment.cgi?id=56111 fix for this problem
Hey, sorry for my poor english, and here is the problem:
First, musl won't unload module even dlclose(). Check here: http://wiki.musl-libc.org/wiki/Functional_differences_from_glibc#Unloading_l...
Then, musl won't excute init(__wine_spec_init) function if a module is already loaded.
That means load_builtin_dll() thought dll is loaded by the current thread since init function was not called, but actually LdrUnloadDll() destroyed them in another thread and nothing is loaded in the current thread. Load_builtin_dll() try to find wm in InLoadOrderModuleList but nothing. After that, app will crash.
And I solved this by making LdrUnloadDll() a stub. Patch is uploaded as a attachment. I hope this could be added in official wine by adding a configure option, thx.
Here's my tracking details on this problem if you're intereted in how i found this: https://github.com/xhebox/noname-linux/issues/2#issuecomment-258680745
https://bugs.winehq.org/show_bug.cgi?id=41703
winetest@luukku.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |winetest@luukku.com
--- Comment #1 from winetest@luukku.com --- https://wiki.winehq.org/Submitting_Patches
Patches aren't picked from bug tracker. I did a patch keyword search yesterday without including wine-staging patches and I got around 200 results.
You need to send your patch for review.
https://bugs.winehq.org/show_bug.cgi?id=41703
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |austinenglish@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=41703
xw897002528@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #56111|0 |1 is obsolete| |
--- Comment #2 from xw897002528@gmail.com --- Created attachment 56117 --> https://bugs.winehq.org/attachment.cgi?id=56117 final patch
https://bugs.winehq.org/show_bug.cgi?id=41703
--- Comment #3 from xw897002528@gmail.com --- (In reply to winetest from comment #1)
https://wiki.winehq.org/Submitting_Patches
Patches aren't picked from bug tracker. I did a patch keyword search yesterday without including wine-staging patches and I got around 200 results.
You need to send your patch for review.
Thx! Can't get send-email worked. But i've send it by gmail to wine-patches@winehq.org.
https://bugs.winehq.org/show_bug.cgi?id=41703
--- Comment #4 from winetest@luukku.com --- If everything goes right you should be able to see your patch at (it shows fast after sending)
https://source.winehq.org/patches/
if not maybe you need to subscribe into wine-devel mailinglist.
https://bugs.winehq.org/show_bug.cgi?id=41703
--- Comment #5 from Bruno Jesus 00cpxxx@gmail.com --- How do you make Wine compile using musl? Can you point a program that can reproduce the issue?
The patch introduces a particular library behavior tweak, I don't think that such approach will be accepted.
https://bugs.winehq.org/show_bug.cgi?id=41703
--- Comment #6 from xw897002528@gmail.com --- (In reply to Bruno Jesus from comment #5)
How do you make Wine compile using musl? Can you point a program that can reproduce the issue?
The patch introduces a particular library behavior tweak, I don't think that such approach will be accepted.
This issue can only be reproduced with musl. Alpinelinux has a 1.8.5 version and i make my own build wine-staging-nine 1.9.22.
Without this patch, winetricks vcrun2008 will failed: fixme:msi:MsiGetLastErrorRecord err:msi:ITERATE_Actions Execution halted, action L"SxsInstallCA" returned 1603
winetricks vcrun2010: c:\4a6a8fa9134964598c5944\vc_red.cab: Verifying signature for vc_red.cab vc_red.cab(c:\4a6a8fa9134964598c5944\vc_red.cab): failed to get certificate. Error: HRESULT 0x80092009 c:\4a6a8fa9134964598c5944\vc_red.cab - Signature verification for file vc_red.cab (c:\4a6a8fa9134964598c5944\vc_red.cab) failed with error 0x80092009 (HRESULT 0x80092009) c:\4a6a8fa9134964598c5944\vc_red.cab Signature could not be verified for vc_red.cab No FileHash provided. Cannot perform FileHash verification for vc_red.cab
https://bugs.winehq.org/show_bug.cgi?id=41703
--- Comment #7 from xw897002528@gmail.com --- Created attachment 56132 --> https://bugs.winehq.org/attachment.cgi?id=56132 Two programs to test if libc support unloading-after-dlclose()
https://bugs.winehq.org/show_bug.cgi?id=41703
--- Comment #8 from xw897002528@gmail.com --- Thx for your reply, Austin English.
I do find a way to check it explicitly and this should be worked for all libc. But i need two programs to check it. I don't know how to write a correct configure.ac.
As you can see, there're two programs in the attachment. Compile the second one as a .so and run the first one. If glibc or other libc that support unloading-after-dlclose(), we should see two lines of 'ss'. Or only one line if the cureent libc is similar to musl.
Any help?
https://bugs.winehq.org/show_bug.cgi?id=41703
xw897002528@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #56132|0 |1 is obsolete| |
--- Comment #9 from xw897002528@gmail.com --- Created attachment 56143 --> https://bugs.winehq.org/attachment.cgi?id=56143 the second edition
https://bugs.winehq.org/show_bug.cgi?id=41703
xw897002528@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #56143|0 |1 is patch| | Attachment #56143|application/mbox |text/plain mime type| |
https://bugs.winehq.org/show_bug.cgi?id=41703
xw897002528@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #56143|0 |1 is obsolete| |
--- Comment #10 from xw897002528@gmail.com --- Created attachment 56144 --> https://bugs.winehq.org/attachment.cgi?id=56144 the second edition
https://bugs.winehq.org/show_bug.cgi?id=41703
--- Comment #11 from Austin English austinenglish@gmail.com --- (In reply to xw897002528 from comment #10)
Created attachment 56144 [details] the second edition
The fixme shouldn't say musl, since other compilers may have the same issue. Just say "This isn't supported on this platform", or something along those lines. Grep the source for similar wording.
https://bugs.winehq.org/show_bug.cgi?id=41703
xw897002528@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|LdrUnloadDll is not suit |Make LdrUnloadDLL a stub if |for musl(musl lacks unload |libc does not unload module |support though it has a |after dlclose |dlclose()) |
https://bugs.winehq.org/show_bug.cgi?id=41703
xw897002528@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #56117|0 |1 is obsolete| | Attachment #56144|0 |1 is obsolete| |
--- Comment #12 from xw897002528@gmail.com --- Created attachment 56155 --> https://bugs.winehq.org/attachment.cgi?id=56155 the third
https://bugs.winehq.org/show_bug.cgi?id=41703
xw897002528@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #56155|0 |1 is obsolete| |
--- Comment #13 from xw897002528@gmail.com --- Created attachment 56156 --> https://bugs.winehq.org/attachment.cgi?id=56156 how about this?
https://bugs.winehq.org/show_bug.cgi?id=41703
--- Comment #14 from xw897002528@gmail.com --- (In reply to Austin English from comment #11)
(In reply to xw897002528 from comment #10)
Created attachment 56144 [details] the second edition
The fixme shouldn't say musl, since other compilers may have the same issue. Just say "This isn't supported on this platform", or something along those lines. Grep the source for similar wording.
How about this one?
https://bugs.winehq.org/show_bug.cgi?id=41703
--- Comment #15 from Austin English austinenglish@gmail.com --- (In reply to xw897002528 from comment #14)
(In reply to Austin English from comment #11)
(In reply to xw897002528 from comment #10)
Created attachment 56144 [details] the second edition
The fixme shouldn't say musl, since other compilers may have the same issue. Just say "This isn't supported on this platform", or something along those lines. Grep the source for similar wording.
How about this one?
Yep, thanks.
https://bugs.winehq.org/show_bug.cgi?id=41703
--- Comment #16 from xw897002528@gmail.com --- (In reply to Austin English from comment #15)
(In reply to xw897002528 from comment #14)
(In reply to Austin English from comment #11)
(In reply to xw897002528 from comment #10)
Created attachment 56144 [details] the second edition
The fixme shouldn't say musl, since other compilers may have the same issue. Just say "This isn't supported on this platform", or something along those lines. Grep the source for similar wording.
How about this one?
Yep, thanks.
Then i need to send it to wine-patches again?
https://bugs.winehq.org/show_bug.cgi?id=41703
--- Comment #17 from Austin English austinenglish@gmail.com --- (In reply to xw897002528 from comment #16)
(In reply to Austin English from comment #15)
(In reply to xw897002528 from comment #14)
(In reply to Austin English from comment #11)
(In reply to xw897002528 from comment #10)
Created attachment 56144 [details] the second edition
The fixme shouldn't say musl, since other compilers may have the same issue. Just say "This isn't supported on this platform", or something along those lines. Grep the source for similar wording.
How about this one?
Yep, thanks.
Then i need to send it to wine-patches again?
Yes, make sure to follow https://wiki.winehq.org/Submitting_Patches
https://bugs.winehq.org/show_bug.cgi?id=41703
--- Comment #18 from xw897002528@gmail.com --- (In reply to Austin English from comment #17)
(In reply to xw897002528 from comment #16)
(In reply to Austin English from comment #15)
(In reply to xw897002528 from comment #14)
(In reply to Austin English from comment #11)
(In reply to xw897002528 from comment #10)
Created attachment 56144 [details] the second edition
The fixme shouldn't say musl, since other compilers may have the same issue. Just say "This isn't supported on this platform", or something along those lines. Grep the source for similar wording.
How about this one?
Yep, thanks.
Then i need to send it to wine-patches again?
Yes, make sure to follow https://wiki.winehq.org/Submitting_Patches
sent
https://bugs.winehq.org/show_bug.cgi?id=41703
Jactry Zeng jactry92@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jactry92@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=41703
--- Comment #19 from xw897002528@gmail.com --- (In reply to Austin English from comment #17)
(In reply to xw897002528 from comment #16)
(In reply to Austin English from comment #15)
(In reply to xw897002528 from comment #14)
(In reply to Austin English from comment #11)
(In reply to xw897002528 from comment #10)
Created attachment 56144 [details] the second edition
The fixme shouldn't say musl, since other compilers may have the same issue. Just say "This isn't supported on this platform", or something along those lines. Grep the source for similar wording.
How about this one?
Yep, thanks.
Then i need to send it to wine-patches again?
Yes, make sure to follow https://wiki.winehq.org/Submitting_Patches
wait, two patches are duplicate in patches list! 127825 127824
https://bugs.winehq.org/show_bug.cgi?id=41703
xw897002528@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #56156|0 |1 is obsolete| |
--- Comment #20 from xw897002528@gmail.com --- Created attachment 56177 --> https://bugs.winehq.org/attachment.cgi?id=56177 fix the mem leak caused by previous version
https://bugs.winehq.org/show_bug.cgi?id=41703
xw897002528@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |WONTFIX Status|UNCONFIRMED |RESOLVED
--- Comment #21 from xw897002528@gmail.com --- I guess this won't be accepted, close it.
https://bugs.winehq.org/show_bug.cgi?id=41703
xw897002528@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Make LdrUnloadDLL a stub if |Hacks for libc does not |libc does not unload module |unload module after dlclose |after dlclose |
https://bugs.winehq.org/show_bug.cgi?id=41703
--- Comment #22 from Jactry Zeng jactry92@gmail.com --- Comment from Alexandre: https://www.winehq.org/pipermail/wine-devel/2016-November/115299.html
https://bugs.winehq.org/show_bug.cgi?id=41703
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED Summary|Hacks for libc does not |Workaround LdrUnloadDll() |unload module after dlclose |for C libraries that do not | |support the dlclose() | |function
--- Comment #23 from Bruno Jesus 00cpxxx@gmail.com --- Closing.
https://bugs.winehq.org/show_bug.cgi?id=41703
Matteo Bruni matteo.mystral@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|WONTFIX |--- Status|CLOSED |REOPENED Ever confirmed|0 |1
--- Comment #24 from Matteo Bruni matteo.mystral@gmail.com --- (In reply to xw897002528 from comment #21)
I guess this won't be accepted, close it.
(In reply to Jactry Zeng from comment #22)
Comment from Alexandre: https://www.winehq.org/pipermail/wine-devel/2016-November/115299.html
Your currently proposed patch is not acceptable but that doesn't mean we won't like a correct fix for this issue (notice how "unloading dlls" and "unloading the corresponding .so" are two different things).
Since this isn't a WONTFIX, I'm reopening the bug. If someone wants to close the bug as ABANDONED though, be my guest.
https://bugs.winehq.org/show_bug.cgi?id=41703
xw897002528@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #56177|0 |1 is obsolete| |
--- Comment #25 from xw897002528@gmail.com --- Created attachment 57076 --> https://bugs.winehq.org/attachment.cgi?id=57076 a better workaround
use 'export WINE_DLL_NOUNLOAD=sxs.dll|urlmon.dll|msisip.dll|advpack.dll|mscoree.dll|fusion.dll|.....' to override the unload list, when you see 'failed to load... c000007b' from 'WINE=+module wine test.exe'.
https://bugs.winehq.org/show_bug.cgi?id=41703
--- Comment #26 from xw897002528@gmail.com --- (In reply to xw897002528 from comment #25)
Created attachment 57076 [details] a better workaround
use 'export WINE_DLL_NOUNLOAD=sxs.dll|urlmon.dll|msisip.dll|advpack.dll|mscoree. dll|fusion.dll|.....' to override the unload list, when you see 'failed to load... c000007b' from 'WINE=+module wine test.exe'.
there's a internal list which make installation of vcrunxxxx safe.
https://bugs.winehq.org/show_bug.cgi?id=41703
xw897002528@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #57076|0 |1 is obsolete| |
--- Comment #27 from xw897002528@gmail.com --- Created attachment 57086 --> https://bugs.winehq.org/attachment.cgi?id=57086 hack edition 2
add missing ifdef
https://bugs.winehq.org/show_bug.cgi?id=41703
xw897002528@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #57086|0 |1 is obsolete| |
--- Comment #28 from xw897002528@gmail.com --- Created attachment 58819 --> https://bugs.winehq.org/attachment.cgi?id=58819 hack edition3
A similiar patch to the first one, but there's no logical hole anymore, and performed better than the second one, no env configuration is needed. Dlls which need reload to refresh the memory, variables or reinit are not working, same as dlls which depends on PROCESS_DETACH to continue.
I cant reinit a dll once process_detach() or MODULE_FlushModrefs() is called. Simply calling load_builtin_callback or process_attach() is not working, it's difficult to archive the same effect from the outside.
https://bugs.winehq.org/show_bug.cgi?id=41703
Andrew Eikum aeikum@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |aeikum@codeweavers.com
https://bugs.winehq.org/show_bug.cgi?id=41703
xw897002528@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution|--- |FIXED
--- Comment #29 from xw897002528@gmail.com --- Closed, since wine-5.7 removed __wine_spec_init from winecrt0. The bug is not valid under the new version anymore.
https://bugs.winehq.org/show_bug.cgi?id=41703
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #30 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 6.13.