Skip to content

feat(arm64): FL4 UEFI release artifacts, built-in FKI v5 driver, and configurable VSpaces - #273

Merged
losfair merged 5 commits into
losfair:mainfrom
CommaBot:feat/arm64-vspaces-rng-nfsd
Dec 2, 2026
Merged

losfair merged 5 commits into
losfair:mainfrom
CommaBot:feat/arm64-vspaces-rng-nfsd

Conversation

@CommaBot

@CommaBot CommaBot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Enable AArch64 L4H-on-FL4 hosts to ship reproducible UEFI/dom0 release artifacts and run foreign-kernel modules inside paravirtual Linux guests:

  • Configurable per-VM VSpace pools & fallible ASID accounting (vmmgr, l4hctl): allow CTL_VM_CREATE (l4hctl create --vspaces) to size a PV guest's VSpace pool up to 512 (0 keeps max(64, vcpus)) so guests hosting many isolated user address spaces do not hit the 64-VSpace default, and return -ENOSPC with transactional rollback instead of panicking when host ASID pools are full.
  • Hardware-neutral ARM64 PAC capability bit (CTL_HOST_INFO): report L4H_HOST_CAP_ARM64_PAUTH_FULL when both the provider supports seL4_TCB_SetPACKeys and the CPU implements address authentication (APA/API/APA3) plus generic authentication (GPA/GPI/GPA3), so schedulers can match PAC-dependent workloads without hardcoding CPU models.
  • Built-in AArch64 FKI v5 driver & guest SDK export (guest/linux): add CONFIG_L4H_FKI (opt-in via fki.enable=1, inert by default) providing paravirtual user VSpaces/uTCBs, high-VA kernel memory, per-context PAC keys, hostcalls, xnu0, and byte channels, and include <linux/fki.h> + Module.symvers in /dev/l4hsdk so out-of-tree foreign-kernel modules build directly inside a seed guest. Also enable CONFIG_DM_SNAPSHOT and CONFIG_NFSD_V4 in arch/l4h/configs/defconfig for copy-on-write disks and loopback workspace mounts.
  • Reproducible AArch64 FL4 UEFI & dom0 release pipeline (boot/l4h-fl4-efi, host/l4h-root, tools): add AArch64 UEFI fl4-bootinfo handoff (TPM 2.0 event log + cache maintenance), map loader_modules on aarch64 in l4h-root, strip build-path noise from arm64 vdso.so, and pin host tools per triple so both x86_64 and native aarch64 Linux build hosts produce bit-for-bit reproducible l4h-fl4-aarch64.efi, l4h-debug-fl4-aarch64.tar.xz, and l4h-dom0-aarch64.tar.xz.
  • GPU leak check baseline (tests/gputest): warm guest slot 1's permanent vmmgr display page tables before sampling --free-bytes so guest kernel size changes near a 1 MiB boundary do not cause false-positive 1 MiB leak failures.

@CommaBot
CommaBot marked this pull request as draft November 30, 2026 10:26
@CommaBot
CommaBot force-pushed the feat/arm64-vspaces-rng-nfsd branch from 5274894 to c06d954 Compare November 30, 2026 10:54
@CommaBot CommaBot changed the title vmmgr, guest: configurable VSpaces, safe ASID exhaustion, ARM64 PAC/RNDR, NFSD/dm-snapshot vmmgr, guest: configurable VSpaces, safe ASID exhaustion, ARM64 PAC cap, NFSD/dm-snapshot Nov 30, 2026
@CommaBot
CommaBot force-pushed the feat/arm64-vspaces-rng-nfsd branch from c06d954 to 49ac92c Compare November 30, 2026 11:09
…ap, NFSD/dm-snapshot

- Allow CTL_VM_CREATE args[2] to configure a PV guest's VSpace pool size
  (0 keeps default max(64, vcpus), non-zero validates 64..=512 and >= vcpus,
  refused with EINVAL for HVM); raise MAX_VSPACES to 512 and expose
  --vspaces in l4hctl and VmSpec::vspaces.
- Move ASID pool tracking into testable l4h_host::vmmgr::AsidPoolSet with a
  single settle() commit/rollback path delegated by AsidPools::transaction,
  unify check_afford across create_guest, create_hvm and CTL_VM_START
  (ENOSPC for ASID exhaustion vs ENOMEM for memory/slots), replace panicking
  AsidPools::assign with fallible try_assign distinguishing seL4_DeleteFirst
  (ENOSPC) from other kernel errors (EIO) and
  l4h_task::component::CreateError::{AsidExhausted, Sel4}, and test the
  production create_guest/create_hvm rollback paths in tests/vm-create.rs.
- Expose hardware-neutral L4H_HOST_CAP_ARM64_PAUTH_FULL (1 << 0) in
  CTL_HOST_INFO data[8..16] only when both the embedded guest provider was
  built with L4H_PROVIDER_ARM_PAC (seL4_TCB_SetPACKeys) and AArch64 ID
  registers report address auth (APA/API/APA3) plus generic PACGA
  (GPA/GPI/GPA3).
- Enable CONFIG_DM_SNAPSHOT, CONFIG_NFSD, and CONFIG_NFSD_V4 in
  guest/linux/arch/l4h/configs/defconfig for copy-on-write block snapshots
  and loopback/in-guest NFSv4 file sharing, and update DESIGN.md.

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>
@CommaBot
CommaBot force-pushed the feat/arm64-vspaces-rng-nfsd branch from 49ac92c to 82ee71d Compare November 30, 2026 11:26
Extend the native FL4 UEFI release pipeline and dom0 packaging to produce
bit-for-bit reproducible AArch64 release artifacts alongside x86_64:

- boot/l4h-fl4-efi: add AArch64 UEFI handoff via the pinned fl4-bootinfo
  protocol without patching FL4, including UEFI TPM 2.0 event log
  collection/final-events append, UEFI 2.10 §7.4 GetMemoryMap/ExitBootServices
  retry loop, full-page module/TPM-log D-cache clean to PoC, arch-guarded
  panic_handler (hlt/wfi), and aarch64-unknown-uefi in
  kernel/fl4/rust-toolchain.toml.
- host/l4h-root: enable bootinfo loader_modules mapping on aarch64 so
  modules handed over by l4h-fl4-efi (guest-kernel, guest-sdk,
  dom0-initrd, l4h-config) are mapped identically to x86_64.
- guest/linux/arch/l4h/arm64/Makefile: link vdso.so with
  -Wl,--build-id=none -Wl,-s so temporary assembler object paths are not
  embedded into vmlinux via .incbin, making AArch64 vmlinux reproducible
  across checkout paths.
- tools/{mkfl4-release-efi,build-fl4-efi,build-dom0,build-release,
  check-reproducible,ci-setup,run-fl4-aarch64}.sh & .github/workflows/release.yml:
  support L4H_ARCH=aarch64 for l4h-fl4-aarch64.efi,
  l4h-debug-fl4-aarch64.tar.xz, and static l4h-dom0-aarch64.tar.xz
  (with unified static ELF executable verification and x86_64-only
  install.py packaging), explicit L4H_LINUX_CC_AARCH64 in multi-arch
  release builds, and document the published AArch64 artifacts in DESIGN.md.

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>
@CommaBot
CommaBot force-pushed the feat/arm64-vspaces-rng-nfsd branch 2 times, most recently from b50476a to efc5fa1 Compare November 30, 2026 16:17
Add the built-in Foreign Kernel Interface (FKI v5) driver under
guest/linux/arch/l4h/drivers/fki/ (CONFIG_L4H_FKI, default y on
ARM64 && NET, disabled on x86_64) together with its public header
guest/linux/arch/l4h/include/linux/fki.h:

- Opt-in runtime activation via kernel command line `fki.enable=1`
  (default off so standard dom0/sub-VM guests do not register
  /dev/xnu-chan{0,1}, /dev/xnu-hostcall, or xnu0; exported fki_*
  entry points reject calls cleanly when disabled).
- High-VA kernel memory, paravirtual user VSpace pool scaling with
  l4h_bootinfo->nr_vspaces (max(nr - 48, 32) when nr > 80, reserving
  208/256 user VSpaces for vspaces=256 guests with elastic borrow/return
  to the Linux VSpace pool), uTCB lifecycle with strict per-CPU
  fki_cur_utcb invariant, cross-CPU fault_ep rebinding on migration,
  pre-run FPU state read/write support, hostcall bridge, virtual
  Ethernet link (xnu0), and bidirectional byte channels.
- Automatic export of <linux/fki.h> and all 83 fki_* symbols into
  /dev/l4hsdk (sdk.erofs) so out-of-tree foreign-kernel modules can
  compile against the guest SDK and load directly without shipping a
  separate fki.ko.
- Update DESIGN.md §3/§5.6 to document the built-in AArch64 FKI driver
  and `fki.enable=1` boot parameter.

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>
@CommaBot
CommaBot force-pushed the feat/arm64-vspaces-rng-nfsd branch from efc5fa1 to 7e415b0 Compare November 30, 2026 16:57
CommaBot and others added 2 commits December 1, 2026 02:56
…check

The first virtio-gpu attach for guest slot 1 allocates permanent global
paging structures (3 pages / 12 KiB on AArch64) in vmmgr's own VSpace for
layout::DISPLAY, which are reused by subsequent guests. Because init-gputest
sampled floor-truncated MiB free memory (l4hctl info) before any GPU attach,
any guest kernel size leaving free memory within 12 KiB above a 1 MiB
boundary caused a false-positive 1 MiB leak report after the first GPU guest.

Follow tests/guest/init-hvmtest: warm guest slot 1's display page tables
before taking the baseline, switch to l4hctl info --free-bytes, and assert
exact zero-byte reclamation after both the 800x600 and 65x65 GPU guests.

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>
tools/cargo.sh and tools/ci-setup.sh downloaded x86_64-unknown-linux-gnu
binaries unconditionally, so a native AArch64 Linux build host (as
l4h-sandbox/image/build-node.sh requires) failed with "Exec format error"
on the pinned Cargo.

tools/source-pins.sh now selects RUSTUP_SHA256 and L4H_CARGO_SHA256 by
L4H_HOST_TRIPLE (default: `uname -m`-unknown-linux-gnu), with pins for
x86_64 and aarch64. Other hosts get empty pins, so check-reproducible.sh
can still source the Linux pins, and cargo.sh and ci-setup.sh refuse to
run there. cargo.sh keeps its download and extracted tool per triple.

ci-setup.sh installs libc6-dev-arm64-cross only on cross-compiling hosts
(an AArch64 host has its native libc6-dev from build-essential) and adds
the arm64 dpkg architecture only when it is foreign.

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>
@CommaBot
CommaBot marked this pull request as ready for review December 1, 2026 18:35
@CommaBot CommaBot changed the title vmmgr, guest: configurable VSpaces, safe ASID exhaustion, ARM64 PAC cap, NFSD/dm-snapshot feat(arm64): FL4 UEFI release artifacts, built-in FKI v5 driver, and configurable VSpaces Dec 1, 2026
@losfair
losfair merged commit 0447887 into losfair:main Dec 2, 2026
17 checks passed
@CommaBot
CommaBot deleted the feat/arm64-vspaces-rng-nfsd branch December 2, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants