* [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem
[not found] ` <51A85DE8.2090600@redhat.com>
@ 2013-05-31 8:52 ` Xiao Guangrong
2013-05-31 12:27 ` Paolo Bonzini
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Xiao Guangrong @ 2013-05-31 8:52 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Jordan Justen, qemu-devel, Justen, Jordan L, Luiz Capitulino,
Gleb Natapov, KVM
Luiz Capitulino reported that guest refused to boot and qemu
complained with:
kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
It is caused by commit 235e8982ad that did double free for the memslot
so that the second one raises the -EINVAL error
Fix it by reset memory size only if it is needed
Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
---
kvm-all.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index 8e7bbf8..405480e 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)
if (s->migration_log) {
mem.flags |= KVM_MEM_LOG_DIRTY_PAGES;
}
- if (mem.flags & KVM_MEM_READONLY) {
+
+ if (slot->memory_size && mem.flags & KVM_MEM_READONLY) {
/* Set the slot size to 0 before setting the slot to the desired
* value. This is needed based on KVM commit 75d61fbc. */
mem.memory_size = 0;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem
2013-05-31 8:52 ` [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem Xiao Guangrong
@ 2013-05-31 12:27 ` Paolo Bonzini
2013-05-31 12:39 ` Luiz Capitulino
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2013-05-31 12:27 UTC (permalink / raw)
To: Xiao Guangrong
Cc: Jordan Justen, qemu-devel, Justen, Jordan L, Luiz Capitulino,
Gleb Natapov, KVM
Il 31/05/2013 10:52, Xiao Guangrong ha scritto:
> Luiz Capitulino reported that guest refused to boot and qemu
> complained with:
> kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
>
> It is caused by commit 235e8982ad that did double free for the memslot
> so that the second one raises the -EINVAL error
>
> Fix it by reset memory size only if it is needed
>
> Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
> ---
> kvm-all.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/kvm-all.c b/kvm-all.c
> index 8e7bbf8..405480e 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)
> if (s->migration_log) {
> mem.flags |= KVM_MEM_LOG_DIRTY_PAGES;
> }
> - if (mem.flags & KVM_MEM_READONLY) {
> +
> + if (slot->memory_size && mem.flags & KVM_MEM_READONLY) {
> /* Set the slot size to 0 before setting the slot to the desired
> * value. This is needed based on KVM commit 75d61fbc. */
> mem.memory_size = 0;
>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem
2013-05-31 8:52 ` [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem Xiao Guangrong
2013-05-31 12:27 ` Paolo Bonzini
@ 2013-05-31 12:39 ` Luiz Capitulino
2013-06-02 17:35 ` [Qemu-devel] " Richard W.M. Jones
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Luiz Capitulino @ 2013-05-31 12:39 UTC (permalink / raw)
To: Xiao Guangrong
Cc: Gleb Natapov, KVM, Justen, Jordan L, qemu-devel, Paolo Bonzini,
Jordan Justen
On Fri, 31 May 2013 16:52:18 +0800
Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> wrote:
> Luiz Capitulino reported that guest refused to boot and qemu
> complained with:
> kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
>
> It is caused by commit 235e8982ad that did double free for the memslot
> so that the second one raises the -EINVAL error
>
> Fix it by reset memory size only if it is needed
>
> Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Tested-by: Luiz Capitulino <lcapitulino@redhat.com>
Thanks Xiao for the fix, and thanks everyone for debugging this issue!
> ---
> kvm-all.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/kvm-all.c b/kvm-all.c
> index 8e7bbf8..405480e 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)
> if (s->migration_log) {
> mem.flags |= KVM_MEM_LOG_DIRTY_PAGES;
> }
> - if (mem.flags & KVM_MEM_READONLY) {
> +
> + if (slot->memory_size && mem.flags & KVM_MEM_READONLY) {
> /* Set the slot size to 0 before setting the slot to the desired
> * value. This is needed based on KVM commit 75d61fbc. */
> mem.memory_size = 0;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem
2013-05-31 8:52 ` [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem Xiao Guangrong
2013-05-31 12:27 ` Paolo Bonzini
2013-05-31 12:39 ` Luiz Capitulino
@ 2013-06-02 17:35 ` Richard W.M. Jones
2013-06-02 22:08 ` Jordan Justen
2013-06-03 6:57 ` Gleb Natapov
4 siblings, 0 replies; 6+ messages in thread
From: Richard W.M. Jones @ 2013-06-02 17:35 UTC (permalink / raw)
To: Xiao Guangrong
Cc: Paolo Bonzini, Gleb Natapov, KVM, Justen, Jordan L, qemu-devel,
Luiz Capitulino, Jordan Justen
On Fri, May 31, 2013 at 04:52:18PM +0800, Xiao Guangrong wrote:
> Luiz Capitulino reported that guest refused to boot and qemu
> complained with:
> kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
>
> It is caused by commit 235e8982ad that did double free for the memslot
> so that the second one raises the -EINVAL error
>
> Fix it by reset memory size only if it is needed
>
> Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
> ---
> kvm-all.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/kvm-all.c b/kvm-all.c
> index 8e7bbf8..405480e 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)
> if (s->migration_log) {
> mem.flags |= KVM_MEM_LOG_DIRTY_PAGES;
> }
> - if (mem.flags & KVM_MEM_READONLY) {
> +
> + if (slot->memory_size && mem.flags & KVM_MEM_READONLY) {
> /* Set the slot size to 0 before setting the slot to the desired
> * value. This is needed based on KVM commit 75d61fbc. */
> mem.memory_size = 0;
Tested and fixes it for me too.
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem
2013-05-31 8:52 ` [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem Xiao Guangrong
` (2 preceding siblings ...)
2013-06-02 17:35 ` [Qemu-devel] " Richard W.M. Jones
@ 2013-06-02 22:08 ` Jordan Justen
2013-06-03 6:57 ` Gleb Natapov
4 siblings, 0 replies; 6+ messages in thread
From: Jordan Justen @ 2013-06-02 22:08 UTC (permalink / raw)
To: Xiao Guangrong
Cc: Paolo Bonzini, qemu-devel, Justen, Jordan L, Luiz Capitulino,
Gleb Natapov, KVM
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
On Fri, May 31, 2013 at 1:52 AM, Xiao Guangrong
<xiaoguangrong@linux.vnet.ibm.com> wrote:
> Luiz Capitulino reported that guest refused to boot and qemu
> complained with:
> kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
>
> It is caused by commit 235e8982ad that did double free for the memslot
> so that the second one raises the -EINVAL error
>
> Fix it by reset memory size only if it is needed
>
> Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
> ---
> kvm-all.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/kvm-all.c b/kvm-all.c
> index 8e7bbf8..405480e 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)
> if (s->migration_log) {
> mem.flags |= KVM_MEM_LOG_DIRTY_PAGES;
> }
> - if (mem.flags & KVM_MEM_READONLY) {
> +
> + if (slot->memory_size && mem.flags & KVM_MEM_READONLY) {
> /* Set the slot size to 0 before setting the slot to the desired
> * value. This is needed based on KVM commit 75d61fbc. */
> mem.memory_size = 0;
> --
> 1.7.7.6
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem
2013-05-31 8:52 ` [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem Xiao Guangrong
` (3 preceding siblings ...)
2013-06-02 22:08 ` Jordan Justen
@ 2013-06-03 6:57 ` Gleb Natapov
4 siblings, 0 replies; 6+ messages in thread
From: Gleb Natapov @ 2013-06-03 6:57 UTC (permalink / raw)
To: Xiao Guangrong
Cc: Paolo Bonzini, Jordan Justen, qemu-devel, Justen, Jordan L,
Luiz Capitulino, KVM
On Fri, May 31, 2013 at 04:52:18PM +0800, Xiao Guangrong wrote:
> Luiz Capitulino reported that guest refused to boot and qemu
> complained with:
> kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
>
> It is caused by commit 235e8982ad that did double free for the memslot
> so that the second one raises the -EINVAL error
>
> Fix it by reset memory size only if it is needed
>
> Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Thanks, applied.
> ---
> kvm-all.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/kvm-all.c b/kvm-all.c
> index 8e7bbf8..405480e 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)
> if (s->migration_log) {
> mem.flags |= KVM_MEM_LOG_DIRTY_PAGES;
> }
> - if (mem.flags & KVM_MEM_READONLY) {
> +
> + if (slot->memory_size && mem.flags & KVM_MEM_READONLY) {
> /* Set the slot size to 0 before setting the slot to the desired
> * value. This is needed based on KVM commit 75d61fbc. */
> mem.memory_size = 0;
> --
> 1.7.7.6
--
Gleb.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-06-03 6:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20130530114604.4b12cb22@redhat.com>
[not found] ` <51A77838.4060707@redhat.com>
[not found] ` <20130530120832.5abe1c65@redhat.com>
[not found] ` <CAFe8ug_UzYV3_vvkbDVog6rH9a_g+w8R2OY21Jh0TWDW9Q5rVQ@mail.gmail.com>
[not found] ` <51A8485A.4000605@linux.vnet.ibm.com>
[not found] ` <51A85DE8.2090600@redhat.com>
2013-05-31 8:52 ` [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem Xiao Guangrong
2013-05-31 12:27 ` Paolo Bonzini
2013-05-31 12:39 ` Luiz Capitulino
2013-06-02 17:35 ` [Qemu-devel] " Richard W.M. Jones
2013-06-02 22:08 ` Jordan Justen
2013-06-03 6:57 ` Gleb Natapov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox