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

[perl #87410] win32_open/win32_popen deadlock

Thread Next
From:
bulk 88 via RT
Date:
September 8, 2012 12:56
Subject:
[perl #87410] win32_open/win32_popen deadlock
Message ID:
rt-3.6.HEAD-11172-1347134183-1400.87410-15-0@perl.org
This list discussion is another report of this bug
http://www.nntp.perl.org/group/perl.perl5.porters/2012/09/msg191761.html

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 2.11.0.0 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
http://doxygen.reactos.org/d0/da9/mtdll_8h_a84d97c70b6831b4756cbe856b6419642.html#a84d97c70b6831b4756cbe856b6419642
is 18

VC 6 msvcrt.dll which I dont have a copy of, is probably 18 see
ftp://ftp.cs.ntust.edu.tw/yang/PC-SIMSCRIPT/C%2B%2B/VC98/CRT/SRC/MTDLL.H

_lock was made public api by MS in VS 2010.
http://preview.library.microsoft.com/en-us/library/634ca0c2%28v=VS.100%29.aspx
(VS 2010)
and
http://preview.library.microsoft.com/en-us/library/634ca0c2%28v=VS.90%29.aspx
(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
https://rt.perl.org:443/rt3/Ticket/Display.html?id=87410

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About