SHA256
1
0
forked from pool/libvirt

Accepting request 497372 from home:jfehlig:branches:Virtualization

- 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

OBS-URL: https://build.opensuse.org/request/show/497372
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=604
This commit is contained in:
James Fehlig 2017-05-22 17:49:23 +00:00 committed by Git OBS Bridge
parent 8f756c33df
commit 9ae4fe010c
6 changed files with 206 additions and 1 deletions

View File

@ -0,0 +1,54 @@
commit 4cd3f241399eb691a7fc9a1279938bfe76215a77
Author: Wim ten Have <wim.ten.have@oracle.com>
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 <wim.ten.have@oracle.com>
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 @@
<readonly/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <target dev='hdd' bus='ide'/>
+ <readonly/>
+ <address type='drive' controller='0' bus='1' target='0' unit='1'/>
+ </disk>
<controller type='ide' index='0'/>
<interface type='bridge'>
<mac address='00:16:3e:66:92:9c'/>

View File

@ -0,0 +1,70 @@
commit 975ea20f85987855686a683c1840e56b7270c570
Author: Jim Fehlig <jfehlig@suse.com>
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;

View File

@ -0,0 +1,64 @@
commit dbb85e0c15593661ee8e5d95a6160ebdbaa2c9b5
Author: Jim Fehlig <jfehlig@suse.com>
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;

View File

@ -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

View File

@ -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

View File

@ -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