gvisor demos: task 5 fix round 1 (real systemd stop proof, identity)
Co-Authored-By: Astra (gpt-6-astra) via codex
35 files changed,
+792
−86
docs/superpowers/notes/census-proposal-gvisor-demos.md+4 −2internal/activator/control.go+8 −0internal/activator/rootfs_deploy_test.go+11 −0internal/activator/rootfs_staged_test.go+7 −0internal/activator/sandbox_spawn_guard_test.go+21 −1internal/activator/sandbox_test.go+83 −0internal/activator/swap_nested_test.go+4 −0internal/activator/unitproc.go+12 −0internal/activator/unitproc_test.go+7 −0internal/host/claimactivation_preflight.go+10 −5internal/host/claimunit_dropin_test.go+19 −0internal/host/egress_startpaths_rootrunner_linux_test.go+2 −2internal/host/gvisor_stop_rootrunner_linux_test.go+184 −0internal/host/rollout.go+2 −1internal/host/rootfsstart_test.go+7 −0internal/host/size_rootrunner_linux_test.go+1 −1internal/host/systemunits.go+2 −1internal/instancectl/client.go+21 −3internal/instancectl/identity.go+1 −1internal/instancectl/legacystart.go+6 −1internal/instancectl/names.go+7 −4internal/instancectl/ocibundle.go+1 −1internal/instancectl/rootfs.go+11 −1internal/instancectl/sandbox_status_test.go+40 −0internal/instancectl/sandboxstop.go+27 −27internal/instancectl/sandboxstop_test.go+163 −11internal/instancectl/server.go+33 −14internal/instancectl/server_test.go+1 −1internal/instancectl/stopinvocation.go+43 −0internal/instancectl/testdata/systemd257/gvisor-not-found.show+11 −0internal/instancectl/testdata/systemd257/inactive.show+11 −0internal/instancectl/testdata/systemd257/native-not-found.show+11 −0internal/instancectl/testdata/systemd257/running.show+11 −0internal/provision/testdata/plan14-root-reads-chain.tsv+1 −1internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv+9 −8
CI failed — run details
Intent
diff --git a/docs/superpowers/notes/census-proposal-gvisor-demos.md b/docs/superpowers/notes/census-proposal-gvisor-demos.md| index 5844ef0e0..ba420670d 100644 |
| --- a/docs/superpowers/notes/census-proposal-gvisor-demos.md |
| +++ b/docs/superpowers/notes/census-proposal-gvisor-demos.md |
| @@ -10,6 +10,7 @@ Ruling `census-ruling-gvisor-demos`. The independent reviewer approves or reject |
| | `internal/activator/unitproc.go` `unitProc.Stop` | body | unchanged (2) | Task 5: root original-run proof is required even after observer completion. Failed root proof masks Exited until successful retry, retaining the lease; listener closure still follows termination. Same control reads. | |
| | `internal/host/agent.go` `runAgent` | body | unchanged (9) | Capture sandbox resolution and refusal once; log errors once; gate route admission and BeforeExec before process launch. No new root read. Task 5: pass the once-captured sandbox effective mode/config error into ExecBackend, UnitBackend and the immutable Client expectation. Same startup environment/registry reads; swapArming declines gVisor before placement. | |
| | `internal/host/bootstrap.go` `bootstrapWithGroup` | body | unchanged (3) | Create the rootfs parent at 0700 and runtime root at 0755. Existing host.env/unit reads unchanged; workload templates remain unarmed. | |
| +| `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. | |
| | `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. | |
| | `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. | |
| @@ -72,6 +73,7 @@ Recorded dispositions, which each change must still satisfy: |
| - `internal/activator/unitproc.go` `unitProc.Stop`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route |
| - `internal/host/agent.go` `runAgent`: authority, task B,C,D,F. Basis: rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): builds the box's lifetime judge once (newBoxJudge, nil with host claims on) and hands it to the seed placement, the moves and runs workers and every loop it starts; read sites unchanged, offsets moved; B,C,D,F authority retained; self-serve moves 1 Task 8: derives the box's lifetimes switch from the judge once (lifetimes := boxJudge != nil) and hands it to the edges file loop; read sites unchanged, offsets moved;rev3=census-ruling-plans-4d-lapse;basis=arms two more plans hooks from the same snapshot: e.SetPlanDisabledFor(planDisabledFor) beside SetPlanGovernedFor, and svc.SetDisabledFor(planDisabledRoute) beside SetMaxRunFor (plans 4d); the reads live in those units (plans-4d-units decision); read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 9b81d97b (with main's plan rate ceiling, edge request records, regional box names, self-serve moves plan 1, plans 4d-1 lapse and its other later changes under main's own census rulings) plus the rootfs placement wiring in the activator start: an agentRootfs built from eb.NestedOK, CARLOS_DEPLOYMENT_SINGLE_TENANT, CARLOS_POOLS, the claim flag, swapArming's answer, the control client's /ready/rootfs and, on a fleet box whose identity resolved, fleetOwnerCheck over the deploy store main already opens for the fleet label (fleetStore), then arm and armedRootfs.Store; this body reads nothing new itself; the closures it wires read later, at a rootfs wake and each status tick: GET /ready/rootfs over the control socket, NestedOK's checks, and release.FleetOwnerKey for the judged row's own account and this box's fleet from the deploy store;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 7 and 11, #329 plan 3 Task 7 and plan 1 Task 7's policy cache: the control client is built once and handed to eb.Control, to the status tick (egressStatus) and to a new egressNudgeLoop goroutine; armSizeSource(svc, "/sys/fs/cgroup") after the activator Service; armPolicyCache() after armChangeIndex; statusLoop takes egressStatus. The reads are those units' own (decision rows); this body reads nothing new: the same five sites, offsets moved, in the agent; B,C,D,F authority retained.;rev3=census-ruling-remote-instance-metrics;basis=builds the metrics loop's owners closure (metricsOwners over the agent's registry, the activator and cgm.Leftover) when an activator exists and hands it to metricsLoop; reads nothing new itself;rev3=census-ruling-edge-asset-cache-3;basis=adds file:Statfs. runAgent keeps its authority (B,C,D,F). The new site is assetcache.Statfs, an exported assetcache.FS interface value (var Statfs FS = statfsFS{}), not a function value and not a call in runAgent: the ready hook passes it to armEdgeAssetCache as the store's filesystem, and armEdgeAssetCache calls its Space method on the configured data directory (dataDir(): $CARLOS_DATA_DIR, else /data), which calls unix.Statfs there (statfsFS.Space, accepted legacy at census-ruling-edge-asset-cache-2). No request-supplied pathname reaches it.;rev3=census-ruling-remote-metrics-nested;basis=main's body (merged origin/main acfa4f80, under main's own census rulings) plus: snapshots the nested layout (snapshotNestedUnits over /sys/fs/cgroup/carlos.slice/carlos-instances.slice) once at start, before the activator, and hands the metrics loop a unitSources struct (stamped units, routeHostNames, that root and the snapshot); reads nothing new itself;rev3=census-ruling-region-ha-p1a;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): wires region HA P1a into the activator: cfg.Record = haRecordFacts(openDeployStore, boxJudge) (the box's lifetime judge this body already builds with newBoxJudge, nil with host claims on; CI fix) and cfg.Self = lease.CurrentSelf; eb.Lifetimes (the process's lifetime index), eb.Registry, eb.StartupSwept (seedSweptAtStart.Load), eb.FilesStore from newProductionFilesStore (now lease.NewFilesStore, rootaws-loaded, a log line on failure) and lease.SetObligationDir(<data>/.ha-owed) (logged on failure; HA acquires then refuse); this body reads nothing new itself, the same five sites; the reads are those units' own (haRecordFacts and lease's SetObligationDir are new rows on this card); merge of origin/main d7ae1d76: main's own later changes to this body are kept as main has them, under main's rulings (census-ruling-remote-instance-metrics: the metricsOwners closure for metricsLoop; census-ruling-edge-asset-cache-3: the +file:Statfs site, assetcache.Statfs handed to the asset ready hook); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: builds one termfence.Confirmer (Self from lease.CurrentSelf at each call, EC2 DescribeInstances method only, client from rootaws.LoadDefaultConfig with retries off, built lazily on first use) and sets eb.OwnerTerminated; this body reads nothing new itself, the same six sites;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 7: the startup Sweep literal hands its answer to startupSwept, which logs as before and, only on a clean sweep, marks rootfs admission swept (MarkRootfsSwept); same Sweep call, no read added;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): sets svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore) from the identity it already resolves once and the deployment store the fleet loops already opened, and logs an ERROR naming the identity error when the box is on a fleet with an invalid identity. fleetWakeFor reads CARLOS_REGION and CARLOS_FLEET from the same environment. Read sites unchanged (6). Agent, not root; a platform box is unchanged.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: one call more beside armRunsPass, armInteractivePass(svc, reg, rolloutSink, boxJudge), in the same activator Configure hook, handing it the same box judge; fix round 1 (Astra P2, shutdown): after svc.Shutdown(ctx), shutdownInteractive(ctx) ends and joins every interactive session under the same shutdown budget; the worker's own reads are its units' (interactive.go); this body reads nothing new, the same six sites; merge of origin/main 6f1f6ca6: main's svc.Fleet = fleetWakeFor(...) and its invalid-identity ERROR line are kept as main has them (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (6);rev3=census-ruling-fix-set-aside-exdev;basis=set-aside EXDEV fix: one field more on the agent ExecBackend literal, RawInstanceDir: layout.RawInstanceDir (a pure path join: <dataDir>/.instances/<InstanceID(host)>), so the start rule set-aside moves a copy out through the raw directory instead of through the nosymfollow bind; this body reads nothing new, the same six sites;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: one more assignment beside eb.FilesStore: eb.EscrowKey = haEscrowKey(os.Getenv("CARLOS_SECRETS_KEY")), the agent's own environment parsed by appconfig.ParsePrivateKey as the moves pass parses it (unset or unparseable: a log line and nil, and HA publication refuses on the box). No path is opened or read, no read site added; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 4: one more goroutine beside configSyncLoop: go escrowLoop(agentCtx, reg, svc), the escrow sweep every 30 s over the same registry and Service. This body reads nothing new itself; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 5: one more call beside eb.EscrowKey: wireRawSecretPages(eb, PageOperator, metricsBoxLabel(os.Getenv, readMachineID())), which sets eb.OnRawSecret to page an operator (alerting.Page through PageOperator, LevelIncident) on its own goroutine with a 20 s timeout; metricsBoxLabel and readMachineID are the reads this body already makes for the moves refusal log; no new read site; the same six sites, offsets moved; B,C,D,F authority retained. Merge of origin/main 90c4d3aa: main's own later changes to this body are kept as main has them, under main's rulings; this branch's change is the same as above. Merge of origin/main 00bf5b8c (fleet set-aside EXDEV fix): main's change to this body is kept as main has it, under its own census ruling; this branch's change is unchanged.;rev3=census-ruling-probe-burst-limit;basis=two more sink wirings beside setAnalyticsSink: setProtectionSink(e.SetProtectionRecordOnly) and setAssetOwnersSource(e.AssetOwners), function values the telemetry pass calls; this body reads nothing new, the same six sites; authority B,C,D,F retained; no new root read or write kind;rev3=census-ruling-region-ha-p1b3a;basis=Arm HA placement exactly once on the existing Service before activatorStart and edges publication, wiring AwakeApps and the PageOperator callback; existing six read sites unchanged, no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: start the concrete coordinator's renewal worker with agent setup; existing closeReplicaCoordinator shutdown cancels and joins it before release. No new read sites or credentials. Merge origin/main c59715e7: retain main's armHAPlacement(svc, PageOperator) wiring beside the existing activator setup; stateless coordinator and shutdown wiring remain. Same read sites; no new root read or credential.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): in the edge-ready callback, calls act.SetHeldWakeHook(e.HeldWake) when act is non-nil (installing the non-blocking wake callback) and stores e.HeldStreamsForStatus in heldStreamsSource. Wiring of in-memory callbacks only; no read added.;rev3=census-ruling-region-ha-p1b3b-t;basis=Wire Service.SetDutyView to the live edge DutySnapshot in the ready callback. No new read; no new loop or cloud operation. B2 wires the registry as the persistent DutyStore before service startup; no new cloud or filesystem path. B3b: arm one journal-backed termination consumer before service startup using agentCtx and the shared confirmer; expose edge tick and join at edge shutdown. No new direct read sites.;rev3=census-ruling-agent-start-demo-1;basis=Passes the existing registry, data store and hibernation prefix into the demo worker, and the existing instance-control client into the demo before-exec hook. No alternate data store or polling loop. Merge resolution against origin/main 9bd45488 retains main's HA departure controller, lifecycle and duty wiring alongside the demo data store and worker; no read site added by the resolution.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: install closed fixed admission before every launch source, bind activator/backend and edge, wire the real termination Started lifecycle and role reader after the change index; close before cancellation/child shutdown. No new external reads or cloud authority. Fix R1: move bind/lifecycle/edge-option wiring into wireAgentAdmission and worker listing into runWorkerBootPassAfterAdmission. Worker boot waits for admission before listing then uses unchanged bounded wakes and per-host serialization; whole Route read moves to the helper. No new storage, cloud, or root execution authority. Preserve merged main's agent wiring and census basis; the branch removes one whole Route use by moving worker iteration to the helper, with no added read kind.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: arms a fleet-only worker using the existing registry, activator, backend and authenticated console transport. Owned worker stops and joins at shutdown. No new bucket reader. merge of origin/main 9b8b2c50: retain HA duty/departure lifecycle, wake-slot and existing agent wiring alongside the replica placement worker; no new read introduced by resolution. merge of origin/main 6be08467: Retain main demo configuration, admission, build and expiry wiring alongside the replica worker; merge-only body change, no additional read. merge of origin/main 7920cccf: Retain main box-role/group admission wiring and boot publication beside the owned replica worker and shutdown; main moves the boot registry List into runWorkerBootPassAfterAdmission, removing its inline whole Route site. No new read introduced by conflict resolution.;rev3=census-ruling-stateless-replicas-3;basis=Task 1 fix round 1 M3: retain the private snapshot source and cancel/join ownership, but use the replica-health-specific retry loop. It logs its first failure only and retains the existing exponential backoff capped at 30 seconds; unsupported builds return nil. Existing five direct read sites unchanged; no new credentials, bucket reader or app lifecycle action. Fix round 1 Q20: publish Edge.ReplicaSnapshots as a separate in-memory status source, leaving the tenant-visible Upstreams source unchanged. No new external reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Load root-written group marker/configuration, configure signed boot binding and agent receipt completer, wire cancellable admission into departure work and expose cached GroupReaderSnapshot. New indirect boot reads use protected root files; agent-owned receipt controls duplicate initial completion only, never root restart permission. Same five direct sites. Merge 45cebde4 retains the replica health socket lifecycle and setReplicaSource beside GroupReaderSnapshot; no extra read beyond main.;rev3=census-ruling-agent-start-demo-2;basis=agent.go:309-329 opens demo-traffic.db beside the operator-configured registry when a demo domain exists, closes it at shutdown and wires drain-before-purge; :1010-1019 shares the worker and write gate; :1164-1177 installs the fleet identity and closed-until-worker serving callback. One added whole Route pass; the new indirect filesystem/SQL reads are claimed in openDemoTraffic and worker/store units. No request chooses the database pathname.;rev3=census-ruling-region-ha-p1b3b-s;basis=Wire the service duty view to authoritative cached sidecar manifest placement in LifetimeIndex and the edge sidecar projection; missing policy denies duty. Existing instance duty wiring remains.;rev3=census-ruling-region-ha-g2-t3;basis=T3a: wire eb.Page = PageOperator beside OwnerTerminated before departures arm, so suspect-holder pages work if departure setup fails; no new read; existing nine sites and authority unchanged; pages through the existing sink. T3b: publish the same backend through an atomic pointer for the metrics observer, and clear it on return; no new external read or authority.;rev3=census-ruling-agent-start-demo-3;basis=Wire the claim activator and root snapshot client into the demo worker; pass moved readiness to status reporting. Census read-site delta: unchanged (9).;rev3=census-ruling-region-ha-g2-fixes;basis=Wire local pool evidence, live withdrawal activator, startup ingress scan and alias publication, and edge lookup; no new direct sites; new indirect record/claim reads use existing store/judge paths described in ingress helpers.;rev3=census-ruling-region-ha-g2r-fixes;basis=W3: starts the existing record-view backstop loop with a departure-inventory listener (non-blocking, coalesced signal) even without an armed RecordView; it requests the existing full pass (backstopFullDue) there. Same nine read sites; no new read or authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Derive one signal-time deadline with a 90-second budget; cap departure stop and startup/seed/service shutdown joins by it. No read added.;rev3=census-ruling-static-sweep-periodic;basis=in the edge-ready callback, publishes e.LargestStaticTree in staticTreeSource for the disk alert line (diskAlertFrac in the metrics loop); in-memory wiring only, no read added; read sites unchanged (9) |
| - `internal/host/bootstrap.go` `bootstrapWithGroup`: legacy, task accepted-legacy. Basis: 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. |
| +- `internal/host/claimactivation_preflight.go` `claimActivationLocalUnits`: authority, task G. Basis: 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 |
| - `internal/host/claimstop_run.go` `RunInstanceControl`: authority, task C,D,G. Basis: 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. |
| - `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/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. |
| @@ -168,8 +170,8 @@ New dispositions, which census-propose wrote and the reviewer checks against the |
| - reads `internal/activator/backend_unit.go:SplitBackend.Start`: +file:Exec, +registry:Backing, +whole:Route; keeps legacy, task accepted-legacy |
| - reads `internal/activator/backend_unit.go:SplitBackend.StartGen`: +file:Exec, +registry:Backing, +whole:Route; keeps legacy, task accepted-legacy |
| - 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 |
| +- reads `internal/activator/unitproc.go:unitProc.stopUnit`: +registry:Host, +registry:Runtime ×2, +whole:Route ×2; keeps legacy, task accepted-legacy |
| -Seal: `b970bb28c5a633d2572a1da549030e9258cfdabb6322ddffdd0ebf41b56c464c` → `4a446166291c2e0f9241d1f82a6f82a4fb64619c00569c809b16e54a28d28cd2`. |
| +Seal: `b970bb28c5a633d2572a1da549030e9258cfdabb6322ddffdd0ebf41b56c464c` → `bc44399085c194c8e6b2f8b68b75dfde8b870dc27f2da0849d8d0d84cda0328c`. |
| Overlay: `internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/activator/control.go b/internal/activator/control.go| index 1b942185f..ad8907151 100644 |
| --- a/internal/activator/control.go |
| +++ b/internal/activator/control.go |
| @@ -30,6 +30,14 @@ type Control interface { |
| var _ Control = (*instancectl.Client)(nil) |
| +// RunInvocationControl prevents a retained original-run handle stopping a |
| +// replacement invocation. A channel without this capability refuses the stop. |
| +type RunInvocationControl interface { |
| + StopRunInvocation(context.Context, string, string, bool) error |
| +} |
| + |
| +var _ RunInvocationControl = (*instancectl.Client)(nil) |
| + |
| // GenControl is the generation half of the instance-control channel |
| // (zero-downtime spec §7.6): the carlos-instance-gen@<id>:<n> template's |
| // start, stop and reset, and the host slice's parent limit (§7.3). It is a |
diff --git a/internal/activator/rootfs_deploy_test.go b/internal/activator/rootfs_deploy_test.go| index 05ef724e4..3fc2ccad7 100644 |
| --- a/internal/activator/rootfs_deploy_test.go |
| +++ b/internal/activator/rootfs_deploy_test.go |
| @@ -850,10 +850,21 @@ func TestRootfsWorkerStopKeepsALingeringHandle(t *testing.T) { |
| if s := r.strays(); !slices.Equal(s, []string{"jobs"}) { |
| t.Fatalf("strays %v, want the lingering jobs", s) |
| } |
| + r.a.mu.Lock() |
| + stopped := r.a.entries[r.host].stopped |
| + r.a.mu.Unlock() |
| p.end() |
| r.clk.advance(actStopTimeout) |
| r.a.sweepOnce() |
| waitFor(t, "the stop to finish", func() bool { return !r.a.hasEntry(r.host) }) |
| + // Entry removal precedes the final generations write. Join that write |
| + // before TempDir cleanup removes the publication directory. |
| + select { |
| + case <-stopped: |
| + case <-time.After(5 * time.Second): |
| + t.Fatal("stop publication did not finish") |
| + } |
| + |
| } |
| t.Run("the running worker's handle", func(t *testing.T) { |
| r := newWorkerRig(t, workerHost(), "jobs") |
diff --git a/internal/activator/rootfs_staged_test.go b/internal/activator/rootfs_staged_test.go| index e9d7a9b34..1d320fa73 100644 |
| --- a/internal/activator/rootfs_staged_test.go |
| +++ b/internal/activator/rootfs_staged_test.go |
| @@ -916,3 +916,10 @@ func TestPlacedChildLaunchesRefuseEveryRuntime(t *testing.T) { |
| } |
| } |
| } |
| + |
| +func (c *stagedRootfsCtl) StopRunInvocation(ctx context.Context, host, invocation string, rootfs bool) error { |
| + if rootfs { |
| + return c.StopRootfs(ctx, host, instancectl.RoleRun, 0, "", false) |
| + } |
| + return c.Stop(ctx, host, instancectl.RoleRun) |
| +} |
diff --git a/internal/activator/sandbox_spawn_guard_test.go b/internal/activator/sandbox_spawn_guard_test.go| index c33475c62..90d2aaae2 100644 |
| --- a/internal/activator/sandbox_spawn_guard_test.go |
| +++ b/internal/activator/sandbox_spawn_guard_test.go |
| @@ -7,6 +7,7 @@ import ( |
| "go/token" |
| "path/filepath" |
| "sort" |
| + "strconv" |
| "strings" |
| "testing" |
| ) |
| @@ -15,6 +16,16 @@ import ( |
| // must trigger the same review as calling cmd.Start directly. |
| func sandboxSpawnReferences(file *ast.File) map[string]int { |
| out := map[string]int{} |
| + imports := map[string]string{} |
| + for _, imp := range file.Imports { |
| + path, _ := strconv.Unquote(imp.Path.Value) |
| + name := path |
| + if imp.Name != nil { |
| + name = imp.Name.Name |
| + } |
| + imports[name] = path |
| + } |
| + |
| for _, decl := range file.Decls { |
| fn, ok := decl.(*ast.FuncDecl) |
| owner := "<package>" |
| @@ -28,7 +39,12 @@ func sandboxSpawnReferences(file *ast.File) map[string]int { |
| return true |
| } |
| name := sel.Sel.Name |
| - if name == "Start" || name == "Run" || name == "Output" || name == "CombinedOutput" || name == "StartGated" || strings.HasPrefix(name, "StartChild") || (strings.HasPrefix(name, "spawnInCgroup") || name == "spawnUnitFrom" || name == "spawnChildFrom" || name == "spawnRootfs" || name == "spawnSuccessor" || name == "spawnPlannedRelease") { |
| + rawProcess := false |
| + if pkg, ok := sel.X.(*ast.Ident); ok { |
| + rawProcess = imports[pkg.Name] == "os" && name == "StartProcess" || imports[pkg.Name] == "syscall" && (name == "Exec" || name == "ForkExec") |
| + } |
| + |
| + if rawProcess || name == "Start" || name == "Run" || name == "Output" || name == "CombinedOutput" || name == "StartGated" || strings.HasPrefix(name, "StartChild") || (strings.HasPrefix(name, "spawnInCgroup") || name == "spawnUnitFrom" || name == "spawnChildFrom" || name == "spawnRootfs" || name == "spawnSuccessor" || name == "spawnPlannedRelease") { |
| out[owner+":"+name]++ |
| } |
| return true |
| @@ -162,6 +178,10 @@ func TestSandboxSpawnGuard(t *testing.T) { |
| t.Fatalf("spawn inventory changed; review the sandbox gate before accepting:\n%s", strings.Join(changes, "\n")) |
| } |
| for _, fixture := range []string{ |
| + `package activator; import proc "os"; func escape(){ launch:=proc.StartProcess; _,_=launch("tenant",nil,nil) }`, |
| + `package activator; import sys "syscall"; func escape(){ launch:=sys.ForkExec; _,_=launch("tenant",nil,nil) }`, |
| + `package activator; import sys "syscall"; func escape(){ launch:=sys.Exec; _=launch("tenant",nil,nil) }`, |
| + |
| `package activator; import renamed "os/exec"; func escape(){ c:=renamed.Command("tenant"); fire:=c.Start; _=fire() }`, |
| `package activator; import "os/exec"; func escape(){ exec.Command("systemctl","start","carlos-app@demo.service").Run() }`, |
| `package activator; import "os/exec"; func escape(){ c:=exec.Command("tenant"); out:=c.CombinedOutput; _,_=out() }`, |
diff --git a/internal/activator/sandbox_test.go b/internal/activator/sandbox_test.go| index ebd6be403..5407c5a67 100644 |
| --- a/internal/activator/sandbox_test.go |
| +++ b/internal/activator/sandbox_test.go |
| @@ -181,6 +181,28 @@ func TestAgentSandboxStagedZeroRefused(t *testing.T) { |
| } |
| } |
| +func TestAgentSandboxNestedDemoStillRefusesDirectPrimitives(t *testing.T) { |
| + b, rt := nestedBackend(t, &fakeControl{}, &fakeUnit{}) |
| + b.SandboxEffective = execsandbox.EffectiveGVisor |
| + rt.DemoID = "AAAAAAAAAAAAAAAAAAAAAA" |
| + if err := b.sandboxLaunch(rt, "run", 0, true); err != nil { |
| + t.Fatal("outer launch did not pass", err) |
| + } |
| + calls := 0 |
| + build := func() *exec.Cmd { calls++; return exec.Command("must-not-run") } |
| + _, _, a := b.spawnChildFrom(context.Background(), rt, rt.Socket, 0, "", cgroup.Limit{}) |
| + _, _, d := b.spawnInCgroupGated(rt, cgroup.Limit{}, build, nil) |
| + _, _, c := b.spawnInCgroupAtTier(rt, "role-run", true, cgroup.Limit{}, build, nil) |
| + for _, err := range []error{a, d, c} { |
| + if !errors.Is(err, execsandbox.ErrUnsupported) { |
| + t.Fatal(err) |
| + } |
| + } |
| + if calls != 0 { |
| + t.Fatal("direct spawn reached", calls) |
| + } |
| +} |
| + |
| type missingWorkerIdentityControl struct{ *fakeControl } |
| func (c missingWorkerIdentityControl) StartRootfsWorker(context.Context, string, string, int64, instancectl.StagedImage) (instancectl.StartResponse, error) { |
| @@ -241,6 +263,67 @@ type sandboxLifecycleControl struct { |
| start func() (instancectl.StartResponse, error) |
| } |
| +type staleRunControl struct { |
| + *fakeControl |
| + invocation string |
| + rootfs bool |
| +} |
| + |
| +func (c *staleRunControl) StopRunInvocation(_ context.Context, _ string, inv string, rootfs bool) error { |
| + c.invocation, c.rootfs = inv, rootfs |
| + return instancectl.ErrStaleInvocation |
| +} |
| + |
| +func TestAgentSandboxOldHandleLeavesSuccessorRunning(t *testing.T) { |
| + unit := &fakeUnit{} |
| + unit.set("inactive", "old", false, false) |
| + ctl := &staleRunControl{fakeControl: &fakeControl{}} |
| + b, rt := nestedBackend(t, ctl.fakeControl, unit) |
| + b.Control = ctl |
| + p, err := b.newUnitProcFor(rt, instancectl.RoleRun, 0, b.pathsFor(rt), instancectl.StartResponse{Unit: instancectl.UnitName(instancectl.RoleRun, rt.Host), Sandbox: "systemd", InvocationID: "old"}, nil, nil) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + select { |
| + case <-p.done: |
| + case <-time.After(time.Second): |
| + t.Fatal("old invocation did not end") |
| + } |
| + unit.set("active", "new", true, true) |
| + if err := p.Stop(context.Background()); err != nil { |
| + t.Fatal(err) |
| + } |
| + active, inv, _ := unit.state(context.Background(), p.unit) |
| + if ctl.invocation != "old" || ctl.rootfs || active != "active" || inv != "new" || len(ctl.callList()) != 0 { |
| + t.Fatalf("successor affected: %q %q %+v", active, inv, ctl) |
| + } |
| +} |
| + |
| +func TestAgentSandboxForeignSuccessorEndsOldObserver(t *testing.T) { |
| + unit := &fakeUnit{} |
| + unit.set("active", "new", true, true) |
| + ctl := &staleRunControl{fakeControl: &fakeControl{}} |
| + b, rt := nestedBackend(t, ctl.fakeControl, unit) |
| + b.Control = ctl |
| + p, err := b.newUnitProcFor(rt, instancectl.RoleRun, 0, b.pathsFor(rt), instancectl.StartResponse{Unit: instancectl.UnitName(instancectl.RoleRun, rt.Host), Sandbox: "systemd", InvocationID: "old"}, nil, nil) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + select { |
| + case <-p.done: |
| + case <-time.After(time.Second): |
| + t.Fatal("stale observer waited on the successor's cgroup") |
| + } |
| + if !p.Exited() { |
| + t.Fatal("old invocation not discharged") |
| + } |
| + active, inv, _ := unit.state(context.Background(), p.unit) |
| + if active != "active" || inv != "new" || len(ctl.callList()) != 0 { |
| + t.Fatal("successor stopped") |
| + } |
| + p.closeListeners() |
| +} |
| + |
| func (c sandboxLifecycleControl) Start(context.Context, string, instancectl.Role, int64) (instancectl.StartResponse, error) { |
| return c.start() |
| } |
diff --git a/internal/activator/swap_nested_test.go b/internal/activator/swap_nested_test.go| index d56609e6e..1d8d3c8b9 100644 |
| --- a/internal/activator/swap_nested_test.go |
| +++ b/internal/activator/swap_nested_test.go |
| @@ -264,3 +264,7 @@ func TestStartStagedNestedWithoutAStagedPathUsesTheLiveLink(t *testing.T) { |
| t.Fatalf("StartStaged = %v; root was sent %+v: want plan 2's live-link start", err, ctl.got) |
| } |
| } |
| + |
| +func (c *exeControl) StopRunInvocation(ctx context.Context, host, invocation string, rootfs bool) error { |
| + return c.Stop(ctx, host, instancectl.RoleRun) |
| +} |
diff --git a/internal/activator/unitproc.go b/internal/activator/unitproc.go| index 85dc15260..9a8e3fe2b 100644 |
| --- a/internal/activator/unitproc.go |
| +++ b/internal/activator/unitproc.go |
| @@ -322,6 +322,18 @@ func (p *unitProc) stopUnit(ctx context.Context) (err error) { |
| if strings.HasPrefix(p.unit, "carlos-instance-rootfs") { |
| rt.Runtime = registry.RuntimeRootfsV1 |
| } |
| + if p.role == instancectl.RoleRun && p.gen == 0 { |
| + bound, ok := p.b.Control.(RunInvocationControl) |
| + if !ok { |
| + return errors.New("instance control cannot stop a retained invocation") |
| + } |
| + err = bound.StopRunInvocation(ctx, p.rt.Host, p.invocation, rt.Rootfs()) |
| + if errors.Is(err, instancectl.ErrStaleInvocation) { |
| + p.stopRequested.Store(true) |
| + return nil |
| + } |
| + return err |
| + } |
| err = p.b.stopRole(ctx, rt, p.role, p.gen) |
| if err == nil && p.gen != 0 { |
| p.genFilesGone.Store(true) |
diff --git a/internal/activator/unitproc_test.go b/internal/activator/unitproc_test.go| index 0528d203f..fae8da3ad 100644 |
| --- a/internal/activator/unitproc_test.go |
| +++ b/internal/activator/unitproc_test.go |
| @@ -921,3 +921,10 @@ func serveOK(t *testing.T, path string) func() { |
| go srv.Serve(ln) //nolint:errcheck |
| return func() { srv.Close(); ln.Close() } |
| } |
| + |
| +func (c *fakeControl) StopRunInvocation(ctx context.Context, host, invocation string, rootfs bool) error { |
| + if rootfs { |
| + return c.StopRootfs(ctx, host, instancectl.RoleRun, 0, "", false) |
| + } |
| + return c.Stop(ctx, host, instancectl.RoleRun) |
| +} |
diff --git a/internal/host/claimactivation_preflight.go b/internal/host/claimactivation_preflight.go| index 0d34853fc..c616d2ade 100644 |
| --- a/internal/host/claimactivation_preflight.go |
| +++ b/internal/host/claimactivation_preflight.go |
| @@ -137,11 +137,8 @@ func claimActivationLocalUnits(r ClaimRuntimeResources) error { |
| return hostwrite.ErrUnavailable |
| } |
| if entry.IsDir() { |
| - if r.Mode == "agent" && filepath.Dir(path) == "/run/systemd/system" && strings.HasSuffix(name, ".d") { |
| - role, _, ordinary := instancectl.ParseUnitName(strings.TrimSuffix(name, ".d")) |
| - if ordinary && role == instancectl.RoleRun { |
| - return fs.SkipDir |
| - } |
| + if claimPreflightSkipDropin(r.Mode, filepath.Dir(path), name) { |
| + return fs.SkipDir |
| } |
| return nil |
| } |
| @@ -171,3 +168,11 @@ func claimActivationLocalUnits(r ClaimRuntimeResources) error { |
| } |
| return nil |
| } |
| + |
| +func claimPreflightSkipDropin(mode, parent, name string) bool { |
| + if mode != "agent" || parent != "/run/systemd/system" || !strings.HasSuffix(name, ".d") { |
| + return false |
| + } |
| + role, _, ordinary := instancectl.ParseUnitName(strings.TrimSuffix(name, ".d")) |
| + return ordinary && role == instancectl.RoleRun |
| +} |
diff --git a/internal/host/claimunit_dropin_test.go b/internal/host/claimunit_dropin_test.go| index 00fd2ed6b..45d8da254 100644 |
| --- a/internal/host/claimunit_dropin_test.go |
| +++ b/internal/host/claimunit_dropin_test.go |
| @@ -29,3 +29,22 @@ func TestClaimDropinUnitRefusesRootfsUnits(t *testing.T) { |
| } |
| } |
| } |
| + |
| +func TestGVisorClaimConsumers(t *testing.T) { |
| + host := "demo.example" |
| + unit := instancectl.GVisorUnitName(host) |
| + if claimDropinUnit(unit) { |
| + t.Fatal("gVisor acquired claim drop-in authority") |
| + } |
| + if claimPreflightSkipDropin("agent", "/run/systemd/system", unit+".d") { |
| + t.Fatal("claims preflight hides gVisor leftovers") |
| + } |
| + for _, native := range []string{instancectl.UnitName(instancectl.RoleRun, host), instancectl.GenUnitName(host, 3)} { |
| + if !claimDropinUnit(native) || !claimPreflightSkipDropin("agent", "/run/systemd/system", native+".d") { |
| + t.Fatal("native claim behavior changed", native) |
| + } |
| + } |
| + if _, ok := instancectl.ParseRole(string(instancectl.RoleGVisorRun)); ok { |
| + t.Fatal("discovery kind became a request role") |
| + } |
| +} |
diff --git a/internal/host/egress_startpaths_rootrunner_linux_test.go b/internal/host/egress_startpaths_rootrunner_linux_test.go| index d3f26f606..f184ad0f3 100644 |
| --- a/internal/host/egress_startpaths_rootrunner_linux_test.go |
| +++ b/internal/host/egress_startpaths_rootrunner_linux_test.go |
| @@ -106,7 +106,7 @@ func TestRootEgressStartPathsPreClaim(t *testing.T) { |
| b.wantAllowed(t, "cmd") |
| var st instancectl.CmdStatus |
| for deadline := time.Now().Add(30 * time.Second); ; { |
| - if st, err = b.client.CmdStatus(ctx, b.host, inv); err != nil { |
| + if st, err = b.client.CmdStatus(ctx, b.host, inv.InvocationID); err != nil { |
| t.Fatal("GET /cmd:", err) |
| } |
| if st.State != instancectl.CmdRunning { |
| @@ -1187,7 +1187,7 @@ func egressNoPolicyStarts(t *testing.T, wired bool) map[string]map[string]string |
| } |
| var st instancectl.CmdStatus |
| for deadline := time.Now().Add(30 * time.Second); ; { |
| - if st, err = b.client.CmdStatus(ctx, b.host, inv); err != nil { |
| + if st, err = b.client.CmdStatus(ctx, b.host, inv.InvocationID); err != nil { |
| t.Fatal("GET /cmd:", err) |
| } |
| if st.State != instancectl.CmdRunning { |
diff --git a/internal/host/gvisor_stop_rootrunner_linux_test.go b/internal/host/gvisor_stop_rootrunner_linux_test.go| new file mode 100644 |
| index 000000000..f835fe98d |
| --- /dev/null |
| +++ b/internal/host/gvisor_stop_rootrunner_linux_test.go |
| @@ -0,0 +1,184 @@ |
| +//go:build linux && rootrunner |
| + |
| +package host |
| + |
| +import ( |
| + "context" |
| + "crypto/rand" |
| + "encoding/hex" |
| + "fmt" |
| + "net/http" |
| + "net/http/httptest" |
| + "os" |
| + "os/exec" |
| + "path/filepath" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/execsandbox" |
| + "github.com/carlosframework/platform/internal/instancectl" |
| +) |
| + |
| +// This witnesses the production /stop handler, systemd state and cgroup proof. |
| +// The gVisor-named fixture runs sleep, not runsc; runtime isolation is not claimed. |
| +func TestRootGVisorStopProof(t *testing.T) { |
| + if os.Geteuid() != 0 { |
| + t.Fatal("requires the throwaway root runner") |
| + } |
| + ctx, cancel := context.WithTimeout(context.Background(), 90*time.Second) |
| + defer cancel() |
| + ctl := func(ctx context.Context, args ...string) (string, error) { |
| + b, e := exec.CommandContext(ctx, "systemctl", args...).CombinedOutput() |
| + return string(b), e |
| + } |
| + must := func(args ...string) string { |
| + t.Helper() |
| + out, err := ctl(ctx, args...) |
| + if err != nil { |
| + t.Fatalf("systemctl %v: %v: %s", args, err, out) |
| + } |
| + return out |
| + } |
| + var nonce [6]byte |
| + if _, err := rand.Read(nonce[:]); err != nil { |
| + t.Fatal(err) |
| + } |
| + host := "gs" + hex.EncodeToString(nonce[:]) + ".example" |
| + native, gvisor := instancectl.UnitName(instancectl.RoleRun, host), instancectl.GVisorUnitName(host) |
| + slice := instancectl.SliceName(host) |
| + parents := []string{slice, "carlos-instances.slice", "carlos.slice"} |
| + for _, unit := range append([]string{native, gvisor}, parents...) { |
| + raw := must("show", "-p", "ActiveState", unit) |
| + if !strings.Contains(raw, "ActiveState=inactive\n") { |
| + t.Fatalf("fixture unit already used: %s %s", unit, raw) |
| + } |
| + } |
| + var files, dirs []string |
| + t.Cleanup(func() { |
| + clean, cancel := context.WithTimeout(context.Background(), 20*time.Second) |
| + defer cancel() |
| + for _, unit := range []string{native, gvisor} { |
| + _, _ = ctl(clean, "stop", unit) |
| + } |
| + for _, path := range files { |
| + if err := os.Remove(path); err != nil && !os.IsNotExist(err) { |
| + t.Error(err) |
| + } |
| + } |
| + _, _ = ctl(clean, "daemon-reload") |
| + for _, unit := range parents { |
| + _, _ = ctl(clean, "stop", unit) |
| + } |
| + for i := len(dirs) - 1; i >= 0; i-- { |
| + if err := os.Remove(dirs[i]); err != nil && !os.IsNotExist(err) { |
| + t.Errorf("fixture cleanup %s: %v", dirs[i], err) |
| + } |
| + } |
| + }) |
| + install := func(unit string) { |
| + t.Helper() |
| + path := filepath.Join("/run/systemd/system", unit) |
| + f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0644) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + files = append(files, path) |
| + body := fmt.Sprintf("[Unit]\nDescription=Task 5 stop proof fixture\n[Service]\nType=exec\nExecStart=/bin/sleep infinity\nSlice=%s\nKillMode=control-group\nTimeoutStopSec=3s\n", slice) |
| + if unit == gvisor { |
| + body += "ExecStop=/bin/kill -TERM $MAINPID\nKillSignal=SIGCONT\n" |
| + } |
| + _, err = f.WriteString(body) |
| + closeErr := f.Close() |
| + if err != nil || closeErr != nil { |
| + t.Fatal(err, closeErr) |
| + } |
| + must("daemon-reload") |
| + } |
| + for _, dir := range []string{"/run/carlos-control", "/run/carlos-control/oci", "/var/lib/carlos", "/var/lib/carlos/oci-rootfs"} { |
| + if err := os.Mkdir(dir, 0700); err == nil { |
| + dirs = append(dirs, dir) |
| + } else if !os.IsExist(err) { |
| + t.Fatal(err) |
| + } |
| + } |
| + id, err := instancectl.GVisorID(host, instancectl.RoleRun, 0) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + artifacts := []string{execsandbox.BundleDir(id), execsandbox.RootfsDir(id)} |
| + makeArtifacts := func() { |
| + t.Helper() |
| + for _, dir := range artifacts { |
| + if err := os.Mkdir(dir, 0700); err != nil { |
| + t.Fatal(err) |
| + } |
| + dirs = append(dirs, dir) |
| + } |
| + } |
| + s := &instancectl.Server{Systemctl: ctl, CgroupRoot: "/sys/fs/cgroup", SandboxConfigErr: execsandbox.ErrRunsc} |
| + handler := s.Handler() |
| + stop := func(inv string, want int) { |
| + t.Helper() |
| + path := "/stop?host=" + host + "&role=run" |
| + if inv != "" { |
| + path += "&invocation=" + inv |
| + } |
| + w := httptest.NewRecorder() |
| + handler.ServeHTTP(w, httptest.NewRequest(http.MethodPost, path, nil).WithContext(ctx)) |
| + if w.Code != want { |
| + t.Fatalf("/stop: %d %s; want %d", w.Code, w.Body, want) |
| + } |
| + } |
| + show := func(unit string) string { |
| + raw := must("show", "-p", "Id,LoadState,ActiveState,SubState,Job,ControlPID,MainPID,ExecMainStatus,Result,InvocationID,ControlGroup", unit) |
| + t.Logf("%s:\n%s", unit, raw) |
| + return raw |
| + } |
| + checkRemoved := func() { |
| + t.Helper() |
| + for _, dir := range artifacts { |
| + if _, err := os.Lstat(dir); !os.IsNotExist(err) { |
| + t.Fatalf("kept artifact %s: %v", dir, err) |
| + } |
| + } |
| + } |
| + install(native) |
| + if raw := show(native); !strings.Contains(raw, "LoadState=loaded\n") || !strings.Contains(raw, "Job=\n") { |
| + t.Fatal(raw) |
| + } |
| + if raw := show(gvisor); !strings.Contains(raw, "LoadState=not-found\n") { |
| + t.Fatal(raw) |
| + } |
| + makeArtifacts() |
| + stop("", http.StatusNoContent) |
| + checkRemoved() |
| + install(gvisor) |
| + for _, unit := range []string{native, gvisor} { |
| + must("start", unit) |
| + if raw := show(unit); !strings.Contains(raw, "ActiveState=active\n") { |
| + t.Fatal(raw) |
| + } |
| + makeArtifacts() |
| + stop("", http.StatusNoContent) |
| + checkRemoved() |
| + if raw := show(unit); !strings.Contains(raw, "ActiveState=inactive\n") || !strings.Contains(raw, "MainPID=0\n") || !strings.Contains(raw, "ControlPID=0\n") { |
| + t.Fatal(raw) |
| + } |
| + } |
| + // A late stop from the previous invocation must leave its successor alive. |
| + must("start", native) |
| + old := strings.TrimSpace(must("show", "-p", "InvocationID", "--value", native)) |
| + must("stop", native) |
| + must("start", native) |
| + next := strings.TrimSpace(must("show", "-p", "InvocationID", "--value", native)) |
| + if old == "" || next == "" || old == next { |
| + t.Fatal("missing replacement invocation") |
| + } |
| + stop(old, http.StatusConflict) |
| + if raw := show(native); !strings.Contains(raw, "InvocationID="+next+"\n") || !strings.Contains(raw, "ActiveState=active\n") { |
| + t.Fatal("stale stop affected successor", raw) |
| + } |
| + stop(next, http.StatusNoContent) |
| + t.Log("loaded-inactive, not-found, running native/gVisor fixtures and stale-handle refusal: PASS") |
| +} |
diff --git a/internal/host/rollout.go b/internal/host/rollout.go| index ba43a0bd4..b7c1e89b5 100644 |
| --- a/internal/host/rollout.go |
| +++ b/internal/host/rollout.go |
| @@ -158,7 +158,8 @@ var placementCheck = func(m *cgroup.Manager) error { |
| // swapArming decides, before the activator exists, whether CARLOS_SWAP=overlap |
| // turns generations on (spec §15; plan 3's review: missing delegation must |
| // fail closed, CODEX-FINDINGS-ZDD-IMPL-3.md:138). With the flag off it is |
| -// false and says nothing. With the flag on but host claims on, or no usable |
| +// false and says nothing, except that gVisor always publishes its refusal. |
| +// With the flag on but host claims on, or no usable |
| // containment, it is false too (claims-on boxes get no swaps, the owner's |
| // ruling, #272): generations, generation containment and the scheduler all stay |
| // off, every leg keeps today's paths but for the failure records armRollout |
diff --git a/internal/host/rootfsstart_test.go b/internal/host/rootfsstart_test.go| index 45dc89193..7461e3f4f 100644 |
| --- a/internal/host/rootfsstart_test.go |
| +++ b/internal/host/rootfsstart_test.go |
| @@ -129,3 +129,10 @@ func TestArmedRootfsGatesRefuseARootfsStartOnASharedBox(t *testing.T) { |
| t.Fatalf("Start on a single-tenant box = %v (materialized %d); want it past the gates, at the live link", err, materialized) |
| } |
| } |
| + |
| +func (c *rootfsWireControl) StopRunInvocation(ctx context.Context, host, invocation string, rootfs bool) error { |
| + if rootfs { |
| + return c.StopRootfs(ctx, host, instancectl.RoleRun, 0, "", false) |
| + } |
| + return c.Stop(ctx, host, instancectl.RoleRun) |
| +} |
diff --git a/internal/host/size_rootrunner_linux_test.go b/internal/host/size_rootrunner_linux_test.go| index 8ec18f962..42032a3b7 100644 |
| --- a/internal/host/size_rootrunner_linux_test.go |
| +++ b/internal/host/size_rootrunner_linux_test.go |
| @@ -399,7 +399,7 @@ func TestSizesThroughEveryStartPathRootRunner(t *testing.T) { |
| wantSliceRow(t, step, b.slice, row) |
| var st instancectl.CmdStatus |
| for deadline := time.Now().Add(30 * time.Second); ; { |
| - if st, err = b.client.CmdStatus(ctx, b.host, inv); err != nil { |
| + if st, err = b.client.CmdStatus(ctx, b.host, inv.InvocationID); err != nil { |
| t.Fatal(step, "GET /cmd:", err) |
| } |
| if st.State != instancectl.CmdRunning { |
diff --git a/internal/host/systemunits.go b/internal/host/systemunits.go| index b53e893f5..6f66f584e 100644 |
| --- a/internal/host/systemunits.go |
| +++ b/internal/host/systemunits.go |
| @@ -3,6 +3,7 @@ package host |
| import ( |
| "bytes" |
| "errors" |
| + "github.com/carlosframework/platform/internal/instancectl" |
| "os" |
| "os/exec" |
| "path/filepath" |
| @@ -33,7 +34,7 @@ var ensureSystemArmed = []string{systemUpdatePathUnit, systemRecoverUnit, instan |
| // carlos-dbread.socket and its service template are the db-read worker's |
| // (db region forward spec §8.3): installed and the socket armed here, the |
| // template never started. |
| -var systemUnitFiles = []string{"carlos-runsc.service", "carlos-instance-gvisor@.service", "carlos-instance-gvisor-probe.service", "carlos-demo-build-gvisor@.service", "carlos-system-update.path", "carlos-system-update.service", systemRecoverUnit, instanceControlSocket, "carlos-instance-control.service", dbReadSocketUnit, "carlos-dbread@.service", "carlos-demo-build@.service", "carlos-demo-builds.slice"} |
| +var systemUnitFiles = []string{"carlos-runsc.service", instancectl.UnitPrefixGVisor + ".service", "carlos-instance-gvisor-probe.service", "carlos-demo-build-gvisor@.service", "carlos-system-update.path", "carlos-system-update.service", systemRecoverUnit, instanceControlSocket, "carlos-instance-control.service", dbReadSocketUnit, "carlos-dbread@.service", "carlos-demo-build@.service", "carlos-demo-builds.slice"} |
| // ensureSystemUnits is the second belt of spec §7: a box the roll script |
| // forgot to arm is armed within the hour by the root adopt pass. It |
diff --git a/internal/instancectl/client.go b/internal/instancectl/client.go| index c6482b98f..31997cac2 100644 |
| --- a/internal/instancectl/client.go |
| +++ b/internal/instancectl/client.go |
| @@ -222,6 +222,24 @@ func (c *Client) Stop(ctx context.Context, host string, role Role) error { |
| return err |
| } |
| +// StopRunInvocation is for a retained original-run handle. Uncertain starts |
| +// still use Stop without an invocation to fence and stop both siblings. |
| +func (c *Client) StopRunInvocation(ctx context.Context, host, invocation string, rootfs bool) error { |
| + if invocation == "" { |
| + return ErrStaleInvocation |
| + } |
| + q := hostRole(host, RoleRun) |
| + q.Set("invocation", invocation) |
| + if rootfs { |
| + q.Set("runtime", runtimeRootfs) |
| + } |
| + status, _, err := c.do(ctx, DeadlineControl, http.MethodPost, "/stop", q, nil) |
| + if status == http.StatusConflict { |
| + return fmt.Errorf("%w: %v", ErrStaleInvocation, err) |
| + } |
| + return err |
| +} |
| + |
| // Cmd starts host's cmd unit and returns its invocation (run spec §5.4). |
| func (c *Client) Cmd(ctx context.Context, host string, memoryMax int64) (StartResponse, error) { |
| return c.cmdQuery(ctx, "/cmd", host, memoryMax, nil) |
| @@ -443,15 +461,15 @@ func (c *Client) readyReport(ctx context.Context, path string, requireDemo bool) |
| } else if err != nil { |
| return rep, err |
| } |
| + if got := hdr.Get(BuildHeader); c.Build != "" && got != c.Build { |
| + return rep, &StaleBuildError{Running: got, Want: c.Build} |
| + } |
| if rep.Sandbox != c.expectedMode() || rep.ExecSandbox != nil && rep.ExecSandbox.Effective != rep.Sandbox { |
| return rep, execsandbox.ErrMismatch |
| } |
| if err != nil { |
| return rep, err |
| } |
| - if got := hdr.Get(BuildHeader); c.Build != "" && got != c.Build { |
| - return rep, &StaleBuildError{Running: got, Want: c.Build} |
| - } |
| if requireDemo && hdr.Get("Carlos-Demo-Box") != "1" { |
| return rep, demo.ErrPolicy |
| } |
diff --git a/internal/instancectl/identity.go b/internal/instancectl/identity.go| index 43b1aad8e..88ae1a189 100644 |
| --- a/internal/instancectl/identity.go |
| +++ b/internal/instancectl/identity.go |
| @@ -14,7 +14,7 @@ func UnitFamily(unit string) (execsandbox.Family, bool) { |
| if id, ok := Unescape(esc); !ok || !execsandbox.ValidID(id) { |
| return "", false |
| } |
| - if strings.HasPrefix(unit, "carlos-instance-gvisor@") { |
| + if strings.HasPrefix(unit, UnitPrefixGVisor) { |
| return execsandbox.FamilyGVisor, true |
| } |
| return execsandbox.FamilySystemd, true |
diff --git a/internal/instancectl/legacystart.go b/internal/instancectl/legacystart.go| index 70619bb65..d8fc7a2c3 100644 |
| --- a/internal/instancectl/legacystart.go |
| +++ b/internal/instancectl/legacystart.go |
| @@ -112,8 +112,13 @@ func (s *Server) beginLegacyStart(parent context.Context, host string, seq uint6 |
| // the stop is done, and only connections accepted before the watermark |
| // stay refused. An error means an attempt did not return in time and may |
| // still submit. |
| -func (s *Server) fenceLegacyStarts(ctx context.Context, host string) (func(), error) { |
| +func (s *Server) fenceLegacyStarts(ctx context.Context, host string, invocation ...string) (func(), error) { |
| s.legacyMu.Lock() |
| + // A retained handle cannot cancel a newer start that has no invocation yet. |
| + if len(invocation) > 0 && invocation[0] != "" && len(s.legacyStarts[host]) > 0 { |
| + s.legacyMu.Unlock() |
| + return func() {}, ErrStaleInvocation |
| + } |
| seq := s.connSeq.Load() |
| if s.legacyStopping == nil { |
| s.legacyStopping = make(map[string]int) |
diff --git a/internal/instancectl/names.go b/internal/instancectl/names.go| index 60dfae808..b7267ebcb 100644 |
| --- a/internal/instancectl/names.go |
| +++ b/internal/instancectl/names.go |
| @@ -30,9 +30,11 @@ import ( |
| type Role string |
| const ( |
| - RoleRun Role = "run" |
| - RoleSeed Role = "seed" |
| - RoleSidecar Role = "sidecar" |
| + RoleRun Role = "run" |
| + // RoleGVisorRun is a discovery kind, never an accepted request role. |
| + RoleGVisorRun Role = "gvisor-run" |
| + RoleSeed Role = "seed" |
| + RoleSidecar Role = "sidecar" |
| // RoleCmd is one `carlos run` command (run spec §5.4). "run" is the |
| // serving role already, so the command's role is cmd. |
| RoleCmd Role = "cmd" |
| @@ -88,6 +90,7 @@ func Escape(s string) string { |
| // platform's to start, stop and sweep; nothing else is (design §5.3). |
| const ( |
| UnitPrefixRun = "carlos-instance@" |
| + UnitPrefixGVisor = "carlos-instance-gvisor@" |
| UnitPrefixSeed = "carlos-instance-seed@" |
| UnitPrefixSidecar = "carlos-instance-sidecar@" |
| UnitPrefixCmd = "carlos-instance-cmd@" |
| @@ -463,7 +466,7 @@ func ParseUnitName(unit string) (Role, string, bool) { |
| }{ |
| {UnitPrefixSeed, RoleSeed}, {UnitPrefixSidecar, RoleSidecar}, {UnitPrefixCmd, RoleCmd}, {UnitPrefixTTY, RoleTTY}, |
| {UnitPrefixRootfsCmd, RoleCmd}, {UnitPrefixRootfsTTY, RoleTTY}, {UnitPrefixRootfs, RoleRun}, |
| - {UnitPrefixRun, RoleRun}, {"carlos-instance-gvisor@", RoleRun}, |
| + {UnitPrefixRun, RoleRun}, {UnitPrefixGVisor, RoleGVisorRun}, |
| } { |
| if strings.HasPrefix(body, p.prefix) { |
| esc := strings.TrimPrefix(body, p.prefix) |
diff --git a/internal/instancectl/ocibundle.go b/internal/instancectl/ocibundle.go| index 2dd5a65f4..9400ac580 100644 |
| --- a/internal/instancectl/ocibundle.go |
| +++ b/internal/instancectl/ocibundle.go |
| @@ -39,7 +39,7 @@ func GVisorUnitName(host string) string { |
| if _, err := GVisorID(host, RoleRun, 0); err != nil { |
| return "" |
| } |
| - return "carlos-instance-gvisor@" + Escape(provision.InstanceID(host)) + ".service" |
| + return UnitPrefixGVisor + Escape(provision.InstanceID(host)) + ".service" |
| } |
| type gvisorInputs struct { |
diff --git a/internal/instancectl/rootfs.go b/internal/instancectl/rootfs.go| index bab78bf13..587977698 100644 |
| --- a/internal/instancectl/rootfs.go |
| +++ b/internal/instancectl/rootfs.go |
| @@ -1150,8 +1150,12 @@ func (s *Server) stopRootfs(w http.ResponseWriter, r *http.Request, req request) |
| return |
| } |
| if req.role == RoleRun && req.gen == 0 { |
| - release, err := s.fenceLegacyStarts(ctx, req.host) |
| + release, err := s.fenceLegacyStarts(ctx, req.host, req.invocation) |
| defer release() |
| + if errors.Is(err, ErrStaleInvocation) { |
| + http.Error(w, err.Error(), http.StatusConflict) |
| + return |
| + } |
| if err != nil { |
| _, _ = s.Systemctl(ctx, "stop", unit) |
| s.stopRunFamiliesBestEffort(ctx, req.host) |
| @@ -1159,6 +1163,12 @@ func (s *Server) stopRootfs(w http.ResponseWriter, r *http.Request, req request) |
| return |
| } |
| } |
| + if req.invocation != "" { |
| + if err := s.checkStopInvocation(ctx, req.invocation, unit); err != nil { |
| + writeStopInvocationError(w, err) |
| + return |
| + } |
| + } |
| // A kill's unproven answer is statusGenUnproven whatever the role, so |
| // the agent types it (ErrGenUnproven) as it types a generation's. |
| perStart := req.gen != 0 || req.role == RoleWorker || req.kill |
diff --git a/internal/instancectl/sandbox_status_test.go b/internal/instancectl/sandbox_status_test.go| index b6baf72ca..a167b4ae2 100644 |
| --- a/internal/instancectl/sandbox_status_test.go |
| +++ b/internal/instancectl/sandbox_status_test.go |
| @@ -51,3 +51,43 @@ func TestAgentSandboxStatusPreservesBlockedRootReport(t *testing.T) { |
| t.Fatalf("transport retained ready state: %+v %v", got, err) |
| } |
| } |
| + |
| +func TestAgentSandboxOldRootKeepsRestartGuidance(t *testing.T) { |
| + for _, status := range []int{204, 503} { |
| + c := sandboxReportClient(t, status, ProbeReport{}, execsandbox.EffectiveGVisor) |
| + c.Build = "new-build" |
| + err := c.Ready(context.Background()) |
| + var stale *StaleBuildError |
| + if !errors.As(err, &stale) || !strings.Contains(err.Error(), "restart carlos-instance-control.service") { |
| + t.Fatalf("status %d: %v", status, err) |
| + } |
| + } |
| +} |
| + |
| +func TestClientBoundStopNamesInvocation(t *testing.T) { |
| + for _, rootfs := range []bool{false, true} { |
| + t.Run(map[bool]string{false: "binary", true: "rootfs"}[rootfs], func(t *testing.T) { |
| + host := "demo.example" |
| + unit := UnitName(RoleRun, host) |
| + if rootfs { |
| + unit = RootfsUnitName(RoleRun, host) |
| + } |
| + ctl := &fakeCtl{dynamic: func(args []string) (string, bool) { |
| + if args[0] == "show" && args[len(args)-1] == unit { |
| + return systemd257Running, true |
| + } |
| + return "", false |
| + }} |
| + _, c := newClient(t, ctl) |
| + err := c.StopRunInvocation(context.Background(), host, "old", rootfs) |
| + if !errors.Is(err, ErrStaleInvocation) { |
| + t.Fatalf("bound stop: %v", err) |
| + } |
| + for _, line := range strings.Split(ctl.joined(), "\n") { |
| + if strings.HasPrefix(line, "stop ") { |
| + t.Fatal("stale client stopped successor", line) |
| + } |
| + } |
| + }) |
| + } |
| +} |
diff --git a/internal/instancectl/sandboxstop.go b/internal/instancectl/sandboxstop.go| index 6fe4253af..42cc70b92 100644 |
| --- a/internal/instancectl/sandboxstop.go |
| +++ b/internal/instancectl/sandboxstop.go |
| @@ -26,32 +26,14 @@ func (s *Server) stopRunFamiliesBestEffort(ctx context.Context, host string) { |
| // stopRunFamilies runs while the caller holds the original-run start fence. |
| // Configuration and readiness cannot disable cleanup of an older family. |
| func (s *Server) stopRunFamilies(ctx context.Context, host string) error { |
| + // Native cleanup must not depend on whether a sibling ID can be derived. |
| + nativeErr := s.stopAndProveRun(ctx, host, UnitName(RoleRun, host)) |
| id, err := GVisorID(host, RoleRun, 0) |
| if err != nil { |
| - return err |
| - } |
| - units := []string{UnitName(RoleRun, host), GVisorUnitName(host)} |
| - var failures []error |
| - for _, unit := range units { |
| - out, err := s.Systemctl(ctx, "show", "-p", runProofProperties, unit) |
| - if err != nil { |
| - failures = append(failures, fmt.Errorf("%s: %w", unit, err)) |
| - continue |
| - } |
| - state := parseShow(out) |
| - if state["LoadState"] != "not-found" { |
| - if _, err := s.Systemctl(ctx, "stop", unit); err != nil { |
| - failures = append(failures, fmt.Errorf("%s: %w", unit, err)) |
| - } |
| - } |
| + return errors.Join(nativeErr, err) |
| } |
| - // Check both even if one failed to stop; neither bundle can be reused yet. |
| - for _, unit := range units { |
| - if err := s.proveRunGone(ctx, host, unit); err != nil { |
| - failures = append(failures, err) |
| - } |
| - } |
| - if err := errors.Join(failures...); err != nil { |
| + siblingErr := s.stopAndProveRun(ctx, host, GVisorUnitName(host)) |
| + if err := errors.Join(nativeErr, siblingErr); err != nil { |
| return err |
| } |
| remove := s.removeSandbox |
| @@ -61,6 +43,27 @@ func (s *Server) stopRunFamilies(ctx context.Context, host string) error { |
| return remove(id) |
| } |
| +func runInactive(m map[string]string) bool { |
| + return (m["ActiveState"] == "inactive" || m["ActiveState"] == "failed") && |
| + (m["SubState"] == "dead" || m["SubState"] == "failed") && |
| + m["MainPID"] == "0" && m["ControlPID"] == "0" && (m["Job"] == "" || m["Job"] == "0") |
| +} |
| +func (s *Server) stopAndProveRun(ctx context.Context, host, unit string) error { |
| + out, err := s.Systemctl(ctx, "show", "-p", runProofProperties, unit) |
| + if err != nil { |
| + return fmt.Errorf("%s: %w", unit, err) |
| + } |
| + m := parseShow(out) |
| + // An unusable template needs no stop when its invocation is already over. |
| + // Loaded units still get stop, which completes stop-post before proof. |
| + if m["LoadState"] == "loaded" || !runInactive(m) { |
| + if _, err := s.Systemctl(ctx, "stop", unit); err != nil { |
| + return fmt.Errorf("%s: %w", unit, err) |
| + } |
| + } |
| + return s.proveRunGone(ctx, host, unit) |
| +} |
| + |
| func (s *Server) proveRunGone(ctx context.Context, host, unit string) error { |
| out, err := s.Systemctl(ctx, "show", "-p", runProofProperties, unit) |
| if err != nil { |
| @@ -72,10 +75,7 @@ func (s *Server) proveRunGone(ctx context.Context, host, unit string) error { |
| return fmt.Errorf("%s: missing %s in stop proof", unit, key) |
| } |
| } |
| - if (m["LoadState"] != "loaded" && m["LoadState"] != "not-found") || |
| - (m["ActiveState"] != "inactive" && m["ActiveState"] != "failed") || |
| - (m["SubState"] != "dead" && m["SubState"] != "failed") || |
| - m["MainPID"] != "0" || m["ControlPID"] != "0" || m["Job"] != "0" { |
| + if !runInactive(m) { |
| return fmt.Errorf("%s: termination unproven", unit) |
| } |
| if s.CgroupRoot == "" { |
diff --git a/internal/instancectl/sandboxstop_test.go b/internal/instancectl/sandboxstop_test.go| index cf4557edb..5e4608c33 100644 |
| --- a/internal/instancectl/sandboxstop_test.go |
| +++ b/internal/instancectl/sandboxstop_test.go |
| @@ -2,6 +2,7 @@ package instancectl |
| import ( |
| "context" |
| + _ "embed" |
| "errors" |
| "net/http" |
| "net/http/httptest" |
| @@ -14,13 +15,31 @@ import ( |
| "github.com/carlosframework/platform/internal/execsandbox" |
| ) |
| +// Captured read-only on docs-t1, systemd 257.13-1~deb13u1. |
| +// |
| +//go:embed testdata/systemd257/inactive.show |
| +var systemd257Inactive string |
| + |
| +//go:embed testdata/systemd257/native-not-found.show |
| +var systemd257NativeAbsent string |
| + |
| +//go:embed testdata/systemd257/gvisor-not-found.show |
| +var systemd257GVisorAbsent string |
| + |
| +//go:embed testdata/systemd257/running.show |
| +var systemd257Running string |
| + |
| +func systemd257Stopped(unit string) string { |
| + return strings.ReplaceAll(systemd257Inactive, "systemd-tmpfiles-clean.service", unit) |
| +} |
| + |
| func sandboxStopServer(t *testing.T) (*Server, *[]string) { |
| t.Helper() |
| calls := []string{} |
| s := &Server{CgroupRoot: t.TempDir()} |
| s.Systemctl = func(_ context.Context, args ...string) (string, error) { |
| calls = append(calls, strings.Join(args, " ")) |
| - return "LoadState=loaded\nActiveState=inactive\nSubState=dead\nInvocationID=old\nMainPID=0\nControlPID=0\nJob=0\nControlGroup=\n", nil |
| + return systemd257Stopped(args[len(args)-1]), nil |
| } |
| s.removeSandbox = func(id string) error { |
| if s.legacyStopping["demo.example"] == 0 { |
| @@ -160,17 +179,17 @@ func TestGVisorStopProofFailure(t *testing.T) { |
| case "active": |
| out = strings.ReplaceAll(out, "ActiveState=inactive", "ActiveState=active") |
| case "job": |
| - out = strings.ReplaceAll(out, "Job=0", "Job=123") |
| + out = strings.ReplaceAll(out, "Job=\n", "Job=123\n") |
| case "control": |
| out = strings.ReplaceAll(out, "ControlPID=0", "ControlPID=123") |
| case "main": |
| out = strings.ReplaceAll(out, "MainPID=0", "MainPID=123") |
| case "stop-post": |
| - out = strings.ReplaceAll(out, "SubState=dead", "SubState=stop-post") |
| + out = strings.NewReplacer("SubState=dead", "SubState=stop-post", "ActiveState=inactive", "ActiveState=deactivating", "ControlPID=0", "ControlPID=123").Replace(out) |
| case "unreadable": |
| return "", errors.New("unreadable") |
| case "missing-property": |
| - out = strings.ReplaceAll(out, "Job=0\n", "") |
| + out = strings.ReplaceAll(out, "Job=\n", "") |
| } |
| return out, nil |
| } |
| @@ -197,16 +216,31 @@ func TestGVisorStopProofFailure(t *testing.T) { |
| } |
| func TestGVisorStopOvertakesAcceptedStart(t *testing.T) { |
| - s, _ := sandboxStopServer(t) |
| + s, calls := sandboxStopServer(t) |
| s.SandboxEffective = execsandbox.EffectiveGVisor |
| seq := s.nextConnSeq() |
| - release, err := s.fenceLegacyStarts(context.Background(), "demo.example") |
| - if err != nil { |
| - t.Fatal(err) |
| + accepted, resume, done := make(chan struct{}), make(chan struct{}), make(chan struct{}) |
| + w := httptest.NewRecorder() |
| + go func() { |
| + defer close(done) |
| + req := httptest.NewRequest(http.MethodPost, "/start?host=demo.example&role=run&memory_max=268435456", nil) |
| + req = req.WithContext(context.WithValue(req.Context(), connSeqKey{}, seq)) |
| + close(accepted) |
| + <-resume |
| + s.handleStart(w, req) |
| + }() |
| + <-accepted |
| + stop := httptest.NewRecorder() |
| + s.handleStop(stop, httptest.NewRequest(http.MethodPost, "/stop?host=demo.example&role=run", nil)) |
| + close(resume) |
| + <-done |
| + if stop.Code != http.StatusNoContent || w.Code != http.StatusConflict { |
| + t.Fatalf("stop=%d start=%d", stop.Code, w.Code) |
| } |
| - release() |
| - if _, _, err := s.beginLegacyStart(context.Background(), "demo.example", seq); err == nil { |
| - t.Fatal("accepted an overtaken start") |
| + for _, call := range *calls { |
| + if strings.HasPrefix(call, "start ") { |
| + t.Fatal("overtaken handler submitted", call) |
| + } |
| } |
| } |
| @@ -229,3 +263,121 @@ func TestGVisorStopJoinsStart(t *testing.T) { |
| } |
| <-joined |
| } |
| + |
| +func TestGVisorStopSystemd257Shapes(t *testing.T) { |
| + for _, load := range []string{"loaded", "not-found", "bad-setting", "error", "masked"} { |
| + for _, job := range []string{"", "0"} { |
| + t.Run(load+"/Job="+job, func(t *testing.T) { |
| + s, _ := sandboxStopServer(t) |
| + base := s.Systemctl |
| + s.Systemctl = func(ctx context.Context, args ...string) (string, error) { |
| + out, err := base(ctx, args...) |
| + if args[0] == "show" && args[len(args)-1] == GVisorUnitName("demo.example") { |
| + if load == "not-found" { |
| + out = systemd257GVisorAbsent |
| + } else { |
| + out = strings.ReplaceAll(out, "LoadState=loaded", "LoadState="+load) |
| + } |
| + } |
| + return strings.ReplaceAll(out, "Job=\n", "Job="+job+"\n"), err |
| + } |
| + release, err := s.fenceLegacyStarts(context.Background(), "demo.example") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer release() |
| + if err := s.stopRunFamilies(context.Background(), "demo.example"); err != nil { |
| + t.Fatal(err) |
| + } |
| + }) |
| + } |
| + } |
| +} |
| + |
| +func TestGVisorStopBothNotFound(t *testing.T) { |
| + s, calls := sandboxStopServer(t) |
| + base := s.Systemctl |
| + s.Systemctl = func(ctx context.Context, args ...string) (string, error) { |
| + out, err := base(ctx, args...) |
| + if args[0] == "show" { |
| + if args[len(args)-1] == UnitName(RoleRun, "demo.example") { |
| + out = systemd257NativeAbsent |
| + } else { |
| + out = systemd257GVisorAbsent |
| + } |
| + } |
| + return out, err |
| + } |
| + w := httptest.NewRecorder() |
| + s.handleStop(w, httptest.NewRequest(http.MethodPost, "/stop?host=demo.example&role=run", nil)) |
| + if w.Code != http.StatusNoContent { |
| + t.Fatalf("%d %s", w.Code, w.Body) |
| + } |
| + for _, call := range *calls { |
| + if strings.HasPrefix(call, "stop ") { |
| + t.Fatal("stopped a not-found unit", call) |
| + } |
| + } |
| +} |
| + |
| +func TestGVisorStopInvalidIDStillStopsNative(t *testing.T) { |
| + s, calls := sandboxStopServer(t) |
| + if err := s.stopRunFamilies(context.Background(), "not/a/host"); err == nil { |
| + t.Fatal("invalid sibling accepted") |
| + } |
| + if !strings.Contains(strings.Join(*calls, "\n"), "stop "+UnitName(RoleRun, "not/a/host")) { |
| + t.Fatal("native cleanup skipped", *calls) |
| + } |
| +} |
| + |
| +func TestGVisorStopStaleInvocation(t *testing.T) { |
| + for _, family := range []string{"native", "gvisor", "rootfs"} { |
| + t.Run(family, func(t *testing.T) { |
| + s, calls := sandboxStopServer(t) |
| + base := s.Systemctl |
| + unit := UnitName(RoleRun, "demo.example") |
| + if family == "gvisor" { |
| + unit = GVisorUnitName("demo.example") |
| + } |
| + if family == "rootfs" { |
| + unit = RootfsUnitName(RoleRun, "demo.example") |
| + } |
| + s.Systemctl = func(ctx context.Context, args ...string) (string, error) { |
| + out, err := base(ctx, args...) |
| + if args[0] == "show" && args[len(args)-1] == unit { |
| + m := parseShow(systemd257Running) |
| + out = strings.NewReplacer("cron.service", unit, m["InvocationID"], "new").Replace(systemd257Running) |
| + } |
| + return out, err |
| + } |
| + path := "/stop?host=demo.example&role=run&invocation=old" |
| + if family == "rootfs" { |
| + path += "&runtime=rootfs" |
| + } |
| + w := httptest.NewRecorder() |
| + s.handleStop(w, httptest.NewRequest(http.MethodPost, path, nil)) |
| + if w.Code != http.StatusConflict { |
| + t.Fatalf("%d %s", w.Code, w.Body) |
| + } |
| + for _, call := range *calls { |
| + if strings.HasPrefix(call, "stop ") || strings.HasPrefix(call, "remove ") { |
| + t.Fatal("stale handle affected successor", call) |
| + } |
| + } |
| + }) |
| + } |
| +} |
| + |
| +func TestGVisorStopBoundHandleDoesNotCancelNewStart(t *testing.T) { |
| + s, calls := sandboxStopServer(t) |
| + ctx, finish, err := s.beginLegacyStart(context.Background(), "demo.example", s.nextConnSeq()) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer finish() |
| + w := httptest.NewRecorder() |
| + s.handleStop(w, httptest.NewRequest(http.MethodPost, "/stop?host=demo.example&role=run&invocation=old", nil)) |
| + if w.Code != http.StatusConflict || ctx.Err() != nil || len(*calls) != 0 { |
| + t.Fatalf("new start changed: %d %v %v", w.Code, ctx.Err(), *calls) |
| + } |
| +} |
diff --git a/internal/instancectl/server.go b/internal/instancectl/server.go| index a3af075e4..4e5410efc 100644 |
| --- a/internal/instancectl/server.go |
| +++ b/internal/instancectl/server.go |
| @@ -585,12 +585,13 @@ func (s *Server) handleEgressStatus(w http.ResponseWriter, _ *http.Request) { |
| // request is the validated form of a verb's query: nothing else reaches a |
| // unit name. |
| type request struct { |
| - host string |
| - role Role |
| - tier cgroup.Limit |
| - gen uint64 // a generation of the run role (zero-downtime spec §7.6); 0 is none |
| - kill bool |
| - exe StagedExe // a staged build to mount (zero-downtime plan 3); Path "" is none |
| + invocation string |
| + host string |
| + role Role |
| + tier cgroup.Limit |
| + gen uint64 // a generation of the run role (zero-downtime spec §7.6); 0 is none |
| + kill bool |
| + exe StagedExe // a staged build to mount (zero-downtime plan 3); Path "" is none |
| // runtime is "rootfs" when the verb is about a rootfs unit (rootfs apps |
| // plan 2), "" otherwise; image is the staged image a rootfs launch |
| // names, and worker the worker name a RoleWorker request carries. |
| @@ -607,11 +608,12 @@ const runtimeRootfs = "rootfs" |
| // verbShape is what a verb's query may carry. |
| type verbShape struct { |
| - roles []Role |
| - tier bool |
| - gen bool |
| - kill bool |
| - exe bool // a start, seed or cmd verb: the staged build its unit binds |
| + stopInvocation bool |
| + roles []Role |
| + tier bool |
| + gen bool |
| + kill bool |
| + exe bool // a start, seed or cmd verb: the staged build its unit binds |
| // seed is the /seed verb, which names no role: its unit is the seed |
| // unit, which may bind a staged build (settings spec §4.2). |
| seed bool |
| @@ -793,6 +795,13 @@ func parseQuery(host string, q url.Values, v verbShape) (request, error) { |
| return request{}, errors.New("version and digest need an exe") |
| } |
| } |
| + if v.stopInvocation && q.Has("invocation") { |
| + inv := q.Get("invocation") |
| + if req.role != RoleRun || req.gen != 0 || inv == "" || len(inv) > 128 || strings.ContainsAny(inv, "\x00\r\n") { |
| + return request{}, errors.New("invocation belongs to an original-run stop") |
| + } |
| + req.invocation = inv |
| + } |
| return req, nil |
| } |
| @@ -1081,7 +1090,7 @@ func (s *Server) stopUnit(ctx context.Context, unit string) { |
| } |
| func (s *Server) handleStop(w http.ResponseWriter, r *http.Request) { |
| - req, err := parseRequest(r, verbShape{roles: []Role{RoleRun, RoleSeed, RoleSidecar, RoleCmd, RoleWorker, RoleTTY}, gen: true, kill: true, rootfsStop: true, worker: true}) |
| + req, err := parseRequest(r, verbShape{roles: []Role{RoleRun, RoleSeed, RoleSidecar, RoleCmd, RoleWorker, RoleTTY}, gen: true, kill: true, rootfsStop: true, worker: true, stopInvocation: true}) |
| if err != nil { |
| http.Error(w, err.Error(), http.StatusBadRequest) |
| return |
| @@ -1105,14 +1114,24 @@ func (s *Server) handleStop(w http.ResponseWriter, r *http.Request) { |
| // on (legacystart.go, #292): once this answers, no start from an |
| // earlier request can still be submitted, and the stop below |
| // replaces any job a joined start had submitted. |
| - release, err := s.fenceLegacyStarts(r.Context(), req.host) |
| + release, err := s.fenceLegacyStarts(r.Context(), req.host, req.invocation) |
| defer release() |
| + if errors.Is(err, ErrStaleInvocation) { |
| + http.Error(w, err.Error(), http.StatusConflict) |
| + return |
| + } |
| if err != nil { |
| // Stopped anyway, but not proven final: a start may follow. |
| s.stopRunFamiliesBestEffort(r.Context(), req.host) |
| http.Error(w, "stop: "+err.Error(), http.StatusBadGateway) |
| return |
| } |
| + if req.invocation != "" { |
| + if err := s.checkStopInvocation(r.Context(), req.invocation, unit, GVisorUnitName(req.host)); err != nil { |
| + writeStopInvocationError(w, err) |
| + return |
| + } |
| + } |
| if err := s.stopRunFamilies(r.Context(), req.host); err != nil { |
| http.Error(w, "stop: "+err.Error(), http.StatusBadGateway) |
| return |
| @@ -1177,7 +1196,7 @@ func (s *Server) handleSweep(w http.ResponseWriter, r *http.Request) { |
| ctx := r.Context() |
| targets := map[string]bool{} |
| out, err := s.Systemctl(ctx, "list-units", "--all", "--plain", "--no-legend", "--no-pager", |
| - "carlos-instance-gvisor@*.service", UnitPrefixRun+"*.service", UnitPrefixSeed+"*.service", UnitPrefixSidecar+"*.service", UnitPrefixCmd+"*.service", UnitPrefixTTY+"*.service", UnitPrefixGen+"*.service", |
| + UnitPrefixGVisor+"*.service", UnitPrefixRun+"*.service", UnitPrefixSeed+"*.service", UnitPrefixSidecar+"*.service", UnitPrefixCmd+"*.service", UnitPrefixTTY+"*.service", UnitPrefixGen+"*.service", |
| UnitPrefixRootfs+"*.service", UnitPrefixRootfsGen+"*.service", UnitPrefixRootfsWorker+"*.service", UnitPrefixRootfsCmd+"*.service", UnitPrefixRootfsTTY+"*.service") |
| if err != nil { |
| http.Error(w, "list-units: "+err.Error(), http.StatusBadGateway) |
diff --git a/internal/instancectl/server_test.go b/internal/instancectl/server_test.go| index ddb083af4..521582eb6 100644 |
| --- a/internal/instancectl/server_test.go |
| +++ b/internal/instancectl/server_test.go |
| @@ -100,7 +100,7 @@ func (f *fakeCtl) run(ctx context.Context, args ...string) (string, error) { |
| } |
| } |
| if !answered && len(args) > 2 && args[0] == "show" && strings.Contains(strings.Join(args, " "), runProofProperties) { |
| - return "LoadState=loaded\nActiveState=inactive\nSubState=dead\nInvocationID=\nMainPID=0\nControlPID=0\nJob=0\nControlGroup=\n", nil |
| + return systemd257Stopped(args[len(args)-1]), nil |
| } |
| return out, nil |
| } |
diff --git a/internal/instancectl/stopinvocation.go b/internal/instancectl/stopinvocation.go| new file mode 100644 |
| index 000000000..3aa35592e |
| --- /dev/null |
| +++ b/internal/instancectl/stopinvocation.go |
| @@ -0,0 +1,43 @@ |
| +package instancectl |
| + |
| +import ( |
| + "context" |
| + "errors" |
| + "fmt" |
| + "net/http" |
| + "strings" |
| +) |
| + |
| +var ErrStaleInvocation = errors.New("INSTANCE-STALE-INVOCATION") |
| + |
| +// The caller holds the host's start fence throughout this check and stop. |
| +// Check every sibling before stopping any, so a replacement is untouched. |
| +func (s *Server) checkStopInvocation(ctx context.Context, want string, units ...string) error { |
| + for _, unit := range units { |
| + if unit == "" { |
| + return ErrStaleInvocation |
| + } |
| + out, err := s.Systemctl(ctx, "show", "-p", runProofProperties, unit) |
| + if err != nil { |
| + return err |
| + } |
| + m := parseShow(out) |
| + for _, key := range strings.Split(runProofProperties, ",") { |
| + if _, ok := m[key]; !ok { |
| + return fmt.Errorf("%s: missing %s in stop proof", unit, key) |
| + } |
| + } |
| + if m["InvocationID"] != want && !runInactive(m) { |
| + return ErrStaleInvocation |
| + } |
| + } |
| + return nil |
| +} |
| + |
| +func writeStopInvocationError(w http.ResponseWriter, err error) { |
| + status := http.StatusBadGateway |
| + if errors.Is(err, ErrStaleInvocation) { |
| + status = http.StatusConflict |
| + } |
| + http.Error(w, err.Error(), status) |
| +} |
diff --git a/internal/instancectl/testdata/systemd257/gvisor-not-found.show b/internal/instancectl/testdata/systemd257/gvisor-not-found.show| new file mode 100644 |
| index 000000000..950c9d794 |
| --- /dev/null |
| +++ b/internal/instancectl/testdata/systemd257/gvisor-not-found.show |
| @@ -0,0 +1,11 @@ |
| +MainPID=0 |
| +ControlPID=0 |
| +Result=success |
| +ExecMainStatus=0 |
| +ControlGroup= |
| +Id=carlos-instance-gvisor@fix1-nonexistent.example.service |
| +LoadState=not-found |
| +ActiveState=inactive |
| +SubState=dead |
| +Job= |
| +InvocationID= |
diff --git a/internal/instancectl/testdata/systemd257/inactive.show b/internal/instancectl/testdata/systemd257/inactive.show| new file mode 100644 |
| index 000000000..2a51e560d |
| --- /dev/null |
| +++ b/internal/instancectl/testdata/systemd257/inactive.show |
| @@ -0,0 +1,11 @@ |
| +MainPID=0 |
| +ControlPID=0 |
| +Result=success |
| +ExecMainStatus=0 |
| +ControlGroup= |
| +Id=systemd-tmpfiles-clean.service |
| +LoadState=loaded |
| +ActiveState=inactive |
| +SubState=dead |
| +Job= |
| +InvocationID=a4c5cd96f190462892666741e6423386 |
diff --git a/internal/instancectl/testdata/systemd257/native-not-found.show b/internal/instancectl/testdata/systemd257/native-not-found.show| new file mode 100644 |
| index 000000000..b0e2840ce |
| --- /dev/null |
| +++ b/internal/instancectl/testdata/systemd257/native-not-found.show |
| @@ -0,0 +1,11 @@ |
| +MainPID=0 |
| +ControlPID=0 |
| +Result=success |
| +ExecMainStatus=0 |
| +ControlGroup= |
| +Id=carlos-instance@fix1-nonexistent.example.service |
| +LoadState=not-found |
| +ActiveState=inactive |
| +SubState=dead |
| +Job= |
| +InvocationID= |
diff --git a/internal/instancectl/testdata/systemd257/running.show b/internal/instancectl/testdata/systemd257/running.show| new file mode 100644 |
| index 000000000..3e999e11d |
| --- /dev/null |
| +++ b/internal/instancectl/testdata/systemd257/running.show |
| @@ -0,0 +1,11 @@ |
| +MainPID=817 |
| +ControlPID=0 |
| +Result=success |
| +ExecMainStatus=0 |
| +ControlGroup=/system.slice/cron.service |
| +Id=cron.service |
| +LoadState=loaded |
| +ActiveState=active |
| +SubState=running |
| +Job= |
| +InvocationID=2900ddbbe7194f11825014d76b6ba319 |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 4383146ff..2b4f1d896 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 4a446166291c2e0f9241d1f82a6f82a4fb64619c00569c809b16e54a28d28cd2 |
| +plan14-root-reads-gvisor-demos.tsv bc44399085c194c8e6b2f8b68b75dfde8b870dc27f2da0849d8d0d84cda0328c |
diff --git a/internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv b/internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv| index 0385fc826..73928c09a 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. |
| -# 22 body, 33 sites, 7 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +# 23 body, 33 sites, 7 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| # 45 new dispositions: 4 reads re-frozen at their disposition with the claim, 41 new units frozen accepted-legacy, 0 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 |
| @@ -52,12 +52,12 @@ |
| @legacy 594821fa6ac1e482415a2ea7adea52f1899e235ad2bd7536f8d6bc186dc8001e internal/instancectl/ocibundle.go gvisorBundlePlan legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Derive fixed own data/run mount paths from validated host/role/gen; serialize deterministic OCI and shared mount/skeleton layout. Data literal is a mount destination, not a filesystem read. Three platform/app/live binds are explicitly ro. data-literal@1043 955467061ca20b00b130d1ca60caedb76ffa56755660cc40266db9184778a86d |
| @legacy 5b7e0982c612178b29e3cbeafb3bdf8f4eeaa560f773345e73df4e7a04406986 internal/instancectl/ocibundle.go gvisorRegularExecutable legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Fstat resolved app/platform file opened by fixed production OpenRootFile (root-owned, no-follow ancestors, regular single-link file); require regular executable, no content read here. file:Stat@179 9bbfb733f64393dfb54533a8c4ac0f9c1e56b6b23fc0b130f7af9b3680aaed73 |
| @legacy 1c7f28ecd4b8cef8d77feae6c655a4fd8ee46f66480a1709dad41e7e0901df5c internal/instancectl/ocibundle.go readCarlosUser legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read fixed /etc/passwd through OpenRootFile, enforcing root owner and no-follow ancestors, bounded to 1 MiB; parse exactly one non-root carlos uid/gid without NSS or tenant input. file:ReadAll@207 83b2b8271c1d3b12e99ea6e0ad1395d0e5db7e823569702314c564ec051390af |
| -@legacy 48b3bec8f3cf985c9f4b9799fd4f6bac35642f4485ef799bef79687598679dd1 internal/instancectl/sandboxstop.go Server.proveRunGone legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 5: read only the validated host-derived systemd cgroup.events path under the configured root. Require complete inactive/dead state, zero jobs/MainPID/ControlPID, expected ControlGroup and exact populated 0 or absent cgroup; unreadable or malformed proof refuses cleanup. file:ReadFile@1064 fb94a0712cd6b0810d13d75e329968b876dc4d61a03cf38b8d7d4bb442bdbf87 |
| +@legacy aecd2b97667691b047efb311443751aed82546bc3654db2baec85bf5cf924fc7 internal/instancectl/sandboxstop.go Server.proveRunGone legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 5: read only the validated host-derived systemd cgroup.events path under the configured root. Require complete inactive/dead state, zero jobs/MainPID/ControlPID, expected ControlGroup and exact populated 0 or absent cgroup; unreadable or malformed proof refuses cleanup. Fix round 1 C1/I1: accept the captured systemd 257 empty Job field as no queued job, also zero. Do not infer running state from LoadState; keep required-property presence, inactive/failed plus dead/failed, zero MainPID/ControlPID, expected ControlGroup and empty/absent cgroup proof. Native cleanup runs before sibling ID derivation. No new read path. file:ReadFile@818 6c4c011ba16be748f7df2fcb56406dc5d968977eaa3321b9f2eab06fad1db393 |
| @legacy 6c407dd1a2b848bef09894cb174b933331bbc0b2c8147e7e533b41c9f6bb7464 internal/instanceexec/sandbox_linux.go gvisorProbeChecks legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Preliminary guest-only probe reads the fixed /proc/self/status to check empty capability sets and NoNewPrivs, and SelfCheck opens the fixed own /data/instances/_probe directory with unchanged safe-open flags. Runs as the guest carlos identity; reports readiness incomplete until the later root challenges exist. No tenant-selected host path or root authority is added. Echo CARLOS_GVISOR_PROBE_NONCE from the initial guest environment in the additive omitempty report field; root supplies the challenge in the OCI environment. No new filesystem read or readiness grant. data-literal@696,file:ReadFile@202 b201174cac395aea50cbe7c306859c47a120d1a954d988a43e9746a1386f658a |
| @legacy c77114e0b2ad3eb534e6cb7971c0eb6742fac4b7d67e4127593ac2a1f0017e81 internal/activator/backend_unit.go SplitBackend.Start legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-region-ha-g2-fixes;basis=Apply the pool refusal to HA or Provisioned rows before start dispatch, preserving explicit non-HA operator placement; added HA and Provisioned field reads, no new I/O.;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:Exec@107,registry:Backing@178,registry:HA@263,registry:Provisioned@272,whole:Route@164,whole:Route@307,whole:Route@404,whole:Route@419 26d8d253f3a2f5a11d7629950e915a34bf0979819ac9c4ca26c6f51af9fe6ed4 |
| @legacy 068313d34de6fc0d04a4c3c2ccc86c34ea25b396ae6bb18f86e1d7b7be8e9c85 internal/activator/backend_unit.go SplitBackend.StartGen legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-region-ha-g2-fixes;basis=Apply the pool refusal to HA or Provisioned rows before generation start dispatch, preserving explicit non-HA operator placement; added HA and Provisioned field reads, no new I/O.;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:Exec@130,registry:Backing@228,registry:HA@316,registry:Provisioned@325,whole:Route@187,whole:Route@360,whole:Route@465,whole:Route@513,whole:Route@557,whole:Route@572,whole:Route@691 5ca67e3b27355d099a26de81a167c0ac25e977cc7f16bf8c5507075b328b3692 |
| @legacy a5903d005b300f84ae54cd5635feb07e0b36aa1369087073d1c494b337f7b23d internal/activator/cmdunit.go cmdUnit.StopAndSettle legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): asks instance control to stop the unit, then waits; the agent keeps the lease until this is proven; no root decision;rev3=census-ruling-rootfs-apps-2;basis=the stop goes through stopRole with the row instead of Control.Stop with its host, so one Host site goes; for a rootfs row that is the rootfs stop verb's request (StopRootfs) over the same control socket; the proof (stop, cgroup empty, streams drained) is unchanged; no file read added;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 8 (PF-7): stops and proves the unit own role (stopRole and waitRoleCgroupEmpty with u.role, cmd or tty), never a hard-coded cmd; a unit of no one-shot role is refused; after the proof it drains the two streams, or closes the session handoff and master; new sites are the refusal text (rt.Host) and the route;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@216,registry:Runtime@365,registry:Runtime@424,whole:Route@218,whole:Route@341,whole:Route@500,whole:Route@689,whole:Route@756 0125d714d97b0cb14e0edae9caf9e8e8ab33e7aca1344dc53fa088d2bd75d120 |
| -@legacy 8bea82465b3eba990f27fc38a932bdc7c1959349e31d3c9e379273315552a6c6 internal/activator/unitproc.go unitProc.stopUnit legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=passes the row to stopRole instead of its host, so one Host site goes; for a rootfs row the stop is the rootfs verb's request (StopRootfs) over the same control socket; no file read added;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W: a worker handle's stop goes to rootfsControl().StopRootfs(host, RoleWorker, 0, name, kill=false), naming the worker, and never kills (root refuses kill for anything but a generation); a generation or role handle goes through stopRole as before; reads +registry:Host x2 and +whole:Route x2 (the worker branch's rt.Host and rt, the same route the handle was started for);rev3=census-ruling-gvisor-demos;basis=Task 5: derive native/rootfs stop dispatch from the retained, response-validated unit identity instead of current route Runtime. Original binary run still calls host/role Stop to fence and prove both families; no unit string sent by agent. registry:Host@327,registry:Host@375,registry:Runtime@446,registry:Runtime@522,whole:Route@329,whole:Route@377,whole:Route@442,whole:Route@588 5f0be10be27db9dacde164d5acff12a930c994371585107e5e703812cf253969 |
| +@legacy 0d3883c9202f2e02f609471c04a98d8fe104eaf6f670be366f7168d6d261ce5f internal/activator/unitproc.go unitProc.stopUnit legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=passes the row to stopRole instead of its host, so one Host site goes; for a rootfs row the stop is the rootfs verb's request (StopRootfs) over the same control socket; no file read added;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W: a worker handle's stop goes to rootfsControl().StopRootfs(host, RoleWorker, 0, name, kill=false), naming the worker, and never kills (root refuses kill for anything but a generation); a generation or role handle goes through stopRole as before; reads +registry:Host x2 and +whole:Route x2 (the worker branch's rt.Host and rt, the same route the handle was started for);rev3=census-ruling-gvisor-demos;basis=Task 5: derive native/rootfs stop dispatch from the retained, response-validated unit identity instead of current route Runtime. Original binary run still calls host/role Stop to fence and prove both families; no unit string sent by agent. Fix round 1 I4: send retained original-run InvocationID through RunInvocationControl; refuse a channel without it. Root compares both derived sibling invocations inside the existing host fence and refuses different live invocations or concurrent starts. Stale replies let the observer finish only on its own invocation-ending evidence, never by stopping the successor. Rootfs binding uses the retained unit kind. Same control channel, no agent-selected unit path. registry:Host@327,registry:Host@375,registry:Host@790,registry:Runtime@446,registry:Runtime@522,whole:Route@329,whole:Route@377,whole:Route@442,whole:Route@792,whole:Route@972 1627ed78dad3c0b043b30501f272d44ded8dc810931a911d4e70a818b05a57e7 |
| @legacy 4ce565c4b802baca59f20aad5301025f98e5c6c960c34abaeff6447bcfe4489a internal/activator/backend_exec.go ExecBackend.LegacyRunGone legacy accepted-legacy accepted-legacy;rev3=census-ruling-292;basis=Census ruling 292: new unit; stops the host's original run unit through instance-control's existing /stop and proves it gone from systemctl show state and cgroup.events, as the exit observer reads. The termination proof only decides release-or-keep, and never starts, wakes or admits anything; unknown or error means keep. Boundary: agent-side shutdown gates running as carlos; they refuse or stop new work once shutdown begins, and a cancelled wake releases its lease; no new read and no root decision; plus the legacy run unit's termination proof (systemctl show state and cgroup.events, as the exit observer reads), and a retried conditional lease delete of the same record.;rev3=census-ruling-rootfs-apps-2;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=a rootfs row's original run unit is the rootfs template's: it is named by unitNameFor and stopped through stopRole (the rootfs verb), and its cgroup proven by unitEvents, which for a rootfs row also reads the control group systemd reports; the Host sites became Route sites (the route passed to those three); the proof's rule is unchanged: unknown or error keeps the lease; no root decision;rev3=census-ruling-gvisor-demos;basis=Task 5: after root fenced Stop succeeds, check both native and gVisor original siblings using the existing systemd/cgroup readers; rootfs retains its existing path. A failed root proof returns immediately and keeps the lease. No mode-dependent cleanup. registry:Host@174,registry:Host@634,whole:Route@393,whole:Route@448,whole:Route@714 69cf187e26e47f94bb1e4d6dff06f15a09492a0b52112b3d82a59987baf43151 |
| @legacy fbcc2aa93f4d5142bd2bcb87734ec7104359b8fe449fec06dd7226c2a1ed999f internal/activator/backend_exec.go ExecBackend.Seed legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: haSpawnGate(rt) first (+whole:Route), which for a host this backend acquired HA re-runs the containment admission (nested layout, not unit-backed, nestedReady) and refuses otherwise; a non-HA host passes untouched; only adds a refusal;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 N1: refuses a row with a runtime before any binary launch (refuseRuntimeBinaryLaunch); adds a refusal only;rev3=census-ruling-agent-start-demo-1;basis=Reads IsDemo and refuses before seed work.;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. registry:Host@519,registry:Host@581,whole:Route@102,whole:Route@232,whole:Route@291,whole:Route@342,whole:Route@410,whole:Route@566 0087126b02ff4c5b8d563c990bdd9088ae7eec494f93ce6ed4b6243395778848 |
| @legacy 4119fc3e8286a50227a9f8b2e54309f1c5ce011e75c69c4e22cf42cf62541e9f internal/activator/backend_exec.go ExecBackend.SeedExe legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 N1: refuses a row with a runtime before any binary launch (refuseRuntimeBinaryLaunch); adds a refusal only;rev3=census-ruling-agent-start-demo-1;basis=Reads IsDemo and refuses before staged seed verification or execution.;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. registry:Host@396,registry:Host@656,whole:Route@132,whole:Route@262,whole:Route@444,whole:Route@477,whole:Route@545,whole:Route@703 7383f3c520e5af890df7858eeea99f66fc994fc6da1a7909a7bafb3190ca641b |
| @@ -92,6 +92,7 @@ internal/activator/unitproc.go ExecBackend.newUnitProc legacy accepted-legacy ac |
| internal/activator/unitproc.go unitProc.Stop legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-gvisor-demos;basis=Task 5: root original-run proof is required even after observer completion. Failed root proof masks Exited until successful retry, retaining the lease; listener closure still follows termination. Same control reads. registry:Host@518,whole:Route@520 ac235a8c1673f0580de9219be59bbca676d932613c909e048db4d38b6525a052 |
| internal/host/agent.go runAgent authority B,C,D,F rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): builds the box's lifetime judge once (newBoxJudge, nil with host claims on) and hands it to the seed placement, the moves and runs workers and every loop it starts; read sites unchanged, offsets moved; B,C,D,F authority retained; self-serve moves 1 Task 8: derives the box's lifetimes switch from the judge once (lifetimes := boxJudge != nil) and hands it to the edges file loop; read sites unchanged, offsets moved;rev3=census-ruling-plans-4d-lapse;basis=arms two more plans hooks from the same snapshot: e.SetPlanDisabledFor(planDisabledFor) beside SetPlanGovernedFor, and svc.SetDisabledFor(planDisabledRoute) beside SetMaxRunFor (plans 4d); the reads live in those units (plans-4d-units decision); read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 9b81d97b (with main's plan rate ceiling, edge request records, regional box names, self-serve moves plan 1, plans 4d-1 lapse and its other later changes under main's own census rulings) plus the rootfs placement wiring in the activator start: an agentRootfs built from eb.NestedOK, CARLOS_DEPLOYMENT_SINGLE_TENANT, CARLOS_POOLS, the claim flag, swapArming's answer, the control client's /ready/rootfs and, on a fleet box whose identity resolved, fleetOwnerCheck over the deploy store main already opens for the fleet label (fleetStore), then arm and armedRootfs.Store; this body reads nothing new itself; the closures it wires read later, at a rootfs wake and each status tick: GET /ready/rootfs over the control socket, NestedOK's checks, and release.FleetOwnerKey for the judged row's own account and this box's fleet from the deploy store;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 7 and 11, #329 plan 3 Task 7 and plan 1 Task 7's policy cache: the control client is built once and handed to eb.Control, to the status tick (egressStatus) and to a new egressNudgeLoop goroutine; armSizeSource(svc, "/sys/fs/cgroup") after the activator Service; armPolicyCache() after armChangeIndex; statusLoop takes egressStatus. The reads are those units' own (decision rows); this body reads nothing new: the same five sites, offsets moved, in the agent; B,C,D,F authority retained.;rev3=census-ruling-remote-instance-metrics;basis=builds the metrics loop's owners closure (metricsOwners over the agent's registry, the activator and cgm.Leftover) when an activator exists and hands it to metricsLoop; reads nothing new itself;rev3=census-ruling-edge-asset-cache-3;basis=adds file:Statfs. runAgent keeps its authority (B,C,D,F). The new site is assetcache.Statfs, an exported assetcache.FS interface value (var Statfs FS = statfsFS{}), not a function value and not a call in runAgent: the ready hook passes it to armEdgeAssetCache as the store's filesystem, and armEdgeAssetCache calls its Space method on the configured data directory (dataDir(): $CARLOS_DATA_DIR, else /data), which calls unix.Statfs there (statfsFS.Space, accepted legacy at census-ruling-edge-asset-cache-2). No request-supplied pathname reaches it.;rev3=census-ruling-remote-metrics-nested;basis=main's body (merged origin/main acfa4f80, under main's own census rulings) plus: snapshots the nested layout (snapshotNestedUnits over /sys/fs/cgroup/carlos.slice/carlos-instances.slice) once at start, before the activator, and hands the metrics loop a unitSources struct (stamped units, routeHostNames, that root and the snapshot); reads nothing new itself;rev3=census-ruling-region-ha-p1a;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): wires region HA P1a into the activator: cfg.Record = haRecordFacts(openDeployStore, boxJudge) (the box's lifetime judge this body already builds with newBoxJudge, nil with host claims on; CI fix) and cfg.Self = lease.CurrentSelf; eb.Lifetimes (the process's lifetime index), eb.Registry, eb.StartupSwept (seedSweptAtStart.Load), eb.FilesStore from newProductionFilesStore (now lease.NewFilesStore, rootaws-loaded, a log line on failure) and lease.SetObligationDir(<data>/.ha-owed) (logged on failure; HA acquires then refuse); this body reads nothing new itself, the same five sites; the reads are those units' own (haRecordFacts and lease's SetObligationDir are new rows on this card); merge of origin/main d7ae1d76: main's own later changes to this body are kept as main has them, under main's rulings (census-ruling-remote-instance-metrics: the metricsOwners closure for metricsLoop; census-ruling-edge-asset-cache-3: the +file:Statfs site, assetcache.Statfs handed to the asset ready hook); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: builds one termfence.Confirmer (Self from lease.CurrentSelf at each call, EC2 DescribeInstances method only, client from rootaws.LoadDefaultConfig with retries off, built lazily on first use) and sets eb.OwnerTerminated; this body reads nothing new itself, the same six sites;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 7: the startup Sweep literal hands its answer to startupSwept, which logs as before and, only on a clean sweep, marks rootfs admission swept (MarkRootfsSwept); same Sweep call, no read added;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): sets svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore) from the identity it already resolves once and the deployment store the fleet loops already opened, and logs an ERROR naming the identity error when the box is on a fleet with an invalid identity. fleetWakeFor reads CARLOS_REGION and CARLOS_FLEET from the same environment. Read sites unchanged (6). Agent, not root; a platform box is unchanged.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: one call more beside armRunsPass, armInteractivePass(svc, reg, rolloutSink, boxJudge), in the same activator Configure hook, handing it the same box judge; fix round 1 (Astra P2, shutdown): after svc.Shutdown(ctx), shutdownInteractive(ctx) ends and joins every interactive session under the same shutdown budget; the worker's own reads are its units' (interactive.go); this body reads nothing new, the same six sites; merge of origin/main 6f1f6ca6: main's svc.Fleet = fleetWakeFor(...) and its invalid-identity ERROR line are kept as main has them (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (6);rev3=census-ruling-fix-set-aside-exdev;basis=set-aside EXDEV fix: one field more on the agent ExecBackend literal, RawInstanceDir: layout.RawInstanceDir (a pure path join: <dataDir>/.instances/<InstanceID(host)>), so the start rule set-aside moves a copy out through the raw directory instead of through the nosymfollow bind; this body reads nothing new, the same six sites;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: one more assignment beside eb.FilesStore: eb.EscrowKey = haEscrowKey(os.Getenv("CARLOS_SECRETS_KEY")), the agent's own environment parsed by appconfig.ParsePrivateKey as the moves pass parses it (unset or unparseable: a log line and nil, and HA publication refuses on the box). No path is opened or read, no read site added; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 4: one more goroutine beside configSyncLoop: go escrowLoop(agentCtx, reg, svc), the escrow sweep every 30 s over the same registry and Service. This body reads nothing new itself; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 5: one more call beside eb.EscrowKey: wireRawSecretPages(eb, PageOperator, metricsBoxLabel(os.Getenv, readMachineID())), which sets eb.OnRawSecret to page an operator (alerting.Page through PageOperator, LevelIncident) on its own goroutine with a 20 s timeout; metricsBoxLabel and readMachineID are the reads this body already makes for the moves refusal log; no new read site; the same six sites, offsets moved; B,C,D,F authority retained. Merge of origin/main 90c4d3aa: main's own later changes to this body are kept as main has them, under main's rulings; this branch's change is the same as above. Merge of origin/main 00bf5b8c (fleet set-aside EXDEV fix): main's change to this body is kept as main has it, under its own census ruling; this branch's change is unchanged.;rev3=census-ruling-probe-burst-limit;basis=two more sink wirings beside setAnalyticsSink: setProtectionSink(e.SetProtectionRecordOnly) and setAssetOwnersSource(e.AssetOwners), function values the telemetry pass calls; this body reads nothing new, the same six sites; authority B,C,D,F retained; no new root read or write kind;rev3=census-ruling-region-ha-p1b3a;basis=Arm HA placement exactly once on the existing Service before activatorStart and edges publication, wiring AwakeApps and the PageOperator callback; existing six read sites unchanged, no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: start the concrete coordinator's renewal worker with agent setup; existing closeReplicaCoordinator shutdown cancels and joins it before release. No new read sites or credentials. Merge origin/main c59715e7: retain main's armHAPlacement(svc, PageOperator) wiring beside the existing activator setup; stateless coordinator and shutdown wiring remain. Same read sites; no new root read or credential.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): in the edge-ready callback, calls act.SetHeldWakeHook(e.HeldWake) when act is non-nil (installing the non-blocking wake callback) and stores e.HeldStreamsForStatus in heldStreamsSource. Wiring of in-memory callbacks only; no read added.;rev3=census-ruling-region-ha-p1b3b-t;basis=Wire Service.SetDutyView to the live edge DutySnapshot in the ready callback. No new read; no new loop or cloud operation. B2 wires the registry as the persistent DutyStore before service startup; no new cloud or filesystem path. B3b: arm one journal-backed termination consumer before service startup using agentCtx and the shared confirmer; expose edge tick and join at edge shutdown. No new direct read sites.;rev3=census-ruling-agent-start-demo-1;basis=Passes the existing registry, data store and hibernation prefix into the demo worker, and the existing instance-control client into the demo before-exec hook. No alternate data store or polling loop. Merge resolution against origin/main 9bd45488 retains main's HA departure controller, lifecycle and duty wiring alongside the demo data store and worker; no read site added by the resolution.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: install closed fixed admission before every launch source, bind activator/backend and edge, wire the real termination Started lifecycle and role reader after the change index; close before cancellation/child shutdown. No new external reads or cloud authority. Fix R1: move bind/lifecycle/edge-option wiring into wireAgentAdmission and worker listing into runWorkerBootPassAfterAdmission. Worker boot waits for admission before listing then uses unchanged bounded wakes and per-host serialization; whole Route read moves to the helper. No new storage, cloud, or root execution authority. Preserve merged main's agent wiring and census basis; the branch removes one whole Route use by moving worker iteration to the helper, with no added read kind.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: arms a fleet-only worker using the existing registry, activator, backend and authenticated console transport. Owned worker stops and joins at shutdown. No new bucket reader. merge of origin/main 9b8b2c50: retain HA duty/departure lifecycle, wake-slot and existing agent wiring alongside the replica placement worker; no new read introduced by resolution. merge of origin/main 6be08467: Retain main demo configuration, admission, build and expiry wiring alongside the replica worker; merge-only body change, no additional read. merge of origin/main 7920cccf: Retain main box-role/group admission wiring and boot publication beside the owned replica worker and shutdown; main moves the boot registry List into runWorkerBootPassAfterAdmission, removing its inline whole Route site. No new read introduced by conflict resolution.;rev3=census-ruling-stateless-replicas-3;basis=Task 1 fix round 1 M3: retain the private snapshot source and cancel/join ownership, but use the replica-health-specific retry loop. It logs its first failure only and retains the existing exponential backoff capped at 30 seconds; unsupported builds return nil. Existing five direct read sites unchanged; no new credentials, bucket reader or app lifecycle action. Fix round 1 Q20: publish Edge.ReplicaSnapshots as a separate in-memory status source, leaving the tenant-visible Upstreams source unchanged. No new external reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Load root-written group marker/configuration, configure signed boot binding and agent receipt completer, wire cancellable admission into departure work and expose cached GroupReaderSnapshot. New indirect boot reads use protected root files; agent-owned receipt controls duplicate initial completion only, never root restart permission. Same five direct sites. Merge 45cebde4 retains the replica health socket lifecycle and setReplicaSource beside GroupReaderSnapshot; no extra read beyond main.;rev3=census-ruling-agent-start-demo-2;basis=agent.go:309-329 opens demo-traffic.db beside the operator-configured registry when a demo domain exists, closes it at shutdown and wires drain-before-purge; :1010-1019 shares the worker and write gate; :1164-1177 installs the fleet identity and closed-until-worker serving callback. One added whole Route pass; the new indirect filesystem/SQL reads are claimed in openDemoTraffic and worker/store units. No request chooses the database pathname.;rev3=census-ruling-region-ha-p1b3b-s;basis=Wire the service duty view to authoritative cached sidecar manifest placement in LifetimeIndex and the edge sidecar projection; missing policy denies duty. Existing instance duty wiring remains.;rev3=census-ruling-region-ha-g2-t3;basis=T3a: wire eb.Page = PageOperator beside OwnerTerminated before departures arm, so suspect-holder pages work if departure setup fails; no new read; existing nine sites and authority unchanged; pages through the existing sink. T3b: publish the same backend through an atomic pointer for the metrics observer, and clear it on return; no new external read or authority.;rev3=census-ruling-agent-start-demo-3;basis=Wire the claim activator and root snapshot client into the demo worker; pass moved readiness to status reporting. Census read-site delta: unchanged (9).;rev3=census-ruling-region-ha-g2-fixes;basis=Wire local pool evidence, live withdrawal activator, startup ingress scan and alias publication, and edge lookup; no new direct sites; new indirect record/claim reads use existing store/judge paths described in ingress helpers.;rev3=census-ruling-region-ha-g2r-fixes;basis=W3: starts the existing record-view backstop loop with a departure-inventory listener (non-blocking, coalesced signal) even without an armed RecordView; it requests the existing full pass (backstopFullDue) there. Same nine read sites; no new read or authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Derive one signal-time deadline with a 90-second budget; cap departure stop and startup/seed/service shutdown joins by it. No read added.;rev3=census-ruling-static-sweep-periodic;basis=in the edge-ready callback, publishes e.LargestStaticTree in staticTreeSource for the disk alert line (diskAlertFrac in the metrics loop); in-memory wiring only, no read added; read sites unchanged (9);rev3=census-ruling-gvisor-demos;basis=Capture sandbox resolution and refusal once; log errors once; gate route admission and BeforeExec before process launch. No new root read. Task 5: pass the once-captured sandbox effective mode/config error into ExecBackend, UnitBackend and the immutable Client expectation. Same startup environment/registry reads; swapArming declines gVisor before placement. file:Exec@19523,file:Open@1837,file:Statfs@50932,registry:App@12933,registry:Host@46968,whole:Route@12925,whole:Route@46126,whole:Route@47091,whole:Route@47153 dba09c350aa2bb8e85768567467346c489904eea29cfd0c3eba7ea99a0ceade5 |
| 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 |
| +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. adec0e3fbfd7af8ccf056cf35334bff29c4a8555cfed4ce0de4617199838e790 |
| 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. data-literal@1364 dc20399778b94614bc05db6f6046949008921df8e0d9adef1b0d07be097d1bd3 |
| 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 |
| @@ -147,12 +148,12 @@ internal/instancectl/ocibundle.go Server.gvisorExecutableWith legacy accepted-le |
| internal/instancectl/ocibundle.go gvisorBundlePlan legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Derive fixed own data/run mount paths from validated host/role/gen; serialize deterministic OCI and shared mount/skeleton layout. Data literal is a mount destination, not a filesystem read. Three platform/app/live binds are explicitly ro. data-literal@1043 955467061ca20b00b130d1ca60caedb76ffa56755660cc40266db9184778a86d |
| internal/instancectl/ocibundle.go gvisorRegularExecutable legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Fstat resolved app/platform file opened by fixed production OpenRootFile (root-owned, no-follow ancestors, regular single-link file); require regular executable, no content read here. file:Stat@179 9bbfb733f64393dfb54533a8c4ac0f9c1e56b6b23fc0b130f7af9b3680aaed73 |
| internal/instancectl/ocibundle.go readCarlosUser legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read fixed /etc/passwd through OpenRootFile, enforcing root owner and no-follow ancestors, bounded to 1 MiB; parse exactly one non-root carlos uid/gid without NSS or tenant input. file:ReadAll@207 83b2b8271c1d3b12e99ea6e0ad1395d0e5db7e823569702314c564ec051390af |
| -internal/instancectl/sandboxstop.go Server.proveRunGone legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 5: read only the validated host-derived systemd cgroup.events path under the configured root. Require complete inactive/dead state, zero jobs/MainPID/ControlPID, expected ControlGroup and exact populated 0 or absent cgroup; unreadable or malformed proof refuses cleanup. file:ReadFile@1064 fb94a0712cd6b0810d13d75e329968b876dc4d61a03cf38b8d7d4bb442bdbf87 |
| +internal/instancectl/sandboxstop.go Server.proveRunGone legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 5: read only the validated host-derived systemd cgroup.events path under the configured root. Require complete inactive/dead state, zero jobs/MainPID/ControlPID, expected ControlGroup and exact populated 0 or absent cgroup; unreadable or malformed proof refuses cleanup. Fix round 1 C1/I1: accept the captured systemd 257 empty Job field as no queued job, also zero. Do not infer running state from LoadState; keep required-property presence, inactive/failed plus dead/failed, zero MainPID/ControlPID, expected ControlGroup and empty/absent cgroup proof. Native cleanup runs before sibling ID derivation. No new read path. file:ReadFile@818 6c4c011ba16be748f7df2fcb56406dc5d968977eaa3321b9f2eab06fad1db393 |
| internal/instanceexec/sandbox_linux.go gvisorProbeChecks legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Preliminary guest-only probe reads the fixed /proc/self/status to check empty capability sets and NoNewPrivs, and SelfCheck opens the fixed own /data/instances/_probe directory with unchanged safe-open flags. Runs as the guest carlos identity; reports readiness incomplete until the later root challenges exist. No tenant-selected host path or root authority is added. Echo CARLOS_GVISOR_PROBE_NONCE from the initial guest environment in the additive omitempty report field; root supplies the challenge in the OCI environment. No new filesystem read or readiness grant. data-literal@696,file:ReadFile@202 b201174cac395aea50cbe7c306859c47a120d1a954d988a43e9746a1386f658a |
| internal/activator/backend_unit.go SplitBackend.Start legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-region-ha-g2-fixes;basis=Apply the pool refusal to HA or Provisioned rows before start dispatch, preserving explicit non-HA operator placement; added HA and Provisioned field reads, no new I/O.;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:Exec@107,registry:Backing@178,registry:HA@263,registry:Provisioned@272,whole:Route@164,whole:Route@307,whole:Route@404,whole:Route@419 26d8d253f3a2f5a11d7629950e915a34bf0979819ac9c4ca26c6f51af9fe6ed4 |
| internal/activator/backend_unit.go SplitBackend.StartGen legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-region-ha-g2-fixes;basis=Apply the pool refusal to HA or Provisioned rows before generation start dispatch, preserving explicit non-HA operator placement; added HA and Provisioned field reads, no new I/O.;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:Exec@130,registry:Backing@228,registry:HA@316,registry:Provisioned@325,whole:Route@187,whole:Route@360,whole:Route@465,whole:Route@513,whole:Route@557,whole:Route@572,whole:Route@691 5ca67e3b27355d099a26de81a167c0ac25e977cc7f16bf8c5507075b328b3692 |
| internal/activator/cmdunit.go cmdUnit.StopAndSettle legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): asks instance control to stop the unit, then waits; the agent keeps the lease until this is proven; no root decision;rev3=census-ruling-rootfs-apps-2;basis=the stop goes through stopRole with the row instead of Control.Stop with its host, so one Host site goes; for a rootfs row that is the rootfs stop verb's request (StopRootfs) over the same control socket; the proof (stop, cgroup empty, streams drained) is unchanged; no file read added;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 8 (PF-7): stops and proves the unit own role (stopRole and waitRoleCgroupEmpty with u.role, cmd or tty), never a hard-coded cmd; a unit of no one-shot role is refused; after the proof it drains the two streams, or closes the session handoff and master; new sites are the refusal text (rt.Host) and the route;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@216,registry:Runtime@365,registry:Runtime@424,whole:Route@218,whole:Route@341,whole:Route@500,whole:Route@689,whole:Route@756 0125d714d97b0cb14e0edae9caf9e8e8ab33e7aca1344dc53fa088d2bd75d120 |
| -internal/activator/unitproc.go unitProc.stopUnit legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=passes the row to stopRole instead of its host, so one Host site goes; for a rootfs row the stop is the rootfs verb's request (StopRootfs) over the same control socket; no file read added;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W: a worker handle's stop goes to rootfsControl().StopRootfs(host, RoleWorker, 0, name, kill=false), naming the worker, and never kills (root refuses kill for anything but a generation); a generation or role handle goes through stopRole as before; reads +registry:Host x2 and +whole:Route x2 (the worker branch's rt.Host and rt, the same route the handle was started for);rev3=census-ruling-gvisor-demos;basis=Task 5: derive native/rootfs stop dispatch from the retained, response-validated unit identity instead of current route Runtime. Original binary run still calls host/role Stop to fence and prove both families; no unit string sent by agent. registry:Host@327,registry:Host@375,registry:Runtime@446,registry:Runtime@522,whole:Route@329,whole:Route@377,whole:Route@442,whole:Route@588 5f0be10be27db9dacde164d5acff12a930c994371585107e5e703812cf253969 |
| +internal/activator/unitproc.go unitProc.stopUnit legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=passes the row to stopRole instead of its host, so one Host site goes; for a rootfs row the stop is the rootfs verb's request (StopRootfs) over the same control socket; no file read added;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W: a worker handle's stop goes to rootfsControl().StopRootfs(host, RoleWorker, 0, name, kill=false), naming the worker, and never kills (root refuses kill for anything but a generation); a generation or role handle goes through stopRole as before; reads +registry:Host x2 and +whole:Route x2 (the worker branch's rt.Host and rt, the same route the handle was started for);rev3=census-ruling-gvisor-demos;basis=Task 5: derive native/rootfs stop dispatch from the retained, response-validated unit identity instead of current route Runtime. Original binary run still calls host/role Stop to fence and prove both families; no unit string sent by agent. Fix round 1 I4: send retained original-run InvocationID through RunInvocationControl; refuse a channel without it. Root compares both derived sibling invocations inside the existing host fence and refuses different live invocations or concurrent starts. Stale replies let the observer finish only on its own invocation-ending evidence, never by stopping the successor. Rootfs binding uses the retained unit kind. Same control channel, no agent-selected unit path. registry:Host@327,registry:Host@375,registry:Host@790,registry:Runtime@446,registry:Runtime@522,whole:Route@329,whole:Route@377,whole:Route@442,whole:Route@792,whole:Route@972 1627ed78dad3c0b043b30501f272d44ded8dc810931a911d4e70a818b05a57e7 |
| internal/activator/backend_exec.go ExecBackend.LegacyRunGone legacy accepted-legacy accepted-legacy;rev3=census-ruling-292;basis=Census ruling 292: new unit; stops the host's original run unit through instance-control's existing /stop and proves it gone from systemctl show state and cgroup.events, as the exit observer reads. The termination proof only decides release-or-keep, and never starts, wakes or admits anything; unknown or error means keep. Boundary: agent-side shutdown gates running as carlos; they refuse or stop new work once shutdown begins, and a cancelled wake releases its lease; no new read and no root decision; plus the legacy run unit's termination proof (systemctl show state and cgroup.events, as the exit observer reads), and a retried conditional lease delete of the same record.;rev3=census-ruling-rootfs-apps-2;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=a rootfs row's original run unit is the rootfs template's: it is named by unitNameFor and stopped through stopRole (the rootfs verb), and its cgroup proven by unitEvents, which for a rootfs row also reads the control group systemd reports; the Host sites became Route sites (the route passed to those three); the proof's rule is unchanged: unknown or error keeps the lease; no root decision;rev3=census-ruling-gvisor-demos;basis=Task 5: after root fenced Stop succeeds, check both native and gVisor original siblings using the existing systemd/cgroup readers; rootfs retains its existing path. A failed root proof returns immediately and keeps the lease. No mode-dependent cleanup. registry:Host@174,registry:Host@634,whole:Route@393,whole:Route@448,whole:Route@714 69cf187e26e47f94bb1e4d6dff06f15a09492a0b52112b3d82a59987baf43151 |
| internal/activator/backend_exec.go ExecBackend.Seed legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: haSpawnGate(rt) first (+whole:Route), which for a host this backend acquired HA re-runs the containment admission (nested layout, not unit-backed, nestedReady) and refuses otherwise; a non-HA host passes untouched; only adds a refusal;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 N1: refuses a row with a runtime before any binary launch (refuseRuntimeBinaryLaunch); adds a refusal only;rev3=census-ruling-agent-start-demo-1;basis=Reads IsDemo and refuses before seed work.;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. registry:Host@519,registry:Host@581,whole:Route@102,whole:Route@232,whole:Route@291,whole:Route@342,whole:Route@410,whole:Route@566 0087126b02ff4c5b8d563c990bdd9088ae7eec494f93ce6ed4b6243395778848 |
| internal/activator/backend_exec.go ExecBackend.SeedExe legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 N1: refuses a row with a runtime before any binary launch (refuseRuntimeBinaryLaunch); adds a refusal only;rev3=census-ruling-agent-start-demo-1;basis=Reads IsDemo and refuses before staged seed verification or execution.;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. registry:Host@396,registry:Host@656,whole:Route@132,whole:Route@262,whole:Route@444,whole:Route@477,whole:Route@545,whole:Route@703 7383f3c520e5af890df7858eeea99f66fc994fc6da1a7909a7bafb3190ca641b |
| @@ -187,9 +188,9 @@ internal/activator/unitproc.go ExecBackend.newUnitProcFor legacy accepted-legacy |
| 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. registry:Host@1233,registry:Host@3084,registry:Host@3274,registry:Host@3621,registry:Host@3847,registry:Host@4551,registry:Host@6175,whole:Route@1235,whole:Route@2233,whole:Route@3086,whole:Route@3276,whole:Route@3623,whole:Route@3849,whole:Route@4553,whole:Route@4809,whole:Route@5262,whole:Route@5727,whole:Route@6177,whole:Route@983 6a55ce3dd0635bb23ced897a36b41cfdd69ac77b144cf8ee359cfee0f57a1b3b |
| 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 |
| @coverage . e359ebe397bac9cf64ba77fb85322e55c3409dc5ca63c9a7c1dc51348ca0ade0 |
| -@coverage internal/activator 3869735dcf558b3836cf4c5b90451fdcdf33e7fb9bc72a684e3f3f70a55f1c8f |
| +@coverage internal/activator a7ddc65189d9c5fe90e23a59166c14e5e25b9b6953fd2b6be57ebfb9c2cca0aa |
| @coverage internal/execsandbox b54dc6618b5ae90c97dd56a1ef8afedbd32eb236b8c98917b92af64e2d913593 |
| -@coverage internal/host 5dc55f3050b45926fbf0b792302e6b30cb5256f62c15924b45000c2a25af888c |
| +@coverage internal/host 207ef0abbb875bab8f5b53c0dc4b28d821d09e0c2387114d82d40b20a5886007 |
| @coverage internal/host/units 93402572d2fc9c32b563820a36d565afa2ed951637bde9561fe2e845137a6524 |
| -@coverage internal/instancectl d6ab9bcbe035eafc45b77bd057737161df72ec2551ee9f70da6fa0a94e313bc6 |
| +@coverage internal/instancectl 73ede89a6fd39e71ae14d820d221e3ef867f1ab5577fbd9075033ee9472fb868 |
| @coverage internal/instanceexec 451a4cb9a8fc078f883afab1c361678185c332a1e294c24420ab4ae2fb3face9 |