From 7225c24983dbc3e90a158f419956a160512c862b Mon Sep 17 00:00:00 2001 From: diviocity Date: Mon, 30 Nov 2026 12:50:45 +0100 Subject: [PATCH] Package vpac from pinned sources and verify the AArch64 runtime root --- BOOTSTRAP.md | 4 ++++ vpac/PKGBUILD.vile | 48 ++++++++++++++++++++++++++++++++++++++++++++ vpac/check-config.py | 35 ++++++++++++++++++++++++++++++++ vpac/config.vile.in | 12 +++++++++++ 4 files changed, 99 insertions(+) create mode 100644 vpac/PKGBUILD.vile create mode 100644 vpac/check-config.py create mode 100644 vpac/config.vile.in diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index b990eb8..6eb5863 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -58,6 +58,8 @@ The aarch64 rebuilds of attr, ISL, libpng, libseccomp and Nettle require the 16 The aarch64 ncurses build uses the target `strip` for installed executables and the host `tic` for the terminfo database. The recipe ran its target `infocmp` against the staged xterm-256color entry. The worker checked the package's 16 KiB ELF segments in `arm/abi16/logs/ncurses-pages.tsv`, SHA-256 `48d777d8e44938601cf51d8a63a58b4243b492ed7a455b3ef1c0b0743db0fb06`. +The AArch64 release kernel booted a fresh ext2 root from 79 signed packages, including binutils, GCC libraries, OpenSSL and X client libraries. The installed musl loader relocated all 82 dynamic executable paths. The root audit covered 12,011 owned files and links and 204 target ELFs. See `arm/abi16/combined-runtime-02`, receipt SHA-256 `06df2a06013eaaaa18f05482668aab20d3ef0fca2339f2f9116970f5bed34c51`. + ## Verified x86_64 bootstrap A fresh signed Git 2.47.3 installation pulled in 15 packages and passed the audit for 1,842 paths and 46 ELF files. In the isolated root, Git created a commit, read it back and passed `git fsck --full`. The installed OpenSSH 9.9p2 client and its five dependencies passed the audit for 4,319 paths and 34 ELFs. Its `ssh-keygen` generated an Ed25519 key, signed a file and verified it for the named principal. The worker retains those installed-package results in `foundation/signed-git-01` and `foundation/signed-ssh-01`, receipt SHA-256 `f43c1f53e159f97b6e5cfb8db542828f5ab055996e7885b2e4b89b044df9ed76` and `6e30b1d67ad5e9740ca28cf76317ef3f4dac4e75c82c78560785a2395ddb2e32` respectively. @@ -76,6 +78,8 @@ The GnuPG 2.4.9-1 recipe uses the SDK's `gpgrt-config` to locate libksba. Its bu The published x86_64 Vinix kernel booted that 22-package root. Both `gpgv` and the GPGME OpenPGP engine verified the feed's actual detached database signature against the packaged public key. Both reported a bad signature when the guest appended bytes to the database. To repeat the check, compile `tests/userland/verify-index.c` with the target SDK and `-lgpgme`. Stage the executable, the signed `vinix.db` and its signature as `/signature-fixture/{verify-index,index,index.sig}`, then boot with `tests/userland/signatures.sh`. The worker receipt manifest is `foundation/signature-engine-guest-03/receipts.sha256`, SHA-256 `71ce37b04b4e75936bd4082396f3b312ee7b4ef68a05cc9e7338849f6889293e`. +The x86_64 vpac recipe uses V at `597b0f6`, targets musl explicitly, and embeds the Vile resources. Its configuration check temporarily removes both input Scheme files and queries an installed signed musl record. The recipe uses the locked `nobody` account from `vinix-accounts` and keeps package and database signature checks enabled. The build peaked at 2,281,107,456 bytes with zero cgroup OOM events. The resulting `vpac-1.0.0-1-x86_64.pkg.tar.zst` has SHA-256 `f6aa20508a8bc62b5da8b5134657f8d12b1ff5c1609a87e2d7eae02759ea7786`. The worker recorded the pinned source trees in `foundation/vpac-vcs-pins-01`, receipt SHA-256 `2124cc24c72459f7274eb4a74c0d1fa4ec30896a35183e31e6786e9060666014`. + For later builds, `tools/build-queue.py` uses the source order and a verified bootstrap feed. Place the input archives and a `NAME.sha256` receipt for each in `$work/artifacts`. Configure the host compiler and signing tools as for a single native build, then select the ports to build. The worker uses this command form. ```sh diff --git a/vpac/PKGBUILD.vile b/vpac/PKGBUILD.vile new file mode 100644 index 0000000..5564b21 --- /dev/null +++ b/vpac/PKGBUILD.vile @@ -0,0 +1,48 @@ +selected := get-environment-variable("VPAC_TARGET_ARCH") +arch := if string?(selected) { selected } else if memq(string->symbol("aarch64"), features()) { "aarch64" } else { "x86_64" } +v-arch := if string=?("aarch64", arch) { "arm64" } else { "x64" } + +defpkgbuild(vpac, + #:pkgname, "vpac", + #:pkgver, "1.0.0", + #:pkgrel, 1, + #:pkgdesc, "Vinix package manager and native Vile package builder", + #:arch, [#:x86-64, #:aarch64], + #:url, "https://gitly.divio.city/me/vpac", + #:license, "GPL-3.0-only", + #:depends, ["musl", "gc", "curl", "libarchive", "libgpg-error", "gpgme", "gnupg", "libseccomp", "vinix-accounts>=0.1.0-2"], + #:makedepends, ["linux-headers"], + #:backup, ["etc/vpac.d/config.vile"], + ; Native makepkg checks out each full commit after cloning its public repository. + #:source, ["vpac-src::git+https://gitly.divio.city/me/vpac.git#commit=e7147c7fac0dc130fe03c7accf07c75a88188d3d", + "nspkg::git+https://gitly.divio.city/me/nspkg.git#commit=c01b0795d1db56c7bce2539b2c46b110637fdc1a", + "stutter::git+https://gitly.divio.city/me/stutter.git#commit=29b47cb4b818f95a5308d3c086bd7933b7c176bd", + "vile::git+https://git.vorelabs.dev/diviocity/vile.git#commit=76646891b77a3d5c6af4a1e42b122cd61dc1654b", + "config.vile.in", "check-config.py"], + #:sha256sums, ["SKIP", "SKIP", "SKIP", "SKIP", "da473de43c4b1232145dee708df4762a1b26f930bb5693053b19a763df462bf4", + "eb72a7f3ce972cfe0b653984324332cf119d778e723d7e659b3a49494cc883ea"], + #:prepare, fn() { + run("mkdir", "modules") + run("mv", "nspkg", "stutter", "vile", "modules/") + run("cp", "config.vile.in", "config.vile") + run("sed", "-i", string-append("s/@ARCH@/", arch, "/g"), "config.vile") + }, + #:build, fn() { + paths := string-append(srcdir(), "/vpac-src|", srcdir(), "/modules|", srcdir(), "/modules/vile|@vlib") + ; Embed the Vile assets while keeping the generated C inside the bootstrap build budget. + ; The V driver runs on the build host. Match the target libc even when the host uses glibc. + run("v", "-prod", "-no-prod-options", "-cflags", "-O0", "-no-parallel", "-no-retry-compilation", + "-os", "linux", "-arch", v-arch, "-cc", "vinix-cc", + "-gc", "boehm", "-d", "musl", "-d", "dynamic_boehm", "-d", "nspkg_libcurl", + "-path", paths, "-o", "vpac-target", "vpac-src/src") + }, + #:check, fn() { + run("python3", "check-config.py") + }, + #:package, fn() { + run("install", "-Dm755", "vpac-target", string-append(pkgdir(), "/usr/bin/vpac")) + run("install", "-Dm644", "config.vile", string-append(pkgdir(), "/etc/vpac.d/config.vile")) + run("install", "-d", string-append(pkgdir(), "/var/lib/vpac"), string-append(pkgdir(), "/var/cache/vpac/pkg"), + string-append(pkgdir(), "/etc/vpac.d/hooks"), string-append(pkgdir(), "/var/log")) + run("install", "-d", "-m700", string-append(pkgdir(), "/etc/vpac.d/gnupg")) + }) diff --git a/vpac/check-config.py b/vpac/check-config.py new file mode 100644 index 0000000..a9dab5a --- /dev/null +++ b/vpac/check-config.py @@ -0,0 +1,35 @@ +"""Exercise the target binary's bundled Vile resources and real installed database queries.""" +import os +from pathlib import Path +import json +import subprocess +import tempfile + +root = Path(os.environ["VPAC_MAKEPKG_ROOT"]) +db = Path(os.environ["VPAC_MAKEPKG_DB"]) +exe = Path("vpac-target").resolve() +with tempfile.TemporaryDirectory() as directory: + work = Path(directory) + # Debug V builds read Scheme files from the compiler checkout. Temporarily move + # those build inputs so only a self-contained release executable can pass. + moved = [] + try: + for resource in (Path("vpac-src/src/config_objects.scm"), Path("modules/vile/scheme/goops_protocol.scm")): + hidden = resource.with_suffix(".scm.hidden") + resource.rename(hidden) + moved.append((hidden, resource)) + contents = Path("config.vile").read_text() + contents = contents.replace('path-root = "/"', "path-root = " + json.dumps(str(root) + "/")) + contents = contents.replace('path-db = "/var/lib/vpac/"', "path-db = " + json.dumps(str(db) + "/")) + config = work / "config.vile" + config.write_text(contents) + env = os.environ.copy() + env.pop("V_RESOURCE_PATH", None) + result = subprocess.check_output(["vinix-run", exe, "--config", config, "q", "-F", + "name,version,validation", "local/musl"], env=env, text=True) + fields = dict(line.split(None, 1) for line in result.splitlines() if len(line.split(None, 1)) == 2) + if fields.get("name") != "musl" or fields.get("validation") != "signature": + raise RuntimeError(f"target vpac did not query signed musl: {result!r}") + finally: + for hidden, resource in moved: + hidden.rename(resource) diff --git a/vpac/config.vile.in b/vpac/config.vile.in new file mode 100644 index 0000000..d8a5d6b --- /dev/null +++ b/vpac/config.vile.in @@ -0,0 +1,12 @@ +; The image supplies the signed seed repository and the trusted public key. +path-root = "/" +path-db = "/var/lib/vpac/" +path-log = "/var/log/vpac.log" +path-cache = ["/var/cache/vpac/pkg/"] +path-gpg = "/etc/vpac.d/gnupg/" +path-hook = ["/etc/vpac.d/hooks/"] +pkg-arch = "@ARCH@" +network-connections = 2 +network-user = "nobody" +network-siglevel = ["package", "database"] +repositories = list(sync-repo("vinix", ["file:///var/lib/vinix/repository/@ARCH@"])) -- 2.56.1