KVM: SEV: Do cache maintenance on the source VM *before* clearing SEV state
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
In the Linux kernel, the following vulnerability has been resolved:
KVM: SEV: Do cache maintenance on the source VM *before* clearing SEV state
Explicitly flush caches after intra-host migration before clearing "SEV active" on the source VM, as doing cache maintenance afterwards creates a tiny window where memory reclaim could return memory to the host without performing a cache flush, e.g. as pointed out by Sashiko:
CPU1 in sev_migrate_from(): src->active = false;
CPU2 running concurrent unmap: Since active is false, the automatic cache flush in sev_guest_memory_reclaimed is skipped. The host frees and reallocates the page.
CPU1 in sev_migrate_from(): sev_writeback_caches(src_kvm); Executes a hardware cache flush (wbnoinvd), which writes the guest's old dirty ciphertext over the new page owner's data.
From the CVE record · Linux
During SEV intra-host migration, the Linux kernel can clear the source VM’s SEV state before flushing caches. If memory is concurrently reclaimed and reused, the later flush can overwrite the new page owner’s data with the guest’s old ciphertext. The input does not describe an attacker path or authentication requirements.
Operators running Linux kernels that use KVM SEV should check whether their kernel includes the fix; affected versions are not specified.