Blame SOURCES/kvm-s390x-fix-storage-attributes-migration-for-non-small.patch

8535f5
From 56c0724bf309a7d6d89f2aba0d38147b1e77954f Mon Sep 17 00:00:00 2001
8535f5
From: Cornelia Huck <cohuck@redhat.com>
8535f5
Date: Fri, 29 Jun 2018 12:57:01 +0200
8535f5
Subject: [PATCH 3/3] s390x: fix storage attributes migration for non-small
8535f5
 guests
8535f5
8535f5
RH-Author: Cornelia Huck <cohuck@redhat.com>
8535f5
Message-id: <20180629125701.12755-1-cohuck@redhat.com>
8535f5
Patchwork-id: 81166
8535f5
O-Subject: [RHEL-7.5.z qemu-kvm-ma PATCH] s390x: fix storage attributes migration for non-small guests
8535f5
Bugzilla: 1596553
8535f5
RH-Acked-by: David Hildenbrand <david@redhat.com>
8535f5
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
8535f5
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
8535f5
8535f5
From: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
8535f5
8535f5
Fix storage attribute migration so that it does not fail for guests
8535f5
with more than a few GB of RAM.
8535f5
With such guests, the index in the buffer would go out of bounds,
8535f5
usually by large amounts, thus receiving -EFAULT from the kernel.
8535f5
Migration itself would be successful, but storage attributes would then
8535f5
not be migrated completely.
8535f5
8535f5
This patch fixes the out of bounds access, and thus migration of all
8535f5
storage attributes when the guest have large amounts of memory.
8535f5
8535f5
Cc: qemu-stable@nongnu.org
8535f5
Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
8535f5
Fixes: 903fd80b03243476 ("s390x/migration: Storage attributes device")
8535f5
Message-Id: <1516297904-18188-1-git-send-email-imbrenda@linux.vnet.ibm.com>
8535f5
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
8535f5
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
8535f5
(cherry picked from commit 46fa893355e0bd88f3c59b886f0d75cbd5f0bbbe)
8535f5
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
8535f5
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
8535f5
---
8535f5
 hw/s390x/s390-stattrib-kvm.c | 4 ++--
8535f5
 1 file changed, 2 insertions(+), 2 deletions(-)
8535f5
8535f5
diff --git a/hw/s390x/s390-stattrib-kvm.c b/hw/s390x/s390-stattrib-kvm.c
8535f5
index bc0274d..1212c47 100644
8535f5
--- a/hw/s390x/s390-stattrib-kvm.c
8535f5
+++ b/hw/s390x/s390-stattrib-kvm.c
8535f5
@@ -115,7 +115,7 @@ static void kvm_s390_stattrib_synchronize(S390StAttribState *sa)
8535f5
         for (cx = 0; cx + len <= max; cx += len) {
8535f5
             clog.start_gfn = cx;
8535f5
             clog.count = len;
8535f5
-            clog.values = (uint64_t)(sas->incoming_buffer + cx * len);
8535f5
+            clog.values = (uint64_t)(sas->incoming_buffer + cx);
8535f5
             r = kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &clog);
8535f5
             if (r) {
8535f5
                 error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror(-r));
8535f5
@@ -125,7 +125,7 @@ static void kvm_s390_stattrib_synchronize(S390StAttribState *sa)
8535f5
         if (cx < max) {
8535f5
             clog.start_gfn = cx;
8535f5
             clog.count = max - cx;
8535f5
-            clog.values = (uint64_t)(sas->incoming_buffer + cx * len);
8535f5
+            clog.values = (uint64_t)(sas->incoming_buffer + cx);
8535f5
             r = kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &clog);
8535f5
             if (r) {
8535f5
                 error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror(-r));
8535f5
-- 
8535f5
1.8.3.1
8535f5