Repository navigation
Highlights
Spawn kernels can now be locked down. kerf start --lockdown boots a spawn at one of the kernel's two lockdown levels, and --deny adds individual confidentiality restrictions on top of integrity, enforced inside the spawn by kerf-init with a BPF LSM program. Everything that is a boot parameter is now chosen per run on kerf start: lockdown, console, network, entrypoint and extra parameters. Trying another setting no longer means unloading and loading the image again.
This release also runs on RISC-V hosts, adds kerf cpus to list the physical CPU IDs that --cpus takes, and reads and writes arm64 MPIDRs in hex.
Breaking changes
- kerf needs a multikernel kernel with instance descriptors:
kexec_file_load()returns a descriptor for the instance, and start and halt are ioctls on it. Thereboot()commands and/proc/kimagethat 0.5.0 used are gone from the kernel, so 0.6.0 and an older kernel do not work together --ip,--gateway,--netmask,--nic,--hostnameand--consolemoved fromkerf loadtokerf start. There is no default network: a start without--ipconfigures none, whatever an earlier start didkerf start --consolenow names the console device. The flag that attaches to the console after boot is--attach, or-a- A range in
--cpustakes the CPUs that exist in it, not every number from its first to its last. Nothing changes where the IDs are consecutive - A spawn powers off when its entrypoint exits, as a container does. This ends any exec session still running, and an entrypoint that daemonizes stops the spawn when its parent exits
kerf createlost the options that never did anything:--cpu-affinity,--numa-nodes,--memory-policy,--uringwith its three size options, and--enable-host-kcorezstandardandlz4are new dependencies of the wheel and of the deb and rpm packages
Lockdown
kerf start --lockdown=integrity|confidentialityaddslockdown=to the spawn's command line for that run. The next start without the option is not locked down--denypicks individual confidentiality restrictions on top of integrity, for a spawn that should not read/proc/kcore, say, but still needs perf. The spawn kernel needs BPF LSM and BTF- kerf-init enforces the request before it starts the entrypoint or accepts an exec session. It checks the level the kernel is actually at, attaches the deny list, and guards itself against ptrace so root in the spawn cannot make it let go. If any of it fails the spawn does not run
- A request that could not be enforced is refused on the host, for example a conflicting
lockdown=or anlsm=list without lockdown or bpf in the command line --denyalso works for a spawn that boots its own initramfs:kerf load --initrdappends kerf-init, which applies the deny list ahead of the initramfs's init. No process holds the restrictions in this mode, so root in the spawn can lift them;kerf startandkerf showsay sokerf start --helplists every feature of both levels with the kernel's own description, which is also the list of names--denyaccepts- kerf-init no longer needs clang or libbpf: it reads the few numbers it needs from the kernel's BTF and writes the programs out itself, so one static binary works on any spawn kernel
- kerf-init closes the file descriptors it inherited, so an initrd or loader cannot hand the workload an open
/proc/kcore
kerf start
--entrypointruns something else than the entrypoint the image was loaded with, and--appendadds boot parameters, both for one run- The console and the network configuration are chosen per run, see the breaking changes
- Whether an instance can be started, or is running, is now the kernel's answer instead of a read of its status file beforehand
CPUs
- New
kerf cpuslists every CPU with its logical number, its physical ID, its NUMA node and who holds it: the host, the pool or an instance --cpustakes physical IDs in decimal or0x-prefixed hex on any architecture, and kerf prints MPIDRs in hex, where each affinity level is a byte- RISC-V hosts are supported. A CPU's physical ID there is its hart ID
- CPUs the host never booted, such as the cores of a second kind, are kept in the pool and shown by
kerf show. They need not be asked for and cannot be given back. An instance whose CPUs are of more than one kind is refused
kerf init
- Shrinking a pool no longer picks the chunk that holds the park table of the pool's CPUs, which failed with
-16. That chunk is offered last, once the request returns every CPU - A pool with none of the host's CPUs is no longer an error, as it can still hold the ones the host never booted
kerf create
- Every instance gets a message ring to the host, which the kernel now creates only when asked.
--staticmakes a static partition without one: it cannot be resized, lent PCI devices or shut down gracefully, only killed
kerf load
- zstd and LZ4 compressed kernels are unpacked with the
zstandardandlz4modules instead of external tools, which were only found missing at load. The legacy LZ4 format that the kernel build writes is handled too kerf load --initrdalways adds kerf-init to the initramfs. It does nothing unless a later start asks for it
kerf show
- Reports the command line and the lockdown of the last start
- Counts the park table as allocated pool memory
- The entry address and segment count of a loaded image are no longer shown, as the kernel does not provide them any more
kerf exec
- A malformed reply from the agent is reported as a lost connection instead of a traceback
Other
kerf unloadrelies on the kernel's own answers:EBUSYfor a running instance,ENOENTfor one without an image- The examples in
--helpkeep their line breaks instead of being rewrapped into run-on paragraphs - The README is restructured around installing and using kerf, and the CPU and NUMA topology document is removed, together with the placement code it described, which never ran. Per-node pool memory,
kerf init --memory=SIZE@N, is unchanged
Full Changelog: v0.5.0...v0.6.0