Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1107728

Summary: Perl core-dumps if a hash is tied to DB_File before spawning a thread
Product: Red Hat Enterprise Linux 7 Reporter: Petr Pisar <ppisar>
Component: perl-DB_FileAssignee: perl-maint-list
Status: CLOSED ERRATA QA Contact: Martin Kyral <mkyral>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.0CC: isenfeld, jplesnik, mkyral, ppisar, psabata, tbowling
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: perl-DB_File-1.830-6.el7 Doc Type: Bug Fix
Doc Text:
Cause: Spawning thread after tying a variable to a Berkeley database file via DB_File Perl module. Consequence: The perl interpreter crashes when the threads terminates. Fix: DB_File module has been changed to destroy DB_File objects only from thread contexts that created the objects. Result: DB_File object destruction is thread-safe now. Please note that it does not mean that any other DB_File operations can be called from other threads. The DB_File Perl module remains thread-unsafe.
Story Points: ---
Clone Of: 1107542
: 1107731 1107732 1169705 (view as bug list) Environment:
Last Closed: 2015-03-05 07:55:40 UTC Type: Bug
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:    
Bug Blocks: 1169705    
Attachments:
Description Flags
Fix proposed to upstream
none
Test
none
Fix proposed to upstream none

Description Petr Pisar 2014-06-10 13:34:18 UTC
+++ This bug was initially created as a clone of Bug #1107542 +++

+++ This bug was initially created as a clone of Bug #1104827 +++

Description of problem:

Perl script using SDBM_File module is core dumping. Seems to match this upstream bug:  https://rt.perl.org/Public/Bug/Display.html?id=61912#txn-515026

[...]

Steps to Reproduce:

Create reproducer test script sdbm_test.pl containing the following lines, as described in the upstream bug report:

	#!/usr/bin/perl
	
	use strict;
	use Fcntl;
	use SDBM_File;
	use threads;
	use threads::shared;
	
	my %dbtest;
	tie(%dbtest, 'SDBM_File', "test.db", O_RDWR|O_CREAT, 0666);
	
	for (1 .. 2)
	{
	        my $thr = threads->new(\&testThread, $_);
	        $thr->detach();
	}
	sleep 4;
	
	sub testThread
	{
	        my $n = shift;
	        print "thread #" . $n . " started\n";
	}

Make script executable and run which produces the following output:

	[root@util6vm ~]# chmod u+x sdbm_test.pl 
	[root@util6vm ~]# ./sdbm_test.pl 

Expected results:

No errors.

Actual results:

	thread #1 started
	thread #2 started
	*** glibc detected *** /usr/bin/perl: double free or corruption (out): 0x0000000000e2c2c0 ***
	======= Backtrace: =========
	/lib64/libc.so.6[0x3d2ca76166]
	/lib64/libc.so.6[0x3d2ca78c93]
	/usr/lib64/perl5/auto/SDBM_File/SDBM_File.so(XS_SDBM_File_DESTROY+0xc0)[0x7f9d58fb06f0]

[...]

----

DB_File (BerkeleyDB binding) in RHEL-7 is affected too (perl-DB_File-1.830-3.el7).

Comment 1 Petr Pisar 2014-06-10 13:35:00 UTC
Created attachment 907264 [details]
Fix proposed to upstream

Comment 2 Petr Pisar 2014-06-10 13:36:17 UTC
Created attachment 907265 [details]
Test

Comment 6 Petr Pisar 2014-08-07 16:00:35 UTC
Created attachment 924952 [details]
Fix proposed to upstream

This fixes an introduced warning about uninitialized db_DESTROY return value.

Comment 13 errata-xmlrpc 2015-03-05 07:55:40 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.

https://rhn.redhat.com/errata/RHBA-2015-0336.html