qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qemu-kvm: fix unmatched RAM alloction/free


From: Hao, Xudong
Subject: Re: [Qemu-devel] [PATCH] qemu-kvm: fix unmatched RAM alloction/free
Date: Fri, 24 May 2013 01:21:08 +0000

> -----Original Message-----
> From: Paolo Bonzini [mailto:address@hidden
> Sent: Friday, May 24, 2013 1:13 AM
> To: Hao, Xudong
> Cc: address@hidden; address@hidden; address@hidden
> 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 <address@hidden>
> > ---
> >  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 via email to

[Prev in Thread] Current Thread [Next in Thread]