$ show Solo5/solo5
Solo5 is a sandboxed execution environment for unikernels, providing a minimal, legacy-free interface between unikernel applications and host systems. It supports multiple backends: hvt (hardware virtualization via KVM, FreeBSD/OpenBSD/DragonFly vmm), spt (Linux seccomp sandbox), virtio (QEMU/bhyve), Xen, and Muen. The architecture consists of guest-side bindings (implementing the solo5_* API) and host-side tenders (loaders/runtime components). Key entry points include the guest's _start() in each binding's start.c and the tender's main (e.g., hvt_main.c, spt_main.c). Data flows are synchronous: unikernels communicate via hypercalls (hvt), seccomp-allowed syscalls (spt), or Xen hypercalls, with shared-memory ring buffers for I/O. External dependencies include libseccomp (spt), KVM/BSD hypervisor APIs, and vendored Xen public headers. The project originated from IBM Research and is used by MirageOS and other unikernel frameworks.
The LLM identified 6 files worth highlighting for reuse:
A self-contained, static-inline JSON parser derived from jsoncvt. It provides tokenization and parsing of JSON strings into a tree structure, with no external dependencies. Reusable in any C project needing lightweight JSON parsing, such as configuration file readers or manifest processors.
A minimal printf/snprintf implementation (from mpaland) that avoids dynamic memory allocation. It supports standard format specifiers and is thread-safe. Ideal for unikernel or embedded environments where a full libc printf is too heavy. Can be extracted and used in any freestanding C project.
A backend-independent ELF loader that validates ELF headers, loads segments with alignment and permission checks, and extracts Solo5 ELF notes (ABI, manifest). It is used by all tenders (hvt, spt, etc.) and can be reused in any project that needs to load ELF binaries with strict validation.
Manifest handling code that parses and validates the MFT1 ELF note, providing lookup functions (by name, by index) for device declarations. Shared between tenders and bindings. Demonstrates a clean pattern for embedding structured metadata in ELF binaries and querying it at runtime.
A producer-consumer ring buffer with memory barriers, used for shared-memory I/O between the hvt tender and guest. Supports batched commit processing and kick suppression. The pattern is reusable for any high-performance inter-process or guest-host communication channel.
Provides fallback implementations for compiler builtins like __builtin_add_overflow when not available. Also defines common macros for alignment and atomic operations. Useful for projects that need to support older or less common compilers without losing safety checks.