carlos / platform Public

gvisor demos: pre-merge fixes from task reviews

Co-Authored-By: Astra (gpt-6-astra) via codex
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev fc24f44490fd017ca5bf75d1e5215823d61804ed parent 5f38e17
25 files changed, +327 −72
  • .gitignore +1 −0
  • README.md +12 −11
  • docs/superpowers/notes/census-proposal-gvisor-demos.md +12 −6
  • internal/console/runscmirror.go +2 −2
  • internal/console/runscmirror_test.go +51 −0
  • internal/demobuild/gvisor.go +4 −3
  • internal/demobuild/gvisor_test.go +8 −0
  • internal/execsandbox/command.go +9 −0
  • internal/execsandbox/command_test.go +28 −0
  • internal/execsandbox/lock.go +10 −2
  • internal/host/claimunit.go +6 −4
  • internal/host/claimunit_test.go +44 −1
  • internal/host/execsandboxstatus_test.go +1 −1
  • internal/host/sandboxenv_linux.go +12 −1
  • internal/host/sandboxenv_linux_test.go +44 −0
  • internal/host/sizestatus.go +16 −3
  • internal/host/sizestatus_test.go +9 −4
  • internal/instancectl/gvisor_fix1_test.go +4 −0
  • internal/instancectl/gvisorunit.go +5 −4
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv +11 −11
  • internal/publicrelease/feed.go +14 −4
  • internal/publicrelease/runsc.go +1 −11
  • internal/publicrelease/runsc_test.go +20 −1
  • internal/publicrelease/verifysums.go +2 −2

CI failed — run details

diff --git a/.gitignore b/.gitignore
index 03a3ed607..104b5d43f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,4 @@ infra/modules/**/.terraform.lock.hcl
writing/
.claude/settings.local.json
.claude/HANDOFF.md
+/internal/host/gvisor_generated_rootrunner_linux_test.go
diff --git a/README.md b/README.md
index c92bfa594..8f9d7174f 100644
--- a/README.md
+++ b/README.md
@@ -249,17 +249,18 @@ A release is a `vX.Y.Z` tag on this repo plus signed binaries on [carlosframewor
1. **Tag.** `git tag -a vX.Y.Z <sha> -m "carlos vX.Y.Z"` on the `main` commit you are releasing, then `git push origin vX.Y.Z` to the forge.
2. **Build.** Six targets, darwin, linux and windows on amd64 and arm64, each with `make build GOOS=<os> GOARCH=<arch> SHA=vX.Y.Z` from a clean checkout of the tag. Build with `TMPDIR` and `GOCACHE` on a real disk: `/tmp` is a shared tmpfs, and a full one fails the link with "no space left on device". Zip each Windows binary as a lone `carlos.exe`. Build the console the same way, with `make build-console GOOS=linux GOARCH=<arch> SHA=vX.Y.Z` for amd64 and arm64, and name the two `carlos-console-linux-<arch>`. Both targets stamp the tag's full commit into the binary. The console writes that commit into the hostname history's floor, and the console roll script refuses a floor with no commit. `console hosts-used activate` refuses a console that isn't a release build or doesn't name a full commit.
3. **Debs.** One per architecture, built with `dpkg-deb --root-owner-group`, holding `usr/bin/carlos`. Copy the last release's `control` and change the version and the description's last sentence. Wrap the description without breaking on hyphens, or apt shows "step- by-step".
-4. **Sums and signature.** Write `SHA256SUMS.txt` over the eight files. Sign it with the ed25519 seed in SSM `/carlos/cli-update-key`, passed on stdin and never in argv, and write the signature base64-encoded to `SHA256SUMS.txt.sig`. Before signing, check that the key's public half equals `cliUpdatePubKey` in `update.go`. A mismatch publishes a release nobody can update to. Write `CONSOLE_SHA256SUMS.txt` over the two console binaries and sign it the same way, to `CONSOLE_SHA256SUMS.txt.sig`. Keep the console out of `SHA256SUMS.txt`: `carlos update` reads that file. The public self-host guide downloads the console and checks this signature, so a release without it leaves the guide on an older console.
-5. **Release notes.** Draft them, and put them through copy review before anything is published. Lead with what changed for people using the CLI. Add a short section for operators, taken from the release notes below this recipe, about anything to check before rolling.
-6. **Publish.** `gh release create vX.Y.Z -R carlosframework/releases --latest --title vX.Y.Z --notes-file NOTES.md` with all fourteen files: the ten above and the console's four. Confirm it is the latest with `gh api repos/carlosframework/releases/releases/latest -q .tag_name`.
-7. **Homebrew.** In `carlosframework/homebrew-tap`, bump `Formula/carlos.rb`: the version, the four url and sha256 pairs from the published `SHA256SUMS.txt`, and the `carlos vX.Y.Z` test string. Open a PR, check each hash against the sums file, and squash-merge it.
-8. **apt.** Download the live tree, `apps/bab/apt-carlosframework/releases/<last>/site.tar.gz` from the flagship bucket, and unpack it. Add the two debs under `pool/main/c/carlos/`, and regenerate each architecture's `Packages` with `dpkg-scanpackages --multiversion`. Delete `Release`, `InRelease` and `Release.gpg`, then rebuild `Release` with `apt-ftparchive release`, passing Origin and Label `CARLOS`, Suite and Codename `stable`, the architectures and the component. Write it outside the tree first, or it lists itself. Sign `InRelease` and `Release.gpg` with the SSM key `/carlos/apt-signing-key` in a throwaway `GNUPGHOME`, set `latest.txt` to the tag, and check both signatures with `gpgv` against the tree's own keyring.
-9. **Ship apt.** Ship the directory and let `carlos ship` build the tarball. A hand-made tar with a leading `./` entry took apt down once. With `AWS_PROFILE=keymail` and `CARLOS_DEPLOYMENT_BUCKET` set to the flagship bucket, run `carlos ship -app apt-carlosframework -account-id bab -kind static -version vX.Y.Z-1 site/`, then `carlos promote -app apt-carlosframework -account-id bab vX.Y.Z-1 canary/apt` with `CARLOS_RELEASE_KEY` from SSM `/carlos/release-key` set for that one command. The channel is the literal `canary/apt`.
-10. **Docs and changelog.** Two parts. Part a is owed every release, whatever else is: until 2026-11-06 the docs sync rode on the changelog and kept being put off, and the live site showed 4 of the 10 docs pages.
- - **10a. Docs.** In `carlosframework/website`, run `node hack/sync-docs.mjs <checkout>` with the platform checkout at the release tag, so the site shows only released behaviour, then `npm run check`. Open and merge the PR, and ship the site the way its AGENTS.md describes. Check that carlosframework.com/docs/ lists every page in `docs/site/nav.json`.
- - **10b. Changelog.** In a full checkout of `main`, with `gh` and `amadan` signed in, run `git fetch origin --tags '+refs/amadan/closed/*:refs/amadan/closed/*'`, then `go run ./cmd/changelog`. Map each of the new release's bullets to the branches behind it in `docs/site/changelog-links.json`, keyed by the bullet's bold lead, and run it again. Land `docs/site/changelog.json` and the links file on a branch. The release tag predates them, so publish them by syncing from a detached checkout of the tag with just those two files taken from `main`: `git checkout --detach <tag> && git checkout origin/main -- docs/site/changelog.json docs/site/changelog-links.json`, then `node hack/sync-docs.mjs <checkout>` and ship as in 10a. Restore the checkout afterwards (`git checkout <tag> -- docs/site`). The page is carlosframework.com/platform/changelog.
-11. **Self-host template.** In `carlos/opentofu` on amadan, on a branch from `main`, run `scripts/bump-carlos vX.Y.Z`. It checks the signature on the release's `SHA256SUMS.txt` and rewrites the hosts' pin and checksum in `modules/region/cloud-init.sh.tftpl`. Then compare the release's "For operators" notes, and any change under `infra/modules/region-host/`, with the template: a new required `host.env` key, a changed `carlos bootstrap`, or an IAM or bucket change that a new host needs goes in the same branch. Run `scripts/check`, then land it with `amadan branch merge carlos/opentofu <branch> -squash -expect <full sha> -message "<subject>"` once CI is green. Note the landed commit.
-12. **Self-host guide.** In `carlosframework/website`, move every pin on `src/platform/self-host/index.html` together: the CLI version in the prerequisites, the console `release_url`, the `ok vX.Y.Z` that `/healthz` returns, and the template commit after `git checkout --detach`. Copy changes go through copy review. Merge the PR and ship the site the way its AGENTS.md describes. This can be the same ship as step 10. Check carlosframework.com/platform/self-host/ shows the new version and commit.
+4. **Runtime assets.** From the release tag's checkout, run `go run ./cmd/runsc-assets -out <artifact-directory>` with the existing release artifact directory. It verifies the pinned archives and extracts five runtime files for each Linux architecture: `runsc`, `gvisor-sentry`, `runsc-fd-parking`, `gvisor-proc-umounter` and `gvisor-sentry-prewarmer`, each suffixed with `-linux-amd64` or `-linux-arm64`. Generate the checksums only after all ten files are present.
+5. **Sums and signature.** Write `SHA256SUMS.txt` over eighteen files: six CLI downloads, two debs and ten runtime assets. Sign it with the ed25519 seed in SSM `/carlos/cli-update-key`, passed on stdin and never in argv, and write the signature base64-encoded to `SHA256SUMS.txt.sig`. Before signing, check that the key's public half equals `cliUpdatePubKey` in `update.go`. A mismatch publishes a release nobody can update to. Write `CONSOLE_SHA256SUMS.txt` over the two console binaries and sign it the same way, to `CONSOLE_SHA256SUMS.txt.sig`. Keep the console out of `SHA256SUMS.txt`: `carlos update` reads that file. The public self-host guide downloads the console and checks this signature, so a release without it leaves the guide on an older console.
+6. **Release notes.** Draft them, and put them through copy review before anything is published. Lead with what changed for people using the CLI. Add a short section for operators, taken from the release notes below this recipe, about anything to check before rolling.
+7. **Publish.** `gh release create vX.Y.Z -R carlosframework/releases --latest --title vX.Y.Z --notes-file NOTES.md` with all twenty-four files: the eighteen assets, `SHA256SUMS.txt`, its signature and the console's four files. Confirm it is the latest with `gh api repos/carlosframework/releases/releases/latest -q .tag_name`.
+8. **Homebrew.** In `carlosframework/homebrew-tap`, bump `Formula/carlos.rb`: the version, the four url and sha256 pairs from the published `SHA256SUMS.txt`, and the `carlos vX.Y.Z` test string. Open a PR, check each hash against the sums file, and squash-merge it.
+9. **apt.** Download the live tree, `apps/bab/apt-carlosframework/releases/<last>/site.tar.gz` from the flagship bucket, and unpack it. Add the two debs under `pool/main/c/carlos/`, and regenerate each architecture's `Packages` with `dpkg-scanpackages --multiversion`. Delete `Release`, `InRelease` and `Release.gpg`, then rebuild `Release` with `apt-ftparchive release`, passing Origin and Label `CARLOS`, Suite and Codename `stable`, the architectures and the component. Write it outside the tree first, or it lists itself. Sign `InRelease` and `Release.gpg` with the SSM key `/carlos/apt-signing-key` in a throwaway `GNUPGHOME`, set `latest.txt` to the tag, and check both signatures with `gpgv` against the tree's own keyring.
+10. **Ship apt.** Ship the directory and let `carlos ship` build the tarball. A hand-made tar with a leading `./` entry took apt down once. With `AWS_PROFILE=keymail` and `CARLOS_DEPLOYMENT_BUCKET` set to the flagship bucket, run `carlos ship -app apt-carlosframework -account-id bab -kind static -version vX.Y.Z-1 site/`, then `carlos promote -app apt-carlosframework -account-id bab vX.Y.Z-1 canary/apt` with `CARLOS_RELEASE_KEY` from SSM `/carlos/release-key` set for that one command. The channel is the literal `canary/apt`.
+11. **Docs and changelog.** Two parts. Part a is owed every release, whatever else is: until 2026-11-06 the docs sync rode on the changelog and kept being put off, and the live site showed 4 of the 10 docs pages.
+ - **11a. Docs.** In `carlosframework/website`, run `node hack/sync-docs.mjs <checkout>` with the platform checkout at the release tag, so the site shows only released behaviour, then `npm run check`. Open and merge the PR, and ship the site the way its AGENTS.md describes. Check that carlosframework.com/docs/ lists every page in `docs/site/nav.json`.
+ - **11b. Changelog.** In a full checkout of `main`, with `gh` and `amadan` signed in, run `git fetch origin --tags '+refs/amadan/closed/*:refs/amadan/closed/*'`, then `go run ./cmd/changelog`. Map each of the new release's bullets to the branches behind it in `docs/site/changelog-links.json`, keyed by the bullet's bold lead, and run it again. Land `docs/site/changelog.json` and the links file on a branch. The release tag predates them, so publish them by syncing from a detached checkout of the tag with just those two files taken from `main`: `git checkout --detach <tag> && git checkout origin/main -- docs/site/changelog.json docs/site/changelog-links.json`, then `node hack/sync-docs.mjs <checkout>` and ship as in 11a. Restore the checkout afterwards (`git checkout <tag> -- docs/site`). The page is carlosframework.com/platform/changelog.
+12. **Self-host template.** In `carlos/opentofu` on amadan, on a branch from `main`, run `scripts/bump-carlos vX.Y.Z`. It checks the signature on the release's `SHA256SUMS.txt` and rewrites the hosts' pin and checksum in `modules/region/cloud-init.sh.tftpl`. Then compare the release's "For operators" notes, and any change under `infra/modules/region-host/`, with the template: a new required `host.env` key, a changed `carlos bootstrap`, or an IAM or bucket change that a new host needs goes in the same branch. Run `scripts/check`, then land it with `amadan branch merge carlos/opentofu <branch> -squash -expect <full sha> -message "<subject>"` once CI is green. Note the landed commit.
+13. **Self-host guide.** In `carlosframework/website`, move every pin on `src/platform/self-host/index.html` together: the CLI version in the prerequisites, the console `release_url`, the `ok vX.Y.Z` that `/healthz` returns, and the template commit after `git checkout --detach`. Copy changes go through copy review. Merge the PR and ship the site the way its AGENTS.md describes. This can be the same ship as step 11. Check carlosframework.com/platform/self-host/ shows the new version and commit.
Then verify from the public side:
diff --git a/docs/superpowers/notes/census-proposal-gvisor-demos.md b/docs/superpowers/notes/census-proposal-gvisor-demos.md
index 8d46cfbc8..0839593c5 100644
--- a/docs/superpowers/notes/census-proposal-gvisor-demos.md
+++ b/docs/superpowers/notes/census-proposal-gvisor-demos.md
@@ -22,8 +22,9 @@ Ruling `census-ruling-gvisor-demos`. The independent reviewer approves or reject
| `internal/host/claimactivation_preflight.go` `claimActivationLocalUnits` | body | unchanged (4) | Fix round 1 I2: preserve the existing native preflight skip decision in a named helper for tests; ParseUnitName now returns a distinct discovery kind for gVisor so its leftover drop-ins are not skipped. Same walks and reads, no new paths or native authority. |
| `internal/host/claimstop_run.go` `RunInstanceControl` | body | unchanged (0) | Retain Task 1 admission and claim separation; wire host-owned exact recovery baseline and pinned-set verification/retry callbacks. No new direct read. Task 6: In effective gVisor mode serve the cleanup-capable registry-view controller before claim recovery or assembly; preserve the retained Configure error so CLAIMS and invalid config still block launches. No new direct read. |
| `internal/host/claimunit.go` `claimUnitContent` | body | unchanged (1) | Mark only claim/demo renderings explicitly; common host.env remains loaded. Ordinary rendering masks CARLOS_HOST_CLAIM with UnsetEnvironment, removed only for a successfully parsed enabled claim rendering. Existing template read unchanged. Task 7: render aggregate build slice through SlicePropertiesFor using the resolved host mode, with 32 MiB and 64-task gVisor overhead per slot. Existing control permissions unchanged. |
-| `internal/host/claimunit.go` `readClaimUnitSettings` | body | unchanged (3) | Task 7: parse CARLOS_EXEC_SANDBOX in the existing host.env reader and resolve fixed mode for installed build-slice budgets. No new file read; invalid values refuse rendering. |
+| `internal/host/claimunit.go` `readClaimUnitSettings` | body | unchanged (3) | Task 7 and pre-merge fixwave: parse CARLOS_EXEC_SANDBOX in the existing host.env reader only when the demo build worker is enabled, for installed build-slice budgets. Invalid sandbox values still refuse build-worker rendering; ordinary and claim hosts retain their settings. No new file read. |
| `internal/host/layoutleg.go` `layoutStatusReport` | body | unchanged (18) | Task 8: add root-reported configured/effective mode, runtime pin and readiness through Client.SandboxStatus, plus observed per-row family from the activator handle. Missing/stale root builds remain unknown. Presentation only, no root decision. |
+| `internal/host/sizestatus.go` `readSizeInForce` | body | unchanged (2) | Task 8 and pre-merge fixwave: validate retained unit family; gVisor reads only its retained unit memory.max and matches Physical(logical tier), with no fallback. Restore main native semantics: generation-0 reads the host slice, a retained generation uses its cgroup when present and falls back only if its directory is absent. Stat of the native retained generation directory is restored; unreadable/malformed existing unit limits remain unknown. Return unchanged logical size/shares. Existing agent cgroupfs paths, no guest-file read. |
| `internal/host/systemapply.go` `systemApplier.install` | body | unchanged (0) | Check staged and previous executable awareness before unit-plan execution. Existing reads unchanged; no unaware prev executes in gvisor mode. |
| `internal/host/systemapply.go` `systemApplier.installUnits` | body | unchanged (6) | Create rootfs/runtime parent directories before controller restart. Existing staged unit and root-owned host.env reads unchanged. |
| `internal/host/systemapply.go` `systemApplier.restoreFiles` | body | unchanged (1) | Check prev awareness before quiesce/copy/restore and check the copied restore executable before rename. Existing stat unchanged. |
@@ -76,7 +77,6 @@ Ruling `census-ruling-gvisor-demos`. The independent reviewer approves or reject
| `internal/activator/unitproc.go` `ExecBackend.newRootfsWorkerProc` | sites | +registry:Host, -whole:Route | Task 5: migrate structured root start identity, validate binding, retain actual unit for observation/exit/stop. Unknown worker response retains only a cleanup request and listener, never a guessed observed identity. Existing route/control/cgroup inputs; no new root read. |
| `internal/activator/unitproc.go` `ExecBackend.newUnitProcFor` | sites | -whole:Route | Task 5: migrate structured root start identity, validate binding, retain actual unit for observation/exit/stop. Unknown worker response retains only a cleanup request and listener, never a guessed observed identity. Existing route/control/cgroup inputs; no new root read. |
| `internal/activator/unitproc.go` `ExecBackend.observe` | sites | -registry:Runtime ×2, -whole:Route ×2 | Task 5: migrate structured root start identity, validate binding, retain actual unit for observation/exit/stop. Unknown worker response retains only a cleanup request and listener, never a guessed observed identity. Existing route/control/cgroup inputs; no new root read. Fix round 2: rootfs log says stop accepted and waits for termination proof; no claim of termination from stop acceptance. Foreign observer uses plain fenced stop with main's existing cgroup evidence. Task 8: move the existing gVisor advisory exit label to unitProc.exitLine, based on UnitIdentity. No changes to records, termination proof, stop, or cgroup reads. |
-| `internal/host/sizestatus.go` `readSizeInForce` | sites | -file:Stat | Task 8: remove Stat and generation-name reconstruction/parent fallback; read memory.max only under the host slice and validated retained unit name. Compare against Physical(logical tier) only for FamilyGVisor, return unchanged logical size/shares. Existing agent cgroupfs read, no root or guest-file read. |
| `internal/host/systemapply.go` `systemApplier.stageCandidate` | sites | -file:OpenFile | Pass the already-open regular file fstat size to bounded preflight. Allocate payload once at exactly that size, use ReadFull then confirm EOF; hash and scan those same bytes before staging. Root-owned staged target is still checked before execution. Preserve staging on floor refusal for apply/install-channel. |
Envelopes re-pinned: `.`, `internal/activator`, `internal/demobuild`, `internal/execsandbox`, `internal/host`, `internal/host/units`, `internal/instancectl`, `internal/instanceexec`, `internal/publicrelease`, `internal/status`, `internal/systemdshow`.
@@ -105,6 +105,7 @@ Recorded dispositions, which each change must still satisfy:
- `internal/host/claimunit.go` `claimUnitContent`: authority, task E1,E3. Basis: rev3=PROPOSED-p3;identity=root claim/adoption controller uid 0;basis=adds write permission for exactly the public retry directory only when the root settings reader has verified a complete census and prepared that directory;rev3=census-ruling-agent-start-demo-1;basis=Demo-only ReadWritePaths for instance data/runtime, staged files and root release lock; ordinary rendering unchanged.;rev3=census-ruling-agent-start-demo-1-followups;basis=In demo box mode, declare StateDirectory=carlos-release/private with mode 0700 so systemd creates root-owned release state before namespace setup and keeps it writable. Existing ReadWritePaths and ordinary/claims rendering stay unchanged. No new read site or caller-controlled path.;rev3=census-ruling-agent-start-demo-3;basis=Declare /var/lib/carlos-demo-snapshots as root-owned StateDirectory with mode 0700 only for configured demo boxes, including recovery with admission off. Ordinary claims units retain their original directories. The shared unit template is unchanged from main; no file read is added.
- `internal/host/claimunit.go` `readClaimUnitSettings`: authority, task C,E3,G,J4. Basis: rev3=PROPOSED-p3;identity=root claim/adoption controller uid 0;basis=retains exact no-census unit settings; a claims-enabled complete census prepares the root-owned retry directory before the hardened controller starts;rev3=census-ruling-agent-start-demo-1;basis=Reads worker/concurrency/toolchain settings from the existing host.env parser; requires box mode and refuses claims coexistence.
- `internal/host/layoutleg.go` `layoutStatusReport`: diagnostic, task H3. Basis: no-effect;rev3=census-ruling-instance-egress-sizes-328-329;basis=#329 plan 3 Task 7: each activator-managed instance row gains a Size cell, rowSizeCell(armedSizeSource.Load(), rt.Host, word) (the added registry:Host site), which for an awake nested row reads that host's cgroup memory.max through readSizeInForce (a decision row, in the agent); still a status report with no effect on any decision.;rev3=census-ruling-alias-socket-follow-338;basis=#338: a platform socket row reports alias (aliasLayout) instead of external; reads Platform;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 5: Pass.Held takes the whole route (so a row with a runtime is never reported as held); status display only
+- `internal/host/sizestatus.go` `readSizeInForce`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-instance-egress-sizes-328-329;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=root-input (J4, as readCgroupEvents): new (#329 plan 3 Task 7): os.Stat of the generation unit's cgroup directory and one ReadFile of memory.max under /sys/fs/cgroup/<parent slices>/<SliceName(host)>[/<GenUnitName(host, gen)>] (instancectl's names; host and gen from the agent's own activator state), a kernel file, matched to a size row; called through rowSizeCell from layoutStatusReport, once per awake nested row per 5-minute status tick; runs in the agent, not root; a status cell only; no root decision
- `internal/host/systemapply.go` `systemApplier.install`: authority, task F,J4. Basis: rev3=PROPOSED-p3;identity=carlos system apply, root update unit or offline root CLI, uid 0;basis=root verifies staged signature and final locked bounds before rename, then records root accepted floor history only after health succeeds;rev3=census-ruling-region-ha-p1a;basis=root apply, uid 0: comment and error text only around the beginExecutableChange call (the wrapped error now reads "update not begun" instead of "update-begun marker"); the call, its position before the first box-changing step and the deferral on error are unchanged; no read added;rev3=census-ruling-region-ha-p3b;basis=Require groupTarget for the staged new artifact and propagate quiesce refusal before effects. Root-owned operator permit must authorize digest/action/current boot; existing signed image, floor and journal checks remain; no new direct read.
- `internal/host/systemapply.go` `systemApplier.installUnits`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-agent-start-demo-1;basis=Renders the staged build slice against live root host configuration; preserves it when settings cannot be parsed.;rev3=census-ruling-region-ha-p3b;basis=Require group apply/rollback permit, preserve root Restart=no/nftables drop-in and masks, and skip automatic update/recovery units. Existing staged unit and host.env reads remain; new indirect marker/permit reads are protected and agent receipts are excluded.
- `internal/host/systemapply.go` `systemApplier.restoreFiles`: authority, task F,J4. Basis: rev3=PROPOSED-p3;identity=carlos system apply/recover, root systemd units or offline root CLI, uid 0;basis=selects signed prev identity and checks staged restore against both root bounds before rename; version sidecar cannot authorize;rev3=census-ruling-region-ha-p3b;basis=Authorize exact previous artifact before restore, propagate quiesce refusal and remove automatic group units from enable list. Existing signature/floor and staged plan reads remain; indirect permit must be root-owned and bind old digest/current boot.
@@ -157,7 +158,6 @@ Recorded dispositions, which each change must still satisfy:
- `internal/activator/unitproc.go` `ExecBackend.newRootfsWorkerProc`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W: starts observing the named worker's unit; refused for a binary row and for a name that is no worker's before anything watches; holds no control listener
- `internal/activator/unitproc.go` `ExecBackend.newUnitProcFor`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=the unit is named by unitNameFor(rt, role, gen), one more Route site (+whole:Route), and a role with no unit of the row's kind is refused before anything watches ""; no new read kind and no file read;rev3=census-ruling-region-ha-p1b3b-s;basis=Attach optional per-worker API closers to the existing unit observer before starting it; unit naming and systemd/cgroup proof reads unchanged.
- `internal/activator/unitproc.go` `ExecBackend.observe`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=final fix I3: the process observer's termination proof for a rootfs handle (Runtime, the new kind, one site) goes through unitEvents (two more Route sites): the host slice's cgroup.events and, for a rootfs unit, the group systemd reports when that is elsewhere, so a foreign invocation root placed outside the slice and could not stop is never read as gone from the absent expected path; a failed stop of a foreign invocation leaves it unstopped, asked again next poll, completion pending; a binary handle's proof is unchanged (cgroup.events under the host slice); the agent decides only whether it keeps a handle and a launch file; no root decision; re-digested at the merge of origin/main 3c33f2eb: main's own change to the observer is in the body, this branch's rootfs-aware evidence and the rootfs-only failed-stop retry (merge prep N1: a binary handle behaves exactly as main) on top; the kinds are the union;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W, W1: for a worker handle (p.worker != "") the observer keeps the exit record it read (workerExit, workerExitOK) for the supervisor instead of wording a member event, and says nothing for a replaced-after-stop or restarted-outside end; the termination evidence (cgroup.events via unitEvents, the foreign-invocation rule) and the record's single-use removal are unchanged and apply to a worker as to a generation; a binary or generation handle behaves exactly as before; the same 22 read sites, no read added;rev3=census-ruling-rootfs-worker-exit;basis=an exit record with an empty code (read and bounded as before) is filled by unitMainExitOf before it is kept for a worker or worded for the member; the termination proof (UnitState, cgroup evidence, the foreign-invocation rule) and the record's single-use removal are unchanged; the same 22 read sites, no read added;rev3=census-ruling-region-ha-p1b3b-s;basis=Retain the already-read advisory exit record for native sidecars after the same systemd and cgroup termination proof; crash classification never substitutes for stop proof. No new read source.
-- `internal/host/sizestatus.go` `readSizeInForce`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-instance-egress-sizes-328-329;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=root-input (J4, as readCgroupEvents): new (#329 plan 3 Task 7): os.Stat of the generation unit's cgroup directory and one ReadFile of memory.max under /sys/fs/cgroup/<parent slices>/<SliceName(host)>[/<GenUnitName(host, gen)>] (instancectl's names; host and gen from the agent's own activator state), a kernel file, matched to a size row; called through rowSizeCell from layoutStatusReport, once per awake nested row per 5-minute status tick; runs in the agent, not root; a status cell only; no root decision
- `internal/host/systemapply.go` `systemApplier.stageCandidate`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-region-ha-p3b;basis=Require groupStageDigest before staging/candidate execution; action and new digest come from root-owned operator permit bound to boot marker. Existing signed pointer/artifact verification and two direct read sites remain.
New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
@@ -192,7 +192,7 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/host/runscensure.go:runscSystemctl`: reads +file:CommandContext; written legacy, accepted-legacy, frozen
- new `internal/host/runscensure.go:wireSandboxReadiness`: reads +file:ReadFile; written legacy, accepted-legacy, frozen
- new `internal/host/runscset_linux.go:openRunscLock`: reads +file:Fstat, +file:Open; written legacy, accepted-legacy, frozen
-- new `internal/host/sandboxenv_linux.go:openSandboxHostEnvironment`: reads +file:Openat2; written legacy, accepted-legacy, frozen
+- new `internal/host/sandboxenv_linux.go:openSandboxHostEnvironment`: reads +file:Openat2, +file:Stat; written legacy, accepted-legacy, frozen
- new `internal/host/units/carlos-demo-build-gvisor@.service:external`: reads +file:external; written legacy, accepted-legacy, frozen
- new `internal/host/units/carlos-instance-gvisor-probe.service:external`: reads +file:external; written legacy, accepted-legacy, frozen
- new `internal/host/units/carlos-instance-gvisor@.service:external`: reads +file:external; written legacy, accepted-legacy, frozen
@@ -223,7 +223,7 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- reads `internal/activator/cmdunit.go:cmdUnit.StopAndSettle`: +registry:Runtime ×2, +whole:Route ×2; keeps legacy, task accepted-legacy
- reads `internal/activator/unitproc.go:unitProc.stopUnit`: +registry:Runtime ×2, +whole:Route; keeps legacy, task accepted-legacy
-Seal: `b970bb28c5a633d2572a1da549030e9258cfdabb6322ddffdd0ebf41b56c464c` → `5a30bab7f892e5f37a1f7501d3bc8100a04b1766eb75fe29cec596b7cc058eef`.
+Seal: `b970bb28c5a633d2572a1da549030e9258cfdabb6322ddffdd0ebf41b56c464c` → `3639a17ab5a6d2f6097776026af7792136fb048676d11117180d063cf3738c0e`.
Overlay: `internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
@@ -234,8 +234,14 @@ The read census covers `Server.assertGVisorUnit` through the
The controller's Task 9 ruling ratifies this action. The independent reviewer
must include it when deciding the envelope.
-- `internal/instancectl/gvisorunit.go:Server.assertGVisorUnit` (`internal/instancectl/gvisorunit.go:273`, slice start at line 280): Task 9 ratified slice start: after validating the host-derived slice name and verifying its unit properties, start that host slice with systemctl before the kernel cgroup readback. Starting the run unit would start the same slice; the explicit start makes parent cgroup verification possible rather than skipping it. A refused start may leave an empty root-started host slice, which demo cleanup stops. No tenant-selected unit or new filesystem read.
+- `internal/instancectl/gvisorunit.go:Server.assertGVisorUnit` (`internal/instancectl/gvisorunit.go:274`, slice start at line 281): Task 9 ratified slice start: after validating the host-derived slice name and verifying its unit properties, start that host slice with systemctl before the kernel cgroup readback. Starting the run unit would start the same slice; the explicit start makes parent cgroup verification possible rather than skipping it. A refused start may leave an empty root-started host slice, which demo cleanup stops. No tenant-selected unit or new filesystem read.
This claim is retained as an envelope-only comment in the cumulative CLAIMS
file because census-propose rejects a standalone claim for a unit with no
read-census change. Reproduce this section after regenerating the card.
+
+## Pre-merge fixwave envelope claims
+
+- `internal/execsandbox/command.go:RunscRunArgs`, `internal/instancectl/gvisorunit.go:gvisorCommands`, `internal/demobuild/gvisor.go:gvisorBuildCommands`: one constructor supplies the unchanged runsc start argv to the writers and their readback verifiers. No flags or stop commands changed.
+- `internal/execsandbox/lock.go:RunscMemberAssetName` and `RunscObjectKey`, `internal/publicrelease/runsc.go:RunscMemberAssetName`: flattened release asset names and object-key suffixes use the same allowlist. Unsupported platforms and members still return no name.
+- `internal/publicrelease/feed.go:Feed.AssetWithSums` and `Feed.OptionalAsset`: download bounds and digest verification are preserved while allowing all runtime members to use one verified manifest. The console mirror compares downloaded hashes with that manifest; it never accepts replacement bytes under a changed release. Strict signed-list parsers are unchanged. No new filesystem read or write authority.
diff --git a/internal/console/runscmirror.go b/internal/console/runscmirror.go
index 75e26418a..7c056aee4 100644
--- a/internal/console/runscmirror.go
+++ b/internal/console/runscmirror.go
@@ -27,11 +27,11 @@ func (s *Server) mirrorRunscRelease(ctx context.Context, feed publicrelease.Feed
}
for _, member := range pin.Files {
asset := publicrelease.RunscMemberAssetName(platform, member.Path)
- data, sha, present, err := feed.OptionalAsset(ctx, tag, asset, systemAssetMaxBytes)
+ data, sha, err := feed.AssetWithSums(ctx, tag, asset, systemAssetMaxBytes, sums)
if err != nil {
return err
}
- if !present || sha != member.SHA256 {
+ if sha != member.SHA256 {
return fmt.Errorf("%s: runtime checksum list changed during mirror", asset)
}
if err := s.mirrorRunscArtifact(ctx, platform, pin, member.Path, data, sha); err != nil {
diff --git a/internal/console/runscmirror_test.go b/internal/console/runscmirror_test.go
index d8c5f2607..ea28dd199 100644
--- a/internal/console/runscmirror_test.go
+++ b/internal/console/runscmirror_test.go
@@ -178,3 +178,54 @@ func (tr runscFeedTransport) RoundTrip(r *http.Request) (*http.Response, error)
}
return res, err
}
+
+type runscCountingTransport func(*http.Request) (*http.Response, error)
+
+func (f runscCountingTransport) RoundTrip(r *http.Request) (*http.Response, error) { return f(r) }
+
+func TestRunscMirrorUsesOneVerifiedManifest(t *testing.T) {
+ for _, kind := range []string{"present", "historical", "changed-during-mirror"} {
+ t.Run(kind, func(t *testing.T) {
+ fx := newConsoleFixture(t)
+ assets, _ := runscReleaseFixture(t, "linux-arm64")
+ if kind == "historical" {
+ assets = map[string][]byte{"carlos-linux-arm64": []byte("old release")}
+ }
+ systemFeed(t, fx, assets)
+ requests := map[string]int{}
+ fx.srv.cfg.SystemFeed.Client = &http.Client{Transport: runscCountingTransport(func(r *http.Request) (*http.Response, error) {
+ name := r.URL.Path[strings.LastIndex(r.URL.Path, "/")+1:]
+ requests[name]++
+ if (name == "SHA256SUMS.txt" || name == "SHA256SUMS.txt.sig") && requests[name] > 1 {
+ return nil, fmt.Errorf("manifest fetched twice")
+ }
+ res, err := http.DefaultTransport.RoundTrip(r)
+ if err == nil && kind == "changed-during-mirror" && name == "runsc-linux-arm64" {
+ res.Body.Close()
+ res.Body = io.NopCloser(strings.NewReader("replacement release runtime"))
+ }
+ return res, err
+ })}
+ err := fx.srv.mirrorRunscRelease(t.Context(), fx.srv.cfg.SystemFeed, "v0.18.0", "linux-arm64")
+ if kind == "changed-during-mirror" {
+ if err == nil || !strings.Contains(err.Error(), "signed checksum") {
+ t.Fatalf("changed runtime: %v", err)
+ }
+ } else if err != nil {
+ t.Fatal(err)
+ }
+ if requests["SHA256SUMS.txt"] != 1 || requests["SHA256SUMS.txt.sig"] != 1 {
+ t.Fatalf("manifest requests: %v", requests)
+ }
+ for name := range assets {
+ want := 1
+ if kind == "historical" {
+ want = 0
+ }
+ if requests[name] != want {
+ t.Fatalf("%s requests=%d want %d", name, requests[name], want)
+ }
+ }
+ })
+ }
+}
diff --git a/internal/demobuild/gvisor.go b/internal/demobuild/gvisor.go
index fa6be1d39..a6833e23d 100644
--- a/internal/demobuild/gvisor.go
+++ b/internal/demobuild/gvisor.go
@@ -101,13 +101,14 @@ func gvisorBuildCommands(l buildLayout) (map[string][]buildCommand, error) {
if err != nil {
return nil, err
}
- path := execsandbox.RunscPath(pin)
- if path == "" || !execsandbox.ValidID(l.id) {
+ run, err := execsandbox.RunscRunArgs(pin, l.id)
+ if err != nil {
return nil, ErrBuild
}
+ path := execsandbox.RunscPath(pin)
return map[string][]buildCommand{
"ExecStartPre": {{[]string{path, "--root=/run/carlos-runsc", "delete", "-force", l.id}, true}},
- "ExecStart": {{[]string{path, "--root=/run/carlos-runsc", "--ignore-cgroups", "--network=none", "--host-uds=create", "--overlay2=none", "run", "--bundle", execsandbox.BundleDir(l.id), l.id}, false}},
+ "ExecStart": {{run, false}},
"ExecStopPost": {{[]string{path, "--root=/run/carlos-runsc", "delete", "-force", l.id}, true}},
}, nil
}
diff --git a/internal/demobuild/gvisor_test.go b/internal/demobuild/gvisor_test.go
index c6a0b1701..5cabec1a3 100644
--- a/internal/demobuild/gvisor_test.go
+++ b/internal/demobuild/gvisor_test.go
@@ -217,6 +217,14 @@ func TestGVisorBuildUnitReadback(t *testing.T) {
if err != nil {
t.Fatal(err)
}
+ pin, err := execsandbox.RunscFor(runtime.GOOS + "-" + runtime.GOARCH)
+ if err != nil {
+ t.Fatal(err)
+ }
+ start := "ExecStart=" + execsandbox.RunscPath(pin) + " --root=/run/carlos-runsc --ignore-cgroups --network=none --host-uds=create --overlay2=none run --bundle /run/carlos-control/oci/" + l.id + " " + l.id + "\n"
+ if !strings.Contains(drop, start) {
+ t.Fatalf("changed build recipe: %s", drop)
+ }
if err = gvisorBuildSource(drop, l); err != nil {
t.Fatal(err)
}
diff --git a/internal/execsandbox/command.go b/internal/execsandbox/command.go
new file mode 100644
index 000000000..4c9d8e7b3
--- /dev/null
+++ b/internal/execsandbox/command.go
@@ -0,0 +1,9 @@
+package execsandbox
+
+func RunscRunArgs(pin RunscPin, id string) ([]string, error) {
+ runsc := RunscPath(pin)
+ if runsc == "" || !ValidID(id) {
+ return nil, ErrRunsc
+ }
+ return []string{runsc, "--root=/run/carlos-runsc", "--ignore-cgroups", "--network=none", "--host-uds=create", "--overlay2=none", "run", "--bundle", BundleDir(id), id}, nil
+}
diff --git a/internal/execsandbox/command_test.go b/internal/execsandbox/command_test.go
new file mode 100644
index 000000000..fbfe795f6
--- /dev/null
+++ b/internal/execsandbox/command_test.go
@@ -0,0 +1,28 @@
+package execsandbox
+
+import (
+ "reflect"
+ "testing"
+)
+
+func TestRunscRunArgs(t *testing.T) {
+ pin, err := RunscFor("linux-arm64")
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, id := range []string{"run-demo.example", "probe", "build-job-1"} {
+ got, err := RunscRunArgs(pin, id)
+ want := []string{RunscPath(pin), "--root=/run/carlos-runsc", "--ignore-cgroups", "--network=none", "--host-uds=create", "--overlay2=none", "run", "--bundle", "/run/carlos-control/oci/" + id, id}
+ if err != nil || !reflect.DeepEqual(got, want) {
+ t.Fatalf("%s: %q %v; want %q", id, got, err, want)
+ }
+ }
+ for _, id := range []string{"", "../probe", "bad id", "%i"} {
+ if _, err := RunscRunArgs(pin, id); err == nil {
+ t.Fatalf("accepted ID %q", id)
+ }
+ }
+ if _, err := RunscRunArgs(RunscPin{}, "probe"); err == nil {
+ t.Fatal("accepted invalid pin")
+ }
+}
diff --git a/internal/execsandbox/lock.go b/internal/execsandbox/lock.go
index 4f6f8ceff..657737b14 100644
--- a/internal/execsandbox/lock.go
+++ b/internal/execsandbox/lock.go
@@ -177,12 +177,20 @@ func RunscDir(pin RunscPin) string {
func RunscObjectKey(platform string, pin RunscPin, member string) string {
id := pin.SetID()
- if (platform != "linux-arm64" && platform != "linux-amd64") || id == "" {
+ asset := RunscMemberAssetName(platform, member)
+ if asset == "" || id == "" {
+ return ""
+ }
+ return "bootstrap/router/runsc-" + id + "/" + asset
+}
+
+func RunscMemberAssetName(platform, member string) string {
+ if platform != "linux-arm64" && platform != "linux-amd64" {
return ""
}
for _, f := range runscMembers {
if member == f.path {
- return "bootstrap/router/runsc-" + id + "/" + f.asset + "-" + platform
+ return f.asset + "-" + platform
}
}
return ""
diff --git a/internal/host/claimunit.go b/internal/host/claimunit.go
index c8f35abfc..b84640416 100644
--- a/internal/host/claimunit.go
+++ b/internal/host/claimunit.go
@@ -98,16 +98,18 @@ func readClaimUnitSettings(path string) (settings claimUnitSettings, readErr err
if err != nil {
return claimUnitSettings{}, err
}
- _, cfg.sandbox, err = execsandbox.ResolveFromEnv(func(k string) string { return values[k] })
- if err != nil {
- return claimUnitSettings{}, err
- }
if values["CARLOS_DEMO_BUILD_WORKER"] != "" {
worker, e := demo.LoadConfig(func(k string) string { return values[k] })
if e != nil || !cfg.demo.BoxMode() || cfg.enabled {
return claimUnitSettings{}, demo.ErrConfig
}
cfg.demo.BuildWorker, cfg.demo.BuildConcurrency, cfg.demo.ToolchainDir = worker.BuildWorker, worker.BuildConcurrency, worker.ToolchainDir
+ if cfg.demo.BuildWorker {
+ _, cfg.sandbox, err = execsandbox.ResolveFromEnv(func(k string) string { return values[k] })
+ if err != nil {
+ return claimUnitSettings{}, err
+ }
+ }
}
if cfg.data == "" {
cfg.data = "/data"
diff --git a/internal/host/claimunit_test.go b/internal/host/claimunit_test.go
index 61c967cdb..12faff98f 100644
--- a/internal/host/claimunit_test.go
+++ b/internal/host/claimunit_test.go
@@ -81,7 +81,7 @@ func TestClaimControlUnitInstallers(t *testing.T) {
"EnvironmentFile": {"-/etc/carlos/host.env"},
"StateDirectory": {"carlos-claims"},
"StateDirectoryMode": {"0700"},
- "ReadWritePaths": {"/run/carlos-control /run/carlos /var/lib/carlos-claims /var/lib/carlos-release/private /run/systemd/system /data /opt/carlos /etc/systemd/system /sys/fs/cgroup"},
+ "ReadWritePaths": {"/run/carlos-control /run/carlos /var/lib/carlos-claims /var/lib/carlos-release/private /run/systemd/system /data /opt/carlos /etc/systemd/system /sys/fs/cgroup", "/var/lib/carlos/oci-rootfs"},
"RestrictAddressFamilies": {"AF_UNIX AF_INET AF_INET6"},
"ProtectSystem": {"strict"},
"ProtectHome": {"yes"},
@@ -327,3 +327,46 @@ func TestDemoSnapshotDirectoryOnlyOnDemoBoxes(t *testing.T) {
}
}
}
+
+func TestClaimUnitSettingsSandboxOnlyForBuildWorker(t *testing.T) {
+ for _, tc := range []struct {
+ name, raw string
+ refused bool
+ }{
+ {"ordinary", "", false},
+ {"claim", "CARLOS_HOST_CLAIM=1\nCARLOS_DATA_DIR=/custom-data\nCARLOS_OPT_DIR=/custom-opt\n", false},
+ {"demo without worker", "CARLOS_DEMO_BOX=1\nCARLOS_DEMO_ACCOUNT=shop\nCARLOS_DEMO_FLEET=demo\nCARLOS_DEMO_DOMAIN=example.com\n", false},
+ {"demo worker", "CARLOS_DEMO_BOX=1\nCARLOS_DEMO_ACCOUNT=shop\nCARLOS_DEMO_FLEET=demo\nCARLOS_DEMO_DOMAIN=example.com\nCARLOS_DEMO_BUILD_WORKER=1\nCARLOS_DEMO_TOOLCHAIN_DIR=/opt/demo-toolchain\n", true},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ path := filepath.Join(t.TempDir(), "host.env")
+ if err := os.WriteFile(path, []byte(tc.raw), 0600); err != nil {
+ t.Fatal(err)
+ }
+ baseline, err := readClaimUnitSettings(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(path, []byte(tc.raw+"CARLOS_EXEC_SANDBOX=invalid\n"), 0600); err != nil {
+ t.Fatal(err)
+ }
+ got, err := readClaimUnitSettings(path)
+ if tc.refused {
+ if err == nil {
+ t.Fatal("build worker accepted invalid sandbox mode")
+ }
+ return
+ }
+ if err != nil || !reflect.DeepEqual(got, baseline) {
+ t.Fatalf("settings = %+v, %v; want %+v", got, err, baseline)
+ }
+ raw, err := unitsFS.ReadFile("units/" + claimControlUnit)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !bytes.Equal(claimUnitContent(claimControlUnit, raw, got), claimUnitContent(claimControlUnit, raw, baseline)) {
+ t.Fatal("invalid sandbox changed claim rendering")
+ }
+ })
+ }
+}
diff --git a/internal/host/execsandboxstatus_test.go b/internal/host/execsandboxstatus_test.go
index f151d6039..9c7e7f858 100644
--- a/internal/host/execsandboxstatus_test.go
+++ b/internal/host/execsandboxstatus_test.go
@@ -78,7 +78,7 @@ func TestGVisorSizeInForce(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
root := t.TempDir()
slice := filepath.Join(root, instancectl.SliceControlGroup(host))
- unit := instancectl.UnitName(instancectl.RoleRun, host)
+ unit := instancectl.GenUnitName(host, 2)
if tc.family == execsandbox.FamilyGVisor {
unit = instancectl.GVisorUnitName(host)
}
diff --git a/internal/host/sandboxenv_linux.go b/internal/host/sandboxenv_linux.go
index 8cc25d67e..b1d991cc8 100644
--- a/internal/host/sandboxenv_linux.go
+++ b/internal/host/sandboxenv_linux.go
@@ -5,6 +5,7 @@ package host
import (
"os"
+ "github.com/carlosframework/platform/internal/execsandbox"
"golang.org/x/sys/unix"
)
@@ -18,5 +19,15 @@ func openSandboxHostEnvironment(path string) (*os.File, error) {
if err != nil {
return nil, &os.PathError{Op: "open", Path: path, Err: err}
}
- return os.NewFile(uintptr(fd), path), nil
+ f := os.NewFile(uintptr(fd), path)
+ info, err := f.Stat()
+ if err != nil {
+ f.Close()
+ return nil, err
+ }
+ if !info.Mode().IsRegular() {
+ f.Close()
+ return nil, execsandbox.ErrConfig
+ }
+ return f, nil
}
diff --git a/internal/host/sandboxenv_linux_test.go b/internal/host/sandboxenv_linux_test.go
new file mode 100644
index 000000000..87fd1ff66
--- /dev/null
+++ b/internal/host/sandboxenv_linux_test.go
@@ -0,0 +1,44 @@
+//go:build linux
+
+package host
+
+import (
+ "errors"
+ "os"
+ "path/filepath"
+ "testing"
+
+ "github.com/carlosframework/platform/internal/execsandbox"
+ "golang.org/x/sys/unix"
+)
+
+func TestExecSandboxHostEnvironmentRegularFile(t *testing.T) {
+ for _, kind := range []string{"fifo", "directory"} {
+ t.Run(kind, func(t *testing.T) {
+ path := filepath.Join(t.TempDir(), "host.env")
+ var err error
+ if kind == "fifo" {
+ err = unix.Mkfifo(path, 0600)
+ } else {
+ err = os.Mkdir(path, 0700)
+ }
+ if err != nil {
+ t.Fatal(err)
+ }
+ f, err := openSandboxHostEnvironment(path)
+ if f != nil {
+ f.Close()
+ }
+ if err == nil {
+ t.Error("opener accepted non-regular host.env")
+ }
+ a := systemApplier{sandboxEnvironment: func() (func(string) string, error) {
+ return sandboxHostEnvironmentAt(path)
+ }}
+ mode, err := a.sandboxMode()
+ if mode != execsandbox.EffectiveGVisor || !errors.Is(err, errExecSandboxFloor) {
+ t.Fatalf("floor = %s, %v; want strict refusal", mode, err)
+ }
+ })
+ }
+}
diff --git a/internal/host/sizestatus.go b/internal/host/sizestatus.go
index 31d24003c..2d4acd781 100644
--- a/internal/host/sizestatus.go
+++ b/internal/host/sizestatus.go
@@ -1,6 +1,7 @@
package host
import (
+ "errors"
"os"
"path/filepath"
"strconv"
@@ -57,15 +58,27 @@ func noteSizeChanged(host string) {
}
}
-// readSizeInForce reads the retained unit's memory limit from cgroupfs.
-// Missing identity or an unreadable unit is unknown; the parent may hold a
-// swap budget. Only gVisor units include runtime overhead in their limit.
+// readSizeInForce reads gVisor limits from the retained unit. Native runs use
+// the slice unless a generation cgroup exists; that cgroup holds the serving
+// limit while the slice may hold a swap budget. Only gVisor adds overhead.
func readSizeInForce(cgroupRoot, host, unit string, sandbox execsandbox.Family) (cgroup.Size, bool) {
family, valid := instancectl.UnitFamily(unit)
if !valid || family != sandbox {
return cgroup.Size{}, false
}
dir := filepath.Join(cgroupRoot, instancectl.SliceControlGroup(host), unit)
+ if sandbox == execsandbox.FamilySystemd {
+ slice := filepath.Dir(dir)
+ _, _, gen := instancectl.ParseGenUnitName(unit)
+ _, _, rootfsGen := instancectl.ParseRootfsGenUnitName(unit)
+ if !gen && !rootfsGen {
+ dir = slice
+ } else if _, err := os.Stat(dir); errors.Is(err, os.ErrNotExist) {
+ dir = slice
+ } else if err != nil {
+ return cgroup.Size{}, false
+ }
+ }
b, err := os.ReadFile(filepath.Join(dir, "memory.max"))
if err != nil {
return cgroup.Size{}, false
diff --git a/internal/host/sizestatus_test.go b/internal/host/sizestatus_test.go
index 21b03ffc9..3a4c2a252 100644
--- a/internal/host/sizestatus_test.go
+++ b/internal/host/sizestatus_test.go
@@ -104,10 +104,14 @@ func TestReadSizeInForcePrefersTheServingUnit(t *testing.T) {
ok bool
}{
{"the serving unit", 2, "large", true},
- {"no unit directory: unknown", 3, "", false},
- {"no generation: unknown", 0, "", false},
+ {"no unit directory: the slice", 3, "xlarge", true},
+ {"no generation: the slice", 0, "xlarge", true},
} {
- got, ok := readSizeInForce(root, host, instancectl.GenUnitName(host, c.gen), execsandbox.FamilySystemd)
+ unit := instancectl.GenUnitName(host, c.gen)
+ if c.gen == 0 {
+ unit = instancectl.UnitName(instancectl.RoleRun, host)
+ }
+ got, ok := readSizeInForce(root, host, unit, execsandbox.FamilySystemd)
if ok != c.ok || got.Name != c.want {
t.Errorf("%s: readSizeInForce(gen %d) = %q, %v; want %q, %v", c.name, c.gen, got.Name, ok, c.want, c.ok)
}
@@ -172,7 +176,8 @@ func TestLayoutReportCarriesSize(t *testing.T) {
)
writeMemoryMax(t, filepath.Join(root, instancectl.SliceControlGroup(serving)), "2147483648")
writeMemoryMax(t, filepath.Join(root, instancectl.SliceControlGroup(serving), instancectl.GenUnitName(serving, 2)), "1073741824")
- writeMemoryMax(t, filepath.Join(root, instancectl.SliceControlGroup(growing), instancectl.UnitName(instancectl.RoleRun, growing)), "536870912")
+ writeMemoryMax(t, filepath.Join(root, instancectl.SliceControlGroup(growing)), "536870912")
+ writeMemoryMax(t, filepath.Join(root, instancectl.SliceControlGroup(growing), instancectl.UnitName(instancectl.RoleRun, growing)), "max")
writeMemoryMax(t, filepath.Join(root, instancectl.SliceControlGroup(swapped)), "1610612736")
large, xlarge, standard := mustSizeNamed(t, "large"), mustSizeNamed(t, "xlarge"), mustSizeNamed(t, "standard")
svc := &fakeSizeStater{states: map[string]activator.SizeState{
diff --git a/internal/instancectl/gvisor_fix1_test.go b/internal/instancectl/gvisor_fix1_test.go
index 5fb0775f3..2a066a0d9 100644
--- a/internal/instancectl/gvisor_fix1_test.go
+++ b/internal/instancectl/gvisor_fix1_test.go
@@ -147,6 +147,10 @@ func TestGVisorFix1StaleStateRecipe(t *testing.T) {
t.Fatal(err)
}
want := "ExecStartPre=-" + execsandbox.RunscPath(pin) + " --root=/run/carlos-runsc delete -force " + id + "\n"
+ start := "ExecStart=" + execsandbox.RunscPath(pin) + " --root=/run/carlos-runsc --ignore-cgroups --network=none --host-uds=create --overlay2=none run --bundle /run/carlos-control/oci/" + id + " " + id + "\n"
+ if !strings.Contains(source, start) {
+ t.Fatalf("changed run recipe: %s", source)
+ }
if !strings.Contains(source, want) {
t.Fatalf("missing stale-state recipe: %s", source)
}
diff --git a/internal/instancectl/gvisorunit.go b/internal/instancectl/gvisorunit.go
index ce6eb08e9..5266fa412 100644
--- a/internal/instancectl/gvisorunit.go
+++ b/internal/instancectl/gvisorunit.go
@@ -32,13 +32,14 @@ func gvisorCommands(pin execsandbox.RunscPin, host string, role Role) (map[strin
if err != nil {
return nil, err
}
- runsc := execsandbox.RunscPath(pin)
- if runsc == "" {
- return nil, execsandbox.ErrRunsc
+ run, err := execsandbox.RunscRunArgs(pin, id)
+ if err != nil {
+ return nil, err
}
+ runsc := execsandbox.RunscPath(pin)
commands := map[string][]gvisorCommand{
"ExecStartPre": {{Args: []string{runsc, "--root=/run/carlos-runsc", "delete", "-force", id}, Ignore: true}},
- "ExecStart": {{Args: []string{runsc, "--root=/run/carlos-runsc", "--ignore-cgroups", "--network=none", "--host-uds=create", "--overlay2=none", "run", "--bundle", execsandbox.BundleDir(id), id}}},
+ "ExecStart": {{Args: run}},
"ExecStop": {{Args: []string{runsc, "--root=/run/carlos-runsc", "kill", id, "TERM"}, Ignore: true}},
"ExecStopPost": {{Args: []string{runsc, "--root=/run/carlos-runsc", "delete", "-force", id}}},
}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 0a87b1ded..e6fde6f9a 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -128,4 +128,4 @@ plan14-root-reads-fix-activator-backoff-flake.tsv feba66806ddfcbdfaf369d72413bb1
plan14-root-reads-region-ha-dr5.tsv f19eb78c1da1475cbf8e11a3d6c394d828aa1c8f88ae24469fe8d473581b934b
plan14-root-reads-instance-syscall-filter.tsv b970bb28c5a633d2572a1da549030e9258cfdabb6322ddffdd0ebf41b56c464c
plan14-root-reads-instance-restore-658-cli.tsv b970bb28c5a633d2572a1da549030e9258cfdabb6322ddffdd0ebf41b56c464c
-plan14-root-reads-gvisor-demos.tsv 5a30bab7f892e5f37a1f7501d3bc8100a04b1766eb75fe29cec596b7cc058eef
+plan14-root-reads-gvisor-demos.tsv 3639a17ab5a6d2f6097776026af7792136fb048676d11117180d063cf3738c0e
diff --git a/internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv b/internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv
index 601b8b058..9d28f42c6 100644
--- a/internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv
+++ b/internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv
@@ -1,5 +1,5 @@
# Census overlay gvisor-demos, written by census-propose (#369). census-ruling-gvisor-demos, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-gvisor-demos.md.
-# 40 body, 34 sites, 11 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 41 body, 33 sites, 11 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
# 60 new dispositions: 4 reads re-frozen at their disposition with the claim, 55 new units frozen accepted-legacy, 1 quiet units retired while they read nothing, 0 other.
@legacy c704be8adc98ef362ac25f0ee4916e4bd6b7d636fbf3e62a068643790aadc9eb internal/activator/backend_unit.go UnitBackend.systemctl legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-gvisor-demos;basis=Task 5: gate launch using startup-captured mode and existing route/role/layout before preparation or execution; migrate structured root start identity and reject mismatches. Unsupported gVisor paths refuse; native behavior and existing root authority checks retained. No new root read source. file:CommandContext@332 fc3481b0f6f5410479d649b20bed2f0870bf574e67d5b00e6e47bd6262036c1b
@legacy bba784d6c5913e5483457620b8c6b0cea30cef7eaa19954b148cea75d1a944ae internal/activator/sidecar_ha.go ExecBackend.startHAWorker legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-s;basis=Require nested HA sidecar shape and closed worker identity environment; prepare and acknowledge sealed secrets before writing the existing run launch file. Start the previously verified staged executable through existing root StartExe, mark uncertain starts for stop proof, and observe the same run unit. No health dial or new root verb.;rev3=census-ruling-gvisor-demos;basis=Task 5: migrate structured root start identity, validate binding, retain actual unit for observation/exit/stop. Unknown worker response retains only a cleanup request and listener, never a guessed observed identity. Existing route/control/cgroup inputs; no new root read. registry:Host@1355,registry:Host@1391,registry:Host@2005,registry:Host@270,registry:Host@320,whole:Route@1049,whole:Route@1433,whole:Route@1504,whole:Route@1637,whole:Route@1692,whole:Route@184,whole:Route@2048,whole:Route@853 f90fb0c55c16840a832498cd96ffdbf8bbc3bc8adca210372a731679afb36edd
@@ -15,6 +15,7 @@
@legacy d68f57a99720c08726d3480bb962429d1d394a565909643a48477a017480f17a internal/demobuild/unit.go var systemctl legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-1;basis=Executes fixed /usr/bin/systemctl with a scrubbed fixed environment and bounded output; callers supply platform-derived unit names and fixed operations for offline build supervision.;rev3=census-ruling-gvisor-demos;basis=Task 9: Preserve fixed executable/environment/arguments/bounded output; attach captured output to internal errors for root logging before sanitization. file:CommandContext@82 aaf08a85aa93e16188d049610d8660ee984fd4d28bf2cd72e6699075754f687d
@legacy 95c151f83a7a2ce229c6c79b5ccd19e90101ce4ffe50a84b58557538b91f33da internal/demobuild/worker.go NewWorker legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-1;basis=Wires existing root-owned recovery into cleanup retry; existing bundle/root reads unchanged.;rev3=census-ruling-agent-start-demo-3;basis=Start with snapshot recovery poisoned; builder readiness stays closed until orphan helper cleanup succeeds. Census read-site delta: unchanged (1).;rev3=census-ruling-gvisor-demos;basis=Task 7: capture only fixed policy from the supplied roleBuild callback; readiness remains per-build and during the selected-family probe. Existing root directory checks and lock unchanged. file:Stat@1419 71be598c63a7ba7e62e90905ae6b1d5b29fe79946ca7c1f814c55916bdb84f5a
@legacy 4ef93c4470151048cf05dc69a2c0c2375a4f25b65e6af8c33ab740705a6b33b5 internal/host/bootstrap.go bootstrapWithGroup legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3b;basis=Move bootstrapWith body here, retaining host.env, embedded unit reads and tmpfiles execution. Group live caller holds root mutation guard; skip automatic update/recovery units, preserve Restart=no/nftables drop-in and masks, and write separate root-owned /run/carlos-group-maintenance tmpfiles rule outside service ownership walk. No agent receipt read.;rev3=census-ruling-gvisor-demos;basis=Create the rootfs parent at 0700 and runtime root at 0755. Existing host.env/unit reads unchanged; workload templates remain unarmed. file:Command@12057,file:ReadFile@564,file:ReadFile@7111 2710b4ae0c444e7742e91dfffc6c136a698927eb62c42eae7cfc4eb1b06d2453
+@legacy f1870fa6be772479ce2bde89b3b1163e12d422a294ed4ba6151d89d87764ff74 internal/host/sizestatus.go readSizeInForce legacy accepted-legacy accepted-legacy;rev3=census-ruling-instance-egress-sizes-328-329;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=root-input (J4, as readCgroupEvents): new (#329 plan 3 Task 7): os.Stat of the generation unit's cgroup directory and one ReadFile of memory.max under /sys/fs/cgroup/<parent slices>/<SliceName(host)>[/<GenUnitName(host, gen)>] (instancectl's names; host and gen from the agent's own activator state), a kernel file, matched to a size row; called through rowSizeCell from layoutStatusReport, once per awake nested row per 5-minute status tick; runs in the agent, not root; a status cell only; no root decision;rev3=census-ruling-gvisor-demos;basis=Task 8 and pre-merge fixwave: validate retained unit family; gVisor reads only its retained unit memory.max and matches Physical(logical tier), with no fallback. Restore main native semantics: generation-0 reads the host slice, a retained generation uses its cgroup when present and falls back only if its directory is absent. Stat of the native retained generation directory is restored; unreadable/malformed existing unit limits remain unknown. Return unchanged logical size/shares. Existing agent cgroupfs paths, no guest-file read. file:ReadFile@676,file:Stat@540 7c87403b9e10061ec4e8317856b7fac1abb5e633aa6522bf2030cc803293307b
@legacy ef8c8c20a6fd6daec8dc2c84b454a0cb05e9fc604300a1d3098f843ae5b6b67a internal/host/systemapply.go systemApplier.installUnits legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-agent-start-demo-1;basis=Renders the staged build slice against live root host configuration; preserves it when settings cannot be parsed.;rev3=census-ruling-region-ha-p3b;basis=Require group apply/rollback permit, preserve root Restart=no/nftables drop-in and masks, and skip automatic update/recovery units. Existing staged unit and host.env reads remain; new indirect marker/permit reads are protected and agent receipts are excluded.;rev3=census-ruling-gvisor-demos;basis=Create rootfs/runtime parent directories before controller restart. Existing staged unit and root-owned host.env reads unchanged. file:ReadDir@1509,file:ReadFile@1060,file:ReadFile@2100,file:ReadFile@5135,file:Stat@2758,file:Stat@4051 f20ce9ef05e19ccb08e68d7c7935aaf20175892fa2616c794ac6adad5303a8a8
@legacy 396d3405311b55e3a1a748760a780bf8688577abacc3317cda791764969f5d74 internal/host/systemapply.go systemApplier.stagePlan legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-region-ha-p3b;basis=Require groupExecutable before staged bootstrap execution, matching the authorized old/new artifact through existing no-follow slot checks. New indirect marker/permit reads are root-protected; staged path still subject to existing release verification, direct read site unchanged.;rev3=census-ruling-gvisor-demos;basis=Require sandbox awareness before clearing or creating staged unit plan and invoking bootstrap. No added direct read. file:ReadDir@710 29ad3b5339fafc83341b78d5d9542c36c7919e9258aa7ac2df6a723f2c888241
@legacy 829fe6967598655fabebc39453c95135bfb8104fbf8b30f1292eea05b8064661 internal/host/systemunits.go ensureSystemUnitsWithGuard legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3b;basis=Move unit-repair body here with existing lock/unit/host.env reads; under lock require operator repair permit on groups before writes and each systemctl effect, preserve root masks/drop-in and omit automatic update/recovery units. New indirect protected marker/permit reads, never agent receipt; fixed repair unchanged.;rev3=census-ruling-gvisor-demos;basis=Create runtime/rootfs directories and repair installer plus three measured workload templates without arming them. Existing unit/host.env reads unchanged. file:OpenFile@293,file:ReadFile@4842,file:ReadFile@4975,file:ReadFile@6379,file:Stat@4751 a089332bfe4c82bdb92dbd23bca60fd1e643eeac4712fe9189cc42ff1d086ca8
@@ -57,7 +58,7 @@
@legacy 162c1096b241d3681b0a32f8a50b9f13beccb7ea6a15c1121a309bbc6e2cce29 internal/host/runscensure.go runscSystemctl legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Execute systemctl with fixed enumeration/start verbs and root-generated unit names, context bounded. No shell or request-provided executable. file:CommandContext@88 16614091a159f92b0575ac6980a90e468c50936662d6f1016425b4080951468e
@legacy 89850dae525cb323ac5284d111ad6b2a490e170d07c67145ea2944da427f9fc8 internal/host/runscensure.go wireSandboxReadiness legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read exact embedded recovery unit and bind host baseline plus compiled-pin verification callbacks. No installed unit data enters instancectl imports. file:ReadFile@85 e46e312a601c7e91da51d537c8ebb580c2c59630f8608d5a65da5a4352245c0e
@legacy 35a5420f20da576cdf58faa3263996e80ee6626aa488ce7ebcd1e9c6957a4306 internal/host/runscset_linux.go openRunscLock legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Open fixed installer lock under checked root runtime directory with O_NOFOLLOW; fstat root owner, single-link regular and private mode before flock. file:Fstat@264,file:Open@64 d44bfa3ce6f1e0bc68c2671ed5604044412de4e6f82b488436d119ee71b81d68
-@legacy cc38e6f633e162e87204491353a29cf019b1b3716c9e082ddfd83b1e51d7ab3e internal/host/sandboxenv_linux.go openSandboxHostEnvironment legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 3 fix round 2, explicit user ruling: open the fixed production host.env path with Openat2 O_RDONLY/O_NOFOLLOW/O_NONBLOCK/O_CLOEXEC and RESOLVE_NO_SYMLINKS for all ancestors. No owner, permission-mode or link-count check; caller enforces 1 MiB cap. This exception is confined to EnvironmentFile authority, not executable/runtime verification. file:Openat2@77 a57adab592aaaf247971a7556724f6e7cfb56090dcbb8ca9173bc21248c03f4d
+@legacy a7d9036733d29b3dc73409199f6564c98641a3b21fb3f37281141ab51db7ecfb internal/host/sandboxenv_linux.go openSandboxHostEnvironment legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 3 fix round 2, explicit user ruling, plus pre-merge fixwave: open the fixed production host.env path with Openat2 O_RDONLY/O_NOFOLLOW/O_NONBLOCK/O_CLOEXEC and RESOLVE_NO_SYMLINKS for all ancestors, then fstat that descriptor and require a regular file. FIFO, directory or failed stat returns an error, preserving the strict floor. No owner, permission-mode or link-count check; caller enforces 1 MiB cap. This exception is confined to EnvironmentFile authority, not executable/runtime verification. file:Openat2@77,file:Stat@378 1e72fe1a6c8ff0dc39d331ca47301ca9e580700d65488ae8bd16adc1d9f2129d
@legacy 7ce6741a7508b1a64de66d58ea342ff1ac4f4093c73a94e8e211949a574fca23 internal/host/units/carlos-demo-build-gvisor@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Add the unarmed root gVisor build skeleton with empty ExecStart, all twelve measured properties, control-group termination and fixed physical budgets. Host LimitFSIZE is omitted by ruling; guest OCI limit remains 33554432 and passed EFBIG measurement. Root prepares validated per-job writable paths, append diagnostics and runtime commands later; template output defaults remain null. file:external@0 8b6f939424c554aaf1e5ed38111ebd0bf67fdcbaaa5bc6415df55affb64ba17a
@legacy 1cb2a2b1f667f42c1b24eb4997c20b5ecc00a9571d92060dedfada948e8a0f5d internal/host/units/carlos-instance-gvisor-probe.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Add the unarmed root gVisor probe skeleton with empty ExecStart, all twelve measured properties, fixed probe data/run paths, append output and mixed kill with SIGCONT. Root command preparation must reset output and bind a fresh nonce before start; full readiness consumer remains a later task. file:external@0 b05d264190ef2172e87e5b2667164f2051e83016695595e32ccbcdce9186eb6b
@legacy 4de04c1583d5fa335adadb7227f9ce1ec35e28280744d6571ebe92c72b4442f2 internal/host/units/carlos-instance-gvisor@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Add the unarmed root gVisor run skeleton with empty ExecStart and all twelve measured host properties. Defines per-instance data/run writable paths and socket output, root runtime directory, mixed kill with SIGCONT, and the existing bounded stop. A root-prepared validated command drop-in is required before it can start; no command or pin placeholder is installed here. file:external@0 914a3c0486d83b6b87ce14c473aab9005ff7bc004cb984040a81ddc60087a5c1
@@ -113,7 +114,6 @@
@legacy 84fc29aee53e3df8e101908f47e3200c21db798396eadbaf9e90200b22a8913e internal/activator/unitproc.go ExecBackend.newRootfsWorkerProc legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W: starts observing the named worker's unit; refused for a binary row and for a name that is no worker's before anything watches; holds no control listener;rev3=census-ruling-gvisor-demos;basis=Task 5: migrate structured root start identity, validate binding, retain actual unit for observation/exit/stop. Unknown worker response retains only a cleanup request and listener, never a guessed observed identity. Existing route/control/cgroup inputs; no new root read. registry:Host@260,registry:Host@346,registry:Host@524,registry:Host@658,whole:Route@565,whole:Route@569 87173abe8f01c89ab0b5f7afbba78b47867d19b84e275a8438f98df78c97135d
@legacy 45a2b65be2fe2e180df8281f490349f25637e9395b0eb4506924234dec0bed46 internal/activator/unitproc.go ExecBackend.newUnitProcFor legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=the unit is named by unitNameFor(rt, role, gen), one more Route site (+whole:Route), and a role with no unit of the row's kind is refused before anything watches ""; no new read kind and no file read;rev3=census-ruling-region-ha-p1b3b-s;basis=Attach optional per-worker API closers to the existing unit observer before starting it; unit naming and systemd/cgroup proof reads unchanged.;rev3=census-ruling-gvisor-demos;basis=Task 5: migrate structured root start identity, validate binding, retain actual unit for observation/exit/stop. Unknown worker response retains only a cleanup request and listener, never a guessed observed identity. Existing route/control/cgroup inputs; no new root read. registry:Host@304,registry:Host@492,whole:Route@421,whole:Route@425 16104276147108e1c9bdb2fe844e2d7b38885ec741c26375cd5eb1d09b58d069
@legacy 7794faecfc27b38d89341f96d8460a7d73ea94bc879423e84b5399350ceaa5bb internal/activator/unitproc.go ExecBackend.observe legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=final fix I3: the process observer's termination proof for a rootfs handle (Runtime, the new kind, one site) goes through unitEvents (two more Route sites): the host slice's cgroup.events and, for a rootfs unit, the group systemd reports when that is elsewhere, so a foreign invocation root placed outside the slice and could not stop is never read as gone from the absent expected path; a failed stop of a foreign invocation leaves it unstopped, asked again next poll, completion pending; a binary handle's proof is unchanged (cgroup.events under the host slice); the agent decides only whether it keeps a handle and a launch file; no root decision; re-digested at the merge of origin/main 3c33f2eb: main's own change to the observer is in the body, this branch's rootfs-aware evidence and the rootfs-only failed-stop retry (merge prep N1: a binary handle behaves exactly as main) on top; the kinds are the union;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W, W1: for a worker handle (p.worker != "") the observer keeps the exit record it read (workerExit, workerExitOK) for the supervisor instead of wording a member event, and says nothing for a replaced-after-stop or restarted-outside end; the termination evidence (cgroup.events via unitEvents, the foreign-invocation rule) and the record's single-use removal are unchanged and apply to a worker as to a generation; a binary or generation handle behaves exactly as before; the same 22 read sites, no read added;rev3=census-ruling-rootfs-worker-exit;basis=an exit record with an empty code (read and bounded as before) is filled by unitMainExitOf before it is kept for a worker or worded for the member; the termination proof (UnitState, cgroup evidence, the foreign-invocation rule) and the record's single-use removal are unchanged; the same 22 read sites, no read added;rev3=census-ruling-region-ha-p1b3b-s;basis=Retain the already-read advisory exit record for native sidecars after the same systemd and cgroup termination proof; crash classification never substitutes for stop proof. No new read source.;rev3=census-ruling-gvisor-demos;basis=Task 5: migrate structured root start identity, validate binding, retain actual unit for observation/exit/stop. Unknown worker response retains only a cleanup request and listener, never a guessed observed identity. Existing route/control/cgroup inputs; no new root read. Fix round 2: rootfs log says stop accepted and waits for termination proof; no claim of termination from stop acceptance. Foreign observer uses plain fenced stop with main's existing cgroup evidence. Task 8: move the existing gVisor advisory exit label to unitProc.exitLine, based on UnitIdentity. No changes to records, termination proof, stop, or cgroup reads. registry:Host@1233,registry:Host@3084,registry:Host@3308,registry:Host@3655,registry:Host@3881,registry:Host@4585,registry:Host@6083,whole:Route@1235,whole:Route@2233,whole:Route@3086,whole:Route@3310,whole:Route@3657,whole:Route@3883,whole:Route@4587,whole:Route@4843,whole:Route@5170,whole:Route@5635,whole:Route@6085,whole:Route@983 76c573cb7122765e70ae4a0009f68c8c25977cfdf751f586185fed336c41cfd5
-@legacy 9d62a633973c4123d7b97a8c1ecbaf28c8e695da049c843e5e87226e33548f36 internal/host/sizestatus.go readSizeInForce legacy accepted-legacy accepted-legacy;rev3=census-ruling-instance-egress-sizes-328-329;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=root-input (J4, as readCgroupEvents): new (#329 plan 3 Task 7): os.Stat of the generation unit's cgroup directory and one ReadFile of memory.max under /sys/fs/cgroup/<parent slices>/<SliceName(host)>[/<GenUnitName(host, gen)>] (instancectl's names; host and gen from the agent's own activator state), a kernel file, matched to a size row; called through rowSizeCell from layoutStatusReport, once per awake nested row per 5-minute status tick; runs in the agent, not root; a status cell only; no root decision;rev3=census-ruling-gvisor-demos;basis=Task 8: remove Stat and generation-name reconstruction/parent fallback; read memory.max only under the host slice and validated retained unit name. Compare against Physical(logical tier) only for FamilyGVisor, return unchanged logical size/shares. Existing agent cgroupfs read, no root or guest-file read. file:ReadFile@304 2658704f34ad47a3284606e7d6e0ee97ba2936b3e05fbecbd6083f61ba0f9f65
@legacy 0284ae0a93f4d19ad551b3a2f7946966a11c0b7c8eb16529d0920f314284a530 internal/host/systemapply.go systemApplier.stageCandidate legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-region-ha-p3b;basis=Require groupStageDigest before staging/candidate execution; action and new digest come from root-owned operator permit bound to boot marker. Existing signed pointer/artifact verification and two direct read sites remain.;rev3=census-ruling-gvisor-demos;basis=Pass the already-open regular file fstat size to bounded preflight. Allocate payload once at exactly that size, use ReadFull then confirm EOF; hash and scan those same bytes before staging. Root-owned staged target is still checked before execution. Preserve staging on floor refusal for apply/install-channel. file:Stat@694 ea8c519d19786af346500c289fc768bd7047639d90154af6ec6ecefdfb41d57f
internal/activator/backend_unit.go UnitBackend.systemctl legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-gvisor-demos;basis=Task 5: gate launch using startup-captured mode and existing route/role/layout before preparation or execution; migrate structured root start identity and reject mismatches. Unsupported gVisor paths refuse; native behavior and existing root authority checks retained. No new root read source. file:CommandContext@332 fc3481b0f6f5410479d649b20bed2f0870bf574e67d5b00e6e47bd6262036c1b
internal/activator/sidecar_ha.go ExecBackend.startHAWorker legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-s;basis=Require nested HA sidecar shape and closed worker identity environment; prepare and acknowledge sealed secrets before writing the existing run launch file. Start the previously verified staged executable through existing root StartExe, mark uncertain starts for stop proof, and observe the same run unit. No health dial or new root verb.;rev3=census-ruling-gvisor-demos;basis=Task 5: migrate structured root start identity, validate binding, retain actual unit for observation/exit/stop. Unknown worker response retains only a cleanup request and listener, never a guessed observed identity. Existing route/control/cgroup inputs; no new root read. registry:Host@1355,registry:Host@1391,registry:Host@2005,registry:Host@270,registry:Host@320,whole:Route@1049,whole:Route@1433,whole:Route@1504,whole:Route@1637,whole:Route@1692,whole:Route@184,whole:Route@2048,whole:Route@853 f90fb0c55c16840a832498cd96ffdbf8bbc3bc8adca210372a731679afb36edd
@@ -133,8 +133,9 @@ internal/host/bootstrap.go bootstrapWithGroup legacy accepted-legacy accepted-le
internal/host/claimactivation_preflight.go claimActivationLocalUnits authority G rev3=PROPOSED-p3;run=22;identity=agent uid carlos; root migration/adopt/control uid 0;basis=refusal-only local named-unit inventory; agent skips only ordinary claim runtime drop-in directories under /run/systemd/system, whose private contents root still inventories and verifies before launch; legacy and named units remain checked;rev3=census-ruling-gvisor-demos;basis=Fix round 1 I2: preserve the existing native preflight skip decision in a named helper for tests; ParseUnitName now returns a distinct discovery kind for gVisor so its leftover drop-ins are not skipped. Same walks and reads, no new paths or native authority. file:ReadDir@215,file:ReadFile@1303,file:ReadFile@1386,file:WalkDir@603 ed9d41211897d86e11e1797fe52ad8adacaad0766f901d0c68225ddb827421e2
internal/host/claimstop_run.go RunInstanceControl authority C,D,G rev3=PROPOSED-p3;run=24;identity=root claim/adopt/update controller uid 0;basis=production root startup builds authenticated execution and launch handlers then uses activateClaimRoot for recovery, the registered census launch verifier and lifecycle start;rev3=census-ruling-rootfs-apps-2;basis=the claims-off path serves through instancectl.RunWithRegistryView with HostRuntime: instanceRegistryHostRuntime beside the same instanceRegistryHostApp(nil); the new read is instanceRegistryHostRuntime's own (a decision row in rootfs-apps-2-new); no read added in this body;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 4 and 6: the claims-off branch hands RunWithRegistryView the pre-claim egress asserter (newEgressAsserter over registryEgressSource and registryEgressHosts, which read the agent-written registry read-only, beside the instanceRegistryHostApp read it already had); the claims branch builds its runtime resources in instanceControlClaimResources, adding the claims asserter (claimsEgressSource writes no allow; the registry is read only to name slices), and serves through runClaimControl, which passes RunWithClaim the same handler, held-release route and host lookup plus that asserter. No read site in the unit, none added.;rev3=census-ruling-agent-start-demo-1;basis=Wires demo registry views and existing root release/adoption guard into instance control.;rev3=census-ruling-region-ha-p3b;basis=Add root hairpin identity verification, dormant install and reset CLI entries with bounded contexts. Indirect inputs are root-owned marker/identity/ingress/state and kernel/systemd process evidence; no request-controlled addresses or executable path. Existing control-service path remains.;rev3=census-ruling-gvisor-demos;basis=Retain Task 1 admission and claim separation; wire host-owned exact recovery baseline and pinned-set verification/retry callbacks. No new direct read. Task 6: In effective gVisor mode serve the cleanup-capable registry-view controller before claim recovery or assembly; preserve the retained Configure error so CLAIMS and invalid config still block launches. No new direct read. 9b56b2d8c8461852e6d6af0b62397b11694fd5edfecc980a9eaa7b291a0777a8
internal/host/claimunit.go claimUnitContent authority E1,E3 rev3=PROPOSED-p3;identity=root claim/adoption controller uid 0;basis=adds write permission for exactly the public retry directory only when the root settings reader has verified a complete census and prepared that directory;rev3=census-ruling-agent-start-demo-1;basis=Demo-only ReadWritePaths for instance data/runtime, staged files and root release lock; ordinary rendering unchanged.;rev3=census-ruling-agent-start-demo-1-followups;basis=In demo box mode, declare StateDirectory=carlos-release/private with mode 0700 so systemd creates root-owned release state before namespace setup and keeps it writable. Existing ReadWritePaths and ordinary/claims rendering stay unchanged. No new read site or caller-controlled path.;rev3=census-ruling-agent-start-demo-3;basis=Declare /var/lib/carlos-demo-snapshots as root-owned StateDirectory with mode 0700 only for configured demo boxes, including recovery with admission off. Ordinary claims units retain their original directories. The shared unit template is unchanged from main; no file read is added.;rev3=census-ruling-gvisor-demos;basis=Mark only claim/demo renderings explicitly; common host.env remains loaded. Ordinary rendering masks CARLOS_HOST_CLAIM with UnsetEnvironment, removed only for a successfully parsed enabled claim rendering. Existing template read unchanged. Task 7: render aggregate build slice through SlicePropertiesFor using the resolved host mode, with 32 MiB and 64-task gVisor overhead per slot. Existing control permissions unchanged. data-literal@1504 90df27de34be8e60ea1b9f03dd3eff5eb8291f05b93e8a488460150f51e70725
-internal/host/claimunit.go readClaimUnitSettings authority C,E3,G,J4 rev3=PROPOSED-p3;identity=root claim/adoption controller uid 0;basis=retains exact no-census unit settings; a claims-enabled complete census prepares the root-owned retry directory before the hardened controller starts;rev3=census-ruling-agent-start-demo-1;basis=Reads worker/concurrency/toolchain settings from the existing host.env parser; requires box mode and refuses claims coexistence.;rev3=census-ruling-gvisor-demos;basis=Task 7: parse CARLOS_EXEC_SANDBOX in the existing host.env reader and resolve fixed mode for installed build-slice budgets. No new file read; invalid values refuse rendering. data-literal@167,data-literal@2091,data-literal@2823 2f4d6a1a09c9cf646ddc30339526d62cb7d9a69f613f6c786da607d21156a288
+internal/host/claimunit.go readClaimUnitSettings authority C,E3,G,J4 rev3=PROPOSED-p3;identity=root claim/adoption controller uid 0;basis=retains exact no-census unit settings; a claims-enabled complete census prepares the root-owned retry directory before the hardened controller starts;rev3=census-ruling-agent-start-demo-1;basis=Reads worker/concurrency/toolchain settings from the existing host.env parser; requires box mode and refuses claims coexistence.;rev3=census-ruling-gvisor-demos;basis=Task 7 and pre-merge fixwave: parse CARLOS_EXEC_SANDBOX in the existing host.env reader only when the demo build worker is enabled, for installed build-slice budgets. Invalid sandbox values still refuse build-worker rendering; ordinary and claim hosts retain their settings. No new file read. data-literal@167,data-literal@2091,data-literal@2863 7e38527bca9b707c1775465f1aa890cdd5922c4e183cd151d3dae397a03aa4bf
internal/host/layoutleg.go layoutStatusReport diagnostic H3 no-effect;rev3=census-ruling-instance-egress-sizes-328-329;basis=#329 plan 3 Task 7: each activator-managed instance row gains a Size cell, rowSizeCell(armedSizeSource.Load(), rt.Host, word) (the added registry:Host site), which for an awake nested row reads that host's cgroup memory.max through readSizeInForce (a decision row, in the agent); still a status report with no effect on any decision.;rev3=census-ruling-alias-socket-follow-338;basis=#338: a platform socket row reports alias (aliasLayout) instead of external; reads Platform;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 5: Pass.Held takes the whole route (so a row with a runtime is never reported as held); status display only;rev3=census-ruling-gvisor-demos;basis=Task 8: add root-reported configured/effective mode, runtime pin and readiness through Client.SandboxStatus, plus observed per-row family from the activator handle. Missing/stale root builds remain unknown. Presentation only, no root decision. registry:Hibernate@1457,registry:Hibernate@1545,registry:Host@1270,registry:Host@1293,registry:Host@1375,registry:Host@1479,registry:Host@1695,registry:Kind@622,registry:Platform@1422,registry:Socket@1437,registry:Socket@1525,whole:Route@1502,whole:Route@156,whole:Route@416,whole:Route@707,whole:Route@745,whole:Route@749,whole:Route@969 4874f16c4788e0fda7034c0db0afdc290992ca1bc9c19eae199f546867a12b4e
+internal/host/sizestatus.go readSizeInForce legacy accepted-legacy accepted-legacy;rev3=census-ruling-instance-egress-sizes-328-329;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=root-input (J4, as readCgroupEvents): new (#329 plan 3 Task 7): os.Stat of the generation unit's cgroup directory and one ReadFile of memory.max under /sys/fs/cgroup/<parent slices>/<SliceName(host)>[/<GenUnitName(host, gen)>] (instancectl's names; host and gen from the agent's own activator state), a kernel file, matched to a size row; called through rowSizeCell from layoutStatusReport, once per awake nested row per 5-minute status tick; runs in the agent, not root; a status cell only; no root decision;rev3=census-ruling-gvisor-demos;basis=Task 8 and pre-merge fixwave: validate retained unit family; gVisor reads only its retained unit memory.max and matches Physical(logical tier), with no fallback. Restore main native semantics: generation-0 reads the host slice, a retained generation uses its cgroup when present and falls back only if its directory is absent. Stat of the native retained generation directory is restored; unreadable/malformed existing unit limits remain unknown. Return unchanged logical size/shares. Existing agent cgroupfs paths, no guest-file read. file:ReadFile@676,file:Stat@540 7c87403b9e10061ec4e8317856b7fac1abb5e633aa6522bf2030cc803293307b
internal/host/systemapply.go systemApplier.install authority F,J4 rev3=PROPOSED-p3;identity=carlos system apply, root update unit or offline root CLI, uid 0;basis=root verifies staged signature and final locked bounds before rename, then records root accepted floor history only after health succeeds;rev3=census-ruling-region-ha-p1a;basis=root apply, uid 0: comment and error text only around the beginExecutableChange call (the wrapped error now reads "update not begun" instead of "update-begun marker"); the call, its position before the first box-changing step and the deferral on error are unchanged; no read added;rev3=census-ruling-region-ha-p3b;basis=Require groupTarget for the staged new artifact and propagate quiesce refusal before effects. Root-owned operator permit must authorize digest/action/current boot; existing signed image, floor and journal checks remain; no new direct read.;rev3=census-ruling-gvisor-demos;basis=Check staged and previous executable awareness before unit-plan execution. Existing reads unchanged; no unaware prev executes in gvisor mode. a22f4cbbab3f7aea6a8f12ae494b8dfe808caee6ea6048ab7a1b8eb600945897
internal/host/systemapply.go systemApplier.installUnits legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-agent-start-demo-1;basis=Renders the staged build slice against live root host configuration; preserves it when settings cannot be parsed.;rev3=census-ruling-region-ha-p3b;basis=Require group apply/rollback permit, preserve root Restart=no/nftables drop-in and masks, and skip automatic update/recovery units. Existing staged unit and host.env reads remain; new indirect marker/permit reads are protected and agent receipts are excluded.;rev3=census-ruling-gvisor-demos;basis=Create rootfs/runtime parent directories before controller restart. Existing staged unit and root-owned host.env reads unchanged. file:ReadDir@1509,file:ReadFile@1060,file:ReadFile@2100,file:ReadFile@5135,file:Stat@2758,file:Stat@4051 f20ce9ef05e19ccb08e68d7c7935aaf20175892fa2616c794ac6adad5303a8a8
internal/host/systemapply.go systemApplier.restoreFiles authority F,J4 rev3=PROPOSED-p3;identity=carlos system apply/recover, root systemd units or offline root CLI, uid 0;basis=selects signed prev identity and checks staged restore against both root bounds before rename; version sidecar cannot authorize;rev3=census-ruling-region-ha-p3b;basis=Authorize exact previous artifact before restore, propagate quiesce refusal and remove automatic group units from enable list. Existing signature/floor and staged plan reads remain; indirect permit must be root-owned and bind old digest/current boot.;rev3=census-ruling-gvisor-demos;basis=Check prev awareness before quiesce/copy/restore and check the copied restore executable before rename. Existing stat unchanged. file:Stat@430 6a1bc52aac86cd48cde5b568cdcb8b7299227e4ac2373f60f2e92c9ab10bad25
@@ -185,7 +186,7 @@ internal/host/runscensure.go runscCommandInventory legacy accepted-legacy accept
internal/host/runscensure.go runscSystemctl legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Execute systemctl with fixed enumeration/start verbs and root-generated unit names, context bounded. No shell or request-provided executable. file:CommandContext@88 16614091a159f92b0575ac6980a90e468c50936662d6f1016425b4080951468e
internal/host/runscensure.go wireSandboxReadiness legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read exact embedded recovery unit and bind host baseline plus compiled-pin verification callbacks. No installed unit data enters instancectl imports. file:ReadFile@85 e46e312a601c7e91da51d537c8ebb580c2c59630f8608d5a65da5a4352245c0e
internal/host/runscset_linux.go openRunscLock legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Open fixed installer lock under checked root runtime directory with O_NOFOLLOW; fstat root owner, single-link regular and private mode before flock. file:Fstat@264,file:Open@64 d44bfa3ce6f1e0bc68c2671ed5604044412de4e6f82b488436d119ee71b81d68
-internal/host/sandboxenv_linux.go openSandboxHostEnvironment legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 3 fix round 2, explicit user ruling: open the fixed production host.env path with Openat2 O_RDONLY/O_NOFOLLOW/O_NONBLOCK/O_CLOEXEC and RESOLVE_NO_SYMLINKS for all ancestors. No owner, permission-mode or link-count check; caller enforces 1 MiB cap. This exception is confined to EnvironmentFile authority, not executable/runtime verification. file:Openat2@77 a57adab592aaaf247971a7556724f6e7cfb56090dcbb8ca9173bc21248c03f4d
+internal/host/sandboxenv_linux.go openSandboxHostEnvironment legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 3 fix round 2, explicit user ruling, plus pre-merge fixwave: open the fixed production host.env path with Openat2 O_RDONLY/O_NOFOLLOW/O_NONBLOCK/O_CLOEXEC and RESOLVE_NO_SYMLINKS for all ancestors, then fstat that descriptor and require a regular file. FIFO, directory or failed stat returns an error, preserving the strict floor. No owner, permission-mode or link-count check; caller enforces 1 MiB cap. This exception is confined to EnvironmentFile authority, not executable/runtime verification. file:Openat2@77,file:Stat@378 1e72fe1a6c8ff0dc39d331ca47301ca9e580700d65488ae8bd16adc1d9f2129d
internal/host/units/carlos-demo-build-gvisor@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Add the unarmed root gVisor build skeleton with empty ExecStart, all twelve measured properties, control-group termination and fixed physical budgets. Host LimitFSIZE is omitted by ruling; guest OCI limit remains 33554432 and passed EFBIG measurement. Root prepares validated per-job writable paths, append diagnostics and runtime commands later; template output defaults remain null. file:external@0 8b6f939424c554aaf1e5ed38111ebd0bf67fdcbaaa5bc6415df55affb64ba17a
internal/host/units/carlos-instance-gvisor-probe.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Add the unarmed root gVisor probe skeleton with empty ExecStart, all twelve measured properties, fixed probe data/run paths, append output and mixed kill with SIGCONT. Root command preparation must reset output and bind a fresh nonce before start; full readiness consumer remains a later task. file:external@0 b05d264190ef2172e87e5b2667164f2051e83016695595e32ccbcdce9186eb6b
internal/host/units/carlos-instance-gvisor@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Add the unarmed root gVisor run skeleton with empty ExecStart and all twelve measured host properties. Defines per-instance data/run writable paths and socket output, root runtime directory, mixed kill with SIGCONT, and the existing bounded stop. A root-prepared validated command drop-in is required before it can start; no command or pin placeholder is installed here. file:external@0 914a3c0486d83b6b87ce14c473aab9005ff7bc004cb984040a81ddc60087a5c1
@@ -246,18 +247,17 @@ internal/activator/rootfs.go ExecBackend.spawnRootfs legacy accepted-legacy acce
internal/activator/unitproc.go ExecBackend.newRootfsWorkerProc legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W: starts observing the named worker's unit; refused for a binary row and for a name that is no worker's before anything watches; holds no control listener;rev3=census-ruling-gvisor-demos;basis=Task 5: migrate structured root start identity, validate binding, retain actual unit for observation/exit/stop. Unknown worker response retains only a cleanup request and listener, never a guessed observed identity. Existing route/control/cgroup inputs; no new root read. registry:Host@260,registry:Host@346,registry:Host@524,registry:Host@658,whole:Route@565,whole:Route@569 87173abe8f01c89ab0b5f7afbba78b47867d19b84e275a8438f98df78c97135d
internal/activator/unitproc.go ExecBackend.newUnitProcFor legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=the unit is named by unitNameFor(rt, role, gen), one more Route site (+whole:Route), and a role with no unit of the row's kind is refused before anything watches ""; no new read kind and no file read;rev3=census-ruling-region-ha-p1b3b-s;basis=Attach optional per-worker API closers to the existing unit observer before starting it; unit naming and systemd/cgroup proof reads unchanged.;rev3=census-ruling-gvisor-demos;basis=Task 5: migrate structured root start identity, validate binding, retain actual unit for observation/exit/stop. Unknown worker response retains only a cleanup request and listener, never a guessed observed identity. Existing route/control/cgroup inputs; no new root read. registry:Host@304,registry:Host@492,whole:Route@421,whole:Route@425 16104276147108e1c9bdb2fe844e2d7b38885ec741c26375cd5eb1d09b58d069
internal/activator/unitproc.go ExecBackend.observe legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=final fix I3: the process observer's termination proof for a rootfs handle (Runtime, the new kind, one site) goes through unitEvents (two more Route sites): the host slice's cgroup.events and, for a rootfs unit, the group systemd reports when that is elsewhere, so a foreign invocation root placed outside the slice and could not stop is never read as gone from the absent expected path; a failed stop of a foreign invocation leaves it unstopped, asked again next poll, completion pending; a binary handle's proof is unchanged (cgroup.events under the host slice); the agent decides only whether it keeps a handle and a launch file; no root decision; re-digested at the merge of origin/main 3c33f2eb: main's own change to the observer is in the body, this branch's rootfs-aware evidence and the rootfs-only failed-stop retry (merge prep N1: a binary handle behaves exactly as main) on top; the kinds are the union;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W, W1: for a worker handle (p.worker != "") the observer keeps the exit record it read (workerExit, workerExitOK) for the supervisor instead of wording a member event, and says nothing for a replaced-after-stop or restarted-outside end; the termination evidence (cgroup.events via unitEvents, the foreign-invocation rule) and the record's single-use removal are unchanged and apply to a worker as to a generation; a binary or generation handle behaves exactly as before; the same 22 read sites, no read added;rev3=census-ruling-rootfs-worker-exit;basis=an exit record with an empty code (read and bounded as before) is filled by unitMainExitOf before it is kept for a worker or worded for the member; the termination proof (UnitState, cgroup evidence, the foreign-invocation rule) and the record's single-use removal are unchanged; the same 22 read sites, no read added;rev3=census-ruling-region-ha-p1b3b-s;basis=Retain the already-read advisory exit record for native sidecars after the same systemd and cgroup termination proof; crash classification never substitutes for stop proof. No new read source.;rev3=census-ruling-gvisor-demos;basis=Task 5: migrate structured root start identity, validate binding, retain actual unit for observation/exit/stop. Unknown worker response retains only a cleanup request and listener, never a guessed observed identity. Existing route/control/cgroup inputs; no new root read. Fix round 2: rootfs log says stop accepted and waits for termination proof; no claim of termination from stop acceptance. Foreign observer uses plain fenced stop with main's existing cgroup evidence. Task 8: move the existing gVisor advisory exit label to unitProc.exitLine, based on UnitIdentity. No changes to records, termination proof, stop, or cgroup reads. registry:Host@1233,registry:Host@3084,registry:Host@3308,registry:Host@3655,registry:Host@3881,registry:Host@4585,registry:Host@6083,whole:Route@1235,whole:Route@2233,whole:Route@3086,whole:Route@3310,whole:Route@3657,whole:Route@3883,whole:Route@4587,whole:Route@4843,whole:Route@5170,whole:Route@5635,whole:Route@6085,whole:Route@983 76c573cb7122765e70ae4a0009f68c8c25977cfdf751f586185fed336c41cfd5
-internal/host/sizestatus.go readSizeInForce legacy accepted-legacy accepted-legacy;rev3=census-ruling-instance-egress-sizes-328-329;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=root-input (J4, as readCgroupEvents): new (#329 plan 3 Task 7): os.Stat of the generation unit's cgroup directory and one ReadFile of memory.max under /sys/fs/cgroup/<parent slices>/<SliceName(host)>[/<GenUnitName(host, gen)>] (instancectl's names; host and gen from the agent's own activator state), a kernel file, matched to a size row; called through rowSizeCell from layoutStatusReport, once per awake nested row per 5-minute status tick; runs in the agent, not root; a status cell only; no root decision;rev3=census-ruling-gvisor-demos;basis=Task 8: remove Stat and generation-name reconstruction/parent fallback; read memory.max only under the host slice and validated retained unit name. Compare against Physical(logical tier) only for FamilyGVisor, return unchanged logical size/shares. Existing agent cgroupfs read, no root or guest-file read. file:ReadFile@304 2658704f34ad47a3284606e7d6e0ee97ba2936b3e05fbecbd6083f61ba0f9f65
internal/host/systemapply.go systemApplier.stageCandidate legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-region-ha-p3b;basis=Require groupStageDigest before staging/candidate execution; action and new digest come from root-owned operator permit bound to boot marker. Existing signed pointer/artifact verification and two direct read sites remain.;rev3=census-ruling-gvisor-demos;basis=Pass the already-open regular file fstat size to bounded preflight. Allocate payload once at exactly that size, use ReadFull then confirm EOF; hash and scan those same bytes before staging. Root-owned staged target is still checked before execution. Preserve staging on floor refusal for apply/install-channel. file:Stat@694 ea8c519d19786af346500c289fc768bd7047639d90154af6ec6ecefdfb41d57f
@remove internal/instancectl/demo_policy.go Server.demoCgroup
@removed internal/instancectl/demo_policy.go Server.demoCgroup H3 census-ruling-gvisor-demos;basis=Delegate the existing readback to demoCgroupReadback; wrapper has no direct read and retains its callers.
@coverage . e81de2dad7f3ecf8f6adbb426b8f6e8f732b7dff5b7e909a273f0e40194307b5
@coverage internal/activator d326609be0b7846d7bcbb4b20856ef9d3a9ffdf70bfb091e3ac7566fa78613de
-@coverage internal/demobuild 8544616096994fe88805489a99a1644d8dc387fd3a25f23ba4847f8be9ae556c
-@coverage internal/execsandbox 695b6e7772f909e39c09a22382db7d7182968638adc8d4f59e2a36246a5a8452
-@coverage internal/host 5ed054ca10605612d1ef02e04f6949d6b70ebe34dd5ca2c8128916b7e4a9e238
+@coverage internal/demobuild 60f5e9d6c2acb85d8943d848f013349157bf985bba71e69e99d4ed6e831c1dd7
+@coverage internal/execsandbox ce4d20024db674a70759ea41e981178727e54c469d300c8cb3f12a13277638ba
+@coverage internal/host f7ecb38917955e3e89c323b3f8d730271d9df28a0967459151552b0471e59149
@coverage internal/host/units 93402572d2fc9c32b563820a36d565afa2ed951637bde9561fe2e845137a6524
-@coverage internal/instancectl 349c65db5738cc5994aa5e7a1ace3403bb6b99e7c99dbed2436dde83ca90c39c
+@coverage internal/instancectl 070e83f5684269385b4c301f8601d6524b6c303375f099f22a3abea0bea970f1
@coverage internal/instanceexec f45ee9b5ec7862c3a07fd9270b38df322c91e73f13e297813698dee30b8efd2c
-@coverage internal/publicrelease 564bbb7ee2c6804da1b395294bc4e903d1c1c1380a25677c4a6233959635dd9a
+@coverage internal/publicrelease 4b98543d38d648c60009592dac6c1e8a012ecca42e52d95d12404c0f9506457c
@coverage internal/status 549f4bf5833dd6d85709bf86f84766736c1a0b531cf5cabdaf6ca26924c67ea8
@coverage internal/systemdshow fee9413c43dcc5d3122ae3283bc42747b68275b713ea1a58e3145401f7752a9b
diff --git a/internal/publicrelease/feed.go b/internal/publicrelease/feed.go
index 9f0b17cd8..471dc6cbe 100644
--- a/internal/publicrelease/feed.go
+++ b/internal/publicrelease/feed.go
@@ -146,18 +146,28 @@ func (f Feed) OptionalAsset(ctx context.Context, tag, asset string, limit int64)
if err != nil {
return nil, "", false, err
}
+ if _, ok := sums[asset]; !ok {
+ return nil, "", false, nil
+ }
+ data, sha, err := f.AssetWithSums(ctx, tag, asset, limit, sums)
+ return data, sha, true, err
+}
+
+// AssetWithSums fetches an asset against a list already verified by Sums or
+// VerifySums. It hashes the downloaded bytes without fetching the list again.
+func (f Feed) AssetWithSums(ctx context.Context, tag, asset string, limit int64, sums map[string]string) ([]byte, string, error) {
want, ok := sums[asset]
if !ok {
- return nil, "", false, nil
+ return nil, "", fmt.Errorf("no %s in the release's checksum list", asset)
}
data, err := f.get(ctx, f.DownloadBase+"/"+tag+"/"+asset, limit)
if err != nil {
- return nil, "", true, err
+ return nil, "", err
}
sum := sha256.Sum256(data)
got := hex.EncodeToString(sum[:])
if got != want {
- return nil, "", true, fmt.Errorf("%s does not match its signed checksum — refusing it", asset)
+ return nil, "", fmt.Errorf("%s does not match its signed checksum — refusing it", asset)
}
- return data, got, true, nil
+ return data, got, nil
}
diff --git a/internal/publicrelease/runsc.go b/internal/publicrelease/runsc.go
index afde3c6cc..7ee190e30 100644
--- a/internal/publicrelease/runsc.go
+++ b/internal/publicrelease/runsc.go
@@ -2,7 +2,6 @@ package publicrelease
import (
"fmt"
- "strings"
"github.com/carlosframework/platform/internal/execsandbox"
)
@@ -10,16 +9,7 @@ import (
func RunscAssetName(platform string) string { return RunscMemberAssetName(platform, "runsc") }
func RunscMemberAssetName(platform, member string) string {
- if platform != "linux-arm64" && platform != "linux-amd64" {
- return ""
- }
- switch member {
- case "runsc", "gvisor-bin/runsc-fd-parking", "gvisor-bin/gvisor-proc-umounter", "gvisor-bin/gvisor-sentry-prewarmer":
- return strings.TrimPrefix(member, "gvisor-bin/") + "-" + platform
- case "gvisor-bin/gvisor_sentry":
- return "gvisor-sentry-" + platform
- }
- return ""
+ return execsandbox.RunscMemberAssetName(platform, member)
}
// RunscReleasePin derives the target set from verified release sums. It uses
diff --git a/internal/publicrelease/runsc_test.go b/internal/publicrelease/runsc_test.go
index 586a21dae..be5a0fcb7 100644
--- a/internal/publicrelease/runsc_test.go
+++ b/internal/publicrelease/runsc_test.go
@@ -11,6 +11,8 @@ import (
"net/http/httptest"
"strings"
"testing"
+
+ "github.com/carlosframework/platform/internal/execsandbox"
)
type runscTransport func(*http.Request) (*http.Response, error)
@@ -92,7 +94,7 @@ func TestOptionalRunscAssetSetManifest(t *testing.T) {
var manifest strings.Builder
for _, m := range members {
name := m.asset + "-" + platform
- if RunscMemberAssetName(platform, m.path) != name {
+ if RunscMemberAssetName(platform, m.path) != name || execsandbox.RunscMemberAssetName(platform, m.path) != name {
t.Fatalf("asset name for %s", m.path)
}
sha := fmt.Sprintf("%x", sha256.Sum256([]byte(name)))
@@ -104,6 +106,12 @@ func TestOptionalRunscAssetSetManifest(t *testing.T) {
if err != nil || !present || pin.SetID() != want {
t.Fatalf("set ID %q want %q: %v", pin.SetID(), want, err)
}
+ for _, f := range pin.Files {
+ name := RunscMemberAssetName(platform, f.Path)
+ if key := execsandbox.RunscObjectKey(platform, pin, f.Path); key != "bootstrap/router/runsc-"+pin.SetID()+"/"+name {
+ t.Fatalf("object name differs from release asset: %s", key)
+ }
+ }
delete(sums, RunscAssetName(platform))
if _, _, err := RunscReleasePin(platform, sums); err == nil {
t.Fatal("accepted partial set")
@@ -138,3 +146,14 @@ func TestOptionalRunscAssetMalformedSignedSums(t *testing.T) {
}
}
}
+
+func TestRunscMemberAssetNameRefusals(t *testing.T) {
+ for _, tc := range [][2]string{{"darwin-arm64", "runsc"}, {"linux-arm64", "unknown"}, {"linux-amd64", "../runsc"}} {
+ if got := RunscMemberAssetName(tc[0], tc[1]); got != "" {
+ t.Fatalf("accepted %v: %s", tc, got)
+ }
+ if got := execsandbox.RunscMemberAssetName(tc[0], tc[1]); got != "" {
+ t.Fatalf("execsandbox accepted %v: %s", tc, got)
+ }
+ }
+}
diff --git a/internal/publicrelease/verifysums.go b/internal/publicrelease/verifysums.go
index 0b84cb0c5..ce736ab37 100644
--- a/internal/publicrelease/verifysums.go
+++ b/internal/publicrelease/verifysums.go
@@ -15,8 +15,8 @@ var sumLine = regexp.MustCompile(`^([0-9a-f]{64}) (\S+)$`)
// VerifySums checks a release's SHA256SUMS.txt against its .sig with pubKey
// (base64 ed25519, over the raw sums bytes, as Feed.Sums checks it) and
-// returns asset name to sha256. Unlike Feed.Sums it is strict, because its
-// caller signs what it returns into deployment authority: every line must be
+// returns asset name to sha256. Its caller signs the result into deployment
+// authority, so it also requires exact line formatting: every line must be
// sha256sum's text form, "<64 lowercase hex> <name>", each name once, and a
// list with no lines is refused. It reads nothing from the network.
func VerifySums(pubKey string, sums []byte, sig string) (map[string]string, error) {