← board

Kernel-matrix bootroom: one static PXX binary, swept across many Linux kernels

The idea

A PXX binary that uses only raw syscalls (no libc, no ld.so, static ELF) talks to the single most stable ABI in Linux: the syscall ABI ("we do not break userspace"). So the same binary boots — unchanged — on kernels spanning many years. Flip the usual frame:

Two independent axes fall out:

Floor rule: the oldest bootable kernel = the newest syscall we touch. read/write/mmap/exit/brk → very old; epoll → 2.6; io_uring → 5.1. The syscall budget chosen = how far back the binary reaches.

MVP scope (do this first)

Initial app (the payload)

Start simple, grow:

  1. sysinfo / proc-lister (suggested first): open and dump /proc/version, /proc/cpuinfo, /proc/meminfo, /proc/uptime via raw open/read/write. Tiny syscall budget → very old floor. Doubles as "what kernel am I on" proof.
  2. microbench: tight loops over getpid/clock_gettime(vDSO)/mmap+munmap/ write to /dev/null; report cycles per op. This is the per-kernel perf signal. Use rdtsc inside the binary (TCG wallclock is noisy; prefer KVM).
  3. Bonus — framebuffer: open("/dev/fb0"), mmap, draw. NICE-TO-HAVE, deferred: not uniform across kernels/QEMU machine models (needs a fb device in the guest: -vga std + fbcon, or simpledrm; varies by version). Keep it off the MVP critical path; add as an optional payload once the matrix works.

Components

  1. PXX binary = /init — static x86-64 ELF, raw syscalls only. PID-1-safe: do NOT bare exit (kernel panics on init death). End with the reboot syscall (LINUX_REBOOT_CMD_*), or exit + QEMU -no-reboot panic=-1 so the kernel reboots, QEMU dies, harness collects the run. Emit a clear end-marker on serial before shutting down so the harness knows it finished (vs hung).
  2. initramfs — cpio (newc) generated at test time, one binary inside. NEVER committed. … | cpio -o -H newc (or a tiny gen-initramfs helper).
  3. Kernel acquisition (the real practical problem) — NO binary blobs in the git tree. Mirror install_cross_sysroot.sh:
    • a tools/fetch_kernels.sh that downloads checksum-pinned kernels into ~/.cache/pxx-kernels/.
    • source = Ubuntu mainline PPA .deb (extract bzImage), or build minimal vanilla once and cache. Only the script + pinned hashes are committed.
  4. QEMU run:
    qemu-system-x86_64 -kernel $K -initrd $IRD -nographic -no-reboot \
      -append "console=ttyS0 panic=-1 init=/init"
    
    (add -enable-kvm when available for honest timing). Scrape serial = output.
  5. Harness — matrix loop over cached kernels: boot each, collect serial, diff outputs (correctness gate), table the timings (perf report). Likely a make kernel-matrix target + a script under tools/.

Genuine hard parts (work, not blockers)

Deferred / later (cool, out of MVP)

Log