Index | Thread | Search

From:
Dave Voutila <dv@sisu.io>
Subject:
Re: [PATCH] vmd: handle the reset control register at 0xcf9
To:
ssnf <ssnf@ssnf.xyz>
Cc:
tech@openbsd.org
Date:
Sun, 23 Aug 2026 07:09:57 -0400

Download raw body.

Thread
ssnf <ssnf@ssnf.xyz> writes:

> Handle guest writes to the x86 reset control register and terminate
> the VM on a reset request.

Not opposed to this and it may help some finicky Linux guests I've seen
that end up trying to panicking trying to reboot. (I've seen it on Intel
hosts with CET features and only certain Linux kernels where some
trampoline into SeaBIOS seems to break.)

Will take a look this week (and at your other diffs, thanks!).

>
> Tested on a 9front guest with fshalt -r.
> ---
>  usr.sbin/vmd/x86_vm.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/usr.sbin/vmd/x86_vm.c b/usr.sbin/vmd/x86_vm.c
> index 1b5ade90f9b..a0197c34b4c 100644
> --- a/usr.sbin/vmd/x86_vm.c
> +++ b/usr.sbin/vmd/x86_vm.c
> @@ -507,6 +507,7 @@ vcpu_exit_inout(struct vm_run_params *vrp)
>  int
>  vcpu_exit(struct vm_run_params *vrp)
>  {
> +	struct vm_exit *vei = vrp->vrp_exit;
>  	int ret;
>
>  	switch (vrp->vrp_exit_reason) {
> @@ -533,6 +534,10 @@ vcpu_exit(struct vm_run_params *vrp)
>  		break;
>  	case VMX_EXIT_IO:
>  	case SVM_VMEXIT_IOIO:
> +		if (vei->vei.vei_dir == VEI_DIR_OUT &&
> +		    vei->vei.vei_port == 0xcf9 &&
> +		    (vei->vei.vei_data & 0x06) == 0x06)
> +			return (EAGAIN);
>  		vcpu_exit_inout(vrp);
>  		break;
>  	case VMX_EXIT_HLT:
> --
> 2.51.0