Add a few SLE12 SP2 bug fixes to Factory/Tumbleweed libvirt package.

- libxl: allow vendor/product addressing for USB hostdevs
  virHostdevFindUSBDevice-privsyms.patch, libxl-usb-vendor.patch
  bsc#989646
- qemu: fix auth for rbd network disks
  d53d4650-qemu-rbd-auth.patch
  bsc#988998
- Replace cpumodel-vendor-crash-fix.patch with upstream variant
  541e9ae6-cpu-vendor-crash-fix.patch
  bsc#992425

OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=563
This commit is contained in:
James Fehlig 2016-08-20 23:29:36 +00:00 committed by Git OBS Bridge
parent e27e06d482
commit 27f2ad74e2
7 changed files with 228 additions and 57 deletions

View File

@ -0,0 +1,45 @@
commit 541e9ae6d4290b9004ed73648ea663563b329b3d
Author: Jim Fehlig <jfehlig@suse.com>
Date: Fri Aug 5 15:23:47 2016 -0600
cpu_x86: fix libvirtd crash when host cpu vendor is not available
When starting a guest and copying host vendor cpuid to the guest
cpu, libvirtd would crash if the host cpu contained a NULL vendor
field. Avoid the crash by checking for a valid vendor in the host
cpu before copying the cpuid to the guest cpu.
For completeness, here is a backtrace from the crash
(gdb) bt
f0 0x00007ffff739bf33 in x86DataCpuid (cpuid=0x8, cpuid=0x8,
data=data@entry=0x7fffb800ee78) at cpu/cpu_x86.c:287
f1 virCPUx86DataAddCPUID (data=data@entry=0x7fffb800ee78, cpuid=0x8)
at cpu/cpu_x86.c:355
f2 0x00007ffff739ef47 in x86Compute (host=<optimized out>, cpu=0x7fffb8000cc0,
guest=0x7fffecca7348, message=<optimized out>) at cpu/cpu_x86.c:1580
f3 0x00007fffd2b38e53 in qemuBuildCpuModelArgStr (migrating=false,
hasHwVirt=<synthetic pointer>, qemuCaps=0x7fffb8001040, buf=0x7fffecca7360,
def=0x7fffc400ce20, driver=0x1c) at qemu/qemu_command.c:6283
f4 qemuBuildCpuCommandLine (cmd=cmd@entry=0x7fffb8002f60,
driver=driver@entry=0x7fffc80882c0, def=def@entry=0x7fffc400ce20,
qemuCaps=qemuCaps@entry=0x7fffb8001040, migrating=<optimized out>)
at qemu/qemu_command.c:6445
(gdb) f2
(gdb) p *host_model
$23 = {name = 0x7fffb800ec50 "qemu64", vendor = 0x0, signature = 0, data = {
len = 2, data = 0x7fffb800e720}}
Index: libvirt-2.1.0/src/cpu/cpu_x86.c
===================================================================
--- libvirt-2.1.0.orig/src/cpu/cpu_x86.c
+++ libvirt-2.1.0/src/cpu/cpu_x86.c
@@ -1576,7 +1576,7 @@ x86Compute(virCPUDefPtr host,
if (!(guest_model = x86ModelCopy(host_model)))
goto error;
- if (cpu->vendor &&
+ if (cpu->vendor && host_model->vendor &&
virCPUx86DataAddCPUID(&guest_model->data,
&host_model->vendor->cpuid) < 0)
goto error;

View File

@ -1,56 +0,0 @@
From 341445ce85d91a105f8183f22226d9d90853b27b Mon Sep 17 00:00:00 2001
From: Jim Fehlig <jfehlig@suse.com>
Date: Fri, 5 Aug 2016 15:23:47 -0600
Subject: [PATCH] cpu_x86: fix libvirtd crash when host cpu is 'qemu64'
When starting an L2 nested VM with <cpu mode="host-model"> on an
L1 VM with cpu 'qemu64', libvirtd crashes with
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff739bf33 in x86DataCpuid (cpuid=0x8, cpuid=0x8,
data=data@entry=0x7fffb800ee78) at cpu/cpu_x86.c:287
287 for (i = 0; i < data->len; i++) {
(gdb) bt
f0 0x00007ffff739bf33 in x86DataCpuid (cpuid=0x8, cpuid=0x8,
data=data@entry=0x7fffb800ee78) at cpu/cpu_x86.c:287
f1 virCPUx86DataAddCPUID (data=data@entry=0x7fffb800ee78, cpuid=0x8)
at cpu/cpu_x86.c:355
f2 0x00007ffff739ef47 in x86Compute (host=<optimized out>, cpu=0x7fffb8000cc0,
guest=0x7fffecca7348, message=<optimized out>) at cpu/cpu_x86.c:1580
f3 0x00007fffd2b38e53 in qemuBuildCpuModelArgStr (migrating=false,
hasHwVirt=<synthetic pointer>, qemuCaps=0x7fffb8001040, buf=0x7fffecca7360,
def=0x7fffc400ce20, driver=0x1c) at qemu/qemu_command.c:6283
f4 qemuBuildCpuCommandLine (cmd=cmd@entry=0x7fffb8002f60,
driver=driver@entry=0x7fffc80882c0, def=def@entry=0x7fffc400ce20,
qemuCaps=qemuCaps@entry=0x7fffb8001040, migrating=<optimized out>)
at qemu/qemu_command.c:6445
In frame 2, &host_model->vendor->cpuid is passed to virCPUx86DataAddCPUID(),
but
(gdb) p *host_model
$23 = {name = 0x7fffb800ec50 "qemu64", vendor = 0x0, signature = 0, data = {
len = 2, data = 0x7fffb800e720}}
With vendor = 0x0, &host_model->vendor->cpuid evaluates to 8, which
is not a nice value to pass to virCPUx86DataAddCPUID(). Check for a
non-null host_model->vendor before calling virCPUx86DataAddCPUID().
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---
src/cpu/cpu_x86.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: libvirt-2.1.0/src/cpu/cpu_x86.c
===================================================================
--- libvirt-2.1.0.orig/src/cpu/cpu_x86.c
+++ libvirt-2.1.0/src/cpu/cpu_x86.c
@@ -1576,7 +1576,7 @@ x86Compute(virCPUDefPtr host,
if (!(guest_model = x86ModelCopy(host_model)))
goto error;
- if (cpu->vendor &&
+ if (cpu->vendor && host_model->vendor &&
virCPUx86DataAddCPUID(&guest_model->data,
&host_model->vendor->cpuid) < 0)
goto error;

View File

@ -0,0 +1,51 @@
commit d53d465083edeb64cc7b78249c030734c0d91c6b
Author: John Ferlan <jferlan@redhat.com>
Date: Tue Aug 16 16:50:15 2016 -0400
qemu: Fix the command line generation for rbd auth using aes secrets
https://bugzilla.redhat.com/show_bug.cgi?id=1182074
Since libvirt still uses a legacy qemu arg format to add a disk, the
manner in which the 'password-secret' argument is passed to qemu needs
to change to prepend a 'file.' If in the future, usage of the more
modern disk format, then the prepended 'file.' can be removed.
Fix based on Jim Fehlig <jfehlig@suse.com> posting and subsequent
upstream list followups, see:
http://www.redhat.com/archives/libvir-list/2016-August/msg00777.html
for details. Introduced by commit id 'a1344f70'.
Index: libvirt-2.1.0/src/qemu/qemu_command.c
===================================================================
--- libvirt-2.1.0.orig/src/qemu/qemu_command.c
+++ libvirt-2.1.0/src/qemu/qemu_command.c
@@ -1296,7 +1296,12 @@ qemuBuildDriveSourceStr(virDomainDiskDef
virBufferAddLit(buf, ",");
if (secinfo && secinfo->type == VIR_DOMAIN_SECRET_INFO_TYPE_AES) {
- virBufferAsprintf(buf, "password-secret=%s,",
+ /* NB: If libvirt starts using the more modern option based
+ * syntax to build the command line (e.g., "-drive driver=rbd,
+ * filename=%s,...") instead of the legacy model (e.g."-drive
+ * file=%s,..."), then the "file." prefix can be removed
+ */
+ virBufferAsprintf(buf, "file.password-secret=%s,",
secinfo->s.aes.alias);
}
Index: libvirt-2.1.0/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth-AES.args
===================================================================
--- libvirt-2.1.0.orig/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth-AES.args
+++ libvirt-2.1.0/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth-AES.args
@@ -26,7 +26,7 @@ data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1
keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
-drive 'file=rbd:pool/image:id=myname:auth_supported=cephx\;none:\
mon_host=mon1.example.org\:6321\;mon2.example.org\:6322\;mon3.example.org\:\
-6322,password-secret=virtio-disk0-secret0,format=raw,if=none,\
+6322,file.password-secret=virtio-disk0-secret0,format=raw,if=none,\
id=drive-virtio-disk0' \
-device virtio-blk-pci,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,\
id=virtio-disk0

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Sat Aug 20 23:25:09 UTC 2016 - jfehlig@suse.com
- libxl: allow vendor/product addressing for USB hostdevs
virHostdevFindUSBDevice-privsyms.patch, libxl-usb-vendor.patch
bsc#989646
- qemu: fix auth for rbd network disks
d53d4650-qemu-rbd-auth.patch
bsc#988998
- Replace cpumodel-vendor-crash-fix.patch with upstream variant
541e9ae6-cpu-vendor-crash-fix.patch
bsc#992425
-------------------------------------------------------------------
Fri Aug 12 15:29:37 UTC 2016 - jfehlig@suse.com

View File

@ -315,10 +315,13 @@ Source99: baselibs.conf
Source100: %{name}-rpmlintrc
# Upstream patches
Patch0: 856965b3-qemu-secdriver.patch
Patch1: 541e9ae6-cpu-vendor-crash-fix.patch
Patch2: d53d4650-qemu-rbd-auth.patch
# Patches pending upstream review
Patch100: libxl-dom-reset.patch
Patch101: pci-use-driver-override-sysfs.patch
Patch102: cpumodel-vendor-crash-fix.patch
Patch102: virHostdevFindUSBDevice-privsyms.patch
Patch103: libxl-usb-vendor.patch
# Need to go upstream
Patch150: xen-pv-cdrom.patch
Patch151: blockcopy-check-dst-identical-device.patch
@ -787,9 +790,12 @@ libvirt plugin for NSS for translating domain names into IP addresses.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch150 -p1
%patch151 -p1
%patch152 -p1

61
libxl-usb-vendor.patch Normal file
View File

@ -0,0 +1,61 @@
commit e7af9dcf1fb0703828ef9740cb9b9c00f2fa00a4
Author: Cédric Bosdonnat <cbosdonnat@suse.com>
Date: Fri Aug 5 09:10:50 2016 +0200
libxl: allow vendor/product addressing for USB hostdevs
libxl only has API to address the host USB devices by bus/device.
Find the bus/device if the user only provided the vendor/product
of the USB device.
Index: libvirt-2.1.0/src/libxl/libxl_conf.c
===================================================================
--- libvirt-2.1.0.orig/src/libxl/libxl_conf.c
+++ libvirt-2.1.0/src/libxl/libxl_conf.c
@@ -1483,23 +1483,36 @@ int
libxlMakeUSB(virDomainHostdevDefPtr hostdev, libxl_device_usbdev *usbdev)
{
virDomainHostdevSubsysUSBPtr usbsrc = &hostdev->source.subsys.u.usb;
+ virUSBDevicePtr usb = NULL;
+ int ret = -1;
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
- return -1;
+ goto cleanup;
if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB)
- return -1;
+ goto cleanup;
- if (usbsrc->bus <= 0 || usbsrc->device <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("libxenlight supports only USB device "
- "specified by busnum:devnum"));
- return -1;
+ if (usbsrc->bus > 0 && usbsrc->device > 0) {
+ usbdev->u.hostdev.hostbus = usbsrc->bus;
+ usbdev->u.hostdev.hostaddr = usbsrc->device;
+ } else {
+ if (virHostdevFindUSBDevice(hostdev, true, &usb) < 0) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("failed to find USB device busnum:devnum "
+ "for %x:%x"),
+ usbsrc->vendor, usbsrc->product);
+ goto cleanup;
+ }
+
+ usbdev->u.hostdev.hostbus = virUSBDeviceGetBus(usb);
+ usbdev->u.hostdev.hostaddr = virUSBDeviceGetDevno(usb);
}
- usbdev->u.hostdev.hostbus = usbsrc->bus;
- usbdev->u.hostdev.hostaddr = usbsrc->device;
+ ret = 0;
+
+ cleanup:
+ virUSBDeviceFree(usb);
- return 0;
+ return ret;
}
static int

View File

@ -0,0 +1,51 @@
commit e05e2dba970d3f4b5ec9bed80a7f0bb4ccc43dc8
Author: Cédric Bosdonnat <cbosdonnat@suse.com>
Date: Fri Aug 5 09:10:49 2016 +0200
Add virHostdevFindUSBDevice to private symbols
Finding an USB device from the vendor/device values will be needed
by libxl driver to convert from vendor/device to bus/dev addresses.
Index: libvirt-2.1.0/src/libvirt_private.syms
===================================================================
--- libvirt-2.1.0.orig/src/libvirt_private.syms
+++ libvirt-2.1.0/src/libvirt_private.syms
@@ -1641,6 +1641,7 @@ virHookPresent;
# util/virhostdev.h
+virHostdevFindUSBDevice;
virHostdevManagerGetDefault;
virHostdevPCINodeDeviceDetach;
virHostdevPCINodeDeviceReAttach;
Index: libvirt-2.1.0/src/util/virhostdev.c
===================================================================
--- libvirt-2.1.0.orig/src/util/virhostdev.c
+++ libvirt-2.1.0/src/util/virhostdev.c
@@ -1178,7 +1178,7 @@ virHostdevMarkUSBDevices(virHostdevManag
}
-static int
+int
virHostdevFindUSBDevice(virDomainHostdevDefPtr hostdev,
bool mandatory,
virUSBDevicePtr *usb)
Index: libvirt-2.1.0/src/util/virhostdev.h
===================================================================
--- libvirt-2.1.0.orig/src/util/virhostdev.h
+++ libvirt-2.1.0/src/util/virhostdev.h
@@ -66,6 +66,12 @@ virHostdevPreparePCIDevices(virHostdevMa
unsigned int flags)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_NONNULL(4);
+
+int
+virHostdevFindUSBDevice(virDomainHostdevDefPtr hostdev,
+ bool mandatory,
+ virUSBDevicePtr *usb)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
int
virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr,
const char *drv_name,