KVM: x86: Load DR6 with guest value only before entering .vcpu_run() loop
In the Linux kernel, the following vulnerability has been resolved: KVM: x86: Load DR6 with guest value only before entering .vcpu_run() loop Move the conditional loading of hardware DR6 with the guest's DR6 value out of the core .vcpu_run() loop to fix a bug where KVM can load hardware with a stale vcpu->arch.dr6. When the guest accesses a DR and host userspace isn't debugging the guest, KVM disables DR interception and loads the guest's values into hardware on VM-Enter and saves them on VM-Exit. This allows the guest to access DRs at will, e.g. so that a sequence of DR accesses to configure a breakpoint only generates one VM-Exit. For DR0-DR3, the logic/behavior is identical between VMX and SVM, and also identical between KVM_DEBUGREG_BP_ENABLED (userspace debugging the guest) and KVM_DEBUGREG_WONT_EXIT (guest using DRs), and so KVM handles loading DR0-DR3 in common code, _outside_ of the core kvm_x86_ops.vcpu_run() loop. But for DR6, the guest's value doesn't need to be loaded into hardware for KVM_DEBUGREG_BP_ENABLED, and SVM provides a dedicated VMCB field whereas VMX requires software to manually load the guest value, and so loading the guest's value into DR6 is handled by {svm,vmx}_vcpu_run(), i.e. is done _inside_ the core run loop. Unfortunately, saving the guest values on VM-Exit is initiated by common x86, again outside of the core run loop. If the guest modifies DR6 (in hardware, when DR interception is disabled), and then the next VM-Exit is a fastpath VM-Exit, K
- Products
- Kernel
- Affected versions
- Not specified
- Fixed versions
- 5.15.182, 6.1.138, 6.12.16, 6.13.4, 6.6.90
- CVEs
- CVE-2025-21839
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 4 Nov 2026, 23:14 UTC · Revision 1
Source evidence
KVM: x86: Load DR6 with guest value only before entering .vcpu_run() loop
core-osv · Original sourcePublished 7 Mar 2025, 09:09 UTC
In the Linux kernel, the following vulnerability has been resolved: KVM: x86: Load DR6 with guest value only before entering .vcpu_run() loop Move the conditional loading of hardware DR6 with the guest's DR6 value out of the core .vcpu_run() loop to fix a bug where KVM can load hardware with a stale vcpu->arch.dr6. When the guest accesses a DR and host userspace isn't debugging the guest, KVM disables DR interception and loads the guest's values into hardware on VM-Enter and saves them on VM-Exit. This allows the guest to access DRs at will, e.g. so that a sequence of DR accesses to configure a breakpoint only generates one VM-Exit. For DR0-DR3, the logic/behavior is identical between VMX and SVM, and also identical between KVM_DEBUGREG_BP_ENABLED (userspace debugging the guest) and KVM_DEBUGREG_WONT_EXIT (guest using DRs), and so KVM handles loading DR0-DR3 in common code, _outside_ of the core kvm_x86_ops.vcpu_run() loop. But for DR6, the guest's value doesn't need to be loaded into hardware for KVM_DEBUGREG_BP_ENABLED, and SVM provides a dedicated VMCB field whereas VMX requires software to manually load the guest value, and so loading the guest's value into DR6 is handled by {svm,vmx}_vcpu_run(), i.e. is done _inside_ the core run loop. Unfortunately, saving the guest values on VM-Exit is initiated by common x86, again outside of the core run loop. If the guest modifies DR6 (in hardware, when DR interception is disabled), and then the next VM-Exit is a fastpath VM-Exit, K
osv:CVE-2025-21839
Kernel
Fixed versions: 5.15.182, 6.1.138, 6.6.90, 6.12.16, 6.13.4
Complete source record
{
"id": "32dbf2081cb01cfe98aa0c9e9184e11676223222806ed6664f523985b890d884",
"url": "https://osv.dev/vulnerability/CVE-2025-21839",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "KVM: x86: Load DR6 with guest value only before entering .vcpu_run() loop",
"summary": "In the Linux kernel, the following vulnerability has been resolved: KVM: x86: Load DR6 with guest value only before entering .vcpu_run() loop Move the conditional loading of hardware DR6 with the guest's DR6 value out of the core .vcpu_run() loop to fix a bug where KVM can load hardware with a stale vcpu->arch.dr6. When the guest accesses a DR and host userspace isn't debugging the guest, KVM disables DR interception and loads the guest's values into hardware on VM-Enter and saves them on VM-Exit. This allows the guest to access DRs at will, e.g. so that a sequence of DR accesses to configure a breakpoint only generates one VM-Exit. For DR0-DR3, the logic/behavior is identical between VMX and SVM, and also identical between KVM_DEBUGREG_BP_ENABLED (userspace debugging the guest) and KVM_DEBUGREG_WONT_EXIT (guest using DRs), and so KVM handles loading DR0-DR3 in common code, _outside_ of the core kvm_x86_ops.vcpu_run() loop. But for DR6, the guest's value doesn't need to be loaded into hardware for KVM_DEBUGREG_BP_ENABLED, and SVM provides a dedicated VMCB field whereas VMX requires software to manually load the guest value, and so loading the guest's value into DR6 is handled by {svm,vmx}_vcpu_run(), i.e. is done _inside_ the core run loop. Unfortunately, saving the guest values on VM-Exit is initiated by common x86, again outside of the core run loop. If the guest modifies DR6 (in hardware, when DR interception is disabled), and then the next VM-Exit is a fastpath VM-Exit, K",
"evidence": "osv:CVE-2025-21839",
"products": [
{
"name": {
"value": "Kernel",
"evidence": "/affected/1/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "5.15.182",
"evidence": "/affected/1/ranges"
},
{
"value": "6.1.138",
"evidence": "/affected/1/ranges"
},
{
"value": "6.6.90",
"evidence": "/affected/1/ranges"
},
{
"value": "6.12.16",
"evidence": "/affected/1/ranges"
},
{
"value": "6.13.4",
"evidence": "/affected/1/ranges"
}
],
"affected_versions": []
}
],
"severity": "high",
"structured": {
"id": "CVE-2025-21839",
"aliases": [
"CVE-2025-21839"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:L/A:H"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "GIT",
"events": [
{
"introduced": "d67668e9dd76d98136048935723947156737932b"
},
{
"fixed": "9efb2b99b96c86664bbdbdd2cdb354ac9627eb20"
},
{
"fixed": "93eeb6df1605b3a24f38afdba7ab903ba6b64133"
},
{
"fixed": "a1723e9c53fe6431415be19302a56543daf503f5"
},
{
"fixed": "4eb063de686bfcdfd03a8c801d1bbe87d2d5eb55"
},
{
"fixed": "d456de38d9eb753a4e9fde053c18d4ef8e485339"
},
{
"fixed": "c2fee09fc167c74a64adb08656cb993ea475197e"
}
]
}
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-21839.json"
}
},
{
"ranges": [
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "5.7.0"
},
{
"fixed": "5.15.182"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "5.16.0"
},
{
"fixed": "6.1.138"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "6.2.0"
},
{
"fixed": "6.6.90"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "6.7.0"
},
{
"fixed": "6.12.16"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "6.13.0"
},
{
"fixed": "6.13.4"
}
]
}
],
"package": {
"name": "Kernel",
"ecosystem": "Linux"
},
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-21839.json"
}
}
],
"modified": "2026-10-28T02:30:40.358296150Z",
"provider": "osv",
"references": [
"https://git.kernel.org/stable/c/4eb063de686bfcdfd03a8c801d1bbe87d2d5eb55",
"https://git.kernel.org/stable/c/93eeb6df1605b3a24f38afdba7ab903ba6b64133",
"https://git.kernel.org/stable/c/9efb2b99b96c86664bbdbdd2cdb354ac9627eb20",
"https://git.kernel.org/stable/c/a1723e9c53fe6431415be19302a56543daf503f5",
"https://git.kernel.org/stable/c/c2fee09fc167c74a64adb08656cb993ea475197e",
"https://git.kernel.org/stable/c/d456de38d9eb753a4e9fde053c18d4ef8e485339",
"https://lists.debian.org/debian-lts-announce/2025/08/msg00010.html",
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/21xxx/CVE-2025-21839.json",
"https://nvd.nist.gov/vuln/detail/CVE-2025-21839",
"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
],
"provider_metadata": {
"cna_assigner": "Linux",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/21xxx/CVE-2025-21839.json"
}
},
"related_cves": [
{
"value": "CVE-2025-21839",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 507887,
"published_at": "2025-03-07T09:09:58.22+00:00"
}