Bug 1286733 - Invalid Python PMAPI pmRegisterDerived call crashes libpcp
Invalid Python PMAPI pmRegisterDerived call crashes libpcp
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: pcp (Show other bugs)
23
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Nathan Scott
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-30 10:45 EST by Marko Myllynen
Modified: 2016-04-06 10:55 EDT (History)
7 users (show)

See Also:
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 10:55:32 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
pmapi-test.py (2.27 KB, text/x-python)
2015-11-30 10:45 EST, Marko Myllynen
no flags Details

  None (edit)
Description Marko Myllynen 2015-11-30 10:45:33 EST
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 11:53:27 EST
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-02 22:48:08 EST
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-02 23:36:20 EST
Fixed upstream - will be in pcp-3.10.9.
Comment 4 Fedora Update System 2015-12-16 20:54:40 EST
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-16 20:55:25 EST
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-16 21:18:12 EST
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 05:26:36 EST
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 05:26:57 EST
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 07:49:02 EST
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 16:57:54 EST
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 17:54:30 EST
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-02 22:56:50 EST
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 17:17:26 EST
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-21 20:17:45 EDT
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 10:53:59 EDT
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.