{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.2",
    "cveMetadata": {
        "cveId": "CVE-2025-21839",
        "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "state": "PUBLISHED",
        "assignerShortName": "Linux",
        "dateReserved": "2024-12-29T08:45:45.777Z",
        "datePublished": "2025-03-07T09:09:58.220Z",
        "dateUpdated": "2026-08-05T11:54:50.771Z"
    },
    "containers": {
        "cna": {
            "providerMetadata": {
                "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
                "shortName": "Linux",
                "dateUpdated": "2026-08-05T11:54:50.771Z"
            },
            "descriptions": [
                {
                    "lang": "en",
                    "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nKVM: x86: Load DR6 with guest value only before entering .vcpu_run() loop\n\nMove the conditional loading of hardware DR6 with the guest's DR6 value\nout of the core .vcpu_run() loop to fix a bug where KVM can load hardware\nwith a stale vcpu->arch.dr6.\n\nWhen the guest accesses a DR and host userspace isn't debugging the guest,\nKVM disables DR interception and loads the guest's values into hardware on\nVM-Enter and saves them on VM-Exit.  This allows the guest to access DRs\nat will, e.g. so that a sequence of DR accesses to configure a breakpoint\nonly generates one VM-Exit.\n\nFor DR0-DR3, the logic/behavior is identical between VMX and SVM, and also\nidentical between KVM_DEBUGREG_BP_ENABLED (userspace debugging the guest)\nand KVM_DEBUGREG_WONT_EXIT (guest using DRs), and so KVM handles loading\nDR0-DR3 in common code, _outside_ of the core kvm_x86_ops.vcpu_run() loop.\n\nBut for DR6, the guest's value doesn't need to be loaded into hardware for\nKVM_DEBUGREG_BP_ENABLED, and SVM provides a dedicated VMCB field whereas\nVMX requires software to manually load the guest value, and so loading the\nguest's value into DR6 is handled by {svm,vmx}_vcpu_run(), i.e. is done\n_inside_ the core run loop.\n\nUnfortunately, saving the guest values on VM-Exit is initiated by common\nx86, again outside of the core run loop.  If the guest modifies DR6 (in\nhardware, when DR interception is disabled), and then the next VM-Exit is\na fastpath VM-Exit, KVM will reload hardware DR6 with vcpu->arch.dr6 and\nclobber the guest's actual value.\n\nThe bug shows up primarily with nested VMX because KVM handles the VMX\npreemption timer in the fastpath, and the window between hardware DR6\nbeing modified (in guest context) and DR6 being read by guest software is\norders of magnitude larger in a nested setup.  E.g. in non-nested, the\nVMX preemption timer would need to fire precisely between #DB injection\nand the #DB handler's read of DR6, whereas with a KVM-on-KVM setup, the\nwindow where hardware DR6 is \"dirty\" extends all the way from L1 writing\nDR6 to VMRESUME (in L1).\n\n    L1's view:\n    ==========\n    <L1 disables DR interception>\n           CPU 0/KVM-7289    [023] d....  2925.640961: kvm_entry: vcpu 0\n A:  L1 Writes DR6\n           CPU 0/KVM-7289    [023] d....  2925.640963: <hack>: Set DRs, DR6 = 0xffff0ff1\n\n B:        CPU 0/KVM-7289    [023] d....  2925.640967: kvm_exit: vcpu 0 reason EXTERNAL_INTERRUPT intr_info 0x800000ec\n\n D: L1 reads DR6, arch.dr6 = 0\n           CPU 0/KVM-7289    [023] d....  2925.640969: <hack>: Sync DRs, DR6 = 0xffff0ff0\n\n           CPU 0/KVM-7289    [023] d....  2925.640976: kvm_entry: vcpu 0\n    L2 reads DR6, L1 disables DR interception\n           CPU 0/KVM-7289    [023] d....  2925.640980: kvm_exit: vcpu 0 reason DR_ACCESS info1 0x0000000000000216\n           CPU 0/KVM-7289    [023] d....  2925.640983: kvm_entry: vcpu 0\n\n           CPU 0/KVM-7289    [023] d....  2925.640983: <hack>: Set DRs, DR6 = 0xffff0ff0\n\n    L2 detects failure\n           CPU 0/KVM-7289    [023] d....  2925.640987: kvm_exit: vcpu 0 reason HLT\n    L1 reads DR6 (confirms failure)\n           CPU 0/KVM-7289    [023] d....  2925.640990: <hack>: Sync DRs, DR6 = 0xffff0ff0\n\n    L0's view:\n    ==========\n    L2 reads DR6, arch.dr6 = 0\n          CPU 23/KVM-5046    [001] d....  3410.005610: kvm_exit: vcpu 23 reason DR_ACCESS info1 0x0000000000000216\n          CPU 23/KVM-5046    [001] .....  3410.005610: kvm_nested_vmexit: vcpu 23 reason DR_ACCESS info1 0x0000000000000216\n\n    L2 => L1 nested VM-Exit\n          CPU 23/KVM-5046    [001] .....  3410.005610: kvm_nested_vmexit_inject: reason: DR_ACCESS ext_inf1: 0x0000000000000216\n\n          CPU 23/KVM-5046    [001] d....  3410.005610: kvm_entry: vcpu 23\n          CPU 23/KVM-5046    [001] d....  3410.005611: kvm_exit: vcpu 23 reason VMREAD\n          CPU 23/KVM-5046    [001] d....  3410.005611: kvm_entry: vcpu 23\n          CPU 23/KVM-5046    [001] d....  3410.\n---truncated---"
                }
            ],
            "metrics": [
                {
                    "cvssV3_1": {
                        "version": "3.1",
                        "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:L/A:H",
                        "baseScore": 7.3,
                        "baseSeverity": "HIGH"
                    },
                    "scenarios": [
                        {
                            "lang": "en",
                            "value": "AV:L - Reaching the flaw requires executing code inside a KVM guest (or local access to /dev/kvm to start one); the DR access, the DR6 write, and the fastpath-inducing WRMSR/HLT are all local CPU instructions with no network component.\nAC:L - A guest at CPL0 controls both halves deterministically — it writes DR6, then forces a fastpath exit via WRMSR TSC_DEADLINE, an x2APIC self-IPI, or HLT, guaranteeing the stale reload on re-entry; under nested virt the dirty-DR6 window is enormous, and the bug also fires spontaneously under ordinary timer/idle activity.\nPR:L - Only an unprivileged local account is needed — on the host, /dev/kvm access lets a normal user run arbitrary ring-0 guest code; inside a guest, unprivileged userspace reaches the same state via ptrace POKEUSER on u_debugreg or perf_event_open hardware breakpoints, which make the guest kernel touch DRs and set KVM_DEBUGREG_WONT_EXIT.\nUI:N - The DR access, DR6 write, and fastpath exit are all attacker-initiated; no victim action is required, and the condition additionally arises during normal guest timer and idle operation.\nS:C - The defect is in the host hypervisor (arch/x86/kvm), but the corrupted resource is guest architectural register state, so the impact lands in the guest OS — a security authority distinct from the host KVM component that contains the bug.\nC:N - The clobbering value is the guest's own previously saved vcpu->arch.dr6, and vmx_sync_dirty_debug_regs() resets hardware DR6 to DR6_RESERVED before host code runs, so no host or cross-VM data is disclosed.\nI:L - The host silently overwrites a guest architectural register with a stale value, letting an in-guest attacker clear DR_TRAPn bits to hide hardware-breakpoint hits from guest-side debuggers and integrity monitors, or inject spurious trap bits; the modification is confined to DR6 and is not an arbitrary write.\nA:H - Losing a DR_TRAPn bit means the guest's hw_breakpoint_handler() never sets X86_EFLAGS_RF for an execute breakpoint, so the faulting instruction re-triggers #DB forever and the vCPU hangs; a stale DR_STEP bit trips WARN_ON_ONCE in the guest's exc_debug_kernel(), panicking the guest under panic_on_warn, and nested hypervisors malfunction outright."
                        }
                    ]
                }
            ],
            "affected": [
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "unaffected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "arch/x86/include/asm/kvm-x86-ops.h",
                        "arch/x86/include/asm/kvm_host.h",
                        "arch/x86/kvm/svm/svm.c",
                        "arch/x86/kvm/vmx/main.c",
                        "arch/x86/kvm/vmx/vmx.c",
                        "arch/x86/kvm/vmx/x86_ops.h",
                        "arch/x86/kvm/x86.c"
                    ],
                    "versions": [
                        {
                            "version": "d67668e9dd76d98136048935723947156737932b",
                            "lessThan": "9efb2b99b96c86664bbdbdd2cdb354ac9627eb20",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "d67668e9dd76d98136048935723947156737932b",
                            "lessThan": "93eeb6df1605b3a24f38afdba7ab903ba6b64133",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "d67668e9dd76d98136048935723947156737932b",
                            "lessThan": "a1723e9c53fe6431415be19302a56543daf503f5",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "d67668e9dd76d98136048935723947156737932b",
                            "lessThan": "4eb063de686bfcdfd03a8c801d1bbe87d2d5eb55",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "d67668e9dd76d98136048935723947156737932b",
                            "lessThan": "d456de38d9eb753a4e9fde053c18d4ef8e485339",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "d67668e9dd76d98136048935723947156737932b",
                            "lessThan": "c2fee09fc167c74a64adb08656cb993ea475197e",
                            "status": "affected",
                            "versionType": "git"
                        }
                    ]
                },
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "affected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "arch/x86/include/asm/kvm-x86-ops.h",
                        "arch/x86/include/asm/kvm_host.h",
                        "arch/x86/kvm/svm/svm.c",
                        "arch/x86/kvm/vmx/main.c",
                        "arch/x86/kvm/vmx/vmx.c",
                        "arch/x86/kvm/vmx/x86_ops.h",
                        "arch/x86/kvm/x86.c"
                    ],
                    "versions": [
                        {
                            "version": "5.7",
                            "status": "affected"
                        },
                        {
                            "version": "0",
                            "lessThan": "5.7",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.15.182",
                            "lessThanOrEqual": "5.15.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.1.138",
                            "lessThanOrEqual": "6.1.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.6.90",
                            "lessThanOrEqual": "6.6.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.12.16",
                            "lessThanOrEqual": "6.12.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.13.4",
                            "lessThanOrEqual": "6.13.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.14",
                            "lessThanOrEqual": "*",
                            "status": "unaffected",
                            "versionType": "original_commit_for_fix"
                        }
                    ]
                }
            ],
            "cpeApplicability": [
                {
                    "nodes": [
                        {
                            "operator": "OR",
                            "negate": false,
                            "cpeMatch": [
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "5.7",
                                    "versionEndExcluding": "5.15.182"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "5.7",
                                    "versionEndExcluding": "6.1.138"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "5.7",
                                    "versionEndExcluding": "6.6.90"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "5.7",
                                    "versionEndExcluding": "6.12.16"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "5.7",
                                    "versionEndExcluding": "6.13.4"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "5.7",
                                    "versionEndExcluding": "6.14"
                                }
                            ]
                        }
                    ]
                }
            ],
            "references": [
                {
                    "url": "https://git.kernel.org/stable/c/9efb2b99b96c86664bbdbdd2cdb354ac9627eb20"
                },
                {
                    "url": "https://git.kernel.org/stable/c/93eeb6df1605b3a24f38afdba7ab903ba6b64133"
                },
                {
                    "url": "https://git.kernel.org/stable/c/a1723e9c53fe6431415be19302a56543daf503f5"
                },
                {
                    "url": "https://git.kernel.org/stable/c/4eb063de686bfcdfd03a8c801d1bbe87d2d5eb55"
                },
                {
                    "url": "https://git.kernel.org/stable/c/d456de38d9eb753a4e9fde053c18d4ef8e485339"
                },
                {
                    "url": "https://git.kernel.org/stable/c/c2fee09fc167c74a64adb08656cb993ea475197e"
                }
            ],
            "title": "KVM: x86: Load DR6 with guest value only before entering .vcpu_run() loop",
            "x_generator": {
                "engine": "bippy-1.2.0"
            }
        },
        "adp": [
            {
                "title": "CVE Program Container",
                "references": [
                    {
                        "url": "https://lists.debian.org/debian-lts-announce/2025/08/msg00010.html"
                    }
                ],
                "providerMetadata": {
                    "orgId": "af854a3a-2127-422b-91ae-364da2661108",
                    "shortName": "CVE",
                    "dateUpdated": "2025-11-03T19:37:57.827Z"
                }
            }
        ]
    }
}