Skip to contentSkip to conversation

libvirt-python: backport a patch to fix crash in getAllDomainStats

PATCH In review [email protected] 2 participants 2 messages May 24, 2016 – May 25, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libvirt-python: backport a patch to fix crash in getAllDomainStats

From: Roy Li <[email protected]>

---
 recipes-extended/libvirt/libvirt-python.inc        |  1 +
 .../0001-fix-crash-in-getAllDomainStats.patch      | 57 ++++++++++++++++++++++
 2 files changed, 58 insertions(+)
 create mode 100644 recipes-extended/libvirt/libvirt/0001-fix-crash-in-getAllDomainStats.patch
recipes-extended/libvirt/libvirt-python.inc +1 -0
index c1dafe9..405d5f7 100644
@@ -17,6 +17,7 @@ FILES_${PN}-python = "${bindir}/* ${libdir}/* ${libdir}/${PYTHON_DIR}/*"
 
 SRC_URI += "http://libvirt.org/sources/python/libvirt-python-${PV}.tar.gz;name=libvirt_python"
 SRC_URI += "file://libvirt_api_xml_path.patch;patchdir=../libvirt-python-${PV}"
+SRC_URI += "file://0001-fix-crash-in-getAllDomainStats.patch;patchdir=../libvirt-python-${PV}"
 
 SRC_URI[libvirt_python.md5sum] = "ed018c714d7ddbe93221c796dff283ed"
 SRC_URI[libvirt_python.sha256sum] = "6d35ae9e7801573393b9c92471f39e6700d479f10b641df81d041b469f160bf8"
recipes-extended/libvirt/libvirt/0001-fix-crash-in-getAllDomainStats.patch new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
2.8.1
#1 lore raw
Quoted 3 lines · On Tue, May 24, 2016 at 1:28 AM, <[email protected]> wrote:

From: Roy Li <[email protected]>

We should have a better commit log here .. so I copied the one from your patch into
the main log.

I also tend to prefer uprev's versus backports .. but we can carry this for now, until
I get around to bumping the version.

Bruce

Quoted 108 lines
---
 recipes-extended/libvirt/libvirt-python.inc        |  1 +
 .../0001-fix-crash-in-getAllDomainStats.patch      | 57
++++++++++++++++++++++
 2 files changed, 58 insertions(+)
 create mode 100644

recipes-extended/libvirt/libvirt/0001-fix-crash-in-getAllDomainStats.patch

recipes-extended/libvirt/libvirt-python.inc +0 -0
index c1dafe9..405d5f7 100644
@@ -17,6 +17,7 @@ FILES_${PN}-python = "${bindir}/* ${libdir}/*

${libdir}/${PYTHON_DIR}/*"

SRC_URI += "
http://libvirt.org/sources/python/libvirt-python-${PV}.tar.gz;name=libvirt_python
"
SRC_URI +=
"file://libvirt_api_xml_path.patch;patchdir=../libvirt-python-${PV}" +SRC_URI += "file://0001-fix-crash-in-getAllDomainStats.patch;patchdir=../libvirt-python-${PV}"

SRC_URI[libvirt_python.md5sum] = "ed018c714d7ddbe93221c796dff283ed" SRC_URI[libvirt_python.sha256sum] =
"6d35ae9e7801573393b9c92471f39e6700d479f10b641df81d041b469f160bf8" diff --git a/recipes-extended/libvirt/libvirt/0001-fix-crash-in-getAllDomainStats.patch b/recipes-extended/libvirt/libvirt/0001-fix-crash-in-getAllDomainStats.patch new file mode 100644
index 0000000..0583a94
--- /dev/null
+++
b/recipes-extended/libvirt/libvirt/0001-fix-crash-in-getAllDomainStats.patch

recipes-extended/libvirt/libvirt-python.inc +24 -0
@@ -0,0 +1,57 @@
+From e9c4e2abffef007a28112ebb40a9586b0128f10b Mon Sep 17 00:00:00 2001
+From: Pavel Hrdina <[email protected]>
+Date: Mon, 18 Apr 2016 16:53:50 +0200
+Subject: [PATCH] fix crash in getAllDomainStats
+
+Upstream-Status: Backport
+
+Commits 1d39dbaf and 827ed9b4 broke the libvirt-python API by removing
+virDomainRef() and virDomainFree().  virDomainStatsRecordListFree() will
+free that domain pointer and later when virDomain (python object) call
+its destructor and tries to free that same pointer again.
+
+Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1326839
+
+Signed-off-by: Pavel Hrdina <[email protected]>
+---
+ libvirt-override.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/libvirt-override.c b/libvirt-override.c
+index 4640ed5..2de95ce 100644
+--- a/libvirt-override.c
++++ b/libvirt-override.c
+@@ -8381,6 +8381,7 @@ convertDomainStatsRecord(virDomainStatsRecordPtr

*records,

recipes-extended/libvirt/libvirt-python.inc +8 -0
+     PyObject *py_retval;
+     PyObject *py_record;
+     PyObject *py_record_stats = NULL;
++    virDomainPtr dom = NULL;
+     size_t i;
+
+     if (!(py_retval = PyList_New(nrecords)))
+@@ -8392,9 +8393,12 @@ convertDomainStatsRecord(virDomainStatsRecordPtr

*records,

recipes-extended/libvirt/libvirt-python.inc +12 -0
+
+         VIR_PY_LIST_SET_GOTO(py_retval, i, py_record, error);
+
++        dom = records[i]->dom;
++        virDomainRef(dom);
+         VIR_PY_TUPLE_SET_GOTO(py_record, 0,
+-                              libvirt_virDomainPtrWrap(records[i]->dom),
++                              libvirt_virDomainPtrWrap(dom),
+                               error);
++        dom = NULL;
+
+         if (!(py_record_stats =

getPyVirTypedParameter(records[i]->params,
+
records[i]->nparams)))
+@@ -8406,6 +8410,8 @@ convertDomainStatsRecord(virDomainStatsRecordPtr *records,

recipes-extended/libvirt/libvirt-python.inc +11 -1
+     return py_retval;
+
+  error:
++    if (dom)
++        virDomainFree(dom);
+     Py_XDECREF(py_retval);
+     return NULL;
+ }
+--
+2.8.1
+
--

2.8.1

--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"