* Thu Apr 11 2019 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 3.1.0-21.el8

- kvm-Remove-7-qcow2-and-luks-iotests-that-are-taking-25-s.patch [bz#1683473]
- kvm-spapr-fix-out-of-bounds-write-in-spapr_populate_drme.patch [bz#1674438]
- kvm-qcow2-include-LUKS-payload-overhead-in-qemu-img-meas.patch [bz#1655065]
- kvm-iotests-add-LUKS-payload-overhead-to-178-qemu-img-me.patch [bz#1655065]
- kvm-vnc-detect-and-optimize-pageflips.patch [bz#1666206]
- kvm-Load-kvm-module-during-boot.patch [bz#1676907 bz#1685995]
- kvm-hostmem-file-reject-invalid-pmem-file-sizes.patch [bz#1669053]
- kvm-iotests-Fix-test-200-on-s390x-without-virtio-pci.patch [bz#1687582]
- kvm-block-file-posix-do-not-fail-on-unlock-bytes.patch [bz#1652572]
- Resolves: bz#1652572
  (QEMU core dumped if stop nfs service during migration)
- Resolves: bz#1655065
  ([rhel.8.0][fast train]'qemu-img measure' size does not match the real allocated size for luks-inside-qcow2 image)
- Resolves: bz#1666206
  (vnc server should detect page-flips and avoid sending fullscreen updates then.)
- Resolves: bz#1669053
  (Guest call trace when boot with nvdimm device backed by /dev/dax)
- Resolves: bz#1674438
  (RHEL8.0 - Guest reboot fails after memory hotplug multiple times (kvm))
- Resolves: bz#1676907
  (/dev/kvm device exists but kernel module is not loaded on boot up causing VM start to fail in libvirt)
- Resolves: bz#1683473
  (Remove 7 qcow2 & luks iotests from rhel8 fast train build %check phase)
- Resolves: bz#1685995
  (/dev/kvm device exists but kernel module is not loaded on boot up causing VM start to fail in libvirt)
- Resolves: bz#1687582
  (QEMU IOTEST 200 fails with 'virtio-scsi-pci is not a valid device model name')
This commit is contained in:
Danilo C. L. de Paula 2019-04-11 18:06:32 +01:00
parent 9374e45db4
commit 797ce578a4
9 changed files with 795 additions and 3 deletions

View File

@ -0,0 +1,58 @@
From cc7dbe3ae92a2bb1557df184493a331fe2381003 Mon Sep 17 00:00:00 2001
From: Max Reitz <mreitz@redhat.com>
Date: Wed, 3 Apr 2019 17:53:52 +0100
Subject: [PATCH 9/9] block/file-posix: do not fail on unlock bytes
RH-Author: Max Reitz <mreitz@redhat.com>
Message-id: <20190403175352.27439-2-mreitz@redhat.com>
Patchwork-id: 85408
O-Subject: [RHEL-AV-8.0.1 qemu-kvm PATCH 1/1] block/file-posix: do not fail on unlock bytes
Bugzilla: 1652572
RH-Acked-by: John Snow <jsnow@redhat.com>
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
bdrv_replace_child() calls bdrv_check_perm() with error_abort on
loosening permissions. However file-locking operations may fail even
in this case, for example on NFS. And this leads to Qemu crash.
Let's avoid such errors. Note, that we ignore such things anyway on
permission update commit and abort.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 696aaaed579ac5bf5fa336216909b46d3d8f07a8)
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
block/file-posix.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/block/file-posix.c b/block/file-posix.c
index 07bbdab..f0af144 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -812,6 +812,18 @@ static int raw_handle_perm_lock(BlockDriverState *bs,
switch (op) {
case RAW_PL_PREPARE:
+ if ((s->perm | new_perm) == s->perm &&
+ (s->shared_perm & new_shared) == s->shared_perm)
+ {
+ /*
+ * We are going to unlock bytes, it should not fail. If it fail due
+ * to some fs-dependent permission-unrelated reasons (which occurs
+ * sometimes on NFS and leads to abort in bdrv_replace_child) we
+ * can't prevent such errors by any check here. And we ignore them
+ * anyway in ABORT and COMMIT.
+ */
+ return 0;
+ }
ret = raw_apply_lock_bytes(s, s->fd, s->perm | new_perm,
~s->shared_perm | ~new_shared,
false, errp);
--
1.8.3.1

View File

@ -0,0 +1,183 @@
From 1b9f228788eb2d7f50961241e28f7a9afadc62ab Mon Sep 17 00:00:00 2001
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: Thu, 21 Mar 2019 10:56:08 +0000
Subject: [PATCH 7/9] hostmem-file: reject invalid pmem file sizes
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: <20190321105608.29960-2-stefanha@redhat.com>
Patchwork-id: 85081
O-Subject: [RHEL-AV-8.0.1 qemu-kvm PATCH 1/1] hostmem-file: reject invalid pmem file sizes
Bugzilla: 1669053
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: Pankaj Gupta <pagupta@redhat.com>
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
Guests started with NVDIMMs larger than the underlying host file produce
confusing errors inside the guest. This happens because the guest
accesses pages beyond the end of the file.
Check the pmem file size on startup and print a clear error message if
the size is invalid.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1669053
Cc: Wei Yang <richardw.yang@linux.intel.com>
Cc: Zhang Yi <yi.z.zhang@linux.intel.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20190214031004.32522-3-stefanha@redhat.com>
Reviewed-by: Wei Yang <richardw.yang@linux.intel.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Pankaj Gupta <pagupta@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit 314aec4a6e06844937f1677f6cba21981005f389)
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
backends/hostmem-file.c | 23 +++++++++++++++++++++
include/qemu/osdep.h | 13 ++++++++++++
util/oslib-posix.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++
util/oslib-win32.c | 5 +++++
4 files changed, 94 insertions(+)
diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
index 6630021..8d85d56 100644
--- a/backends/hostmem-file.c
+++ b/backends/hostmem-file.c
@@ -57,6 +57,29 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
#ifndef CONFIG_POSIX
error_setg(errp, "-mem-path not supported on this host");
#else
+
+ /*
+ * Verify pmem file size since starting a guest with an incorrect size
+ * leads to confusing failures inside the guest.
+ */
+ if (fb->is_pmem) {
+ Error *local_err = NULL;
+ uint64_t size;
+
+ size = qemu_get_pmem_size(fb->mem_path, &local_err);
+ if (!size) {
+ error_propagate(errp, local_err);
+ return;
+ }
+
+ if (backend->size > size) {
+ error_setg(errp, "size property %" PRIu64 " is larger than "
+ "pmem file \"%s\" size %" PRIu64, backend->size,
+ fb->mem_path, size);
+ return;
+ }
+ }
+
backend->force_prealloc = mem_prealloc;
path = object_get_canonical_path(OBJECT(backend));
memory_region_init_ram_from_file(&backend->mr, OBJECT(backend),
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 3bf48bc..c68a85b 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -553,6 +553,19 @@ void os_mem_prealloc(int fd, char *area, size_t sz, int smp_cpus,
Error **errp);
/**
+ * qemu_get_pmem_size:
+ * @filename: path to a pmem file
+ * @errp: pointer to a NULL-initialized error object
+ *
+ * Determine the size of a persistent memory file. Besides supporting files on
+ * DAX file systems, this function also supports Linux devdax character
+ * devices.
+ *
+ * Returns: the size or 0 on failure
+ */
+uint64_t qemu_get_pmem_size(const char *filename, Error **errp);
+
+/**
* qemu_get_pid_name:
* @pid: pid of a process
*
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 97b2f3b..b173fc0 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -496,6 +496,59 @@ void os_mem_prealloc(int fd, char *area, size_t memory, int smp_cpus,
}
}
+uint64_t qemu_get_pmem_size(const char *filename, Error **errp)
+{
+ struct stat st;
+
+ if (stat(filename, &st) < 0) {
+ error_setg(errp, "unable to stat pmem file \"%s\"", filename);
+ return 0;
+ }
+
+#if defined(__linux__)
+ /* Special handling for devdax character devices */
+ if (S_ISCHR(st.st_mode)) {
+ char *subsystem_path = NULL;
+ char *subsystem = NULL;
+ char *size_path = NULL;
+ char *size_str = NULL;
+ uint64_t ret = 0;
+
+ subsystem_path = g_strdup_printf("/sys/dev/char/%d:%d/subsystem",
+ major(st.st_rdev), minor(st.st_rdev));
+ subsystem = g_file_read_link(subsystem_path, NULL);
+ if (!subsystem) {
+ error_setg(errp, "unable to read subsystem for pmem file \"%s\"",
+ filename);
+ goto devdax_err;
+ }
+
+ if (!g_str_has_suffix(subsystem, "/dax")) {
+ error_setg(errp, "pmem file \"%s\" is not a dax device", filename);
+ goto devdax_err;
+ }
+
+ size_path = g_strdup_printf("/sys/dev/char/%d:%d/size",
+ major(st.st_rdev), minor(st.st_rdev));
+ if (!g_file_get_contents(size_path, &size_str, NULL, NULL)) {
+ error_setg(errp, "unable to read size for pmem file \"%s\"",
+ size_path);
+ goto devdax_err;
+ }
+
+ ret = g_ascii_strtoull(size_str, NULL, 0);
+
+devdax_err:
+ g_free(size_str);
+ g_free(size_path);
+ g_free(subsystem);
+ g_free(subsystem_path);
+ return ret;
+ }
+#endif /* defined(__linux__) */
+
+ return st.st_size;
+}
char *qemu_get_pid_name(pid_t pid)
{
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index b4c17f5..bd633af 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -560,6 +560,11 @@ void os_mem_prealloc(int fd, char *area, size_t memory, int smp_cpus,
}
}
+uint64_t qemu_get_pmem_size(const char *filename, Error **errp)
+{
+ error_setg(errp, "pmem support not available");
+ return 0;
+}
char *qemu_get_pid_name(pid_t pid)
{
--
1.8.3.1

View File

@ -0,0 +1,62 @@
From 887d5afffeff844b1284b380e53f178f68e15087 Mon Sep 17 00:00:00 2001
From: Thomas Huth <thuth@redhat.com>
Date: Wed, 3 Apr 2019 10:17:09 +0100
Subject: [PATCH 8/9] iotests: Fix test 200 on s390x without virtio-pci
RH-Author: Thomas Huth <thuth@redhat.com>
Message-id: <20190403101709.3284-2-thuth@redhat.com>
Patchwork-id: 85312
O-Subject: [RHEL-AV-8.0.1 qemu-kvm PATCH 1/1] iotests: Fix test 200 on s390x without virtio-pci
Bugzilla: 1687582
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
RH-Acked-by: David Hildenbrand <david@redhat.com>
RH-Acked-by: Max Reitz <mreitz@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
virtio-pci is optional on s390x, e.g. in downstream RHEL builds, it
is disabled. On s390x, virtio-ccw should be used instead. Other tests
like 051 or 240 already use virtio-scsi-ccw instead of virtio-scsi-pci
on s390x, so let's do the same here and always use virtio-scsi-ccw on
s390x.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit e0a59749efc246646bb208e553489b894450cbcd)
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
tests/qemu-iotests/200 | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/tests/qemu-iotests/200 b/tests/qemu-iotests/200
index b9ebd5a..8301ff5 100755
--- a/tests/qemu-iotests/200
+++ b/tests/qemu-iotests/200
@@ -52,13 +52,21 @@ ${QEMU_IMG} create -f $IMGFMT -F $IMGFMT "${TEST_IMG}" -b "${BACKING_IMG}" 512M
${QEMU_IO} -c "write -P 0xa5 512 300M" "${BACKING_IMG}" | _filter_qemu_io
+case "$QEMU_DEFAULT_MACHINE" in
+ s390-ccw-virtio)
+ virtio_scsi="-device virtio-scsi-ccw,id=scsi0,iothread=iothread0"
+ ;;
+ *)
+ virtio_scsi="-device pci-bridge,id=bridge1,chassis_nr=1,bus=pci.0
+ -device virtio-scsi-pci,bus=bridge1,addr=0x1f,id=scsi0,iothread=iothread0"
+ ;;
+esac
+
echo
echo === Starting QEMU VM ===
echo
qemu_comm_method="qmp"
-_launch_qemu -device pci-bridge,id=bridge1,chassis_nr=1,bus=pci.0 \
- -object iothread,id=iothread0 \
- -device virtio-scsi-pci,bus=bridge1,addr=0x1f,id=scsi0,iothread=iothread0 \
+_launch_qemu -object iothread,id=iothread0 $virtio_scsi \
-drive file="${TEST_IMG}",media=disk,if=none,cache=$CACHEMODE,id=drive_sysdisk,format=$IMGFMT \
-device scsi-hd,drive=drive_sysdisk,bus=scsi0.0,id=sysdisk,bootindex=0
h1=$QEMU_HANDLE
--
1.8.3.1

View File

@ -0,0 +1,113 @@
From dcce446158c042fd0aa54a6ebcc61c00f8d4759e Mon Sep 17 00:00:00 2001
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: Mon, 4 Mar 2019 08:54:27 +0000
Subject: [PATCH 4/9] iotests: add LUKS payload overhead to 178 qemu-img
measure test
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: <20190304085427.8148-3-stefanha@redhat.com>
Patchwork-id: 84777
O-Subject: [RHEL-8.0/AV qemu-kvm PATCH 2/2] iotests: add LUKS payload overhead to 178 qemu-img measure test
Bugzilla: 1655065
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
The previous patch includes the LUKS payload overhead into the qemu-img
measure calculation for qcow2. Update qemu-iotests 178 to exercise this
new code path.
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20190218104525.23674-3-stefanha@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
(cherry picked from commit 0482098608b83b559bc1802e4c612051b51f6c4c)
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
tests/qemu-iotests/178 | 8 ++++++++
tests/qemu-iotests/178.out.qcow2 | 24 ++++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/tests/qemu-iotests/178 b/tests/qemu-iotests/178
index 3f4b4a4..927bf06 100755
--- a/tests/qemu-iotests/178
+++ b/tests/qemu-iotests/178
@@ -142,6 +142,14 @@ for ofmt in human json; do
# The backing file doesn't need to exist :)
$QEMU_IMG measure --output=$ofmt -o backing_file=x \
-f "$fmt" -O "$IMGFMT" "$TEST_IMG"
+
+ echo
+ echo "== $fmt input image and LUKS encryption =="
+ echo
+ $QEMU_IMG measure --output=$ofmt \
+ --object secret,id=sec0,data=base \
+ -o encrypt.format=luks,encrypt.key-secret=sec0,encrypt.iter-time=10 \
+ -f "$fmt" -O "$IMGFMT" "$TEST_IMG"
fi
echo
diff --git a/tests/qemu-iotests/178.out.qcow2 b/tests/qemu-iotests/178.out.qcow2
index d42d4a4..55a8dc9 100644
--- a/tests/qemu-iotests/178.out.qcow2
+++ b/tests/qemu-iotests/178.out.qcow2
@@ -68,6 +68,11 @@ converted image file size in bytes: 458752
required size: 1074135040
fully allocated size: 1074135040
+== qcow2 input image and LUKS encryption ==
+
+required size: 2686976
+fully allocated size: 1076232192
+
== qcow2 input image and preallocation (human) ==
required size: 1074135040
@@ -114,6 +119,11 @@ converted image file size in bytes: 524288
required size: 1074135040
fully allocated size: 1074135040
+== raw input image and LUKS encryption ==
+
+required size: 2686976
+fully allocated size: 1076232192
+
== raw input image and preallocation (human) ==
required size: 1074135040
@@ -205,6 +215,13 @@ converted image file size in bytes: 458752
"fully-allocated": 1074135040
}
+== qcow2 input image and LUKS encryption ==
+
+{
+ "required": 2686976,
+ "fully-allocated": 1076232192
+}
+
== qcow2 input image and preallocation (json) ==
{
@@ -263,6 +280,13 @@ converted image file size in bytes: 524288
"fully-allocated": 1074135040
}
+== raw input image and LUKS encryption ==
+
+{
+ "required": 2686976,
+ "fully-allocated": 1076232192
+}
+
== raw input image and preallocation (json) ==
{
--
1.8.3.1

View File

@ -0,0 +1,148 @@
From e5d1850f80df1b548b1c3bdc0914e7790702d543 Mon Sep 17 00:00:00 2001
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: Mon, 4 Mar 2019 08:54:26 +0000
Subject: [PATCH 3/9] qcow2: include LUKS payload overhead in qemu-img measure
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: <20190304085427.8148-2-stefanha@redhat.com>
Patchwork-id: 84778
O-Subject: [RHEL-8.0/AV qemu-kvm PATCH 1/2] qcow2: include LUKS payload overhead in qemu-img measure
Bugzilla: 1655065
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
LUKS encryption reserves clusters for its own payload data. The size of
this area must be included in the qemu-img measure calculation so that
we arrive at the correct minimum required image size.
(Ab)use the qcrypto_block_create() API to determine the payload
overhead. We discard the payload data that qcrypto thinks will be
written to the image.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190218104525.23674-2-stefanha@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
(cherry picked from commit 61914f8906fabbae26372a576d9dd988c5e22b75)
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
block/qcow2.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 71 insertions(+), 1 deletion(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 991d6ac..1b41e4c 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -4113,6 +4113,60 @@ static coroutine_fn int qcow2_co_flush_to_os(BlockDriverState *bs)
return ret;
}
+static ssize_t qcow2_measure_crypto_hdr_init_func(QCryptoBlock *block,
+ size_t headerlen, void *opaque, Error **errp)
+{
+ size_t *headerlenp = opaque;
+
+ /* Stash away the payload size */
+ *headerlenp = headerlen;
+ return 0;
+}
+
+static ssize_t qcow2_measure_crypto_hdr_write_func(QCryptoBlock *block,
+ size_t offset, const uint8_t *buf, size_t buflen,
+ void *opaque, Error **errp)
+{
+ /* Discard the bytes, we're not actually writing to an image */
+ return buflen;
+}
+
+/* Determine the number of bytes for the LUKS payload */
+static bool qcow2_measure_luks_headerlen(QemuOpts *opts, size_t *len,
+ Error **errp)
+{
+ QDict *opts_qdict;
+ QDict *cryptoopts_qdict;
+ QCryptoBlockCreateOptions *cryptoopts;
+ QCryptoBlock *crypto;
+
+ /* Extract "encrypt." options into a qdict */
+ opts_qdict = qemu_opts_to_qdict(opts, NULL);
+ qdict_extract_subqdict(opts_qdict, &cryptoopts_qdict, "encrypt.");
+ qobject_unref(opts_qdict);
+
+ /* Build QCryptoBlockCreateOptions object from qdict */
+ qdict_put_str(cryptoopts_qdict, "format", "luks");
+ cryptoopts = block_crypto_create_opts_init(cryptoopts_qdict, errp);
+ qobject_unref(cryptoopts_qdict);
+ if (!cryptoopts) {
+ return false;
+ }
+
+ /* Fake LUKS creation in order to determine the payload size */
+ crypto = qcrypto_block_create(cryptoopts, "encrypt.",
+ qcow2_measure_crypto_hdr_init_func,
+ qcow2_measure_crypto_hdr_write_func,
+ len, errp);
+ qapi_free_QCryptoBlockCreateOptions(cryptoopts);
+ if (!crypto) {
+ return false;
+ }
+
+ qcrypto_block_free(crypto);
+ return true;
+}
+
static BlockMeasureInfo *qcow2_measure(QemuOpts *opts, BlockDriverState *in_bs,
Error **errp)
{
@@ -4122,11 +4176,13 @@ static BlockMeasureInfo *qcow2_measure(QemuOpts *opts, BlockDriverState *in_bs,
uint64_t virtual_size; /* disk size as seen by guest */
uint64_t refcount_bits;
uint64_t l2_tables;
+ uint64_t luks_payload_size = 0;
size_t cluster_size;
int version;
char *optstr;
PreallocMode prealloc;
bool has_backing_file;
+ bool has_luks;
/* Parse image creation options */
cluster_size = qcow2_opt_get_cluster_size_del(opts, &local_err);
@@ -4156,6 +4212,20 @@ static BlockMeasureInfo *qcow2_measure(QemuOpts *opts, BlockDriverState *in_bs,
has_backing_file = !!optstr;
g_free(optstr);
+ optstr = qemu_opt_get_del(opts, BLOCK_OPT_ENCRYPT_FORMAT);
+ has_luks = optstr && strcmp(optstr, "luks") == 0;
+ g_free(optstr);
+
+ if (has_luks) {
+ size_t headerlen;
+
+ if (!qcow2_measure_luks_headerlen(opts, &headerlen, &local_err)) {
+ goto err;
+ }
+
+ luks_payload_size = ROUND_UP(headerlen, cluster_size);
+ }
+
virtual_size = qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0);
virtual_size = ROUND_UP(virtual_size, cluster_size);
@@ -4226,7 +4296,7 @@ static BlockMeasureInfo *qcow2_measure(QemuOpts *opts, BlockDriverState *in_bs,
info = g_new(BlockMeasureInfo, 1);
info->fully_allocated =
qcow2_calc_prealloc_size(virtual_size, cluster_size,
- ctz32(refcount_bits));
+ ctz32(refcount_bits)) + luks_payload_size;
/* Remove data clusters that are not required. This overestimates the
* required size because metadata needed for the fully allocated file is
--
1.8.3.1

View File

@ -31,10 +31,19 @@ kvm_setup_powerpc () {
fi
}
kvm_setup_s390x () {
if grep -q "^features.*sie" /proc/cpuinfo; then
modprobe kvm
fi
}
case $(uname -m) in
ppc64|ppc64le)
kvm_setup_powerpc
;;
s390x)
kvm_setup_s390x
;;
esac
exit 0

View File

@ -0,0 +1,74 @@
From 2744bd7eb7955e7ae995a48784760e48c33c1e73 Mon Sep 17 00:00:00 2001
From: David Gibson <dgibson@redhat.com>
Date: Wed, 27 Feb 2019 04:54:34 +0000
Subject: [PATCH 2/9] spapr: fix out of bounds write in spapr_populate_drmem_v2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: David Gibson <dgibson@redhat.com>
Message-id: <20190227045434.23465-1-dgibson@redhat.com>
Patchwork-id: 84720
O-Subject: [RHELAV-8.1 qemu-kvm PATCH] spapr: fix out of bounds write in spapr_populate_drmem_v2
Bugzilla: 1674438
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Serhii Popovych <spopovyc@redhat.com>
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
From: Fabiano Rosas <farosas@linux.ibm.com>
buf_len is uint8_t which is not large enough to hold the result of:
nr_entries * sizeof(struct sPAPRDrconfCellV2) + sizeof(uint32_t);
for a nr_entries greater than 10.
This causes the allocated buffer 'int_buf' to be smaller than expected
and we eventually overwrite some of glibc's control structures (see
"chunk" in https://sourceware.org/glibc/wiki/MallocInternals)
The following error is seen while trying to free int_buf:
"free(): invalid next size (fast)"
Fixes: a324d6f166 "spapr: Support ibm,dynamic-memory-v2 property"
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Message-Id: <20190213172926.21740-1-farosas@linux.ibm.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
(cherry picked from commit cc941111a5bc5f498185fa3824c3b6579c7d45ad)
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1674438
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=20382722
Branch: rhel8/master-3.1.0
Signed-off-by: David Gibson <dgibson@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
hw/ppc/spapr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index bd2abb7..c1478bf 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -688,14 +688,14 @@ static int spapr_populate_drmem_v2(sPAPRMachineState *spapr, void *fdt,
int offset, MemoryDeviceInfoList *dimms)
{
MachineState *machine = MACHINE(spapr);
- uint8_t *int_buf, *cur_index, buf_len;
+ uint8_t *int_buf, *cur_index;
int ret;
uint64_t lmb_size = SPAPR_MEMORY_BLOCK_SIZE;
uint64_t addr, cur_addr, size;
uint32_t nr_boot_lmbs = (machine->device_memory->base / lmb_size);
uint64_t mem_end = machine->device_memory->base +
memory_region_size(&machine->device_memory->mr);
- uint32_t node, nr_entries = 0;
+ uint32_t node, buf_len, nr_entries = 0;
sPAPRDRConnector *drc;
DrconfCellQueue *elem, *next;
MemoryDeviceInfoList *info;
--
1.8.3.1

View File

@ -0,0 +1,95 @@
From c233fdd40580baf460b34655aa72a9a489b4501b Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Thu, 7 Mar 2019 09:11:50 +0000
Subject: [PATCH 5/9] vnc: detect and optimize pageflips
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <20190307091150.6551-2-kraxel@redhat.com>
Patchwork-id: 84816
O-Subject: [RHEL-8.0/AV qemu-kvm PATCH 1/1] vnc: detect and optimize pageflips
Bugzilla: 1666206
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: John Snow <jsnow@redhat.com>
When size and format of the display surface stays the same we can just
tag the guest display as dirty and be done with it.
There is no need need to resize the vnc server display or to touch the
vnc client dirty bits. On the next refresh cycle
vnc_refresh_server_surface() will check for actual display content
changes and update the client dirty bits as needed.
The desktop resize and framebuffer format notifications to the vnc
client will be skipped too.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20190116101049.8929-1-kraxel@redhat.com
(cherry picked from commit 61e77a5f0c788495566aecb437bcf6b2cf9cda97)
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
ui/vnc.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/ui/vnc.c b/ui/vnc.c
index d7903a7..765bdc5 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -742,6 +742,17 @@ static void vnc_update_server_surface(VncDisplay *vd)
width, height);
}
+static bool vnc_check_pageflip(DisplaySurface *s1,
+ DisplaySurface *s2)
+{
+ return (s1 != NULL &&
+ s2 != NULL &&
+ surface_width(s1) == surface_width(s2) &&
+ surface_height(s1) == surface_height(s2) &&
+ surface_format(s1) == surface_format(s2));
+
+}
+
static void vnc_dpy_switch(DisplayChangeListener *dcl,
DisplaySurface *surface)
{
@@ -749,6 +760,7 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl,
"Display output is not active.";
static DisplaySurface *placeholder;
VncDisplay *vd = container_of(dcl, VncDisplay, dcl);
+ bool pageflip = vnc_check_pageflip(vd->ds, surface);
VncState *vs;
if (surface == NULL) {
@@ -761,14 +773,21 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl,
vnc_abort_display_jobs(vd);
vd->ds = surface;
- /* server surface */
- vnc_update_server_surface(vd);
-
/* guest surface */
qemu_pixman_image_unref(vd->guest.fb);
vd->guest.fb = pixman_image_ref(surface->image);
vd->guest.format = surface->format;
+ if (pageflip) {
+ vnc_set_area_dirty(vd->guest.dirty, vd, 0, 0,
+ surface_width(surface),
+ surface_height(surface));
+ return;
+ }
+
+ /* server surface */
+ vnc_update_server_surface(vd);
+
QTAILQ_FOREACH(vs, &vd->clients, next) {
vnc_colordepth(vs);
vnc_desktop_resize(vs);
--
1.8.3.1

View File

@ -39,6 +39,7 @@
%endif
%ifarch s390x
%global kvm_target s390x
%global have_kvm_setup 1
%endif
%ifarch ppc
%global kvm_target ppc
@ -68,7 +69,7 @@ Obsoletes: %1-rhev
Summary: QEMU is a machine emulator and virtualizer
Name: qemu-kvm
Version: 3.1.0
Release: 20%{?dist}
Release: 21%{?dist}
# Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped
Epoch: 15
License: GPLv2 and GPLv2+ and CC-BY
@ -222,6 +223,20 @@ Patch67: kvm-migration-Fix-cancel-state.patch
Patch68: kvm-migration-rdma-Fix-qemu_rdma_cleanup-null-check.patch
# For bz#1686260 - stibp is missing on qemu 3.0 and qemu 3.1
Patch69: kvm-i386-Add-stibp-flag-name.patch
# For bz#1674438 - RHEL8.0 - Guest reboot fails after memory hotplug multiple times (kvm)
Patch71: kvm-spapr-fix-out-of-bounds-write-in-spapr_populate_drme.patch
# For bz#1655065 - [rhel.8.0][fast train]'qemu-img measure' size does not match the real allocated size for luks-inside-qcow2 image
Patch72: kvm-qcow2-include-LUKS-payload-overhead-in-qemu-img-meas.patch
# For bz#1655065 - [rhel.8.0][fast train]'qemu-img measure' size does not match the real allocated size for luks-inside-qcow2 image
Patch73: kvm-iotests-add-LUKS-payload-overhead-to-178-qemu-img-me.patch
# For bz#1666206 - vnc server should detect page-flips and avoid sending fullscreen updates then.
Patch74: kvm-vnc-detect-and-optimize-pageflips.patch
# For bz#1669053 - Guest call trace when boot with nvdimm device backed by /dev/dax
Patch76: kvm-hostmem-file-reject-invalid-pmem-file-sizes.patch
# For bz#1687582 - QEMU IOTEST 200 fails with 'virtio-scsi-pci is not a valid device model name'
Patch77: kvm-iotests-Fix-test-200-on-s390x-without-virtio-pci.patch
# For bz#1652572 - QEMU core dumped if stop nfs service during migration
Patch78: kvm-block-file-posix-do-not-fail-on-unlock-bytes.patch
BuildRequires: zlib-devel
BuildRequires: glib2-devel
@ -366,6 +381,7 @@ Requires: glusterfs-api >= 3.6.0
%endif
%if %{have_kvm_setup}
Requires(post): systemd-units
Requires(preun): systemd-units
%ifarch %{power64}
Requires: powerpc-utils
%endif
@ -929,8 +945,8 @@ chmod +x $RPM_BUILD_ROOT%{_libdir}/qemu-kvm/block-*.so
export DIFF=diff; make check V=1
pushd tests/qemu-iotests
./check -v -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 045 048 052 063 077 086 101 104 106 120 132 140 143 145 147 150 152 157 159 160 162 170 171 175 181 184 194 205 208 218 221 222 226 227 232
./check -v -qcow2 001 002 003 004 005 007 008 009 010 011 012 013 017 018 019 020 021 022 024 025 027 028 029 031 032 033 034 035 036 037 038 039 042 043 046 047 048 049 050 052 053 054 056 057 058 060 061 062 063 065 066 068 069 072 073 074 080 085 086 087 089 090 091 095 096 097 098 102 103 104 105 107 108 110 111 114 117 120 122 126 127 130 132 133 134 137 138 140 141 142 143 144 145 147 150 151 152 154 156 157 158 159 162 165 170 174 176 177 179 181 184 187 188 189 190 191 194 195 196 198 201 202 203 204 205 206 208 209 214 216 217 218 222 223 226 227 232
./check -v -luks 001 002 003 004 005 008 009 010 011 012 021 032 033 048 052 140 143 145 157 162 174 181 184 208 218 227
./check -v -qcow2 001 002 003 004 005 007 008 009 010 011 012 017 018 019 020 021 022 024 025 027 028 029 031 032 033 034 035 036 037 038 039 042 043 046 047 048 049 050 052 053 054 056 057 058 062 063 065 066 068 069 072 073 074 080 085 086 087 089 090 091 095 096 097 098 102 103 104 105 107 108 110 111 114 117 120 126 127 130 132 133 134 137 138 140 141 142 143 144 145 147 150 151 152 156 157 158 159 162 165 170 174 177 179 181 184 187 188 189 190 191 194 195 196 198 201 202 203 204 205 206 208 209 214 216 217 218 222 223 226 227 232
./check -v -luks 001 002 003 004 005 008 009 010 011 012 021 032 033 052 140 143 145 157 162 174 181 184 208 218 227
./check -v -nbd 001 002 003 004 005 008 009 010 011 021 032 033 045 077 094 104 119 123 132 143 145 147 151 152 162 181 184 194 205 208 218 222
popd
@ -948,6 +964,11 @@ sh %{_sysconfdir}/sysconfig/modules/kvm.modules &> /dev/null || :
fi
%endif
%if %{have_kvm_setup}
%preun -n qemu-kvm-core
%systemd_preun kvm-setup.service
%endif
%post -n qemu-kvm-common
%systemd_post ksm.service
%systemd_post ksmtuned.service
@ -1114,6 +1135,35 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
%changelog
* Thu Apr 11 2019 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 3.1.0-21.el8
- kvm-Remove-7-qcow2-and-luks-iotests-that-are-taking-25-s.patch [bz#1683473]
- kvm-spapr-fix-out-of-bounds-write-in-spapr_populate_drme.patch [bz#1674438]
- kvm-qcow2-include-LUKS-payload-overhead-in-qemu-img-meas.patch [bz#1655065]
- kvm-iotests-add-LUKS-payload-overhead-to-178-qemu-img-me.patch [bz#1655065]
- kvm-vnc-detect-and-optimize-pageflips.patch [bz#1666206]
- kvm-Load-kvm-module-during-boot.patch [bz#1676907 bz#1685995]
- kvm-hostmem-file-reject-invalid-pmem-file-sizes.patch [bz#1669053]
- kvm-iotests-Fix-test-200-on-s390x-without-virtio-pci.patch [bz#1687582]
- kvm-block-file-posix-do-not-fail-on-unlock-bytes.patch [bz#1652572]
- Resolves: bz#1652572
(QEMU core dumped if stop nfs service during migration)
- Resolves: bz#1655065
([rhel.8.0][fast train]'qemu-img measure' size does not match the real allocated size for luks-inside-qcow2 image)
- Resolves: bz#1666206
(vnc server should detect page-flips and avoid sending fullscreen updates then.)
- Resolves: bz#1669053
(Guest call trace when boot with nvdimm device backed by /dev/dax)
- Resolves: bz#1674438
(RHEL8.0 - Guest reboot fails after memory hotplug multiple times (kvm))
- Resolves: bz#1676907
(/dev/kvm device exists but kernel module is not loaded on boot up causing VM start to fail in libvirt)
- Resolves: bz#1683473
(Remove 7 qcow2 & luks iotests from rhel8 fast train build %check phase)
- Resolves: bz#1685995
(/dev/kvm device exists but kernel module is not loaded on boot up causing VM start to fail in libvirt)
- Resolves: bz#1687582
(QEMU IOTEST 200 fails with 'virtio-scsi-pci is not a valid device model name')
* Fri Mar 15 2019 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 3.1.0-20.el8
- kvm-i386-Add-stibp-flag-name.patch [bz#1686260]
- Resolves: bz#1686260