HomeFreeBSD

bhyveload: support guest rebooting from the loader

Description

bhyveload: support guest rebooting from the loader

userboot has a EXIT_REBOOT code that it uses when the 'reboot' loader
command is executed. Use that and longjmp back to reinit the VM
entirely with a reboot request. This fixes the 'reboot' option in the
loader menu to actually reboot rather than shutdown the VM.

The JMP_* constants are introduced to keep track of why we're doing a
longjmp, though they aren't currently used. We'll notably still do a
complete reload of the interpreter to give the rebooted VM that new
loader smell. It just seemed forward thinking to just keep track of the
different setjmp points.

While we're here, we don't actually need to keep the fd we passed to
fdlopen(3), so let's avoid leaking it.

Reviewed by: markj

(cherry picked from commit 24cd5c26fe3ef7181e85467d9d55afbd76af5a2c)

Details

Provenance
kevansAuthored on Jan 5 2024, 6:21 AM
Parents
rG4bd568bd759b: bhyveload: limit rights on the dirfds we create
Branches
Unknown
Tags
Unknown