4 releases

0.1.3 Feb 13, 2025
0.1.2 Nov 25, 2024
0.1.1 Apr 11, 2024
0.1.0 Mar 26, 2024

#48 in Operating systems

Download history 94/week @ 2024-12-18 73/week @ 2024-12-25 1600/week @ 2025-01-01 475/week @ 2025-01-08 472/week @ 2025-01-15 214/week @ 2025-01-22 418/week @ 2025-01-29 593/week @ 2025-02-05 442/week @ 2025-02-12 921/week @ 2025-02-19 264/week @ 2025-02-26 264/week @ 2025-03-05 314/week @ 2025-03-12 654/week @ 2025-03-19 537/week @ 2025-03-26 704/week @ 2025-04-02

2,232 downloads per month
Used in 2 crates

MIT/Apache

14KB
219 lines

Uhyve Hypervisor Interface

The Uhyve hypercall interface works as follows:

  • On x86_64 you use an out port instruction. The address of the out-port corresponds to the hypercall you want to use. You can obtain it from the IoPorts enum. The data send to that port is the physical memory address (of the VM) of the parameters of that hypercall.
  • On aarch64 you write to the respective HypercallAddress. The 64-bit value written to that location is the guest's physical memory address of the hypercall's parameter.

Uhyve

crates.io Zulip Badge DOI

Uhyve is a minimal, special-purpose hypervisor for the Hermit kernel.

Installation

  1. Install the Rust toolchain. The Rust Foundation provides installation instructions.
  2. Install Uhyve:
cargo install --locked uhyve

Requirements

Linux

To check if your system supports virtualization, you can use the following command:

if egrep -c '(vmx|svm)' /proc/cpuinfo > /dev/null; then echo "Virtualization support found"; fi

Uhyve on Linux depends on the virtualization solution KVM (Kernel-based Virtual Machine). If the following command gives you some output, you are ready to go!

lsmod | grep kvm

Note

If the above steps don't work, make sure that you have enabled virtualization in your UEFI/BIOS settings.

macOS

Warning

Currently, Uhyve is mainly developed for Linux. The macOS version has not been tested extensively and does not support all features of the Linux version.

You can install Apple's Xcode Command Line Tools using the following command:

xcode-select --install

Additionally, the included hypervisor bases on the Hypervisor Framework depending on OS X Yosemite (10.10) or newer.

To verify if your processor is able to support this framework, run the following in your Terminal:

sysctl kern.hv_support

The output kern.hv_support: 1 indicates virtualization support.

Starting with Big Sur, all processes using the Hypervisor API must have the com.apple.security.hypervisor entitlement and therefore must be signed.

Building from source

To build from source, simply checkout the code and use cargo build:

git clone https://github.com/hermit-os/uhyve.git
cd uhyve
cargo build --release

macOS Big Sur: Signing Uhyve

uhyve can be self-signed using the following command:

codesign -s - --entitlements app.entitlements --force path_to_uhyve/uhyve

The file app.entitlements must have following content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.hypervisor</key>
    <true/>
</dict>
</plist>

For further information, please consult Apple's Documentation.

Usage

Assuming that you have installed Uhyve, run the hypervisor to start the unikernel:

uhyve /path/to/the/unikernel/binary

Note

This repository ships a few binaries that can be used for testing.

If you want to compile Hermit binaries yourself (or create your own), take a look at the following repositories:

Configuration

Uhyve can be configured using command line arguments and environment variables. This example launches a virtual machine with 4 GiB of memory and 4 cores:

uhyve -m 4GiB -c 4 path/to/unikernel

For more options, the default values, and the corresponding environment variables run:

uhyve --help

Contributing

If you are interested in contributing to Uhyve, make sure to check out the Uhyve wiki!

Our wiki contains instructions on working with Uhyve's source code, including setting up a suitable development environment, as well as profiling, testing and debugging Uhyve.

Known issues

  • Uhyve isn't able to pass more than 128 environment variables to the unikernel.

Licensing

Licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0.8–1.4MB
~29K SLoC