Part 9 4 chapters

Containers and Virtualization

Namespaces, cgroup v2, seccomp, and Landlock as APIs our programs call, then our daemons living inside Podman containers and the real trade-offs of containers versus KVM virtual machines.

Chapter 32

Namespaces and cgroups

The eight Linux namespaces and cgroup v2's unified hierarchy as the two primitives every container runtime assembles from: unshare vs setns vs clone3, the pid-1 reparenting consequence, memory.max enforced by an OOM kill, and the ENOMEM Go hits calling unshare(CLONE_NEWPID) directly from a threaded runtime.

55 minutesRead →
Chapter 33

Seccomp and Landlock

fwatch sandboxes itself with two independent, unprivileged kernel layers (a seccomp-bpf syscall allowlist built from a real strace profile, and a Landlock ruleset that restricts filesystem reads to one directory), probing the Landlock ABI at runtime instead of assuming it, and proving both with negative controls that watch the exact denial happen.

55 minutesRead →
Chapter 34

Our programs in containers

The same three daemons this book has built all along, now shipped as multi-stage UBI10 Containerfiles and run under rootless podman: pid 1's signal and reaping duties, the GOMAXPROCS-from-cgroup story that catches C++'s hardware_concurrency() lying about its own container, debugging across the namespace boundary with podman exec/nsenter/gdb, and the seccomp default that quietly denies io_uring.

60 minutesRead →
Chapter 35

Virtualization and KVM

How a VM actually runs: VMX root/non-root modes, EPT, and virtio devices as the host kernel moonlighting as a hypervisor, the isolation spectrum from bare process through container and microVM to full VM, the rust-vmm/Firecracker/cloud-hypervisor landscape, and overheadbench's measured syscall/mem/io deltas across all three.

50 minutesRead →