Bug 1286733

Summary: Invalid Python PMAPI pmRegisterDerived call crashes libpcp
Product: [Fedora] Fedora Reporter: Marko Myllynen <myllynen>
Component: pcpAssignee: Nathan Scott <nathans>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: brolley, fche, lberk, mgoodwin, nathans, pcp, scox
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcp-3.10.9-1.fc23 pcp-3.10.9-1.fc22 pcp-3.11.1-1.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-06 14:55:32 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:
Attachments:
Description Flags
pmapi-test.py none

Description Marko Myllynen 2015-11-30 15:45:33 UTC
Created attachment 1100522 [details]
pmapi-test.py

Description of problem:
The attached test script exposes two issues around Python PMAPI pmRegisterDerived():

localhost:~> python ~/pmapi-test.py
zsh: segmentation fault  python ~/pmapi-test.py
localhost:~> python ~/pmapi-test.py
REGISTERED 1
EXCEPTION 2
'NoneType' object has no attribute 'decode'
localhost:~> 

Version-Release number of selected component (if applicable):
pcp-3.10.6-2.el7.x86_64

Comment 1 Frank Ch. Eigler 2015-11-30 16:53:27 UTC
I would argue that a python program shouldn't be able to crash libpcp anyway.  If it can, the python bindings do not perform sufficient checking.  See also
https://bugzilla.redhat.com/show_bug.cgi?id=1262721#c5

Comment 2 Nathan Scott 2015-12-03 03:48:08 UTC
Hi Marko,

(In reply to Marko Myllynen from comment #0)
> Created attachment 1100522 [details]
> pmapi-test.py
> 
> Description of problem:
> The attached test script exposes two issues around Python PMAPI
> pmRegisterDerived():
> 
> localhost:~> python ~/pmapi-test.py
> zsh: segmentation fault  python ~/pmapi-test.py

The crash happens because to the ctypes wrapper declares pmRegisterDerived(3) with an integer return type, when it actually returns a string.

> localhost:~> python ~/pmapi-test.py
> REGISTERED 1
> EXCEPTION 2
> 'NoneType' object has no attribute 'decode'
> localhost:~> 
> 

With that fixed, I see the second behaviour above - the NoneType is coming from pmDerivedErrStr (not sure why, but this seems to always return NULL - might be something to do with the thread-local-storage used in libpcp for this error message string).  But, even if we can't get at an error string, we should not be calling decode() on NoneType unconditionally as the python wrapper code is currently doing.

Comment 3 Nathan Scott 2015-12-03 04:36:20 UTC
Fixed upstream - will be in pcp-3.10.9.

Comment 4 Fedora Update System 2015-12-17 01:54:40 UTC
pcp-3.10.9-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-d08245c076

Comment 5 Fedora Update System 2015-12-17 01:55:25 UTC
pcp-3.10.9-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-2b40815137

Comment 6 Fedora Update System 2015-12-17 02:18:12 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 7 Fedora Update System 2015-12-17 10:26:36 UTC
pcp-3.10.9-1.fc23 has been pushed to the Fedora 23 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 'dnf --enablerepo=updates-testing update pcp'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-2b40815137

Comment 8 Fedora Update System 2015-12-17 10:26:57 UTC
pcp-3.10.9-1.fc22 has been pushed to the Fedora 22 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 'dnf --enablerepo=updates-testing update pcp'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-d08245c076

Comment 9 Fedora Update System 2015-12-17 12:49:02 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 10 Fedora Update System 2016-01-05 21:57:54 UTC
pcp-3.10.9-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2016-01-05 22:54:30 UTC
pcp-3.10.9-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2016-02-03 03:56:50 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 13 Fedora Update System 2016-02-03 22:17:26 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 14 Fedora Update System 2016-03-22 00:17:45 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 15 Fedora Update System 2016-04-06 14:53:59 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.