diff --git a/4cd3f241-fix-NULL-disk-source.patch b/4cd3f241-fix-NULL-disk-source.patch new file mode 100644 index 0000000..3a43fc8 --- /dev/null +++ b/4cd3f241-fix-NULL-disk-source.patch @@ -0,0 +1,54 @@ +commit 4cd3f241399eb691a7fc9a1279938bfe76215a77 +Author: Wim ten Have +Date: Fri May 19 16:38:43 2017 +0200 + + xenconfig: fix handling of NULL disk source + + It is possible to crash libvirtd when converting xl native config to + domXML when the xl config contains an empty disk source, e.g. an empty + CDROM. Fix by checking that the disk source is non-NULL before parsing it. + + Signed-off-by: Wim ten Have + +Index: libvirt-3.3.0/src/xenconfig/xen_xl.c +=================================================================== +--- libvirt-3.3.0.orig/src/xenconfig/xen_xl.c ++++ libvirt-3.3.0/src/xenconfig/xen_xl.c +@@ -316,6 +316,10 @@ xenParseXLDiskSrc(virDomainDiskDefPtr di + char *tmpstr = NULL; + int ret = -1; + ++ /* A NULL source is valid, e.g. an empty CDROM */ ++ if (srcstr == NULL) ++ return 0; ++ + if (STRPREFIX(srcstr, "rbd:")) { + if (!(tmpstr = virStringReplace(srcstr, "\\\\", "\\"))) + goto cleanup; +Index: libvirt-3.3.0/tests/xlconfigdata/test-disk-positional-parms-partial.cfg +=================================================================== +--- libvirt-3.3.0.orig/tests/xlconfigdata/test-disk-positional-parms-partial.cfg ++++ libvirt-3.3.0/tests/xlconfigdata/test-disk-positional-parms-partial.cfg +@@ -22,4 +22,4 @@ parallel = "none" + serial = "none" + builder = "hvm" + boot = "d" +-disk = [ "/dev/HostVG/XenGuest2,,hda,,backendtype=phy", "/var/lib/libvirt/images/XenGuest2-home,,hdb,,", "/root/boot.iso,,hdc,,devtype=cdrom" ] ++disk = [ "/dev/HostVG/XenGuest2,,hda,,backendtype=phy", "/var/lib/libvirt/images/XenGuest2-home,,hdb,,", "/root/boot.iso,,hdc,,devtype=cdrom" , "format=raw,vdev=hdd,access=ro,devtype=cdrom" ] +Index: libvirt-3.3.0/tests/xlconfigdata/test-disk-positional-parms-partial.xml +=================================================================== +--- libvirt-3.3.0.orig/tests/xlconfigdata/test-disk-positional-parms-partial.xml ++++ libvirt-3.3.0/tests/xlconfigdata/test-disk-positional-parms-partial.xml +@@ -39,6 +39,12 @@ + +
+ ++ ++ ++ ++ ++
++ + + + diff --git a/975ea20f-loopback-macro.patch b/975ea20f-loopback-macro.patch new file mode 100644 index 0000000..9259638 --- /dev/null +++ b/975ea20f-loopback-macro.patch @@ -0,0 +1,70 @@ +commit 975ea20f85987855686a683c1840e56b7270c570 +Author: Jim Fehlig +Date: Fri May 19 15:31:48 2017 -0600 + + maint: define a macro for IPv4 loopback address + + Use a macro instead of hardcoding "127.0.0.1" throughout the + sources. + +Index: libvirt-3.3.0/src/internal.h +=================================================================== +--- libvirt-3.3.0.orig/src/internal.h ++++ libvirt-3.3.0/src/internal.h +@@ -79,6 +79,8 @@ + # define INET_ADDRSTRLEN 16 + # endif + ++# define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1" ++ + /* String equality tests, suggested by Jim Meyering. */ + # define STREQ(a, b) (strcmp(a, b) == 0) + # define STRCASEEQ(a, b) (c_strcasecmp(a, b) == 0) +Index: libvirt-3.3.0/src/qemu/qemu_conf.c +=================================================================== +--- libvirt-3.3.0.orig/src/qemu/qemu_conf.c ++++ libvirt-3.3.0/src/qemu/qemu_conf.c +@@ -250,10 +250,10 @@ virQEMUDriverConfigPtr virQEMUDriverConf + SYSCONFDIR "/pki/qemu") < 0) + goto error; + +- if (VIR_STRDUP(cfg->vncListen, "127.0.0.1") < 0) ++ if (VIR_STRDUP(cfg->vncListen, VIR_LOOPBACK_IPV4_ADDR) < 0) + goto error; + +- if (VIR_STRDUP(cfg->spiceListen, "127.0.0.1") < 0) ++ if (VIR_STRDUP(cfg->spiceListen, VIR_LOOPBACK_IPV4_ADDR) < 0) + goto error; + + /* +Index: libvirt-3.3.0/src/util/virsocketaddr.c +=================================================================== +--- libvirt-3.3.0.orig/src/util/virsocketaddr.c ++++ libvirt-3.3.0/src/util/virsocketaddr.c +@@ -383,11 +383,11 @@ virSocketAddrFormatFull(const virSocketA + * nicely for UNIX sockets */ + if (addr->data.sa.sa_family == AF_UNIX) { + if (withService) { +- if (virAsprintf(&addrstr, "127.0.0.1%s0", ++ if (virAsprintf(&addrstr, VIR_LOOPBACK_IPV4_ADDR"%s0", + separator ? separator : ":") < 0) + goto error; + } else { +- if (VIR_STRDUP(addrstr, "127.0.0.1") < 0) ++ if (VIR_STRDUP(addrstr, VIR_LOOPBACK_IPV4_ADDR) < 0) + goto error; + } + return addrstr; +Index: libvirt-3.3.0/src/vz/vz_sdk.c +=================================================================== +--- libvirt-3.3.0.orig/src/vz/vz_sdk.c ++++ libvirt-3.3.0/src/vz/vz_sdk.c +@@ -3084,7 +3084,7 @@ static int prlsdkApplyGraphicsParams(PRL + + glisten = virDomainGraphicsGetListen(gr, 0); + pret = PrlVmCfg_SetVNCHostName(sdkdom, glisten && glisten->address ? +- glisten->address : "127.0.0.1"); ++ glisten->address : VIR_LOOPBACK_IPV4_ADDR); + prlsdkCheckRetGoto(pret, cleanup); + + ret = 0; diff --git a/dbb85e0c-libxl-graphics-listen-addr.patch b/dbb85e0c-libxl-graphics-listen-addr.patch new file mode 100644 index 0000000..21b9d3f --- /dev/null +++ b/dbb85e0c-libxl-graphics-listen-addr.patch @@ -0,0 +1,64 @@ +commit dbb85e0c15593661ee8e5d95a6160ebdbaa2c9b5 +Author: Jim Fehlig +Date: Fri May 19 15:52:04 2017 -0600 + + libxl: add default listen address for VNC and spice + + If a VNC listen address is not specified in domXML, libxl + will default to 127.0.0.1, but this is never reflected in the domXML. + In the case of spice, a missing listen address resulted in listening + on all interfaces, i.e. '0.0.0.0'. If not specified, set the listen + address in virDomainGraphicsDef struct to the libxl default when + creating the frame buffer device. Additionally, set default spice + listen address to 127.0.0.1. + +Index: libvirt-3.3.0/src/libxl/libxl_conf.c +=================================================================== +--- libvirt-3.3.0.orig/src/libxl/libxl_conf.c ++++ libvirt-3.3.0/src/libxl/libxl_conf.c +@@ -1227,13 +1227,18 @@ libxlMakeVfb(virPortAllocatorPtr graphic + } + x_vfb->vnc.display = l_vfb->data.vnc.port - LIBXL_VNC_PORT_MIN; + +- if ((glisten = virDomainGraphicsGetListen(l_vfb, 0)) && +- glisten->address) { +- /* libxl_device_vfb_init() does VIR_STRDUP("127.0.0.1") */ +- VIR_FREE(x_vfb->vnc.listen); +- if (VIR_STRDUP(x_vfb->vnc.listen, glisten->address) < 0) +- return -1; ++ if ((glisten = virDomainGraphicsGetListen(l_vfb, 0))) { ++ if (glisten->address) { ++ /* libxl_device_vfb_init() does VIR_STRDUP("127.0.0.1") */ ++ VIR_FREE(x_vfb->vnc.listen); ++ if (VIR_STRDUP(x_vfb->vnc.listen, glisten->address) < 0) ++ return -1; ++ } else { ++ if (VIR_STRDUP(glisten->address, VIR_LOOPBACK_IPV4_ADDR) < 0) ++ return -1; ++ } + } ++ + if (VIR_STRDUP(x_vfb->vnc.passwd, l_vfb->data.vnc.auth.passwd) < 0) + return -1; + if (VIR_STRDUP(x_vfb->keymap, l_vfb->data.vnc.keymap) < 0) +@@ -1335,10 +1340,16 @@ libxlMakeBuildInfoVfb(virPortAllocatorPt + } + b_info->u.hvm.spice.port = l_vfb->data.spice.port; + +- if ((glisten = virDomainGraphicsGetListen(l_vfb, 0)) && +- glisten->address && +- VIR_STRDUP(b_info->u.hvm.spice.host, glisten->address) < 0) +- return -1; ++ if ((glisten = virDomainGraphicsGetListen(l_vfb, 0))) { ++ if (glisten->address) { ++ if (VIR_STRDUP(b_info->u.hvm.spice.host, glisten->address) < 0) ++ return -1; ++ } else { ++ if (VIR_STRDUP(b_info->u.hvm.spice.host, VIR_LOOPBACK_IPV4_ADDR) < 0 || ++ VIR_STRDUP(glisten->address, VIR_LOOPBACK_IPV4_ADDR) < 0) ++ return -1; ++ } ++ } + + if (VIR_STRDUP(b_info->u.hvm.keymap, l_vfb->data.spice.keymap) < 0) + return -1; diff --git a/libvirt.changes b/libvirt.changes index 21b209c..1b3af32 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Mon May 22 17:30:44 UTC 2017 - jfehlig@suse.com + +- libxl: add default listen address for VNC and spice + 975ea20f-loopback-macro.patch, + dbb85e0c-libxl-graphics-listen-addr.patch + bsc#1040207 +- xenconfig: fix handling of NULL disk source + 4cd3f241-fix-NULL-disk-source.patch + bsc#1040213 + ------------------------------------------------------------------- Mon May 15 21:21:56 UTC 2017 - jfehlig@suse.com diff --git a/libvirt.spec b/libvirt.spec index f8ea60a..9e9e906 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -326,6 +326,9 @@ Patch5: d12781b4-conf-iommu-cache-mode-attr.patch Patch6: a5691448-qemu-iommu-cache-mode.patch Patch7: 3a276c65-conf-iommu-def-stability-check.patch Patch8: 935d927a-conf-iommu-ABI-stability-check.patch +Patch9: 4cd3f241-fix-NULL-disk-source.patch +Patch10: 975ea20f-loopback-macro.patch +Patch11: dbb85e0c-libxl-graphics-listen-addr.patch # Patches pending upstream review Patch100: libxl-dom-reset.patch Patch101: network-don-t-use-dhcp-authoritative-on-static-netwo.patch @@ -905,6 +908,9 @@ libvirt plugin for NSS for translating domain names into IP addresses. %patch6 -p1 %patch7 -p1 %patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 -p1 %patch100 -p1 %patch101 -p1 %patch102 -p1 diff --git a/libxl-def-usbctrl.patch b/libxl-def-usbctrl.patch index e2d1a54..301cd9d 100644 --- a/libxl-def-usbctrl.patch +++ b/libxl-def-usbctrl.patch @@ -27,7 +27,7 @@ Index: libvirt-3.3.0/src/libxl/libxl_conf.c =================================================================== --- libvirt-3.3.0.orig/src/libxl/libxl_conf.c +++ libvirt-3.3.0/src/libxl/libxl_conf.c -@@ -1822,34 +1822,94 @@ libxlMakeUSBController(virDomainControll +@@ -1833,34 +1833,94 @@ libxlMakeUSBController(virDomainControll } static int