Skip to content

Commit 58ed851

Browse files
committed
Update README.md
Update README.md to reflect the current features, instructions and communication channels. Signed-off-by: Sergio Lopez <[email protected]>
1 parent 0f1a631 commit 58ed851

File tree

1 file changed

+34
-28
lines changed

1 file changed

+34
-28
lines changed

README.md

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# libkrun
22

3-
```libkrun``` is a dynamic library that allows programs to easily acquire the ability to run processes in a partially isolated environment using [KVM](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt) Virtualization.
3+
```libkrun``` is a dynamic library that allows programs to easily acquire the ability to run processes in a partially isolated environment using [KVM](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt) Virtualization on Linux and [HVF](https://developer.apple.com/documentation/hypervisor) on macOS/ARM64.
44

55
It integrates a VMM (Virtual Machine Monitor, the userspace side of an Hypervisor) with the minimum amount of emulated devices required to its purpose, abstracting most of the complexity that comes from Virtual Machine management, offering users a simple C API.
66

7-
## Possible use cases
7+
## Use cases
88

9-
* Adding VM-isolation capabilities to an OCI runtime.
10-
* Implementing a lightweight jailer for serverless workloads.
11-
* Bringing additional self-isolation capabilities to conventional services (think of something as simple as ```chroot```, but more powerful).
9+
* [crun](https://github.com/containers/crun/blob/main/krun.1.md): Adding Virtualization-based isolation to container and confidential workloads.
10+
* [kunkit](https://github.com/containers/krunkit): Running GPU-enabled (via [venus](https://docs.mesa3d.org/drivers/venus.html)) lightweight VMs on macOS.
11+
* [muvm](https://github.com/AsahiLinux/muvm): Launching a microVM with GPU acceleration (via [native context](https://www.youtube.com/watch?v=9sFP_yddLLQ)) for running games that require 4k pages.
1212

1313
## Goals and non-goals
1414

@@ -30,7 +30,8 @@ It integrates a VMM (Virtual Machine Monitor, the userspace side of an Hyperviso
3030
This project provides two different variants of the library:
3131

3232
- **libkrun**: Generic variant compatible with all Virtualization-capable systems.
33-
- **libkrun-sev**: Variant including support for AMD SEV (bare SEV and SEV-ES) memory encryption and remote attestation. Requires an SEV-capable CPU.
33+
- **libkrun-sev**: Variant including support for AMD SEV (SEV, SEV-ES and SEV-SNP) memory encryption and remote attestation. Requires an SEV-capable CPU.
34+
- **libkrun-efi**: Variant that bundles OVMF/EDK2 for booting a distribution-provided kernel (only available on macOS).
3435

3536
Each variant generates a dynamic library with a different name (and ```soname```), so both can be installed at the same time in the same system.
3637

@@ -39,24 +40,22 @@ Each variant generates a dynamic library with a different name (and ```soname```
3940
### All variants
4041

4142
* virtio-console
42-
* virtio-vsock (specialized for TSI, Transparent Socket Impersonation)
4343
* virtio-block
44-
45-
### libkrun
46-
4744
* virtio-fs
45+
* virtio-gpu (venus and native-context)
46+
* virtio-net
47+
* virtio-vsock (for TSI and socket redirection)
4848
* virtio-balloon (only free-page reporting)
4949
* virtio-rng
50+
* virtio-snd
5051

5152
## Networking
5253

53-
In ```libkrun```, networking is implemented using a novel technique called **Transparent Socket Impersonation**, or **TSI**. This allows the VM to have network connectivity without a virtual interface (hence, ```virtio-net``` is not among the list of supported devices).
54+
In ```libkrun```, networking is provided by two different, mutually exclusive techniques:
5455

55-
This technique supports both outgoing and incoming connections. It's possible for userspace applications running in the VM are able to transparently connect to endpoints outside the VM, and also receive connections from the outside to ports listening inside the VM.
56+
- **virtio-vsock + TSI**: A novel technique called **Transparent Socket Impersonation** which allows the VM to have network connectivity without a virtual interface. This technique supports both outgoing and incoming connections. It's possible for userspace applications running in the VM to transparently connect to endpoints outside the VM and receive connections from the outside to ports listening inside the VM. Requires a custom kernel (like the one bundled in **libkrunfw**) and it's limited to AF_INET SOCK_DGRAM and SOCK_STREAM sockets.
5657

57-
### Limitations
58-
59-
**TSI** only supports impersonating AF_INET SOCK_DGRAM and SOCK_STREAM sockets. This implies it's not possible to communicate outside the VM with raw sockets.
58+
- **virtio-net + passt/gvproxy**: A conventional virtual interface that allows the guest to communicate with the outside through the VMM using a supporting application like [passt](https://passt.top/passt/about/) or [gvproxy](https://github.com/containers/gvisor-tap-vsock).
6059

6160
## Building and installing
6261

@@ -69,10 +68,18 @@ This technique supports both outgoing and incoming connections. It's possible fo
6968
* C Library static libraries, as the [init](init/init.c) binary is statically linked (package ```glibc-static``` in Fedora)
7069
* patchelf
7170

71+
#### Optional features
72+
73+
* **GPU=1**: Enables virtio-gpu. Requires virglrenderer-devel.
74+
* **VIRGL_RESOURCE_MAP2=1**: Uses virgl_resource_map2 function. Requires a virglrenderer-devel patched with [1374](https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1374)
75+
* **BLK=1**: Enables virtio-block.
76+
* **NET=1**: Enables virtio-net.
77+
* **SND=1**: Enables virtio-snd.
78+
7279
#### Compiling
7380

7481
```
75-
make
82+
make [FEATURE_OPTIONS]
7683
```
7784

7885
#### Installing
@@ -103,19 +110,23 @@ make SEV=1
103110
sudo make SEV=1 install
104111
```
105112

106-
### macOS
113+
### macOS (EFI variant)
107114

108115
#### Requirements
109116

110-
As part of ```libkrun``` building process, it's necessary to produce a Linux ELF binary from [init/init.c](init/init.c). The easiest way to do this is by using a binary version of [krunvm](https://github.com/slp/krunvm) and its dependencies ([libkrunfw](https://github.com/containers/libkrunfw), and ```libkrun``` itself), such as the one available in the [krunvm Homebrew repo](https://github.com/slp/homebrew-krun), and then executing the [build_on_krunvm.sh](build_on_krunvm.sh) script found in this repository.
117+
* A working [Rust](https://www.rust-lang.org/) toolchain
118+
119+
#### Compiling
111120

112-
This will create a lightweight Linux VM using ```krunvm``` with the current working directory mapped inside it, and produce the Linux ELF binary from [init/init.c](init/init.c).
121+
```
122+
make EFI=1
123+
```
113124

114-
#### Building the library using krunvm
125+
#### Installing
115126

116127
```
117-
./build_on_krunvm.sh
118-
make
128+
sudo make EFI=1 install
129+
119130
```
120131

121132
## Using the library
@@ -167,14 +178,9 @@ LD_LIBRARY_PATH=/usr/local/lib64 ./chroot_vm rootfs/ /bin/sh
167178

168179
```libkrun``` has achieved maturity and starting version ```1.0.0``` the public API is guaranteed to be stable, following [SemVer](https://semver.org/).
169180

170-
### Known users
171-
172-
- [crun](https://github.com/containers/crun): An OCI runtime that can make use of libkrun to run containers with Virtualization-based isolation.
173-
- [krunvm](https://github.com/slp/krunvm): A CLI tool for creating and running microVMs based on OCI images.
174-
175181
## Getting in contact
176182

177-
The main communication channel is the [VirTEE Matrix channel](https://matrix.to/#/#virtee:matrix.org).
183+
The main communication channel is the [libkrun Matrix channel](https://matrix.to/#/#libkrun:matrix.org).
178184

179185
## Acknowledgments
180186

0 commit comments

Comments
 (0)