A network filesystem for sharing host directories with virtual machines. A
namespace starts empty, and rules attach host paths to it, each one rw, ro
or hidden. The server checks every operation against the rules. Rules can
change while guests have the namespace mounted.
| Program | What it does |
|---|---|
voidportd |
The server. It reads its configuration from a TOML state file and runs the listeners for guests and the control socket. |
voidport |
The guest client: voidport mount, voidport umount, voidport subscribe, and the mount.voidport helper of mount(8). |
voidport-ctl |
Changes the configuration of a running server through its control socket. |
voidport-keeper |
Connects the vhost-user-fs-pci device of a virtual machine to voidportd, and makes the device available while voidportd restarts. |
voidport-mount-manager |
Mounts every share of a namespace under a directory and unmounts the shares that go away, following voidport subscribe. |
Every program except voidport-mount-manager has a manual page (man voidportd, man voidport, and one per subcommand) and --help.
$ nix develop -c cargo build --releasenix build builds the programs with their manual pages and the
mount.voidport link. nix build .#kernel-module builds the kernel module.
Share a directory. Name at least one listener: --addr HOST:PORT, --unix PATH or --vsock PORT, each repeatable.
$ voidportd share /srv/shared/project --addr 0.0.0.0:9000
namespace "share" is being served.
Mount it from the guest:
voidport mount voidport://0.0.0.0:9000/@share /mnt/share
Reconfigure it from this machine:
voidport-ctl --socket /home/you/.local/state/voidport/control.sock info
auth is "none": anything that can connect to the tcp listener can mount this namespace. See the Security section of the voidport README.Run the printed line in the guest, with an address of the host that the guest can connect to:
$ voidport mount voidport://10.0.2.2:9000/@share /mnt/share
$ ls /mnt/share/srv/shared/project
README.md src/The directory appears below the mountpoint under the path it has on the host.
share writes the share into $XDG_STATE_HOME/voidport/state.toml (or
--state PATH) and then starts the server on that file, so the share survives
a restart. Other options: --ro, --name NAME (default share) and
--control-socket PATH. With --vsock 0 or a tcp port 0, the server picks a
free port at every start.
The state file contains the whole configuration. The example state file
installed with the programs, share/doc/voidport/state.toml in the output of
nix build, shows every key with a comment. Start the server on a state file:
$ voidportd --state state.tomlA missing state file is created empty. A file that does not parse stops the
start. The server writes every change made through voidport-ctl back to
the file. Started with NOTIFY_SOCKET set, the server sends READY=1 once
the control socket and every listener accept connections.
The server runs as two voidportd processes. The process you started locks
the state file and has the control socket and every listening socket open
for its whole life. It starts the process that handles requests and hands
it copies of those sockets over a socket pair. It also opens listeners
added with voidport-ctl listener add.
Send SIGTERM or SIGINT to the process you started. It stops the process that handles requests and then exits.
If the process that handles requests was ready and ends unexpectedly, the
process you started immediately starts a replacement. The listening
addresses remain open. Clients connecting in the meantime will wait until
request processing resumes. If the process that handles requests ends
before it is ready, voidportd stops and closes its listening addresses.
Clients will continue to wait and retry. Fix the cause shown in the log,
then start voidportd again.
Change a running server with voidport-ctl:
$ voidport-ctl namespace list
$ voidport-ctl rule add project /docs --mode ro --target /srv/shared/docs
$ voidport-ctl rule add project /work --match 'project-*' --mode rw
$ voidport-ctl rule add project /secrets --mode hidden
$ voidport-ctl rule remove project /docs
$ voidport-ctl xattr add project 'user.*' --write deny
$ voidport-ctl listener add --addr 0.0.0.0:9000
$ voidport-ctl session list
$ voidport-ctl resolve project /docs/index.mdA rule change applies to new lookups and opens. Open handles still have the access they were opened with.
Without --socket, voidport-ctl and voidportd --tui use
$XDG_STATE_HOME/voidport/control.sock and then /run/voidport/control.sock.
A mount URL contains the namespace name after @. It may add a path inside
the namespace:
voidport://HOST:PORT/@project/srcover tcpvoidport+unix://%2Frun%2Fvoidport%2Fdata.sock/@projectover a unix socket, with the socket path percent-encodedvoidport+vsock://2:1024/@projectover vsock, where 2 is the cid of the hostvoidport+virtio://voidport-0/@project/srcover a virtio device taggedvoidport-0
voidport umount DIR unmounts either kind of mount.
A change made on the host or through another mount shows in the next
lookup, stat and read of every mount. A mount caches the pages of a file
only while the server has a lease on it. It caches the attributes of a
file or a directory, and the names in a directory, only while the server
has a delegation of it, which a host kernel grants from Linux 6.19 on.
The server grants attributes only on a host mount with noatime. The
server recalls the lease or the delegation before the change goes ahead.
fcntl record locks and flock locks work across mounts and with the host
(on FUSE mounts, directory flock stays local to the mount because Linux FUSE
does not forward directory flock).
voidport mount URL DIR mounts over FUSE when the kernel module is not
loaded or the process may not mount through it, and always for a vsock URL.
It needs /dev/fuse and runs in the foreground until the mount ends.
SIGINT and SIGTERM unmount. While a program still uses the mount, new
programs see an empty folder, and the client exits once the last program has
let go. A second SIGINT or SIGTERM ends the mount at once, and the
programs still using it get errors. Options: --read-only, --allow-other,
--dispatch-threads, --no-auto-unmount, --no-privileged-bits and
--direct-io. Started with NOTIFY_SOCKET set, it sends READY=1 once the
mount is up.
nix build .#kernel-module builds voidport.ko for the kernel of
linuxPackages_latest in the nixpkgs revision locked by the flake. Its output
contains the module as voidport/voidport.ko. Copy that file into any
directory of the guest and load it from there, only on that kernel:
# insmod voidport.koWith the module loaded, voidport mount of a tcp, unix, or virtio URL mounts
through the module and returns at once. A kernel mount needs CAP_SYS_ADMIN.
mount(8) and fstab use the same URLs through the mount.voidport helper:
# mount -t voidport voidport://build-host:9000/@project/src /mnt/src
# mount -t voidport voidport+virtio://voidport-0/@project/src /mnt/src
$ grep voidport /etc/fstab
voidport+virtio://voidport-0/@project/src /mnt/src voidport _netdev 0 0The generic mount options work, and the module accepts no_privileged_bits
and direct_io.
Busybox mount does not pass the generic options, such as ro, to the helper.
On NixOS guests (with a kernel built with CONFIG_RUST=y, such as Linux 7.3),
import nixosModules.guest from the flake to install the module, udev binding
rule, and voidport / mount.voidport tools together:
{
imports = [ voidport.nixosModules.guest ];
hardware.voidport.enable = true;
}To build voidport.ko manually for another Rust-enabled kernel package, use
voidport.lib.kernelModuleFor pkgs config.boot.kernelPackages.kernel.
A virtual machine can connect to the server through a virtio device.
Add a vhost-user listener, start the keeper before QEMU, and give QEMU a
device with a tag that starts with voidport-:
$ voidport-ctl listener add --vhost-user /run/voidport/vhost-user.sock
$ voidport-keeper --vm /run/vm/voidport.sock --server /run/voidport/vhost-user.sock
$ qemu-system-x86_64 ... -m 4G \
-object memory-backend-memfd,id=mem,size=4G,share=on \
-machine q35,memory-backend=mem \
-chardev socket,id=voidport,path=/run/vm/voidport.sock \
-device vhost-user-fs-pci,chardev=voidport,tag=voidport-0The output of nix build .#kernel-module also contains the udev rule as
lib/udev/rules.d/60-voidport.rules. Copy it into /etc/udev/rules.d when
installing without the NixOS module; it binds voidport-* virtio devices to
voidport.ko. Then mount via voidport+virtio:// or directly by tag:
# voidport mount voidport+virtio://voidport-0/@project /mnt/project
# mount -i -t voidport project /mnt/project -o tag=voidport-0Virtio mounts support server-to-guest notifications (leases, delegations, page
caching, and MAP_SHARED / MAP_PRIVATE mappings) and survive voidportd
restarts through voidport-keeper.
To map host file pages directly into guest physical memory over virtio, give
voidport-keeper a --dax-window size in bytes (a non-zero multiple of the
host page size) together with --tag and --queues, and attach QEMU's
vhost-user-test-device-pci (stock QEMU 11.1.2 vhost-user-fs-pci does not
expose a DAX shared-memory region):
$ voidport-keeper \
--vm /run/vm/voidport.sock \
--server /run/voidport/vhost-user.sock \
--tag voidport-0 --queues 2 --dax-window 67108864
$ qemu-system-x86_64 ... -m 4G \
-object memory-backend-memfd,id=mem,size=4G,share=on \
-machine q35,memory-backend=mem \
-chardev socket,id=voidport,path=/run/vm/voidport.sock \
-device vhost-user-test-device-pci,chardev=voidport,virtio-id=26,config_size=40,num_vqs=3,vq_size=128Leased handles use DAX automatically when the device advertises a window.
Stock QEMU 11.1.2 opens SHMEM_MAP backing mappings PROT_READ | PROT_WRITE
even for read-only maps, so files opened only read-only fall back cleanly to
direct RPC reads while writable handles (and read-only handles sharing an open
writable file) use DAX directly.
voidport subscribe URL prints one JSON object per line: a snapshot of
every share first, then added, changed, removed, lapsed, stalled,
disconnected, resumed and ended. After lapsed and resumed, a new
snapshot replaces all earlier state.
stalled means the server session was lost and requests and re-subscription
are waiting for the same URL and namespace. It is emitted once for that session
loss, and reconnect attempts do not repeat it. A whole-session loss emits
stalled immediately before disconnected unless loss of the subscribed
connection already emitted disconnected; in that case, the later session loss
emits only stalled. When only the subscribed connection is lost and the session
survives, the stream still emits only disconnected.
stalled reports when the loss became known, not when the peer went silent. TCP
clients use the operating system's keepalive mechanism, and voidport chooses no
probe timing. Linux documents defaults of two hours before probes, nine probes,
and 75 seconds between probes, so detection can take about 2 hours 11 minutes.
net.ipv4.tcp_keepalive_time, net.ipv4.tcp_keepalive_intvl and
net.ipv4.tcp_keepalive_probes control this delay (Linux
Documentation/networking/ip-sysctl.rst, checked 2026-10-29). Unix and vsock
connections use the loss signals they already had.
$ voidport subscribe voidport://10.0.2.2:9000/@project
{"entries":[{"kind":"directory","mode":"rw","path":"/src"}],"event":"snapshot","v":1}
{"event":"added","kind":"directory","mode":"ro","path":"/docs","v":1}
{"event":"removed","path":"/docs","v":1}voidport-mount-manager URL DIR [MOUNT_URL] mounts every share under DIR and
unmounts the shares that go away. Pass a third argument (or set
VOIDPORT_MOUNT_URL) to subscribe over one transport (such as vsock) while
mounting shares over virtio:
$ voidport-mount-manager voidport://10.0.2.2:9000/@project /mnt/project
$ voidport-mount-manager voidport+vsock://2:1024/@project /mnt/project \
voidport+virtio://voidport-0/@projectEvery namespace uses auth = "none". Any process that can connect to a data
listener can mount every namespace of the server, and read and write what the
rules allow. The traffic is neither encrypted nor authenticated.
- Every network that can route to the address of a tcp listener can connect to it. Bind it to an interface that only the virtual machines can connect to, and never use it across an untrusted network. A server with a tcp listener prints a note about this at start.
- Every virtual machine on the host can connect to a vsock listener, and the
host itself can where the vsock loopback module is loaded. Set
cidto accept one machine only. - Unix and vhost-user listeners and the control socket are created with mode 0600. A process that can connect to the control socket can change every namespace.
$ nix run .#checknix run .#check runs cargo fmt --check, cargo clippy -D warnings and the
test suite of the workspace in the development shell. Run the tests of one
crate with nix develop -c cargo test -p voidportd. The end-to-end tests mount
over FUSE and need /dev/fuse.
nix run .#kernel-ladder runs the kernel ladder: the tests of the kernel
module, one step after the other, on the stable, longterm and mainline kernels
and on a debug build of each. The steps build the module, check its format
and lints against the configuration of the kernel tree, and mount voidport in
KVM guests.
Both commands use the checkout that contains the current directory.
The source contains the full text of each license, in a file named after the SPDX identifier of the license.
| Component | License |
|---|---|
voidportd, voidport-rules |
AGPL-3.0-only |
voidport-proto, voidport-session |
MIT |
the kernel module voidport.ko and its udev rule, the crates voidport-kernel-options and mapping-test, and the build, tests and tooling of the module, the kernel ladder included |
GPL-2.0-only |
| every other crate and file | GPL-3.0-only |