Subject: CVE-2024-26990: KVM: x86/mmu: Write-protect L2 SPTEs in TDP MMU when clearing dirty status

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

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

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

KVM: x86/mmu: Write-protect L2 SPTEs in TDP MMU when clearing dirty status

Check kvm_mmu_page_ad_need_write_protect() when deciding whether to
write-protect or clear D-bits on TDP MMU SPTEs, so that the TDP MMU
accounts for any role-specific reasons for disabling D-bit dirty logging.

Specifically, TDP MMU SPTEs must be write-protected when the TDP MMU is
being used to run an L2 (i.e. L1 has disabled EPT) and PML is enabled.
KVM always disables PML when running L2, even when L1 and L2 GPAs are in
the some domain, so failing to write-protect TDP MMU SPTEs will cause
writes made by L2 to not be reflected in the dirty log.

[sean: massage shortlog and changelog, tweak ternary op formatting]

The Linux kernel CVE team has assigned CVE-2024-26990 to this issue.

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

	Issue introduced in 6.4 with commit 5982a5392663 and fixed in 6.6.29 with commit cdf811a93747
	Issue introduced in 6.4 with commit 5982a5392663 and fixed in 6.8.8 with commit e20bff0f1b2d
	Issue introduced in 6.4 with commit 5982a5392663 and fixed in 6.9 with commit 2673dfb591a3

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-2024-26990
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/x86/kvm/mmu/tdp_mmu.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/cdf811a937471af2d1facdf8ae80e5e68096f1ed
	https://git.kernel.org/stable/c/e20bff0f1b2de9cfe303dd35ff46470104a87404
	https://git.kernel.org/stable/c/2673dfb591a359c75080dd5af3da484b89320d22