Bug 676050 - perl threads crash on string evals
perl threads crash on string evals
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: perl (Show other bugs)
5.6
Unspecified Linux
medium Severity medium
: rc
: ---
Assigned To: Marcela Mašláňová
Petr Šplíchal
: Patch
Depends On: 641320
Blocks:
  Show dependency treegraph
 
Reported: 2011-02-08 12:50 EST by Jeff Bastian
Modified: 2012-02-21 00:40 EST (History)
3 users (show)

See Also:
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.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-02-21 00:40:23 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


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

  None (edit)
Description Jeff Bastian 2011-02-08 12:50:23 EST
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 05:00:12 EDT
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 Product and Program Management 2011-05-31 09:41:01 EDT
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 11:30:16 EDT
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 03:45:06 EDT
    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 00:40:23 EST
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.