[openstack-nova/f20] Updated patches from f20-patches

Xavier Queralt Mateu xqueralt at fedoraproject.org
Fri Jan 24 09:48:03 UTC 2014


commit c71b478c599792458a43c14bb2c82358be2e879b
Author: Xavier Queralt <xqueralt at redhat.com>
Date:   Fri Jan 24 10:41:29 2014 +0100

    Updated patches from f20-patches
    
    Resolves: CVE-2013-7130
    Resolves: #909113

 0003-libvirt-Fix-root-disk-leak-in-live-mig.patch |  127 +++++++++++++++++++++
 openstack-nova.spec                               |    9 ++-
 2 files changed, 135 insertions(+), 1 deletions(-)
---
diff --git a/0003-libvirt-Fix-root-disk-leak-in-live-mig.patch b/0003-libvirt-Fix-root-disk-leak-in-live-mig.patch
new file mode 100644
index 0000000..bdb257a
--- /dev/null
+++ b/0003-libvirt-Fix-root-disk-leak-in-live-mig.patch
@@ -0,0 +1,127 @@
+From b7148e8167c6f8515237ac146c9207f0af06146b Mon Sep 17 00:00:00 2001
+From: Nikola Dipanov <ndipanov at redhat.com>
+Date: Tue, 10 Dec 2013 17:43:17 +0100
+Subject: [PATCH] libvirt: Fix root disk leak in live mig
+
+This patch makes sure that i_create_images_and_backing method of the
+libvirt driver (called in several places, but most problematic one is
+the call in the pre_live_migration method) creates all the files the
+instance needs that are not present.
+
+Prioir to this patch - the method would only attempt to download the
+image, and if it did so with the path of the ephemeral drives, it could
+expose the image to other users as an ephemeral devices. See the related
+bug for more detaiis.
+
+After this patch - we properly distinguish between image, ephemeral and
+swap files, and make sure that the imagebackend does the correct thing.
+
+Closes-bug: #1251590
+
+Co-authored-by: Loganathan Parthipan <parthipan at hp.com>
+
+Change-Id: I78aa2f4243899db4f4941e77014a7e18e27fc63e
+(cherry picked from commit c69a619668b5f44e94a8fe1a23f3d887ba2834d7)
+
+Conflicts:
+	nova/virt/libvirt/driver.py
+---
+ nova/tests/virt/libvirt/test_libvirt.py | 42 +++++++++++++++++++++++++++++++++
+ nova/virt/libvirt/driver.py             | 31 +++++++++++++++++-------
+ 2 files changed, 65 insertions(+), 8 deletions(-)
+
+diff --git a/nova/tests/virt/libvirt/test_libvirt.py b/nova/tests/virt/libvirt/test_libvirt.py
+index 6410be3..34b4493 100644
+--- a/nova/tests/virt/libvirt/test_libvirt.py
++++ b/nova/tests/virt/libvirt/test_libvirt.py
+@@ -3046,6 +3046,48 @@ class LibvirtConnTestCase(test.TestCase):
+         conn._create_images_and_backing(self.context, self.test_instance,
+                                         "/fake/instance/dir", disk_info_json)
+ 
++    def test_create_images_and_backing_ephemeral_gets_created(self):
++        conn = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
++        disk_info_json = jsonutils.dumps(
++            [{u'backing_file': u'fake_image_backing_file',
++              u'disk_size': 10747904,
++              u'path': u'disk_path',
++              u'type': u'qcow2',
++              u'virt_disk_size': 25165824},
++             {u'backing_file': u'ephemeral_1_default',
++              u'disk_size': 393216,
++              u'over_committed_disk_size': 1073348608,
++              u'path': u'disk_eph_path',
++              u'type': u'qcow2',
++              u'virt_disk_size': 1073741824}])
++
++        base_dir = os.path.join(CONF.instances_path,
++                                CONF.image_cache_subdirectory_name)
++        self.test_instance.update({'name': 'fake_instance',
++                                   'user_id': 'fake-user',
++                                   'os_type': None,
++                                   'project_id': 'fake-project'})
++
++        with contextlib.nested(
++            mock.patch.object(conn, '_fetch_instance_kernel_ramdisk'),
++            mock.patch.object(libvirt_driver.libvirt_utils, 'fetch_image'),
++            mock.patch.object(conn, '_create_ephemeral')
++        ) as (fetch_kernel_ramdisk_mock, fetch_image_mock,
++                create_ephemeral_mock):
++            conn._create_images_and_backing(self.context, self.test_instance,
++                                            "/fake/instance/dir",
++                                            disk_info_json)
++            self.assertEqual(len(create_ephemeral_mock.call_args_list), 1)
++            m_args, m_kwargs = create_ephemeral_mock.call_args_list[0]
++            self.assertEqual(
++                    os.path.join(base_dir, 'ephemeral_1_default'),
++                    m_kwargs['target'])
++            self.assertEqual(len(fetch_image_mock.call_args_list), 1)
++            m_args, m_kwargs = fetch_image_mock.call_args_list[0]
++            self.assertEqual(
++                    os.path.join(base_dir, 'fake_image_backing_file'),
++                    m_kwargs['target'])
++
+     def test_create_images_and_backing_disk_info_none(self):
+         conn = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
+         self.mox.StubOutWithMock(conn, '_fetch_instance_kernel_ramdisk')
+diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
+index 5c05307..5a5f829 100644
+--- a/nova/virt/libvirt/driver.py
++++ b/nova/virt/libvirt/driver.py
+@@ -4210,14 +4210,29 @@ class LibvirtDriver(driver.ComputeDriver):
+ 
+                 image = self.image_backend.image(instance,
+                                                  instance_disk,
+-                                                 CONF.libvirt_images_type)
+-                image.cache(fetch_func=libvirt_utils.fetch_image,
+-                            context=context,
+-                            filename=cache_name,
+-                            image_id=instance['image_ref'],
+-                            user_id=instance['user_id'],
+-                            project_id=instance['project_id'],
+-                            size=info['virt_disk_size'])
++                                                 CONF.libvirt.images_type)
++                if cache_name.startswith('ephemeral'):
++                    image.cache(fetch_func=self._create_ephemeral,
++                                fs_label=cache_name,
++                                os_type=instance["os_type"],
++                                filename=cache_name,
++                                size=info['virt_disk_size'],
++                                ephemeral_size=instance['ephemeral_gb'])
++                elif cache_name.startswith('swap'):
++                    inst_type = flavors.extract_flavor(instance)
++                    swap_mb = inst_type['swap']
++                    image.cache(fetch_func=self._create_swap,
++                                filename="swap_%s" % swap_mb,
++                                size=swap_mb * unit.Mi,
++                                swap_mb=swap_mb)
++                else:
++                    image.cache(fetch_func=libvirt_utils.fetch_image,
++                                context=context,
++                                filename=cache_name,
++                                image_id=instance['image_ref'],
++                                user_id=instance['user_id'],
++                                project_id=instance['project_id'],
++                                size=info['virt_disk_size'])
+ 
+         # if image has kernel and ramdisk, just download
+         # following normal way.
diff --git a/openstack-nova.spec b/openstack-nova.spec
index 611f6da..ddc1bda 100644
--- a/openstack-nova.spec
+++ b/openstack-nova.spec
@@ -2,7 +2,7 @@
 
 Name:             openstack-nova
 Version:          2013.2.1
-Release:          2%{?dist}
+Release:          3%{?dist}
 Summary:          OpenStack Compute (nova)
 
 Group:            Applications/System
@@ -39,6 +39,7 @@ Source30:         openstack-nova-novncproxy.sysconfig
 #
 Patch0001: 0001-Ensure-we-don-t-access-the-net-when-building-docs.patch
 Patch0002: 0002-remove-runtime-dep-on-python-pbr.patch
+Patch0003: 0003-libvirt-Fix-root-disk-leak-in-live-mig.patch
 
 BuildArch:        noarch
 BuildRequires:    intltool
@@ -77,6 +78,7 @@ Summary:          Components common to all OpenStack Nova services
 Group:            Applications/System
 
 Requires:         python-nova = %{version}-%{release}
+Requires:         python-keystoneclient
 
 Requires(post):   systemd-units
 Requires(preun):  systemd-units
@@ -395,6 +397,7 @@ This package contains documentation files for nova.
 
 %patch0001 -p1
 %patch0002 -p1
+%patch0003 -p1
 
 find . \( -name .gitignore -o -name .placeholder \) -delete
 
@@ -901,6 +904,10 @@ fi
 %endif
 
 %changelog
+* Fri Jan 24 2014 Xavier Queralt <xqueralt@@redhat.com> - 2013.2.1-3
+- Require python-keystoneclient for api-paste - rhbz#909113
+- Fix root disk leak in live migration - CVE-2013-7130
+
 * Tue Dec 17 2013 Pádraig Brady <pbrady at redhat.com> - 2013.2.1-2
 - Rotate log files by size rather than by age - rhbz#867747
 


More information about the scm-commits mailing list