All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hao, Xudong" <xudong.hao@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"gleb@redhat.com" <gleb@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: RE: [PATCH] qemu-kvm: fix unmatched RAM alloction/free
Date: Fri, 24 May 2013 01:21:08 +0000	[thread overview]
Message-ID: <403610A45A2B5242BD291EDAE8B37D3010E39197@SHSMSX102.ccr.corp.intel.com> (raw)
In-Reply-To: <12651812.6747454.1369329209342.JavaMail.root@redhat.com>

> -----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


WARNING: multiple messages have this Message-ID (diff)
From: "Hao, Xudong" <xudong.hao@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "gleb@redhat.com" <gleb@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] qemu-kvm: fix unmatched RAM alloction/free
Date: Fri, 24 May 2013 01:21:08 +0000	[thread overview]
Message-ID: <403610A45A2B5242BD291EDAE8B37D3010E39197@SHSMSX102.ccr.corp.intel.com> (raw)
In-Reply-To: <12651812.6747454.1369329209342.JavaMail.root@redhat.com>

> -----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


  reply	other threads:[~2013-05-24  1:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2013-05-24  1:21     ` 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=403610A45A2B5242BD291EDAE8B37D3010E39197@SHSMSX102.ccr.corp.intel.com \
    --to=xudong.hao@intel.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.