develooper Front page | perl.perl5.porters | Postings from November 2013

[perl #118127] Perl crash when run under AppVerifier

From:
bulk88 via RT
Date:
November 23, 2013 22:16
Subject:
[perl #118127] Perl crash when run under AppVerifier
Message ID:
rt-4.0.18-19812-1385245009-959.118127-15-0@perl.org
On Wed Oct 30 02:08:09 2013, shay wrote:
> On Wed Oct 30 01:49:04 2013, shay wrote:
> > For the record, I can reproduce this, debugging blead perl in VC++
> > 2010 with AppVerifier running. My call stack is:
> >
> 
> I can also still reproduce this, with the same call stack, with the
> patch from #120091 (which is related but doesn't claim to fix this)
> applied.

Posting a patch to this problem for comments/review. The idea is to tag sockets handles with a special low 2 bits pattern. The kernel ignores the last 2 bits of all handles, so the only meaning the low 2 bits have are on a user-mode (that includes kernel32.dll) level. 2 closesocket calls are necessary to avoid a leak in ws2_32.dll's socket descriptor to winsock provider vtable hash table. I'm not 100% sure that this won't create another race like #118059 fixed. This patch breaks non-IFS/non-kernel handle socket provider protocols even harder than before. Before=Perl already calls dup/dup2 on socket handles, which calls DuplicateHandle in the CRT, if the socket handle isn't a kernel handle (but a user mode pointer), that causes breakage. Also I assume Perl's sysread/syswrite/buffered IO calls also won't work on non-kernel socket handles, I think I've seen a ticket about that somewhere on RT before. Perl may have had support for doing recv instead of read() on sockets in the pa
 st, but I might be imagining it, will need to research.
 
-- 
bulk88 ~ bulk88 at hotmail.com

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=118127



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