libvirt: fix libvirtd crash if path part of URI is missing
PATCH 1/3 libvirt: fix libvirtd crash if path part of URI is missing
From: thomas tai <[email protected]>
If the user forgets to include the path portion of the URI, instead of receiving an error message, libvirtd crashes.
So for example attempting to make this call will cause libvirtd to fall over.
virsh -c qemu+ssh://[email protected] list (forgetting the trailing /system after the host name)
The reason for the crash is that libvirtd is trying to output an error message with a uninitialized variable. This problem is already fixed in the upstream so applying this fix to our tree allows this issue to be avoided.
--- .../libvirt/qemu-fix-crash-in-qemuOpen.patch | 39 ++++++++++++++++++++++ recipes-extended/libvirt/libvirt_1.0.3.bb | 5 +-- 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 recipes-extended/libvirt/libvirt/qemu-fix-crash-in-qemuOpen.patch
recipes-extended/libvirt/libvirt/qemu-fix-crash-in-qemuOpen.patch new file +39 -0
@@ -0,0 +1,39 @@ +From 74bff2509080912ea8abf1de8fd95fa2412b659a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=A1n=20Tomko?= <[email protected]> +Date: Thu, 11 Apr 2013 11:37:25 +0200 +Subject: [PATCH] qemu: fix crash in qemuOpen + +commit 74bff2509080912ea8abf1de8fd95fa2412b659a from upsteam +git://libvirt.org/libvirt.git + +If the path part of connection URI is not present, cfg is used +unitialized. + +https://bugzilla.redhat.com/show_bug.cgi?id=950855 +--- + src/qemu/qemu_driver.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 2c0d7d1..0d41e39 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -1026,6 +1026,7 @@ static virDrvOpenStatus qemuOpen(virConnectPtr conn, + goto cleanup; + } + ++ cfg = virQEMUDriverGetConfig(qemu_driver); + if (conn->uri->path == NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no QEMU URI path given, try %s"), +@@ -1033,7 +1034,6 @@ static virDrvOpenStatus qemuOpen(virConnectPtr conn, + goto cleanup; + } + +- cfg = virQEMUDriverGetConfig(qemu_driver); + if (cfg->privileged) { + if (STRNEQ(conn->uri->path, "/system") && + STRNEQ(conn->uri->path, "/session")) { +-- +1.7.1 +
recipes-extended/libvirt/libvirt_1.0.3.bb +3 -2
@@ -3,7 +3,7 @@ HOMEPAGE = "http://libvirt.org" LICENSE = "GPLv2+" LIC_FILES_CHKSUM = "file://COPYING;md5=fb919cc88dbe06ec0b0bd50e001ccf1f" SECTION = "console/tools" -PR = "r6" +PR = "r7" DEPENDS = "bridge-utils gnutls libxml2 lvm2 avahi parted curl libpcap util-linux e2fsprogs pm-utils \ iptables ebtables dnsmasq readline"
@@ -25,7 +25,8 @@ RCONFLICTS_${PN}_libvirtd = "connman" SRC_URI = "http://libvirt.org/sources/libvirt-${PV}.tar.gz \ file://libvirt-1.0.3-fix-thread-safety-in-lxc-callback-handling.patch \ file://libvirtd.sh \ - file://libvirtd.conf" + file://libvirtd.conf \ + file://qemu-fix-crash-in-qemuOpen.patch " SRC_URI[md5sum] = "3d9f85d586c9aa3d819b626622f3fc97" SRC_URI[sha256sum] = "f64f4acd7cdcfc6ab5e803195ed58b949f262b54e3659d8c37b33f0fec112757"
Signature · 1 line
1.8.1.2
PATCH 2/3 libvirt: use 4 fields for PACKAGECONFIG[]
From: Joe Slater <[email protected]>
As per the PACKAGECONFIG documentation "You can omit any argument you like but must retain the separating commas".
If we do not retain the separating commas, we might get parsing errors, or, worse, we will think we depend on many items that we do not enable.
--- recipes-extended/libvirt/libvirt_1.0.3.bb | 38 ++++++++++++++++--------------- 1 file changed, 20 insertions(+), 18 deletions(-)
recipes-extended/libvirt/libvirt_1.0.3.bb +20 -18
@@ -3,7 +3,7 @@ HOMEPAGE = "http://libvirt.org" LICENSE = "GPLv2+" LIC_FILES_CHKSUM = "file://COPYING;md5=fb919cc88dbe06ec0b0bd50e001ccf1f" SECTION = "console/tools" -PR = "r7" +PR = "r8" DEPENDS = "bridge-utils gnutls libxml2 lvm2 avahi parted curl libpcap util-linux e2fsprogs pm-utils \ iptables ebtables dnsmasq readline"
@@ -115,29 +115,31 @@ INITSCRIPT_PARAMS_${PN}-libvirtd = "defaults 72" PACKAGECONFIG ??= "qemu yajl xen libxl xen-inotify uml openvz vmware vbox esx \ polkit lxc test remote macvtap libvirtd netcf udev python ${@base_contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)}" -PACKAGECONFIG[qemu] = "--with-qemu,--without-qemu,qemu" +# enable,disable,depends,rdepends +# +PACKAGECONFIG[qemu] = "--with-qemu,--without-qemu,qemu," PACKAGECONFIG[yajl] = "--with-yajl,--without-yajl,yajl,yajl" -PACKAGECONFIG[xen] = "--with-xen,--without-xen,xen" -PACKAGECONFIG[xenapi] = "--with-xenapi,--without-xenapi" -PACKAGECONFIG[libxl] = "--with-libxl=${STAGING_DIR_TARGET}/lib,--without-libxl,xen" -PACKAGECONFIG[xen-inotify] = "--with-xen-inotify,--without-xen-inotify,xen" -PACKAGECONFIG[uml] = "--with-uml, --without-uml" -PACKAGECONFIG[openvz] = "--with-openvz,--without-openvz" -PACKAGECONFIG[vmware] = "--with-vmware,--without-vmware" -PACKAGECONFIG[phyp] = "--with-phyp,--without-phyp" -PACKAGECONFIG[vbox] = "--with-vbox,--without-vbox" -PACKAGECONFIG[esx] = "--with-esx,--without-esx" -PACKAGECONFIG[hyperv] = "--with-hyperv,--without-hyperv" +PACKAGECONFIG[xen] = "--with-xen,--without-xen,xen," +PACKAGECONFIG[xenapi] = "--with-xenapi,--without-xenapi,," +PACKAGECONFIG[libxl] = "--with-libxl=${STAGING_DIR_TARGET}/lib,--without-libxl,xen," +PACKAGECONFIG[xen-inotify] = "--with-xen-inotify,--without-xen-inotify,xen," +PACKAGECONFIG[uml] = "--with-uml, --without-uml,," +PACKAGECONFIG[openvz] = "--with-openvz,--without-openvz,," +PACKAGECONFIG[vmware] = "--with-vmware,--without-vmware,," +PACKAGECONFIG[phyp] = "--with-phyp,--without-phyp,," +PACKAGECONFIG[vbox] = "--with-vbox,--without-vbox,," +PACKAGECONFIG[esx] = "--with-esx,--without-esx,," +PACKAGECONFIG[hyperv] = "--with-hyperv,--without-hyperv,," PACKAGECONFIG[polkit] = "--with-polkit,--without-polkit,polkit,polkit" -PACKAGECONFIG[lxc] = "--with-lxc,--without-lxc, lxc" -PACKAGECONFIG[test] = "--with-test=yes,--with-test=no" -PACKAGECONFIG[remote] = "--with-remote,--without-remote" +PACKAGECONFIG[lxc] = "--with-lxc,--without-lxc, lxc," +PACKAGECONFIG[test] = "--with-test=yes,--with-test=no,," +PACKAGECONFIG[remote] = "--with-remote,--without-remote,," PACKAGECONFIG[macvtap] = "--with-macvtap=yes,--with-macvtap=no,libnl,libnl" -PACKAGECONFIG[libvirtd] = "--with-libvirtd,--without-libvirtd" +PACKAGECONFIG[libvirtd] = "--with-libvirtd,--without-libvirtd,," PACKAGECONFIG[netcf] = "--with-netcf,--without-netcf,netcf,netcf" PACKAGECONFIG[dtrace] = "--with-dtrace,--without-dtrace,," PACKAGECONFIG[udev] = "--with-udev --with-pciaccess,--without-udev,udev libpciaccess," -PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux" +PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux," # Enable the Python tool support require libvirt-python.inc
Signature · 1 line
1.8.1.2
PATCH 3/3 libvirt: make ebtables a PACKAGECONFIG
This is a bit ugly since ebtables isn't controlled via --with/--without-PACKAGE but we can achieve the same result using the cached path variable. Since there are no static hooks into ebtables it doesn't get picked up via the automatic RDEPENDS so we also ensure that we add the RDEPENDS explicitly here.
--- recipes-extended/libvirt/libvirt_1.0.3.bb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
recipes-extended/libvirt/libvirt_1.0.3.bb +7 -3
@@ -3,10 +3,10 @@ HOMEPAGE = "http://libvirt.org" LICENSE = "GPLv2+" LIC_FILES_CHKSUM = "file://COPYING;md5=fb919cc88dbe06ec0b0bd50e001ccf1f" SECTION = "console/tools" -PR = "r8" +PR = "r9" DEPENDS = "bridge-utils gnutls libxml2 lvm2 avahi parted curl libpcap util-linux e2fsprogs pm-utils \ - iptables ebtables dnsmasq readline" + iptables dnsmasq readline" # These might be included by PACKAGECONFIG #RRECOMMENDS+= "polkit qemu yajl libnl lxc netcf"
@@ -113,7 +113,9 @@ INITSCRIPT_PARAMS_${PN}-libvirtd = "defaults 72" # full config PACKAGECONFIG ??= "qemu yajl xen libxl xen-inotify uml openvz vmware vbox esx \ - polkit lxc test remote macvtap libvirtd netcf udev python ${@base_contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)}" + polkit lxc test remote macvtap libvirtd netcf udev python \ + ${@base_contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \ + ebtables" # enable,disable,depends,rdepends #
@@ -140,6 +142,8 @@ PACKAGECONFIG[netcf] = "--with-netcf,--without-netcf,netcf,netcf" PACKAGECONFIG[dtrace] = "--with-dtrace,--without-dtrace,," PACKAGECONFIG[udev] = "--with-udev --with-pciaccess,--without-udev,udev libpciaccess," PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux," +PACKAGECONFIG[ebtables] = "ac_cv_path_EBTABLES_PATH=/sbin/ebtables,ac_cv_path_EBTABLES_PATH=,ebtables,ebtables" + # Enable the Python tool support require libvirt-python.inc
Signature · 1 line
1.8.1.2
Merged these three and the dangling single patch!
Bruce
Quoted 99 lines · Mark Asselstine
From: thomas tai <[email protected]>
If the user forgets to include the path portion of the URI, instead of receiving an error message, libvirtd crashes.
So for example attempting to make this call will cause libvirtd to fall over.
virsh -c qemu+ssh://[email protected] list (forgetting the trailing /system after the host name)
The reason for the crash is that libvirtd is trying to output an error message with a uninitialized variable. This problem is already fixed in the upstream so applying this fix to our tree allows this issue to be avoided.
Signed-off-by Thomas Tai <[email protected]>Signed-off-by Mark Asselstine <[email protected]>--- .../libvirt/qemu-fix-crash-in-qemuOpen.patch | 39 ++++++++++++++++++++++ recipes-extended/libvirt/libvirt_1.0.3.bb | 5 +-- 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 recipes-extended/libvirt/libvirt/qemu-fix-crash-in-qemuOpen.patchrecipes-extended/libvirt/libvirt/qemu-fix-crash-in-qemuOpen.patch new file +39
-0@@ -0,0 +1,39 @@ +From 74bff2509080912ea8abf1de8fd95fa2412b659a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=A1n=20Tomko?= <[email protected]> +Date: Thu, 11 Apr 2013 11:37:25 +0200 +Subject: [PATCH] qemu: fix crash in qemuOpen + +commit 74bff2509080912ea8abf1de8fd95fa2412b659a from upsteam +git://libvirt.org/libvirt.git + +If the path part of connection URI is not present, cfg is used +unitialized. + +https://bugzilla.redhat.com/show_bug.cgi?id=950855 +--- + src/qemu/qemu_driver.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 2c0d7d1..0d41e39 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -1026,6 +1026,7 @@ static virDrvOpenStatus qemuOpen(virConnectPtr conn, + goto cleanup; + } + ++ cfg = virQEMUDriverGetConfig(qemu_driver); + if (conn->uri->path == NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no QEMU URI path given, try %s"), +@@ -1033,7 +1034,6 @@ static virDrvOpenStatus qemuOpen(virConnectPtr conn, + goto cleanup; + } + +- cfg = virQEMUDriverGetConfig(qemu_driver); + if (cfg->privileged) { + if (STRNEQ(conn->uri->path, "/system") && + STRNEQ(conn->uri->path, "/session")) { +-- +1.7.1 +recipes-extended/libvirt/libvirt_1.0.3.bb +3
-3@@ -3,7 +3,7 @@ HOMEPAGE = "http://libvirt.org" LICENSE = "GPLv2+" LIC_FILES_CHKSUM = "file://COPYING;md5=fb919cc88dbe06ec0b0bd50e001ccf1f" SECTION = "console/tools" -PR = "r6" +PR = "r7" DEPENDS = "bridge-utils gnutls libxml2 lvm2 avahi parted curl libpcap util-linux e2fsprogs pm-utils \ iptables ebtables dnsmasq readline"@@ -25,7 +25,8 @@ RCONFLICTS_${PN}_libvirtd = "connman" SRC_URI = "http://libvirt.org/sources/libvirt-${PV}.tar.gz \ file://libvirt-1.0.3-fix-thread-safety-in-lxc-callback-handling.patch \ file://libvirtd.sh \ - file://libvirtd.conf" + file://libvirtd.conf \ + file://qemu-fix-crash-in-qemuOpen.patch " SRC_URI[md5sum] = "3d9f85d586c9aa3d819b626622f3fc97" SRC_URI[sha256sum] = "f64f4acd7cdcfc6ab5e803195ed58b949f262b54e3659d8c37b33f0fec112757" --1.8.1.2
_______________________________________________
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"