All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qemu-kvm: fix unmatched RAM alloction/free
@ 2013-05-23  1:02 ` Xudong Hao
  0 siblings, 0 replies; 12+ messages in thread
From: Xudong Hao @ 2009-01-17 23:13 UTC (permalink / raw)
  To: kvm; +Cc: gleb, pbonzini, qemu-devel, Xudong Hao

mmap is used in qemu_vmalloc function instead of qemu_memalign(commit
7dda5dc8), so it should change qemu_vfree to munmap to fix a unmatched
issue.

This issue appears when a PCI device is being assigned to KVM guest,
failure to read PCI rom file will bring RAM free, then the incorrect
qemu_vfree calling will cause a segment fault.

Signed-off-by: Xudong Hao <xudong.hao@intel.com>
---
 exec.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/exec.c b/exec.c
index fa1e0c3..d40d237 100644
--- a/exec.c
+++ b/exec.c
@@ -1152,15 +1152,11 @@ void qemu_ram_free(ram_addr_t addr)
                 abort();
 #endif
             } else {
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
-                munmap(block->host, block->length);
-#else
                 if (xen_enabled()) {
                     xen_invalidate_map_cache_entry(block->host);
                 } else {
-                    qemu_vfree(block->host);
+                    munmap(block->host, block->length);
                 }
-#endif
             }
             g_free(block);
             break;
-- 
1.5.6


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

* [Qemu-devel] [PATCH] qemu-kvm: fix unmatched RAM alloction/free
@ 2013-05-23  1:02 ` Xudong Hao
  0 siblings, 0 replies; 12+ messages in thread
From: Xudong Hao @ 2013-05-23  1:02 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, Xudong Hao, qemu-devel, gleb

mmap is used in qemu_vmalloc function instead of qemu_memalign(commit
7dda5dc8), so it should change qemu_vfree to munmap to fix a unmatched
issue.

This issue appears when a PCI device is being assigned to KVM guest,
failure to read PCI rom file will bring RAM free, then the incorrect
qemu_vfree calling will cause a segment fault.

Signed-off-by: Xudong Hao <xudong.hao@intel.com>
---
 exec.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/exec.c b/exec.c
index fa1e0c3..d40d237 100644
--- a/exec.c
+++ b/exec.c
@@ -1152,15 +1152,11 @@ void qemu_ram_free(ram_addr_t addr)
                 abort();
 #endif
             } else {
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
-                munmap(block->host, block->length);
-#else
                 if (xen_enabled()) {
                     xen_invalidate_map_cache_entry(block->host);
                 } else {
-                    qemu_vfree(block->host);
+                    munmap(block->host, block->length);
                 }
-#endif
             }
             g_free(block);
             break;
-- 
1.5.6

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

* Re: [PATCH] qemu-kvm: fix unmatched RAM alloction/free
  2013-05-23  1:02 ` [Qemu-devel] " Xudong Hao
@ 2013-05-23 17:13   ` Paolo Bonzini
  -1 siblings, 0 replies; 12+ messages in thread
From: Paolo Bonzini @ 2013-05-23 17:13 UTC (permalink / raw)
  To: Xudong Hao; +Cc: kvm, gleb, qemu-devel

> mmap is used in qemu_vmalloc function instead of qemu_memalign(commit
> 7dda5dc8), so it should change qemu_vfree to munmap to fix a unmatched
> issue.
> 
> This issue appears when a PCI device is being assigned to KVM guest,
> failure to read PCI rom file will bring RAM free, then the incorrect
> qemu_vfree calling will cause a segment fault.
> 
> Signed-off-by: Xudong Hao <xudong.hao@intel.com>
> ---
>  exec.c |    6 +-----
>  1 files changed, 1 insertions(+), 5 deletions(-)
> 
> diff --git a/exec.c b/exec.c
> index fa1e0c3..d40d237 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1152,15 +1152,11 @@ void qemu_ram_free(ram_addr_t addr)
>                  abort();
>  #endif
>              } else {
> -#if defined(TARGET_S390X) && defined(CONFIG_KVM)
> -                munmap(block->host, block->length);
> -#else
>                  if (xen_enabled()) {
>                      xen_invalidate_map_cache_entry(block->host);
>                  } else {
> -                    qemu_vfree(block->host);
> +                    munmap(block->host, block->length);
>                  }
> -#endif
>              }
>              g_free(block);
>              break;

Just "git pull". :)  This is very similar to commit e7a09b9 (osdep: introduce
qemu_anon_ram_free to free qemu_anon_ram_alloc-ed memory, 2013-05-13)

Paolo

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

* Re: [Qemu-devel] [PATCH] qemu-kvm: fix unmatched RAM alloction/free
@ 2013-05-23 17:13   ` Paolo Bonzini
  0 siblings, 0 replies; 12+ messages in thread
From: Paolo Bonzini @ 2013-05-23 17:13 UTC (permalink / raw)
  To: Xudong Hao; +Cc: gleb, kvm, qemu-devel

> mmap is used in qemu_vmalloc function instead of qemu_memalign(commit
> 7dda5dc8), so it should change qemu_vfree to munmap to fix a unmatched
> issue.
> 
> This issue appears when a PCI device is being assigned to KVM guest,
> failure to read PCI rom file will bring RAM free, then the incorrect
> qemu_vfree calling will cause a segment fault.
> 
> Signed-off-by: Xudong Hao <xudong.hao@intel.com>
> ---
>  exec.c |    6 +-----
>  1 files changed, 1 insertions(+), 5 deletions(-)
> 
> diff --git a/exec.c b/exec.c
> index fa1e0c3..d40d237 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1152,15 +1152,11 @@ void qemu_ram_free(ram_addr_t addr)
>                  abort();
>  #endif
>              } else {
> -#if defined(TARGET_S390X) && defined(CONFIG_KVM)
> -                munmap(block->host, block->length);
> -#else
>                  if (xen_enabled()) {
>                      xen_invalidate_map_cache_entry(block->host);
>                  } else {
> -                    qemu_vfree(block->host);
> +                    munmap(block->host, block->length);
>                  }
> -#endif
>              }
>              g_free(block);
>              break;

Just "git pull". :)  This is very similar to commit e7a09b9 (osdep: introduce
qemu_anon_ram_free to free qemu_anon_ram_alloc-ed memory, 2013-05-13)

Paolo

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

* RE: [PATCH] qemu-kvm: fix unmatched RAM alloction/free
  2013-05-23 17:13   ` [Qemu-devel] " Paolo Bonzini
@ 2013-05-24  1:21     ` Hao, Xudong
  -1 siblings, 0 replies; 12+ messages in thread
From: Hao, Xudong @ 2013-05-24  1:21 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, gleb, qemu-devel

> -----Original Message-----
> From: Paolo Bonzini [mailto:pbonzini@redhat.com]
> Sent: Friday, May 24, 2013 1:13 AM
> To: Hao, Xudong
> Cc: kvm@vger.kernel.org; gleb@redhat.com; qemu-devel@nongnu.org
> Subject: Re: [PATCH] qemu-kvm: fix unmatched RAM alloction/free
> 
> > mmap is used in qemu_vmalloc function instead of qemu_memalign(commit
> > 7dda5dc8), so it should change qemu_vfree to munmap to fix a unmatched
> > issue.
> >
> > This issue appears when a PCI device is being assigned to KVM guest,
> > failure to read PCI rom file will bring RAM free, then the incorrect
> > qemu_vfree calling will cause a segment fault.
> >
> > Signed-off-by: Xudong Hao <xudong.hao@intel.com>
> > ---
> >  exec.c |    6 +-----
> >  1 files changed, 1 insertions(+), 5 deletions(-)
> >
> > diff --git a/exec.c b/exec.c
> > index fa1e0c3..d40d237 100644
> > --- a/exec.c
> > +++ b/exec.c
> > @@ -1152,15 +1152,11 @@ void qemu_ram_free(ram_addr_t addr)
> >                  abort();
> >  #endif
> >              } else {
> > -#if defined(TARGET_S390X) && defined(CONFIG_KVM)
> > -                munmap(block->host, block->length);
> > -#else
> >                  if (xen_enabled()) {
> >                      xen_invalidate_map_cache_entry(block->host);
> >                  } else {
> > -                    qemu_vfree(block->host);
> > +                    munmap(block->host, block->length);
> >                  }
> > -#endif
> >              }
> >              g_free(block);
> >              break;
> 
> Just "git pull". :)  This is very similar to commit e7a09b9 (osdep: introduce
> qemu_anon_ram_free to free qemu_anon_ram_alloc-ed memory, 2013-05-13)
> 

OK, this commit do the same thing as my patch, I did not notice qemu upstream tree, just take a look at qemu-kvm tree, but I think this commit should be backport to qemu-kvm tree, because many user are using qemu-kvm for KVM. 

Anyway please ignore this patch.

Thanks,
-Xudong


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

* Re: [Qemu-devel] [PATCH] qemu-kvm: fix unmatched RAM alloction/free
@ 2013-05-24  1:21     ` Hao, Xudong
  0 siblings, 0 replies; 12+ messages in thread
From: Hao, Xudong @ 2013-05-24  1:21 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: gleb, kvm, qemu-devel

> -----Original Message-----
> From: Paolo Bonzini [mailto:pbonzini@redhat.com]
> Sent: Friday, May 24, 2013 1:13 AM
> To: Hao, Xudong
> Cc: kvm@vger.kernel.org; gleb@redhat.com; qemu-devel@nongnu.org
> Subject: Re: [PATCH] qemu-kvm: fix unmatched RAM alloction/free
> 
> > mmap is used in qemu_vmalloc function instead of qemu_memalign(commit
> > 7dda5dc8), so it should change qemu_vfree to munmap to fix a unmatched
> > issue.
> >
> > This issue appears when a PCI device is being assigned to KVM guest,
> > failure to read PCI rom file will bring RAM free, then the incorrect
> > qemu_vfree calling will cause a segment fault.
> >
> > Signed-off-by: Xudong Hao <xudong.hao@intel.com>
> > ---
> >  exec.c |    6 +-----
> >  1 files changed, 1 insertions(+), 5 deletions(-)
> >
> > diff --git a/exec.c b/exec.c
> > index fa1e0c3..d40d237 100644
> > --- a/exec.c
> > +++ b/exec.c
> > @@ -1152,15 +1152,11 @@ void qemu_ram_free(ram_addr_t addr)
> >                  abort();
> >  #endif
> >              } else {
> > -#if defined(TARGET_S390X) && defined(CONFIG_KVM)
> > -                munmap(block->host, block->length);
> > -#else
> >                  if (xen_enabled()) {
> >                      xen_invalidate_map_cache_entry(block->host);
> >                  } else {
> > -                    qemu_vfree(block->host);
> > +                    munmap(block->host, block->length);
> >                  }
> > -#endif
> >              }
> >              g_free(block);
> >              break;
> 
> Just "git pull". :)  This is very similar to commit e7a09b9 (osdep: introduce
> qemu_anon_ram_free to free qemu_anon_ram_alloc-ed memory, 2013-05-13)
> 

OK, this commit do the same thing as my patch, I did not notice qemu upstream tree, just take a look at qemu-kvm tree, but I think this commit should be backport to qemu-kvm tree, because many user are using qemu-kvm for KVM. 

Anyway please ignore this patch.

Thanks,
-Xudong


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

* Re: [Qemu-devel] [PATCH] qemu-kvm: fix unmatched RAM alloction/free
  2013-05-24  1:21     ` [Qemu-devel] " Hao, Xudong
@ 2013-05-24 13:08       ` Eric Blake
  -1 siblings, 0 replies; 12+ messages in thread
From: Eric Blake @ 2013-05-24 13:08 UTC (permalink / raw)
  To: Hao, Xudong; +Cc: Paolo Bonzini, gleb, kvm, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 815 bytes --]

On 05/23/2013 07:21 PM, Hao, Xudong wrote:
>> Just "git pull". :)  This is very similar to commit e7a09b9 (osdep: introduce
>> qemu_anon_ram_free to free qemu_anon_ram_alloc-ed memory, 2013-05-13)
>>
> 
> OK, this commit do the same thing as my patch, I did not notice qemu upstream tree, just take a look at qemu-kvm tree, but I think this commit should be backport to qemu-kvm tree, because many user are using qemu-kvm for KVM. 

That argues that the qemu-kvm tree needs one final commit that wipes
everything and replaces it with a readme file that tells users to
upgrade to the qemu upstream tree, now that the qemu-kvm tree has been
merged upstream and is no longer actively maintained.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]

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

* Re: [Qemu-devel] [PATCH] qemu-kvm: fix unmatched RAM alloction/free
@ 2013-05-24 13:08       ` Eric Blake
  0 siblings, 0 replies; 12+ messages in thread
From: Eric Blake @ 2013-05-24 13:08 UTC (permalink / raw)
  To: Hao, Xudong; +Cc: Paolo Bonzini, kvm, gleb, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 815 bytes --]

On 05/23/2013 07:21 PM, Hao, Xudong wrote:
>> Just "git pull". :)  This is very similar to commit e7a09b9 (osdep: introduce
>> qemu_anon_ram_free to free qemu_anon_ram_alloc-ed memory, 2013-05-13)
>>
> 
> OK, this commit do the same thing as my patch, I did not notice qemu upstream tree, just take a look at qemu-kvm tree, but I think this commit should be backport to qemu-kvm tree, because many user are using qemu-kvm for KVM. 

That argues that the qemu-kvm tree needs one final commit that wipes
everything and replaces it with a readme file that tells users to
upgrade to the qemu upstream tree, now that the qemu-kvm tree has been
merged upstream and is no longer actively maintained.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]

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

* Re: [PATCH] qemu-kvm: fix unmatched RAM alloction/free
  2013-05-23  1:02 ` [Qemu-devel] " Xudong Hao
@ 2013-05-28 18:34   ` Michael Tokarev
  -1 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2013-05-28 18:34 UTC (permalink / raw)
  To: Xudong Hao; +Cc: kvm, gleb, pbonzini, qemu-devel

Um, something's wrong with the Date.  Care to resend with that fixed?

Thanks,

/mjt

18.01.2009 02:13, Xudong Hao wrote:
> mmap is used in qemu_vmalloc function instead of qemu_memalign(commit
> 7dda5dc8), so it should change qemu_vfree to munmap to fix a unmatched
> issue.
[...]

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

* Re: [Qemu-devel] [PATCH] qemu-kvm: fix unmatched RAM alloction/free
@ 2013-05-28 18:34   ` Michael Tokarev
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2013-05-28 18:34 UTC (permalink / raw)
  To: Xudong Hao; +Cc: pbonzini, gleb, kvm, qemu-devel

Um, something's wrong with the Date.  Care to resend with that fixed?

Thanks,

/mjt

18.01.2009 02:13, Xudong Hao wrote:
> mmap is used in qemu_vmalloc function instead of qemu_memalign(commit
> 7dda5dc8), so it should change qemu_vfree to munmap to fix a unmatched
> issue.
[...]

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

* RE: [PATCH] qemu-kvm: fix unmatched RAM alloction/free
  2013-05-28 18:34   ` [Qemu-devel] " Michael Tokarev
@ 2013-05-29  2:37     ` Hao, Xudong
  -1 siblings, 0 replies; 12+ messages in thread
From: Hao, Xudong @ 2013-05-29  2:37 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: kvm, gleb, pbonzini, qemu-devel

> -----Original Message-----
> From: Michael Tokarev [mailto:mjt@tls.msk.ru]
> Sent: Wednesday, May 29, 2013 2:34 AM
> To: Hao, Xudong
> Cc: kvm@vger.kernel.org; gleb@redhat.com; pbonzini@redhat.com;
> qemu-devel@nongnu.org
> Subject: Re: [PATCH] qemu-kvm: fix unmatched RAM alloction/free
> 
> Um, something's wrong with the Date.  Care to resend with that fixed?
> 

Because the similar fix are already in qemu upstream, seems we need not this patch longer.

> Thanks,
> 
> /mjt
> 
> 18.01.2009 02:13, Xudong Hao wrote:
> > mmap is used in qemu_vmalloc function instead of qemu_memalign(commit
> > 7dda5dc8), so it should change qemu_vfree to munmap to fix a unmatched
> > issue.
> [...]

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

* Re: [Qemu-devel] [PATCH] qemu-kvm: fix unmatched RAM alloction/free
@ 2013-05-29  2:37     ` Hao, Xudong
  0 siblings, 0 replies; 12+ messages in thread
From: Hao, Xudong @ 2013-05-29  2:37 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: pbonzini, gleb, kvm, qemu-devel

> -----Original Message-----
> From: Michael Tokarev [mailto:mjt@tls.msk.ru]
> Sent: Wednesday, May 29, 2013 2:34 AM
> To: Hao, Xudong
> Cc: kvm@vger.kernel.org; gleb@redhat.com; pbonzini@redhat.com;
> qemu-devel@nongnu.org
> Subject: Re: [PATCH] qemu-kvm: fix unmatched RAM alloction/free
> 
> Um, something's wrong with the Date.  Care to resend with that fixed?
> 

Because the similar fix are already in qemu upstream, seems we need not this patch longer.

> Thanks,
> 
> /mjt
> 
> 18.01.2009 02:13, Xudong Hao wrote:
> > mmap is used in qemu_vmalloc function instead of qemu_memalign(commit
> > 7dda5dc8), so it should change qemu_vfree to munmap to fix a unmatched
> > issue.
> [...]

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

end of thread, other threads:[~2013-05-29  2:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-17 23:13 [PATCH] qemu-kvm: fix unmatched RAM alloction/free Xudong Hao
2013-05-23  1:02 ` [Qemu-devel] " Xudong Hao
2013-05-23 17:13 ` Paolo Bonzini
2013-05-23 17:13   ` [Qemu-devel] " Paolo Bonzini
2013-05-24  1:21   ` Hao, Xudong
2013-05-24  1:21     ` [Qemu-devel] " Hao, Xudong
2013-05-24 13:08     ` Eric Blake
2013-05-24 13:08       ` Eric Blake
2013-05-28 18:34 ` Michael Tokarev
2013-05-28 18:34   ` [Qemu-devel] " Michael Tokarev
2013-05-29  2:37   ` Hao, Xudong
2013-05-29  2:37     ` [Qemu-devel] " Hao, Xudong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.