From: Dave Voutila Subject: vmm: classify injected #DB as hardware exception To: tech@openbsd.org Cc: Mike Larkin Date: Wed, 02 Sep 2026 10:18:00 -0400 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? --- 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);