Skip to content

Latest commit

 

History

History
928 lines (727 loc) · 135 KB

DESIGN.md

File metadata and controls

928 lines (727 loc) · 135 KB

FL4: a verified Rust seL4 with fine-grained SMP

Design, draft 9 (2026-11-13). Draft 8 is published at https://claude.ai/artifact/3zN2Xrz25AFk4ysqA4qfin; draft 9 changes how fine-grained locking is built (§6, §7, §9, §13).

FL4 re-implements the seL4 17.0 kernel in Rust. Every seL4 program builds and runs on it unchanged from source, and FL4 adds its own APIs on top. Binary compatibility is not a goal. It makes MCS and SMP first-class, detects hardware at boot instead of asking for configuration, and keeps seL4's big kernel lock only for what is rare: its common syscall paths run beside the lock, on every core at once, within footprints the simulator checks. The serial kernel is proven correct in Lean through Aeneas. The concurrent kernel is checked by deterministic simulation against that proven serial kernel.

Baseline seL4 17.0.0-dev (c98d70ad)
First target x86_64, tested only inside QEMU/KVM
API MCS only
Next target AArch64 (future work, not part of the current plan)
License GPL-2.0, same as seL4

Assurance levels used below: Verified (extracted by Aeneas, proven in Lean), Sim-tested (checked by deterministic simulation), Trusted (small unsafe or hardware code, reviewed and tested).

1. Goals and scope

Goals

  • A superset of the seL4 API. Every seL4 user program is a valid FL4 program at the source level: unmodified sel4test sources build against FL4's own libsel4 and pass. FL4 is free to renumber its ABI and adds new features and APIs over time, so FL4 programs need not run on seL4.
  • Few configuration options. Hardware features are detected at boot. The only build inputs left are the build profile and the few seL4 settings that user programs are compiled against.
  • MCS and SMP as the main configuration. seL4 treats SMP as a big-kernel-lock add-on and has not verified MCS+SMP. FL4 designs for MCS on many cores from the start.
  • Fine-grained locking. Independent operations on different cores run in parallel. Two threads doing IPC on separate endpoints never share a lock.
  • Machine-checked serial correctness. The kernel logic is safe Rust that Aeneas translates to Lean 4. We prove it free of panics and overflow, prove it preserves the kernel invariants, and prove it refines an abstract spec.
  • Tested concurrent correctness. A deterministic simulator runs the real kernel code on simulated cores and checks that every concurrent run is equivalent to some serial run of the proven kernel.
  • Portable. x86_64 first. The architecture boundary is drawn so AArch64 is a new backend crate, not a rewrite.

Out of scope

  • The non-MCS (master) API. FL4 builds only with KernelIsMCS on. Decided.
  • In-kernel IOMMU support. FL4 builds with KernelIOMMU off and has no IO page table objects. User space programs the IOMMU directly (§11). Decided.
  • 32-bit architectures (ia32, aarch32) and RISC-V.
  • Fastpaths. seL4's IPC and exception fastpaths are a second, hand-optimized copy of the general path, with their own proofs. FL4 has only the general path, so there is one implementation to verify. A fastpath can be added later if measurements show a need, together with a proof that it matches the general path. Decided.
  • Information-flow (confidentiality) proofs and binary-level translation validation. The design leaves room for both.
  • seL4's in-kernel benchmark API (KernelBenchmarks: utilisation tracking, kernel-entry tracing, the benchmark log buffer). It exists only in profiling builds, and supporting it would mean another kernel configuration to build, test and verify. FL4 forces KernelBenchmarks none, so sel4test's BENCHMARK_0001 is not built. Performance is measured from user space instead (sel4bench, §12).

2. Compatibility contract

FL4 is compatible with seL4 at the source level, not the binary level:

  • seL4 programs build and run unchanged. Any program written against the libsel4 17.0 MCS API compiles against FL4's libsel4 without edits and behaves as the seL4 spec allows.
  • seL4 binaries do not carry over. FL4 generates its own libsel4 and numbers syscalls, invocation labels, object types, BootInfo records and fault types itself. Every program is rebuilt for FL4.
  • FL4 programs may not build on seL4. They can use FL4's extensions.

What stays the same

Surface Rule
Functions and types: seL4_Call, seL4_TCB_Configure, seL4_MessageInfo_t, the bitfield accessors, … Same names, parameters and return types
Constants: seL4_TCBBits, seL4_IllegalOperation, seL4_CapInitThreadTCB, object type names, … Same names. Values may change, so programs that use the names keep working
Structures user code reads directly: seL4_BootInfo, seL4_IPCBuffer, seL4_UserContext, extra BootInfo records Same field names and meanings
Build interface: sel4test's CMake settings and the CONFIG_* macros user code tests Same names (see §3)
Behavior: check order in decoders, which error a failing call returns, fault message contents, scheduling Follows the seL4 C source and the ported spec (§9)

sel4test does not cover all of that behavior, so FL4 adds a differential fuzzer. It generates programs that use only the seL4 API, builds each one twice, against upstream libsel4 for seL4 and against FL4's libsel4 for FL4, runs both under QEMU and compares their syscall traces (§12).

What FL4 is free to change

  • Numbering. FL4 keeps one interface definition: seL4's interface XML, imported into the FL4 tree, with FL4's methods added where they belong in each interface. The generator numbers everything from it and emits the kernel decoders and FL4's libsel4 together, so the two always agree.
  • Object sizes. The seL4_*Bits constants are FL4's own. The first change is seL4_TCBBits 12 (4 KiB), so a TCB holds the full AVX-512 register state (2,432 bytes with x87, SSE and AVX). The other sizes keep seL4's values for now.
  • Register conventions. The syscall register layout could change too. FL4 keeps seL4's x86_64 convention for now, and libsel4's hand-written syscall stubs are reused.

Extensions

  • Every new API gets a new name. The meaning of an existing seL4 name never changes. New behavior on an existing object is a new method, and the seL4 method keeps its seL4 meaning.
  • Extensions use the seL4_ prefix, as the l4h ones already do, and live in the same headers. They are not build options: every FL4 libsel4 and kernel has all of them.
  • If upstream seL4 later adds an API that FL4 wants, FL4 adopts it under seL4's name, as a normal part of following seL4.
  • More ASIDs. x86_64 FL4 has 2048 ASID pools of 512, about 1M ASIDs (20 bits), where seL4 has 8 pools (4096). The API is seL4's (ASIDControl_MakePool, ASIDPool_Assign); only seL4_NumASIDPoolsBits changes, from 3 to 11. User space pays 8 bytes per ASID, in the 4 KiB pools it retypes. The kernel's own memory for ASIDs is fixed: a 16 KiB table of pool pointers and the PCID cache (§11, x86_64 backend). Mapping caps keep the 20-bit ASID in spare bits of their two words. fl4test FL4ASID0001 runs a process whose ASID is above 2^16. The spec port uses the same widths (Fl4Spec/PORTING.md).

3. Configuration

seL4 has over a hundred Kernel* build options, and many of them just tell the kernel what hardware it will run on. FL4 adds no options of its own. It sorts seL4's options into four groups. The only inputs that change the kernel image are the profile and the two settings in the last group, and none of them depend on the hardware.

Detected at boot (option removed)

seL4 option FL4 detects it from
KernelLAPICMode, KernelUseLogicalIDs CPUID.01H:ECX[21] and IA32_APIC_BASE. x2APIC when the CPU has it, and always when firmware already turned it on. xAPIC otherwise. IPIs use physical destination mode in both
KernelIRQController, KernelMaxNumIOAPIC ACPI MADT: IOAPICs when listed, legacy PIC otherwise
KernelPC99TSCFrequency Under KVM, the pvclock multiplier and shift; otherwise an advertised hypervisor frequency leaf. Native Intel CPUs use CPUID 15H/16H. The fallback is the PIT, as the median of 5 runs on the boot core, never again per core. Native CPU rates are ignored under a hypervisor: GCE C3 reports 1.9 GHz in CPUID 15H while the virtual TSC runs at 2.7 GHz. The temporary pvclock buffer is unregistered after a consistent snapshot. Reported to user space in SEL4_BOOTINFO_HEADER_X86_TSC_FREQ, rounded to MHz
KernelSupportPCID CPUID.01H:ECX[17], with INVPCID from CPUID.07H:EBX[10]
KernelFSGSBase CPUID.07H:EBX[0]. FSGSBASE instructions when present, the MSRs otherwise
KernelFPU, KernelXSave, KernelXSaveFeatureSet, KernelXSaveSize CPUID 0DH. Best save instruction available (XSAVES, XSAVEC, XSAVEOPT, XSAVE, then FXSAVE). XCR0 enables every user state component the CPU has except AMX tile data (8 KiB), which stays off. The 4 KiB TCB (§2) holds the largest remaining area, 2,432 bytes with AVX-512
KernelX86MicroArch CPUID family and model, for errata only
KernelSkimWindow, KernelX86IBRSMode, KernelX86IBPBOnContextSwitch, KernelX86RSBOnContextSwitch The skim window remains for native Intel boots without RDCL_NO; virtualization requires Meltdown immunity on Intel or Zen 2+ on AMD, plus the mitigation capabilities/microcode in the security policy. Each core is probed before VM initialization. Every VM exit uses IBPB, or (opted into per VCPU, with AutoIBRS or eIBRS) owes it to the core's next switch to another address space. Native kernel entry uses IBPB, AutoIBRS with Safe RET on eligible AMD CPUs, or AutoIBRS alone on AMD CPUs reporting SRSO_NO or SRSO_USER_KERNEL_NO. Legacy IBRS, return-stack stuffing, PBRSB, BHI controls/clearing, VERW and SMT restrictions are selected as required. eIBRS/AutoIBRS remain enabled when available. No additional context-switch IBPB is used (§15).
KernelMaxNumNodes (as a hardware count) Enabled processors in the MADT. See the last group for the upper bound
KernelCacheLnSz CPUID.01H:EBX for flush loops. Data layout always aligns to 64 bytes
KernelMultiboot1Header, KernelMultiboot2Header, KernelMultibootGFX* Both headers are always present. The multiboot2 header asks, as an optional request, for a linear framebuffer with no preferred size. FL4's x86_64 UEFI loader passes the firmware's current GOP mode in the same tag when it is 32-bit RGB, except in SEV and TDX guests
EFER.NXE (for seL4_X86_ExecuteNever) CPUID 80000001H:EDX[20]. Without execute-disable the attribute is ignored
MCS timer mode Already a boot-time choice in seL4: TSC-deadline when available, calibrated LAPIC one-shot otherwise

Fixed at one value

These are accepted only at the value FL4 supports. The CMake shim fails the build with a clear message for any other value. Values that user programs see are generated into FL4's libsel4, so programs and kernel always agree.

  • API shape: KernelIsMCS on, KernelIOMMU off, KernelVTX and 64-bit VCPU guests on, KernelNumDomains 1 (one scheduling domain; KernelNumDomainSchedules follows at upstream's value for one domain), KernelHugePage on, SYSCALL as the entry method, KernelPTLevels 4.
  • Kernel limits at seL4's defaults: KernelNumPriorities 256, KernelRetypeFanOutLimit 256, KernelMaxNumWorkUnitsPerPreemption 100, KernelMaxNumBootinfoUntypedCaps 230 (x86_64 describes 256 more in an extra BootInfo record, l4h 0047), KernelBootThreadTimeSlice 5, KernelWcetScale 1, KernelStaticMaxPeriodUs 0. The kernel builds these in, so the shim refuses any other value rather than let libsel4's generated configuration advertise a limit the kernel does not enforce (GitHub issue #3). KernelTimeSlice (non-MCS only) and KernelStackBits (FL4 sizes its own kernel stacks) do not apply.
  • KernelResetChunkBits is 16: untyped resets clear 64 KiB, then check for preemption, as in l4h patch 0030.
  • Always off: fastpaths (KernelFastpath, KernelExceptionFastpath, KernelSignalFastpath) and KernelDangerousCodeInjection. KernelX86DangerousMSR is on only in the bench profile. Fastpaths are left out because a second, hand-optimized copy of IPC is hard to verify (see §1). User programs cannot tell the difference, since the fastpath only changes speed.
  • Compiler options (KernelOptimisation and similar) do not apply. Cargo profiles replace them.

Set by the build profile

There are three profiles, debug, release and bench. Debug turns on KernelDebugBuild, KernelPrinting, the hardware debug API (breakpoints and single-step, which sel4test turns on for debug builds), invocation error reporting and IRQ reporting. Release turns them all off. Bench is release plus what sel4bench needs to read the performance counters: user-mode rdpmc (KernelExportPMCUser) and the seL4_X86DangerousRDMSR/WRMSR syscalls (KernelX86DangerousMSR), which the kernel's entry glue answers without entering the core. A project that asks for either gets both; every other build gets neither.

Read from the user-program configuration

Two settings stay, because user programs are compiled against them. FL4 reads them from the same generated configuration as libsel4:

  • KernelRootCNodeSizeBits, the size of the root task's CNode (seL4's default is 12; sel4test uses 13, l4h 19).
  • KernelMaxNumNodes as an upper bound. FL4 starts min(cores found, this value, 64) cores on both architectures, so a program sized for N cores never sees more than N. The core's logical state, its core masks (u64), the serial gate, and the AArch64 per-core storage and banked IRQ layout support 64 nodes. The gate holder drains only the cores the boot started (SerialGate::set_cores).

Boot command line

FL4 keeps one of l4h's boot options, with the same name. It says where console output can be seen, which the build cannot know:

Option Effect
fb_console Also draw the console on the multiboot2 framebuffer (from GRUB, or from GOP through FL4's x86_64 UEFI loader), for machines whose serial port cannot be reached

SMP is not an option either. One kernel image runs on one core or many. With one core, lock operations take a predicted branch on a flag set at boot, so uniprocessor IPC does no atomic operations.

AArch64 follows the same rule: GIC version, timer frequency, physical address size and memory map come from ID registers and the device tree at boot, so one image covers every supported board.

4. From the l4h patch series

The l4h kernel is seL4 plus 41 patches (l4h/kernel/patches). FL4 includes every fix and feature in that series, except multikernel partitioning (0031 to 0036). The virtualization implementation and its current verification limits are described in README.md. New APIs become FL4 extensions under §2. Fixes become FL4's behavior from the start, each with a regression test in fl4test or the simulator.

l4h user space

l4h's new methods, constants, flags and BootInfo records keep their l4h names and arguments, so l4h user space builds against FL4's libsel4 with no source changes. Their numbers come from FL4's generator, like everything else, so l4h user space is rebuilt like any other program.

New APIs

Patch Extension FL4 notes
0003, 0006 seL4_TCB_SetTimer: one-shot deadline timer per TCB that signals a badge to its bound notification The in-kernel timer. Armed timers sit in a per-core balanced tree ordered by deadline, held under that core's scheduler lock. Arm and disarm take O(log n). At most 32 timers fire per kernel entry, and the rest fire on an interrupt programmed for right away. The hardware is armed for the deadline itself, so a timer never fires early. The armed deadline is tracked, and the timer is not reprogrammed for a later deadline. Tree invariants join P1
0001, 0004, 0027, 0007 seL4_TCBFlag_trapSyscalls: every syscall instruction of the thread goes to its fault handler as UnknownSyscall For foreign syscall ABIs such as Linux processes. int $N on the gates open to user space is reported as #GP with the vector. FL4 always saves and restores the user RSP on SYSCALL entry, with or without the skim window. On AArch64 the fault carries x8
0002 seL4_TCB_ReadFPU, seL4_TCB_WriteFPU through a frame The image is always the standard (uncompacted) XSAVE layout, whatever save instruction was chosen at boot. Written images are sanitized: MXCSR is masked with the CPU's MXCSR_MASK, and only components enabled in XCR0 are kept. A live copy on another core is flushed first, and the state is reloaded when the target is the caller
0009 seL4_X86_ExecuteNever VM attribute Sets XD on 4 KiB, 2 MiB and 1 GiB user mappings, so user space can enforce W^X
0017 seL4_X86_DeferFlush attribute and seL4_X64_PML4_Flush A remap that only lowers rights can skip the TLB shootdown, and the caller flushes a batch at once. FL4 also adopts the flush rules that need no API: mapping into a not-present entry flushes nothing, and a remap that only raises rights flushes the local core only
0023, 0029 Page_TestAndClearAccessed for 4 KiB and 2 MiB mappings For page reclaim in user-level OS personalities
0029 Page_DeriveSubframe: 4 KiB aliases of a RAM-backed 2 MiB frame The aliases are CDT children of the large frame cap when that cap is original (siblings when it is a copy), so revoking the original removes them. The CDT invariants in P1 cover the new parent-child shape
0025 IRQControl_GetIOAPICRemapped Programs an IOAPIC pin in remappable format with an interrupt-remapping handle the caller owns. This is the piece that lets a user-space IOMMU driver do interrupt remapping (§11)
0021 BootInfo record for the boot modules after the first The modules are copied above the root task's image, below 4 GiB, and handed over as device untypeds so retyping does not clear them
0047 BootInfo record for x86 untypeds past the 230 in BootInfo On x86_64 up to 256 more untypeds keep their caps, in the slots after untyped.end, and their descriptors go in an extra BootInfo record (ID 10) after the others; the rest of the extra BootInfo is a padding record and extraLen covers all its mapped pages. An untyped past those fails boot; AArch64 still drops them as seL4 does
0018 BootInfo record for the AArch64 feature ID registers Part of the AArch64 port

Fixes that become FL4 behavior

Patch Behavior in FL4
0000 Remote stalls can fail. A stall IPI is handled only on the interrupt path. When the remote core is busy, the operation gives up and the syscall restarts. In FL4 an operation that needs a stall runs under the serial gate (§7). The operations that need a stall: TCB invocations, finalising a TCB or SC cap, removing a reply whose donated SC belongs to a thread on another core, SchedContext_YieldTo, and SchedControl_ConfigureFlags. l4h's GenMC harnesses for the lock and IPI code are ported to FL4's lock table and serial gate, next to the simulator's weak-memory mode
0012 A timer interrupt that finds the timer still armed belongs to a deadline that has since been replaced. FL4 acknowledges it and returns to user space without taking the serial gate. The armed deadline is compared with the time first, so a due interrupt does not pay for the MSR read, which traps under a hypervisor. This prevents the livelock l4h saw with vCPUs that the host deschedules
0013 SchedControl_ConfigureFlags enqueues a thread on another core only when it is schedulable. A postponed thread still gets a remote queue update, so that core reprograms its timer
0014 APIC countdown mode converts deadlines with both rates instead of their truncated ratio, rounds up so the count never runs out early, and re-arms delays longer than the 32-bit count
0019 At boot, only free pages that contain a nonzero word are cleared, which keeps the hypervisor's shared zero pages. Clean boot untypeds start with a free index of 0. Untyped resets at run time still clear everything
0021 The load-address search skips memory regions that end below the minimum address and rounds region starts up to a page. Modules whose end is below their start are ignored
0028 User segments use the Linux layout: data at 0x2b, code at 0x33, and STAR[63:48] = 0x23, so SYSRET and IRET load the same selectors. The selector values are not part of the libsel4 API, but a program that reads %cs sees a different value than on seL4
0030 Untyped resets clear 64 KiB, then check for preemption (§3)
0037 APs load the full GDT base in real mode
0008 Every invocation starts with an empty error-message buffer, so an error reply never carries a message left by an earlier, possibly more privileged, invocation. The MCP threshold from the same patch is left out (see below)
0011, 0020 Multiboot2 framebuffer request and the framebuffer console (§3)
0022, 0024 Timer-rate sources and the Meltdown check, now boot-time detection (§3)
0015, 0016 AArch64 port: broadcast inner-shareable TLBI instead of IPIs, 16-bit ASIDs required (TCR_EL1.AS), APs that fail init stop, and MCS uses the CNTFRQ rate read at boot (§11)

Fixes found while building FL4

Behavior where FL4 differs from seL4 17.0 only by closing a race or an overflow. They were found by the simulator (§10) or the P0 proofs (§9).

Where Behavior in FL4
TCB_CopyRegisters The source thread is stalled like the target when it runs on another core. seL4 stalls only the target, so it copies a stale register context and, with suspendSource, leaves the other core running a suspended thread until its next kernel entry
Domain time accounting The check that the domain's time has run out saturates, so a very long interval cannot wrap the sum and underflow the remaining time

FL4 bugs the verification work found

Bugs in FL4's own code, not differences from seL4, kept here because each one shows which check catches what:

Bug Found by Fix
The release queue's tail was read from the word after its head, which was the deadline-timer tree root (l4h 0003), so arming a TCB timer corrupted the release queue fl4-sim's release-queue oracle (tail and links), once the workload gave SCs partial and sporadic budgets RELEASE_TAIL follows RELEASE_HEAD
budget_check's overrun loop gave up after refill_max + 2 rounds; seL4's has no bound. Charging more budgets than that at once (a long vCPU stall) then took the usage off a smaller head refill, which wrapped, so the SC had an effectively unbounded budget P1: the ordering proof for budget_check would not go through; fl4-sim then reproduced it with 2 s stalls (seed 25 in the regressions) Walk fuel for the loop, and the post-loop charge guarded by seL4's own assertion (head.amount > usage)
Finalising a CNode recursed once per level, so deep zombie chains could overflow the kernel stack P0 (recursion has no measure) Loops
Clearing dirty memory divided by the region size, which can be zero P0 Guard
Unmapping a 4K frame mapped with the PAT attribute (write-combining) left the entry in place, because bit 7 of a 4K entry (PAT) was tested as the large-page bit; the cap became unmapped over a live user mapping P3 (VSpace, frame Unmap) Per-size base-address masks, no PS test for 4K; fl4test FL4VM0005
The timer red-black tree followed links without null checks where only the red-black invariant rules out null, so a damaged tree would write page zero P1 (timer proofs) Null nodes have no links and are never written
The kernel's USER_TOP was libsel4's seL4_UserTop (0x7ffffffff000), not C's 0x7fffffffffff, so page-table maps and breakpoints in the last user page were refused where seL4 accepts them P3 (VSpace, l4v user_vtop) C's value
With no receive IPC buffer, set_mr returned the running index past the message registers, where seL4 returns n_msgRegisters, so fault messages reported a length of up to 18 instead of 4 P3 (fault-message refinement) Return N_MSG_REGISTERS
An NMI, #DB or #MC between SYSCALL and the stack switch pushed its frame on the user's RSP in ring 0 Review while adding the SYSRET exit IST stacks
VMX controls could advertise performance-MSR switching while CPUID exposed no PMU, causing a host MSR-read fault Intel real-guest regression Filter the VMX entry/exit performance controls by PMU availability
Deleting a non-final IO-port cap left its VCPU grant active; final cleanup revoked unrelated VCPU grants Proof port and seL4 lifecycle comparison Revoke only the cap owner's grant on every finalisation; free the allocation during final cleanup
ReadVMCB returned the ASID word (0x058, with the kernel's flush decision) and the clean bits (0x0c0), which the kernel rewrites on every entry from per-core state, so one VMM could see whether another VCPU or root had run on its core Spec review of the VCPU decoder Both read as 0, like the physical pointers; WriteVMCB already rejected them
A remote stall serviced while exit() took the serial gate after a local path (the ASID this core ran had gone stale; on AArch64 also for a thread running a VM) made the running thread restart at FAULT_IP, still that of its last entry. A thread a local path had just woken from ReplyRecv ran the syscall again with the received badge as its capability, and took a cap fault in the receive phase l4h guest stress, two 2-vCPU guests (losfair/l4h#227) Before that wait, a running thread's FAULT_IP is its NEXT_IP, as an interrupt entry saves it
A guest's HVC under ARMVCPURun (AArch64) whose exit a remote stall cancelled while it took the serial gate was lost: the CPU had already advanced the guest's ELR past the HVC, the caller stayed TS_RUNNING_VM, and its guest went on after an HVC its VMM never saw Review of the remaining stall-cancellation points after losfair/l4h#227 The guest's ELR is the HVC until the entry runs, as FAULT_IP already was for a bound VCPU's HVC; the entry's body moves it past the HVC again before completing the run
A user int3 (#BP) or #DB (x86_64) whose entry a remote stall cancelled while it took the serial gate was lost: the thread restarted after the instruction (a trap-type exception, as int3, single-step and data breakpoints are, is not raised again), and DR6 had already been read and cleared Review of the remaining stall-cancellation points after losfair/l4h#227 Every user #BP and #DB is kept alike: the entry leaves it pending in the thread (its DR6 debug slot, with the DR6 status bits and the resume address); exit() delivers it under the gate, and a stall while taking it keeps it pending until the thread next runs. It is dropped if the thread was moved (its resume address changed) or the breakpoint it names was removed before delivery

The VT-x and AMD-V patches (0038–0043) are implemented through a shared VCPU/EPT API with runtime CPU selection. See README.md for implementation and verification status.

Virtualization differences from seL4

Where Behavior in FL4 Why
endTimeslice A thread in RunningVM whose budget runs out gets no timeout fault, even with a valid timeout handler: it is appended or postponed like a thread without one. seL4 raises the fault whatever the thread state A fault would abandon the in-flight VMEnter: the thread would leave RunningVM blocked on its timeout handler with no VMEnter result (neither an exit nor a notification). In seL4's reply path (handleFaultReply, doReplyTransfer), a timeout reply copies the registers its message carries (the TimeoutReply layout, FaultIP first) into the thread. With label 0 the thread restarts at FAULT_IP: by default that re-executes SysVMEnter with the stale entry message registers, not the guest state the interrupted entry had reached, and only a reply that rewrites FaultIP resumes it elsewhere in user space. With a nonzero label the thread is left Inactive

Left out

  • Debug syscall MCP threshold (0008, KernelDebugSyscallMinMCP). FL4 does not gate debug syscalls or kernel error messages by MCP. Debug syscalls exist only in the debug profile, which is not for running untrusted code.
  • Multikernel partitioning (0031 to 0036). FL4 is always the only kernel on its machine. That drops the kernel load-address build option, the ap_boot_page=, no_legacy_irq, peers=, console_ring=, tsc_mhz= and apic_khz= boot options, and IRQControl_SendPeer. FL4 loads at the fixed seL4 address, owns the IOAPICs and PIC, and always measures its own timer rates.

5. Architecture

The kernel is a stack of layers. Each one has a single assurance level, so the trusted code stays small and easy to find.

Layer Crate Assurance Contents
User space sel4test, rootserver Unmodified sources, built against FL4's libsel4
Entry and exit fl4-arch-x86_64 Trusted SYSCALL/SYSRET, interrupt and exception stubs, register save into the TCB, per-core GS state, FPU switching
Entry runtime fl4-sync Trusted, sim-tested The serial gate (a ticket lock that drains local paths), the local paths beside it, IPI servicing while spinning
Kernel logic fl4-core Verified Syscall dispatch, decode, CSpace, CDT, IPC, notifications, untyped, scheduling, MCS refills, VSpace logic, IRQ objects. Safe Rust only, generic over the store and arch traits
Object store fl4-store Trusted, sim-tested Implements Store over physical memory, directly: on one core, under the serial gate, or within a local path's footprint; the object locks of local paths
Hardware backends Trusted Page-table writes, TLB and cache maintenance, x2APIC, TSC-deadline timer, IOAPIC/MSI, ACPI parsing, serial

Workspace layout

fl4/
  crates/
    fl4-abi/          # generated from interfaces/ and .bf; no_std, no unsafe
    fl4-bitfield-gen/ # Rust backend for seL4's bitfield_gen.py
    fl4-core/         # #![forbid(unsafe_code)]; the Aeneas input
    fl4-sync/         # serial gate, local paths, IPI-aware spinning
    fl4-store/        # PhysStore, the object locks of local paths
    fl4-arch/         # Arch + Platform traits, shared by all backends
    fl4-arch-x86_64/  # entry asm, paging, APIC, timer, FPU, VT-d (later)
    fl4-arch-aarch64/ # placeholder that compiles; filled after M5
    fl4-kernel/       # the kernel binary: boot, glue, linker script
    fl4-sim/          # deterministic simulator and oracles (host binary)
  proofs/             # Lean 4 project (Lake)
    Fl4Core/          # Aeneas output, regenerated by the gate, never hand-edited
    Fl4Proofs/P0/     # no-failure theorems (generated, plus hand-written ones)
    Spec/             # abstract spec, ported from seL4's Isabelle ASpec (MCS)
    Invariants/  Refinement/  Runtime/
  cmake/              # drop-in "kernel" for seL4 CMake projects (sel4test)
  interfaces/         # the one interface definition: seL4's XML imported, plus FL4 methods
  libsel4/            # FL4's libsel4: generated headers + seL4's hand-written ones
  vendor/seL4/        # pinned upstream, for CMake config, generators and the fuzzer's seL4 build
  xtask/              # codegen, extract, prove, sim, sel4test runners

6. The verified core

fl4-core holds every kernel decision. It has to stay inside the Rust subset that Charon and Aeneas translate, so we design for that from the start rather than retrofit it.

Rules for fl4-core

  • #![no_std], no alloc, #![forbid(unsafe_code)]. No raw pointers, Cell, RefCell, atomics, dyn or closures stored in data.
  • Objects are named by typed physical-address handles (TcbRef, EpRef, SlotRef, …), never by references held across calls. Intrusive lists (endpoint queues, ready queues, the CDT) link handles, as in seL4.
  • Every fallible path returns Result. Arithmetic uses explicit checked or wrapping operations. Aeneas models overflow as failure, so "never fails" theorems cover overflow too.
  • Loops are bounded by data the kernel controls (queue length, CNode radix, preemption-point counters). Long operations return to the caller at preemption points, exactly as seL4 does.
  • Dependency on hardware goes through two traits: Store for kernel memory and Arch for machine operations. Both are plain generic parameters, which Aeneas turns into Lean structure arguments.
  • CI runs Charon and Aeneas on every commit. A construct Aeneas cannot translate fails the build. This "extractability gate" is the main guard against slowly drifting out of the subset.

Shape of the core API

The core is written as a serial kernel: one entry point per kind of kernel entry (handle_syscall, handle_interrupt_entry, handle_vm_fault, handle_user_exception, …), each taking the store and the machine and running the whole entry, scheduling included. seL4's split into a mostly read-only decode and a writing invoke is kept as it is in seL4, as a matter of structure, not as an interface concurrency depends on.

// fl4-core: safe Rust, extracted by Aeneas
pub trait Store {
    fn read(&self, addr: u64) -> u64;           // kernel memory, by kernel virtual address
    fn read_pair(&self, addr: u64) -> (u64, u64); // adjacent words, defaulting to two reads
    fn write(&mut self, addr: u64, v: u64);
    fn zero(&mut self, addr: u64, len: u64);
    fn ks_base(&self) -> u64;                   // the kernel's global state
    fn cur_cpu(&self) -> u64;
}
pub trait Arch { /* time, IRQs, TLB, IOAPIC, ports, FPU, remote stall, console */ }

pub fn handle_syscall<S: Store, A: Arch>(s: &mut S, a: &mut A, number: i64);

Objects are typed handles over this memory (Tcb, Ep, Slot, …) with field accessors, so every kernel decision is a function of what the store returns. That is what lets one core serve every execution mode: the store is plain memory on one core, under the serial gate, and within a local path's footprint (§7), and the proofs, which are about the serial core, apply to each entry.

Fast paths

An l4h guest syscall is two kernel entries: the user context's trapped syscall, delivered as an UnknownSyscall fault to the vCPU's kernel thread waiting on its endpoint, and that thread's ReplyRecv, which answers it and waits again (l4h DESIGN §5.4). fastpath.rs handles each in one flat function: after the same prefix as the general path (FAULT_IP, the budget check) it checks, with reads only, that the general path would take its common course (a receiver waiting with a reply object and its own scheduling context; a reply through an undonated reply object to a thread that can run at once; an idle endpoint with nothing signalled; the other thread chosen next, nothing to wake, the domain not over), then makes the same writes and Arch calls and switches directly. A declined fast path has changed nothing, and the general path runs as before. It skips the decoding, the second reply-cap lookup, the possible-switch, enqueue and dequeue pair that leaves the ready queues as they were, and the scheduler's search, and keeps out-of-line calls (each a mispredicted return under Safe RET) to commit_time and set_next_interrupt.

The intended theorem is fast s = (true, s') → handle_syscall_general s = s', in the style of seL4's fastpath proofs; it is not proved yet. fl4-sim --fastpath-diff checks it: each serial syscall runs through the general path, is undone from a store log, and runs again through handle_syscall, and every word either wrote and the simulated machine (time, RNG, deadlines, effects, loaded address space) must end the same. --scenario guest sets up an l4h vCPU's handler and trapping thread on one core, among the random workload; cargo xtask sim runs it with the check, and on every core at once under the random, PCT and TSO schedulers. The fast paths also run beside the serial gate, as local paths (§7).

Footprints

A kernel entry's footprint is the memory it reads and writes. Under the serial gate it does not matter: nothing else runs. A local path beside the gate (§7) runs alongside other local paths, so its write footprint is stated, small and checked: the simulator asserts it on every local path it runs, and P2 (§9) is to prove it.

7. Concurrency: the serial gate and local paths

seL4 SMP protects the whole kernel with one CLH lock (NODE_LOCK_SYS in include/smp/lock.h). FL4 does too, for most kernel entries: the serial gate. What scales instead are local paths: syscalls common enough to matter whose footprint is known, which run beside the gate on every core at once. Concurrency comes from adding local paths, each one checked, not from a general mechanism.

Until 2026-11-21 FL4 ran concurrent entries as TL2-style transactions over a striped seqlock table (fl4-store's tx, with P2 in §9 proving it serializable). That was removed. An entry runs 600–700 cycles and touches 100–200 words, and a transaction pays for every access (version checks, read and write logs) and a commit: 4,000–5,000 cycles on x86_64 even uncontended, against 650–750 run directly. Under the gate with local paths beside it, x86_64 ran getpid 5–7× faster than with transactions at 4–6 vCPUs and fault_4k up to 1.5× (§12). Two mechanisms side by side also doubled the reasoning about how they interact, and the gap between P2's abstract model and the 1,200-line runtime was only tested.

The serial gate

fl4_sync::SerialGate: a ticket lock whose holder also excludes local paths.

  • Tickets. A core takes a ticket (next, fetch-add) and waits until serving reaches it, servicing remote calls meanwhile. next, serving, closed, each core's active flag and owner each sit on their own cache lines: queued cores spin on serving and local paths read closed, so a handoff that keeps the gate closed moves only the queued cores' line.
  • Draining local paths. A core running a local path marks itself active. The gate holder stores closed = 1 and then scans the active flags until none is set, then sets closed = 2. The active store and the closed store are SeqCst, each followed by a load of the other's word: a Dekker handshake, which needs the store-load order x86 gives only to locked stores. Either the local path sees the closed gate and backs off, or the holder sees its flag and waits. The holder orders its store before the scan with one SeqCst fence and reads the flags with plain loads, so their cache misses overlap; SeqCst loads (AArch64 LDAR) would take one miss after another, microseconds per serial entry on 64 cores. An acquire fence after the scan orders what the drained paths wrote (their releasing leave_local) before the entry.
  • Handoff. closed distinguishes open (0), closing and draining (1), and closed with local paths excluded (2). A release with another ticket queued keeps the gate at 2, and the successor, acquiring the release of serving, inherits the exclusion without another scan. Otherwise release opens the gate.
  • One core. With one core there is no gate: the store is plain memory.
  • IPI-aware spinning. seL4 services remote-stall IPIs while spinning on its lock. FL4 does the same in every spin loop: waiting for the gate, for local paths to drain, or for a remote call to be acknowledged. IPI handlers touch only core-local state, so a core waiting for an acknowledgement cannot deadlock with a core spinning on the gate. A stall puts the stalled thread back in its queue, which is another core's if the gate holder just moved it; the servicing core then sends the reschedule IPI that core is owed, since it is in no entry that would (found by the simulator under PCT: an idle core with a ready thread and no IPI).
  • Effects. Every Arch operation runs at once, whether under the gate or in a local path: an entry never reruns, so nothing needs to be queued or undone. An entry accepts interrupts only in its body (at preemption points, under the gate), after any remote stall could have cancelled it.

Local paths

fl4_sync::run_syscall: on several cores, a syscall that may have one first tries its local path; if that declines, the entry takes the gate. run_vm_fault and run_timer_irq do the same for a VM fault and for the kernel timer interrupt. The local paths now:

  • an l4h guest syscall's fault and the handler's ReplyRecv, the fast paths of §6 (handle_syscall_local);
  • I/O port invocations, SysCall or SysSend on an IoPort cap (handle_ioport_local): the general path's own code, once reads show a valid access, budget left, and no reschedule pending or due on this core (schedulable_here). l4h's logger writes the serial port one byte per invocation, each with a trap to the hypervisor; under the gate, a guest's boot log slowed the syscalls of every other core by about 25% for half a second;
  • frame-cap invocations (fl4_core::localinv, handle_invocation_local): CNode Copy and Mint of a frame cap, CNode Delete of a small RAM frame cap, and the page map of a small RAM frame (X86Page_Map; on AArch64 ARMPage_Map into a VSpace, cacheable, since a non-cacheable map cleans the frame's cache lines first): the general path's own decode, once the plan's slots and page-table entry are locked and still hold what the plan read. An l4h guest's fork, exit and page faults are mostly these. On x86_64 an unmap or remap may shoot other cores down by a remote call (CALL_LOCK); on AArch64 it is a broadcast TLBI, which writes no kernel state;
  • TCB_SetTimer on a thread of this core that is disarmed or armed in this core's timer tree (fl4_core::localtimer::handle_set_timer_local), when the caller keeps running and nothing becomes due: the general path's own code, tcb::decode's timer::insert, the reply and a schedule() that keeps the caller. It looks the target up one CSpace level at a time (localtimer::cspace_step), locking each slot before it reads it and holding the locks until it ends, since frame-cap invocations on other cores write slots of a shared CSpace beside the gate; it writes no slot, and the timer state it writes is this core's alone (timer ownership, below);
  • the kernel timer interrupt, from a native thread or the idle loop (fl4_core::localtimer::handle_timer_irq_local), the general path's handle_interrupt_entry once reads show it stays on this core: a round-robin budget that runs out with no other thread of this core ready at the thread's priority or above (refilled, the thread goes on); one due timer, of a thread of this core in this core's tree, whose bound notification is active (badges ORed), idle (made active, or its thread woken from Recv) or waited on (its waiter woken), the woken thread and whatever schedule() may then choose being this core's threads with no VCPU, no yield to complete and no SC donated; or neither (a timer interrupt for a budget or deadline already dealt with). Issue #94 measured the timer interrupt as the largest source of serial entries under guest syscall load, about 1,200 per busy core per second on AArch64.

The timer interrupt's local path is planned with reads only (plan_timer_irq), locks what the plan names (the notification; for a thread woken from Recv, the endpoint and reply object cancel_ipc writes), lets observe see them, and checks again under the locks that the plan still holds, as the syscall paths do. On AArch64 it is the one interrupt acknowledged beside the gate, and under a priority mask (gic::ack_timer_only): each core's remote-call SGI (0x40) and kernel timer (0x60) are above the mask (0x80), every other interrupt below it (0xa0), so the acknowledge returns the timer, that SGI (which needs only its end), or nothing, even if the timer stopped asserting after the entry found it the highest pending; never an LPI whose handler a serial entry may be moving (take_irq_under_gate). The values keep their order in every implemented priority width and in the Non-secure view of a GIC with two security states, where both priorities and mask are stored shifted ((p >> 1) | 0x80). A GICv3 with two security states and SCR_EL3.FIQ 0 shifts the priorities but not the mask, which then hides the timer though both read back alike: each core's init_cpu writes the least implemented priority bit to a priority register and to the mask and reads them back to tell the views apart (gic_layout::v3_same_priority_view, as Linux's gic_has_group0), then reads the priorities and the mask back, and if any core's GIC fails either check, no core takes the timer beside the gate (gic::can_ack_timer_only). An acknowledge under the mask that finds nothing leaves the interrupt to the serial path, which acknowledges with the mask open. An interrupt the local path acknowledged and did not handle, or a stall while it waited for the gate to open, leaves it to the serial path, which handles an accepted interrupt even after a stall.

Timer ownership. A thread's timer fields (TIMER_DEADLINE to TIMER_HEIGHT) belong, while it is armed, to the core whose tree holds it (TIMER_HEIGHT >> 8), and while it is disarmed to its affinity. A thread can be armed in another core's tree: TCB_SetTimer under the gate arms it in the caller's core's, and migration leaves it where it is. Beside the gate only the owner writes them, and no local path moves them to another core: TCB_SetTimer arms a thread of this core in this core's tree, after finding it there or disarmed (in_core_timer_tree, a bounded search that reads only nodes of this core's tree, never the target's links unless it is one), and the interrupt fires only a thread of this core from this core's tree.

What a local path may write, its footprint, is:

  • this core's node state, and threads and scheduling contexts on this core (checked before any write), with the IPC buffers of those threads;
  • the timer links (TIMER_LEFT to TIMER_HEIGHT) of the threads in this core's timer tree, which may be other cores' threads;
  • the objects it locks: the endpoint, notification and reply object involved, which threads on several cores may share, and the queue links (EP_NEXT, EP_PREV) of the threads queued on a locked endpoint or waiting notification, which belong to its queue;
  • the I/O port, for an I/O port access; the timer interrupt's end, for the timer interrupt.

Not in it, of a thread on this core: its queue links while it is blocked on an endpoint or notification (they are that object's queue's, written only with it locked), and its timer fields while it is armed in another core's tree (that core's, by timer ownership). TCB_SetTimer locks the CSpace slots it reads and writes none.

Every other kernel word it reads changes only under the gate, which the core's active mark keeps out. The locks are fl4_store::lock: a 4,096-entry table of lock words, one per cache line, indexed by a hash of the object's address so that neighbouring objects (a guest's per-vCPU endpoints) use different ones; taken with a CAS, never waited for. A local path that cannot take them, or declines, leaves the entry to the gate, having written only FAULT_IP and the timestamp, which the general path repeats (with one domain, two timestamp updates equal the later one). A reply object taken beside the gate must have no neighbours on a call stack: reply_remove would write them unlocked. IPC buffers are user memory: a frame two threads on different cores share is the user's race, as on one core.

Admission: only trapped syscalls, ReplyRecv, I/O port invocations, frame-cap invocations and TCB_SetTimer (by their label, a register) try a local path, and of the interrupts the kernel timer's. While the gate is closed, a core waits for it to open (servicing remote calls) rather than take a ticket, since queued syscalls would keep it closed for each other; but only if its last such syscall ran a fast path, beside the gate or under it (or was an I/O port access), and for at most LOCAL_WAIT_US (500 µs by the kernel clock; the simulator counts LOCAL_WAIT_SPINS spins), since serial entries queued back to back keep the gate closed and the core would wait out of FIFO order. A spin bound would make the wait depend on what a spin costs: on AArch64, where 1024 yield spins took a few microseconds, local paths timed out into the queue, which kept the gate closed for the next ones, and 32 or more busy cores ran nearly every guest syscall serially. One whose fast path then declined would have waited for the gate twice, which cost fork-heavy loads up to 11%. A TCB_SetTimer or timer interrupt that declined beside the gate does not wait next time (the general path has no fast path for them); one that found the gate closed does. Both kernels use the local paths; AArch64 has no I/O ports. On AArch64 the timer's local path is for native threads (a thread with a bound VCPU, or running one, takes the serial path).

Checking a local path

A local path needs three things, the obligations of P2 (§9):

  1. Refinement. When it runs, it ends in the state the general path would: local s = (true, s') → handle_syscall_general s = s' (handle_interrupt_entry for the timer interrupt). fl4-sim --fastpath-diff runs every other serial syscall, and every timer interrupt, through the local path, undoes it from a store log, runs the general path, and compares every word and the simulated machine. The timer paths (fl4_core::localtimer) are written to make this near trivial: checks with reads only, then the general path's own functions in its order. One that declines has written only FAULT_IP and the timestamp, which the general path repeats.
  2. Footprint. It writes only its footprint. The simulator's footprint oracle (§10) checks every word each local path writes, serially and concurrently.
  3. Commutation. Local paths with disjoint footprints commute, and no serial entry overlaps one. Shown once for the runtime: the locks make footprints of different cores disjoint, and the gate handshake excludes serial entries. The simulator runs local paths on every core at once under the random, PCT and x86-TSO schedulers, with mutants of the handshake and the locks.

What runs where

Operation Where Written
l4h guest syscall (fault to the vCPU's handler) local faulting thread, handler, endpoint and its queue links, reply object, core's scheduler state, handler's IPC buffer
l4h handler ReplyRecv local handler, faulting thread, reply object, endpoint, SCs on the core, core's scheduler state
I/O port access local caller, core's scheduler state, the port
TCB_SetTimer on a thread of this core, disarmed or armed in this core's tree local caller, target, timer links of this core's tree, core's scheduler state
Kernel timer interrupt: round-robin budget expiry, one due timer of a thread of this core, or neither local current and woken threads, SCs on the core, timer links of this core's tree, the notification, endpoint and its queue links, and reply object, core's scheduler state, the interrupt's end
Everything else gate anything

The CDT stays seL4's doubly linked list in derivation order, so the "is this the final cap" check and inserts only need the slot and its two neighbors. With MCS, IPC uses reply objects instead of reply caps, so the IPC path never touches the CDT. This is one of the main reasons FL4 builds on MCS. Shared CSpaces stay fast because CSpace walks only read slots: sel4test threads share one CSpace, and every invocation reads slots in it.

Ownership of running threads

A TCB whose thread is running on core C has its register context owned by C. C saves and restores that context outside the gate. A remote operation that changes it, such as TCB_WriteRegisters or suspend, runs under the serial gate and stalls C with an IPI first, like seL4's remoteTCBStall, so C is not running the thread when it changes. A signal to a notification bound to a thread in RunningVM on C changes nothing of the thread on x86: it only has to reach the check of bound signals that precedes every VM entry, so C gets a reschedule IPI and is not stalled. C makes that check under the gate, which it takes only after the signaller releases it, and an IPI that arrives between the check and VMRUN or VMLAUNCH exits the guest at once (KVM's kvm_vcpu_kick). The stall would hold the gate for a guest exit on C, which under nesting is itself an exit to the host. AArch64 still stalls, as the VCPU's caller must stop too. Under a hypervisor and outside a CVM (smp::idle_polls), an idle core polls for up to 100 µs, with an interrupt window and the buffer clearing a halt has each round, before it halts, as Linux's haltpoll does: there a halt and the wakeup from it are exits. On bare metal it halts at once. When the kernel finds only one core, the serial gate, local paths and IPIs are skipped behind a flag set at boot, which keeps uniprocessor IPC free of atomic operations.

8. SMP and MCS semantics

FL4 follows seL4 17.0 MCS+SMP behavior exactly. The design points that matter for locking:

  • Each core has its own SchedControl cap, ready queues with priority bitmap, release queue and timer. A thread runs on the core of its bound scheduling context.
  • When a client donates its SC to a passive server on Call, the server runs on the client's core. Migration changes both cores' scheduler state under the serial gate.
  • Budget accounting reads the per-core TSC and updates only the current SC, which is in the timer path's footprint. The refill algorithm (src/kernel/sporadic.c) is ported directly and verified on its own: refill invariants are some of the first Lean proofs.
  • Cross-core wakeups update the target core's queues under the serial gate and send the reschedule IPI. A local path wakes only threads on its own core.
  • The domain scheduler keeps seL4's global schedule. Changes go through the serial gate.

9. Proof plan

The proof is staged so each level is useful by itself and later levels build on earlier ones.

Level Statement Scope
P0 Every extracted function terminates without failure (no panic, overflow or out-of-bounds) when the invariants hold. Complete for both extractions (the status files proofs/Fl4Proofs/P0/status.json and proofs/Fl4ProofsA64/P0/status.json): x86_64 1,078 of 1,078 functions, 18 proved by hand; AArch64 1,074 of 1,074, 27 by hand. Both assume Store and Arch total (P0/Totality.lean). CI fails if an x86_64 one is left (FL4_P0_STRICT) All of fl4-core
P1 Each kernel entry preserves the invariants: well-typed heap, object alignment and non-overlap, CDT well-formed (including subframe aliases), queues consistent with thread states, refill invariants, deadline-timer trees, untyped bookkeeping All of fl4-core
P2 Local-path soundness (§7): each local path refines the general path (local s = (true, s') → handle_syscall_general s = s') and writes only its footprint (a frame lemma: states that agree on the footprint give results that agree on it, and nothing outside it changes); and, once for the runtime, local paths with disjoint footprints commute and no serial entry overlaps one, so every execution equals some serial order Per local path (refinement, frame); once for the gate and the locks (commutation)
P3 Functional refinement: every kernel entry refines the abstract spec One subsystem at a time: CSpace, then IPC and notifications, scheduler and MCS, untyped, VSpace
P3x Conservative extension: on any state reachable by seL4 calls alone, every seL4 call behaves exactly as in the ported seL4 spec Proven once for the spec, then again for each extension that touches shared state
P4 Integrity, then confidentiality After P3

Status

  • P0: complete, assuming the Store and Arch implementations total (P0/Totality.lean, in TRUSTED). The counts are the status files', as of their last generation: x86_64 1,078 functions, 18 by hand (proofs/Fl4Proofs/P0/status.json); the AArch64 build 1,074, 27 by hand (proofs/Fl4ProofsA64/P0/status.json). cargo xtask gate (CI, with FL4_P0_STRICT) re-extracts and checks only x86_64; the AArch64 tree is extracted and built on its own (cargo xtask extract --arch aarch64, xtask/scripts/gen_p0.py proofs --arch aarch64, lake build Fl4ProofsA64). P1 and P3 are about the x86_64 build only, one serial entry at a time; the existing P2 theorem is about the removed transactional runtime, so the current serial gate and local paths (SMP on both architectures) have no proof yet.
  • P1, in proofs/Fl4Proofs/P1, over a LawfulStore (a total store with read-after-write laws and a model instance):
    • The invariants: refill rings (structure, ordering, no-overflow, window); thread queues refining list operations, with priority and time ordering; the combined scheduler-queue invariant (exact queued flags, located membership, ready and release queues exclusive); endpoint and notification queues consistent with thread states; bound SCs (BoundInv, SCsOK); reply, SC and notification-binding objects; the deadline-timer trees. Together they form BlkOK/EntryInv.
    • kernel_entry.entry: native syscalls (excluding VMEnter) and interrupt entries preserve EntryInv, under EntryHyps. Still assumed there: IPC transfer, the composite handle_invocation (its per-family pieces are proved), handle_fault, debug_syscall, activate_thread, and three placement facts P3 supplies.
    • Write footprints and frames for the native operations used by P3: cap-slot writes, installs, delete and finalisation, and VSpace operations. The native thread-finalisation leaf requires an unbound VCPU link. None of them breaks the invariant, and finalisation writes no cap slot.
    • The two conditions seL4's C code relies on without checking are P1 invariants, kept by every kernel entry: the current thread has an SC when switch_sched_context runs (BoundInv.resume, l4v active_sc_tcb_at), and a thread blocked on reply has a reply object (ReplyInv0.reply).
    • Typed-heap layout, object alignment and non-overlap appear as hypotheses (the sets P1 is parameterised by). CDT and untyped invariants are proved in P3 (MdbOK), not yet as P1 invariants.
  • P2: not started. The transaction-soundness theorem it replaces (proofs/Fl4Proofs/P2/Runtime.lean, sound and snapshot) is complete, but about the transactional runtime removed on 2026-11-21 (§7); the Lean tree still builds it.
  • P3, in proofs/Fl4Proofs/P3, against Fl4Spec (the l4v rt abstract spec ported to Lean, up to call_kernel; KernelInit_A is dead in l4v and left out). The top-level theorem handle_invocation_refinesM relates the decode and invocation of each capability to the spec, from per-capability results and named hypotheses, and carries the CDT invariant MdbOK (frame invariant, untyped bookkeeping, no overlap) through a per-step relation MdbStep:
    • CSpace: lookups, every CNode invocation, delete and revoke (zombies, preemption), untyped retype and reset, the IRQ and IO port caps.
    • TCBs: native TCB invocations, including cap installs. The dispatcher excludes the new SetEPTRoot label.
    • Scheduling contexts (MCS): SchedContext and SchedControl, budget checks, set_priority, and binding and unbinding SCs.
    • VSpace: native frames and page tables, native-root ASID assignment, ASID pools and control, DeriveSubframe, with the VSpace cap-placement invariant (VsMdbInv). Guest-tagged pool entries stay occupied during allocation and are rejected by native lookup. FrameLabel.native excludes EPT mapping, and ASID-assignment leaves require a native extra cap.
    • Endpoints and notifications: the IPC and signal paths are in progress. The native idle-bound notification leaf excludes a thread running a VM.
    • Hypotheses still to discharge are named in each file. The main ones: the state facts after the TCB fault-handler install, finalisation of a final Endpoint, Notification, Reply, Thread or SchedContext cap on the spec side (FinWorkHyp; FL4's side and the VSpace cases are proved), the reply and fault paths, and the placement link between P3's typed heap and P1's object sets.
    • The proofs so far found no disagreement between FL4 and the spec.

The abstract spec

Decided: we port seL4's Isabelle abstract specification (the MCS version, from l4v/spec/abstract) to Lean 4 as a nondeterministic state monad. It is long but close to a transliteration, and it keeps FL4 tied to the meaning the seL4 proofs have already validated. The semantic port covers the MCS native paths; non-MCS paths and IO page tables remain excluded. The cap and object representations include VCPU/EPT objects, and ASID pools retain guest tags as occupied entries while native lookup rejects them. VMEnter, SetEPTRoot, EPT mapping, guest-root ASID assignment, and the VCPU/EPT invocation families still need their own functional refinement; their extracted core functions are covered by P0. Where FL4 must differ, such as per-core state, the difference is written down in the spec and listed in one place.

  • The port goes subsystem by subsystem in P3 order. Each Lean definition carries a comment naming the Isabelle definition it comes from, so reviewers can compare them side by side.
  • The Lean spec is executable where the Isabelle spec is deterministic. Those parts double as a reference model in the simulator and the differential fuzzer.
  • Extensions go in separate Lean modules on top of the ported spec, never as edits to it. Theorem P3x states that they leave seL4 behavior unchanged, which is the formal form of the superset rule in §2.

From serial to concurrent

The argument

(1) Under the serial gate an entry runs alone on memory, so it is one serial kernel entry, which P0 to P3 are about. (2) A local path that runs ends in the state the general path, a serial entry, would (refinement), and writes only its footprint (frame). (3) The gate holder waits for active local paths and a local path starts only on an open gate (the Dekker handshake of §7), so serial entries and local paths never overlap; two local paths hold disjoint footprints, by their locks and their cores, so they commute. Together, any execution equals running its entries one after another, in the order serial entries take the gate and local paths finish. (1) is P0–P3; (2) and (3) are P2. (4) What is left unproven is that fl4-store, fl4-sync and the IPI paths implement the gate and the locks correctly on real memory. The simulator tests exactly that, and checks (2) on every local path it runs.

Trusted base

The proof assumes: Rust, LLVM and the linker, and the kernels' linker scripts; Charon, Aeneas and the Lean kernel; the abstract spec; entry assembly and boot code; fl4-store and fl4-sync; hardware backends; the totality of Store and Arch (for each extraction); and the processor's memory model. fl4-core's AArch64 slice has P0 only. Everything trusted is listed in one file in the repo, with its size tracked in CI.

10. Deterministic simulation

fl4-sim is a host program that links the real fl4-core and fl4-sync, over simulated memory, with a simulated arch backend. Nothing is mocked above the hardware line.

Execution model

  • Each simulated CPU is a coroutine, and all of them run on one host thread, so switching CPUs is a stack switch, not a host context switch. A seeded scheduler decides which CPU runs at every scheduling point: each atomic operation, lock attempt, IPI send and store access. The same seed always replays the same run.
  • Time is virtual. Each CPU has its own TSC and TSC-deadline timer, so MCS budget overruns, timeouts and refill edge cases can be hit on purpose.
  • Atomics run on a store-buffer model of x86-TSO (fl4-sim --tso). fl4-store and fl4-sync do every atomic operation of the runtime (serial gate, object locks) through the Mem trait. On hardware these are the operations themselves, inlined. In the simulator each core has a FIFO store buffer:
    • The kernel's stores and the runtime's release and relaxed atomic stores go into the buffer.
    • Loads read the core's own newest buffered store first.
    • Locked operations (CAS, fetch-add, SeqCst stores) and SeqCst fences drain the buffer, as does leaving the kernel. Otherwise buffered stores become visible at random points.
    • A mutant that weakens the SeqCst store of a core's "local path active" flag to Release breaks the Dekker handshake between that store and the gate holder's. It passes 100 seeds under sequentially consistent scheduling and fails 4 under TSO.
    • A weak-memory model for AArch64 is future work.
  • User programs are Rust closures that issue seL4 syscalls through the simulated register ABI. Workloads include generated random syscall programs, ports of the SMP-sensitive sel4test cases, and targeted races: revoke during IPC, deleting an endpoint with queued threads on several cores, SC exhaustion during migration, signal racing with a thread being bound to another core.

Oracles

Oracle Catches
Footprint. Every word a local path beside the gate writes lies in its footprint (§7): the core's node state, threads on the core with their IPC buffers (but not the queue links of one blocked on an endpoint or notification, nor the timer fields of one armed in another core's tree), SCs on the core, the timer links of the threads in the core's timer tree, the objects it locked and the queue links of threads queued on a locked endpoint or waiting notification (footprint, computed once the path holds its locks, through local_syscall's and local_timer_irq's observe hook, so nothing it reads can change until the path ends; a local path that writes before that fails). Checked in the serial differential runs and in every concurrent one. The Arch operations no local path may make (remote stalls, TLB and IOAPIC operations, interrupt polling, masking and acknowledgement, reschedule IPIs, FPU state) assert that no local path is running. The exceptions: a frame-cap invocation's local path (fl4_core::localinv): a CNode_Delete that unmaps a page, or an X86Page_Map remap, invalidates the page or the address space itself and shoots the other cores down under CALL_LOCK (fl4-arch-x86_64 smp.rs), and on AArch64 a CNode_Delete or ARMPage_Map remap invalidates the page by a broadcast TLBI, with no remote call; no other local path may invalidate TLB entries, and none may invalidate paging structures; and the timer interrupt's local path, which ends that interrupt and no other. Mutants of fl4_core::localtimer that drop one of its checks fail timer-scenario seeds on this oracle (of 16, with the fast-path check / concurrent / TSO): TCB_SetTimer's target on this core 16/16/16, the target found in this core's tree 14/6/6; the due timer's thread on this core 16/12/12, a second timer not due 16/12/9; the notification locked 16/16/15, the endpoint and reply object of a thread woken from Recv locked 16/16/15. Dropping the check that a woken thread is this core's is not caught, and cannot be: a bound notification's only waiter is its bound thread (handle_recv, bindable_ntfn), the due timer's thread, already checked. It is how the queue links were found to belong to a locked endpoint's footprint. A mutant that skips the check that the receiver is on this core fails 8 of 40 serial and 30 of 60 concurrent guest-scenario seeds, every one on this oracle A local path writing outside its footprint, on the first run that executes it, with no unlucky interleaving needed
Fast paths. --fastpath-diff: every other serial syscall, and every timer interrupt, also runs through its local or fast path from the same state as the general path, and both must leave the same memory and machine state (§6), and make the same Arch calls with effects (clock reads, deadlines, ends of interrupt, address-space loads, reschedule IPIs, port writes, console output) in the same order. An end of interrupt must end the interrupt in service, once. The run counts each local path's attempts and runs (and the timer interrupt's cases), and a campaign prints their totals Fast and local paths that diverge from the general path
Invariants. Executable Rust versions of the P1 invariants, checked after every commit: CDT links, endpoint, notification and release queues (links, tails, owning core), deadline-timer trees (each core's a red-black search tree of threads marked for it, with its earliest as TIMER_MIN; armed threads in their core's tree, disarmed ones in none with their links clear), and refills (ring bounds; for periodic SCs, time order without overlap and a total within the period). The workload gives SCs partial and sporadic budgets so the refill paths run. The release-queue checks found a layout bug: the release queue's tail word was the deadline-timer tree root Corruption, close to where it starts
Liveness. Wait-for graph with cycle detection, bounded retry counts, IPI acknowledgement deadlines. As implemented: every wait (for the serial gate, for local paths to drain, or for a remote stall to be acknowledged) is a counted spin, and a core that spins 2,000,000 times without finishing a kernel entry fails the run. The only blocking waits are those, so a deadlock shows up as such a spin. A run that hangs anyway fails on the per-seed timeout Deadlock, livelock, missed IPIs

Exploration

  • Random walks and PCT (probabilistic concurrency testing) at scale, millions of seeds per night. In PCT (fl4-sim --pct D), the live core with the highest priority runs. Priorities start in random order, and at D−1 random scheduling points the running core drops below the others. A spinning core also drops below the others, because it is waiting for another core. Each step of a run has about 50 scheduling points. PCT preempts rarely, and catches none of the runtime mutants below in 100 seeds, so the random and TSO schedulers remain the main campaigns.
  • Bounded exhaustive search with partial-order reduction for small scenarios of 2 to 3 CPUs and a few syscalls each. These cover the hand-picked races completely.
    • As built (fl4-sim --explore B), the search runs every schedule of a seed's scenario with up to B preemptions. The schedule is a list of scheduling points at which the running core is preempted; otherwise a core runs until it spins or runs out of steps.
    • The reduction: scheduling points are only the runtime's atomic operations (serial gate, object locks). Data accesses happen with the gate held or within a local path's footprint, so their order against another core's matters only at those operations.
    • A two-core, six-entry scenario has 156 to 162 such points, and a schedule takes about 2 ms of CPU, so a bound of 1 runs in well under a second over all CPUs. cargo xtask sim runs four seeds this way.
    • Results so far: it finds none of the mutants below. These scenarios run the plain workload, whose local paths are rare (I/O port accesses), so a serial entry seldom meets one; hand-picked scenarios with the guest pattern are still to do.
  • Mutation testing checks that the simulator can fail: each known-broken runtime must fail seeds in a 100-seed concurrent campaign with an l4h vCPU's syscall pattern on every core. The mutants are test-only Cargo features of fl4-sync: the gate holder does not wait for active local paths (mutant-gate-no-wait), a local path marks its core active without the handshake's store-load order (mutant-gate-release), without marking it at all (mutant-local-no-active), or without locking its objects (mutant-local-no-lock). cargo xtask mutants runs each one under the random, PCT and TSO schedulers in CI, and each must be caught by at least one of them. Current catch rates (random/PCT/TSO): 19/0/40, 40/0/53 and 25/0/28 out of 100 seeds; mutant-gate-release, which only TSO shows and on about 2% of seeds, runs 400 (9 fail). The footprint oracle has no mutant here: one that skips the check that the receiver is on this core, a change to fl4-core, is caught as described under Oracles. A local path that writes the reply objects next to its own on a call stack (the bug Reply.next == 0 guards against) is not caught: the workload builds no such call stack.
  • Failing seeds shrink automatically and become regression tests. A failing run is cut to the shortest prefix of the same seed that still fails, found by bisecting the step count; one mutant's 4000-step failure shrank to 12 steps. --record appends shrunk runs to crates/fl4-sim/regressions, which every campaign replays first.
  • --scenario timer gives every worker a bound notification, a reply object and a core endpoint, and half of them round-robin SCs of 40 to 80 µs: workers arm their own timers and others' (other cores' too, in the past, far ahead, or disarmed), wait for them on the notification or in Recv, poll and send, while the root task moves workers to other cores with their timers armed, binds notifications again and deletes one, so the timer interrupt's local path meets each of its cases on running and idle cores. The guest scenario's handlers arm their own timers, which wake them in ReplyRecv.
  • cargo xtask sim runs every campaign above (100 seeds each of random, PCT and TSO; 25 each of the endpoint and notification races under random and TSO; 25 each of the guest scenario with the fast-path check, of the plain workload with it, and of the guest scenario under random, PCT and TSO; 25 each of the timer scenario with the fast-path check and under random, PCT and TSO; and the four bounded searches) in about 3.5 seconds on 16 host CPUs. Where the time went before, when it took over 25 minutes:
    • Simulated CPUs were host threads handing a baton through a condition variable, about 10 million host context switches for one endpoint-race run.
    • Each run booted again: boot reads all of free memory (l4h 0019), 36 ms. Boot now uses a fixed seed. A campaign boots once and forks a child per run from the booted state, with one child per host CPU at a time, and the seed's RNG starts after boot.
    • The capability and refill oracles scanned the whole 8,192-slot root CNode after every entry. They now check only slots written since the last check, slots that were not empty and unlinked then, and every slot of a CNode or TCB that is new to them. Any other slot is unchanged since a check found it empty and unlinked.
    • Store forwarding searched the whole store buffer, which an untyped reset fills with a thousand stores.
  • For bugs seen only in QEMU, QEMU record and replay reproduces the full-system run. The simulator remains the main tool.

11. x86_64 now, AArch64 later (future work)

x86_64 backend

  • Multiboot 1 and 2 entry, so QEMU -kernel with the rootserver as a module works the way the seL4 x86 build does. APs start with INIT-SIPI-SIPI.
  • SYSCALL/SYSRET, per-core GS-based kernel state, SMEP and SMAP, PCID, and the optional kernel skim window (seL4's KPTI-style mitigation). A thread whose context SYSCALL saved leaves by SYSRET (Error = −1, as in seL4), and only when its return address is in the canonical lower half, so SYSRET never faults in ring 0 with the user's RSP loaded, and only while RCX and R11 still equal NextIP and FLAGS and FLAGS has neither TF nor RF (as in Linux), so a fault reply or a thread's own register copy is not overwritten and single-stepping traps after the first user instruction. Every other exit uses IRET. NMI, #DB, #MC and #DF run on per-core IST stacks, because the instructions just after SYSCALL and just before SYSRET run in ring 0 on the user's stack pointer.
  • PCIDs, when the CPU has them, are a per-core cache of ASIDs: ASIDs have 20 bits and PCIDs 12. Each core has a direct-mapped table of 512 PCIDs, indexed by a hash of the ASID that gives the ASIDs of one pool distinct entries. An entry holds the ASID it last ran and that ASID's invalidation generation. Invalidating an ASID bumps a generation in a global table of 4096 words, which ASIDs share by hash, and shoots down the cores running it. A core flushes a PCID when it takes it for another ASID, or when the generation moved. Sharing a generation costs only extra flushes. Memory is 32 KiB global plus 8 KiB per core, whatever the number of ASIDs; seL4 instead uses the ASID as the PCID. The test host has no PCIDs (§12), so this path is covered by host unit tests of the table, not by sel4test.
  • x2APIC or xAPIC, chosen at boot (§3). In xAPIC mode IPIs use physical destination mode, so more than 8 cores can be addressed.
  • MCS timer: TSC-deadline mode when CPUID reports it, otherwise the LAPIC one-shot timer with a TSC-to-APIC ratio calibrated at boot. seL4 has the same fallback in apic.c. Both are first-class paths, and the test setups in §12 exercise each one.
  • IOAPIC and MSI routing, ACPI MADT parsing, IO port caps.
  • The PIT is used only for calibration, on channel 2. Channel 0 is put in one-shot mode at boot, because firmware leaves it interrupting at 18.2 Hz on ISA IRQ 0, which is IOAPIC pin 2, where user space may route an HPET timer.
  • XSAVE-family FPU switching, chosen at boot like the other mitigations (§3). On Intel CPUs it is eager: the incoming thread's state is loaded on every switch, because lazy switching is what LazyFP (CVE-2018-3665) exploits. On CPUs LazyFP does not affect (AMD) it is lazy, as in seL4. A thread that doesn't own the FPU registers runs with CR0.TS set. Its first FPU instruction raises #NM, and the entry glue swaps the state and returns to the thread without entering the core. fl4test FL4FPU0003 checks that two threads keep their own registers across IPC; it fails on a mutant that leaves TS clear. A thread that keeps using the FPU would pay a trap and two CR0 writes per switch, more than the eager switch costs (CR0 writes are slow under KVM). So each thread counts its #NM traps in a byte after its FPU image. From the third trap on it is switched eagerly; the byte keeps counting and wraps, so after 256 switches the thread is tried lazily again (Linux once did the same with fpu_counter). Guest execution uses the bound TCB's FPU image and switches a validated guest XCR0 around each VM entry.

IOMMU left to user space

FL4 has no IO page table objects and no IOSpace caps. The kernel never programs the IOMMU.

  • The kernel parses the ACPI DMAR (Intel) or IVRS (AMD) table only to find the IOMMU's MMIO registers. It does not reserve them, so they show up in BootInfo as ordinary device untypeds, and the root task can hand them to an IOMMU driver.
  • User space finds the DMAR or IVRS table through the ACPI RSDP that seL4 already passes in BootInfo, so no new interface is needed.
  • The kernel leaves the IOMMU in whatever state firmware set. A driver that enables translation has to map anything devices need, which is its job.
  • The consequence is that DMA isolation now depends on the user-space driver, and devices can reach kernel memory until that driver turns translation on. This is a deliberate trade, and the trusted-base list records it.
  • sel4test's IO page table tests are compiled only when CONFIG_IOMMU is set, so the suite runs unchanged without them.

Keeping AArch64 cheap

  • Arch covers register context, fault decoding, page-table formats as associated types, TLB and cache maintenance, and IRQ controller access. fl4-core never names an x86 type.
  • Arch-specific kernel objects (page tables, ASID pools, IO ports) are an enum in fl4-core selected by cfg, with verified logic per architecture. Their invariants are written against the Arch trait.
  • fl4-sync uses only acquire/release orderings plus explicit fences. Nothing relies on x86-TSO, and the simulator's weak-memory mode checks that.
  • The AArch64 fixes from l4h are requirements of the port: broadcast TLB invalidation, 16-bit ASIDs, CNTFRQ for MCS accounting, the ID-register BootInfo record, and x8 in trapped-syscall faults (§4).
  • The AArch64 placeholder crate compiles in CI from M0, so the trait boundary cannot quietly pick up x86 assumptions.

12. sel4test and CI

sel4test finds the kernel through find_package(seL4) in its kernel/ directory and builds libsel4 and the kernel image from there. FL4 ships a drop-in replacement in cmake/:

  • It reuses upstream seL4's CMake configuration from vendor/seL4, so sel4test's settings work unchanged, but builds libsel4 from FL4's libsel4/ and generators instead of upstream's.
  • It replaces only the kernel.elf target with a cargo build that reads the generated configuration and checks it against §3.
  • sel4test runs with SIMULATION=OFF, because its SIMULATION mode turns on KernelIOMMU for x86. With SIMULATION off, a debug build also turns on the hardware debug API, so FL4 implements breakpoints and single-step in the debug profile. KVM passes debug registers through to the guest.
  • FL4's extensions get their own suite, fl4test, built on the same test framework and run in the same QEMU setups. It covers every extension and fix taken from l4h. sel4test itself stays unmodified: fl4test/fl4test.c is linked into sel4test's test application, its tests are named FL4…, sel4test runs filter them out and cargo xtask fl4test runs only them.
  • l4h user space, rebuilt against FL4's libsel4, runs under QEMU/KVM as a second compatibility check. Parts that depend on multikernel boot are skipped.
  • xtask sel4test links the checkout at ~/Projects/sel4test with this kernel directory, builds, runs under QEMU and parses the test summary. sel4test has 228 test definitions. Each one is tracked separately so progress is visible.

Test machine

FL4 is never booted on the development machine's hardware. Every kernel run happens inside a QEMU/KVM guest on that machine, driven locally by xtask. Hosted CI can come later with the same commands.

CPU AMD Ryzen 7 7700 (Zen 4), 8 cores, 16 threads
Memory 61 GiB
Virtualisation KVM (AMD-V), /dev/kvm usable by the build user
QEMU 10.0.13
Relevant features Has invpcid, smep, smap, xsaves, fsgsbase, automatic IBRS, 1 GiB pages, invariant TSC. No PCIDs (neither has TCG), so FL4's PCID paths are not exercised here; no TSC-deadline timer. x2APIC is not exposed to the host. AMD-Vi IOMMU present.

KVM emulates both x2APIC and the TSC-deadline timer for guests, even though this host CPU lacks both. Masking them in the guest CPU model covers the fallback paths that real CPUs without those features would take. So sel4test runs in three QEMU setups:

Setup QEMU options Purpose
KVM, full features -enable-kvm -machine kernel-irqchip=split -cpu host Fast main loop; x2APIC and TSC-deadline paths. Same kernel image in every setup
KVM, reduced features -enable-kvm -machine kernel-irqchip=split -cpu host,-x2apic,-tsc-deadline,-pcid,-invpcid,-fsgsbase,-xsaves,-xsavec xAPIC, the calibrated one-shot timer, no PCIDs, the FS/GS MSRs and XSAVEOPT
TCG -accel tcg, record and replay when needed An independent CPU and device model, for failures seen under KVM
TCG, Intel model -accel tcg -cpu Skylake-Client-v1 A Meltdown-affected CPU: the skim window paths

The KVM setups keep the IOAPIC in QEMU (kernel-irqchip=split). With KVM's in-kernel IOAPIC, QEMU routes GSI 0 (the PIT) to pin 2 and gives GSI 2 no route. sel4test's timer driver puts the HPET on pin 2, so its interrupts never arrive. That was the cause of SCHED0000 failing ("flaky") and INTERRUPT0005 hanging under KVM: the driver ran only on stray PIT interrupts every 55 ms instead of its own 10 ms ones. Since the change no sel4test test is skipped. Three tests measure wall-clock scheduling and depend on the host: SCHED0011, SCHED0014 and TIMEOUTFAULT0001. With 4 cores in kvm-reduced, SCHED0014 failed 20 runs out of 20 on upstream seL4 (FL4_KERNEL=sel4, the same tests on vendor/seL4) and 5 out of 20 on FL4, on a host with load 5 to 7. Upstream already disables the test under simulation. When a run's only failures are among these three, xtask reruns them alone up to three times and says so in the log. Any other failure fails the run. Under -icount, QEMU 10.0 currently stops with "Bad icount read" during boot, so the TCG setup runs without it until that is resolved.

cargo xtask uefi boots the same kernel and sel4test's driver through GRUB's Multiboot 2 loader on OVMF (UEFI) under KVM, and checks that the kernel finds ACPI from the RSDP the bootloader passes, starts every core and starts the root task. UEFI firmware keeps its ACPI tables outside the BIOS areas the legacy search covers (GitHub issue #8). sel4test's driver stops there on any kernel: its timer set-up looks for the RSDP in the BIOS areas from user space, not in BootInfo.

Performance numbers come from KVM with pinned vCPUs and are labelled that way. They are compared with upstream seL4 measured in the same setup, never with bare-metal figures.

Test matrix

Job Configurations When
sel4test on QEMU x86_64 MCS × {1, 2, 4 cores} × {debug, release} × the first two setups above Every PR
Extract and check proofs Charon → Aeneas → lake build Every PR
Simulation, short 10⁴ seeds plus all regression seeds Every PR
Simulation, long Millions of seeds, PCT, exhaustive small scenarios, TSO and weak modes Nightly
Differential fuzzing against seL4 Same generated programs on seL4 and FL4, compare traces (cargo xtask fuzz, fl4test/fuzz.c) Nightly
Performance sel4bench IPC and signal latency; multi-core scaling on independent endpoints; FL4 and seL4 both under KVM Nightly, tracked over time

Performance targets: uniprocessor IPC within 1.2× of seL4 built with KernelFastpath off (seL4 with its fastpath is also measured and reported, for reference), and near-linear throughput scaling for independent IPC pairs where seL4's big lock stays flat. The machine has 8 physical cores, so scaling is measured up to 8 vCPUs pinned one per physical core.

The baseline seL4 must have the same mitigations as FL4 on the test CPU. seL4's x86_64 default turns on KernelSkimWindow, which switches CR3 on every entry and exit. FL4 turns the skim window on only where the CPU needs it (§3). The development machine (AMD Zen 4) doesn't, so cargo xtask bench sel4 builds seL4 with KernelSkimWindow=OFF (and KernelSupportPCID=OFF, KernelFSGSBase=msr). Measured on that machine (cycles, medians, cargo xtask bench, one pinned vCPU):

IPC seL4, skim on (default) seL4, skim off FL4 before FL4, SYSRET exit and LTO FL4, also lazy FPU
Call, same address space 1026 494 950–988 836 684–722
ReplyRecv, same 1064–1102 494–513 1102 1026 874
Call, cross address space 1026 798–817 1216–1254 1064 912–950
ReplyRecv, cross 1064–1102 798–836 1349–1368 1254 1102

Against the like-for-like baseline FL4 is now at 1.14–1.7×. Cross-address-space Call is the closest; same-address-space Call and ReplyRecv are the furthest. That is not yet 1.2×. Instrumentation (TSC and retired-instruction counts at stage boundaries) shows where the rest goes:

  • About 1800 kernel instructions per Call or ReplyRecv. The capability lookup takes about 200 and the extra-caps lookup about 200 even with no extra caps; budget charging takes about 85, scheduling 90–210, and the exit path about 150.
  • Eager FPU switching cost about 130 cycles per switch between threads, for XSAVES and XRSTORS, because the owner changes on every IPC round trip. Lazy switching on CPUs without LazyFP (§11) removed it: on this machine, Call went from 836 to 722 cycles (same address space) and from 1064 to 950 (cross).
  • One CR3 write plus the TLB refill after it costs about 280 cycles. That is the whole cross-address-space difference; this CPU has no PCIDs.

sel4bench's signal benchmark (-DSIGNAL=ON) currently fails in the same way on both kernels: its child thread dies with an invalid instruction. It is a setup problem in the benchmark build, so cargo xtask bench runs the IPC benchmarks only. Counting retired kernel instructions per Call or ReplyRecv the same way in both kernels (PMC0 in kernel mode, read at entry and exit; a temporary patch) gives about 580–990 for seL4 and 1550–1990 for FL4, so FL4's path is 2–2.7× longer in instructions. Closing the gap is M5 work on the general path in fl4-core: fewer capability decodes and encodes, repeated loads of the current thread and its fields, and the many small helper calls of a direct transliteration.

The differential fuzzer (cargo xtask fuzz) builds fl4test/fuzz.c against upstream seL4 and against FL4 and runs both in the KVM setup.

  • Each of 40 seeds generates a program of 400 calls. It runs in a thread whose CSpace is a fresh 256-slot CNode holding only that CNode and a private 64 KiB untyped. Capability pointers are therefore slot numbers, and nothing depends on the root task's memory layout.
  • The calls are retypes of endpoints, notifications, replies, CNodes, untypeds and scheduling contexts; CNode Copy, Mint, Move, Mutate, Delete, Revoke, Rotate and CancelBadgedSends; and non-blocking sends.
  • The trace records each call's arguments, its error, the message registers a failure returns, and the types of the capabilities in the slots it touched (seL4_DebugCapIdentify).
  • The first run gave 16,000 identical trace lines. Every call kind both succeeded and failed in several ways: success, InvalidCapability, FailedLookup, DeleteFirst, IllegalOperation, RangeError, NotEnoughMemory.
  • Left out for now:
    • Receives. A receive through a capability without the Read right is a capability fault, which the program would need a fault handler to survive.
    • TCB and frame objects, whose sizes differ between the kernels.

Multi-core scaling is measured by fl4test's FL4PERF0002 (fl4test/perf.c). It uses only the seL4 API, so it also runs on upstream seL4 with FL4_KERNEL=sel4. It runs k independent client/server pairs, pair i on core i, for k = 1 to the number of cores, and prints round trips per million TSC ticks. These are debug builds with 8 unpinned vCPUs on a host shared with other VMs, so expect noise:

Pairs 1 2 3 4 5 6 7 8
seL4 96 112 109 109 108 83 65 78
FL4 186 325 347 318 742 861 706 279

seL4 stays flat behind its kernel lock. FL4 reaches 4.6× at 6 pairs, but not smoothly. The transaction log (fl4_store::tx::conflicts, printed with the debug statistics) shows why: most aborts come from small objects of different pairs sharing a 64-byte stripe. Endpoints are 16 bytes and reply objects 32, both fixed by the seL4 API, and allocators place them next to each other.

Two experiments with 16-byte stripes failed:

  • A hashed table of 16384 entries made the curve smooth (159 to 757, 4.8×) but raised the abort rate to about 15%, through hash collisions.
  • An adjacency-preserving table raised serial entries tenfold.

FL4_PIN=c0,c1,... pins each vCPU thread to a host CPU; xtask gets the thread IDs from QEMU over QMP. Until the kbench work it also pinned a bogus "thread 0" (the SMT thread number in each CPU's QMP props), which shifted the list so that two vCPUs shared one host CPU. That, not the host, explains an earlier pinned run in which both kernels slowed down more than 20× from 5 pairs on.

The SMP measurements below up to 2026-11-21 ran the transactional runtime, removed then (§7): the probes, stripes, conflict logs and transaction counts they mention no longer exist. They stay as the record of why.

Kernel-intensive SMP throughput (cargo xtask kbench, fl4test FL4PERF0003). k workers on k cores, k = 1, 2, 4, 6, each repeat one kernel operation on objects of their own for a fixed window of 10⁸ TSC ticks:

  • yield: seL4_Yield.
  • signal: Signal plus Wait on the worker's own notification.
  • ipc: Call to a server on the same core.
  • xipc: Call to a server on the next core.
  • cap: CNode Copy plus Delete.
  • retype: Untyped Retype of an endpoint plus Delete, which resets the untyped.
  • map: Page Unmap plus Map of a 4 KiB frame in the one shared address space.

Both kernels are release builds, seL4 with the skim window off as in the uniprocessor comparison. There are 6 vCPUs under KVM, pinned to host cores 2–7, on a host shared with another project's 8-vCPU VM. The table gives the median of 3 alternating rounds, in operations per million TSC ticks summed over all cores; a whole kbench takes about 15 s. The spread between rounds is mostly within ±10%, and 2-core runs vary more (up to ±30%).

Workload Kernel 1 core 2 4 6
yield FL4 643 1151 2009 3020
seL4 274 238 236 221
signal FL4 622 1021 1731 2467
seL4 1962 1550 1341 1301
ipc FL4 182 341 577 854
seL4 113 105 104 101
xipc FL4 – 69 122 159
seL4 – 30 30 26
cap FL4 360 626 994 1322
seL4 1340 1094 1023 1015
retype FL4 208 366 735 706
seL4 946 684 669 665
map FL4 346 171 76 55
seL4 7 7 7 7

What the table shows:

  • seL4 does not scale. Its throughput is flat or falls with cores, as its big kernel lock predicts.
  • FL4 scales on independent objects. From 1 to 6 cores: yield 4.7×, ipc 4.7×, signal 4.0×, cap 3.7×.
  • retype scales 3.4×. The untyped reset clears free memory in place inside the transaction (§7). Before that, the 4 KiB clear overflowed the write buffer, and every reset reran under the serial gate. Retype then measured 268, 352, 425 and 430, levelling off at 1.6×. Locking and validating the region costs a single core about a fifth of its throughput (268 to 208).
  • map gets slower with more workers. All workers share one address space, so every unmap shoots down every other worker's core.
  • FL4 costs more per operation on the multi-core build. On one core it is about 3.5× slower than seL4 for signal, cap and retype. Not yet measured: whether that is transaction bookkeeping or the gate. The crossover is at about 4 cores for signal and cap, and at about 6 for retype.
  • seL4 is slow on yield and ipc, likely because of timer writes under KVM. seL4's yield and same-core IPC take 3,600 and 8,800 ticks. A likely cause, not yet confirmed, is MCS reprogramming the timer on each scheduling-context switch, which is a VM exit under KVM.
  • seL4's map is about 50× FL4's on one core. seL4 shoots down every core that has run the address space, even idle ones, which KVM must wake. FL4 interrupts only the cores currently running the ASID (§3).

SMP transaction performance (issue #11). The runtime avoids transaction bookkeeping on quiet entries and reduces false conflicts between small objects under parallel Linux workloads. The current measurements and validation are summarized below; the core and its proof definitions are unchanged.

The retained changes are opportunistic serial admission with contention backoff, per-entry store specialization, finer version stripes, and ordered bulk clears. The write log retains its locality hash: an isolated ablation recovered most of the SMP syscall/IPC loss from removing both word-log tweaks. The extra lookup shortcut was dropped. Removing ordered clears substantially hurt SMP retype throughput, so that optimization stays. The tests focus on gate exclusion/backoff, queued ticket ordering and IPI servicing, and clear bounds/validation/version restoration. Existing concurrent store tests, simulation and mutation campaigns supply broader coverage.

Fresh comparison on the issue's Ryzen 7 7700/KVM setup, three boots per cell: PR base 46b3cb6, pre-cleanup PR af5fa2b, cleaned code 10ba06e, and seL4. Six vCPUs are pinned to physical cores 2–7; emulator threads use 0–1. Linux 6.18.63, initramfs, workload, per-backend l4h root tasks and mitigation settings are held fixed. Linux runs one warmup suite before each measured suite. No builds or benchmarks overlap.

Median Linux getpid throughput, million calls/s:

Linux vCPUs PR base Before cleanup Cleaned PR Patched seL4
1 0.527 1.344 1.355 1.070
2 0.617 1.409 1.339 1.313
4 0.821 1.775 1.727 1.283

Other four-vCPU Linux results; throughput higher is better, latency lower:

Workload PR base Before cleanup Cleaned PR Patched seL4
4 KiB faults/s 569,983 633,892 687,635 665,454
Fork / exit / wait cycles/s 9,624 11,463 11,125 12,014
Cross-core pipe (µs) 15.532 11.975 11.763 10.944
Cross-core futex (µs) 8.802 6.375 5.485 6.473

Primitive latency, µs, from 15 measured batches per metric. The primary probe has one active core on the six-vCPU machine. Split timings include instrumentation and are not additive:

Primitive PR base Before cleanup Cleaned PR Patched seL4
Fault/ReplyRecv, separate VSpaces, live FPU 1.5522 0.5740 0.5627 0.6088
Syscall-fault delivery, split probe 0.7789 0.2645 0.2638 0.3066
ReplyRecv resume, split probe 0.7940 0.3359 0.3257 0.3302

Kernel SMP throughput, aggregate operations per million TSC ticks:

Workload Workers PR base Before cleanup Cleaned PR Upstream seL4
ipc 6 737 995 965 107
cap 6 1,711 1,355 1,317 1,057
retype 2 278 326 327 785
retype 4 567 585 601 753
retype 6 653 941 926 735

Cleanup changes four-vCPU syscall throughput by -2.7% and six-worker IPC/retype by -3.0% / -1.6% versus the preceding PR. Performance is not uniform: the cleaned four-vCPU same-core pipe latency is 7.671 µs versus seL4's 6.881 µs, and two-vCPU fork throughput is 6,454/s versus 10,143/s. The transaction metadata reserves 3.30 MiB more BSS than the PR base. Kernel throughput uses upstream seL4 c98d70a; Linux and primitive probes use l4h-patched seL4 62e345c. This is one KVM host with pinned but non-isolated cores and boost enabled, not bare-metal or application-wide parity.

Validation: host tests, trusted-base check, 200-seed simulation (including TSO, PCT and bounded exploration), all runtime mutants, and the strict extraction/Lean gate passed. Four-core release KVM passed 192 sel4tests and 26 fl4tests; reduced-feature debug KVM passed 26 fl4tests on four cores and 193 sel4tests on one. All 60 comparison boots passed.

Raw measurements retain all measured and emitted warmup samples, image hashes, revisions and run order; no measured samples were discarded. Runtime implementation remains trusted and tested; this adds no proof assumptions or operation-specific lock paths.

Capability transaction follow-up (base 6ba3aa0). The fork investigation in issue #11 attributes most two-vCPU kernel-entry time to Copy, Delete and Page_Map. The candidate changes in §7 remove repeated capability loads and metadata writes, and validate the two words of a capability together when they share a stripe. Separate release images retain the first change alone and both changes, so their effects can be measured independently.

Two comparison campaigns completed 156 benchmark boots at task nice -20; the second also used a dedicated CPU group at weight 10000 (reported as group nice -20). Other builds continued. In that second campaign, two-core Copy/Delete/Page_Map raw median latencies changed from 0.466/0.442/0.407 µs to 0.441/0.427/0.393 µs, reductions of 5.4%/3.6%/3.5%. Medians of the ratios to adjacent seL4 controls improved by 2.1%/0.8%/1.5%, so some of the raw change reflects host conditions. The direct batched workload's aggregate throughput rose 4.3% at two workers and 11.3% at four. These are medians of three boot medians, with five measured batches per boot.

Linux fork throughput is still inconclusive under load. With five boots per cell, the raw two-vCPU change was +5.3% in the task-priority-only campaign and +36.9% in the dedicated-group campaign; four-vCPU changes were +11.4% and -6.1%. Single-vCPU medians fell 10.9% and 2.1%. All samples are retained. These changing results do not establish an end-to-end fork gain or exclude a regression; the primitive measurements are the evidence for the candidate, while Linux needs a more controlled follow-up.

Validation passed 30 host tests, the 20-seed simulator campaign (including PCT, TSO and transaction-failure injection), and 1,824 bounded interleaving schedules. Both candidate kernels booted Linux with 1, 2 and 4 vCPUs. The combined candidate and unmodified base each passed 192 sel4tests and 26 fl4tests on four-core release KVM. Earlier loaded runs of the candidate had one MULTICORE0003 failure and an FL4PERF0003 timeout; neither reproduced in the subsequent full-suite comparison, and those logs are retained.

The updated extraction and proofs pass: all 1,045 P0 functions are proved with no sorry, and the full Lean build succeeds. P1 specifies paired reads against its memory view and supplies a model; P3 proves the combined link update and reuse of a cap from the same snapshot. The P0 generator recognizes trusted interface arguments by type, including the differently named argument of a default trait method. An existing simulator IRQ test failed on the unmodified base because it expected a transaction on a quiet core, where opportunistic admission now runs serially. Its setup now enters policy backoff first, ensuring that the test actually exercises an aborted attempt.

Without the transactional runtime (§7, 2026-11-21). Same host, l4h 6-vCPU guest, against the kernel with STM still built in (unused on x86_64): getppid loops with 2, 4 and 6 threads 2.69 → 2.84, 5.20 → 5.33 and 7.24 → 7.36 M calls/s, 1 thread unchanged; fork loops on every vCPU 5,259 → 5,452/s on one vCPU and 7,791 → 8,353/s on six; pipe round trips between processes 1–3% faster. run-smpbench.py (divisor 4, three boots each, alternating): getpid, fork_wait, fault_4k, and same- and cross-vCPU pipe and same-vCPU futex round trips 1–7% better at 1, 4 and 6 vCPUs, futex_cross too noisy to tell (2.8–8.8 µs within each kernel). The image's .text is 420 KB smaller and .bss 10.3 → 4.2 MB without the per-core transaction state. These recover most of the fork losses the guest fast paths seemed to cost (below).

Guest syscall fast paths (§6, 2026-11-21). Same host and guest as below, with deep probes in both kernels, getppid loops with one thread pinned per vCPU (2.5–3 s each, after boot settles): 1 thread 716 → 654 ns per call, total throughput with 2, 4 and 6 threads 2.30 → 2.74, 1.77 → 2.21 and 1.52 → 1.64 M calls/s. The kernel part of an entry (the body run under the gate) averages 623 TSC cycles without the fast paths and 503 with them; the CR3 load (no PCIDs here) is about 140 of either. A measurement build counted both fast paths running the same number of times (1,940 and 1,932 in a 50 ms loop). Most of the rest of a 2,500-cycle round trip is entry and exit: CR0.TS set on the switch to the kernel thread (the FPU is switched lazily), the CR3 loads, and the gate.

Guest syscall fast paths beside the gate (§6, §7, 2026-11-21). Same loops: 1 thread 655 → 675 ns per call against the gated fast paths (715 without them); total throughput with 2, 4 and 6 threads 2.66 → 2.76, 2.27 → 5.20 and 1.66 → 7.11 M calls/s, so per-thread latency stays within 25% of one thread's at six. run-smpbench.py with l4h #209's harness (divisor 4, three boots each, alternating with main before these changes): getpid 1.43 → 1.52 M at 1 vCPU, 1.01 → 5.12 M at 4 and 1.06 → 7.27 M at 6; pipe and futex round trips within 2%; fork_wait 8% lower at 1 vCPU, 17% higher at 4 and 10% lower at 6, fault_4k 6% lower at 1 vCPU (turning off transactions accounts for 1–3% of the fork losses). The older harness measured while l4h-logd was still writing the guest's boot log, which slows syscalls by 20–25% for half a second after boot (I/O port invocations, §6); a kernel that ran the first phases sooner measured more of its IPC phases inside that window, and showed pipe and futex round trips up to 19% slower.

Deep gate probes (x86_64, 2026-11-20). With the probe bound at two, a third concurrent core's entries ran as transactions, and an l4h guest's syscall throughput fell as vCPUs were added. Raw getppid loops pinned one per vCPU in a 6-vCPU guest (Ryzen 7 7700, QEMU/KVM, 6 host cores): 1.13 M calls/s with one thread, 2.2 M with two, then 0.75 M with four and 1.12 M with six (per-call latency 5.3 µs). Letting probes queue behind every other core (§7) gives 1.65 M and 1.53 M, with one and two threads unchanged. run-smpbench.py, divisor 4, medians of three interleaved boots (higher is better):

Linux vCPUs Metric seL4 FL4 base Deep probes
4 getpid (calls/s) 1.20 M 0.95 M 1.41 M
4 fault_4k (faults/s) 502 k 425 k 473 k
4 fork_wait (cycles/s) 11.6 k 7.0 k 8.6 k
6 getpid 1.22 M 1.06 M 1.32 M
6 fault_4k 605 k 491 k 561 k
6 fork_wait 11.1 k 8.8 k 8.5 k

The other metrics (pipes, futexes, 1 vCPU) are within ±7%. At divisor 4 the 6-vCPU compute phase reads 8–10% lower with deep probes; at full length (divisor 1) both give 5.18 G ops/s, and a two-second pinned compute loop shows the same per-vCPU rate, so that is a few milliseconds of fixed start or end skew in a short phase, not lost throughput. A full-length 6-vCPU boot gives getpid 1.09 M → 1.51 M, fault_4k 562 k → 672 k, fork_wait 9.39 k → 8.84 k.

Fork serial-gate follow-up (same base). The gate changes in §7 recover direct execution promptly after transient contention, reuse exclusion between queued serial tickets, and scan the runtime's 16 supported cores. The two queued-successor bound still falls back to transactions under contention. Inlining, a transaction-local read cache and an activity-sampling policy were tested and removed after unsuccessful performance trials.

On the same Ryzen 7 7700/KVM L4H setup, five interleaved nice -20 boots per configuration produce these fork/exit/wait medians (cycles/s):

Linux vCPUs seL4 FL4 base Combined candidate Candidate below seL4
1 6,875 6,222 6,553 4.7%
2 10,700 6,466 9,757 8.8%
4 12,053 11,237 11,438 5.1%

Two-vCPU throughput improves 50.9% over unmodified 6ba3aa0. An independent three-boot recheck also meets the predeclared 10% median gap target at every count. Both use task nice -20, CPU-group weight 10000, and physical CPU affinities. Other builds continue unchanged; every sample is retained. Two-core direct Copy/Delete/Page_Map is within 4.2% of seL4 or faster; aggregate direct throughput exceeds seL4 by 2.1% at two workers and 29.3% at four. The single-worker direct cycle and some vfork/CLONE_VM controls still lag more, so the 10% result applies to this fork workload and host.

All 105 confirmation/recheck boots pass. Validation passes 31 host tests, the 200-seed simulator campaign (1,300 main/targeted seed-runs), 720 bounded schedules, all five mutation checks, 20 additional TSO seeds at 16 cores, 192 sel4tests and 26 fl4tests on four-core release KVM. The new gate test queues a real successor before a failed probe releases its ticket; neither may enter while a transaction remains active. The core, store, simulator and extracted proofs are unchanged from the preceding candidate, whose hashes and proof build were checked. The runtime remains trusted and tested. Benchmark runners and setup are in L4H PR #163. Measurements and validation summaries are recorded in FL4 PR #13.

13. Milestones

Ordered by dependency. Each milestone ends with a check that can be run.

  • M0 Scaffolding — ABI and bitfield generators, workspace, CMake drop-in, Aeneas pipeline on a stub core, boot to a serial banner on QEMU. Exit: sel4test builds against FL4; extraction runs in CI.
  • M1 Uniprocessor MCS kernel — CSpace, CDT, untyped, TCB, endpoints, notifications, reply and SC objects, VSpace, IRQs, faults, debug syscalls, both MCS timer modes. The l4h fixes, and the l4h extensions that do not depend on SMP. Exit: sel4test passes with 1 core, debug and release, in both KVM setups.
  • M2 P0 and first P1 proofs — No-failure proofs for all of fl4-core, CDT and refill invariants. Exit: P0 complete; extraction gate enforced.
  • M3 SMP under the serial gate — APs, per-core scheduling, IPIs, migration, and the remaining l4h extensions. Every entry takes the serial gate, which behaves like a big lock. Simulator with oracles running. Exit: sel4test passes with 2 and 4 cores.
  • M4 Local paths — The common paths run beside the gate (§7): an l4h guest's syscalls and I/O port accesses so far; page mapping under a per-address-space lock next, as measurement directs. Each with its refinement and footprint checked by the simulator, and P2 for each and for the runtime. (A transactional runtime filled this milestone until 2026-11-21, §7.) Exit: P2 for every local path; nightly simulation clean for two weeks; sel4test passes; scaling target met.
  • M5 P1 completion and performance — Full invariant set. Speed up the general IPC path in fl4-core without adding a second copy of it. Exit: P1 complete; uniprocessor IPC within target.
  • M6 Refinement — P3 per subsystem against the ported spec. Exit: each subsystem's refinement proof lands separately.

AArch64 is future work, outside M1–M6. The boundary rules in §11 still apply, so the port stays a new backend crate when it happens.

14. Risks

Risk Mitigation
Aeneas cannot express some kernel patterns, or proof terms grow too large at kernel scale Extractability gate from M0. Keep functions small. Prove against the Store trait instead of a concrete heap. Budget time to contribute upstream fixes to Charon and Aeneas.
Porting the abstract spec to Lean is a large job Port incrementally per subsystem, in the same order as P3. P0 to P2 do not need the abstract spec.
Behavior differs from seL4 in cases sel4test does not cover Differential fuzzing against seL4 on QEMU. Decoders follow the C source check by check.
The serial gate limits scaling for workloads without local paths Measure (smpbench, §12) and add local paths for what dominates; each comes with its own refinement and footprint check. The gate itself bounds worst-case waits as seL4's lock does.
A local path writes outside its footprint The footprint oracle checks every local path the simulator runs; P2 is to prove it. Keep local paths few and simple.
The simulator misses a bug that only real hardware shows Keep the trusted runtime tiny, test both KVM CPU models and TCG, and use QEMU record and replay to reproduce.
KVM hides timing and ordering behavior of real hardware, and one AMD host runs every test The reduced-feature KVM setup covers the fallback hardware paths. The simulator's memory model does not depend on the host. Add an Intel KVM host once FL4 is ready for wider testing.

15. Decisions

Settled on 2026-11-12.

Question Decision Where it applies
Support the non-MCS API? No. MCS only. §1, §2, §12
Source of the abstract spec Port seL4's Isabelle abstract spec to Lean. §9
IOMMU No in-kernel support. User space programs the IOMMU directly. §11
Configuration As few options as possible. Hardware is detected at boot, not configured. §3
API evolution FL4 is a superset of the seL4 API. Every seL4 program builds and runs on FL4 from source, but FL4 programs may use extensions seL4 lacks. §2, §9
l4h patch series Include every fix and feature except multikernel partitioning and the debug syscall MCP threshold. §4
Binary compatibility Not a goal. FL4 is compatible with the seL4 API at the source level and numbers its own ABI. §2
Debug syscall MCP threshold Not supported. §4
Multikernel Not supported. FL4 is the only kernel on its machine. §4
Fastpaths Only for an l4h guest syscall's fault and reply, checked against the general path in simulation; their refinement proof is to do. §6, §9
Test hardware Only inside QEMU/KVM guests on the development machine. FL4 never boots on that machine's hardware. §12
Fine-grained locking The serial gate, with local paths beside it whose footprints are checked, under the unchanged serial core. Replaces a transactional store (TL2 style, decided 2026-11-13). Decided 2026-11-21. §6, §7, §9, §13
IBPB on context switch No separate context-switch barrier. Native kernel entry uses IBPB or Safe RET to protect the kernel, or neither on AMD CPUs with AutoIBRS that report SRSO_NO or SRSO_USER_KERNEL_NO. Every VM exit issues IBPB to protect the kernel and userspace VMM; a VCPU's holder may defer it to the next switch to another address space (the security policy). General user-to-user side-channel isolation remains outside the model. Revised 2026-11-17; see the security policy. §3

VT-x and AMD-V support precede the AArch64 port. P0 covers the virtualization policy; P1/P3 use the expanded capability and TCB layouts, with native semantic scope as described in §9.