From mboxrd@z Thu Jan 1 00:00:00 1970 From: christoffer.dall@linaro.org (Christoffer Dall) Date: Mon, 27 Jun 2016 13:08:39 +0200 Subject: [PATCH] KVM: arm/arm64: Stop leaking vcpu pid references In-Reply-To: <1465403085-2358-1-git-send-email-james.morse@arm.com> References: <1465403085-2358-1-git-send-email-james.morse@arm.com> Message-ID: <20160627110839.GD26498@cbox> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wed, Jun 08, 2016 at 05:24:45PM +0100, James Morse wrote: > kvm provides kvm_vcpu_uninit(), which amongst other things, releases the > last reference to the struct pid of the task that was last running the vcpu. > > On arm64 built with CONFIG_DEBUG_KMEMLEAK, starting a guest with kvmtool, > then killing it with SIGKILL results (after some considerable time) in: > > cat /sys/kernel/debug/kmemleak > > unreferenced object 0xffff80007d5ea080 (size 128): > > comm "lkvm", pid 2025, jiffies 4294942645 (age 1107.776s) > > hex dump (first 32 bytes): > > 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > > backtrace: > > [] create_object+0xfc/0x278 > > [] kmemleak_alloc+0x34/0x70 > > [] kmem_cache_alloc+0x16c/0x1d8 > > [] alloc_pid+0x34/0x4d0 > > [] copy_process.isra.6+0x79c/0x1338 > > [] _do_fork+0x74/0x320 > > [] SyS_clone+0x18/0x20 > > [] el0_svc_naked+0x24/0x28 > > [] 0xffffffffffffffff > > On x86 kvm_vcpu_uninit() is called on the path from kvm_arch_destroy_vm(), > on arm no equivalent call is made. Add the call to kvm_arch_vcpu_free(). > > Signed-off-by: James Morse > Fixes: 749cf76c5a36 ("KVM: ARM: Initial skeleton to compile KVM support") > Cc: # 3.10+ > Acked-by: Marc Zyngier Applied, thanks. -Christoffer