KVM: Reject wrapped offset in kvm_reset_dirty_gfn()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ fb04a1eddb1a65b6588a021bdc132270d5ae48bb · < ecf9b3ea7847fe14f34b8c41f00de1eb95c747da| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
KVM: Reject wrapped offset in kvm_reset_dirty_gfn()
kvm_reset_dirty_gfn() guards the gfn range with
if (!memslot || (offset + __fls(mask)) >= memslot->npages) return;
but offset is u64 and the addition is unchecked. The check can be silently bypassed by a u64 wrap.
The dirty ring backing those entries is MAP_SHARED at KVM_DIRTY_LOG_PAGE_OFFSET of the vcpu fd, so the VMM can rewrite the slot and offset fields of any entry between when the kernel pushes them and when KVM_RESET_DIRTY_RINGS consumes them. On reset, kvm_dirty_ring_reset() re-reads the values via READ_ONCE() and feeds them straight back into this check; only the flags handshake is treated as the handover, the slot/offset payload is taken on trust.
Crafting two entries
entry[i].offset = 0xffffffffffffffc1 entry[i+1].offset = 0
From the CVE record · Linux
KVM’s dirty-ring reset has an unchecked integer addition that can let a crafted offset bypass a bounds check. A local process holding /dev/kvm can trigger an out-of-bounds load and potentially clear a page-table writable bit when the legacy MMU path is in use; no user interaction is described.
Operators running Linux kernels with KVM should check their versions against the vendor advisory; affected versions are not specified.