diff --git a/0001-util-recognize-SMB-CIFS-filesystems-as-shared.patch b/0001-util-recognize-SMB-CIFS-filesystems-as-shared.patch new file mode 100644 index 0000000..acddaf2 --- /dev/null +++ b/0001-util-recognize-SMB-CIFS-filesystems-as-shared.patch @@ -0,0 +1,81 @@ +From 9265a89ae8e70495a989411b628429bcaf47c25e Mon Sep 17 00:00:00 2001 +Message-Id: <9265a89ae8e70495a989411b628429bcaf47c25e.1384729615.git.crobinso@redhat.com> +From: Laine Stump +Date: Thu, 26 Sep 2013 05:40:17 -0400 +Subject: [PATCH 1/2] util: recognize SMB/CIFS filesystems as shared + +This should resolve: + + https://bugzilla.redhat.com/show_bug.cgi?id=1012085 + +libvirt previously recognized NFS, GFS2, OCFS2, and AFS filesystems as +"shared", and thus eligible for exceptions to certain rules/actions +about chowning image files before handing them off to a guest. This +patch widens the definition of "shared filesystem" to include SMB and +CIFS filesystems (aka "Windows file sharing"); both of these use the +same protocol, but different drivers so there are different magic +numbers for each. + +(cherry picked from commit e4e73337e5a5aa708bb356751404ab8ae6583f42) +--- + src/util/virstoragefile.c | 16 +++++++++++++++- + src/util/virstoragefile.h | 2 ++ + 2 files changed, 17 insertions(+), 1 deletion(-) + +diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c +index 532234e..60fdcf3 100644 +--- a/src/util/virstoragefile.c ++++ b/src/util/virstoragefile.c +@@ -1085,6 +1085,12 @@ cleanup: + # ifndef AFS_FS_MAGIC + # define AFS_FS_MAGIC 0x6B414653 + # endif ++# ifndef SMB_SUPER_MAGIC ++# define SMB_SUPER_MAGIC 0x517B ++# endif ++# ifndef CIFS_SUPER_MAGIC ++# define CIFS_SUPER_MAGIC 0xFF534D42 ++# endif + + + int virStorageFileIsSharedFSType(const char *path, +@@ -1150,6 +1156,12 @@ int virStorageFileIsSharedFSType(const char *path, + if ((fstypes & VIR_STORAGE_FILE_SHFS_AFS) && + (sb.f_type == AFS_FS_MAGIC)) + return 1; ++ if ((fstypes & VIR_STORAGE_FILE_SHFS_SMB) && ++ (sb.f_type == SMB_SUPER_MAGIC)) ++ return 1; ++ if ((fstypes & VIR_STORAGE_FILE_SHFS_CIFS) && ++ (sb.f_type == CIFS_SUPER_MAGIC)) ++ return 1; + + return 0; + } +@@ -1168,7 +1180,9 @@ int virStorageFileIsSharedFS(const char *path) + VIR_STORAGE_FILE_SHFS_NFS | + VIR_STORAGE_FILE_SHFS_GFS2 | + VIR_STORAGE_FILE_SHFS_OCFS | +- VIR_STORAGE_FILE_SHFS_AFS); ++ VIR_STORAGE_FILE_SHFS_AFS | ++ VIR_STORAGE_FILE_SHFS_SMB | ++ VIR_STORAGE_FILE_SHFS_CIFS); + } + + int virStorageFileIsClusterFS(const char *path) +diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h +index ffe7a54..a93e664 100644 +--- a/src/util/virstoragefile.h ++++ b/src/util/virstoragefile.h +@@ -96,6 +96,8 @@ enum { + VIR_STORAGE_FILE_SHFS_GFS2 = (1 << 1), + VIR_STORAGE_FILE_SHFS_OCFS = (1 << 2), + VIR_STORAGE_FILE_SHFS_AFS = (1 << 3), ++ VIR_STORAGE_FILE_SHFS_SMB = (1 << 4), ++ VIR_STORAGE_FILE_SHFS_CIFS = (1 << 5), + }; + + int virStorageFileIsSharedFS(const char *path); +-- +1.8.4.2 + diff --git a/0002-libxl-fix-dubious-cpumask-handling-in-libxlDomainSet.patch b/0002-libxl-fix-dubious-cpumask-handling-in-libxlDomainSet.patch new file mode 100644 index 0000000..9363202 --- /dev/null +++ b/0002-libxl-fix-dubious-cpumask-handling-in-libxlDomainSet.patch @@ -0,0 +1,51 @@ +From e51fa6486d82c2f2c6a98c1c11bf93dfbaaf75f3 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <9265a89ae8e70495a989411b628429bcaf47c25e.1384729615.git.crobinso@redhat.com> +References: <9265a89ae8e70495a989411b628429bcaf47c25e.1384729615.git.crobinso@redhat.com> +From: Jeremy Fitzhardinge +Date: Wed, 30 Oct 2013 10:38:08 -0700 +Subject: [PATCH 2/2] libxl: fix dubious cpumask handling in + libxlDomainSetVcpuAffinities + +Rather than casting the virBitmap pointer to uint8_t* and then using +the structure contents as a byte array, use the virBitmap API to determine +the bitmap size and test each bit. + +Signed-off-by: Jeremy Fitzhardinge +(cherry picked from commit ba1bf10063a0205c1de12b209b0282833710214f) +--- + src/libxl/libxl_driver.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c +index adaec75..f47aceb 100644 +--- a/src/libxl/libxl_driver.c ++++ b/src/libxl/libxl_driver.c +@@ -808,7 +808,7 @@ libxlDomainSetVcpuAffinities(libxlDriverPrivatePtr driver, virDomainObjPtr vm) + libxlDomainObjPrivatePtr priv = vm->privateData; + virDomainDefPtr def = vm->def; + libxl_bitmap map; +- uint8_t *cpumask = NULL; ++ virBitmapPtr cpumask = NULL; + uint8_t *cpumap = NULL; + virNodeInfo nodeinfo; + size_t cpumaplen; +@@ -829,10 +829,12 @@ libxlDomainSetVcpuAffinities(libxlDriverPrivatePtr driver, virDomainObjPtr vm) + goto cleanup; + } + +- cpumask = (uint8_t*) def->cputune.vcpupin[vcpu]->cpumask; ++ cpumask = def->cputune.vcpupin[vcpu]->cpumask; + +- for (i = 0; i < VIR_DOMAIN_CPUMASK_LEN; ++i) { +- if (cpumask[i]) ++ for (i = 0; i < virBitmapSize(cpumask); ++i) { ++ bool bit; ++ ignore_value(virBitmapGetBit(cpumask, i, &bit)); ++ if (bit) + VIR_USE_CPU(cpumap, i); + } + +-- +1.8.4.2 + diff --git a/libvirt.spec b/libvirt.spec index 3244ed2..2f08507 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -341,7 +341,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 1.0.5.7 -Release: 1%{?dist}%{?extra_release} +Release: 2%{?dist}%{?extra_release} License: LGPLv2+ Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -352,6 +352,11 @@ URL: http://libvirt.org/ %endif Source: http://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.gz +# Fix attaching ISO from cifs filesystem (bz #1012085) +Patch0001: 0001-util-recognize-SMB-CIFS-filesystems-as-shared.patch +# Fix crash with libxl driver and vcpu affinity (bz #1013045) +Patch0002: 0002-libxl-fix-dubious-cpumask-handling-in-libxlDomainSet.patch + %if %{with_libvirtd} Requires: libvirt-daemon = %{version}-%{release} %if %{with_network} @@ -1084,6 +1089,11 @@ of recent versions of Linux (and other OSes). %prep %setup -q +# Fix attaching ISO from cifs filesystem (bz #1012085) +%patch0001 -p1 +# Fix crash with libxl driver and vcpu affinity (bz #1013045) +%patch0002 -p1 + %build %if ! %{with_xen} %define _without_xen --without-xen @@ -2005,6 +2015,10 @@ fi %endif %changelog +* Sun Nov 17 2013 Cole Robinson - 1.0.5.7-2 +- Fix attaching ISO from cifs filesystem (bz #1012085) +- Fix crash with libxl driver and vcpu affinity (bz #1013045) + * Wed Nov 06 2013 Cole Robinson - 1.0.5.7-1 - Rebased to version 1.0.5.7 - Fix memory limit to not incorrectly invoke OOM killer on qemu (bz #966939)