Skip to contentSkip to conversation

CVE-2026-98283: KVM: PPC: Book3S HV: fix use-after-free in kvmhv_emulate_tlbie_all_lpid()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Oct 6

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

KVM: PPC: Book3S HV: fix use-after-free in kvmhv_emulate_tlbie_all_lpid()

kvmhv_emulate_tlbie_all_lpid() iterates the nested-guest IDR and drops mmu_lock before calling kvmhv_emulate_tlbie_lpid(), but does not hold a reference on the kvm_nested_guest pointer obtained from the IDR. A concurrent vCPU issuing a single-LPID tlbie (is=2, ric=2) can race through kvmhv_flush_nested() -> kvmhv_remove_nested() -> idr_remove / --refcnt -> kvmhv_release_nested() -> kfree(gp) in that window, leaving the iterating vCPU with a dangling pointer. The subsequent mutex_lock(&gp->tlb_lock) and accesses to gp->shadow_pgtable, gp->shadow_lpid and gp->l1_host all touch freed memory. The free path is fully L1-controlled.

Fix this by incrementing gp->refcnt inside the loop before dropping mmu_lock, mirroring what kvmhv_get_nested() does, and releasing the reference with kvmhv_put_nested() after the per-guest work completes. This is the same get/put discipline already used at every other call site that drops mmu_lock while holding a nested-guest pointer.

The Linux kernel CVE team has assigned CVE-2026-98283 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 4.20 with commit e3b6b4661527e821ffbe3db83952fdb1e6e47c49 and fixed in 6.1.189 with commit 4d8f7b1f586375df8bce23a0909566ad5e852259
	Issue introduced in 4.20 with commit e3b6b4661527e821ffbe3db83952fdb1e6e47c49 and fixed in 6.6.158 with commit e37fba1ba69385cff2d0e60b371ee19e7d1852d1
	Issue introduced in 4.20 with commit e3b6b4661527e821ffbe3db83952fdb1e6e47c49 and fixed in 6.12.112 with commit 24b634852413229bb8340d908b115c3365f3a247
	Issue introduced in 4.20 with commit e3b6b4661527e821ffbe3db83952fdb1e6e47c49 and fixed in 6.18.54 with commit fbf69b7d0555ee83c871f58750770f74b7179ad1
	Issue introduced in 4.20 with commit e3b6b4661527e821ffbe3db83952fdb1e6e47c49 and fixed in 7.2.8 with commit ec2d7a52b3996ae81131617b4afc0af31583c1b4
	Issue introduced in 4.20 with commit e3b6b4661527e821ffbe3db83952fdb1e6e47c49 and fixed in 7.3-rc4 with commit 51938dfa8a51a4f85328413fca9b6e21f9d2d088

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-98283

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
arch/powerpc/kvm/book3s_hv_nested.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/4d8f7b1f586375df8bce23a0909566ad5e852259
	https://git.kernel.org/stable/c/e37fba1ba69385cff2d0e60b371ee19e7d1852d1
	https://git.kernel.org/stable/c/24b634852413229bb8340d908b115c3365f3a247
	https://git.kernel.org/stable/c/fbf69b7d0555ee83c871f58750770f74b7179ad1
	https://git.kernel.org/stable/c/ec2d7a52b3996ae81131617b4afc0af31583c1b4
	https://git.kernel.org/stable/c/51938dfa8a51a4f85328413fca9b6e21f9d2d088