Subject: | Segfault if socket lives across threading |
If a thread is created between the creation of a socket and its closing,
then Perl crashes due to a double-free. The simple script attached
demonstrates the problem.
$ dpkg-query -l libnet-ssleay-perl libssl1.0.0 libio-socket-ssl-perl
perl
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-
aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==============-==============-
============================================
ii libio-socket-s 1.62-1 Perl module implementing object
oriented int
ii libnet-ssleay- 1.47-1 Perl module for Secure Sockets Layer
(SSL)
ii libssl1.0.0:i3 1.0.1-4 SSL shared libraries
ii perl 5.14.2-9 Larry Wall's Practical Extraction and
Report
$ perl -v
This is perl 5, version 14, subversion 2 (v5.14.2) built for i486-linux-
gnu-thread-multi-64int
(with 59 registered patches, see perl -V for more detail)
Copyright 1987-2011, Larry Wall
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to
the
Internet, point your browser at http://www.perl.org/, the Perl Home
Page.
Subject: | test.pl |
#!/usr/bin/env perl
$|=1;
use strict;
use warnings;
use threads;
use IO::Socket::SSL qw(:debug3);
my $sock = IO::Socket::SSL->new('www.google.com:https') || die IO::Socket::SSL::errstr;
my $thread = threads->create(sub { 1; });
$thread->join;
$sock->close;