Re: [PATCH] KVM: x86: fix #GP check in em_dr_write()

From: Sean Christopherson

Date: Wed Jun 03 2026 - 13:11:33 EST


On Tue, Jun 02, 2026, Sean Christopherson wrote:
> On Mon, Jun 01, 2026, Carlos López wrote:
> > The practical impact is limited, as check_dr_write() already checks DR6
> > and DR7 manually. However, it misses DR4/DR5, which alias DR6/DR7 when
> > CR4.DE=0.
>
> *sigh* (not at your patch, at the existing code)
>
> Which, after digging into *why* check_dr_write() checks DR6/DR7, highlights that
> this fix is incomplete. em_dr_write() can't rely on ->set_dr() for #GP checks,
> because unfortunately for us, the #GP check has priority over DR intercepts on
> SVM, and over DR7.GD (General Detect) #DBs.

And testing fail. The DR7.GD #DB has priority, I forgot that DR7.GD is cleared
by the CPU on delivery of the #DB.