Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 1344749 - perl segmentation fault when using PerlIO Layer :locale and threads
Summary: perl segmentation fault when using PerlIO Layer :locale and threads
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: perl
Version: 7.2
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: perl-maint-list
QA Contact: Martin Kyral
Lenka Špačková
URL: https://rt.perl.org/Public/Bug/Displa...
Depends On:
TreeView+ depends on / blocked
Reported: 2016-06-10 15:47 UTC by Abhijeet Sadawarte
Modified: 2019-12-16 05:55 UTC (History)
5 users (show)

Fixed In Version: perl-5.16.3-289.el7
Doc Type: Release Note
Doc Text:
Perl interpreter no longer crashes after using the PerlIO locale pragma When a thread was spawned after using the PerlIO locale pragma, the Perl interpreter terminated unexpectedly with a segmentation fault. An upstream patch has been applied, which fixes PerlIO::encoding object duplication. As a result, threads are correctly created after setting a file handle encoding.
Clone Of:
: 1345788 1390907 (view as bug list)
Last Closed: 2016-11-04 00:16:22 UTC
Target Upstream Version:

Attachments (Terms of Use)
Upstream fix (5.12 KB, patch)
2016-06-13 14:00 UTC, Petr Pisar
no flags Details | Diff
Fix ported to perl-5.16.3 (4.97 KB, patch)
2016-06-13 14:44 UTC, Petr Pisar
no flags Details | Diff

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2191 0 normal SHIPPED_LIVE perl bug fix update 2016-11-03 13:19:19 UTC

Description Abhijeet Sadawarte 2016-06-10 15:47:06 UTC
Description of problem:

perl segmentation fault when using PerlIO Layer :locale and threads

Version-Release number of selected component (if applicable):

Red Hat Enterprise Linux Server release 7.2

How reproducible:

[root@dhcp7-145 abhi]# perl
use open IO => ':locale';
use threads;
sub loop {for ($x = 1; $x < 1000000000000; $x++) {}}
$thr = threads->create(\&loop);

Segmentation fault (core dumped)

The script should not core dump but print a message like it does when run without the "open" pragma.

# perl
use threads;
sub loop {for ($x = 1; $x < 1000000000000; $x++) {}}
$thr = threads->create(\&loop);
Perl exited with active threads:
        1 running and unjoined
        0 finished and unjoined
        0 running and detached

Additional info:

1. the crash is in the PUSHSTACKi(PERLSI_MAGIC); expansion

2. looks like a very old bug :( http://www.gossamer-threads.com/lists/perl/porters/219693) and it appears to have been fixed in 2015, so maybe our perl is missing it 

3. link to report is 

and link to patch is 

Comment 2 Petr Pisar 2016-06-13 06:21:21 UTC
I confirm perl-5.16.3-286.el7.x86_64 is affected.

Comment 3 Petr Pisar 2016-06-13 14:00:19 UTC
Created attachment 1167501 [details]
Upstream fix

Comment 4 Petr Pisar 2016-06-13 14:44:31 UTC
Created attachment 1167520 [details]
Fix ported to perl-5.16.3

Comment 7 Petr Pisar 2016-06-14 10:02:28 UTC
How to test:

(1) Run the code in comment #1.
  The program segfaults.
  The program successfully terminate with zero exit code.

Comment 13 errata-xmlrpc 2016-11-04 00:16:22 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.


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