scrotwmos features
This is the list of what the code does today. Each line names one feature, its status, and where the code is. The code location is a path and a function name. A path alone means the feature is the whole file or a build rule. Tests are named where a test runs the feature.
Status words:
- built+tested: the code exists and a test in
regress/or acheck-*target runs it. - built: the code exists and is wired in. No test runs it directly.
- partial: some of the path exists. The line says what is missing.
- not built: a library or a parser exists, but nothing calls it. Things that do not exist at all are in Not built yet.
The security record is in security.md. How to build is in building.md. How to run the suites is in testing.md.
1. Boot
1.1 Boot chains and modes
- Appliance chain: firmware, then
swmstub.efias\EFI\BOOT\BOOTX64.EFI, then a username and password, then the sealed boot image, then the dom0 kernel with swm-wl as/init. built+tested (check-stub, check-hostboot, check-appliance).bin/swmstub/swmstub.cefi_main() - byol chain: firmware, then
byolstub.efi, then the password or the TPM, then the LUKS root key appended to the initrd, then Void Linux with runit, then swm-wl on VT 2. built+tested (check-boot, check-install).bin/swmstub/byolstub.cefi_main() - Install media chain: firmware, then
swminstall.efi, then the signed installer kernel, thenmedia-initas PID 1, thenswmtool. built+tested (check-stub, check-appliance).bin/swmstub/swminstall.cefi_main(),scripts/appliance/media-init - Bare Wayland mode: swm-wl started by hand from a VT, with real DRM and seatd, logind or its own monitor as the seat. built.
scripts/start-swm.sh,bin/swm-wl/main.cmain() - X11 mode: swm-x11 under an X server, as an ordinary program. built+tested (check-x11).
bin/swm-x11/main.c - Web mode: swm-web serves a tiling terminal page to a browser. built.
bin/swm-web/main.c - Mode selection: the loader on the ESP picks the chain. In swm-wl,
getpid() == 1selects the dom0 bring-up. built+tested (testdom0pid1).bin/swm-wl/main.cmain() - Session driver selection:
privsepwith a root monitor,containeras root with no monitor,noneotherwise. As PID 1,noneis refused. built+tested (testdriver, testdom0_pid1).bin/swm-wl/wl_session.csession_bus_launch() - No boot menu: the typed username picks the world and its A or B slot. The boot image’s file name is a hash of the master and the username. built+tested (test_keys, check-stub).
lib/libkeys/keys.ckeys_blob_name()
1.2 Appliance loader (swmstub)
- Freestanding PE32+ build: gcc and
ld -m i386pep, no gnu-efi or EDK2, no GOT, no TLS, no time stamp. built+tested (check-stub).bin/swmstub/Makefile - Firmware watchdog off at the prompt. built+tested (check-stub with a 10 s watchdog test app).
bin/swmstub/swmstub.cefi_main() - Console and line input: green on black, ASCII input, the password not echoed. built+tested (check-stub).
bin/swmstub/con.c - ESP reader through the firmware’s SimpleFileSystem, with size caps. built+tested (check-stub).
bin/swmstub/esp.cesp_read() - Unlock with tries and lockout: 3 tries, the wait doubles from 1 s, then the loader halts. built+tested (check-stub).
bin/swmstub/unlock.cunlock(),lockout() - Sealed world config as an initrd: dom0.conf, dom0.fstab, the host name and the boot partition, served over the image’s defaults. built+tested (check-hostboot, test_keys).
bin/swmstub/swmstub.cconfig_build(),lib/libkeys/keys.ckeys_config_cpio() - Install keymap as an initrd: the ESP keymap, laid over the image’s. built+tested (install proof).
bin/swmstub/swmstub.ckeymap_build() - Machine firmware as an initrd: the sealed firmware blob, served when the world config names its digest. built+tested (test_firmware, install proof).
bin/swmstub/swmstub.cfirmware_build() - Key handoff to dom0: the master, the screen-unlock hash, the disk key and the home key, served through LoadFile2 and wiped when the kernel has copied it. built+tested (check-hostboot, testmonitorkeys).
bin/swmstub/swmstub.chandoff_build(),bin/swmstub/unlock.chandoff_offer() - Screen-unlock hash: computed while the password and the master are both in memory. built+tested (testkeys, testmonitor_keys).
bin/swmstub/swmstub.cscreen_live() - Boot image check: AEAD open, Ed25519 release signature, and the header digest must equal the world config’s
bootfield. built+tested (check-stub, check-hostboot).bin/swmstub/swmstub.cefi_main(),lib/libkeys/keys.ckeys_image_accept() - Measured boot: PCR 8 capped before the prompt (TOTP’s, on every boot), then the digest of the boot image’s signed header measured into it before StartImage. Only the release is measured: worlds on one release measure the same. No TPM: the boot goes on. built+tested (check-stub with swtpm).
bin/swmstub/measure.ctpm_measure(),bin/swmstub/swmstub.cefi_main() - TOTP codes (optional, offered with the install’s questions and laid with keys.wrap, or
swmtool totp): the box’s two phone entries, every world’s alike, enrolled one at a time. The TPM seals them to the loader, PCR 8 empty; no copy on the disk. keys.wrap’s TOTP field, under a MAC from the disk key, says on and which seal: a seal taken off, or one put on, halts the boot after the password. The loader caps PCR 8, shows the loader code and asks the login code first; a seal it cannot open halts before the prompt. A new stub at update-boot turns the old codes off, then takes new ones if asked. No key goes through the TPM: a disk copy, or the ESP written with a world’s password, skips the codes (doc/design-dom0-tpm.md, “TOTP codes”). built+tested (testdom0totp, test_keys, check-stub; the codes on the screen by hand).bin/swmstub/swmstub.ccodes_take(),disk_take(),bin/swmstub/totp.c,lib/libkeys/keys.ckeys_totp_mark_check(),installer/tpm.ctpm_totp_sealed(),installer/upgrade.ccmd_totp(),installer/appliance.cappliance_totp() - Only initrd provider: the loader refuses to boot when another LoadFile2 initrd provider exists. built+tested (check-stub with a rogue provider app).
bin/swmstub/initrd.cinitrd_foreign() - Secret wipe: master, username and hash wiped on every path, and the stack wiped before LoadImage. built+tested (check-stub scans memory for the secrets).
bin/swmstub/rt.cstack_wipe() - Pinned release key, no default: the build fails without a key. A test key prints a warning at build time and on every boot. built+tested (testreleasestamp).
bin/swmstub/key.cpinned_warning() - Freestanding runtime: pool heap, mem and str functions, and a
randombytesthat halts. built.bin/swmstub/rt.c
1.3 byol loader (byolstub)
- Unlock: the same prompt, tries and lockout as the appliance, amber colors, two slots (the user and
rescue). built+tested (check-boot).bin/swmstub/byolstub.cefi_main() - Kernel list and rescue picker: up to 16 kernels, newest first. The user’s slot boots the newest.
rescuepicks from the list. built+tested (check-boot).bin/swmstub/byolstub.ckernels_parse(),pick() - Root key to dracut: the disk key is appended as a cpio file. dracut falls back to the passphrase. built+tested (check-boot).
lib/libkeys/keys.ckeys_rootkey_cpio() - TPM measured boot: measures kernel, initrd and command line into PCR 8, unseals over PCRs 4, 7 and 8, then caps PCR 8. Falls back to the password. A PCR mismatch warns of tampering. built+tested (test_tpm2 with swtpm, check-boot).
bin/swmstub/tpm.ctpm_measure(),tpm_unseal(),tpm_cap(),bin/swmstub/byolstub.ctpm_try() - TOTP codes (D, optional): two phone entries. The loader shows the loader code before the prompt, so a fake loader is seen; the login code is typed first, before the username and password, a second factor;
swmtool recovertakes none. The clock is the RTC’s and not trusted: one set ahead lets an evil maid collect loader codes, one set back replays a recorded login code; wrong codes are not counted across boots. Both secrets sealed with the KEK;swmtool totp onenrolls them by QR codes (qrencode, in byol’s base);totp offasks the login. built+tested (testkeys; testbyol_totp, the swmtool half, with the box’s TPM); the loader’s half built, not yet tested (a D boot by hand).lib/libkeys/keys_totp.ckeys_totp(),bin/swmstub/totp.ctotp_show(),bin/swmstub/unlock.cunlock(),installer/tpm.cpreboot_tpm_totp(),installer/upgrade.ccmd_totp() - Unsigned payload: kernel, initrd and command line are read from the ESP and not verified. This is by design. built.
bin/swmstub/byolstub.cmust_read()
1.4 Install media loader (swminstall)
- Signed installer kernel: verified under the pinned installer key, held to the machine’s arch and to “no handoff”, started from memory, no initrd offered and a foreign one refused. built+tested (check-stub).
bin/swmstub/swminstall.cefi_main()
1.5 Kernels
- Pinned sources: Linux 7.3 and the NVIDIA open driver, each pinned by SHA-256. built+tested (check-build).
Makefile(kernel rules),kernel/upstream,kernel/nvidia/upstream - Flavors: guest-std, netvm, backup, gfxvm, screen, host (dom0) and installer. Each is a base config plus fragments, read back after the build. built+tested (check-build, check-kernel).
kernel/*.fragment,mk/kconfig.mk - Reproducible VM kernels with a signed index: no clock, user or host in the version string. The index is signed with signify. built+tested (check-build, check-kernel).
Makefile(kernel rules),installer/kernels.c(swmtool kernel-verify) - dom0 kernel config: no modules, EFI stub, built-in initramfs, command line override, strict IOMMU, VT-d on by default, no PCIe/ACPI hotplug, no USB4, the TPM driver (CRB and TIS) with its event log, lockdown (confidentiality) forced, no SysRq, MSR device, iopl or ACPI table upgrade. built+tested (testkcfgloader, testkcfglockdown, check-hostboot, check-gpu-hold).
kernel/host.fragment,kernel/host.fragment.x86_64 - Command line: baked into the signed dom0 image. Firmware load options are ignored. On byol it is an ESP file, measured into PCR 8 when the TPM is on. built+tested (testkcfgloader).
kernel/host.fragment - Installer kernel: the dom0 config plus an installer fragment, with the live Void tree as its initramfs. built+tested (check-appliance).
kernel/installer.fragment - Kernel patches (16): i915 fixes, GPU hang names the process, virtioconsole ordering, vfio-pci through s2idle, initramfs list escaping, an Intel NUC’s EC fan and temperatures, RAPL’s graphics plane, nfnetlink’s commands from the init user namespace alone, the EFI stub’s initrd unmeasured for dom0, and others. Each patch has a check line. built+tested (testkernel_patches).
kernel/patches/ - NVIDIA open driver built in for guest-std on x86_64. built+tested (check-graft).
kernel/nvidia/patches - Guest agent helpers: command line parse, os-release read, resolver bind, module load order, boot count. built+tested (make test).
kernel/fb_cmdline.c,kernel/osrelease.c,kernel/resolv.c,kernel/modules.c,kernel/count.c - Guest initramfs for distribution kernels: the agent as
/initplus virtio and file system modules. built+tested (test_guestrd).make guestrd,mk/guestrd.mk - aarch64: base config and a host fragment exist. The VMM, gfxvm and screen flavors are x86_64 only. partial.
kernel/config.base.aarch64
1.6 dom0 init (swm-wl as PID 1)
- PID 1 bring-up: empty environment; proc, sysfs, devtmpfs,
/run,/tmp, devpts and/dev/shmmounted nosuid and noexec where they can be; all logs to the kernel log. built+tested (testdom0pid1, testdom0noexec, check-hostboot).bin/swm-wl/main.cdom0_pid1_bringup() - Host name from the sealed config. built+tested (check-hostboot).
bin/swm-wl/main.cdom0_set_hostname() - dom0.fstab: PID 1 mounts plain lines. The monitor opens crypt lines with the disk key. Only
/swmdataand/srv/<name>targets. nosuid and nodev forced. built+tested (testdom0paths).lib/libsession/dom0_fstab.cmnt_ok(),dom0_fstab_mount_plain() - Key handoff read: the monitor reads the handoff once after the fork, then zeroes and unlinks it. Keys stay on locked, no-dump, wipe-on-fork pages. built+tested (testmonitorkeys).
lib/libsession/monitor_keys.cmonitor_keys_load(),monitor_keys_ingest() - Display GPU pick: the boot display card only. Its render node is root:gpu 0660. Other GPUs stay on pci-stub for VMs. built+tested (check-gpu-hold, testdom0_globals).
bin/swm-wl/main.cdom0_display_gpu() - CPU renderer: dom0 always uses pixman. No GPU context in dom0. built+tested (testdom0globals).
bin/swm-wl/main.cdom0_renderer() - Default config path:
/etc/scrotwmos/dom0.confwhen there is no-f. built+tested (testdom0pid1).bin/swm-wl/main.cdom0_pid1_bringup() - Three programs: the dom0 package and image may hold only swm-wl, swm-vmm and vmm-gfx as executables, all static. built+tested (testdom0payload).
mk/dom0-payload.mk - Bad config powers off: PID 1 cannot run on a refused config. built+tested (testdom0pid1).
bin/swm-wl/main.cconfig_fatal() - Rescue world’s own network: the rescue world’s config gets
dom0_net = dhcp. Other worlds get the net VM. The dom0 kernel drives no NIC, so the lease finds no port today. built+tested (test_appliance).installer/appliance.cslot_conf()
1.7 A/B slots and worlds
- A/B is two credentials on one master: each A/B world has two keys.wrap slots, each with its own boot image and config. Both share one root image and one home. built+tested (testappliance, testprovision, install proof).
installer/appliance.cappliance_worlds() - World kinds:
ab,rescueanddecoy. Up to 8 worlds and 8 slots. Isolationcontainerorvm. The decoy is a VM with its home inside its image. built+tested (testanswer, testappliance).installer/answer.cv_kind(),answer_worlds() - One keys.wrap for all worlds: every slot is in one file on the ESP. built.
lib/libkeys/keys_admin.ckeys_slot_add()
1.8 Release signing and verification
swmtool release sign:[sig || header || kernel].-rrelease key,-iinstaller key. The public key must match the pinned one. The output is verified before it is written. built+tested (testreleasesign).installer/release.crelease_sign()- Release directory: loader, signed loader, signed dom0 image, keymaps, byol tree, the worlds’ package repository, VM kernel blobs with their signed index. built+tested (check-appliance).
Makefile(release) - Release keys and version: public keys only in the tree, a
not-a-releasemarker for nightly keys,release/VERSION. built+tested (testreleasestamp).release/keys/nightly/,mk/version.mk - signify verify in process (vendored OpenBSD code). built+tested (test_signify).
lib/libsignify/verify.csignify_verify() - SHA-256 library. built+tested (test_sha256).
lib/libdigest/sha256.c - TPM 2.0 command library: CreatePrimary, Load, StartAuthSession, PolicyPCR, Create, Unseal, PCRRead, Flush, policy and PCR math. Seal and unseal in a session salted to the SRK (ECDH P-256): the secret encrypted on the bus, HMACs both ways, the SRK’s name pinned. built+tested (testtpm2 with swtpm and a real TPM).
lib/libtpm/tpm2.csess_start(),lib/libtpm/VENDOR/uECC.c - VM kernel check at launch: a kernel blob is held to the signed index and its SHA-256. built+tested (check-kernel, test_session).
lib/libsession/kernel_blob.ckernel_blob_resolve()
2. Install and upgrade
2.1 swmtool commands
- survey: PCI devices by IOMMU group, devices alone in a group, virtualization, IOMMU, memory encryption, TPM and GPU support. built.
installer/swmtool.cmain() - plan: an interactive wizard that writes an answer file. It validates with the install parser and writes no password. built+tested (testplangen).
installer/plan_gen.ccmd_plan() - install: parse, resolve the disk, compute the plan, then print it (
--dry-run) or run it. built+tested (check-install, testinstallguard, test_appliance, install proof).installer/install.ccmd_install() - fill: internal. Fills a mounted image (root, home, byol, kernels and others). built+tested (check-install, testbyolconf, testworldrepo).
installer/fill.ccmd_fill() - update: update-boot, then each world’s packages. On byol, the byol path. built+tested (install proof).
installer/upgrade.ccmd_upgrade(),byol_update() - update-boot: rotate the boot images (see 2.6). built+tested (test_appliance, install proof).
installer/upgrade.cupgrade_boot() - update-root: a world’s root packages by xbps in a jail. A root left an empty file by
place worldis made anew from the release first. built+tested (install proof).installer/upgrade.cupdate_roots(),add_jail() - unlock: on the install media, map a world’s data for the commands that need it. built+tested (install proof).
installer/upgrade.cadd_unlock() - add: install packages into a world’s root in a jail. built+tested (install proof).
installer/upgrade.cadd_xbps() - open and close: mount a world’s root and home at
/mnt/USER. built+tested (install proof).installer/upgrade.cadd_open(),add_close() - points: list home points by hour.
--back nrolls back.--shareand--rootvariants. built+tested (check-months, install proof).installer/upgrade.cadd_points(),add_rollback() - place:
init,show,phrase,list,open,restore,worldfor backup places. built+tested (check-backup-vm).installer/upgrade.ccmd_place() - passwd: rewrap a world’s keys.wrap slot and its places’ keys. No data is re-encrypted. built+tested (test_appliance).
installer/upgrade.cupgrade_passwd(),passwd_places() - esp restore: the ESP made again from its twin; refused when the twin is not whole or a whole ESP is newer. built+tested (test_appliance, install proof).
installer/upgrade.ccmd_esp() - preboot make and passwd (byol): new master, a 64-byte LUKS keyslot added from a locked memfd, keys.wrap with the user and
rescueslots. A password change updates the login, LUKS and keys.wrap in a restartable order. A root whose header came back from its stripped copy (the recipe in swmtool(8)) opens by the disk key and gets the new password’s keyslot again. built+tested (check-install, check-boot, test_appliance).installer/preboot.cpreboot_make(),preboot_passwd(),disk_key() - recover (byol D): when the TPM refuses, the loader halts and never asks the phrase;
swmtool recover, from the install stick or any Linux with the disk, checks the recovery phrase against keys.wrap, opens the root by the disk key, asks the username and a new password (and whether to drop the TOTP codes), sets the login’s password (UID 1000 or more), lays the root’s kernels, initrds, command line and stub by its kernel hook, wraps D’s slots again under the new password and a new KEK, and removes the seals: the next boot asks the password once and seals again. A stopped run finishes when run again. swmtool update on a D disk seals the new kernels from the stick (preboot tpm seal --root). swmtool’s half built+tested (testbyolrecover, with the box’s TPM); the loader’s halt lines and its refusal of the phrase built, not run (test_boot);swmtool update’s seal on a D disk built, its seal step tested alone.installer/tpm.cpreboot_tpm_recover(),pend_d(),installer/upgrade.ccmd_recover(),byol_update() - preboot tpm (byol):
on,off,password,password off,seal,phrase,ready.passwordmakes the boot take the TPM and the password together, with the recovery phrase;phraseshows it again;swmtool totp onadds a phone’s TOTP code that the loader shows before the password. Seals per kernel to PCRs 4, 7 and 8 after a full event-log replay against the live PCRs. built+tested (check-boot with swtpm, test_tpm2).installer/tpm.cpreboot_tpm(),tpm_seal(),pcr4(),pcr8() - firmware scan and refresh: picks the machine’s firmware files from PCI modaliases and the CPU family, and seals them into the firmware blob. built+tested (test_firmware).
installer/firmware.cfirmware_collect(),installer/upgrade.cfirmware_refresh() - session: add, change or remove a world’s sessions in both slots’ configs. byol sessions too. built+tested (test_appliance).
installer/upgrade.ccmd_session(),byol_session() - world: add or remove a world. Removal deletes its blobs, points, time-travel directories and GPU records. built+tested (test_appliance).
installer/upgrade.cworld_add(),world_del() - share join and part: a session into or out of its world’s share image. built+tested (test_appliance).
installer/upgrade.cshare_on() - vm (byol): its own VMs on Void’s qemu, each a runit service
/etc/sv/vm-<name>that runs qemu as the VM’s own uid (a-vm-<name>line of/etc/subuid, made by create and clone, spent by rm; a VM from before takes one at its next start), under qemu’s-sandbox. The VM is qemu’s command line as YAML, read by libyaml events with no typing; the tool adds the name, a QMP socket and an hvc0 console socket, and refuses a YAML that sets them.start [--temp](qemu’s-snapshot),stop(QMPsystem_powerdown, a kill after 60 s),restart,enable,disable,list(with a boot column:on,off,-),console(a raw relay, Ctrl-] leaves),top(a row per VM with its disk and net rates, its reads never block the screen).list’s ip comes from the VM’s MAC inlan0’s neighbor table; nothing is sent.image build,create,clone, andstartcheck root, then each program and file that they run, and name the missing Void packages; swmtool installs none. built+tested (testvmconf, testvmtop, testvmautostart, testvmaddr, testvmdeps, fuzzvmconf and fuzzvmqmp in check-fuzz, testvmboot and testvmaddr_ns in check-root).installer/vm.ccmd_vm(),vm_run(),vm_list(),installer/vm_conf.cvm_conf_parse(),vm_argv_make(),installer/vm_qmp.c,installer/vm_top.cvm_top(),installer/vm_net.c,installer/vm_deps.cvm_need() - vm create, clone, rm, pass, image list and rm (byol):
createmakes a VM over a base image: a sparse qcow2 over it, its own uid’s; its YAML from the base options, the image’s fragment and a size (small,medium,large, or one in/etc/scrotwmos/vm/recipes/sizes),-sanother disk size; a MAC from the name’s sha256; a seed (vfatSWMSEEDby qemu-img’s vvfat, no mount) with hostname, user, authorizedkeys (the user’s~/.ssh/id_ed25519.pubalone; none: refused), update, id, and the password’s bcrypt hash; the password random or asked (-p), root’s alone.-n lan0,vmnat0orbothpicks the NICs (none:lan0when the box has it, else user net); a NIC onvmnat0gets a fixed address,10.83.87.2to.191, past the highest any VM’s YAML has, written in its YAML and seed (nat_mac,nat_addr,nat_gw,nat_dns, the gateway, vmnat sending its 53 on to the host’s resolver; a VM made before keeps the host’s resolver at its create), and each image’s first boot sets that NIC static by its MAC; an image from beforevmnat0(noseed: 2in its fragment) is refused; create, clone and rm holdVM_DIR/.lockup to the YAML, and the build holds<name>.build: rm, start and another create of the name refuse while it runs.clonecopies a stopped VM, not one being built, whole with a new MAC, seed, password, and address onvmnat0;rmremoves a stopped VM, its password overwritten first,-kkeeps the disk;passshows the password;image rmrefuses an image a VM’s disk is over. built+tested (testvmnic, testvmseedfedora, testvmseedopenbsd, testvmimagevoid, testvmimage in check-root).installer/vm_image.cvm_create(),vm_clone(),vm_rm(),vm_pass(),vm_image_list(),vm_image_rm(),installer/vm_nic.cvm_nat_pick(),vm_nat_seed() - vm image build (byol): base images of three OSes, each sealed 0444 with its sha256, log, and qemu fragment.
void: xbps-install from the box’s mirror (or--repo) with the box’s keys, ext4 made from a directory, GRUB for BIOS, no mount and no loop device.fedora-45: the release’s CHECKSUM checked by gpgv against the key baked in, the pxeboot kernel, initrd, and stage2 checked against pinned sha256s, then a kickstart install in a temporary qemu, user net alone.openbsd-8.0: SHA256.sig checked against the signify key baked in, each file against it, an ISO by mkisofs, autoinstall under OVMF, one prep boot over ssh. Each build’s work runs as root of namespaces of its own over the build range, never as the box’s root nor a VM’s uid; fedora’s and openbsd’s with kvm as their one group.image serveis guestfwd’s command: one HTTP GET of a listed file. Each image’s first boot reads the seed. built+tested (testvmimagevoid, testvmimagefedora, testvmseedfedora, testvmimageopenbsd, testvmseed_openbsd; for real, opt-in:make -C regress vm-image-void-live,check-vm-image-fedora-live,check-vm-image-openbsd-live).installer/vm_image.cvm_image_build(),vm_image_seal(),installer/vm_image_void.cvm_image_build_void(),installer/vm_image_fedora.cvm_image_build_fedora(),vm_image_serve(),installer/vm_recipe.cvmi_serve(),vmi_signed_sum(),installer/vm_image_openbsd.cvm_image_build_openbsd(),installer/vm_recipe_openbsd.cvmo_sums() - lan0-link (byol): the service
/etc/sv/lan0-link, not a command to type. It takeslan0down when its NIC loses carrier and up when the carrier is back, so a VM’s tap does not keeplan0’s lease. built+tested (testbyollan0 in check-root).installer/lan0_link.ccmd_lan0_link() - vmnat (byol): the service
/etc/sv/vmnat, not a command to type. It makes the NAT bridgevmnat0when missing (MAC02:00:0a:53:57:01), sets10.83.87.1/24on it, turns IPv6 off on it and IPv4 forwarding on, then lays the rules again over netlink (no nft): the subnet masqueraded out any other device, no flow opened intovmnat0from outside, no spoofed source out, no IPv6 through it, UDP and TCP 53 from the subnet to the gateway sent on to the host’s resolver (the first IPv4 server of/etc/resolv.confa guest can reach, not on the subnet; none: 53 to the gateway’s address dropped, said once with why, while a host DNS server still answers a guest on the host’s other addresses). Then it watches nftables’ change events, no timer: a flushed ruleset (nft, a stop or restart of Void’s nftables service), or any chain of its short a rule, has its rules laid again and the flows opened into the subnet meanwhile flushed (conntrack), said in its svlogd log,/var/log/vmnat, the first time and then at each power of two; a failure ends the run a minute on, and runit runs it again. With no/etc/nftables.confVoid’s nftables service flushes each second, said. It watches/etc/resolv.conftoo (inotify on/etcand on the directory a link names, or its nearest ancestor while not made): a change read a quarter second on, the DNS rule alone laid again for the new resolver, the DNS flows to the gateway flushed from conntrack, said. IPv4 forwarding is the box’s. The session NAT drops a flow into a client from any non-port link, so a guest opens none. No DHCP. built+tested (testbyolvmnat in check-root, testnetnat, testnetdns).installer/vmnat.ccmd_vmnat(),lib/libsession/net_nat.cnet_nat_bridge(),net_nat_bridge_dns(),net_nat_bridge_laid(),net_nat_ct_flush_in(),net_nat_ct_flush_dns(),lib/libsession/net_dns.cnet_dns_hostw_event(),net_dns_host_pick(),lib/libsession/net_nl.cnl_link_bridge(),nl_addr_set() - help: one line per command.
place show,place restoreand some others are only in swmtool(8). built.installer/swmtool.chelp()
2.2 Answer file
- Parser: the libswm config grammar. Known keys only, each once. Required keys checked. Cleartext passwords refused. Every value goes through an allowlist validator. built+tested (test_answer).
installer/answer.canswer_parse(),answer_valid() - Global keys: base, keyboard, disk, erase, unattended, hostname, user, passwordhash, timezone, repo, serialconsole, network, allowhotplug, points, backupdisk, swap, dark, tpm, packages, nicallow, romapprove. built+tested (test_answer).
installer/answer.canswer_apply() - World keys: kind, users, isolation, packages, apps, network reach, language, pid limit, share, GPU. built+tested (test_answer).
installer/answer.canswer_worlds() - Session keys for dom0 worlds and for byol. built+tested (test_answer).
installer/answer.canswer_sessions(),answer_byol_sessions() - Package sets: firefox, chromium, office, rescue, shell, nvidia and others. built+tested (test_answer).
installer/answer.canswer_pkgset_packages() - dom0 and byol rules: dom0 refuses user, passwordhash, packages, dark and tpm. byol refuses nicallow, romapprove, allowhotplug and backupdisk. built+tested (testanswer).
installer/answer.canswer_parse() - dom0 time zone is UTC: any other zone is refused. partial (no zone support in dom0).
installer/appliance.cappliance_compute() - Static address: parsed and validated, then refused by install. The wizard does not ask for it. partial.
installer/answer.canswer_network(),installer/install.ccmd_install() - TPM on a box with no TPM 2.0 is refused. built.
installer/install.ccmd_install()
2.3 Disk selection and execution
- Disk resolve: by rule or path. Never a removable disk. A disk in use is refused. A disk with partitions needs
eraseor--force. By-id names. Kernel claim with retries. built+tested (testdisk, testinstall_guard).installer/disk.cdisk_resolve(),disk_claim() - Executor: fork and exec of an argv only, fixed PATH, empty environment, the first failure stops the plan. built+tested (test_execute).
installer/execute.crun_cmd(),plan_execute() - Pure plan: the plan is computed without touching a disk. built+tested (test_plan).
installer/plan.cplan_compute()
2.4 Appliance install
- Layout: GPT with the ESP, optional swap, and swmdata. The old ESP is zeroed. built+tested (testappliance, testswap_part).
installer/appliance.cappliance_layout(),appliance_shred() - ESP contents: the loader, keys.wrap, and per slot a sealed boot image and a sealed config. Per world a sealed disk key and home key. One firmware blob and the keymap. All names are hashes. One time stamp on every file. built+tested (test_provision).
installer/provision.cprovision_seal(),provision_stamp_tree() - swmdata: LUKS2 aes-xts-plain64, 64-byte key, data at 16 MiB, 4096-byte sectors, XFS. Holds
images/(withimages/tt),gpu/andlog/. built+tested (testprovision, testdmcrypt).installer/provision.cswmdata_make(),luks_make() - Store blobs: each world’s share key and backup record, sealed in the store on swmdata. built+tested (test_provision).
installer/provision.csblob_put(),share_blobs(),place_blobs() - Images per world: one root, one home (container worlds), one home per container session, a share image when asked, and a kernel store image. built+tested (test_appliance).
installer/appliance.cappliance_worlds(),installer/provision.cmake_image() - Thin images: each image is sparse and as large as swmdata. built+tested (test_provision).
installer/provision.calloc_image() - Kernel store: VM kernel blobs unpacked under the signed index. Nothing is written before the signature checks. built+tested (test_appliance).
installer/kernels.ckernels_lay(),index_read() - One key holder: all keys in locked memory in one process. Volume keys go to cryptsetup through a locked memfd. keys.wrap is written last. On failure every blob is removed. built+tested (test_provision).
installer/provision.cprovision() - Passwords: from a file or the terminal (twice), printable ASCII only, weak ones flagged. built+tested (test_appliance).
installer/appliance.cappliance_passwords(),installer/provision.cprovision_pass_weak() - Device approvals at install:
nic_allowandrom_approve, with the option ROM read through sysfs. built+tested (test_appliance).installer/appliance.cappliance_approvals(),appliance_rom_read() - Backup disk at install: a USB disk erased to one XFS, the A/B worlds’ backup place. built+tested (test_appliance).
installer/appliance.cbackup_mount() - Per-world NIC records sealed in
gpu/. built+tested (test_appliance).installer/provision.cnic_records() - Session colors per slot and session. built.
installer/appliance.cappliance_color()
2.5 byol install
- Layout: ESP, optional swap with a new key each boot, LUKS2 root with XFS.
/bootis inside the root. fstab and the command line name the root and the ESP by UUIDs pinned at install, not by labels. built+tested (test_plan, check-install, check-boot).installer/plan.cplan_compute() - Fill: Void base and kernel, session essentials, rescue set, package sets, locales, fonts, the scrotwmos tree, the compositor config, runit services, sudoers, optional serial getty. built+tested (check-install).
installer/fill.cfill_byol(),fill_root() - Kernel hook: on kernel install or removal, copy kernel, initrd and command line to the ESP, refresh the loader, keep 3 kernels, reseal the TPM. The ESP is made from the root each run, and the seal refuses what the root did not make (design-byol-tpm.md, “What the seal trusts”). built+tested (testbyolhook in check-root, check-boot).
installer/plan.cplan_byol_paths(),plan_preboot_hook;installer/tpm.cseal_kernels() - byol sessions: container and VM sessions on byol with their roots and homes. built+tested (check-install).
installer/plan.cplan_byol_sessions() - VM packages: byol’s base adds qemu-system-amd64, qemu-img, qemu-firmware, cdrtools, curl, and gnupg for
swmtool vm, the programsvm_deps.cchecks for; an update installs none of them. built.installer/fill.cbyol_base - lan0: when the install went out on a wired uplink, the bridge
lan0with that NIC in it; a VM’s tap there is the run step’s (swmq*), no qemu-bridge-helper. dhcpcd runs onlan0and the real NICs, not on the NIC inlan0or the VMs’ taps;lan0follows its NIC’s carrier (lan0-link). A NIC of that MAC missing, or a bridge that cannot be made: dhcpcd on every link, no lan0. An update lays it on a box from beforeswmtool vmwhen the root has no/etc/sv/dhcpcd/lan0of ours. Novmuser is made: each VM’s qemu runs as its own ids, kvm its one other group; a box from before them keeps itsvmuser. built+tested (testbyollan0 in check-root, testappliance, testplan).installer/plan.cplan_byol_vm(),installer/fill.cfill_byol_lan0(),byol_dhcpcd_conf,byol_lan0_link() - vmnat0: every install and update, any uplink, lays the NAT bridge’s service (
vmnat, on) and takesallow lan0andallow vmnat0out of/etc/qemu/bridge.conf(the file’s other lines kept);lan0and the VMs are left. A second run changes nothing. Podman’s containers on it, as root, take.192to.254(doc/design-byol-vms.md). built+tested (testbyolvmnatfill, testplan).installer/plan.cplan_byol_vm(),installer/fill.cfill_byol_vmnat(),bridge_unallow() - Config record: a SHA-256 of each user-editable file, so an update rewrites untouched files and keeps edited ones. built+tested (testbyolconf).
installer/fill.cbyol_record_write(),byol_conf_update()
2.6 Upgrade (update-boot)
- Release check first: the new dom0 image is checked as the loader checks it. The new loader must be release-signed, have no handoff, and pin the same release key. built+tested (test_appliance).
installer/upgrade.cupgrade_boot(),upgrade_stub_bad() - A/B rotation: B gets A’s old image, A gets the new one. Each slot keeps its config and only its
bootdigest changes. Write order: B image, B config, A image, A config. A crash leaves a bootable slot. built+tested (test_appliance, install proof).installer/upgrade.cupgrade_boot() - Downgrade refused: an older version or date is refused unless
--force. built+tested (test_appliance).installer/upgrade.colder() - Loader first:
BOOTX64.EFIis replaced before the slots when it is not the release’s. built+tested (test_appliance).installer/upgrade.cstub_write() - ESP restamp: every file is rewritten with one time, the decoy’s too. built+tested (test_appliance).
installer/upgrade.cupgrade_boot() - One update at a time: a lock on the ESP directory. The ESP is mounted in a private namespace, nosuid, nodev, noexec. built.
installer/upgrade.cupdate_lock() - byol update: refuses an older tree without force, lays the new tree, updates config by the record, updates session packages. built+tested (testbyolconf).
installer/upgrade.cbyol_update(),installer/fill.cfill_byol_update()
2.7 Install media
- media-init (PID 1, sh): banner, wired or Wi-Fi network, mirror check. A plan on the stick with
unattended=yesinstalls and powers off. Otherwise a task menu, the wizard, and the disk confirmed by typing its name. A failure after writing leaves a shell, never a reboot. built+tested (testmediadone, testmediadhcp, testmediawifi, install proof, negative install proof).scripts/appliance/media-init - media-power: power off, halt or reboot after sync. built.
scripts/appliance/media-power - Stick firmware: only the NIC and radio firmware the network drivers ask for. built+tested (testlivefirmware).
mk/live-firmware.mk
2.8 Root file system and volume tools
- make rootfs: a session root file system per distribution into
/srv/<label>, each step a target that a rerun continues from; the session daemon in it when asked (ROOTFS_AGENT). built+tested (test_rootfs).mk/rootfs.mk - make volume: a VM disk or a container root: file, XFS, root file system copy, a label when asked (
VOLUME_LABEL). A volume that exists is left alone; remove it to make it again. built+tested (test_volume).mk/volume.mk - World repo: the worlds’ package repository (scrotwmd, swmtool). built+tested (testworldrepo).
mk/world-repo.mk - byol tree: the byol tree. built+tested (check-install).
mk/byol-tree.mk - Proof scripts: the USB proof runs in the install proof. The others (world, web, Wi-Fi, boot log, screenshots) are run by hand. built.
scripts/appliance/
3. Segregation
3.1 Privilege separation (dom0)
- One binary, one fork: swm-wl as root forks early. The parent stays root as the monitor. The child drops to
_swmand runs the compositor. Root with no target uid is refused. built+tested (test_driver, check-root).lib/libsession/privsep.cprivsep_init() - Monitor request wire: a request/reply socket with magic, version and a string table. 22 operations, each with its own handler and checks. built+tested (testhelperwire, test_driver).
lib/libsession/privsep.cmonitor_ops[],helper_validate(),lib/libsession/helper_wire.c - Sync channel: fixed records that are never lost (boot dead end, port plan, net time, uplink, world mark). No descriptor can enter the monitor. built+tested (testmonsync).
lib/libsession/mon_sync.c - Async channel: alerts that may be dropped. A drop is counted and reported once. built+tested (testmonasync, testasyncalerts).
lib/libsession/mon_async.cmon_async_raise() - Alert codes: one table gives each code its meaning and its remedy. built+tested (testalert, testguruset, testguru_band).
lib/libsession/alert.calert_table - Monitor loop: polls the control, seat, channel, uevent, DHCP, trunk, gfx, scrub, hang, place and log descriptors. built+tested (check-root, testmonflood).
lib/libsession/privsep.cmonitor_loop() - Session output through the monitor: each session’s stderr is cut into lines, rate limited per session, and written to the kernel log. built+tested (testmonlog, testloglines).
lib/libsession/mon_log.cmon_log_feed() - Boot log, crash mark, log tail. built+tested (testmonlog, testwllog).
lib/libsession/privsep.cmonitor_boot_log_open(),monitor_crash_mark(),handle_log_tail() - Reap and ordered shutdown, then power off. built+tested (teststoporder, testpoweroff).
lib/libsession/privsep.cmonitor_sigchld() - Session stop order: ask each window to close, wait, SIGHUP, SIGTERM, SIGKILL, reap. Only then is the display, VM or namespace removed. built+tested (teststoporder, testwinfree).
lib/libsession/stop_order.cstop_order() - Restart backoff for sessions, the net VM, the gfx VM and the screen VM. built+tested (testsession, testnettrunk, testmongfxvm, testmon_screen).
lib/libsession/session.csession_backoff() - Blob warm-up: a child reads the signed VM blobs into the page cache. built+tested (testmonwarm).
lib/libsession/mon_warm.cmon_warm_plan()
3.2 Sessions and worlds
- Session drivers: none (no isolation), container (namespaces, needs CAPSYSADMIN), privsep (asks the root monitor). A VM is a monitor launch of swm-vmm. built+tested (test_driver).
lib/libsession/driver_none.cnone_create(),lib/libsession/driver_privsep.cprivsep_create() - Session kinds: daemon, VM, container, gfx. GPU modes: none, graphics, compute. built.
lib/libsession/session.h - Workspace to session map: a workspace names a session. Several workspaces may name one session. Unnamed workspaces go to
session_default, which is required. built+tested (testlibswm, testconf_man).lib/libswm/session_cfg.csetconfwssession(),setconfsessiondefault(),ws_spawn_session() - Session config keys: isolation, net, class, gpu, rootfs, image, home, daemon, kernel, initrd, disk, ram, vcpus, memory, swap, pid and CPU limits, mounts, environment, share, uid, color, resume. built+tested (testlibswm, testconflex).
bin/swm-wl/stubs.csetconfsession() - Session uid: set in the config, at least 500000, unique, not in passwd. Containers and a VM’s host-side VMM run as it. built+tested (testsession, testdriver).
lib/libsession/session.csession_uid_ok(),session_runs_as_own_uid() - Session pins: PID 1 reads each session’s image, home, uid and share from the sealed config. A launch that differs is refused. built+tested (test_session).
lib/libsession/session.csession_pin_line(),session_pin_ok() - Template sessions: an image under a lock with a dirty mark. A start after a crash needs
session_resume. built+tested (testtemplateend).lib/libsession/session.csession_template_lock() - Rescue session: root, all capabilities, no seccomp, host network, real
/devand/swmdata. Only from the sealed config, and alone. built+tested (testsession, testappliance).lib/libsession/session.csetup_rescue(),session_rescue_ok() - World mark: two words and a color, derived from the world key in the monitor. Only dom0 draws it, on the lock and on secret prompts. built+tested (testmonitorkeys, testdom0lock).
lib/libsession/world_mark.cworld_mark_from(),lib/libsession/monitor_keys.cmonitor_keys_mark() - World master in the monitor: per-session image keys are derived there, and screen-unlock checks are answered there. built+tested (testmonitorkeys, testhomekeys).
lib/libsession/monitor_keys.cmonitor_keys_session_key(),monitor_keys_screen_verify()
3.3 Container tier
- Namespaces: mount, PID, UTS, IPC, cgroup, and network unless the host network. No user namespace. built+tested (testsessionns, testnssecurity, check-ns).
lib/libsession/session.cchild_setup() - Root file system: pivotroot, then a recursive read-only remount, nosuid, nodev. The old root is detached. built+tested (testsessionns, testcontainer_e2e).
lib/libsession/session.csetup_rootfs(),setup_rootfs_inner(),remount_recursive_ro() - Root store check: a store root is walked and checked, and pinned by inode. built+tested (test_session).
lib/libsession/session.csession_rootfs_pin(),session_rootfs_ok() - Image root: an encrypted image mounted read-only, nosuid, nodev. built+tested (test_session).
lib/libsession/session.csetup_rootfs() - Minimal /dev: null, zero, full, random, urandom, tty, ptmx, devpts, shm. built+tested (testnssecurity).
lib/libsession/session.csetup_dev() - GPU render nodes: render nodes only, never card nodes. built+tested (testsessionns, testdom0dmabuf).
lib/libsession/session.csetup_gpu() - Mounts: up to 32, opened as the session uid, cloned and placed. Reserved targets refused. built+tested (test_session).
lib/libsession/session.cvalidate_mounts(),mounts_place() - Home image: the session’s home is its own image at
/home/<name>. built+tested (testsession, testhome_keys).lib/libsession/session.cmount_home() - Capability drop in two phases: no-new-privs, ambient and bounding sets cleared, then setgroups, setgid, setuid, then the rest cleared. built+tested (testsession, testns_security).
lib/libsession/session_caps.csession_caps_drop_phase1(),session_caps_become() - Descriptor and environment hygiene: close all but kept descriptors, explicit environment, parent-death signal, no core dumps. built+tested (testnssecurity, testforksites).
lib/libsession/session.cchild_exec() - Relay and reaper: each under its own seccomp filter that kills on a call off its list. built+tested (teststoporder, test_seccomp).
lib/libsession/seccomp_relay.cseccomp_relay_install(),seccomp_reaper_install() - Application seccomp allowlist: one list for a graphical userland and browsers. Also used by the guest compositor. built+tested (testseccomp, testchromiumflags, testvmbrowsertabs).
lib/libsession/seccomp_app.cseccomp_app_install() - Seccomp builder: rules on no argument, one argument or two, ioctl allowlists, masked denylists. built+tested (test_seccomp).
lib/libsession/seccomp.cseccomp_install() - cgroup v2 limits: memory, swap, pids and CPU from the config; group OOM kill; peak values read at removal. A dom0 memory floor. built+tested (testsession, testvm_limits).
lib/libsession/session.ccgroup_setup(),cgroup_remove() - Open file limit: 4096 in a container. built.
lib/libsession/session.h - Container resolver: the gateway on a routed network. Mounts over
/etc,/etc/resolv.confor/runrefused. built+tested (testnetdns, testcontainere2e).lib/libsession/session.ccontainer_resolver() - Per-session D-Bus system bus. built+tested (testsession, testvmbrowsertabs).
lib/libsession/dbus.csession_dbus_system_start() - Shared directory: a root-owned setgid directory for sessions of one share group. built+tested (testvmshare, test_session).
lib/libsession/session.csession_share_open() - No network for a uid 0 container. built+tested (testnettrunk).
lib/libsession/net_trunk.cnet_trunk_nat_path() - Host root file system containers: developer builds only. The dom0 build leaves them out. built.
lib/libsession/session.csession_host_rootfs_ok()
3.4 VM tier
- VMM sandbox: swm-vmm runs in its own mount, IPC, UTS, cgroup and network namespaces with an empty read-only root, as the session uid, not dumpable. Every resource arrives as an open descriptor. built+tested (testvmsandbox, testvmsession, testvmmargs).
lib/libsession/session.cchild_setup(),setup_vmm_root() - Signed guest kernel: the index is verified with the kernel key, then the blob’s SHA-256. built+tested (testsession, testvmm_load, check-kernel).
lib/libsession/kernel_blob.ckernel_blob_resolve() - KVM core: memfd RAM, vCPU threads (1 to 64), halt polling off. built+tested (testvmmhalt, testvmmload).
vmm/kvm.cvm_create() - x86_64 boot: bzImage loader, initrd, e820, CPUID filter, MTRR, serial console for unsigned kernels. built+tested (testvmmload, testvmmserial).
vmm/arch_x86_64.carch_load_kernel() - ACPI tables: DSDT with COM1, S5, PCI0. built+tested (test_acpi).
vmm/acpi.cacpi_build() - virtio-blk, with a read-only second disk for ttvm. built+tested (test_vblk).
vmm/virtio_blk.cvblk_start() - virtio-net on a tap or switch port. built+tested (test_vnet).
vmm/virtio_net.cvnet_start() - virtio-console: port 1 the bus, port 2 quiesce, trunk ports for the net VM and gfx VM. built+tested (test_vcon).
vmm/virtio_console.cvcon_start() - virtio-balloon with free page reporting. Off with VFIO. built+tested (testvballoon, testvm_balloon).
vmm/virtio_balloon.c - virtio-fs share: the FUSE server runs inside the VMM, beneath a pinned directory. built+tested (testvirtiofs, testvfsfuse, testvmshare).
vmm/fuse_srv.cvfs_server_new(),vmm/virtio_fs.cviofs_start() - virtio-gpu: 2D scanout, and 3D through vmm-gfx (Venus or native context). built+tested (testvgpu, testvdrm, fuzz_vgpu).
vmm/virtio_gpu.c - Pixel window and frames: a shared framebuffer, and frame copy-out from a VFIO GPU. built+tested (testvmmfb, testframecopy, testframegive).
vmm/kvm.cvm_fb(),bin/scrotwmd/frame_copy.c - PCI bus with MSI and MSI-X: holds only VFIO devices in a release build. built+tested (testpci, fuzzpci, testvmpci).
vmm/pci.cpci_add() - VFIO whole-device passthrough: up to 4 groups and 8 functions. DMA map, resets, ATS off, BAR map, interrupt routing. built+tested (test_vfio, check-vfio).
vmm/vfio.cvfio_start() - VMM seccomp: kill on any call off its list. The list grows only for trunk, gfx and VFIO roles. built+tested (testseccomp, testvm_sandbox).
vmm/seccomp_vmm.cvmm_seccomp_install() - brk-only heap: lets the VMM run under a filter that refuses mmap, on glibc and musl. built+tested (testvmmbrk, check-musl-vmm).
vmm/brk_malloc.c - VM roles: client VM, net VM, gfx VM (up to 4 client slots), ttvm, screen VM. built+tested.
vmm/main.cmain() - Guest PID 1: loads modules, switches root, mounts, places the resolver, drops to the user, starts the guest compositor. built+tested (testvmsession, testvmd0).
bin/scrotwmd/guest.cguest_init() - Guest compositor seccomp: the application filter before the first client. built+tested (testvmbrowser_tabs).
bin/scrotwmd/main.cmain() - Disk quiesce for points: freeze and thaw over console port 2. The guest thaws itself after a hold time. built+tested (testqz, testlibtt_root).
lib/libsession/qz.c,bin/scrotwmd/guest_qz.cqz_freeze() - No USB device model: a VM gets no USB device. By design.
vmm/
3.5 Disk encryption in dom0
- Per-image dm-crypt: aes-xts-plain64 over a loop device, set up by loop and device-mapper ioctls. No cryptsetup in dom0. Mapped by descriptor. One mapping per image. built+tested (testdmcrypt, testluks_interop).
lib/libsession/dmcrypt.cdmcrypt_open(),lib/libsession/privsep.cmonitor_image_setup() - swmdata open: the monitor opens the crypt lines of dom0.fstab with the disk key. nosuid, nodev and noexec forced. built+tested (testdom0paths, test_appliance).
lib/libsession/privsep.cmonitor_disks_open() - Encrypted swap: the GPT partition named
swap, mapped under a random key the monitor makes each boot and never stores, in every world. built+tested (testswappart).lib/libsession/swap_part.cswap_part_find(),lib/libsession/privsep.cmonitor_swap_map() - Opens beneath: every untrusted name is opened with no symlink and no climb. built.
lib/libsession/beneath.copenat_beneath()
3.6 GPU
- dom0 draws with the CPU: the compositor’s DRM ioctl allowlist keeps KMS, dumb buffers, PRIME, syncobj, leases and two i915 calls. Any other DRM ioctl kills it. built+tested (testseccomp, testdom0_dmabuf).
lib/libsession/seccomp_dom0.cseccomp_dom0_compositor() - vmm-gfx: one host-side 3D server per VM, in its own jail, with its own seccomp filter. built+tested (testvgfx, fuzzvgfx, check-gfx).
bin/vmm-gfx/gfx.c,bin/vmm-gfx/seccomp_gfx.cgfx_seccomp_install() - gfx VM: one VM holds up to 4 slots’ vmm-gfx in per-slot jails. dom0 relays each client’s add and remove. built+tested (testmongfxvm, testgfxvmjail, testvmgfxvm).
lib/libsession/mon_gfxvm.cmon_gfxvm_config(),lib/libsession/gfxvm_jail.cgfxvm_jail_start() - Screen VM: draws the sessions’ sources for dom0. Restarts with backoff. built+tested (testmonscreen, test_screen).
lib/libsession/mon_screen.cmon_screen_init(),lib/libsession/privsep.cmonitor_screen_start() - Whole GPU to a VM: second GPUs are held on pci-stub at boot, given to one VM, then reset and held again. built+tested (testgpucfg, testvmgpu, check-gpu-hold).
lib/libsession/privsep.cmonitor_vm_gpu() - GPU hand-off cycle: take, probe (group, attach, reset, ROM), hold. Each sysfs write is in a child. built+tested (testmonscrub, check-handoff).
lib/libsession/mon_scrub.ctake_child(),probe_child(),hold_child() - GPU ROM records and approval: a held GPU’s ROM digest is sealed per world and approved in F9. Approvals can be revoked. built+tested (testgpurom, testf9table).
lib/libsession/gpu_rom.c,lib/libsession/privsep.chandle_gpu_approve() - GPU gate: per-release device rows, an IOMMU group gate, and DMAR flags. built+tested (testgpucfg).
lib/libsession/gpu.cgpu_gate(),gpu_row_match() - Compute sessions: CUDA on a whole NVIDIA GPU, with the GSP firmware and libraries mounted in the guest. built+tested (testguestnvver, testguestgpu).
bin/scrotwmd/guest_nv.c,bin/gpu-probe/gpu-probe.c - Guest GPU paths: KMS on a whole GPU, Mesa overlay, nouveau fallback. built+tested (testgkms, testguest_mesa).
bin/scrotwmd/guest_kms.cgkms_probe(),bin/scrotwmd/guest_mesa.cgmesa_bind() - GPU hang blame: kernel hang records mapped to the owning session by cgroup. built+tested (testmonhang, fuzzmonhang).
lib/libsession/mon_hang.cmon_hang_parse() - Screen VM’s GPU priority: its vmm-gfx keeps
CAP_SYS_NICEalone, the kernel’s own test for a raise. Its seccomp list refuses every other call that tests it. built+tested (test_vgfx).lib/libsession/session_caps.h,bin/vmm-gfx/seccomp_gfx.c - GPU top (F2): per-engine busy and per-client use, rolled up by session. built+tested (testgputop, testf2engine).
lib/libsession/gpu_top.c,lib/libsession/privsep.chandle_gpu_top() - dom0 buffers to sessions: dom0-allocated buffers given to sessions, and dma-buf import. built+tested (testvmdmabuf, testdom0dmabuf).
bin/swm-wl/wl_dmabuf.c,bin/swm-wl/wl_import.c
3.7 Seat, input and USB
- Monitor as seat server: a libseat-compatible socket. Only the compositor’s pid is served. Only DRM and input devices, judged by the opened descriptor. built+tested (testseat, testseat_monitor, check-seat).
lib/libsession/seat.cseat_handle_open_device(),seat_open_device() - Input routing: every key binding runs in dom0. Other keys and pointer events go to the focused window’s session only. built+tested (testcompositore2e, test_e2e).
bin/swm-wl/main.ckeyboard_handle_key(),bin/swm-wl/wl_session.cbus_session_send_key() - Keys that always reach dom0: power and VT switch, before the lock and before shortcut inhibitors. built+tested (testpoweroff).
bin/swm-wl/main.ckeyboard_handle_key() - Keyboard trust: each keyboard is a program, a device, or a kept device. Destructive panel actions need a real keyboard on a panel a real keyboard opened. built+tested (testpanelgate).
bin/swm-wl/wl_gate.h - USB and input hotplug policy: devices present at boot are stamped. Then USB authorization is off. A later device is let in only if its stamp is kept, or after an F7 accept.
allow_hotplug=1turns this off. built+tested (testdom0autorun, testf7detail, USB proof).lib/libsession/privsep.chandle_device(),device_shut(),uevent_wake_pass() - Lid and sleep: lid close locks, then sleeps. Held devices are cut before sleep. built+tested (check-sleep-resume).
lib/libsession/privsep.chandle_sleep(),lib/libsession/mon_scrub.cmon_scrub_sleep_cuts()
3.8 Clipboard
- Clipboard per session: each compositor has its own clipboard. Nothing crosses between sessions. The bus carries only a sync flag. built+tested (test_clipboard).
bin/swm-wl/wl_clip.cclip_serve() - No data-control in dom0: created only in non-dom0 builds. built.
bin/swm-wl/main.cmain()
3.9 What dom0 refuses
- Compositor seccomp: exec, ptrace, processvm, bpf, userfaultfd, perf, keyrings, kexec, mounts, chroot, namespaces, clone3 and iouring refused. Installed on PID 1. built+tested (testseccomp, testdom0_noexec).
lib/libsession/seccomp_dom0.cseccomp_dom0_compositor() - dom0 runs no program: baraction, autorun, search menus, daemons and host spawns are refused. built+tested (testdom0noexec, testdom0_autorun).
bin/swm-wl/stubs.c,bin/swm-wl/wl_session.csession_bus_launch() - No NIC driver in dom0: the net VM drives the NICs. dom0 passes it the firmware files. built+tested (testmonnetfw).
lib/libsession/mon_netfw.cmon_netfw_open() - Bad DNS or NTP setting: the net VM stays off for the boot. built+tested (testnetdns).
lib/libsession/privsep.cmonitor_loop()
4. Storage, backup and recovery
4.1 Disk layout
- ESP plus swmdata on one disk: the ESP holds the loader, keys.wrap and sealed blobs with hashed names. swmdata is LUKS2 with XFS. built+tested (test_provision, check-appliance).
installer/provision.cswmdata_make() - ESP twin: a last vfat partition. Every change to the ESP stamps it and copies it there;
swmtool esp restoremakes a dead ESP again from it. built+tested (testprovision, testappliance, install proof).installer/appliance.cappliance_esp_close(),installer/provision.cprovision_tree_copy() - Image store
/swmdata/images: root only. Every open is beneath it. built+tested (testsession, testdom0_paths).lib/libsession/privsep.cmonitor_open_image_fd() - Time travel directories
images/tt/<hash>/: the name is derived from the master and the session, so it names no session. built+tested (testkeys, testlibtt).lib/libkeys/keys.ckeys_tt_dir() - Device records in
gpu/, sealed under the master. built.lib/libsession/monitor_keys.cmonitor_keys_gpu(),monitor_keys_nic() - Container roots
/srv/<label>: read-only volumes mounted by label. built+tested (testdom0paths).lib/libsession/dom0_fstab.cmnt_ok() - World share
/share: an image under a random key, mounted by the monitor at boot. built+tested (test_appliance).lib/libsession/privsep.cmonitor_share_blob() - One store time: the access and modify times of every image and point are set to one stamp. built+tested (testdom0paths, test_months).
lib/libsession/dom0_fstab.csession_store_stamp(),lib/libsession/privsep.cmonitor_store_stamp()
4.2 Keys and sealed blobs
- keys.wrap: up to 8 slots in a fixed-size file. bcryptpbkdf of username and password, then XSalsa20-Poly1305 over the 32-byte master. The container id is the associated data. built+tested (testkeys).
lib/libkeys/keys.ckeys_slot_kek(),keys_unwrap() - Username selects the world: all slots are one type. The slot count is visible. built+tested (test_keys).
lib/libkeys/keys.ckeys_blob_name() - TPM slot (byol only): the master under a random key that the TPM seals to PCRs. built+tested (testkeys, testtpm2).
lib/libkeys/keys_admin.ckeys_slot_add_tpm(),lib/libkeys/keys.ckeys_unwrap_tpm() - TPM and password slot, recovery phrase slot (byol D): the master under bcrypt of the password mixed with the TPM’s key; the recovery phrase a password-like slot, read by
keys_phrase_canon. built+tested (test_keys; check-boot written, not run).lib/libkeys/keys.ckeys_slot_kek(),keys_unwrap_tpm() - Password change by rewrap: the master never changes. built+tested (testkeys, testappliance).
lib/libkeys/keys_admin.ckeys_rewrap() - Rounds bounds: default 16, floor 8, ceiling 64. built+tested (test_keys).
lib/libkeys/keys_admin.cclamp_rounds() - Sealed blobs: boot, disk, home, config, share, firmware, swap, GPU, GPU note, NIC, place. The file name and the key are derived from the master under separate labels. built+tested (testkeys, testappliance).
lib/libkeys/keys_admin.ckeys_blob_seal(),lib/libkeys/keys.ckeys_blob_open() - Release-signed boot image: Ed25519 over a header with arch, version, handoff version and the image digest. built+tested (testkeys, testrelease_sign).
lib/libkeys/keys_admin.ckeys_image_sign(),lib/libkeys/keys.ckeys_image_verify() - Boot handoff: fixed layout, read once by the monitor, then destroyed. built+tested (testmonitorkeys, check-hostboot).
lib/libkeys/keys.ckeys_handoff_build(),keys_handoff_parse() - World config blob: dom0.conf, dom0.fstab, host name, boot image digest, firmware digest. built+tested (test_keys).
lib/libkeys/keys.ckeys_config_build(),keys_config_parse() - Firmware blob: keyed from the disk key, records sorted and checked. built+tested (testkeys, testfirmware).
lib/libkeys/keys.ckeys_firmware_master(),keys_firmware_cpio() - Image keys: roots, VM disks and the kernel store use a key derived from the master and the image label. The home and share keys are random and sealed. built+tested (testkeys, testmonitor_keys).
lib/libkeys/keys.ckeys_data_key() - Screen-unlock verifier: a salted bcrypt hash. built+tested (test_keys).
lib/libkeys/keys.ckeys_screen_hash(),keys_screen_verify() - Primitives: XSalsa20-Poly1305, an AEAD with associated data, Ed25519 and SHA-512 (TweetNaCl), bcryptpbkdf (OpenBSD), PBKDF2-SHA1 for Wi-Fi. built+tested (testkeys).
lib/libkeys/secretbox.c,lib/libkeys/aead.caead_seal(),lib/libkeys/VENDOR/
4.3 Lock screen password
- Check in the monitor with a throttle: the compositor sends the password. The monitor runs bcrypt. A deny opens a window that starts at 1 s and doubles to 60 s. built+tested (testmonitorkeys, testdom0lock).
lib/libsession/privsep.chandle_screen_verify() - Unlock rewraps place headers that wait for a password change. built+tested (testlibtt, testmonplacewire).
lib/libtt/tt.cmonitor_place_rewrap()
4.4 Time travel: local points
- Library: the monitor links libtt and gives it host callbacks. Up to 32 homes, the share, and each container’s root. built+tested (testlibtt, testlibtt_root).
lib/libtt/tt.ctt_new() - Hourly points by reflink: a FICLONE of the home image. The device is frozen during the clone. An unchanged hour is skipped. built+tested (testmonpoints, testpointsroot, check-months).
lib/libsession/mon_points.cpoints_clone(),point_take(),point_unchanged() - Thinning: all points for 24 hours, one a day for 7 days, one a week up to 104 weeks. Under 5 % free, no new point. Under 1 % free, all points dropped. built+tested (testmonpoints, testmontm, test_months).
lib/libsession/mon_points.cpoints_keep(),lib/libsession/mon_tm.ctm_points_plan() - Clock rules: no point on an unsynced clock. A clock set ahead is never the newest. built+tested (testmontm, test_months).
lib/libsession/mon_tm.ctm_clock(),tm_points_newest() - VM disk points with quiesce: dom0 maps a VM’s disk but never mounts it. The guest freezes before the clone. Each point records how clean it is. built+tested (testqz, testtravel).
lib/libsession/mon_points.cpoints_qz_mark(),lib/libsession/qz.c - Container root points. built+tested (testlibttroot, test_travel).
lib/libtt/tt.ctt_root_home() - Share points: the share is one more home. built+tested (testlibtt, testtravel).
lib/libtt/tt.ctt_share() - Point at power-down. built+tested (test_libtt).
lib/libtt/tt.ctt_last_points() - F11 controls: points on or off, delete all, make a place from a USB disk, a point’s details, mount, unmount, browse a mounted point (TMLIST of its hour), take a point now, consolidate now. Reads are done as the session’s uid. A VM’s point is never opened in dom0. built+tested (testlibtt, testf11screen).
lib/libtt/tt.ctt_set() - Mounted points inside the session: each read-only at
/points/<hour>, any number at once. built+tested (testlibttroot, test_travel).lib/libtt/tt.ctt_open_mount() - Partial file sweep after a power cut. built+tested (testmontm).
lib/libsession/mon_tm.ctm_parts_sweep() - Points from the command line: list, open read-only, roll back. A rollback is itself a point. built+tested (testappliance, testtravel).
installer/upgrade.cadd_points(),add_rollback() - Points switch in dom0.conf. Always off for the decoy. built+tested (test_appliance).
installer/appliance.cslot_conf()
4.5 Time travel: backup places
- Place kinds: USB disk, NFS, SMB. built+tested (testbackupvm, test_travel).
lib/libsession/backup_vm.cbackup_vm_mount_usb(),backup_vm_mount_net() - Place header: the place keys under the password, two copies, each read back. Rekey and rotate on a password change. built+tested (testkeysplace, testmonplace).
lib/libkeys/keys_place.ckeys_place_header(),keys_place_rotate(),lib/libsession/mon_place.chdr_write() - Copies of ciphertext: the copy child and ttvm hold no data key. Sealed chunk manifests. Deltas against a base. built+tested (testmonplacewire, testbackupplace, testtravel).
lib/libsession/mon_place.ccopy(),manifest_make(),hash_chunks() - Anchor: the record names the last copy of each home. Dropped after 14 days. built+tested (testmontm, test_months).
lib/libsession/mon_tm.ctm_place_mark() - Pins: old manifest keys kept across a password change, so old copies still open. built+tested (testkeysplace).
lib/libkeys/keys_place.ckeys_pins_seal(),keys_pins_open() - Daily scrub: the newest copy is read back and checked against its manifest. built+tested (testmontm, testmonplace).
lib/libsession/mon_place.cscrub() - Place thinning: the same rule as points. built+tested (testmonplace_wire).
lib/libsession/mon_place.cthin() - Job scheduler: a copy starts on a point, a disk, a boot or a new place. A deadline per job. Backoff after a failure. An alert after three late kills. built+tested (testmontm, testtmskips).
lib/libsession/mon_tm.ctm_place_tick(),tm_round_next() - USB events: a new disk starts a round. A pulled disk kills the job. built+tested (testmontm).
lib/libsession/mon_tm.ctm_uevent() - Network places through the net VM only. dom0’s own network is never used. built+tested (testmontm, test_travel).
lib/libsession/mon_tm.ctm_place_net() - ttvm: headless. Its disk is the place and the point is a read-only disk. Every reply’s length is checked. built+tested (testbackupwire, check-backup-vm).
lib/libsession/backup_vm.cbackup_vm_cmd(),vmm/backup_wire.h - swm-tt (ttvm init): mounts the place, probes it, locks it, copies through partial files, publishes without replace, reads back with direct I/O. built+tested (testbackupplace).
bin/swm-tt/main.c,lib/libtt/serve.c,lib/libtt/place.c,lib/libtt/agent.c - Make a place from F11: a child derives the place keys. The VM writes the header or adopts one. built+tested (testmonplace, test_libtt).
lib/libtt/tt.cmonitor_place_keys_fork(),lib/libsession/mon_place.cplace_make() - Place status for the panels. built+tested (testlibtt, testf11_screen).
lib/libtt/tt.cmonitor_place_status() - Place commands in rescue: init, show, phrase, list, open, restore, world. Restore puts a copy back as a session’s home, root, or VM disk, or as the world’s share, on a new box. built+tested (testplacetool, test_travel).
installer/upgrade.cadd_place(),place_home_take() - World record: place kind and address, SMB credentials, place keys, screen hash, flags, anchor, settings, Wi-Fi networks. built+tested (testkeysplace, testmonwifi).
lib/libkeys/keys_place.ckeys_place_rec_build(),keys_place_rec_parse() - World file: at each job the place gets the world’s file: its master, config, settings and Wi-Fi networks, sealed under the place header’s key and under the recovery phrase’s key; two copies, each read back. built+tested (testkeysplace, testmonitorkeys, testmonplace_wire).
lib/libkeys/keys_place.ckeys_world_seal(),keys_world_open(),lib/libsession/monitor_keys.cmonitor_keys_world_seal() - Recovery phrase: 12 words of the BIP-39 English wordlist, derived from the master (BIP-39’s words and checksum, not its seed; see security.md 3.8), shown by
swmtool place phrase. It opens the world’s file and copies when the password is lost, and on byol D the disk when the TPM refuses (swmtool recover, from the install stick;swmtool preboot tpm phraseand the stub at an install’s first boot show it). built+tested (testkeysplace, test_appliance).lib/libkeys/keys.ckeys_phrase_key(),lib/libkeys/keys_phrase.ckeys_phrase_words() - A dead box’s world on a new box:
swmtool place worldmakes a new install’s never-booted world the dead box’s again from its file, by password or phrase. It lays the world’s VM kernels from the release, with no network. It seals this box’s GPU and NIC approvals again under the world’s master. It is journaled: the next run finishes a cut-off run. built+tested (test_appliance, install proof).installer/upgrade.cplace_world_run(),world_rekey()
4.6 byol time travel
- The store: byol’s root is
root.img, an image in an XFS store at/swmdata. The store is on the disk’s LUKS2 partition. The image has its own LUKS2, under the disk key. Points are reflink clones beside it. built+tested (testttd, testplan, check-boot).installer/provision.cprovision_store_make(),installer/plan.cplan_byol_open(),installer/swmtool.ccmd_store() - ttd: the daemon, a runit service. Hourly points under a dm suspend, the keep set, the 5% and 1% rules, the hourly FITRIM, on and off. Its socket is
/run/ttd.sock;swmtool ttis its client. built+tested (test_ttd).bin/ttd/main.c,lib/libtt/byol.ctt_byol_open(),tt_byol_do(),installer/swmtool.ccmd_tt() - byol’s place, a directory: the user mounts it (XFS, ext4, btrfs, FAT or exFAT on a disk, NFS, SMB; never FUSE);
tt place /<dir>. A place child on the box mounts its own copy nosuid, nodev, noexec. Not mounted: absent, no copy, the points go on. No ttvm on byol. built+tested (test_ttd).lib/libtt/child.cchild_dir(),bin/ttd/main.cttd_place_start() - tt: the bare tool, no daemon. Each verb runs once, with no hourly point (
on_demand). Its place jobs run in a place child on the box, no VM. Refused while ttd runs;/run/tt.lockholds one writer. built+tested (test_ttd).bin/tt/main.c,lib/libtt/child.ctt_child_fork() - Mount and roll back: a point read-only at
/points/<hour>;tt backstages it asroot.next.imgwith its kernels,tt back undostages the root before.swm-exchangeswaps them in the initramfs. built+tested (test_ttd).lib/libtt/byol.cbyol_back(),bin/swm-exchange/main.c - Restore on a new box: an install whose root comes from a place copy (
restore = /<dir>, mounted first), read by a place child on the box. built+tested (test_plan, check-boot).lib/libtt/restore.cplace_copy_in()
5. Networking
- Session network paths: none, host, routed tap, a port on the net VM’s switch, or the net VM trunk. The monitor picks. built+tested (testnettrunk, testsession, testnet_tap).
lib/libsession/net_trunk.cnet_trunk_nat_path(),lib/libsession/session.csession_net_open() - Reach levels: guest (internet only), lan (LAN only), full (both), none. Enforced in the router. built+tested (testnetisolation, testnetrouter).
lib/libsession/net_nat.cnet_nat_reach() - Routed tap: one /30 per session. The VMM gets the descriptor. built+tested (testnettap).
lib/libsession/net_tap.cnet_tap_plan() - NAT and isolation firewall: nftables over netlink, no nft program. Source checks, no client to router, no client to client, no private ranges without LAN reach, rate and connection caps. built+tested (testnetnat, testnetisolation).
lib/libsession/net_nat.cnet_nat_ensure() - Uplink closed before an address: new inbound traffic dropped. built+tested (testnetnat).
lib/libsession/net_nat.cnet_nat_uplink_close() - Connection tracking size and flush. built+tested (testnetnat).
lib/libsession/net_nat.cnet_nat_ct_flush() - Layer 2 switch: port to trunk only, VLAN tag per port, no learning, no flooding, rate limited. built+tested (testnetswitch, check-vm-switch).
lib/libsession/net_switch.cnet_switch_up(),net_switch_down() - Net VM: owns the NICs (whole, by VFIO), builds the VLAN ports and the router, owns the uplink. IPv4 only. built+tested (testnettrunk, testvmtrunk).
lib/libsession/net_trunk.cnet_trunk_init(),bin/scrotwmd/guest.cguest_net_trunk() - NIC eligibility and uplink status: why a NIC is or is not used, shown in F5. built+tested (testhelperwire).
lib/libsession/gpu.cdev_net_why() - NIC measurement on the box: an unmeasured NIC is tested in a scratch VM, then approved. built+tested (testmonscrub, testf9table).
lib/libsession/mon_nicm.cmon_nicm_start() - NIC firmware to the net VM as a second initramfs. CPU microcode is never passed. built+tested (testmonnetfw).
lib/libsession/mon_netfw.cmon_netfw_open() - Uplink modes: wired, Wi-Fi, wired only, Wi-Fi only, both with standby and failover. partial (no test for the dual uplink).
bin/scrotwmd/guest.cuplink_pick() - Wi-Fi in the net VM: wpasupplicant in the guest. dom0 sends one join with a WPA3 password or a WPA2 PMK. No SSID or key is logged. built+tested (testnetwifi, testmon_wifi).
lib/libsession/mon_wifi.cmon_wifi_choose(),bin/scrotwmd/guest_wifi.c - DHCPv4 client: a separate engine process with its own uid, an empty network namespace and a kill-on-violation filter. The monitor checks the lease and applies it. built+tested (testnetdhcp, testdhcplink).
lib/libsession/net_dhcp.cnet_dhcp_engine_main(),net_dhcp_lease_valid() - dom0’s own DHCP: only as PID 1, only for the rescue world. The dom0 kernel drives no NIC, so it finds no port today. built+tested (testnetdhcp, test_appliance).
lib/libsession/privsep.cmonitor_loop() - DNS policy: a configured resolver, or the lease’s first acceptable one. Client DNS is redirected to it. No DNS is parsed. built+tested (testnetdns).
lib/libsession/net_dns.cnet_dns_ok(),lib/libsession/net_nat.cdns_rule() - NTP in the net VM: OpenBSD ntpd, with pledge emulated by seccomp. Its uid may only send to the named servers. built+tested (testswmntp).
bin/swm-ntp/swm_ntp.cswm_ntp_init(),bin/swm-ntp/pledge.cpledge() - dom0 clock from the net VM: only the offset crosses. Slewed within a budget, one step a boot, and a floor that only moves forward. built+tested (testnettime).
lib/libsession/net_time.cnet_time_judge() - byol networking: no net VM. A container gets a routed /30 on a veth, NAT and its reach, as a VM does. Clients are isolated from each other. built+tested (testnettrunk, testbyolctr_net).
lib/libsession/net_trunk.cnet_trunk_nat_path(),lib/libsession/net_tap.cnet_veth_open() - Guest NIC config from the kernel command line. built+tested (testvmmargs).
vmm/main.cbuild_cmdline() - Network status for F5. built+tested (testhelperwire).
lib/libsession/privsep.chandle_net_status()
6. User interface
6.1 libswm (shared tiling core)
- Layouts: vertical, horizontal, max, floating. built+tested (testlibswm, testx11integration, testwl_integration).
lib/libswm/layout.cvertical_config() - Center and flip layout modifiers. built+tested (test_libswm).
lib/libswm/layout.cconfig_master() - Layout cycle and prior layout. built+tested (test_libswm).
lib/libswm/layout.cswm_switch_layout(),lib/libswm/config.csetlayoutorder() - Master and stack sizing. built+tested (test_libswm).
lib/libswm/layout.c - Floating geometry: kept, constrained to a region, gravity. built.
lib/libswm/layout.cconstrain_window(),contain_window() - Workspaces: created on demand. Cycling skips empty ones or visits all. built+tested (test_libswm).
lib/libswm/workspace.cworkspace_lookup() - Regions and multihead. built+tested (testmultihead, testx11_regions).
lib/libswm/layout.cget_region() - Focus: next, previous, main, urgent, prior, free. built+tested (test_libswm).
lib/libswm/focus.cset_focus(),win_cycle() - Window states: free, floating, below, raised, maximized, fullscreen, iconified, transient. built+tested (testwinfree).
lib/libswm/win.cwin_free() - Iconify and uniconify order. built.
lib/libswm/win.cwin_iconified_each() - Quirks: window rules with regex selectors and window types. built+tested (test_libswm).
lib/libswm/rules.cparsequirks(),win_match_quirks() - Key and button bindings: configurable chords and modifier. built+tested (test_libswm).
lib/libswm/keybind.cparsebinding(),binding_lookup() - 81 named actions, each checked against the man page. built+tested (testconfman).
lib/libswm/keybind.c - Default key map: spectrwm’s keys, workspaces 1 to 22. built+tested (test_libswm).
lib/libswm/keybind.csetup_keybindings() - Structural actions: decides which actions dom0 runs and which go to a session. built+tested (test_e2e).
lib/libswm/keybind.cbinding_action_is_structural() - Config parser: the spectrwm grammar, 171 keywords,
+=and-=, early reads before the fork, refused old keywords. built+tested (testconflex, testconf_man).lib/libswm/conflex.cconf_lex(),lib/libswm/config.cconf_early() - Config search path:
~/.scrotwmos.conf, then/etc/scrotwmos.conf. swm-wl adds a Wayland overlay. built.lib/libswm/config.cscan_config() - Bar format sequences and expansion. built+tested (testlibswm, testcolors).
lib/libswm/bar_fmt.cbar_fmt() - Bar script (
bar_action). built.lib/libswm/bar_script.cbar_script_start() - Colors: names, rgb and hex; per-screen lists. built+tested (test_colors).
lib/libswm/color.ccolor_parse() - Safe text: untrusted strings escaped before they are drawn. built+tested (testsafetext).
lib/libswm/safe_text.csafe_text()
6.2 swm-x11
- XCB window management with ICCCM. built+tested (testx11integration, testx11e2e).
bin/swm-x11/x11_manage.c - EWMH: active window, client lists, desktops, work area, window states, allowed actions, struts, window types. built+tested (testx11e2e).
bin/swm-x11/x11_ewmh.cewmh_setup() - RandR multihead. built+tested (testx11regions).
bin/swm-x11/x11_randr.cscan_randr() - Key and button grabs. built.
bin/swm-x11/x11_hid.cgrabkeys(),grabbuttons() - Stacking order. built.
bin/swm-x11/x11_stacking.crefresh_stack() - Bar with Xft and markup. built+tested (test_colors).
bin/swm-x11/x11_bar.cbar_parse_markup() - Launch workspace: spawned clients get
libswmhackand_SWM_WS, so a window opens on the workspace it was launched from. built.bin/swm-x11/main.c,lib/libswmhack/swm_hack.c - Session keywords: accepted with a warning. X11 has no sessions. By design.
bin/swm-x11/x11_conf.csetconfsession()
6.3 swm-wl (Wayland compositor)
- Wayland globals: xdg-shell, layer-shell, session-lock, XWayland, decorations, activation, presentation, fractional scale, pointer constraints, text input, input method, output management and others. built+tested (testdom0globals, check-wl).
bin/swm-wl/main.cmain() - Scene graph tiling driven by libswm. built+tested (testwlintegration, testwlscene).
bin/swm-wl/main.cdo_stack() - Layer shell with exclusive zones. built+tested (testmultiheadmenu).
bin/swm-wl/wl_layer.c - XWayland: X11 clients tiled. The dom0 build has none. built+tested (testwlintegration).
bin/swm-wl/wl_xwayland.cxwayland_setup() - Clipboard: selection approval, refused under the lock. built+tested (test_clipboard).
bin/swm-wl/wl_clip.cclip_serve() - Window close: close watch per window, SIGHUP to Chromium’s browser process. A session’s X11 Chromium, behind xwayland-satellite, has SIGHUP by a pidfd, and its windows wait for it to go. built+tested (testcompositore2e 9x).
bin/swm-wl/wl_close.cwl_close_hup() - Cursor session tag: the cursor shows a two-letter tag of the session with the keyboard. built.
bin/swm-wl/wl_cursor.ctag_now() - Bar with FreeType. built+tested (test_colors).
bin/swm-wl/wl_bar.c - VT switch: Ctrl+Alt+F1 to F12, also while locked. built.
bin/swm-wl/main.ckeyboard_handle_key() - Power off and reboot as bindable actions. built+tested (check-power-off).
bin/swm-wl/main.caction_poweroff(),action_reboot() - Restart is a reload: the config is read again in place. built.
bin/swm-wl/main.caction_reload(),action_restart() - Search menus: work on a host build. On dom0 they raise an alert. partial.
bin/swm-wl/main.csearch_start() - Spawn routing: a spawn goes through the focused workspace’s session. built+tested (testcontainere2e, test_e2e).
bin/swm-wl/main.caction_spawn_custom() - Bus sessions: surfaces, shared memory and dma-buf buffers, frame channel, input forwarding. built+tested (teste2e, testbuspointer, testfbuf).
bin/swm-wl/wl_session.chandle_surface_create(),handle_buf_add() - Net VM relay: Wi-Fi scan, join, uplink mode, stats. built.
bin/swm-wl/wl_session.ctrunk_relay() - Screen VM link. built+tested (testwlscreen, testwlscene).
bin/swm-wl/wl_screen.c - Output management: apply, test, power, deferred modeset, direct scanout. built.
bin/swm-wl/main.coutput_config_apply() - Input devices and hotplug lock. built+tested (testguruband).
bin/swm-wl/main.cnew_input_handler(),input_rec_add() - Per-world input settings: pointer speed, acceleration, natural scroll, tap, left-handed, cursor size, key repeat. Saved to the world record. built+tested (testguruband).
bin/swm-wl/main.csettings_load(),settings_set() - Input method and text input. built.
bin/swm-wl/main.cnew_input_method_handler(),new_text_input_handler() - Log. built+tested (testwllog).
bin/swm-wl/wl_log.c
6.4 Lock screens
- ext-session-lock: client lockers. A black cover on every output. Stays locked if the client crashes. built+tested (check-wl).
bin/swm-wl/wl_lock.cnew_lock_handler(),lock_create_fallback() - dom0 locker: no client. The password is checked by the monitor and wiped. Shows the host name and the waiting alert count. built+tested (testdom0lock).
bin/swm-wl/wl_lock.cdom0_lock_activate(),dom0_lock_submit() - Locked from boot: a black cover until a lock takes over. built.
bin/swm-wl/wl_lock.clock_at_start() - Sleep from the lock: lock, suspend, wake, ignore keys for 5 s. built+tested (check-sleep-resume).
bin/swm-wl/wl_lock.cdom0_sleep()
6.5 Alert band
- Guru band: a band across every output. Amber for recoverable, red for a dead end. Hidden under the lock. built+tested (testguruband, testguruset, test_alert).
bin/swm-wl/wl_guru.cguru_raise(),guru_key()
6.6 Panels (dom0 build, MOD+F1 to F12)
All panels draw over the focused output and above the lock. Under the
lock only F10 opens. Keys work only from a real keyboard. Text is
escaped. A host build logs a note instead. Tests: testguruband,
testpanelgate, testpanelmenu, and each panel’s own test.
Toggle and key routing: bin/swm-wl/wl_panel.c panel_toggle(),
panel_key().
- F1 help: every live binding, a tutorial, the man page text. built+tested.
bin/swm-wl/wl_panel.cf1_build(),f1_key() - F2 top: one row per session (kind, uid, state, CPU, GPU, memory, tasks, uptime), the display GPU’s engines and clients. built+tested (testf2engine, testgputop).
bin/swm-wl/wl_panel.cf2_line(),f2_sample() - F3 log: this boot’s log lines, filter, up to 4 earlier boots. built+tested (testmonlog).
bin/swm-wl/wl_panel.cf3_sample(),f3_key() - F4 alerts: waiting and seen alerts, with the selected one decoded. built+tested (test_alert).
bin/swm-wl/wl_panel.cf4_line(),f4_key() - F5 network: uplink, internet, uplink mode, standby, net VM, sessions; Wi-Fi scan and saved networks; join, hidden network, forget. built+tested (testmonwifi, testnetwifi).
bin/swm-wl/wl_panel.cf5_line(),f5_key() - F6 disks: disks with I/O graphs, mounts, image use and each image’s newest copy (or never, or no place), partitions, the backup place. built+tested (testf6io).
bin/swm-wl/wl_panel.cf6_line(),f6_key() - F7 USB: input devices, USB devices by port, outputs; a 30 s scan window, accept, delete, detail. built+tested (testf7detail).
bin/swm-wl/wl_panel.cf7_line(),f7_key() - F8 machine: CPUs, memory, swap, battery, uptime, firmware versions. A row for each hwmon: fans, temperatures, voltages, currents and power. A rapl row: the CPU’s power by RAPL zone. Two reader children of the monitor read them: the hwmons and RAPL each 5 s; the batteries each 30 s while one discharges, each 5 min otherwise, each 5 s while F8 is open. No loop waits on them. built+tested (testhelperwire).
bin/swm-wl/wl_panel.cf8_line(),f8_sample(),lib/libsession/privsep.chandle_sensor_status() - F9 IOMMU: virtualization, IOMMU units, device table, ROM and NIC approval records, NIC measure. built+tested (testf9table).
bin/swm-wl/wl_panel.cf9_line(),f9_key() - F10 power: lock, sleep, reboot, power off, last wake reason. built+tested (testfscreen, testpoweroff, testsleep_resume).
bin/swm-wl/wl_panel.cf10_key(),bin/swm-wl/wl_f10.c - F11 backups: state, points list, points on or off, delete all, pick a USB backup disk. built+tested (testf11screen).
bin/swm-wl/wl_panel.cf11_key(),bin/swm-wl/wl_f11.c - F12 settings: 8 input settings, saved to the world at once. built+tested (testguruband).
bin/swm-wl/wl_panel.cf12_line(),f12_key() - Uniconify list (MOD+Shift+W): a panel with no function key. built.
bin/swm-wl/wl_panel.cpanel_uniconify()
6.7 swm-web
- Tiling terminal in a browser: libwebsockets on port 8080, a control protocol for layout and keys, PTY terminals, tiling from libswm. built.
bin/swm-web/main.c,bin/swm-web/web_term.c - Loopback alone, its own page alone: the listen socket on lo; a WebSocket upgrade refused unless Host is localhost, 127.0.0.1 or [::1] with the port and Origin is http:// and that Host. No password: any local user reaches the shells. built+tested (testweblisten).
bin/swm-web/main.ccallback_http(),own_host()
6.8 scrotwmd (session compositor)
- Headless compositor in each session: toplevels, popups, layer surfaces, decorations, activation; requests and titles sent to dom0. built+tested (teste2e, testcontainer_e2e).
bin/scrotwmd/main.cnew_toplevel_handler() - Input from the bus into a local seat. built+tested (testbuspointer, test_e2e).
bin/scrotwmd/main.c - Spawn with an environment allowlist, Chromium flags, profile lock cleanup. built+tested (testchromiumflags, testchromiumlock, testspawncmd).
bin/scrotwmd/main.cbus_handle_spawn(),bin/scrotwmd/chromium_flags.c - Frame transport: shared memory ring or dma-buf with dom0-allocated buffers. built+tested (testframecopy, testframegive, check-vm-dmabuf).
bin/scrotwmd/frame_copy.c,bin/scrotwmd/frame_give.c - XWayland in the session. built+tested (check-compositor-e2e).
bin/scrotwmd/main.cxwl_start() - Renderer recovery after GPU loss. built+tested (test_gkms).
bin/scrotwmd/main.c - Screen VM role: draws the scene into its own swapchain. No input code. built+tested (testscreen, testscreen_draw).
bin/scrotwmd/screen.c,bin/scrotwmd/screen_draw.c
7. Tooling
- Bus protocol: queued non-blocking sends, version and endian handshake, descriptor passing, fixed message types for surfaces, input, clipboard, buffers, screen VM, spawn and net VM. built+tested (testbusmsg, testbusconn, fuzzbusmsg).
lib/libbus/bus_msg.c,lib/libbus/bus_conn.c - scrotwmctl: a developer bus test client. Not shipped. built.
bin/scrotwmctl/main.c - gpu-probe: a CUDA vector-add proof for a compute VM. built.
bin/gpu-probe/gpu-probe.c - libcompat: fparseln, strlcpy, closefrom, timingsafe_bcmp, mount API wrappers. built.
lib/libcompat/ - Examples: a DRM console config and a session config with host, container and VM workspaces. built.
examples/
8. Build and test
8.1 Build
- make only: one top Makefile and one per directory. built.
Makefile - Default target: the libraries (libtt among them), swm-x11, swm-wl, swm-web, scrotwmd, scrotwmctl, swmtool, ttd, tt and swm-exchange. built.
Makefile(all) - Other targets: libswmhack, gpu-probe, swm-ntp, swm-tt, stub, agent, kernels, vmm, musl and glibc build roots, nctx-mesa, gpu-fw, musl-dom0, musl-gfxvm, pkg, release, media, install-media. built.
Makefile - Strict flags for tree code, warnings off for vendored code. built+tested (testdepnames).
mk/cc.mk - Parallel by default, output grouped per target. built.
mk/jobs.mk - Static wlroots and Mesa stack from pinned sources for dom0 and the guest agent. built.
mk/agent.mk - Man page lint on every page, before
make test. built+tested.Makefile(lint-man) - CI: the same make targets on two forges, from one
.github/workflows; gitea runs GitHub’sci.yml. The media runner is not set up. partial..github/workflows/,mk/ci.mk
8.2 Tests
make test: unit tests for libswm, the bus, libsession, scrotwmd, the VMM devices, the installer, keys and TPM, plus shell tests. built+tested.regress/Makefile- Test accounting: plans and asserts; skips can be made failures. built+tested (test_tally).
regress/tally.c - Fuzzing: libFuzzer with ASan and UBSan over 15 corpora (bus, virtio-gpu, vmm-gfx wire, virtqueue chains, PCI, gfx VM agent, GPU hang records, swmtool vm’s YAML and QMP replies). built+tested (check-fuzz).
regress/Makefile(fuzz) - ThreadSanitizer over the device models. built+tested (check-tsan).
regress/Makefile - Display integration: nested X11 and Wayland suites. built+tested (check-x11, check-wl, check-e2e, check-compositor-e2e, check-x11-e2e).
regress/Makefile - Root suites: containers, namespaces, seat, and 34 root suites. Need sudo. built+tested (check-container, check-ns, check-seat, check-root).
regress/Makefile - Installer legs: release, plan, layout, byol, answer, fill, update, passwd, install. built+tested (check-ta).
regress/Makefile - KVM suites: kernels, VMs, dma-buf, ttvm, template end, musl VMM. built+tested (check-kernel, check-vm, check-backup-vm).
regress/Makefile - Long time-travel run: 92 simulated days, about 6 hours, not in check-all. built+tested (check-months).
regress/Makefile - Hardware suites: VFIO, GPU hand-off, nested KVM, switch, GPU hold, gfx, sleep, power off. Not in check-all. built+tested.
regress/Makefile - Boot and install suites: install, boot, loader under OVMF, dom0 boot, keys, session. built+tested (check-install, check-boot, check-stub, check-hostboot).
regress/Makefile - Appliance proofs in qemu: media, then install, each world, and negative installs, in parallel machine slots. built+tested (check-appliance, install-proof).
Makefile(check-appliance,proof_slot),mk/proof.mk - Everything this box can run:
make check-all. built.Makefile(check-all)
Not built yet
These are described in the design documents or the man pages, but the code does not have them.
- Secure Boot signing of the loaders: no build step signs
swmstub.efi,byolstub.efiorswminstall.efifor UEFI Secure Boot. - One keys.wrap per world: all worlds still share one multi-slot keys.wrap.
- Guest-keyed per-session volumes: no code.
- Fixed-slot points and points inside the image: deferred. Only reflink points exist.
- Rescue prompt for the A/B home: no code.
- Static network address: parsed, then refused by install.
- dom0 time zones: only UTC is accepted.
- Auto-lock on idle: the idle notifier exists, but nothing starts the dom0 locker on idle.
- Search menus on dom0: the keys exist and raise an alert, because dom0 runs no menu program.
- X11 and Wayland applications in the browser: investigated and set aside. swm-web is a terminal multiplexer.
- Multihome test: the dual uplink has no test of its own.
- aarch64 VMs: the VMM, gfx VM and screen VM are x86_64 only.
- Second CI runner: the workflow exists, but no runner runs it.
- Panels redesign: the panel layout in the design document is not in the code.