Bug 626330

Summary: Sending signal to thread without signal handler in thread causes perl to segfault
Product: Red Hat Enterprise Linux 6 Reporter: Petr Pisar <ppisar>
Component: perlAssignee: perl-maint-list
Status: CLOSED ERRATA QA Contact: Petr Šplíchal <psplicha>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: cweyl, iarnell, kasal, lkundrak, mmaslano, ohudlick, ovasik, ppisar, psabata, psplicha, rc040203, rdevries1000, tcallawa
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: perl-5.10.1-116.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 622190 Environment:
Last Closed: 2011-05-19 11:37:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 622190, 640719    
Bug Blocks:    

Description Petr Pisar 2010-08-23 08:18:48 UTC
+++ This bug was initially created as a clone of Bug #622190 +++

Description of problem:
Sending signal to thread without signal handler in thread causes perl to segfault


Version-Release number of selected component (if applicable):
perl-5.10.1-116.fc13.x86_64


How reproducible:
Every time

Steps to Reproduce:
1.
Run next program perl script:

use strict;
use threads;

sub thr_func
{
    print "thread started\n";
    while(1) {
        sleep(100);
    }
}

my $thr = threads->create('thr_func');
$thr->kill('TERM');

  
Actual results: 
catchsegv perl test.pl

produces:

*** Segmentation fault
Register dump:

 RAX: 0000000001bda7c0   RBX: 0000000001ba2040   RCX: 000000000000000a
 RDX: 0000000001beee70   RSI: 0000000000000000   RDI: 0000000001bda280
 RBP: 0000000000000001   R8 : 0000000001c03cb0   R9 : 00000000000036d3
 R10: 00007fff367f3770   R11: 000000383311eaf0   R12: 000000000000003c
 R13: 0000000000000008   R14: 0000000001bda280   R15: 0000000001c03cb0
 RSP: 00007fff367f39f0

 RIP: 00007f17604f5165   EFLAGS: 00010206

 CS: 0033   FS: 0000   GS: 0000

 Trap: 0000000e   Error: 00000006   OldMask: 00000000   CR2: 0000003c

 FPUCW: 0000037f   FPUSW: 00000000   TAG: 00000000
 RIP: 00000000   RDP: 00000000

 ST(0) 0000 0000000000000032   ST(1) 0000 000000000000000e
 ST(2) 0000 ffffffff801f8000   ST(3) 0000 ffffffff9b52007e
 ST(4) 0000 0000000000000000   ST(5) 0000 0000000000000000
 ST(6) 0000 0000000000000000   ST(7) 0000 0000000000000005
 mxcsr: 1fa0
 XMM0:  000000000000000000000000ffffff00 XMM1:  000000000000000000000000ffffff00
 XMM2:  000000000000000000000000ffffff00 XMM3:  000000000000000000000000ffffff00
 XMM4:  000000000000000000000000ffffff00 XMM5:  000000000000000000000000ffffff00
 XMM6:  000000000000000000000000ffffff00 XMM7:  000000000000000000000000ffffff00
 XMM8:  000000000000000000000000ffffff00 XMM9:  000000000000000000000000ffffff00
 XMM10: 000000000000000000000000ffffff00 XMM11: 000000000000000000000000ffffff00
 XMM12: 000000000000000000000000ffffff00 XMM13: 000000000000000000000000ffffff00
 XMM14: 000000000000000000000000ffffff00 XMM15: 000000000000000000000000ffffff00

Backtrace:
/usr/lib64/perl5/auto/threads/threads.so(XS_threads_kill+0x145)[0x7f17604f5165]
/usr/lib64/perl5/CORE/libperl.so(Perl_pp_entersub+0x5a5)[0x38330a6865]
/usr/lib64/perl5/CORE/libperl.so(Perl_runops_standard+0x16)[0x38330a4b56]
/usr/lib64/perl5/CORE/libperl.so(perl_run+0x338)[0x383304d0e8]
perl(main+0xec)[0x400cac]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x3f7581ec5d]
perl[0x400af9]

[...]

--- Additional comment from ppisar on 2010-08-18 09:03:13 GMT ---

So, it's not in the `make install'. The problem is with perl include paths:

petr@dhcp-0-146:/tmp/threads-1.77-build/usr/lib64/perl5 $ find
.
./threads.pm
./auto
./auto/threads
./auto/threads/.packlist
./auto/threads/threads.bs
./auto/threads/threads.so
./perllocal.pod
petr@dhcp-0-146:/tmp/threads-1.77-build/usr/lib64/perl5 $ perl -I . /tmp/perl_thread_kill 
Perl exited with active threads:
        1 running and unjoined
        0 finished and unjoined
        0 running and detached
petr@dhcp-0-146:/tmp/threads-1.77-build/usr/lib64/perl5 $ perl -I $PWD /tmp/perl_thread_kill 
Segmentation fault

Comment 1 Marcela Mašláňová 2010-10-06 17:06:23 UTC
*** Bug 640719 has been marked as a duplicate of this bug. ***

Comment 2 Petr Šabata 2010-10-15 09:15:33 UTC
Fix available, see the:
CPAN RT #60460
Bug #622190

Comment 6 errata-xmlrpc 2011-05-19 11:37:48 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0558.html

Comment 7 errata-xmlrpc 2011-05-19 13:08:11 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0558.html