15239e66cSJoel Dahl.\" 283994ddcSNeel Natu.\" Copyright (c) 2012 NetApp Inc 383994ddcSNeel Natu.\" All rights reserved. 483994ddcSNeel Natu.\" 583994ddcSNeel Natu.\" Redistribution and use in source and binary forms, with or without 683994ddcSNeel Natu.\" modification, are permitted provided that the following conditions 783994ddcSNeel Natu.\" are met: 883994ddcSNeel Natu.\" 1. Redistributions of source code must retain the above copyright 983994ddcSNeel Natu.\" notice, this list of conditions and the following disclaimer. 1083994ddcSNeel Natu.\" 2. Redistributions in binary form must reproduce the above copyright 1183994ddcSNeel Natu.\" notice, this list of conditions and the following disclaimer in the 1283994ddcSNeel Natu.\" documentation and/or other materials provided with the distribution. 1383994ddcSNeel Natu.\" 1483994ddcSNeel Natu.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1583994ddcSNeel Natu.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1683994ddcSNeel Natu.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1783994ddcSNeel Natu.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1883994ddcSNeel Natu.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1983994ddcSNeel Natu.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2083994ddcSNeel Natu.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2183994ddcSNeel Natu.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2283994ddcSNeel Natu.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2383994ddcSNeel Natu.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2483994ddcSNeel Natu.\" SUCH DAMAGE. 2583994ddcSNeel Natu.\" 26*5df041c4SKyle Evans.Dd January 12, 2024 2783994ddcSNeel Natu.Dt BHYVELOAD 8 2883994ddcSNeel Natu.Os 2983994ddcSNeel Natu.Sh NAME 3083994ddcSNeel Natu.Nm bhyveload 3183994ddcSNeel Natu.Nd load a 3283994ddcSNeel Natu.Fx 3383994ddcSNeel Natuguest inside a bhyve virtual machine 3483994ddcSNeel Natu.Sh SYNOPSIS 3583994ddcSNeel Natu.Nm 36568e3a8dSMarcel Moolenaar.Op Fl C 379b1aa8d6SNeel Natu.Op Fl S 386380102cSPeter Grehan.Op Fl c Ar cons-dev 39cde1f5b8SJohn Baldwin.Op Fl d Ar disk-path 40cde1f5b8SJohn Baldwin.Op Fl e Ar name=value 41cde1f5b8SJohn Baldwin.Op Fl h Ar host-path 428c96dcc1SMarcel Moolenaar.Op Fl l Ar os-loader 436ee52c65SRoman Bogorodskiy.Op Fl m Ar memsize Ns Op Ar K|k|M|m|G|g|T|t 4483994ddcSNeel Natu.Ar vmname 4583994ddcSNeel Natu.Sh DESCRIPTION 4683994ddcSNeel Natu.Nm 4783994ddcSNeel Natuis used to load a 4883994ddcSNeel Natu.Fx 4983994ddcSNeel Natuguest inside a 5083994ddcSNeel Natu.Xr bhyve 4 5183994ddcSNeel Natuvirtual machine. 5283994ddcSNeel Natu.Pp 5383994ddcSNeel Natu.Nm 5483994ddcSNeel Natuis based on 5583994ddcSNeel Natu.Xr loader 8 56edccda4dSJoel Dahland will present an interface identical to the 5783994ddcSNeel Natu.Fx 5883994ddcSNeel Natuloader on the user's terminal. 598c96dcc1SMarcel MoolenaarThis behavior can be changed by specifying a different OS loader. 6083994ddcSNeel Natu.Pp 6183994ddcSNeel NatuThe virtual machine is identified as 6283994ddcSNeel Natu.Ar vmname 6383994ddcSNeel Natuand will be created if it does not already exist. 6483994ddcSNeel Natu.Sh OPTIONS 6583994ddcSNeel NatuThe following options are available: 6683994ddcSNeel Natu.Bl -tag -width indent 67cde1f5b8SJohn Baldwin.It Fl c Ar cons-dev 68cde1f5b8SJohn Baldwin.Ar cons-dev 69cde1f5b8SJohn Baldwinis a 70cde1f5b8SJohn Baldwin.Xr tty 4 71cde1f5b8SJohn Baldwindevice to use for 72cde1f5b8SJohn Baldwin.Nm 73cde1f5b8SJohn Baldwinterminal I/O. 74cde1f5b8SJohn Baldwin.Pp 75cde1f5b8SJohn BaldwinThe text string "stdio" is also accepted and selects the use of 76cde1f5b8SJohn Baldwinunbuffered standard I/O. This is the default value. 77cde1f5b8SJohn Baldwin.It Fl d Ar disk-path 78cde1f5b8SJohn BaldwinThe 79cde1f5b8SJohn Baldwin.Ar disk-path 80cde1f5b8SJohn Baldwinis the pathname of the guest's boot disk image. 81cde1f5b8SJohn Baldwin.It Fl e Ar name=value 828c96dcc1SMarcel MoolenaarSet the 838c96dcc1SMarcel Moolenaar.Fx 848c96dcc1SMarcel Moolenaarloader environment variable 85cde1f5b8SJohn Baldwin.Ar name 86cde1f5b8SJohn Baldwinto 87cde1f5b8SJohn Baldwin.Ar value . 88cde1f5b8SJohn Baldwin.Pp 89cde1f5b8SJohn BaldwinThe option may be used more than once to set more than one environment 90cde1f5b8SJohn Baldwinvariable. 91cde1f5b8SJohn Baldwin.It Fl h Ar host-path 92cde1f5b8SJohn BaldwinThe 93cde1f5b8SJohn Baldwin.Ar host-path 94cde1f5b8SJohn Baldwinis the directory at the top of the guest's boot filesystem. 958c96dcc1SMarcel Moolenaar.It Fl l Ar os-loader 968c96dcc1SMarcel MoolenaarSpecify a different OS loader. 978c96dcc1SMarcel MoolenaarBy default 988c96dcc1SMarcel Moolenaar.Nm 998c96dcc1SMarcel Moolenaarwill use 1008c96dcc1SMarcel Moolenaar.Pa /boot/userboot.so , 1018c96dcc1SMarcel Moolenaarwhich presents a standard 1028c96dcc1SMarcel Moolenaar.Fx 1038c96dcc1SMarcel Moolenaarloader. 1046ee52c65SRoman Bogorodskiy.It Fl m Ar memsize Ns Op Ar K|k|M|m|G|g|T|t 1056ee52c65SRoman Bogorodskiy.Ar memsize 106200758f1SNeel Natuis the amount of memory allocated to the guest. 107200758f1SNeel Natu.Pp 108200758f1SNeel NatuThe 1096ee52c65SRoman Bogorodskiy.Ar memsize 110200758f1SNeel Natuargument may be suffixed with one of 111200758f1SNeel Natu.Cm K , 112200758f1SNeel Natu.Cm M , 113200758f1SNeel Natu.Cm G 114200758f1SNeel Natuor 115200758f1SNeel Natu.Cm T 116200758f1SNeel Natu(either upper or lower case) to indicate a multiple of 117200758f1SNeel NatuKilobytes, Megabytes, Gigabytes or Terabytes 118200758f1SNeel Naturespectively. 11983994ddcSNeel Natu.Pp 1206ee52c65SRoman Bogorodskiy.Ar memsize 1216ee52c65SRoman Bogorodskiydefaults to 256M. 122568e3a8dSMarcel Moolenaar.It Fl C 123568e3a8dSMarcel MoolenaarInclude guest memory in the core file when 124568e3a8dSMarcel Moolenaar.Nm 125568e3a8dSMarcel Moolenaardumps core. 126568e3a8dSMarcel MoolenaarThis is intended for debugging an OS loader as it allows inspection of 127568e3a8dSMarcel Moolenaarthe guest memory. 1289b1aa8d6SNeel Natu.It Fl S 1299b1aa8d6SNeel NatuWire guest memory. 1309b1aa8d6SNeel Natu.El 131f429b905SNeel Natu.Sh EXAMPLES 13283994ddcSNeel NatuTo create a virtual machine named 13383994ddcSNeel Natu.Ar freebsd-vm 13483994ddcSNeel Natuthat boots off the ISO image 13583994ddcSNeel Natu.Pa /freebsd/release.iso 13683994ddcSNeel Natuand has 1GB memory allocated to it: 137edccda4dSJoel Dahl.Pp 138200758f1SNeel Natu.Dl "bhyveload -m 1G -d /freebsd/release.iso freebsd-vm" 1396380102cSPeter Grehan.Pp 1406380102cSPeter GrehanTo create a virtual machine named 1416380102cSPeter Grehan.Ar test-vm 1426380102cSPeter Grehanwith 256MB of memory allocated, the guest root filesystem under the host 1436380102cSPeter Grehandirectory 1446380102cSPeter Grehan.Pa /user/images/test 1456380102cSPeter Grehanand terminal I/O sent to the 1466380102cSPeter Grehan.Xr nmdm 4 1476380102cSPeter Grehandevice 1486380102cSPeter Grehan.Pa /dev/nmdm1B 1496380102cSPeter Grehan.Pp 1500947c55bSJoel Dahl.Dl "bhyveload -m 256MB -h /usr/images/test -c /dev/nmdm1B test-vm" 15183994ddcSNeel Natu.Sh SEE ALSO 15283994ddcSNeel Natu.Xr bhyve 4 , 1536380102cSPeter Grehan.Xr nmdm 4 , 154b540294aSMaxim Konovalov.Xr vmm 4 , 155b540294aSMaxim Konovalov.Xr bhyve 8 , 156b540294aSMaxim Konovalov.Xr loader 8 15783994ddcSNeel Natu.Sh HISTORY 15883994ddcSNeel Natu.Nm 15983994ddcSNeel Natufirst appeared in 16083994ddcSNeel Natu.Fx 10.0 , 16183994ddcSNeel Natuand was developed at NetApp Inc. 16283994ddcSNeel Natu.Sh AUTHORS 16383994ddcSNeel Natu.Nm 16483994ddcSNeel Natuwas developed by 16583994ddcSNeel Natu.An -nosplit 16601c2b8acSBaptiste Daroussin.An Neel Natu Aq Mt neel@FreeBSD.org 16783994ddcSNeel Natuat NetApp Inc with a lot of help from 16801c2b8acSBaptiste Daroussin.An Doug Rabson Aq Mt dfr@FreeBSD.org . 16983994ddcSNeel Natu.Sh BUGS 17083994ddcSNeel Natu.Nm 171edccda4dSJoel Dahlcan only load 17283994ddcSNeel Natu.Fx 17383994ddcSNeel Natuas a guest. 174*5df041c4SKyle Evans.Sh SECURITY CONSIDERATIONS 175*5df041c4SKyle EvansNote that in some configurations, 176*5df041c4SKyle Evans.Nm 177*5df041c4SKyle Evanswill execute guest loader scripts in the context of the host machine. 178*5df041c4SKyle EvansNote, however, that 179*5df041c4SKyle Evans.Nm 180*5df041c4SKyle Evanswill enter a 181*5df041c4SKyle Evans.Xr capsicum 4 182*5df041c4SKyle Evanssandbox before it loads the 183*5df041c4SKyle Evans.Ar os-loader 184*5df041c4SKyle Evansor executes any loader scripts. 185*5df041c4SKyle EvansOn the host filesystem, the sandbox will only have access to the path specified 186*5df041c4SKyle Evansby the 187*5df041c4SKyle Evans.Fl h 188*5df041c4SKyle Evansflag, the contents of the 189*5df041c4SKyle Evans.Pa /boot 190*5df041c4SKyle Evansdirectory if 191*5df041c4SKyle Evans.Fl l 192*5df041c4SKyle Evanswas not specified, and the chosen console device. 193*5df041c4SKyle Evans.Pp 194*5df041c4SKyle EvansNote that the guest loader scripts are already subject to some limitations that 195*5df041c4SKyle Evansare not relaxed simply because we are running in userland. 196*5df041c4SKyle EvansFor instance, any I/O on the loader's 197*5df041c4SKyle Evans.Dq host 198*5df041c4SKyle Evansdevice that can be done in loader scripts is limited to the interface that 199*5df041c4SKyle Evans.Nm 200*5df041c4SKyle Evansprovides, which itself will restrict paths that can be touched to those within 201*5df041c4SKyle Evansa specified 202*5df041c4SKyle Evans.Fl h 203*5df041c4SKyle Evansdirectory, if any. 204*5df041c4SKyle EvansAccess to files within 205*5df041c4SKyle Evans.Pa /boot 206*5df041c4SKyle Evansinside the sandbox would require arbitrary code execution in userboot, and 207*5df041c4SKyle Evansuserboot is usually provided by the host machine rather than anything that is 208*5df041c4SKyle Evansa part of the guest image. 209*5df041c4SKyle EvansAll access to the 210*5df041c4SKyle Evans.Fl h 211*5df041c4SKyle Evansdirectory as well as 212*5df041c4SKyle Evans.Pa /boot 213*5df041c4SKyle Evansis strictly read-only in the sandbox. 214