From: Mike Larkin Subject: Re: vmm: classify injected #DB as hardware exception To: Dave Voutila Cc: tech@openbsd.org Date: Wed, 2 Sep 2026 11:03:37 -0700 On Wed, Sep 02, 2026 at 10:18:00AM -0400, Dave Voutila wrote: > Both VMX and SVM currently encode an injected #DB as a software > exception. > > Using the software-exception type also gives the hardware the wrong > instruction-completion semantics while delivering the event. Move #DB > next to #UD in both injection paths, where it is encoded as a hardware > exception without an error code. > > ok? > hm this is another one I thought we (me? hshoexer?) already fixed but if it never landed please go ahead. I know we also discussed this one before, a few months ago. ok mlarkin > --- > diff e7450dffd6c02a765d93e405c0a5751cf3f2b9f3 c597b118780d9e1062c05ddde4ba76f673c3fede > commit - e7450dffd6c02a765d93e405c0a5751cf3f2b9f3 > commit + c597b118780d9e1062c05ddde4ba76f673c3fede > blob - 48b8ac55514e79d373b80601e6ca04f236613c93 > blob + 82b2ec36d9d1149814d736fdf6cc9b5bbb3380a5 > --- sys/arch/amd64/amd64/vmm_machdep.c > +++ sys/arch/amd64/amd64/vmm_machdep.c > @@ -3879,6 +3879,7 @@ vcpu_run_vmx(struct vcpu *vcpu, struct vm_run_params * > /* Software Exceptions */ > eii |= (4ULL << 8); > break; > + case VMM_EX_DB: > case VMM_EX_UD: > /* Hardware exception, no error code. */ > eii |= (3ULL << 8); > @@ -6781,13 +6782,13 @@ vcpu_run_svm(struct vcpu *vcpu, struct vm_run_params * > switch (vcpu->vc_inject.vie_vector) { > case VMM_EX_BP: > case VMM_EX_OF: > - case VMM_EX_DB: > /* > * Software exception. > * XXX check nRIP support. > */ > vmcb->v_eventinj |= (4ULL << 8); > break; > + case VMM_EX_DB: > case VMM_EX_UD: > /* Hardware exception, no error code. */ > vmcb->v_eventinj |= (3ULL << 8);