Re: [PATCH 0/2] KVM: selftests: Fix two VMs leaked on early returns
From: Sean Christopherson
Date: Mon Aug 10 2026 - 09:41:37 EST
On Sat, Aug 08, 2026, Gokul K wrote:
> Two x86 selftests create a VM and then take an early return that skips the
> kvm_vm_free() at the end of the function.
>
> Patch 1 is the plain-SEV path of sev_smoke_test(), which returns straight
> out of the UCALL_DONE case instead of leaving the loop. The SEV-ES path
> next to it breaks out and frees correctly.
>
> Patch 2 is nx_huge_pages_test, which returns as soon as it has confirmed
> that disabling NX huge pages is denied without CAP_SYS_BOOT. This one is
> not an unusual error path: nx_huge_pages_test.sh runs the test without
> CAP_SYS_BOOT for any non-root user, so a normal run always takes it.
>
> Neither leak causes a failure today, since the process exits shortly
> afterwards. They do mean those paths never exercise VM teardown.
Eh, not really, they just exercise VM teardown at a different point in the
processes' lifecycle.