In the Linux kernel, the following vulnerability has been resolved:KVM: x86: Load DR6 with guest value only before entering .vcpu_run() loopMove the conditional loading of hardware DR6 with the guest's DR6 valueout of the core .vcpu_run() loop to fix a bug where KVM can load hardwarewith 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 onVM-Enter and saves them on VM-Exit. This allows the guest to access DRsat will, e.g. so that a sequence of DR accesses to configure a breakpointonly generates one VM-Exit.For DR0-DR3, the logic/behavior is identical between VMX and SVM, and alsoidentical between KVM_DEBUGREG_BP_ENABLED (userspace debugging the guest)and KVM_DEBUGREG_WONT_EXIT (guest using DRs), and so KVM handles loadingDR0-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 forKVM_DEBUGREG_BP_ENABLED, and SVM provides a dedicated VMCB field whereasVMX requires software to manually load the guest value, and so loading theguest'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 commonx86, again outside of the core run loop. If the guest modifies DR6 (inhardware, when DR interception is disabled), and then the next VM-Exit isa fastpath VM-Exit, KVM will reload hardware DR6 with vcpu->arch.dr6 andclobber the guest's actual value.The bug shows up primarily with nested VMX because KVM handles the VMXpreemption timer in the fastpath, and the window between hardware DR6being modified (in guest context) and DR6 being read by guest software isorders of magnitude larger in a nested setup. E.g. in non-nested, theVMX preemption timer would need to fire precisely between #DB injectionand the #DB handler's read of DR6, whereas with a KVM-on-KVM setup, thewindow where hardware DR6 is "dirty" extends all the way from L1 writingDR6 to VMRESUME (in L1). L1's view: ==========
No PoCs from references.
- https://github.com/fkie-cad/nvd-json-data-feeds
- https://github.com/w4zu/Debian_security