http://bugs.winehq.org/show_bug.cgi?id=21501
Summary: Visual C++ 2010 beta 2 web installer can't replace corrupted downloads (sharing violation due to wintrust handle leak) Product: Wine Version: 1.1.37 Platform: x86 URL: http://www.microsoft.com/visualstudio/en-us/try/defaul t.mspx#download OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wintrust AssignedTo: wine-bugs@winehq.org ReportedBy: focht@gmx.net
Hello,
the web installer verifies the integrity of already downloaded files using hashing and wintrust signature checks.
In case of a corrupted file, WinVerifyTrust -> WINTRUST_DefaultVerify -> SOFTPUB_LoadFileMessage fails:
--- snip --- ... 0031:trace:wintrust:SoftpubInitialize (0x1004c230) 0031:trace:wintrust:SoftpubInitialize returning 00000000 0031:trace:wintrust:SoftpubLoadMessage (0x1004c230) 0031: create_file( access=80000000, attributes=00000040, sharing=00000001, create=1, options=00000050, attrs=00000080, objattr={rootdir=0000,sd={},name=L""}, filename="/home/focht/.wine/dosdevices/c:/windows/temp/21006.01/1033/VS_PRO/wcu/vc90sp1/vc_red.cab" ) 0031: create_file() = 0 { handle=0178 } 0031: get_handle_fd( handle=0178 ) 0031: *fd* 0178 -> 145 0031: get_handle_fd() = 0 { type=1, removable=0, access=00120089, options=00000050 } 0031:trace:wintrust:SOFTPUB_OpenFile returning 1 0031:trace:wintrust:SOFTPUB_GetFileSubject returning 1 0031:trace:wintrust:SOFTPUB_GetSIP returning 1 0031:trace:wintrust:CryptSIPGetSignedDataMsg (0x38ddf90 0x1004c268 0 0x9bf677c (nil)) 0031:trace:wintrust:WINTRUST_GetSignedMsgFromCabFile (0x38ddf90 0x1004c268 0 0x9bf677c (nil)) 0031:trace:wintrust:WINTRUST_GetSignedMsgFromCabFile cert_offset: 3823372 0031:trace:wintrust:WINTRUST_GetSignedMsgFromCabFile cert_size: 5944 0031:warn:wintrust:WINTRUST_GetSignedMsgFromCabFile offset beyond file, not attempting to read 0031:trace:wintrust:CryptSIPGetSignedDataMsg returning 0 0031:trace:wintrust:SoftpubLoadMessage returning 1 (800b0100) 0031:trace:wintrust:WINTRUST_DefaultVerify returning 800b0100 0031:trace:wintrust:WinVerifyTrust returning 800b0100 ... --- snip ---
It seems if WinVerifyTrust fails that way, the caller is not supposed to clean up, e.g. calling WinVerifyTrust with WTD_STATEACTION_CLOSE -> WINTRUST_DefaultClose. The web installer never does - hence the handle + additional data is leaked.
This leaked file handle later leads to a sharing violation when urlmon tries to copy the new file from download cache to destination (DownloadBSC_OnStopBinding):
--- snip --- 0031: create_file( access=c0010000, attributes=00000040, sharing=00000007, create=1, options=00001040, attrs=00000000, objattr={rootdir=0000,sd={},name=L""}, filename="/home/focht/.wine/dosdevices/c:/windows/temp/21006.01/1033/VS_PRO/wcu/vc90sp1/vc_red.cab" ) 0031: create_file() = SHARING_VIOLATION { handle=0000 } ... --- snip ---
After 3 download + replacement tries, it gives up.
Properly internally cleaning up (closing the file handle ...) helps the installer/urlmon to replace the file.
Regards
http://bugs.winehq.org/show_bug.cgi?id=21501
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, Installer
http://bugs.winehq.org/show_bug.cgi?id=21501
--- Comment #1 from Juan Lang juan_lang@yahoo.com 2010-01-26 17:13:58 --- Created an attachment (id=25904) --> (http://bugs.winehq.org/attachment.cgi?id=25904) Patch: Close file handle on error loading a message from it
Does this patch help?
http://bugs.winehq.org/show_bug.cgi?id=21501
--- Comment #2 from Anastasius Focht focht@gmx.net 2010-01-26 17:50:52 --- Hello,
--- quote --- Does this patch help? --- quote ---
sure, I tested something similar.
Regards
http://bugs.winehq.org/show_bug.cgi?id=21501
Juan Lang juan_lang@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
--- Comment #3 from Juan Lang juan_lang@yahoo.com 2010-01-26 17:58:19 --- Patch sent: http://www.winehq.org/pipermail/wine-patches/2010-January/084145.html Thanks!
http://bugs.winehq.org/show_bug.cgi?id=21501
--- Comment #4 from Juan Lang juan_lang@yahoo.com 2010-01-27 16:00:38 --- Closing the handle can cause the last error to change to something spurious, so I had to change the way error handling is done (which I probably should have done in the first place.) I sent a patch series starting here: http://www.winehq.org/pipermail/wine-patches/2010-January/084164.html
http://bugs.winehq.org/show_bug.cgi?id=21501
Juan Lang juan_lang@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED
--- Comment #5 from Juan Lang juan_lang@yahoo.com 2010-01-28 11:29:26 --- Should be fixed by commit 4c1e554d191d7e75b3f9f12e0531e24bf231ef0b. Please reopen if I managed to screw it up ;-)
http://bugs.winehq.org/show_bug.cgi?id=21501
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #6 from Alexandre Julliard julliard@winehq.org 2010-02-05 11:39:22 --- Closing bugs fixed in 1.1.38.
http://bugs.winehq.org/show_bug.cgi?id=21501
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |4c1e554d191d7e75b3f9f12e053 | |1e24bf231ef0b
--- Comment #7 from Anastasius Focht focht@gmx.net 2011-10-11 15:18:06 CDT --- Hello,
filling/correcting fields ...
Regards
https://bugs.winehq.org/show_bug.cgi?id=21501
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- URL|http://www.microsoft.com/vi |https://web.archive.org/web |sualstudio/en-us/try/defaul |/20130329153355/http://down |t.mspx#download |load.microsoft.com/download | |/D/B/C/DBC11267-9597-46FF-8 | |377-E194A73970D6/vs_proweb. | |exe