qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 1/1] s390x: fix storage attributes migration for non-small guests
@ 2018-01-18 17:51 Claudio Imbrenda
  2018-01-19 11:54 ` Cornelia Huck
  2018-01-19 12:17 ` Christian Borntraeger
  0 siblings, 2 replies; 4+ messages in thread
From: Claudio Imbrenda @ 2018-01-18 17:51 UTC (permalink / raw)
  To: cohuck; +Cc: qemu-devel, qemu-s390x, borntraeger

Fix storage attribute migration so that it does not fail for guests
with more than a few GB of RAM.
With such guests, the index in the buffer would go out of bounds,
usually by large amounts, thus receiving -EFAULT from the kernel.
Migration itself would be successful, but storage attributes would then
not be migrated completely.

This patch fixes the out of bounds access, and thus migration of all
storage attributes when the guest have large amounts of memory.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Fixes: 903fd80b03243476 ("s390x/migration: Storage attributes device")
---
 hw/s390x/s390-stattrib-kvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/s390x/s390-stattrib-kvm.c b/hw/s390x/s390-stattrib-kvm.c
index 41770a7..480551c 100644
--- a/hw/s390x/s390-stattrib-kvm.c
+++ b/hw/s390x/s390-stattrib-kvm.c
@@ -116,7 +116,7 @@ static void kvm_s390_stattrib_synchronize(S390StAttribState *sa)
         for (cx = 0; cx + len <= max; cx += len) {
             clog.start_gfn = cx;
             clog.count = len;
-            clog.values = (uint64_t)(sas->incoming_buffer + cx * len);
+            clog.values = (uint64_t)(sas->incoming_buffer + cx);
             r = kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &clog);
             if (r) {
                 error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror(-r));
@@ -126,7 +126,7 @@ static void kvm_s390_stattrib_synchronize(S390StAttribState *sa)
         if (cx < max) {
             clog.start_gfn = cx;
             clog.count = max - cx;
-            clog.values = (uint64_t)(sas->incoming_buffer + cx * len);
+            clog.values = (uint64_t)(sas->incoming_buffer + cx);
             r = kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &clog);
             if (r) {
                 error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror(-r));
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/1] s390x: fix storage attributes migration for non-small guests
  2018-01-18 17:51 [Qemu-devel] [PATCH v2 1/1] s390x: fix storage attributes migration for non-small guests Claudio Imbrenda
@ 2018-01-19 11:54 ` Cornelia Huck
  2018-01-19 12:17 ` Christian Borntraeger
  1 sibling, 0 replies; 4+ messages in thread
From: Cornelia Huck @ 2018-01-19 11:54 UTC (permalink / raw)
  To: Claudio Imbrenda; +Cc: qemu-devel, qemu-s390x, borntraeger

On Thu, 18 Jan 2018 18:51:44 +0100
Claudio Imbrenda <imbrenda@linux.vnet.ibm.com> wrote:

> Fix storage attribute migration so that it does not fail for guests
> with more than a few GB of RAM.
> With such guests, the index in the buffer would go out of bounds,
> usually by large amounts, thus receiving -EFAULT from the kernel.
> Migration itself would be successful, but storage attributes would then
> not be migrated completely.
> 
> This patch fixes the out of bounds access, and thus migration of all
> storage attributes when the guest have large amounts of memory.
> 
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
> Fixes: 903fd80b03243476 ("s390x/migration: Storage attributes device")
> ---
>  hw/s390x/s390-stattrib-kvm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Thanks, applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/1] s390x: fix storage attributes migration for non-small guests
  2018-01-18 17:51 [Qemu-devel] [PATCH v2 1/1] s390x: fix storage attributes migration for non-small guests Claudio Imbrenda
  2018-01-19 11:54 ` Cornelia Huck
@ 2018-01-19 12:17 ` Christian Borntraeger
  2018-01-19 12:26   ` Cornelia Huck
  1 sibling, 1 reply; 4+ messages in thread
From: Christian Borntraeger @ 2018-01-19 12:17 UTC (permalink / raw)
  To: Claudio Imbrenda, cohuck; +Cc: qemu-devel, qemu-s390x



On 01/18/2018 06:51 PM, Claudio Imbrenda wrote:
> Fix storage attribute migration so that it does not fail for guests
> with more than a few GB of RAM.
> With such guests, the index in the buffer would go out of bounds,
> usually by large amounts, thus receiving -EFAULT from the kernel.
> Migration itself would be successful, but storage attributes would then
> not be migrated completely.
> 
> This patch fixes the out of bounds access, and thus migration of all
> storage attributes when the guest have large amounts of memory.
> 
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
> Fixes: 903fd80b03243476 ("s390x/migration: Storage attributes device")

Cc: stable ?

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>

> ---
>  hw/s390x/s390-stattrib-kvm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/s390x/s390-stattrib-kvm.c b/hw/s390x/s390-stattrib-kvm.c
> index 41770a7..480551c 100644
> --- a/hw/s390x/s390-stattrib-kvm.c
> +++ b/hw/s390x/s390-stattrib-kvm.c
> @@ -116,7 +116,7 @@ static void kvm_s390_stattrib_synchronize(S390StAttribState *sa)
>          for (cx = 0; cx + len <= max; cx += len) {
>              clog.start_gfn = cx;
>              clog.count = len;
> -            clog.values = (uint64_t)(sas->incoming_buffer + cx * len);
> +            clog.values = (uint64_t)(sas->incoming_buffer + cx);
>              r = kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &clog);
>              if (r) {
>                  error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror(-r));
> @@ -126,7 +126,7 @@ static void kvm_s390_stattrib_synchronize(S390StAttribState *sa)
>          if (cx < max) {
>              clog.start_gfn = cx;
>              clog.count = max - cx;
> -            clog.values = (uint64_t)(sas->incoming_buffer + cx * len);
> +            clog.values = (uint64_t)(sas->incoming_buffer + cx);
>              r = kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &clog);
>              if (r) {
>                  error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror(-r));
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/1] s390x: fix storage attributes migration for non-small guests
  2018-01-19 12:17 ` Christian Borntraeger
@ 2018-01-19 12:26   ` Cornelia Huck
  0 siblings, 0 replies; 4+ messages in thread
From: Cornelia Huck @ 2018-01-19 12:26 UTC (permalink / raw)
  To: Christian Borntraeger; +Cc: Claudio Imbrenda, qemu-devel, qemu-s390x

On Fri, 19 Jan 2018 13:17:29 +0100
Christian Borntraeger <borntraeger@de.ibm.com> wrote:

> On 01/18/2018 06:51 PM, Claudio Imbrenda wrote:
> > Fix storage attribute migration so that it does not fail for guests
> > with more than a few GB of RAM.
> > With such guests, the index in the buffer would go out of bounds,
> > usually by large amounts, thus receiving -EFAULT from the kernel.
> > Migration itself would be successful, but storage attributes would then
> > not be migrated completely.
> > 
> > This patch fixes the out of bounds access, and thus migration of all
> > storage attributes when the guest have large amounts of memory.
> > 
> > Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
> > Fixes: 903fd80b03243476 ("s390x/migration: Storage attributes device")  
> 
> Cc: stable ?

Probably doesn't hurt for an out-of-bounds error.

> 
> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
> 
> > ---
> >  hw/s390x/s390-stattrib-kvm.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)

Updated the queued patch, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-19 12:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-18 17:51 [Qemu-devel] [PATCH v2 1/1] s390x: fix storage attributes migration for non-small guests Claudio Imbrenda
2018-01-19 11:54 ` Cornelia Huck
2018-01-19 12:17 ` Christian Borntraeger
2018-01-19 12:26   ` Cornelia Huck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).