Bug 676050 - perl threads crash on string evals
Summary: perl threads crash on string evals
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: perl
Version: 5.6
Hardware: Unspecified
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Marcela Mašláňová
QA Contact: Petr Šplíchal
URL:
Whiteboard:
Depends On: 641320
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-02-08 17:50 UTC by Jeff Bastian
Modified: 2016-06-01 01:41 UTC (History)
4 users (show)

Fixed In Version: perl-5.8.8-35.el5
Doc Type: Bug Fix
Doc Text:
Cause String evaluation in threads. Consequence String evaluation in threads can produce crash. Fix String evaluation is internally done in non threaded variables and module threads was updated to version 1.79. Result String evaluation do not lead to crashes.
Clone Of:
Environment:
Last Closed: 2012-02-21 05:40:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
newCONTSUB wasn't thread safe (1.61 KB, patch)
2011-08-17 15:30 UTC, Marcela Mašláňová
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0199 0 normal SHIPPED_LIVE perl bug fix update 2012-02-20 14:54:01 UTC

Description Jeff Bastian 2011-02-08 17:50:23 UTC
Description of problem:
While working on bug 675863, we discovered Perl scripts using threads crash when doing string evals.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[jbastian@sun-x4500-1 ~]$ cat thread-eval.pl
#!/usr/bin/perl

use threads;

threads->create(sub { eval '1' }) for 1..20;
print("Waiting for threads to finish\n");
$_->join() foreach (threads->list());

[jbastian@sun-x4500-1 ~]$ ./thread-eval.pl
Waiting for threads to finish
Segmentation fault
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Perl 5.8.9 fixes it:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[jbastian@sun-x4500-1 ~]$ /home/jbastian/local/bin/perl --version

This is perl, v5.8.9 built for x86_64-linux-thread-multi
...

[jbastian@sun-x4500-1 ~]$ /home/jbastian/local/bin/perl ./thread-eval.pl 
Waiting for threads to finish

[jbastian@sun-x4500-1 ~]$
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


This was reported upstream at
  http://rt.perl.org/rt3//Public/Bug/Display.html?id=45053
See also
  http://perl5.git.perl.org/perl.git?a=search&h=HEAD&st=commit&s=45053

And appears to be fixed with these commits:
http://perl5.git.perl.org/perl.git/commit/863e9b4aa72b7b080129007c00c2b1efa2a78bca
http://perl5.git.perl.org/perl.git/commit/401667e9af6ec282136e4e49614eb18614c5654b


Version-Release number of selected component (if applicable):
perl-5.8.8-32.el5_5.2

How reproducible:
every time

Steps to Reproduce:
1. save thread-eval.pl as shown above and run it
  
Actual results:
segmentation fault

Expected results:
no crash

Additional info:

Comment 1 Marcela Mašláňová 2011-04-13 09:00:12 UTC
We would need update of threads to 1.71 from 1.07 and apply change of op.c from commit 
http://perl5.git.perl.org/perl.git/commit/401667e9af6ec282136e4e49614eb18614c5654b

Comment 2 RHEL Program Management 2011-05-31 13:41:01 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 3 Marcela Mašláňová 2011-08-17 15:30:16 UTC
Created attachment 518708 [details]
newCONTSUB wasn't thread safe

This patch fix threads part in perl, but you also need update of threads module at least to 1.71.

Comment 9 Marcela Mašláňová 2011-09-26 07:45:06 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause
    String evaluation in threads.
Consequence
    String evaluation in threads can produce crash.
Fix
    String evaluation is internally done in non threaded variables and module threads was updated to version 1.79.
Result
    String evaluation do not lead to crashes.

Comment 11 errata-xmlrpc 2012-02-21 05:40:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0199.html


Note You need to log in before you can comment on or make changes to this bug.