Skip to content

kerf 0.6.0

Latest

Choose a tag to compare

@github-actions github-actions released this 30 Nov 00:57

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. The reboot() commands and /proc/kimage that 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, --hostname and --console moved from kerf load to kerf start. There is no default network: a start without --ip configures none, whatever an earlier start did
  • kerf start --console now names the console device. The flag that attaches to the console after boot is --attach, or -a
  • A range in --cpus takes 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 create lost the options that never did anything: --cpu-affinity, --numa-nodes, --memory-policy, --uring with its three size options, and --enable-host-kcore
  • zstandard and lz4 are new dependencies of the wheel and of the deb and rpm packages

Lockdown

  • kerf start --lockdown=integrity|confidentiality adds lockdown= to the spawn's command line for that run. The next start without the option is not locked down
  • --deny picks 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 an lsm= list without lockdown or bpf in the command line
  • --deny also works for a spawn that boots its own initramfs: kerf load --initrd appends 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 start and kerf show say so
  • kerf start --help lists every feature of both levels with the kernel's own description, which is also the list of names --deny accepts
  • 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

  • --entrypoint runs something else than the entrypoint the image was loaded with, and --append adds 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 cpus lists every CPU with its logical number, its physical ID, its NUMA node and who holds it: the host, the pool or an instance
  • --cpus takes physical IDs in decimal or 0x-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. --static makes 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 zstandard and lz4 modules 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 --initrd always 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 unload relies on the kernel's own answers: EBUSY for a running instance, ENOENT for one without an image
  • The examples in --help keep 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