develooper Front page | perl.perl5.porters | Postings from September 2012

[perl #87410] win32_open/win32_popen deadlock

Thread Next
bulk 88 via RT
September 8, 2012 12:56
[perl #87410] win32_open/win32_popen deadlock
Message ID:
This list discussion is another report of this bug

I got the following idea on howto fix this. The fix is for perl to
acquire lock 11 before calling CRT's dup, this way the lock order is
restored (lock 11/_OSFHND_LOCK then a handle specific lock). Now the
question is whether _lock is exported from all the CRTs that Perl can be
compiled with.

All info below is from 32 bit dlls.

msvcrt.dll 7.0.2600.5512 (xpsp.080413-2111) exports _lock, disassembly
shows _OSFHND_LOCK in _alloc_osfhnd is 11
msvcr71.dll  7.10.6030.0 exports _lock, disassembly shows _OSFHND_LOCK
in _alloc_osfhnd is 11 and crt src code shows it is 11
msvcr100.dll 10.0.40219.1 exports _lock, disassembly shows _OSFHND_LOCK
in _alloc_osfhnd is 11
msvcrt90.dll 9.00.21022.8 exports _lock, disassembly shows _OSFHND_LOCK
in _alloc_osfhnd is 11 and crt src code shows it is 11
msvcrt40.dll 5.1.2600.5512 on WinXP, which contains zero machine code,
just export table forwards to msvcrt.dll does NOT export a _lock
msvcrt20.dll from Windows 95 install disk, does not export
_lock, _lock exists internally though. disassembly shows _OSFHND_LOCK in
_alloc_osfhnd is 18
msvcrt.dll 6.1.8637.0 from WinME, exports _lock, disassembly shows
_OSFHND_LOCK in _alloc_osfhnd is 17, not 18, not 11 *scratches head*
msvcrt.dll 6.1.9844.0 from Win2K SP4-ish, exports _lock, disassembly
shows _OSFHND_LOCK in _alloc_osfhnd is 17

Reactos/Wine does the Dos Windows way _OSFHND_LOCK
is 18

VC 6 msvcrt.dll which I dont have a copy of, is probably 18 see

_lock was made public api by MS in VS 2010.
(VS 2010)
(VS 2008). I dont have a VS 2010 to check its headers.

VC 2003's msvcrt.lib exports _lock but it is never declared in the VS
2003 CRT headers so we dont have a GetProcAddress nightmare to use
_lock. I have a msvcrt.lib that I labeled "vc6" I found somewhere a long
time ago, it also has _lock.

Since WinCE and Win2K are supported platforms. How to figure out what
the _OSFHND_LOCK constant is in a particular CRT DLL? 

via perlbug:  queue: perl5 status: open

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About