{"id":19866233,"url":"https://github.com/hyperlight-dev/hyperlight","last_synced_at":"2026-04-19T18:02:11.102Z","repository":{"id":261504511,"uuid":"883829350","full_name":"hyperlight-dev/hyperlight","owner":"hyperlight-dev","description":"Hyperlight is a lightweight Virtual Machine Manager (VMM) designed to be embedded within applications. It enables safe execution of untrusted code within micro virtual machines with very low latency and minimal overhead.","archived":false,"fork":false,"pushed_at":"2026-03-06T06:14:49.000Z","size":6458,"stargazers_count":4161,"open_issues_count":168,"forks_count":162,"subscribers_count":32,"default_branch":"main","last_synced_at":"2026-03-06T11:14:14.514Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyperlight-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":"SUPPORT.md","governance":"GOVERNANCE.md","roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE.txt","maintainers":"MAINTAINERS.md","copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-05T16:39:07.000Z","updated_at":"2026-03-06T09:32:43.000Z","dependencies_parsed_at":"2024-11-06T22:41:21.816Z","dependency_job_id":"8aa5f810-d551-4abb-9763-32a4382dd71c","html_url":"https://github.com/hyperlight-dev/hyperlight","commit_stats":null,"previous_names":["hyperlight-dev/hyperlight"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/hyperlight-dev/hyperlight","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperlight-dev%2Fhyperlight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperlight-dev%2Fhyperlight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperlight-dev%2Fhyperlight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperlight-dev%2Fhyperlight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperlight-dev","download_url":"https://codeload.github.com/hyperlight-dev/hyperlight/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperlight-dev%2Fhyperlight/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30571981,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-16T06:02:37.763Z","status":"ssl_error","status_checked_at":"2026-03-16T06:02:14.913Z","response_time":96,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T15:25:17.739Z","updated_at":"2026-03-16T07:25:43.155Z","avatar_url":"https://github.com/hyperlight-dev.png","language":"Rust","readme":"\u003cdiv align=\"center\"\u003e\n    \u003ch1\u003eHyperlight\u003c/h1\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/hyperlight-dev/hyperlight/refs/heads/main/docs/assets/hyperlight-logo.png\" width=\"150px\" alt=\"hyperlight logo\"/\u003e\n    \u003cp\u003e\u003cstrong\u003eHyperlight is a lightweight Virtual Machine Manager (VMM) designed to be embedded within applications. It enables safe execution of untrusted code within \u003ci\u003emicro virtual machines\u003c/i\u003e with very low latency and minimal overhead.\u003c/strong\u003e \u003cbr\u003e We are a \u003ca href=\"https://cncf.io/\"\u003eCloud Native Computing Foundation\u003c/a\u003e sandbox project. \u003c/p\u003e\n\u003c/div\u003e\n\n\u003e Note: Hyperlight is a nascent project with an evolving API and no guaranteed support. Assistance is provided on a\n\u003e best-effort basis by the developers.\n\n---\n\n## Overview\n\nHyperlight is a library for creating _micro virtual machines_  — or _sandboxes_ — specifically optimized for securely\nrunning untrusted code with minimal impact. It supports both Windows and Linux,\nutilizing [Windows Hypervisor Platform](https://docs.microsoft.com/en-us/virtualization/api/#windows-hypervisor-platform)\non Windows, and either Microsoft Hypervisor (mshv) or [KVM](https://linux-kvm.org/page/Main_Page) on Linux.\n\nThese micro VMs operate without a kernel or operating system, keeping overhead low. Instead, guests are built\nspecifically for Hyperlight using the Hyperlight Guest library, which provides a controlled set of APIs that facilitate\ninteraction between host and guest:\n\n- The host can call functions implemented and exposed by the guest (known as _guest functions_).\n- Once running, the guest can call functions implemented and exposed by the host (known as _host functions_).\n\nBy default, Hyperlight restricts guest access to a minimal API. The only _host function_ available by default allows the\nguest to print messages, which are displayed on the host console or redirected to stdout, as configured. Hosts can\nchoose to expose additional host functions, expanding the guest’s capabilities as needed.\n\nBelow is an example demonstrating the use of the Hyperlight host library in Rust to execute a simple guest application.\nIt is followed by an example of a simple guest application using the Hyperlight guest library, also written in Rust.\n\n### Host\n\n```rust\nuse std::thread;\n\nuse hyperlight_host::{MultiUseSandbox, UninitializedSandbox};\n\nfn main() -\u003e hyperlight_host::Result\u003c()\u003e {\n    // Create an uninitialized sandbox with a guest binary\n    let mut uninitialized_sandbox = UninitializedSandbox::new(\n        hyperlight_host::GuestBinary::FilePath(\"path/to/your/guest/binary\".to_string()),\n        None // default configuration\n    )?;\n\n    // Registering a host function makes it available to be called by the guest\n    uninitialized_sandbox.register(\"Sleep5Secs\", || {\n        thread::sleep(std::time::Duration::from_secs(5));\n        Ok(())\n    })?;\n    // Note: This function is unused by the guest code below, it's just here for demonstration purposes\n\n    // Initialize sandbox to be able to call host functions\n    let mut multi_use_sandbox: MultiUseSandbox = uninitialized_sandbox.evolve()?;\n\n    // Call a function in the guest\n    let message = \"Hello, World! I am executing inside of a VM :)\\n\".to_string();\n    // in order to call a function it first must be defined in the guest and exposed so that\n    // the host can call it\n    multi_use_sandbox.call::\u003ci32\u003e(\n        \"PrintOutput\",\n        message,\n    )?;\n\n    Ok(())\n}\n```\n\n### Guest\n\nFirst, create a `Cargo.toml` with the required dependencies:\n\n```toml\n[package]\nname = \"my-hyperlight-guest\"\nversion = \"0.1.0\"\nedition = \"2024\"\n\n[dependencies]\nhyperlight-guest = \"0.12\"\nhyperlight-guest-bin = \"0.12\"\nhyperlight-common = { version = \"0.12\", default-features = false }\n```\n\n\u003e **Important:** The `hyperlight-common` crate must have `default-features = false` to avoid pulling in\n\u003e the standard library, which conflicts with the `no_std` requirement for guests.\n\nThen, create `src/main.rs`:\n\n```rust\n#![no_std]\n#![no_main]\nextern crate alloc;\nextern crate hyperlight_guest_bin;\n\nuse alloc::vec::Vec;\nuse alloc::string::String;\nuse hyperlight_common::flatbuffer_wrappers::function_call::FunctionCall;\nuse hyperlight_common::flatbuffer_wrappers::guest_error::ErrorCode;\n\nuse hyperlight_guest::bail;\nuse hyperlight_guest::error::Result;\nuse hyperlight_guest_bin::{guest_function, host_function};\n\n#[host_function(\"HostPrint\")]\nfn host_print(message: String) -\u003e Result\u003ci32\u003e;\n\n#[guest_function(\"PrintOutput\")]\nfn print_output(message: String) -\u003e Result\u003ci32\u003e {\n    let result = host_print(message)?;\n    Ok(result)\n}\n\n#[no_mangle]\npub extern \"C\" fn hyperlight_main() {\n    // any initialization code goes here\n}\n\n#[no_mangle]\npub fn guest_dispatch_function(function_call: FunctionCall) -\u003e Result\u003cVec\u003cu8\u003e\u003e {\n    let function_name = function_call.function_name;\n    bail!(ErrorCode::GuestFunctionNotFound =\u003e \"{function_name}\");\n}\n```\n\nBuild the guest using [cargo-hyperlight](https://github.com/hyperlight-dev/cargo-hyperlight):\n\n```sh\ncargo install --locked cargo-hyperlight\ncargo hyperlight build\n```\n\n\u003e **Note:** You must use `cargo hyperlight build` instead of the regular `cargo build` command.\n\u003e The `cargo-hyperlight` tool sets up the required custom target, sysroot, and compiler flags\n\u003e that are necessary for building Hyperlight guests.\n\nFor additional examples of using the Hyperlight host Rust library, see\nthe [./src/hyperlight_host/examples](./src/hyperlight_host/examples) directory.\n\nFor examples of guest applications, see the [./src/tests/c_guests](./src/tests/c_guests) directory for C guests and\nthe [./src/tests/rust_guests](./src/tests/rust_guests) directory for Rust guests.\n\n\u003e Note: Hyperlight guests can be written using the Hyperlight Rust or C Guest libraries.\n\n## Repository Structure\n\n- Hyperlight Host Libraries (i.e., the ones that create and manage the VMs)\n    - [src/hyperlight_host](./src/hyperlight_host) - This is the Rust Hyperlight host library.\n\n- Hyperlight Guest Libraries (i.e., the ones to make it easier to create guests that run inside the VMs)\n    - [src/hyperlight_guest](./src/hyperlight_guest) - The core Rust library for Hyperlight guests. It provides only the essential building blocks for interacting with the host environment, including the VM exit mechanism (`outb`), abstractions for calling host functions and receiving return values, and the input/output stacks used for guest-host communication.\n    - [src/hyperlight_guest_bin](./src/hyperlight_guest_bin/) - An extension to the core Rust library for Hyperlight guests. It contains more opinionated components (e.g., panic handler, heap initialization, musl-specific imports, logging, and exception handling).\n    - [src/hyperlight_guest_capi](./src/hyperlight_guest_capi) - A C-compatible wrapper around `hyperlight_guest_bin`, exposing its core functionality for use in C programs and other languages via FFI.\n\n- Hyperlight Common (functionality used by both the host and the guest)\n    - [src/hyperlight_common](./src/hyperlight_common)\n\n- Test Guest Applications:\n    - [src/tests/rust_guests](./src/tests/rust_guests) - This directory contains three Hyperlight Guest programs written\n      in Rust, which are intended to be launched within partitions as \"guests\".\n    - [src/tests/c_guests](./src/tests/c_guests) - This directory contains two Hyperlight Guest programs written in C,\n      which are intended to be launched within partitions as \"guests\".\n\n- Tests:\n    - [src/hyperlight-testing](./src/hyperlight_testing) - Shared testing code for Hyperlight projects built in Rust.\n\n## Try it yourself!\n\nYou can run Hyperlight on:\n\n- [Linux with KVM][kvm].\n- [Windows with Windows Hypervisor Platform (WHP).][whp] -  Note that you need Windows 11 / Windows Server 2022 or later to use hyperlight, if you are running on earlier versions of Windows then you should consider using our devcontainer on [GitHub codespaces]((https://codespaces.new/hyperlight-dev/hyperlight)) or WSL2.\n- Windows Subsystem for Linux 2 (see instructions [here](https://learn.microsoft.com/en-us/windows/wsl/install) for Windows client and [here](https://learn.microsoft.com/en-us/windows/wsl/install-on-server) for Windows Server) with KVM.\n- Azure Linux with mshv (note that you need mshv to be installed to use Hyperlight)\n\nAfter having an environment with a hypervisor setup, running the example has the following pre-requisites:\n\n1. On Linux or WSL, you'll most likely need build essential. For Ubuntu, run `sudo apt install build-essential`. For\n   Azure Linux, run `sudo dnf install build-essential`.\n2. [Rust](https://www.rust-lang.org/tools/install). Install toolchain v1.89 or later.\n3. [just](https://github.com/casey/just). `cargo install just` On Windows you also need [pwsh](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.4).\n4. [clang and LLVM](https://clang.llvm.org/get_started.html).\n    - On Ubuntu, run:\n\n        ```sh\n        wget https://apt.llvm.org/llvm.sh\n        chmod +x ./llvm.sh\n        sudo ./llvm.sh 18 clang clang-tools-extra\n        sudo ln -s /usr/lib/llvm-18/bin/ld.lld /usr/bin/ld.lld\n        sudo ln -s /usr/lib/llvm-18/bin/clang /usr/bin/clang\n        ```\n\n    - On Windows, see [this](https://learn.microsoft.com/en-us/cpp/build/clang-support-msbuild?view=msvc-170).\n\n    - On Azure Linux, run:\n\n        ```sh\n        if ! command -v clang \u003e /dev/null 2\u003e\u00261; then\n            sudo dnf install clang -y\n            sudo dnf install clang-tools-extra -y\n        fi\n        ```\n\nThen, we are ready to build and run the example:\n\n```sh\njust build  # build the Hyperlight library\njust rg     # build the rust test guest binaries\ncargo run --example hello-world\n```\n\nIf all worked as expected, you should see the following message in your console:\n\n```text\nHello, World! I am executing inside of a VM :)\n```\n\nIf you get the error `Error: NoHypervisorFound` and KVM or mshv is set up then this may be a permissions issue. In bash,\nyou can use `ls -l /dev/kvm` or  `ls -l /dev/mshv` to check which group owns that device and then `groups` to make sure\nyour user is a member of that group.\n\nFor more details on how to verify that KVM is correctly installed and permissions are correct, follow the\nguide [here](https://help.ubuntu.com/community/KVM/Installation).\n\nFor additional debugging tips, including common build and runtime issues, see the [How to build a Hyperlight guest binary](./docs/how-to-build-a-hyperlight-guest-binary.md) guide.\n\n### Or you can use a codespace\n\n[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/hyperlight-dev/hyperlight)\n\n## Contributing to Hyperlight\n\nIf you are interested in contributing to Hyperlight, running the entire test-suite is a good way to get started. To do\nso, on your console, run the following commands:\n\n```sh\njust guests  # build the c and rust test guests\njust build  # build the Hyperlight library\njust test # runs the tests\n```\n\nAlso , please review the [CONTRIBUTING.md](./CONTRIBUTING.md) file for more information on how to contribute to\nHyperlight.\n\n\u003e Note: For general Hyperlight development, you may also need flatc (Flatbuffer compiler): for instructions,\n\u003e see [here](https://github.com/google/flatbuffers).\n\u003e Copyright © contributors to Hyperlight, established as Hyperlight a Series of LF Projects, LLC.\n\n## Join our Community Meetings\n\nThis project holds fortnightly community meetings to discuss the project's progress, roadmap, and any other topics of interest. The meetings are open to everyone, and we encourage you to join us.\n\n- **When**: Every other Wednesday 09:00 (PST/PDT) [Convert to your local time](https://dateful.com/convert/pst-pdt-pacific-time?t=09)\n- **Where**: Zoom! - Agenda and information on how to join can be found in the [Hyperlight Community Meeting Notes](https://hackmd.io/blCrncfOSEuqSbRVT9KYkg#Agenda). Please log into hackmd to edit!\n\n## Chat with us on the CNCF Slack\n\nThe Hyperlight project Slack is hosted in the CNCF Slack #hyperlight. To join the Slack, [join the CNCF Slack](https://www.cncf.io/membership-faq/#how-do-i-join-cncfs-slack), and join the #hyperlight channel.\n\n## More Information\n\nFor more information, please refer to our compilation of documents in the [`docs/` directory](./docs/README.md).\n\n## Code of Conduct\n\nSee the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md).\n\n[wsl2]: https://docs.microsoft.com/en-us/windows/wsl/install\n\n[kvm]: https://help.ubuntu.com/community/KVM/Installation\n\n[whp]: https://devblogs.microsoft.com/visualstudio/hyper-v-android-emulator-support/#1-enable-hyper-v-and-the-windows-hypervisor-platform\n\n\n## FOSSA Status\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fhyperlight-dev%2Fhyperlight.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fhyperlight-dev%2Fhyperlight?ref=badge_large)\n","funding_links":[],"categories":["Rust","Uncategorized","Projects","Sandboxing \u0026 Isolation"],"sub_categories":["Uncategorized","Security"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperlight-dev%2Fhyperlight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperlight-dev%2Fhyperlight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperlight-dev%2Fhyperlight/lists"}