From: Dave Voutila Subject: fix reboot of alpine linux guests in vmd To: tech@openbsd.org Cc: mlarkin@openbsd.org Date: Mon, 05 Jan 2026 21:23:20 -0500 This has bothered me for awhile and I finally got to the bottom of it. On some Alpine Linux versions, attempting a reboot via reboot(1) results in a double fault and a hung vcpu. You get a panic like: [ 615.066340] traps: PANIC: double fault, error_code: 0x0 [ 615.066347] Oops: double fault: 0000 [#1] SMP PTI [ 615.066353] CPU: 0 UID: 0 PID: 2381 Comm: init Not tainted 6.18.2-0-virt #1-Alpine PREEMPT(none) [ 615.066355] Hardware name: OpenBSD VMM, BIOS 1.16.3p0-OpenBSD-vmm 01/01/2011 [ 615.066356] RIP: 0008:0x9a070 [ 615.066360] Code: Unable to access opcode bytes at 0x9a046. [ 615.066361] RSP: 0018:00000000405ebb78 EFLAGS: 00010046 [ 615.066362] RAX: ffff951d00098000 RBX: 0000000000000000 RCX: 0000000000000000 [ 615.066363] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 615.066363] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 [ 615.066364] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000001 [ 615.066364] R13: 00000000fee1de01 R14: 0000000028121969 R15: ffffffffb1a63ea0 [ 615.066365] FS: 00007f836bf6eb28(0000) GS:ffff951e2a16a000(0000) knlGS:0000000000000000 [ 615.066366] CS: 0008 DS: 0000 ES: 0000 CR0: 0000000080050013 [ 615.066366] CR2: 00000000405ebb68 CR3: 000000000009c000 CR4: 0000000000b50eb0 It appears for some reason Alpine Linux kernels don't go the triple-fault route that most other distro kernels do and instead tries a reset function in the BIOS. At some point, the trampoline setup to get into the BIOS must be getting busted. I'm not sure the exact cause, but by tweaking the RAM vs. Reserved point for the first memory regions setup by vmd, it avoids breaking things. OK? diffstat refs/heads/master refs/heads/vmd-lowmem-reboot M usr.sbin/vmd/loadfile.h | 0+ 2- M usr.sbin/vmd/x86_vm.c | 2+ 1- 2 files changed, 2 insertions(+), 3 deletions(-) diff refs/heads/master refs/heads/vmd-lowmem-reboot commit - 891a370a6a2c9a3a769c31957a3e71d930cb05ec commit + ad286d08c723cf00f095e09f3ec4db1e532438a3 blob - f0167aa6cafbe5991bc20fa8eb3619e2a0617380 blob + 64a208e5d8ba8f0ab6e0899cc4600fca0a7da0b3 --- usr.sbin/vmd/loadfile.h +++ usr.sbin/vmd/loadfile.h @@ -70,8 +70,6 @@ #define COUNT_RANDOM 0x4000 #define COUNT_ALL 0x7f00 -#define LOWMEM_KB 640 - #define BOOTARGS_PAGE 0x2000 #define STACK_PAGE 0xF000 #define GDT_PAGE 0x10000 blob - ff02fd9a3515d05cfd468280230c3731e687bbbb blob + 12713478b9981c44e6a9a2f7a1f21d9967306377 --- usr.sbin/vmd/x86_vm.c +++ usr.sbin/vmd/x86_vm.c @@ -43,7 +43,8 @@ typedef uint8_t (*io_fn_t)(struct vm_run_params *); -#define MAX_PORTS 65536 +#define LOWMEM_KB 576 +#define MAX_PORTS 65536 io_fn_t ioports_map[MAX_PORTS];