KVM: x86: Check for invalid/obsolete root *after* making MMU pages available
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ f95eec9bed76d42194c23153cb1cc8f186bf91cb · < bce0d3c26e2c761a4bf43c8949f333fc7374eb2d| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
KVM: x86: Check for invalid/obsolete root *after* making MMU pages available
Check for a "stale" page fault, i.e. for an invalid and/or obsolete root, after making MMU pages available for the shadow MMU. If reclaiming shadow pages zaps an in-use root, i.e. marks it invalid, then KVM will attempt to map memory into an invalid root. On its own, populating an invalid root is "fine", but because child shadow pages inherit their parent's role, any children created during the map/fetch will be created as invalid pages, thus violating KVM's invariant that invalid pages are never on the list of active MMU pages.
Note, the underlying flaw has existed since KVM first started tracking invalid roots in 2008 (commit 2e53d63acba7, "KVM: MMU: ignore zapped root pagetables"), but the true badness only came along in 2020 (Linux 5.9) with the invariant that invalid shadow pages can't be on the list of active pages.
Note #2, inheriting role.invalid when creating child shadow pages is also far from ideal; that flaw will be addressed separately.
From the CVE record · Linux
A flaw in the Linux kernel's KVM x86 shadow MMU can place invalid child shadow pages on the active MMU page list. This can happen when shadow-page reclamation invalidates an in-use root before KVM maps memory into it. The input does not specify an attacker action, access requirement, or user interaction.
Operators running Linux kernels with KVM x86 should check their exposure; the input identifies Linux 5.9 as when the violated invariant was introduced but does not specify affected versions.