diff options
| author | Roman Bogorodskiy <novel@FreeBSD.org> | 2026-09-20 14:41:55 +0000 |
|---|---|---|
| committer | Roman Bogorodskiy <novel@FreeBSD.org> | 2026-09-28 18:39:05 +0000 |
| commit | c901f931f6eb102cc0347fddb71bdb409374bdf9 (patch) | |
| tree | 6e6ff67272598d3e07714669118582c06d409218 | |
| parent | 809221661a8136a19661e4e379a44203e0ea2a03 (diff) | |
bhyve: fix boot device ordering
EDK2's QemuBootOrderLib inspects the bootorder file provided
via fw_cfg and requires it to be NUL-terminated. Otherwise,
it rejects the supplied bootorder and falls back to its
default boot order.
Currently, bhyve registers bootorder with qemu_fwcfg_add_file()
using bootorder_len returned by open_memstream(), which excludes
the trailing NUL byte.
Fix that by passing bootorder_len + 1 to qemu_fwcfg_add_file() so
the fw_cfg payload is properly NUL-terminated.
PR: 279720
Reviewed by: markj
Found with: codex (gpt-5.6-sol)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D59859
(cherry picked from commit b27a221ef79d6d77d6173897f12118e1126453d8)
| -rw-r--r-- | usr.sbin/bhyve/pci_emul.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c index 238c4780088e..49e6b6136ff8 100644 --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -1482,7 +1482,7 @@ init_bootorder(void) } fclose(fp); - return (qemu_fwcfg_add_file("bootorder", bootorder_len, bootorder)); + return (qemu_fwcfg_add_file("bootorder", bootorder_len + 1, bootorder)); } #define BUSIO_ROUNDUP 32 |
