Memory leak in vmx.c

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

 



I've noticed a memory leak that occurs in vmx.c.

In alloc_apic_access_page, it calls __kvm_set_memory_region(kvm,
&kvm_userspace_mem, 0).  __kvm_set_memory_region calls
kvm_arch_prepare_memory_region, which because the user_alloc parameter
is 0 will allocate memory for the page with vm_mmap.

This memory never gets freed.   In kvm_arch_destroy_vm it calls
put_page(kvm->arch.apic_access_page), but that only unpins the memory
(necessary due to an earlier call to gfn_to_page), it never actually
frees the memory.  The memory is allocated in the current process
context so it's cleaned up when the process exits, but if a process
creates and destroys multiple VMs then this leak starts to become a
problem.

Similar leaks occur in alloc_identity_pagetable and vmx_set_tss_addr
for a total of 5 pages of memory leak for a VM.  The vmx_set_tss_addr
actually leaks each time vmx_set_tss_addr is called so this could also
become a problem if a program had occasion to set the tss addr several
times.

thanks,
Andy
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux