Bug 1258862 - local_sock() double free error
Summary: local_sock() double free error
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: pcp
Version: 23
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Nathan Scott
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-09-01 12:24 UTC by Filip Krska
Modified: 2016-04-06 14:56 UTC (History)
8 users (show)

Fixed In Version: pcp-3.11.1-1.el5
Doc Type: Bug Fix
Doc Text:
Clone Of: 1258846
Environment:
Last Closed: 2016-04-06 14:56:08 UTC


Attachments (Terms of Use)

Description Filip Krska 2015-09-01 12:24:53 UTC
The related code in Fedora/master is unchanged, so the double free is present here as well. Needed to propagate through upstream.

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

Description of problem:

pmdamemcache crashes with following backtrace:

Core was generated by `perl /var/lib/pcp/pmdas/memcache/pmdamemcache.pl'.
Program terminated with signal 6, Aborted.

#0  0x00007f9464552625 in raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007f9464553e05 in abort () at abort.c:92
#2  0x00007f9464590537 in __libc_message (do_abort=2, fmt=0x7f9464678940 "*** glibc detected *** %s: %s: 0x%s ***\n")
    at ../sysdeps/unix/sysv/linux/libc_fatal.c:198
#3  0x00007f9464595e66 in malloc_printerr (action=3, str=0x7f9464676a2e "free(): invalid pointer", ptr=<value optimized out>)
    at malloc.c:6336
#4  0x00007f946459897a in _int_free (av=0x7f94648afe80, p=0x7f94648afef8, have_lock=0) at malloc.c:4832
#5  0x00007f945de06d25 in __pmHostEntFree (hostent=0x15cb740) at auxconnect.c:39
#6  0x00007f945e265517 in local_sock (host=0x15cb780 "127.0.0.1", port=11211, callback=0x16ba050, cookie=0) at local.c:209
#7  0x00007f945e273eaa in XS_PCP__PMDA_add_sock (my_perl=0x7633, cv=0x1693560) at PMDA.xs:1099
#8  0x00007f946588e815 in Perl_pp_entersub (my_perl=0x159f010) at pp_hot.c:2888
#9  0x00007f946588cb06 in Perl_runops_standard (my_perl=0x159f010) at run.c:40
#10 0x00007f94658350d8 in S_run_body (my_perl=0x159f010) at perl.c:2435
#11 perl_run (my_perl=0x159f010) at perl.c:2353
#12 0x0000000000400e74 in main (argc=2, argv=0x7ffcf217ad98, env=0x7ffcf217adb0) at perlmain.c:117

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

pcp-3.10.3-3.el6.x86_64
perl-PCP-PMDA-3.10.3-3.el6.x86_64

How reproducible:

No reproducer known so far, abrt reports generated often in customer's environment

Steps to Reproduce:
1.
2.
3.

Actual results:

Program terminated with signal 6, Aborted.

Expected results:

No abort

Additional info:

The same double free bug seem to be present in RHEL 7's, fedora master's pcp as well, upstream propagation needed.

Hypothesis:

pcp-3.10.3/src/perl/PMDA/local.c:

int
local_sock(char *host, int port, scalar_t *callback, int cookie)
{
    __pmSockAddr *myaddr;
    __pmHostEnt  *servinfo = NULL;
...
    if ((servinfo = __pmGetAddrInfo(host)) == NULL) {
        __pmNotifyErr(LOG_ERR, "__pmGetAddrInfo (%s): %s", host, netstrerror());
        goto error;                     <------------ local.c:158
...
    __pmHostEntFree(servinfo);          < first free()
...
    if (sts < 0) {
        __pmNotifyErr(LOG_ERR, "__pmConnect (%s): %s", host, netstrerror());
        goto error;                     <------------ local.c:196
    }
...
 error:
    if (fd >= 0)
        __pmCloseSocket(fd);
    if (servinfo)
        __pmHostEntFree(servinfo);      <------------ local.c:209   second free()

We can get to line 209 only from line 196 (just after __pmHostEntFree(), so servinfo is already freed). We cannot get there from line 158 because servinfo would be NULL.

Comment 1 Nathan Scott 2015-09-02 03:52:44 UTC
Thanks for the detailed problem report and diagnosis Filip, this is now fixed upstream and will make its way into Fedora via the pcp-3.10.7 release within the next few weeks.

Comment 2 Fedora Update System 2015-09-17 05:40:45 UTC
pcp-3.10.7-1.el5 has been submitted as an update to Fedora EPEL 5. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2015-8117

Comment 3 Fedora Update System 2015-09-17 05:45:07 UTC
pcp-3.10.7-1.fc21 has been submitted as an update to Fedora 21. https://bodhi.fedoraproject.org/updates/FEDORA-2015-16073

Comment 4 Fedora Update System 2015-09-18 05:20:43 UTC
pcp-3.10.7-1.fc21 has been pushed to the Fedora 21 testing repository. If problems still persist, please make note of it in this bug report.\nIf you want to test the update, you can install it with \n su -c 'yum --enablerepo=updates-testing update pcp'. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-16073

Comment 5 Fedora Update System 2015-09-19 02:46:17 UTC
pcp-3.10.7-1.el5 has been pushed to the Fedora EPEL 5 testing repository. If problems still persist, please make note of it in this bug report.\nIf you want to test the update, you can install it with \n su -c 'yum --enablerepo=updates-testing update pcp'. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2015-8117

Comment 6 Fedora Update System 2015-10-13 06:53:18 UTC
pcp-3.10.7-1.fc21 has been pushed to the Fedora 21 stable repository. If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2015-10-29 21:51:51 UTC
pcp-3.10.8-1.el5 has been submitted as an update to Fedora EPEL 5. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2015-60b17897b4

Comment 8 Fedora Update System 2015-11-01 16:48:14 UTC
pcp-3.10.8-1.el5 has been pushed to the Fedora EPEL 5 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'yum --enablerepo=epel-testing update pcp'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2015-60b17897b4

Comment 9 Fedora Update System 2015-12-17 02:18:54 UTC
pcp-3.10.9-1.el5 has been submitted as an update to Fedora EPEL 5. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2015-2ac90519bc

Comment 10 Fedora Update System 2015-12-17 12:49:38 UTC
pcp-3.10.9-1.el5 has been pushed to the Fedora EPEL 5 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'yum --enablerepo=epel-testing update pcp'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2015-2ac90519bc

Comment 11 Fedora Update System 2016-02-03 03:57:34 UTC
pcp-3.11.0-1.el5 has been submitted as an update to Fedora EPEL 5. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-57b7efb2d7

Comment 12 Fedora Update System 2016-02-03 22:18:02 UTC
pcp-3.11.0-1.el5 has been pushed to the Fedora EPEL 5 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-57b7efb2d7

Comment 13 Fedora Update System 2016-03-22 00:18:19 UTC
pcp-3.11.1-1.el5 has been pushed to the Fedora EPEL 5 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-5b519318e0

Comment 14 Fedora Update System 2016-04-06 14:54:41 UTC
pcp-3.11.1-1.el5 has been pushed to the Fedora EPEL 5 stable repository. If problems still persist, please make note of it in this bug report.


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