carlos / platform Public

gvisor demos: task 6 fix round 1 (proof without stop-post, Ready-only drain)

Apply the Task 6 rulings: prove termination from unit/job/PID/cgroup
state, run drain and housekeeping only from Ready, and retain the last
completed probe pass while its replacement runs.

Exercise the full probe orchestration with fake systemd/proc/cgroup state
and real temporary Unix sockets; refresh the cumulative census proposal.
Co-Authored-By: Astra (gpt-6-astra) via codex
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev b423ec5ea178f92906c1a80ec4efd3719507ff59 parent 88f8296
14 files changed, +794 −197
  • docs/superpowers/notes/census-proposal-gvisor-demos.md +5 −6
  • internal/instancectl/gvisor_fix1_test.go +154 −0
  • internal/instancectl/gvisordrain.go +21 −5
  • internal/instancectl/gvisordrain_test.go +7 −17
  • internal/instancectl/gvisorprobe.go +43 −29
  • internal/instancectl/gvisorprobe_flow_linux_test.go +541 −0
  • internal/instancectl/gvisorprobe_linux.go +1 −1
  • internal/instancectl/gvisorstart_test.go +1 −39
  • internal/instancectl/gvisorunit.go +2 −57
  • internal/instancectl/sandbox.go +0 −3
  • internal/instancectl/sandboxstop.go +1 −9
  • internal/instancectl/server.go +3 −14
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv +14 −16

CI failed — run details

diff --git a/docs/superpowers/notes/census-proposal-gvisor-demos.md b/docs/superpowers/notes/census-proposal-gvisor-demos.md
index 8e4d1f025..9579a50ec 100644
--- a/docs/superpowers/notes/census-proposal-gvisor-demos.md
+++ b/docs/superpowers/notes/census-proposal-gvisor-demos.md
@@ -1,6 +1,6 @@
# Census approval: gvisor-demos
-Ruling `census-ruling-gvisor-demos`. The independent reviewer approves or rejects every change below, 60 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+Ruling `census-ruling-gvisor-demos`. The independent reviewer approves or rejects every change below, 59 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
| unit | change | read sites | what changed |
|---|---|---|---|
@@ -25,9 +25,9 @@ Ruling `census-ruling-gvisor-demos`. The independent reviewer approves or reject
| `internal/instancectl/demo_policy.go` `Server.demoHandler` | body | unchanged (4) | Retain authenticated claim cleanup routes on demo-plus-claims sandbox refusal when a ClaimStop handler exists; sandbox admission still rejects claim launches, and claimAwareLegacy rejects legacy mutations. Existing registry reads unchanged. |
| `internal/instancectl/gen.go` `Server.handleParent` | body | unchanged (1) | Validate logical parent input as before, require the demo route in gVisor mode and apply Physical once to the small demo parent. Existing request query read unchanged; shares stay logical. |
| `internal/instancectl/rootfs.go` `Server.runRootfsProbe` | body | unchanged (1) | Refuse sandbox configuration or readiness errors before preparing or starting the native rootfs probe. Existing image read unchanged. Task 6: Effective gVisor refuses ROOTFS explicitly before native/rootfs probe preparation; no fallback. Existing native reads unchanged. |
-| `internal/instancectl/server.go` `Server.RunProbe` | body | unchanged (1) | Refuse sandbox configuration or readiness errors before fixture reads and native probe dispatch. Existing probe read unchanged. Task 6: Use the fixed private probe selector, dispatch gVisor to the serialized root/guest proof, and check mode drain before the native probe. No native/rootfs fallback in gVisor; existing native report read unchanged. |
+| `internal/instancectl/server.go` `Server.RunProbe` | body | unchanged (1) | Select the fixed root-private probe family and delegate gVisor to its serialized root/guest proof, with no native/rootfs fallback. Task 6 fix round 1: remove mode drain from probe execution (Ready/ReadyDemo only), and let runGVisorProbe atomically publish the report/runtime identity including start lines once. Existing native report read unchanged. |
| `internal/instancectl/server.go` `runWithClaim` | body | unchanged (4) | Retain sandbox modes and error; bind host-provided baseline and runtime callbacks without importing host templates. Existing reads unchanged. Task 6: Capture HostClaims once from ControlConfig/hostwrite.Enabled and set the fixed root-owned bundle discovery directory. Existing command and configuration reads unchanged. |
-| `internal/instancectl/server.go` `type Server` | body | unchanged (1) | Retain Task 1 mode/error/readiness fields, baseline/runtime callbacks, Task 4 per-host validated staged descriptors and root-selected probe nonce. Fix round 1 adds a private writer-operation seam assigned only in package tests, after the unchanged GVisorID admission check; production defaults still call the same checked constructor, WriteRootfs, WriteBundle and verifier. No new direct read or request-controlled callback. Task 5: private injected removal seam for unprivileged tests; production default removes only root-derived bundle and skeleton after both-family proof inside existing start fence. No new request field or agent-selected unit. Task 6: Retain serialized probe nonce, runtime-set identity verifier/token, fixed claims flag, bundle discovery root, and private unprivileged identity seam. No request-controlled callback or path; existing declaration read-site classification unchanged. |
+| `internal/instancectl/server.go` `type Server` | body | unchanged (1) | Retain Task 1 mode/error/readiness fields, baseline/runtime callbacks, Task 4 per-host validated staged descriptors and root-selected probe nonce. Fix round 1 adds a private writer-operation seam assigned only in package tests, after the unchanged GVisorID admission check; production defaults still call the same checked constructor, WriteRootfs, WriteBundle and verifier. No new direct read or request-controlled callback. Task 5: private injected removal seam for unprivileged tests; production default removes only root-derived bundle and skeleton after both-family proof inside existing start fence. No new request field or agent-selected unit. Task 6: Retain serialized probe nonce, runtime-set identity verifier/token, fixed claims flag, bundle discovery root, and private unprivileged identity seam. No request-controlled callback or path; existing declaration read-site classification unchanged. Task 6 fix round 1: private gvisorProbeTestOps is set only in package tests; production defaults retain all fixed paths and the checked root output opener. No externally supplied callback or new direct read. |
| `system.go` `runSystem` | body | unchanged (0) | Dispatch fixed runsc-ensure and exec-sandbox-allows-prev system applets; no direct reads. |
| `system.go` `systemVerb` | body | unchanged (0) | Recognize two root sandbox applets; no direct reads. |
| `internal/activator/backend_exec.go` `ExecBackend.LegacyRunGone` | sites | +registry:Host | 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. |
@@ -168,7 +168,7 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/host/units/carlos-runsc.service:external`: reads +file:external; written legacy, accepted-legacy, frozen
- new `internal/instancectl/demo_policy.go:Server.demoCgroupReadback`: reads +file:ReadFile, +file:Stat; written legacy, accepted-legacy, frozen
- new `internal/instancectl/gvisordrain.go:Server.sandboxUnitEmpty`: reads +file:WalkDir; written legacy, accepted-legacy, frozen
-- new `internal/instancectl/gvisordrain.go:Server.sandboxUnits`: reads +file:WalkDir; written legacy, accepted-legacy, frozen
+- new `internal/instancectl/gvisordrain.go:Server.sandboxUnitsFor`: reads +file:WalkDir; written legacy, accepted-legacy, frozen
- new `internal/instancectl/gvisordrain.go:Server.sweepGVisorBundles`: reads +file:ReadDir; written legacy, accepted-legacy, frozen
- new `internal/instancectl/gvisordrain.go:sandboxGroupEmpty`: reads +file:ReadFile; written legacy, accepted-legacy, frozen
- new `internal/instancectl/gvisorprobe.go:Server.gvisorProbeKernelLimits`: reads +file:ReadFile; written legacy, accepted-legacy, frozen
@@ -183,7 +183,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/instancectl/sandbox.go:Server.requestFamily`: reads +registry:Status, +whole:Route ×3; written legacy, accepted-legacy, frozen
- new `internal/instancectl/sandbox.go:Server.unitFamily`: reads +registry:Runtime, +whole:Route ×3; written legacy, accepted-legacy, frozen
- new `internal/instancectl/sandboxstop.go:Server.proveRunGone`: reads +file:ReadFile; written legacy, accepted-legacy, frozen
-- new `internal/instancectl/sandboxstop.go:Server.stopRunFamiliesID`: reads +file:Lstat; written legacy, accepted-legacy, frozen
- new `internal/instanceexec/probe_gvisor.go:checkGVisorFacts`: reads +file:Openat2; written legacy, accepted-legacy, frozen
- new `internal/instanceexec/probe_gvisor.go:type gvisorProbeFacts`: reads +file:Openat2; written legacy, accepted-legacy, frozen
- new `internal/instanceexec/probe_gvisor_linux.go:runGVisorProbeChecks`: reads +data-literal, +file:Lstat, +file:Openat2, +file:ReadFile ×2; written legacy, accepted-legacy, frozen
@@ -193,6 +192,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- reads `internal/activator/cmdunit.go:cmdUnit.StopAndSettle`: +registry:Runtime ×2, +whole:Route ×2; keeps legacy, task accepted-legacy
- reads `internal/activator/unitproc.go:unitProc.stopUnit`: +registry:Runtime ×2, +whole:Route; keeps legacy, task accepted-legacy
-Seal: `b970bb28c5a633d2572a1da549030e9258cfdabb6322ddffdd0ebf41b56c464c` → `743b4b8a0bb9fc0aa5617269e390017cec736028bc2092a13e78375bf041ee87`.
+Seal: `b970bb28c5a633d2572a1da549030e9258cfdabb6322ddffdd0ebf41b56c464c` → `ba1df741e686c684a41c8ac7ba9edc1c2690346276423e7376b144a033d09687`.
Overlay: `internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/instancectl/gvisor_fix1_test.go b/internal/instancectl/gvisor_fix1_test.go
new file mode 100644
index 000000000..5fb0775f3
--- /dev/null
+++ b/internal/instancectl/gvisor_fix1_test.go
@@ -0,0 +1,154 @@
+package instancectl
+
+import (
+ "context"
+ "net/http"
+ "net/http/httptest"
+ "os"
+ "path/filepath"
+ "runtime"
+ "strings"
+ "testing"
+
+ "github.com/carlosframework/platform/internal/execsandbox"
+)
+
+func TestGVisorFix1FailedRunReloadStop(t *testing.T) {
+ s, _ := gvisorStartFixture(t)
+ w := httptest.NewRecorder()
+ s.Handler().ServeHTTP(w, gvisorStartRequest(s))
+ if w.Code != 200 {
+ t.Fatal(w.Code, w.Body)
+ }
+ base := s.Systemctl
+ reloaded := false
+ s.Systemctl = func(ctx context.Context, args ...string) (string, error) {
+ query := strings.Join(args, " ")
+ if args[0] == "daemon-reload" {
+ reloaded = true
+ return "", nil
+ }
+ if args[0] == "show" && strings.Contains(query, runProofProperties) {
+ return strings.ReplaceAll(strings.ReplaceAll(systemd257Stopped(args[len(args)-1]), "ActiveState=inactive", "ActiveState=failed"), "SubState=dead", "SubState=failed"), nil
+ }
+ if strings.Contains(query, "InvocationID,ExecStopPost") && reloaded {
+ t.Error("termination queried discarded per-command status")
+ return "InvocationID=1234567890abcdef1234567890abcdef\nExecStopPost=", nil
+ }
+ return base(ctx, args...)
+ }
+ s.Systemctl(t.Context(), "daemon-reload")
+ removed := false
+ s.removeSandbox = func(id string) error {
+ if id != "run-demo.example" || s.legacyStopping["demo.example"] == 0 {
+ t.Error("removal outside original-run fence")
+ }
+ removed = true
+ return nil
+ }
+ w = httptest.NewRecorder()
+ s.Handler().ServeHTTP(w, httptest.NewRequest("POST", "/stop?host=demo.example&role=run", nil))
+ if w.Code != 204 || !removed {
+ t.Fatal(w.Code, w.Body, removed)
+ }
+}
+
+func TestGVisorFix1NativeAdmissionNoDiscovery(t *testing.T) {
+ for _, path := range []string{"/start", "/seed", "/cmd", "/tty", "/claim/launch"} {
+ t.Run(path, func(t *testing.T) {
+ root := filepath.Join(t.TempDir(), "not-a-cgroup-tree")
+ if err := os.WriteFile(root, nil, 0600); err != nil {
+ t.Fatal(err)
+ }
+ calls := 0
+ s := &Server{SandboxEffective: execsandbox.EffectiveSystemd, CgroupRoot: root, Systemctl: func(context.Context, ...string) (string, error) { calls++; return "", nil }}
+ reached := false
+ handler := s.sandboxHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { reached = true; w.WriteHeader(204) }))
+ w := httptest.NewRecorder()
+ handler.ServeHTTP(w, httptest.NewRequest("POST", path, nil))
+ if w.Code != 204 || !reached || calls != 0 {
+ t.Fatalf("status=%d reached=%v discovery calls=%d", w.Code, reached, calls)
+ }
+ })
+ }
+}
+
+func TestGVisorFix1RetainedBundleStart(t *testing.T) {
+ s, starts := gvisorStartFixture(t)
+ s.sandboxBundleRoot = t.TempDir()
+ retained := filepath.Join(s.sandboxBundleRoot, "run-demo.example")
+ if err := os.Mkdir(retained, 0700); err != nil {
+ t.Fatal(err)
+ }
+ s.removeSandbox = func(string) error { return os.Remove(retained) }
+ // The request goes through admission, as an accepted connection does.
+ w := httptest.NewRecorder()
+ s.Handler().ServeHTTP(w, gvisorStartRequest(s))
+ if w.Code != 200 || starts() != 1 {
+ t.Fatalf("start fenced itself: %d %s", w.Code, w.Body)
+ }
+ w = httptest.NewRecorder()
+ s.Handler().ServeHTTP(w, httptest.NewRequest("POST", "/stop?host=demo.example&role=run", nil))
+ if w.Code != 204 {
+ t.Fatal(w.Code, w.Body)
+ }
+ w = httptest.NewRecorder()
+ s.Handler().ServeHTTP(w, gvisorStartRequest(s))
+ if w.Code != 200 || starts() != 2 {
+ t.Fatal("start after fenced cleanup refused", w.Code, w.Body)
+ }
+}
+
+func TestGVisorFix1ReadyDrainOnce(t *testing.T) {
+ for _, mode := range []execsandbox.Effective{execsandbox.EffectiveSystemd, execsandbox.EffectiveGVisor} {
+ t.Run(string(mode), func(t *testing.T) {
+ s, _ := gvisorStartFixture(t)
+ s.SandboxEffective = mode
+ base := s.Systemctl
+ lists, jobs := 0, 0
+ s.Systemctl = func(ctx context.Context, args ...string) (string, error) {
+ if args[0] == "list-units" {
+ lists++
+ if mode == execsandbox.EffectiveSystemd {
+ for _, arg := range args {
+ if arg == "carlos-instance*.service" || arg == "carlos-demo-build*.service" {
+ t.Error("native readiness listed native families")
+ }
+ }
+ }
+ }
+ if args[0] == "list-jobs" {
+ jobs++
+ }
+ return base(ctx, args...)
+ }
+ if rep, ok := s.Ready(); !ok {
+ t.Fatal(rep)
+ }
+ if lists != 1 || jobs != 1 {
+ t.Fatalf("list-units=%d list-jobs=%d", lists, jobs)
+ }
+ })
+ }
+}
+
+func TestGVisorFix1StaleStateRecipe(t *testing.T) {
+ pin, err := execsandbox.RunscFor(runtime.GOOS + "-" + runtime.GOARCH)
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, role := range []Role{RoleRun, roleProbe} {
+ host, id := "demo.example", "run-demo.example"
+ if role == roleProbe {
+ host, id = ProbeDirName, "probe"
+ }
+ source, err := gvisorDropIn(pin, host, role)
+ if err != nil {
+ t.Fatal(err)
+ }
+ want := "ExecStartPre=-" + execsandbox.RunscPath(pin) + " --root=/run/carlos-runsc delete -force " + id + "\n"
+ if !strings.Contains(source, want) {
+ t.Fatalf("missing stale-state recipe: %s", source)
+ }
+ }
+}
diff --git a/internal/instancectl/gvisordrain.go b/internal/instancectl/gvisordrain.go
index 67b695ebf..0557eb618 100644
--- a/internal/instancectl/gvisordrain.go
+++ b/internal/instancectl/gvisordrain.go
@@ -37,17 +37,26 @@ func (s *Server) gvisorPrerequisites(ctx context.Context) error {
}
func (s *Server) sandboxUnits(ctx context.Context) (map[string]bool, error) {
+ return s.sandboxUnitsFor(ctx, "")
+}
+func (s *Server) sandboxUnitsFor(ctx context.Context, family execsandbox.Family) (map[string]bool, error) {
if s.Systemctl == nil || s.CgroupRoot == "" {
return nil, errSandboxDrain
}
units := map[string]bool{}
- out, err := s.Systemctl(ctx, "list-units", "--all", "--plain", "--no-legend", "--no-pager", "carlos-instance*.service", "carlos-demo-build*.service")
+ patterns := []string{"carlos-instance*.service", "carlos-demo-build*.service"}
+ if family == execsandbox.FamilyGVisor {
+ patterns = []string{UnitPrefixGVisor + "*.service", gvisorProbeUnit, "carlos-demo-build-gvisor@*.service"}
+ }
+ wanted := func(unit string) bool { f, ok := sandboxUnitFamily(unit); return ok && (family == "" || f == family) }
+ args := append([]string{"list-units", "--all", "--plain", "--no-legend", "--no-pager"}, patterns...)
+ out, err := s.Systemctl(ctx, args...)
if err != nil {
return nil, err
}
for _, line := range strings.Split(out, "\n") {
f := strings.Fields(line)
- if len(f) > 0 {
+ if len(f) > 0 && wanted(f[0]) {
units[f[0]] = false
}
}
@@ -57,7 +66,7 @@ func (s *Server) sandboxUnits(ctx context.Context) (map[string]bool, error) {
}
for _, line := range strings.Split(out, "\n") {
f := strings.Fields(line)
- if len(f) >= 3 {
+ if len(f) >= 3 && wanted(f[1]) {
units[f[1]] = true
}
}
@@ -70,7 +79,7 @@ func (s *Server) sandboxUnits(ctx context.Context) (map[string]bool, error) {
return err
}
if d.IsDir() && strings.HasSuffix(d.Name(), ".service") {
- if _, ok := units[d.Name()]; !ok {
+ if _, ok := units[d.Name()]; !ok && wanted(d.Name()) {
units[d.Name()] = false
}
return filepath.SkipDir
@@ -98,7 +107,11 @@ func sandboxUnitFamily(unit string) (execsandbox.Family, bool) {
}
func (s *Server) assertSandboxDrain(ctx context.Context) error {
- units, err := s.sandboxUnits(ctx)
+ opposite := execsandbox.FamilyGVisor
+ if s.effectiveSandbox() == execsandbox.EffectiveGVisor {
+ opposite = execsandbox.FamilySystemd
+ }
+ units, err := s.sandboxUnitsFor(ctx, opposite)
if err != nil {
return fmt.Errorf("%w: %v", errSandboxDrain, err)
}
@@ -153,6 +166,9 @@ func (s *Server) sandboxUnitEmpty(unit string) error {
if err != nil {
return err
}
+ if d.IsDir() && strings.HasSuffix(d.Name(), ".service") && d.Name() != unit {
+ return filepath.SkipDir
+ }
if d.IsDir() && d.Name() == unit {
if err := sandboxGroupEmpty(filepath.Join(path, "cgroup.events")); err != nil {
return err
diff --git a/internal/instancectl/gvisordrain_test.go b/internal/instancectl/gvisordrain_test.go
index c0176292f..6eaca0fb3 100644
--- a/internal/instancectl/gvisordrain_test.go
+++ b/internal/instancectl/gvisordrain_test.go
@@ -46,6 +46,13 @@ func TestGVisorFamilyReadiness(t *testing.T) {
}
}
err := s.gvisorReady(context.Background())
+ if code == "DRAIN" {
+ rep, ready := s.Ready()
+ if ready {
+ t.Fatal("drain accepted")
+ }
+ err = errors.New(rep.Lines[0].Detail)
+ }
if err == nil || !strings.Contains(err.Error(), want.Error()) {
t.Fatalf("readiness %v", err)
}
@@ -167,20 +174,3 @@ func TestGVisorDispatchInventory(t *testing.T) {
func requestForGVisorRootfs() request {
return request{host: "demo.example", role: RoleRun, runtime: runtimeRootfs}
}
-
-func TestGVisorDrainBlocksNativeSubmission(t *testing.T) {
- s, starts := gvisorStartFixture(t)
- s.SandboxEffective = execsandbox.EffectiveSystemd
- base := s.Systemctl
- s.Systemctl = func(ctx context.Context, args ...string) (string, error) {
- if args[0] == "list-jobs" {
- return "1 " + GVisorUnitName("demo.example") + " start waiting", nil
- }
- return base(ctx, args...)
- }
- w := httptest.NewRecorder()
- s.Handler().ServeHTTP(w, gvisorStartRequest(s))
- if w.Code != 503 || !strings.Contains(w.Body.String(), "DRAIN") || starts() != 0 {
- t.Fatal(w.Code, w.Body, starts())
- }
-}
diff --git a/internal/instancectl/gvisorprobe.go b/internal/instancectl/gvisorprobe.go
index b8bed0eec..abea13a56 100644
--- a/internal/instancectl/gvisorprobe.go
+++ b/internal/instancectl/gvisorprobe.go
@@ -51,12 +51,7 @@ func (s *Server) gvisorReady(ctx context.Context) error {
if err := s.gvisorPrerequisites(ctx); err != nil {
return err
}
- if err := s.assertSandboxDrain(ctx); err != nil {
- return err
- }
- if err := s.sweepGVisorBundles(ctx); err != nil {
- return err
- }
+
identity, err := s.gvisorRuntimeIdentity()
s.mu.Lock()
defer s.mu.Unlock()
@@ -105,10 +100,12 @@ func (s *Server) finishGVisorProbe(ctx context.Context) error {
if err := s.proveGVisorProbeGone(ctx); err != nil {
return err
}
- if err := s.gvisorDeleteCompleted(ctx, gvisorProbeUnit, "probe"); err != nil {
- return err
+
+ remove := s.removeSandbox
+ if remove == nil {
+ remove = execsandbox.RemoveRunFiles
}
- if err := execsandbox.RemoveRunFiles("probe"); err != nil {
+ if err := remove("probe"); err != nil {
return err
}
return s.removeGVisorDropIn(ctx, gvisorProbeUnit)
@@ -146,13 +143,21 @@ func (s *Server) removeGVisorDropIn(ctx context.Context, unit string) error {
func (s *Server) runGVisorProbe(ctx context.Context) (report ProbeReport) {
s.gvisorProbeMu.Lock()
defer s.gvisorProbeMu.Unlock()
- s.mu.Lock()
- s.gvisorProbeIdentity = ""
- s.mu.Unlock()
+ var identity string
+ ops := s.gvisorProbeOperations()
fail := func(check string, err error) ProbeReport {
return ProbeReport{Lines: []VerdictLine{{Check: check, Verdict: "fail", Detail: err.Error()}}}
}
defer func() {
+ report = s.withStartLines(report)
+ s.mu.Lock()
+ if report.Ready {
+ s.gvisorProbeIdentity = identity
+ } else {
+ s.gvisorProbeIdentity = ""
+ }
+ s.report, s.probed = report, true
+ s.mu.Unlock()
if !report.Ready && s.Run != nil {
diag, cancel := context.WithTimeout(context.WithoutCancel(ctx), 5*time.Second)
defer cancel()
@@ -169,14 +174,13 @@ func (s *Server) runGVisorProbe(ctx context.Context) (report ProbeReport) {
if err := s.gvisorPrerequisites(ctx); err != nil {
return fail("exec-sandbox", err)
}
- if err := s.assertSandboxDrain(ctx); err != nil {
- return fail("drain", err)
- }
- identity, err := s.gvisorRuntimeIdentity()
+
+ var err error
+ identity, err = s.gvisorRuntimeIdentity()
if err != nil {
return fail("runsc", err)
}
- // Never rewrite the reused probe ID until the previous stop-post completed.
+ // Never rewrite the reused probe ID before the previous unit is inactive and empty.
if err = s.proveGVisorProbeGone(ctx); err != nil {
return fail("probe-cleanup", err)
}
@@ -188,11 +192,11 @@ func (s *Server) runGVisorProbe(ctx context.Context) (report ProbeReport) {
return fail("nonce", err)
}
s.gvisorProbeNonce = hex.EncodeToString(nonce)
- socket, abstract, fixture, err := GVisorProbePaths(s.gvisorProbeNonce)
+ socket, abstract, fixture, err := ops.paths(s.gvisorProbeNonce)
if err != nil {
return fail("nonce", err)
}
- if err = ensureExe(s.ExeRoot, ProbeDirName, SystemBinary, ProbeDirName); err != nil {
+ if err = ops.prepareExe(); err != nil {
return fail("probe-exe", err)
}
f, err := os.OpenFile(fixture, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0600)
@@ -209,7 +213,7 @@ func (s *Server) runGVisorProbe(ctx context.Context) (report ProbeReport) {
return fail("host-abstract", err)
}
defer listener.Close()
- if err = os.Remove(gvisorProbeOutput); err != nil && !errors.Is(err, os.ErrNotExist) {
+ if err = os.Remove(ops.output); err != nil && !errors.Is(err, os.ErrNotExist) {
return fail("probe-output", err)
}
// The nonce makes the socket path new. Existing state is a refusal.
@@ -229,14 +233,6 @@ func (s *Server) runGVisorProbe(ctx context.Context) (report ProbeReport) {
report = fail("probe-cleanup", err)
}
}
- s.mu.Lock()
- defer s.mu.Unlock()
- if report.Ready {
- s.gvisorProbeIdentity = identity
- } else {
- s.gvisorProbeIdentity = ""
- }
- s.report, s.probed = report, true
}()
if err = s.assertGVisorUnit(ctx, ProbeDirName, gvisorProbeUnit); err != nil {
return fail("unit", err)
@@ -292,7 +288,7 @@ func (s *Server) runGVisorProbe(ctx context.Context) (report ProbeReport) {
if err = gvisorProbeExitShown(status); err != nil {
return fail("probe-exit", err)
}
- file, err := execsandbox.OpenRootFile(gvisorProbeOutput)
+ file, err := ops.openOutput(ops.output)
if err != nil {
return fail("probe-output", err)
}
@@ -351,3 +347,21 @@ func gvisorProbeExitShown(out string) error {
}
return nil
}
+
+// Only package tests replace these host I/O operations and paths. Production
+// always uses the fixed probe paths, checked output opener and real procfs.
+type gvisorProbeOps struct {
+ output, procRoot string
+ paths func(string) (string, string, string, error)
+ prepareExe func() error
+ openOutput func(string) (*os.File, error)
+}
+
+func (s *Server) gvisorProbeOperations() gvisorProbeOps {
+ if s.gvisorProbeTestOps != nil {
+ return *s.gvisorProbeTestOps
+ }
+ return gvisorProbeOps{output: gvisorProbeOutput, procRoot: "/proc", paths: GVisorProbePaths,
+ prepareExe: func() error { return ensureExe(s.ExeRoot, ProbeDirName, SystemBinary, ProbeDirName) },
+ openOutput: execsandbox.OpenRootFile}
+}
diff --git a/internal/instancectl/gvisorprobe_flow_linux_test.go b/internal/instancectl/gvisorprobe_flow_linux_test.go
new file mode 100644
index 000000000..e676af70d
--- /dev/null
+++ b/internal/instancectl/gvisorprobe_flow_linux_test.go
@@ -0,0 +1,541 @@
+//go:build linux
+
+package instancectl
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "io"
+ "net"
+ "net/http"
+ "net/http/httptest"
+ "os"
+ "path/filepath"
+ "runtime"
+ "strings"
+ "sync"
+ "testing"
+ "time"
+
+ "github.com/carlosframework/platform/internal/execsandbox"
+)
+
+var flowChecks = []string{"uid", "gid", "guest-nonroot", "CapInh", "CapPrm", "CapBnd", "CapAmb", "CapEff", "NoNewPrivs", "uname", "proc-version", "io-uring", "loopback", "public-tcp", "host-abstract", "host-fixture", "host-socket", "openat2", "read-error"}
+
+type probeFlow struct {
+ s *Server
+ root, group, fault string
+ mu sync.Mutex
+ commandStatus string
+ recordReads int
+ identity, nonce string
+ nonces, events, logs []string
+ active bool
+ runs, reloads, journals int
+ listener *net.UnixListener
+ conn *net.UnixConn
+ peer sync.WaitGroup
+ entered, release chan struct{}
+}
+
+func (f *probeFlow) event(name string) { f.mu.Lock(); f.events = append(f.events, name); f.mu.Unlock() }
+func (f *probeFlow) write(name, value string) error {
+ path := filepath.Join(f.root, name)
+ if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
+ return err
+ }
+ return os.WriteFile(path, []byte(value), 0600)
+}
+func (f *probeFlow) closePeer() {
+ f.mu.Lock()
+ listener, conn := f.listener, f.conn
+ f.mu.Unlock()
+ if listener != nil {
+ listener.Close()
+ }
+ if conn != nil {
+ conn.Close()
+ }
+ f.peer.Wait()
+}
+func newProbeFlow(t *testing.T) *probeFlow {
+ t.Helper()
+ root, err := os.MkdirTemp("", "pf")
+ if err != nil {
+ t.Fatal(err)
+ }
+ f := &probeFlow{root: root, group: "/" + parentSlices + "/" + gvisorProbeUnit, identity: "pin-a/identity-1"}
+ t.Cleanup(func() { f.closePeer(); os.RemoveAll(root) })
+ s, _ := gvisorStartFixture(t)
+ f.s = s
+ s.CgroupRoot = filepath.Join(root, "cg")
+ s.DropInDir = filepath.Join(root, "units")
+ s.gvisorIdentityTest = func() (string, error) { f.mu.Lock(); defer f.mu.Unlock(); return f.identity, nil }
+ s.gvisorProbeIdentity = f.identity
+ ops := &gvisorProbeOps{output: filepath.Join(root, "output"), procRoot: filepath.Join(root, "proc"),
+ paths: func(nonce string) (string, string, string, error) {
+ if _, _, _, err := GVisorProbePaths(nonce); err != nil {
+ return "", "", "", err
+ }
+ f.mu.Lock()
+ f.nonce = nonce
+ f.nonces = append(f.nonces, nonce)
+ f.mu.Unlock()
+ f.event("nonce")
+ if f.fault == "paths" {
+ return "", "", "", errors.New("fixture paths failure")
+ }
+ if f.fault == "abstract" {
+ if err := f.write("a-"+nonce[:8], "occupied"); err != nil {
+ return "", "", "", err
+ }
+ }
+ if f.fault == "socket-exists" {
+ if err := f.write("s-"+nonce[:8], "occupied"); err != nil {
+ return "", "", "", err
+ }
+ }
+ return filepath.Join(root, "s-"+nonce[:8]), filepath.Join(root, "a-"+nonce[:8]), filepath.Join(root, "fixture"), nil
+ },
+ prepareExe: func() error {
+ f.event("exe")
+ if f.fault == "fixture" {
+ return f.write("fixture", "occupied")
+ }
+ if f.fault == "exe" {
+ return errors.New("fixture exe failure")
+ }
+ return nil
+ },
+ openOutput: func(path string) (*os.File, error) { f.event("output"); return os.Open(path) },
+ }
+ s.gvisorProbeTestOps = ops
+ plan := func() ([]byte, execsandbox.MountLayout, error) {
+ return gvisorBundlePlan(ProbeDirName, roleProbe, 0, gvisorInputs{
+ User: execsandbox.User{UID: 1001, GID: 1001}, NOFILE: execsandbox.Rlimit{Type: "RLIMIT_NOFILE", Soft: 1024, Hard: 1024}, App: SystemBinary, Live: "/run/carlos-control/exe/_probe/live", Nonce: s.gvisorProbeNonce,
+ })
+ }
+ s.gvisorBundleTestOps = &gvisorBundleOps{
+ layout: func(host string, role Role, gen uint64) ([]byte, execsandbox.MountLayout, error) { return plan() },
+ writeRootfs: func(string, execsandbox.MountLayout) error {
+ f.event("skeleton")
+ if f.fault == "skeleton" {
+ return errors.New("fixture skeleton failure")
+ }
+ return f.write("skeleton", "prepared")
+ },
+ writeBundle: func(_ string, raw []byte) error { f.event("bundle"); return f.write("bundle", string(raw)) },
+ verify: func(string, Role, uint64) error {
+ f.event("verify")
+ if f.fault == "bundle" {
+ return errors.New("fixture bundle failure")
+ }
+ got, err := os.ReadFile(filepath.Join(root, "bundle"))
+ if err != nil {
+ return err
+ }
+ want, _, err := plan()
+ if err != nil {
+ return err
+ }
+ return execsandbox.CompareBundle(got, want)
+ },
+ }
+ s.removeSandbox = func(id string) error {
+ if id != "probe" {
+ return errors.New("unexpected fixture removal")
+ }
+ f.mu.Lock()
+ active := f.active
+ f.mu.Unlock()
+ if active {
+ return errors.New("removed active probe")
+ }
+ f.event("remove")
+ if f.fault == "remove" && f.runs > 0 {
+ return errors.New("fixture removal failure")
+ }
+ for _, name := range []string{"bundle", "skeleton"} {
+ if err := os.Remove(filepath.Join(root, name)); err != nil && !errors.Is(err, os.ErrNotExist) {
+ return err
+ }
+ }
+ return nil
+ }
+ s.Run = func(ctx context.Context, args ...string) (string, error) {
+ if strings.Join(args, " ") != "journalctl --no-pager --output=cat --lines=20 --unit="+gvisorProbeUnit {
+ t.Error(args)
+ }
+ deadline, ok := ctx.Deadline()
+ if !ok || time.Until(deadline) > 5*time.Second {
+ t.Error("unbounded diagnostic context")
+ }
+ f.mu.Lock()
+ f.journals++
+ f.mu.Unlock()
+ return strings.Repeat("x", 12000) + "journal-tail", nil
+ }
+ s.Logf = func(format string, args ...any) {
+ f.mu.Lock()
+ f.logs = append(f.logs, fmt.Sprintf(format, args...))
+ f.mu.Unlock()
+ }
+ for name, value := range map[string]string{"cgroup.events": "populated 0\n", "cgroup.procs": "101\n102\n103\n104\n", "memory.max": "301989888", "memory.high": "271790892", "memory.swap.max": "301989888", "pids.max": "320", "cpu.weight": "50", "io.weight": "default 50", "cpu.max": "50000 100000"} {
+ if err := f.write("cg"+f.group+"/"+name, value); err != nil {
+ t.Fatal(err)
+ }
+ }
+ pin, _ := execsandbox.RunscFor(runtime.GOOS + "-" + runtime.GOARCH)
+ for _, p := range []struct{ pid, exe, args, children string }{
+ {"101", execsandbox.RunscPath(pin), "runsc\x00run\x00probe", "102 103 104"},
+ {"102", execsandbox.RunscPath(pin), "runsc\x00gofer\x00probe", ""},
+ {"103", filepath.Join(execsandbox.RunscDir(pin), "gvisor-bin/gvisor_sentry"), "gvisor_sentry", ""},
+ {"104", filepath.Join(execsandbox.RunscDir(pin), "gvisor-bin/runsc-fd-parking"), "runsc-fd-parking", ""},
+ } {
+ for name, value := range map[string]string{"cgroup": "0::" + f.group + "\n", "cmdline": p.args, "task/" + p.pid + "/children": p.children} {
+ if err := f.write("proc/"+p.pid+"/"+name, value); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if err := os.Symlink(p.exe, filepath.Join(root, "proc", p.pid, "exe")); err != nil {
+ t.Fatal(err)
+ }
+ }
+ shown := gvisorShownFixture(t, ProbeDirName, roleProbe)
+ source, _ := gvisorDropIn(pin, ProbeDirName, roleProbe)
+ s.Systemctl = func(ctx context.Context, args ...string) (string, error) {
+ query := strings.Join(args, " ")
+ switch args[0] {
+ case "list-units", "list-jobs":
+ f.event(args[0])
+ return "", nil
+ case "daemon-reload":
+ f.mu.Lock()
+ f.reloads++
+ f.commandStatus = "code=(null) ; status=0/0"
+ f.mu.Unlock()
+ f.event("reload")
+ if f.fault == "reload" {
+ return "", errors.New("fixture reload failure")
+ }
+ return "", nil
+ case "cat":
+ return source, nil
+ case "start":
+ if args[1] != gvisorProbeUnit {
+ return "", errors.New("unexpected start")
+ }
+ f.event("start")
+ if f.fault == "no-socket" {
+ return "", nil
+ }
+ if f.fault == "start" {
+ return "", errors.New("fixture start failure")
+ }
+ if _, err := os.Lstat(ops.output); !errors.Is(err, os.ErrNotExist) {
+ t.Error("old output not removed before start")
+ }
+ f.mu.Lock()
+ nonce := f.nonce
+ f.mu.Unlock()
+ // The host fixture and abstract listener exist before the guest starts.
+ if _, err := os.Stat(filepath.Join(root, "fixture")); err != nil {
+ t.Error(err)
+ }
+ if _, err := os.Stat(filepath.Join(root, "a-"+nonce[:8])); err != nil {
+ t.Error(err)
+ }
+ listener, err := net.ListenUnix("unix", &net.UnixAddr{Net: "unix", Name: filepath.Join(root, "s-"+nonce[:8])})
+ if err != nil {
+ return "", err
+ }
+ f.mu.Lock()
+ f.listener = listener
+ f.active = true
+ f.runs++
+ f.mu.Unlock()
+ if err := f.write("cg"+f.group+"/cgroup.events", "populated 1\n"); err != nil {
+ return "", err
+ }
+ f.peer.Add(1)
+ go f.serve(nonce, listener)
+ return "", nil
+ case "stop":
+ f.closePeer()
+ f.mu.Lock()
+ f.active = false
+ runs := f.runs
+ f.mu.Unlock()
+ f.event("stop")
+ if f.fault == "cleanup" && runs > 0 {
+ return "", errors.New("fixture stop failure")
+ }
+ return "", f.write("cg"+f.group+"/cgroup.events", "populated 0\n")
+ case "show":
+
+ if strings.Contains(query, "InvocationID,ExecStopPost") {
+ f.mu.Lock()
+ f.recordReads++
+ runs, status := f.runs, f.commandStatus
+ f.mu.Unlock()
+ if runs == 0 {
+ return "InvocationID=\n", nil
+ }
+ return "InvocationID=old\nExecStopPost={ path=" + execsandbox.RunscPath(pin) + " ; argv[]=" + execsandbox.RunscPath(pin) + " --root=/run/carlos-runsc delete -force probe ; ignore_errors=no ; " + status + " }", nil
+ }
+ if strings.Contains(query, runProofProperties) {
+ f.mu.Lock()
+ active, runs := f.active, f.runs
+ f.mu.Unlock()
+ out := systemd257Stopped(gvisorProbeUnit)
+ if runs == 0 {
+ out = strings.Replace(out, "InvocationID="+parseShow(out)["InvocationID"], "InvocationID=", 1)
+ }
+ if active {
+ out = strings.ReplaceAll(strings.ReplaceAll(out, "MainPID=0", "MainPID=101"), "ActiveState=inactive", "ActiveState=active")
+ }
+ if f.fault == "prior-job" && runs == 0 {
+ out = strings.Replace(out, "Job=\n", "Job=42\n", 1)
+ }
+ return out, nil
+ }
+ if strings.Contains(query, "MainPID,ControlPID,ControlGroup,ActiveState") {
+ f.event("pids")
+ return "MainPID=101\nControlPID=0\nControlGroup=" + f.group + "\nActiveState=active", nil
+ }
+ if strings.Contains(query, "Result,ExecMainCode,ExecMainStatus") {
+ f.event("exit")
+ if f.fault == "exit" {
+ return "Result=timeout\nExecMainCode=2\nExecMainStatus=9", nil
+ }
+ return "Result=success\nExecMainCode=1\nExecMainStatus=0", nil
+ }
+ f.event("assert")
+ if f.fault == "unit" {
+ return strings.Replace(shown, "User=root", "User=carlos", 1), nil
+ }
+ return shown, nil
+ }
+ return "", fmt.Errorf("unexpected fixture systemctl: %v", args)
+ }
+ return f
+}
+func (f *probeFlow) serve(nonce string, listener *net.UnixListener) {
+ defer f.peer.Done()
+ conn, err := listener.AcceptUnix()
+ if err != nil {
+ return
+ }
+ f.mu.Lock()
+ f.conn = conn
+ f.mu.Unlock()
+ defer conn.Close()
+ conn.SetDeadline(time.Now().Add(3 * time.Second))
+ if f.entered != nil {
+ close(f.entered)
+ <-f.release
+ }
+ f.event("challenge")
+ challenge := nonce + "\n"
+ if f.fault == "challenge" {
+ challenge = strings.Repeat("0", 64) + "\n"
+ }
+ if _, err = io.WriteString(conn, challenge); err != nil {
+ return
+ }
+ ack := make([]byte, len(challenge))
+ if _, err = io.ReadFull(conn, ack); err != nil {
+ return
+ }
+ if string(ack) != nonce+"\n" {
+ return
+ }
+ f.event("ack")
+ rep := ProbeReport{Ready: true, Nonce: nonce}
+ for _, check := range flowChecks {
+ verdict := "ok"
+ if f.fault == "guest/"+check {
+ verdict = "fail"
+ rep.Ready = false
+ }
+ rep.Lines = append(rep.Lines, VerdictLine{Check: check, Verdict: verdict})
+ }
+ if f.fault == "nonce" {
+ rep.Nonce = strings.Repeat("1", 64)
+ }
+ if f.fault == "missing-check" {
+ rep.Lines = rep.Lines[1:]
+ }
+ raw, _ := json.Marshal(rep)
+ if f.fault == "json" {
+ raw = []byte("{")
+ }
+ if f.fault == "oversize" {
+ raw = []byte(strings.Repeat("x", 65537))
+ }
+ if f.fault != "output" {
+ if err := os.WriteFile(f.s.gvisorProbeTestOps.output, raw, 0600); err != nil {
+ return
+ }
+ }
+ f.mu.Lock()
+ if f.fault == "pin-during" {
+ f.identity = "pin-b/identity-2"
+ }
+ if f.fault != "settlement" {
+ f.commandStatus = "code=exited ; status=0"
+ f.active = false
+ }
+ f.mu.Unlock()
+ if f.fault != "settlement" {
+ _ = f.write("cg"+f.group+"/cgroup.events", "populated 0\n")
+ }
+}
+
+func TestGVisorFix1ProbeFlow(t *testing.T) {
+ f := newProbeFlow(t)
+ for i := 0; i < 2; i++ {
+ if i == 1 {
+ f.s.Systemctl(t.Context(), "daemon-reload")
+ }
+ if rep := f.s.runGVisorProbe(t.Context()); !rep.Ready {
+ t.Fatal(i, rep)
+ }
+ if err := f.s.sandboxAdmission(t.Context()); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if f.runs != 2 || len(f.nonces) != 2 || f.nonces[0] == f.nonces[1] || f.reloads < 5 || f.journals != 0 || f.recordReads != 0 {
+ t.Fatal(f.runs, f.nonces, f.reloads, f.logs)
+ }
+ for _, name := range []string{"bundle", "skeleton", "fixture"} {
+ if _, err := os.Lstat(filepath.Join(f.root, name)); !errors.Is(err, os.ErrNotExist) {
+ t.Fatal("leftover", name, err)
+ }
+ }
+ position := -1
+ for _, name := range []string{"nonce", "exe", "bundle", "verify", "assert", "start", "challenge", "pids", "ack", "exit", "output", "stop", "remove", "reload"} {
+ found := -1
+ for i := position + 1; i < len(f.events); i++ {
+ if f.events[i] == name {
+ found = i
+ break
+ }
+ }
+ if found < 0 {
+ t.Fatalf("missing ordered %s: %v", name, f.events)
+ }
+ position = found
+ }
+ f.mu.Lock()
+ f.identity = "pin-b/identity-1"
+ f.mu.Unlock()
+ if err := f.s.sandboxAdmission(t.Context()); err == nil {
+ t.Fatal("pin change reused pass")
+ }
+}
+
+func TestGVisorFix1ProbeFailures(t *testing.T) {
+ faults := []string{"prior-job", "exe", "bundle", "unit", "start", "challenge", "pids", "limits", "settlement", "exit", "output", "json", "oversize", "nonce", "missing-check", "pin-during", "cleanup", "baseline", "runtime", "identity", "paths", "fixture", "abstract", "socket-exists", "skeleton", "remove", "reload", "output-reset", "no-socket"}
+ for _, check := range flowChecks {
+ faults = append(faults, "guest/"+check)
+ }
+ for _, fault := range faults {
+ t.Run(fault, func(t *testing.T) {
+ f := newProbeFlow(t)
+ f.fault = fault
+ switch fault {
+ case "identity":
+ f.s.gvisorIdentityTest = func() (string, error) { return "", execsandbox.ErrRunsc }
+ case "output-reset":
+ if err := f.write("output/keep", "occupied"); err != nil {
+ t.Fatal(err)
+ }
+ case "pids":
+ if err := f.write("proc/104/cgroup", "0::/outside\n"); err != nil {
+ t.Fatal(err)
+ }
+ case "limits":
+ if err := f.write("cg"+f.group+"/memory.high", "1"); err != nil {
+ t.Fatal(err)
+ }
+ case "baseline":
+ f.s.SandboxBaseline = func() error { return errors.New("fixture baseline failure") }
+ case "runtime":
+ f.s.SandboxRunsc = func(context.Context) error { return execsandbox.ErrRunsc }
+ }
+ ctx := t.Context()
+ if fault == "settlement" || fault == "no-socket" {
+ var cancel context.CancelFunc
+ ctx, cancel = context.WithTimeout(ctx, time.Second)
+ defer cancel()
+ }
+ rep := f.s.runGVisorProbe(ctx)
+ if rep.Ready {
+ t.Fatal("failed proof accepted")
+ }
+
+ expected := map[string]string{"prior-job": "probe-cleanup", "exe": "probe-exe", "bundle": "bundle", "unit": "unit", "start": "start", "challenge": "host-socket", "pids": "runtime-cgroup", "limits": "limits", "settlement": "probe-stop", "exit": "probe-exit", "output": "probe-output", "json": "probe-output", "oversize": "probe-output", "nonce": "probe-checks", "missing-check": "probe-checks", "pin-during": "runsc", "cleanup": "probe-cleanup", "baseline": "exec-sandbox", "runtime": "exec-sandbox", "identity": "runsc", "paths": "nonce", "fixture": "host-fixture", "abstract": "host-abstract", "socket-exists": "host-socket", "skeleton": "bundle", "remove": "probe-cleanup", "reload": "bundle", "output-reset": "probe-output", "no-socket": "host-socket"}[fault]
+ if strings.HasPrefix(fault, "guest/") {
+ expected = "probe-checks"
+ }
+ if len(rep.Lines) != 1 || rep.Lines[0].Check != expected {
+ t.Fatalf("wrong failure: %+v, want %s", rep, expected)
+ }
+ w := httptest.NewRecorder()
+ f.s.Handler().ServeHTTP(w, gvisorStartRequest(f.s))
+ if w.Code != http.StatusServiceUnavailable {
+ t.Fatal(w.Code, w.Body)
+ }
+ if f.journals != 1 || len(f.logs) != 1 || len(f.logs[0]) > 4200 || !strings.Contains(f.logs[0], "journal-tail") {
+ t.Fatal("diagnostic not bounded", f.journals, len(f.logs), f.logs)
+ }
+ f.s.mu.Lock()
+ token := f.s.gvisorProbeIdentity
+ f.s.mu.Unlock()
+ if token != "" {
+ t.Fatal("failure retained previous pass")
+ }
+ })
+ }
+}
+
+func TestGVisorFix1RunningProbeKeepsPass(t *testing.T) {
+ f := newProbeFlow(t)
+ if rep := f.s.runGVisorProbe(t.Context()); !rep.Ready {
+ t.Fatal(rep)
+ }
+ f.entered, f.release = make(chan struct{}), make(chan struct{})
+ f.fault = "guest/uid"
+ done := make(chan ProbeReport, 1)
+ go func() { done <- f.s.runGVisorProbe(context.Background()) }()
+ <-f.entered
+ // Release the fake guest even if an assertion fails.
+ finished := false
+ defer func() {
+ if !finished {
+ close(f.release)
+ <-done
+ }
+ }()
+ if rep, ok := f.s.Ready(); !ok {
+ t.Error("running probe revoked pass", rep)
+ }
+ next := f.s.sandboxHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(204) }))
+ w := httptest.NewRecorder()
+ next.ServeHTTP(w, gvisorStartRequest(f.s))
+ if w.Code != 204 {
+ t.Error("running probe blocked start", w.Code, w.Body)
+ }
+ close(f.release)
+ rep := <-done
+ finished = true
+ if rep.Ready {
+ t.Error("failed replacement probe accepted")
+ }
+ if err := f.s.sandboxAdmission(t.Context()); err == nil {
+ t.Error("completed failure left starts admitted")
+ }
+}
diff --git a/internal/instancectl/gvisorprobe_linux.go b/internal/instancectl/gvisorprobe_linux.go
index c1f4603bd..6a615e85f 100644
--- a/internal/instancectl/gvisorprobe_linux.go
+++ b/internal/instancectl/gvisorprobe_linux.go
@@ -29,7 +29,7 @@ func (s *Server) assertGVisorProbeProcesses(ctx context.Context) error {
if err != nil {
return err
}
- return gvisorProbeProcesses("/proc", s.CgroupRoot, group, main, pin)
+ return gvisorProbeProcesses(s.gvisorProbeOperations().procRoot, s.CgroupRoot, group, main, pin)
}
func gvisorProbeProcesses(procRoot, cgroupRoot, group string, main int, pin execsandbox.RunscPin) error {
allowed := map[string]bool{}
diff --git a/internal/instancectl/gvisorstart_test.go b/internal/instancectl/gvisorstart_test.go
index e0cb579d6..025879d51 100644
--- a/internal/instancectl/gvisorstart_test.go
+++ b/internal/instancectl/gvisorstart_test.go
@@ -81,13 +81,7 @@ func gvisorStartFixture(t *testing.T) (*Server, func() int) {
if strings.Contains(joined, "--value") {
return "1234567890abcdef1234567890abcdef", nil
}
- if strings.Contains(joined, "InvocationID,ExecStopPost") {
- if started == 0 {
- return "InvocationID=\n", nil
- }
- pin, _ := execsandbox.RunscFor(runtime.GOOS + "-" + runtime.GOARCH)
- return "InvocationID=1234567890abcdef1234567890abcdef\nExecStopPost={ path=" + execsandbox.RunscPath(pin) + " ; argv[]=" + execsandbox.RunscPath(pin) + " --root=/run/carlos-runsc delete -force run-demo.example ; ignore_errors=no ; code=exited ; status=0 }", nil
- }
+
return shown, nil
}
return "", errors.New("unexpected systemctl " + joined)
@@ -192,38 +186,6 @@ func TestGVisorLimits(t *testing.T) {
}
}
-func TestGVisorDispatchCleanupRetainsFailedDelete(t *testing.T) {
- s, _ := gvisorStartFixture(t)
- w := httptest.NewRecorder()
- s.handleStart(w, gvisorStartRequest(s))
- if w.Code != 200 {
- t.Fatal(w.Body)
- }
- removed := false
- s.removeSandbox = func(string) error { removed = true; return nil }
- base := s.Systemctl
- s.Systemctl = func(ctx context.Context, args ...string) (string, error) {
- out, err := base(ctx, args...)
- if strings.Contains(strings.Join(args, " "), "InvocationID,ExecStopPost") {
- out = strings.Replace(out, "status=0 }", "status=1 }", 1)
- }
- return out, err
- }
- w = httptest.NewRecorder()
- s.handleStop(w, httptest.NewRequest("POST", "/stop?host=demo.example&role=run", nil))
- if w.Code/100 == 2 || removed {
- t.Fatal("failed runtime delete accepted")
- }
- if _, err := os.Stat(filepath.Join(s.DropInDir, GVisorUnitName("demo.example")+".d", gvisorDropInName)); err != nil {
- t.Fatal("retained pin lost", err)
- }
- s.Systemctl = base
- w = httptest.NewRecorder()
- s.handleStop(w, httptest.NewRequest("POST", "/stop?host=demo.example&role=run", nil))
- if w.Code != 204 || !removed {
- t.Fatal(w.Code, w.Body)
- }
-}
func TestGVisorDispatchReloadDebt(t *testing.T) {
s, _ := gvisorStartFixture(t)
unit := GVisorUnitName("demo.example")
diff --git a/internal/instancectl/gvisorunit.go b/internal/instancectl/gvisorunit.go
index e590998fa..a798e5ccf 100644
--- a/internal/instancectl/gvisorunit.go
+++ b/internal/instancectl/gvisorunit.go
@@ -36,7 +36,7 @@ func gvisorCommands(pin execsandbox.RunscPin, host string, role Role) (map[strin
return nil, execsandbox.ErrRunsc
}
commands := map[string][]gvisorCommand{
- "ExecStartPre": {{Args: []string{runsc, "--root=/run/carlos-runsc", "delete", "-force", id}}},
+ "ExecStartPre": {{Args: []string{runsc, "--root=/run/carlos-runsc", "delete", "-force", id}, Ignore: true}},
"ExecStart": {{Args: []string{runsc, "--root=/run/carlos-runsc", "--ignore-cgroups", "--network=none", "--host-uds=create", "--overlay2=none", "run", "--bundle", execsandbox.BundleDir(id), id}}},
"ExecStop": {{Args: []string{runsc, "--root=/run/carlos-runsc", "kill", id, "TERM"}, Ignore: true}},
"ExecStopPost": {{Args: []string{runsc, "--root=/run/carlos-runsc", "delete", "-force", id}}},
@@ -302,54 +302,6 @@ func gvisorProbeOutputShown(source string) error {
return nil
}
-func (s *Server) gvisorDeleteCompleted(ctx context.Context, unit, id string) error {
- out, err := s.Systemctl(ctx, "show", unit, "-p", "InvocationID,ExecStopPost")
- if err != nil {
- return err
- }
- m, err := gvisorShow(out)
- if err != nil {
- return err
- }
- invocation, present := m["InvocationID"]
- if !present {
- return errGVisorProbe
- }
- if invocation == "" {
- return nil
- }
- raw := m["ExecStopPost"]
- commands, err := parseGVisorCommands(raw)
- if err != nil || len(commands) == 0 {
- return errGVisorProbe
- }
- last := commands[len(commands)-1]
- if len(last.Args) != 5 || last.Ignore || !slices.Equal(last.Args[1:], []string{"--root=/run/carlos-runsc", "delete", "-force", id}) {
- return errGVisorProbe
- }
- path := last.Args[0]
- set, ok := strings.CutPrefix(path, "/opt/carlos/runsc/")
- set, tail, found := strings.Cut(set, "/")
- if !ok || !found || len(set) != 64 || tail != "runsc" || strings.Trim(set, "0123456789abcdef") != "" {
- return execsandbox.ErrRunsc
- }
- record := raw[strings.LastIndex(raw, "{ "):]
- fields := strings.Split(strings.TrimSuffix(strings.TrimPrefix(record, "{ "), " }"), " ; ")
- code, status := "", ""
- for _, field := range fields {
- if value, ok := strings.CutPrefix(field, "code="); ok {
- code = value
- }
- if value, ok := strings.CutPrefix(field, "status="); ok {
- status = value
- }
- }
- if code != "exited" || status != "0" {
- return fmt.Errorf("%w: runtime delete incomplete", execsandbox.ErrRunsc)
- }
- return nil
-}
-
func (s *Server) finishPreviousGVisorRun(ctx context.Context, host, unit string) error {
if s.DropInDir == "" {
return execsandbox.ErrConfig
@@ -359,14 +311,7 @@ func (s *Server) finishPreviousGVisorRun(ctx context.Context, host, unit string)
} else if err != nil {
return err
}
- if err := s.stopAndProveRun(ctx, host, unit); err != nil {
- return err
- }
- id, err := GVisorID(host, RoleRun, 0)
- if err != nil {
- return err
- }
- return s.gvisorDeleteCompleted(ctx, unit, id)
+ return s.stopAndProveRun(ctx, host, unit)
}
// systemctl prints one property line per command, including repeated keys.
diff --git a/internal/instancectl/sandbox.go b/internal/instancectl/sandbox.go
index d9b683d78..252e913a4 100644
--- a/internal/instancectl/sandbox.go
+++ b/internal/instancectl/sandbox.go
@@ -119,9 +119,6 @@ func (s *Server) sandboxAdmission(ctx context.Context) error {
return s.SandboxConfigErr
}
if s.SandboxEffective == "" || s.SandboxEffective == execsandbox.EffectiveSystemd {
- if s.SandboxEffective != "" && s.Systemctl != nil && s.CgroupRoot != "" {
- return s.assertSandboxDrain(ctx)
- }
return nil
}
if s.SandboxEffective != execsandbox.EffectiveGVisor {
diff --git a/internal/instancectl/sandboxstop.go b/internal/instancectl/sandboxstop.go
index a4674216e..3abe70877 100644
--- a/internal/instancectl/sandboxstop.go
+++ b/internal/instancectl/sandboxstop.go
@@ -47,15 +47,7 @@ func (s *Server) stopRunFamiliesID(ctx context.Context, iid string) error {
if remove == nil {
remove = execsandbox.RemoveRunFiles
}
- if s.DropInDir != "" {
- if _, err := os.Lstat(filepath.Join(s.DropInDir, sibling+".d", gvisorDropInName)); err == nil {
- if err = s.gvisorDeleteCompleted(ctx, sibling, "run-"+iid); err != nil {
- return err
- }
- } else if !errors.Is(err, os.ErrNotExist) {
- return err
- }
- }
+
if err := remove("run-" + iid); err != nil {
return err
}
diff --git a/internal/instancectl/server.go b/internal/instancectl/server.go
index d01c6117f..b86cb0bc8 100644
--- a/internal/instancectl/server.go
+++ b/internal/instancectl/server.go
@@ -54,6 +54,7 @@ type Server struct {
sandboxBundleRoot string
gvisorIdentityTest func() (string, error)
gvisorBundleTestOps *gvisorBundleOps
+ gvisorProbeTestOps *gvisorProbeOps
SandboxConfigured execsandbox.Configured
SandboxEffective execsandbox.Effective
@@ -1402,7 +1403,7 @@ func (s *Server) Ready() (ProbeReport, bool) {
if err := s.sandboxAdmission(ctx); err != nil {
return s.withSandboxState(sandboxReport(err)), false
}
- if s.effectiveSandbox() == execsandbox.EffectiveSystemd && s.Systemctl != nil && s.CgroupRoot != "" {
+ if s.Systemctl != nil && s.CgroupRoot != "" {
if err := s.assertSandboxDrain(ctx); err != nil {
return s.withSandboxState(sandboxReport(err)), false
}
@@ -1516,11 +1517,7 @@ func (s *Server) RunProbe(ctx context.Context) {
}
if s.effectiveSandbox() == execsandbox.EffectiveGVisor {
- rep := s.runGVisorProbe(ctx)
- rep = s.withStartLines(rep)
- s.mu.Lock()
- s.report, s.probed = rep, true
- s.mu.Unlock()
+ s.runGVisorProbe(ctx)
return
}
@@ -1530,14 +1527,6 @@ func (s *Server) RunProbe(ctx context.Context) {
s.mu.Unlock()
return
}
- if s.Systemctl != nil && s.CgroupRoot != "" {
- if err := s.assertSandboxDrain(ctx); err != nil {
- s.mu.Lock()
- s.report, s.probed = sandboxReport(err), true
- s.mu.Unlock()
- return
- }
- }
ctx, unlock, lockErr := hairpinLocked(ctx)
defer unlock()
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 51c08de7d..5201f2a2d 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 743b4b8a0bb9fc0aa5617269e390017cec736028bc2092a13e78375bf041ee87
+plan14-root-reads-gvisor-demos.tsv ba1df741e686c684a41c8ac7ba9edc1c2690346276423e7376b144a033d09687
diff --git a/internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv b/internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv
index 5e1cced58..fe9e0ca6b 100644
--- a/internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv
+++ b/internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv
@@ -1,6 +1,6 @@
# 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.
# 26 body, 33 sites, 7 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
-# 60 new dispositions: 4 reads re-frozen at their disposition with the claim, 55 new units frozen accepted-legacy, 1 quiet units retired while they read nothing, 0 other.
+# 59 new dispositions: 4 reads re-frozen at their disposition with the claim, 54 new units frozen accepted-legacy, 1 quiet units retired while they read nothing, 0 other.
@legacy c704be8adc98ef362ac25f0ee4916e4bd6b7d636fbf3e62a068643790aadc9eb internal/activator/backend_unit.go UnitBackend.systemctl legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-gvisor-demos;basis=Task 5: gate launch using startup-captured mode and existing route/role/layout before preparation or execution; migrate structured root start identity and reject mismatches. Unsupported gVisor paths refuse; native behavior and existing root authority checks retained. No new root read source. file:CommandContext@332 fc3481b0f6f5410479d649b20bed2f0870bf574e67d5b00e6e47bd6262036c1b
@legacy bba784d6c5913e5483457620b8c6b0cea30cef7eaa19954b148cea75d1a944ae internal/activator/sidecar_ha.go ExecBackend.startHAWorker legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-s;basis=Require nested HA sidecar shape and closed worker identity environment; prepare and acknowledge sealed secrets before writing the existing run launch file. Start the previously verified staged executable through existing root StartExe, mark uncertain starts for stop proof, and observe the same run unit. No health dial or new root verb.;rev3=census-ruling-gvisor-demos;basis=Task 5: migrate structured root start identity, validate binding, retain actual unit for observation/exit/stop. Unknown worker response retains only a cleanup request and listener, never a guessed observed identity. Existing route/control/cgroup inputs; no new root read. registry:Host@1355,registry:Host@1391,registry:Host@2005,registry:Host@270,registry:Host@320,whole:Route@1049,whole:Route@1433,whole:Route@1504,whole:Route@1637,whole:Route@1692,whole:Route@184,whole:Route@2048,whole:Route@853 f90fb0c55c16840a832498cd96ffdbf8bbc3bc8adca210372a731679afb36edd
@legacy 6becaa7d7d3b47c82db5f5edc9a18c080948feeaebc835f8455a5130cadb9d5d internal/activator/unitproc.go ExecBackend.newUnitProc legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=returns newUnitProcFor's error alongside the handle; the same one site, no read added;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. whole:Route@220 2c4479b8182bd8f0fc235dd213776e6c59b22b341e6a470c0f690bee428f42ad
@@ -13,8 +13,8 @@
@legacy 5fd7a23e052a152316c75b4c833012f4ac059e747fa492da80bf6e1706058039 internal/instancectl/demo_policy.go Server.demoHandler legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-1;basis=R26: HostDemo and the demo start/purge lock run only in demo mode. Ordinary starts do not read HostDemo or gain its read-error refusal. Demo-mode missing/non-demo/held-row and read-error refusals remain.;rev3=census-ruling-gvisor-demos;basis=Retain authenticated claim cleanup routes on demo-plus-claims sandbox refusal when a ClaimStop handler exists; sandbox admission still rejects claim launches, and claimAwareLegacy rejects legacy mutations. Existing registry reads unchanged. file:Query@485,file:Query@525,registry:Status@703,whole:Route@658 b52ba1d3b35ed5195d5009ec59c180abd32262bd716ddbac4e1de245f1173d2e
@legacy 82ba9b45321078b468fb92afd835e2f75415a3c7ae7109cb61b08d39e02082c5 internal/instancectl/gen.go Server.handleParent legacy accepted-legacy accepted-legacy;rev3=J2,J4;basis=root-input;rev3=census-ruling-instance-egress-sizes-328-329;basis=#329 plan 3 Task 5: holds the host's slice lock (lockSliceWrites) around its one set-property, so /parent and /size never interleave on one slice. Its one site is still r.URL.Query() of the agent's request (counted as file:Query). The checks in this body are unchanged, though cgroup.ValidParentLimit, which it calls, now accepts one size or the sum of any two from the four-row table (up to 4 GiB, was 2 GiB); no read added.;rev3=census-ruling-agent-start-demo-1;basis=Reads fixed DemoBox and clamps the existing parent memory writer to small.;rev3=census-ruling-gvisor-demos;basis=Validate logical parent input as before, require the demo route in gVisor mode and apply Physical once to the small demo parent. Existing request query read unchanged; shares stay logical. file:Query@78 0646b2e418f426992e35bb05ec9a2c23fa0f916f7af1e4366f3ade14ddc12c69
@legacy d6421b84958c2af443e0556aa224414d7a2a9056ed887f0cd389c7b4c1a759a9 internal/instancectl/rootfs.go Server.runRootfsProbe legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=instance control (/opt/carlos/carlos instance-control, carlos-instance-control.service, root);basis=root-input (J2,J4, as Server.RunProbe): new (rootfs Plan 2 Task 7): builds the probe image once per service start, hashes it (fileSHA256), lays out the _probe rootfs exe layout and its box-addrs, starts carlos-instance-rootfs-probe.service and ReadFiles its report from /run/carlos-control/rootfs-probe.out, which PID 1 writes from the probe's stdout; the probe runs the platform binary from root's own probe image, no tenant code; the report only decides readiness, and without an ok root-image line it is never ready, whatever it says;rev3=census-ruling-agent-start-demo-1;basis=Reads DemoBox and refuses before preparing or launching a rootfs probe; ordinary probe behavior unchanged.;rev3=census-ruling-gvisor-demos;basis=Refuse sandbox configuration or readiness errors before preparing or starting the native rootfs probe. Existing image read unchanged. Task 6: Effective gVisor refuses ROOTFS explicitly before native/rootfs probe preparation; no fallback. Existing native reads unchanged. file:ReadFile@2133 9f191518546c42664f607e5b8dbc85bc273fc7abc29bb12283edad58223b73a3
-@legacy ec1940b89581c01a14abcea9a9181de831ec33250cbe393af4636f9193402662 internal/instancectl/server.go Server.RunProbe legacy accepted-legacy accepted-legacy;rev3=J2,J4;basis=root-input;rev3=census-ruling-rootfs-apps-2;basis=after the resolver allow it applies the box-address deny (denyLocalAddrs: set-property IPAddressDeny on carlos-instances.slice from localPrefixes, which reads /proc/net/fib_trie and /proc/net/if_inet6 as LocalAddrs already did), writes the probe's box-addrs under its own exe layout (writeFileExcl, a decision row), and after the binary probe runs the rootfs probe (runRootfsProbe, a decision row); its own direct read, probe.out, is unchanged;rev3=census-ruling-region-ha-p3b;basis=Take shared root hairpin lease for the entire probe so deny refresh and hairpin mutation cannot race it. Indirect reads validate root boot snapshot, root state/fence and interface inventory; existing probe.out direct read remains and lock/config errors fail readiness.;rev3=census-ruling-gvisor-demos;basis=Refuse sandbox configuration or readiness errors before fixture reads and native probe dispatch. Existing probe read unchanged. Task 6: Use the fixed private probe selector, dispatch gVisor to the serialized root/guest proof, and check mode drain before the native probe. No native/rootfs fallback in gVisor; existing native report read unchanged. file:ReadFile@3171 a2cda25a722ffb5621e875d25e1deb245c1cc954c840d0a22f69a6262b6c87c6
-@legacy 9d74063b775ea879b737b4386ca8f968e8cc76e7bcce7562a13e24a506a67c62 internal/instancectl/server.go type Server legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=Re-digested at the pre-land merge: the body includes main's own change under census ruling 292, with no further change from this branch. Census ruling 292 reclassified this declaration accepted-legacy (J2,J4) for root's per-host ordering of legacy run starts against stops; this ruling kept the row as main classed it. Its own addition is the cmd start's poll and wait bounds and its per-host lock map: field declarations only;rev3=census-ruling-rootfs-apps-2;basis=new fields: HostRuntime, ProbeImage, ProbeImageFile, RootfsProbeOut, DenyEvery, the deny's lastDeny and denyMu, the rootfs probe's report and lock, the jit reload counters and imageDigests; genStarting counts binary generation starts per unit; rootfsLocksMu and rootfsLocks, one lock entry per rootfs unit name being started or removed right now, held by a start from its layout through systemctl start and its own cleanup and by a removal from its proof through the raw removal, a removal refusing while it is taken, a waiting start giving up when its request ends, an entry dropped with its last holder or waiter (fixes E6, L2, L3); rootfsProvenHook, a test hook run between the proof and the raw removal; field declarations only; no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 and #329 plan 3 Task 5: the declaration gains sliceLocks (one mutex per host slice, taken by /size and /parent) and Egress (the asserter every start path calls), and its comment names the egress allow (plan 3's ControlDropInDir field was deleted in ef38e13b, the P1 EROFS fix); the same one site, the Statfs field, offset moved; no read added.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 6: comments only: the one-shot pacing fields cover /cmd and /tty, and cmdLocks is now keyed by (role, host) (oneShotKey, PF-7) so a session's start never waits behind a command's; field declarations unchanged; the same one site, no read added;rev3=census-ruling-agent-start-demo-1;basis=Adds fixed demo configuration, registry views, derived runtime root, synchronization and purge guard.;rev3=census-ruling-region-ha-p3b;basis=Add hairpinActive boolean alongside lastDeny under existing deny synchronization. Field declaration only; existing Statfs selector unchanged, no new read or externally supplied authority.;rev3=census-ruling-region-ha-p3b2-rolls;basis=adds one field holding the current hairpin exit watcher, guarded by the root hairpin flock; no new read;rev3=census-ruling-agent-start-demo-3;basis=Retain the snapshot supervisor in instance-control state; no new request-selected path. Census read-site delta: unchanged (1).;rev3=census-ruling-gvisor-demos;basis=Retain Task 1 mode/error/readiness fields, baseline/runtime callbacks, Task 4 per-host validated staged descriptors and root-selected probe nonce. Fix round 1 adds a private writer-operation seam assigned only in package tests, after the unchanged GVisorID admission check; production defaults still call the same checked constructor, WriteRootfs, WriteBundle and verifier. No new direct read or request-controlled callback. Task 5: private injected removal seam for unprivileged tests; production default removes only root-derived bundle and skeleton after both-family proof inside existing start fence. No new request field or agent-selected unit. Task 6: Retain serialized probe nonce, runtime-set identity verifier/token, fixed claims flag, bundle discovery root, and private unprivileged identity seam. No request-controlled callback or path; existing declaration read-site classification unchanged. file:Statfs@4781 a6db141589c9448386a806a015899a8fb7b9514b0a8df5b2b33a44fa5a793087
+@legacy fba53ebc8c38053a37328dd85a3d3b38d4852b20f20cc55897227a59722cac5a internal/instancectl/server.go Server.RunProbe legacy accepted-legacy accepted-legacy;rev3=J2,J4;basis=root-input;rev3=census-ruling-rootfs-apps-2;basis=after the resolver allow it applies the box-address deny (denyLocalAddrs: set-property IPAddressDeny on carlos-instances.slice from localPrefixes, which reads /proc/net/fib_trie and /proc/net/if_inet6 as LocalAddrs already did), writes the probe's box-addrs under its own exe layout (writeFileExcl, a decision row), and after the binary probe runs the rootfs probe (runRootfsProbe, a decision row); its own direct read, probe.out, is unchanged;rev3=census-ruling-region-ha-p3b;basis=Take shared root hairpin lease for the entire probe so deny refresh and hairpin mutation cannot race it. Indirect reads validate root boot snapshot, root state/fence and interface inventory; existing probe.out direct read remains and lock/config errors fail readiness.;rev3=census-ruling-gvisor-demos;basis=Select the fixed root-private probe family and delegate gVisor to its serialized root/guest proof, with no native/rootfs fallback. Task 6 fix round 1: remove mode drain from probe execution (Ready/ReadyDemo only), and let runGVisorProbe atomically publish the report/runtime identity including start lines once. Existing native report read unchanged. file:ReadFile@2874 d77aeeac7de9d58663980809014bd4c83060235b63ac4c85cf25bcb89827c80b
+@legacy 82605110a6be16960462dabb0f3740520c3204748ff60a8ead26fc4c36d91d90 internal/instancectl/server.go type Server legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=Re-digested at the pre-land merge: the body includes main's own change under census ruling 292, with no further change from this branch. Census ruling 292 reclassified this declaration accepted-legacy (J2,J4) for root's per-host ordering of legacy run starts against stops; this ruling kept the row as main classed it. Its own addition is the cmd start's poll and wait bounds and its per-host lock map: field declarations only;rev3=census-ruling-rootfs-apps-2;basis=new fields: HostRuntime, ProbeImage, ProbeImageFile, RootfsProbeOut, DenyEvery, the deny's lastDeny and denyMu, the rootfs probe's report and lock, the jit reload counters and imageDigests; genStarting counts binary generation starts per unit; rootfsLocksMu and rootfsLocks, one lock entry per rootfs unit name being started or removed right now, held by a start from its layout through systemctl start and its own cleanup and by a removal from its proof through the raw removal, a removal refusing while it is taken, a waiting start giving up when its request ends, an entry dropped with its last holder or waiter (fixes E6, L2, L3); rootfsProvenHook, a test hook run between the proof and the raw removal; field declarations only; no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 and #329 plan 3 Task 5: the declaration gains sliceLocks (one mutex per host slice, taken by /size and /parent) and Egress (the asserter every start path calls), and its comment names the egress allow (plan 3's ControlDropInDir field was deleted in ef38e13b, the P1 EROFS fix); the same one site, the Statfs field, offset moved; no read added.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 6: comments only: the one-shot pacing fields cover /cmd and /tty, and cmdLocks is now keyed by (role, host) (oneShotKey, PF-7) so a session's start never waits behind a command's; field declarations unchanged; the same one site, no read added;rev3=census-ruling-agent-start-demo-1;basis=Adds fixed demo configuration, registry views, derived runtime root, synchronization and purge guard.;rev3=census-ruling-region-ha-p3b;basis=Add hairpinActive boolean alongside lastDeny under existing deny synchronization. Field declaration only; existing Statfs selector unchanged, no new read or externally supplied authority.;rev3=census-ruling-region-ha-p3b2-rolls;basis=adds one field holding the current hairpin exit watcher, guarded by the root hairpin flock; no new read;rev3=census-ruling-agent-start-demo-3;basis=Retain the snapshot supervisor in instance-control state; no new request-selected path. Census read-site delta: unchanged (1).;rev3=census-ruling-gvisor-demos;basis=Retain Task 1 mode/error/readiness fields, baseline/runtime callbacks, Task 4 per-host validated staged descriptors and root-selected probe nonce. Fix round 1 adds a private writer-operation seam assigned only in package tests, after the unchanged GVisorID admission check; production defaults still call the same checked constructor, WriteRootfs, WriteBundle and verifier. No new direct read or request-controlled callback. Task 5: private injected removal seam for unprivileged tests; production default removes only root-derived bundle and skeleton after both-family proof inside existing start fence. No new request field or agent-selected unit. Task 6: Retain serialized probe nonce, runtime-set identity verifier/token, fixed claims flag, bundle discovery root, and private unprivileged identity seam. No request-controlled callback or path; existing declaration read-site classification unchanged. Task 6 fix round 1: private gvisorProbeTestOps is set only in package tests; production defaults retain all fixed paths and the checked root output opener. No externally supplied callback or new direct read. file:Statfs@4829 1541a3b0e5f9972f07c1d94b85d1067fa83d1b24099ebf6b65d783716d4a7353
@legacy 9874cef8d7e250375fe74636e2cdf0138df6ab889df1e3dbbd4f308b99904b82 internal/activator/backend_exec.go ExecBackend.waitLegacyRunGone legacy accepted-legacy accepted-legacy;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. whole:Route@524 3f1799da4272a8c8fb1fafb704f0cbad074dc9a8e8becb6ae7e7667c37a0ee79
@legacy 11be0650a243f28cddd173711c6fb6a695ac3778804055d8284b6f64efc84529 internal/activator/backend_rootfs.go uncertainWorkerProc.Stop legacy accepted-legacy accepted-legacy;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. whole:Route@166 c75ed435c88311a74616e4bf44a73694e0f5f99276b92a489a15674ab849a451
@legacy ccfa0c9fb480e3258ad0036dc10a42f3259a803ebe6db6257c50102a2c2eb5c1 internal/activator/sandbox.go ExecBackend.sandboxLaunch legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 5: read only existing in-memory route layout, demo marker, role, runtime and backing plus startup-captured mode/config error. AgentLaunchAllowed refuses direct/native/unsupported work in gVisor. No environment re-resolution or new filesystem path. registry:Backing@695,registry:Runtime@754,whole:Route@482 3d78de6e0c4be99af3ae7269be831588345389f4e9b8329ebab64475884e32f8
@@ -50,14 +50,14 @@
@legacy 4de04c1583d5fa335adadb7227f9ce1ec35e28280744d6571ebe92c72b4442f2 internal/host/units/carlos-instance-gvisor@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Add the unarmed root gVisor run skeleton with empty ExecStart and all twelve measured host properties. Defines per-instance data/run writable paths and socket output, root runtime directory, mixed kill with SIGCONT, and the existing bounded stop. A root-prepared validated command drop-in is required before it can start; no command or pin placeholder is installed here. file:external@0 914a3c0486d83b6b87ce14c473aab9005ff7bc004cb984040a81ddc60087a5c1
@legacy dd34ca6003fd907b4919382e5d960722556e8d322311cfa1d70b1eb76d96274d internal/host/units/carlos-runsc.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Root oneshot reads fixed root-owned host.env through its applet and installs compiled runtime set only under /opt/carlos/runsc; no RemainAfterExit. file:external@0 215ca2aea9519d14d0e20b5f9b6588b43ff7c5ef7b485982274fbbbfe2cf02b5
@legacy cf1d2c6d163ee921d028ab8153ec669982370e033c2d389153dbc09d05c4d643 internal/instancectl/demo_policy.go Server.demoCgroupReadback legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read memory.max/high/swap.max, pids.max, cpu.max/weight and io.weight in the derived parent and validated child cgroups. GVisor uses Physical memory/tasks and logical shares; pre-start only absent groups may defer verification, and post-start requires every file. Native checks remain the existing logical limits. file:ReadFile@1349,file:Stat@1194 89ab9fb2d29510f76d969ad980c1fcb09b455623c6b744b5b3c9687787ba6642
-@legacy bfb168d7b1551d2906f4801c37acc87e2830a87b7628896141ba20eb9aa3c7bd internal/instancectl/gvisordrain.go Server.sandboxUnitEmpty legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Walk only the fixed kernel carlos.slice hierarchy to find the named discovered service and require populated 0. No registry-provided filesystem path or runsc-state traversal. file:WalkDir@116 144d303d9beacc49c86080175ac9564c1463d28edb7b07bd9bb0c5764abc6ab1
-@legacy 64f5683105ea393103940f6d62a6c6e359ce2d741b453b4503ec4011c14a2b95 internal/instancectl/gvisordrain.go Server.sandboxUnits legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Combine systemd loaded units/jobs with directory names under the fixed cgroup carlos.slice root. Reads kernel cgroup directories; no request-selected path or process submission. file:WalkDir@794 29e5ffd74f02b26441bcc82d65c72eca23f94bbdf8cec89394f6ac852426888f
+@legacy 00c33dceabb209518ceebdc5ad8c399df4101357804a47141965cf01f13e1330 internal/instancectl/gvisordrain.go Server.sandboxUnitEmpty legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read the fixed carlos.slice cgroup hierarchy for the named discovered unit and require populated 0; skip other service subtrees. Task 6 fix round 1 confines the opposite-family caller to Ready/ReadyDemo. No request-selected filesystem path or new read site. file:WalkDir@116 e802bfb809b344b2ae4e1b3d7ae9f4896b8e3396dac720de56fa218b203e8994
+@legacy 2f09251e4b1d9e0966073e3ce00e5bdb6810f0e7d483fa7b054fc1d779f171f4 internal/instancectl/gvisordrain.go Server.sandboxUnitsFor legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 6 fix round 1: enumerate systemd units/jobs and the fixed carlos.slice kernel hierarchy, filtering by the requested fixed family. Ready in systemd mode lists only gVisor instance/probe/build patterns and ignores native jobs/services; original gVisor host overlap checks request both families. Never invoked by native per-start admission. Only kernel-owned cgroup directory reads; no tenant-selected path or runsc-state traversal. file:WalkDir@1194 6ce5d5d373840b13e1bf20a1791cbd1390540448fd238e71b2b8abb4acf05216
@legacy 732a77a4fb010d06211707a09b74525afb694cd4b7d03fecda1fc24eddf98e09 internal/instancectl/gvisordrain.go Server.sweepGVisorBundles legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=List the fixed root-owned OCI directory, accept only validated run IDs, skip live/in-flight work and acquire the original instance-ID fence before both-family stop/delete proof and removal. Never opens /run/carlos-runsc. file:ReadDir@130 0572d9325bd87b5326c195ad30874350114ad25f72d99648731ffe45ea2924a7
@legacy 289e4e86ceacf4c869115693ea028f091344b330be5a02aecb4a8aac94fc3c08 internal/instancectl/gvisordrain.go sandboxGroupEmpty legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read the caller-derived kernel cgroup.events path and require a single populated 0 field; malformed/present nonzero state refuses proof. file:ReadFile@57 4776168285ee07b83941a24023d959616dbe5af6f76491c094f1f12024384ea7
@legacy 523480138e9a6f3c15e1c0f7a58cbf5f413c511c3b2ad84cfc1744f287602ad4 internal/instancectl/gvisorprobe.go Server.gvisorProbeKernelLimits legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read only the fixed probe unit cgroup limit files, requiring the pinned physical memory/tasks and logical CPU/IO contract. file:ReadFile@357 919a374b3b1b5181da14d122f29c4ab9042634009da696afb899fc7bbe80cdc5
-@legacy 2cc16e330e72759951b1073fa45fdaddbd50f8a5c1a1f3289c95b2ff71cea322 internal/instancectl/gvisorprobe.go Server.runGVisorProbe legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Under probe serialization prove previous invocation idle/deleted, derive a fresh random nonce and fixed challenge paths, create root-only O_EXCL outside-mount fixture and abstract listener, remove old fixed output, prepare/assert the typed probe bundle/unit, and submit only after context recheck. Read a bounded nonce-bound root-owned output and guest socket handshake, inspect runtime PIDs/limits while guest waits, then stop/prove/delete before accepting readiness or removing files. No launch JSON, tenant database/source, or runtime-state read. file:Lstat@2369,file:OpenFile@1797,file:Read@1434,file:ReadAll@4903 9ab0d2ea08c766c2cf2c39562e134419b218ae714e7931560cc96da5107e67e2
+@legacy e29c1db7f86648a6a98ddc8f4f1e0025d6a7ec8fa4f64855c9efec0c402054b2 internal/instancectl/gvisorprobe.go Server.runGVisorProbe legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 6 fix round 1, applying the controller rulings: serialized probe construction uses root random nonce/fixed paths, root-only O_EXCL fixture, abstract listener, typed verified bundle/unit and context recheck. Read bounded root-owned nonce-bound output and the guest socket handshake; inspect kernel/proc runtime and limits while guest waits. Termination uses inactive/not-loaded state, no job/PIDs and empty cgroup, never per-command stop-post records. Keep the prior pass during the run and publish report plus runtime identity once, after cleanup; any failed attempt invalidates it and records the bounded diagnostic. A private package-test-only operations struct substitutes paths, executable preparation and output opening; production keeps GVisorProbePaths, fixed output/procfs, ensureExe and execsandbox.OpenRootFile. No new tenant-controlled path, launch/source/database read, or runtime-state read. file:Lstat@2452,file:OpenFile@1887,file:Read@1577,file:ReadAll@4796 893229809de0f7213f0d2931094c653d85f3dc4787c237e647a8357c1c70363a
@legacy 5453c559c4886ff67c038178332bf104aad65ec1475fc16c213c01681d76e29f internal/instancectl/gvisorprobe_linux.go gvisorProbeProcesses legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read kernel cgroup.procs under the fixed probe subtree and /proc/<numeric PID> exe, cgroup, cmdline, task directory and children. Require pinned-set executable paths, in-subtree membership, live gofer/Sentry and no descendant outside the unit. PIDs come from kernel/systemd evidence, never a request. file:ReadDir@1895,file:ReadFile@1085,file:ReadFile@1381,file:ReadFile@2022,file:ReadFile@468,file:Readlink@925,file:WalkDir@279 f83c97c76a1584b3ae4ac34d4098902c7b805a970ce6dc5c8378e787c694ab0a
-@legacy fa03634703152bd1b7fc411c7431a5527524265396f49db61223bfda7134c8a1 internal/instancectl/gvisorunit.go Server.finishPreviousGVisorRun legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Lstat only the validated run unit retained controller drop-in. Before replacing it require inactive/empty proof and successful owning-unit runtime delete status. Does not inspect runtime state. file:Lstat@161 2fcbb0fe5caeba134519668b419e317ea5ee106c3994e10c02bca50c00b7de0b
+@legacy a6039549f1f55f12e49a2b68c709e8c90e89d20af049619fbba956484d9dd153 internal/instancectl/gvisorunit.go Server.finishPreviousGVisorRun legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 6 fix round 1: Lstat only the root-derived retained run drop-in; when present, stop and require terminal unit/no job/no PIDs/empty cgroup through the existing proof. No ExecStopPost status dependency. Per the explicit ruling, stale runtime metadata is inert and the next ignored ExecStartPre runsc delete -force removes it. file:Lstat@161 28836624c17a0ef444382aae2c660b500697cac35d67a6b84921823e3569ab92
@legacy 62ae6757c1358f227e5da14c6a018cc72dedc4d1ed4c16ba5af72feb84357f99 internal/instancectl/ocibundle.go Server.gvisorExecutable legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Resolve prepared root-owned app link through existing native live or validated staged target; production passes fixed checked root file/directory helpers. file:EvalSymlinks@217 c64f3dc10842930f1c594db2ece7f41ac8bdde0d5907e510a179aee5dc7f1a21
@legacy 1ce29730ea6b37af57f6ae0465cc44f9327a20423e8dcf25026a57f30922e104 internal/instancectl/ocibundle.go Server.gvisorExecutableWith legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read only prepared root-owned app/live links and live directory listing after ancestor checks; reject staged target without retained successful validation, revalidate staged digest after checked resolved regular executable metadata, require exact live host -> ../app. No launch/source/database file is opened. file:ReadDir@1611,file:Readlink@1822,file:Readlink@711 f6a646dfcd1483b9d2aefad5ed4fd0bc015deb5d07eb928c303227f2190aff5f
@legacy 5d9afb4a737882b56f397e19da88961f70bd7a278810cea13944f2d47d72541a 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. Task 6: Pass the already root-resolved numeric carlos uid/gid alongside the serialized probe nonce in the OCI environment. No added mount, launch parsing, or filesystem read. data-literal@1187 064e8089b8b53b09eed7ebb8d2c050084a7beb091043a8c5667f3266f3cb0977
@@ -66,7 +66,6 @@
@legacy 4e1e0e30bc8cfd5ed764037291e6cb878a5007fe869f6903931d7ad05b46ae56 internal/instancectl/sandbox.go Server.requestFamily legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read the registry route through the existing root-provided HostDemo callback for gVisor public starts and reject held or unsupported routes before preparation. Native registry/egress behavior remains unchanged; fixed policy receives no readiness state. registry:Status@429,whole:Route@318,whole:Route@397,whole:Route@542 dfb40d756f97cc8aa68626b550ad341a9ddd796493de158d3f99ee20c9614fed
@legacy 43a54aebd894c7b4852e9fbcf3e1dc75d71ceffebe4c51ee7003dffce4d22cb7 internal/instancectl/sandbox.go Server.unitFamily legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Classify only retained mode, claims/demo flags, role and route runtime/demo shape; gVisor public starts require a route and only private probe/build may omit it. No I/O or readiness-driven fallback. registry:Runtime@630,whole:Route@614,whole:Route@794,whole:Route@852 bed900b96d6b79417c25954e25144ec00c6388a0951ffd405b9788f103851d06
@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 6b43e08bd4a6671256e46467fa52930c9195644edc10210dd5691ae7cc16ed2c internal/instancectl/sandboxstop.go Server.stopRunFamiliesID legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Derive both original unit names from a validated instance ID; retain the original-run fence through stop/inactive/job/kernel proof, retained owning-unit delete status, bundle/skeleton removal and drop-in removal/reload. Lstat only the derived root-owned drop-in, never runtime-state files. file:Lstat@589 fe81c4c488fe38b794f27891827b3634350aa6a8f326d44e2cf00a5646bd0fde
@legacy cec824c9807e579085fc5e14741c1b3fd97bcf58210f8861cd4f9c282d39aa1e internal/instanceexec/probe_gvisor.go checkGVisorFacts legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Evaluate guest probe facts only. Census labels the boolean Openat2 field as a file read, but this pure evaluator performs no I/O or root action. file:Openat2@845 0fbb701794c0c747fb23628a1e3ed9f791d3024e2001df8040809b8f7544bae1
@legacy 41d8f6f4a50ddf86247cc886cfee2c1dad66937a57f9af7b0be82a8fef3283b5 internal/instanceexec/probe_gvisor.go type gvisorProbeFacts legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Guest evidence fields only; Openat2 is a boolean fact, not a syscall or filesystem read. file:Openat2@325 5b30f52a1aca92bfa18331e3a88ac84fbaa4b15765197f822446c1aff7884046
@legacy ced2799330403a27ba85eb6c52d5ad242b3e124dd4f06c6c6d02de3be25b1f81 internal/instanceexec/probe_gvisor_linux.go runGVisorProbeChecks legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Unprivileged guest reads fixed /proc/self/status and /proc/version; checks root-supplied numeric identity, capabilities/NNP, pinned measured kernel signature, io_uring ENOSYS, loopback/public TCP refusal, absent nonce-derived host fixture and unreachable root abstract socket. Checks existing safe-open behavior at its own fixed data directory and serves a nonce socket in its own host-visible run mount until root acknowledges process/limit proof. No host root authority or tenant-selected path. data-literal@2263,file:Lstat@2161,file:Openat2@2230,file:ReadFile@1287,file:ReadFile@607 413c4f54d74b42a5242cf9b73781898d8f71213500a42f18d876975036fe10c1
@@ -123,9 +122,9 @@ internal/instancectl/demo_cleanup.go Server.stopDemoUnits legacy accepted-legacy
internal/instancectl/demo_policy.go Server.demoHandler legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-1;basis=R26: HostDemo and the demo start/purge lock run only in demo mode. Ordinary starts do not read HostDemo or gain its read-error refusal. Demo-mode missing/non-demo/held-row and read-error refusals remain.;rev3=census-ruling-gvisor-demos;basis=Retain authenticated claim cleanup routes on demo-plus-claims sandbox refusal when a ClaimStop handler exists; sandbox admission still rejects claim launches, and claimAwareLegacy rejects legacy mutations. Existing registry reads unchanged. file:Query@485,file:Query@525,registry:Status@703,whole:Route@658 b52ba1d3b35ed5195d5009ec59c180abd32262bd716ddbac4e1de245f1173d2e
internal/instancectl/gen.go Server.handleParent legacy accepted-legacy accepted-legacy;rev3=J2,J4;basis=root-input;rev3=census-ruling-instance-egress-sizes-328-329;basis=#329 plan 3 Task 5: holds the host's slice lock (lockSliceWrites) around its one set-property, so /parent and /size never interleave on one slice. Its one site is still r.URL.Query() of the agent's request (counted as file:Query). The checks in this body are unchanged, though cgroup.ValidParentLimit, which it calls, now accepts one size or the sum of any two from the four-row table (up to 4 GiB, was 2 GiB); no read added.;rev3=census-ruling-agent-start-demo-1;basis=Reads fixed DemoBox and clamps the existing parent memory writer to small.;rev3=census-ruling-gvisor-demos;basis=Validate logical parent input as before, require the demo route in gVisor mode and apply Physical once to the small demo parent. Existing request query read unchanged; shares stay logical. file:Query@78 0646b2e418f426992e35bb05ec9a2c23fa0f916f7af1e4366f3ade14ddc12c69
internal/instancectl/rootfs.go Server.runRootfsProbe legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=instance control (/opt/carlos/carlos instance-control, carlos-instance-control.service, root);basis=root-input (J2,J4, as Server.RunProbe): new (rootfs Plan 2 Task 7): builds the probe image once per service start, hashes it (fileSHA256), lays out the _probe rootfs exe layout and its box-addrs, starts carlos-instance-rootfs-probe.service and ReadFiles its report from /run/carlos-control/rootfs-probe.out, which PID 1 writes from the probe's stdout; the probe runs the platform binary from root's own probe image, no tenant code; the report only decides readiness, and without an ok root-image line it is never ready, whatever it says;rev3=census-ruling-agent-start-demo-1;basis=Reads DemoBox and refuses before preparing or launching a rootfs probe; ordinary probe behavior unchanged.;rev3=census-ruling-gvisor-demos;basis=Refuse sandbox configuration or readiness errors before preparing or starting the native rootfs probe. Existing image read unchanged. Task 6: Effective gVisor refuses ROOTFS explicitly before native/rootfs probe preparation; no fallback. Existing native reads unchanged. file:ReadFile@2133 9f191518546c42664f607e5b8dbc85bc273fc7abc29bb12283edad58223b73a3
-internal/instancectl/server.go Server.RunProbe legacy accepted-legacy accepted-legacy;rev3=J2,J4;basis=root-input;rev3=census-ruling-rootfs-apps-2;basis=after the resolver allow it applies the box-address deny (denyLocalAddrs: set-property IPAddressDeny on carlos-instances.slice from localPrefixes, which reads /proc/net/fib_trie and /proc/net/if_inet6 as LocalAddrs already did), writes the probe's box-addrs under its own exe layout (writeFileExcl, a decision row), and after the binary probe runs the rootfs probe (runRootfsProbe, a decision row); its own direct read, probe.out, is unchanged;rev3=census-ruling-region-ha-p3b;basis=Take shared root hairpin lease for the entire probe so deny refresh and hairpin mutation cannot race it. Indirect reads validate root boot snapshot, root state/fence and interface inventory; existing probe.out direct read remains and lock/config errors fail readiness.;rev3=census-ruling-gvisor-demos;basis=Refuse sandbox configuration or readiness errors before fixture reads and native probe dispatch. Existing probe read unchanged. Task 6: Use the fixed private probe selector, dispatch gVisor to the serialized root/guest proof, and check mode drain before the native probe. No native/rootfs fallback in gVisor; existing native report read unchanged. file:ReadFile@3171 a2cda25a722ffb5621e875d25e1deb245c1cc954c840d0a22f69a6262b6c87c6
+internal/instancectl/server.go Server.RunProbe legacy accepted-legacy accepted-legacy;rev3=J2,J4;basis=root-input;rev3=census-ruling-rootfs-apps-2;basis=after the resolver allow it applies the box-address deny (denyLocalAddrs: set-property IPAddressDeny on carlos-instances.slice from localPrefixes, which reads /proc/net/fib_trie and /proc/net/if_inet6 as LocalAddrs already did), writes the probe's box-addrs under its own exe layout (writeFileExcl, a decision row), and after the binary probe runs the rootfs probe (runRootfsProbe, a decision row); its own direct read, probe.out, is unchanged;rev3=census-ruling-region-ha-p3b;basis=Take shared root hairpin lease for the entire probe so deny refresh and hairpin mutation cannot race it. Indirect reads validate root boot snapshot, root state/fence and interface inventory; existing probe.out direct read remains and lock/config errors fail readiness.;rev3=census-ruling-gvisor-demos;basis=Select the fixed root-private probe family and delegate gVisor to its serialized root/guest proof, with no native/rootfs fallback. Task 6 fix round 1: remove mode drain from probe execution (Ready/ReadyDemo only), and let runGVisorProbe atomically publish the report/runtime identity including start lines once. Existing native report read unchanged. file:ReadFile@2874 d77aeeac7de9d58663980809014bd4c83060235b63ac4c85cf25bcb89827c80b
internal/instancectl/server.go runWithClaim authority C,D,G Claim instance controller adds held-release RPC dispatch within existing launch/participation execution boundary.;rev3=census-ruling-rootfs-apps-2;basis=takes a RegistryView (HostApp and HostRuntime) for the bare hostApp, and the production Server literal gains HostRuntime, ProbeImage: BuildProbeImage, ProbeImageFile: ProbeImagePath, RootfsProbeOut under /run/carlos-control and DenyEvery: 10s; this body reads nothing new itself; the readers it wires (instanceRegistryHostRuntime, BuildProbeImage, the rootfs probe's output) are decision rows;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 4 and #329 plan 3 Task 5: takes the egress asserter as a parameter, sets it on the production Server literal (Egress) and starts its 30 s Loop beside probeLoop and diskLoop; the literal also names the fixture check ProbeFixturesOK (renamed in plan 2 Task 14). It sets no control drop-in directory: plan 3's ControlDropInDir default (/run/systemd/system.control) was deleted with removeGenControlDropIn in ef38e13b (the P1 EROFS fix), so instance control names systemd's control directory only to read it (TrustedDropinReader). The same four sites (the two exec.CommandContext closures, statfsBytes, the data literal), offsets moved; no read added.;rev3=census-ruling-agent-start-demo-1;basis=Wires root-owned demo config and existing fixed paths into the service.;rev3=census-ruling-region-ha-p3b;basis=Resume root-owned hairpin state before probes/control service work; verify current systemd agent identity and kernel fence/addresses, restore pidfd watch or revoke stale state. Same direct exec/statfs/data sites; indirect inputs are protected root snapshot/state and kernel evidence, never receipt data.;rev3=census-ruling-agent-start-demo-3;basis=Construct the demo snapshot supervisor for configured demo boxes; startup cleanup gates builder readiness. Census read-site delta: unchanged (4).;rev3=census-ruling-gvisor-demos;basis=Retain sandbox modes and error; bind host-provided baseline and runtime callbacks without importing host templates. Existing reads unchanged. Task 6: Capture HostClaims once from ControlConfig/hostwrite.Enabled and set the fixed root-owned bundle discovery directory. Existing command and configuration reads unchanged. data-literal@2476,file:CommandContext@1109,file:CommandContext@1287,file:Statfs@2497 eebfc7f2053b6f18d4efa46a2f2b8f3296d9828bf39c45f92b047c1bbd693822
-internal/instancectl/server.go type Server legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=Re-digested at the pre-land merge: the body includes main's own change under census ruling 292, with no further change from this branch. Census ruling 292 reclassified this declaration accepted-legacy (J2,J4) for root's per-host ordering of legacy run starts against stops; this ruling kept the row as main classed it. Its own addition is the cmd start's poll and wait bounds and its per-host lock map: field declarations only;rev3=census-ruling-rootfs-apps-2;basis=new fields: HostRuntime, ProbeImage, ProbeImageFile, RootfsProbeOut, DenyEvery, the deny's lastDeny and denyMu, the rootfs probe's report and lock, the jit reload counters and imageDigests; genStarting counts binary generation starts per unit; rootfsLocksMu and rootfsLocks, one lock entry per rootfs unit name being started or removed right now, held by a start from its layout through systemctl start and its own cleanup and by a removal from its proof through the raw removal, a removal refusing while it is taken, a waiting start giving up when its request ends, an entry dropped with its last holder or waiter (fixes E6, L2, L3); rootfsProvenHook, a test hook run between the proof and the raw removal; field declarations only; no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 and #329 plan 3 Task 5: the declaration gains sliceLocks (one mutex per host slice, taken by /size and /parent) and Egress (the asserter every start path calls), and its comment names the egress allow (plan 3's ControlDropInDir field was deleted in ef38e13b, the P1 EROFS fix); the same one site, the Statfs field, offset moved; no read added.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 6: comments only: the one-shot pacing fields cover /cmd and /tty, and cmdLocks is now keyed by (role, host) (oneShotKey, PF-7) so a session's start never waits behind a command's; field declarations unchanged; the same one site, no read added;rev3=census-ruling-agent-start-demo-1;basis=Adds fixed demo configuration, registry views, derived runtime root, synchronization and purge guard.;rev3=census-ruling-region-ha-p3b;basis=Add hairpinActive boolean alongside lastDeny under existing deny synchronization. Field declaration only; existing Statfs selector unchanged, no new read or externally supplied authority.;rev3=census-ruling-region-ha-p3b2-rolls;basis=adds one field holding the current hairpin exit watcher, guarded by the root hairpin flock; no new read;rev3=census-ruling-agent-start-demo-3;basis=Retain the snapshot supervisor in instance-control state; no new request-selected path. Census read-site delta: unchanged (1).;rev3=census-ruling-gvisor-demos;basis=Retain Task 1 mode/error/readiness fields, baseline/runtime callbacks, Task 4 per-host validated staged descriptors and root-selected probe nonce. Fix round 1 adds a private writer-operation seam assigned only in package tests, after the unchanged GVisorID admission check; production defaults still call the same checked constructor, WriteRootfs, WriteBundle and verifier. No new direct read or request-controlled callback. Task 5: private injected removal seam for unprivileged tests; production default removes only root-derived bundle and skeleton after both-family proof inside existing start fence. No new request field or agent-selected unit. Task 6: Retain serialized probe nonce, runtime-set identity verifier/token, fixed claims flag, bundle discovery root, and private unprivileged identity seam. No request-controlled callback or path; existing declaration read-site classification unchanged. file:Statfs@4781 a6db141589c9448386a806a015899a8fb7b9514b0a8df5b2b33a44fa5a793087
+internal/instancectl/server.go type Server legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=Re-digested at the pre-land merge: the body includes main's own change under census ruling 292, with no further change from this branch. Census ruling 292 reclassified this declaration accepted-legacy (J2,J4) for root's per-host ordering of legacy run starts against stops; this ruling kept the row as main classed it. Its own addition is the cmd start's poll and wait bounds and its per-host lock map: field declarations only;rev3=census-ruling-rootfs-apps-2;basis=new fields: HostRuntime, ProbeImage, ProbeImageFile, RootfsProbeOut, DenyEvery, the deny's lastDeny and denyMu, the rootfs probe's report and lock, the jit reload counters and imageDigests; genStarting counts binary generation starts per unit; rootfsLocksMu and rootfsLocks, one lock entry per rootfs unit name being started or removed right now, held by a start from its layout through systemctl start and its own cleanup and by a removal from its proof through the raw removal, a removal refusing while it is taken, a waiting start giving up when its request ends, an entry dropped with its last holder or waiter (fixes E6, L2, L3); rootfsProvenHook, a test hook run between the proof and the raw removal; field declarations only; no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 and #329 plan 3 Task 5: the declaration gains sliceLocks (one mutex per host slice, taken by /size and /parent) and Egress (the asserter every start path calls), and its comment names the egress allow (plan 3's ControlDropInDir field was deleted in ef38e13b, the P1 EROFS fix); the same one site, the Statfs field, offset moved; no read added.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 6: comments only: the one-shot pacing fields cover /cmd and /tty, and cmdLocks is now keyed by (role, host) (oneShotKey, PF-7) so a session's start never waits behind a command's; field declarations unchanged; the same one site, no read added;rev3=census-ruling-agent-start-demo-1;basis=Adds fixed demo configuration, registry views, derived runtime root, synchronization and purge guard.;rev3=census-ruling-region-ha-p3b;basis=Add hairpinActive boolean alongside lastDeny under existing deny synchronization. Field declaration only; existing Statfs selector unchanged, no new read or externally supplied authority.;rev3=census-ruling-region-ha-p3b2-rolls;basis=adds one field holding the current hairpin exit watcher, guarded by the root hairpin flock; no new read;rev3=census-ruling-agent-start-demo-3;basis=Retain the snapshot supervisor in instance-control state; no new request-selected path. Census read-site delta: unchanged (1).;rev3=census-ruling-gvisor-demos;basis=Retain Task 1 mode/error/readiness fields, baseline/runtime callbacks, Task 4 per-host validated staged descriptors and root-selected probe nonce. Fix round 1 adds a private writer-operation seam assigned only in package tests, after the unchanged GVisorID admission check; production defaults still call the same checked constructor, WriteRootfs, WriteBundle and verifier. No new direct read or request-controlled callback. Task 5: private injected removal seam for unprivileged tests; production default removes only root-derived bundle and skeleton after both-family proof inside existing start fence. No new request field or agent-selected unit. Task 6: Retain serialized probe nonce, runtime-set identity verifier/token, fixed claims flag, bundle discovery root, and private unprivileged identity seam. No request-controlled callback or path; existing declaration read-site classification unchanged. Task 6 fix round 1: private gvisorProbeTestOps is set only in package tests; production defaults retain all fixed paths and the checked root output opener. No externally supplied callback or new direct read. file:Statfs@4829 1541a3b0e5f9972f07c1d94b85d1067fa83d1b24099ebf6b65d783716d4a7353
system.go runSystem authority B,C,D,F,G,J4 rev3=census-ruling-self-serve-moves-1;identity=explicit operator CLI uid 0;basis=adds the lifetimes family to the system dispatch (carlos system lifetimes cutover, a console door call as the operator); every existing command branch unchanged;rev3=census-ruling-claims-cleanup-r2;basis=claims cleanup R2: drops the claims case (host.RunSystemClaims, deleted); every other branch unchanged; no read added;rev3=census-ruling-nearest-region-a;basis=adds the hosts-used family to the system dispatch (carlos system hosts-used status, one GET of a console door as the operator); every existing command branch unchanged; no read added;rev3=census-ruling-region-ha-p1a;basis=explicit operator CLI and root units, uid 0: drops the "join" case (host.RunSystemJoin, deleted with internal/host/joinroot.go, its only caller) and its line in the usage text; every other branch unchanged; no read added;rev3=census-ruling-named-unit-delivery-114;basis=the system verb dispatch gains named-units, routed to host.RunSystemNamedUnits; no read of its own;rev3=census-ruling-design-pdf-service;basis=add dispatch for carlos system pdf; no new reads;rev3=census-ruling-managed-fleets-2a;basis=Adds managed-fleets operator CLI dispatch; no direct read added; existing root command branches unchanged.;rev3=census-ruling-agent-start-demo-2;basis=system.go:62-66 adds the demos family dispatch to the console-only operator client (system_demos.go:19, system_demos_api.go:23); no direct read added and other root commands are unchanged.;rev3=census-ruling-region-ha-p3b2;basis=Dispatches carlos system group-maintenance {status|permit|revoke|prepare|apply|rollback} to internal/host; no read of its own.;rev3=census-ruling-gvisor-demos;basis=Dispatch fixed runsc-ensure and exec-sandbox-allows-prev system applets; no direct reads. b2d431b47f8d15cd017b8fd7507865f099465973c9f1eef8e5cc0ee6e3d1f588
system.go systemVerb authority B,C,D,F,G,J4 rev3=census-ruling-self-serve-moves-1;identity=explicit operator CLI uid 0;basis=adds the lifetimes family to the system dispatch (carlos system lifetimes cutover, a console door call as the operator); every existing command branch unchanged;rev3=census-ruling-claims-cleanup-r2;basis=claims cleanup R2: drops "claims" from the verb list, so it now falls to the unknown-verb message; no read added;rev3=census-ruling-nearest-region-a;basis=adds "hosts-used" to the verb list, routed to runSystemHostsUsedVerb; no read added;rev3=census-ruling-region-ha-p1a;basis=explicit operator CLI and root units, uid 0: drops "join" from the verb list, so `carlos system join` now falls to the unknown-verb message; no read added;rev3=census-ruling-named-unit-delivery-114;basis=the known-verb list gains named-units; no read of its own;rev3=census-ruling-design-pdf-service;basis=add recognition for carlos system pdf; no new reads;rev3=census-ruling-managed-fleets-2a;basis=Recognizes managed-fleets as a CLI family; no read added.;rev3=census-ruling-agent-start-demo-2;basis=system.go:43-57 recognizes demos; parsing only, no direct read added.;rev3=census-ruling-region-ha-p3b2;basis=Recognizes group-maintenance as a system verb; parsing only.;rev3=census-ruling-gvisor-demos;basis=Recognize two root sandbox applets; no direct reads. 05f652ae4aa1ba135b6bb0358be5570fe13c74e385609124a66d9947ad1f906b
internal/activator/backend_exec.go ExecBackend.waitLegacyRunGone legacy accepted-legacy accepted-legacy;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. whole:Route@524 3f1799da4272a8c8fb1fafb704f0cbad074dc9a8e8becb6ae7e7667c37a0ee79
@@ -163,14 +162,14 @@ internal/host/units/carlos-instance-gvisor-probe.service external legacy accepte
internal/host/units/carlos-instance-gvisor@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Add the unarmed root gVisor run skeleton with empty ExecStart and all twelve measured host properties. Defines per-instance data/run writable paths and socket output, root runtime directory, mixed kill with SIGCONT, and the existing bounded stop. A root-prepared validated command drop-in is required before it can start; no command or pin placeholder is installed here. file:external@0 914a3c0486d83b6b87ce14c473aab9005ff7bc004cb984040a81ddc60087a5c1
internal/host/units/carlos-runsc.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Root oneshot reads fixed root-owned host.env through its applet and installs compiled runtime set only under /opt/carlos/runsc; no RemainAfterExit. file:external@0 215ca2aea9519d14d0e20b5f9b6588b43ff7c5ef7b485982274fbbbfe2cf02b5
internal/instancectl/demo_policy.go Server.demoCgroupReadback legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read memory.max/high/swap.max, pids.max, cpu.max/weight and io.weight in the derived parent and validated child cgroups. GVisor uses Physical memory/tasks and logical shares; pre-start only absent groups may defer verification, and post-start requires every file. Native checks remain the existing logical limits. file:ReadFile@1349,file:Stat@1194 89ab9fb2d29510f76d969ad980c1fcb09b455623c6b744b5b3c9687787ba6642
-internal/instancectl/gvisordrain.go Server.sandboxUnitEmpty legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Walk only the fixed kernel carlos.slice hierarchy to find the named discovered service and require populated 0. No registry-provided filesystem path or runsc-state traversal. file:WalkDir@116 144d303d9beacc49c86080175ac9564c1463d28edb7b07bd9bb0c5764abc6ab1
-internal/instancectl/gvisordrain.go Server.sandboxUnits legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Combine systemd loaded units/jobs with directory names under the fixed cgroup carlos.slice root. Reads kernel cgroup directories; no request-selected path or process submission. file:WalkDir@794 29e5ffd74f02b26441bcc82d65c72eca23f94bbdf8cec89394f6ac852426888f
+internal/instancectl/gvisordrain.go Server.sandboxUnitEmpty legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read the fixed carlos.slice cgroup hierarchy for the named discovered unit and require populated 0; skip other service subtrees. Task 6 fix round 1 confines the opposite-family caller to Ready/ReadyDemo. No request-selected filesystem path or new read site. file:WalkDir@116 e802bfb809b344b2ae4e1b3d7ae9f4896b8e3396dac720de56fa218b203e8994
+internal/instancectl/gvisordrain.go Server.sandboxUnitsFor legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 6 fix round 1: enumerate systemd units/jobs and the fixed carlos.slice kernel hierarchy, filtering by the requested fixed family. Ready in systemd mode lists only gVisor instance/probe/build patterns and ignores native jobs/services; original gVisor host overlap checks request both families. Never invoked by native per-start admission. Only kernel-owned cgroup directory reads; no tenant-selected path or runsc-state traversal. file:WalkDir@1194 6ce5d5d373840b13e1bf20a1791cbd1390540448fd238e71b2b8abb4acf05216
internal/instancectl/gvisordrain.go Server.sweepGVisorBundles legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=List the fixed root-owned OCI directory, accept only validated run IDs, skip live/in-flight work and acquire the original instance-ID fence before both-family stop/delete proof and removal. Never opens /run/carlos-runsc. file:ReadDir@130 0572d9325bd87b5326c195ad30874350114ad25f72d99648731ffe45ea2924a7
internal/instancectl/gvisordrain.go sandboxGroupEmpty legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read the caller-derived kernel cgroup.events path and require a single populated 0 field; malformed/present nonzero state refuses proof. file:ReadFile@57 4776168285ee07b83941a24023d959616dbe5af6f76491c094f1f12024384ea7
internal/instancectl/gvisorprobe.go Server.gvisorProbeKernelLimits legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read only the fixed probe unit cgroup limit files, requiring the pinned physical memory/tasks and logical CPU/IO contract. file:ReadFile@357 919a374b3b1b5181da14d122f29c4ab9042634009da696afb899fc7bbe80cdc5
-internal/instancectl/gvisorprobe.go Server.runGVisorProbe legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Under probe serialization prove previous invocation idle/deleted, derive a fresh random nonce and fixed challenge paths, create root-only O_EXCL outside-mount fixture and abstract listener, remove old fixed output, prepare/assert the typed probe bundle/unit, and submit only after context recheck. Read a bounded nonce-bound root-owned output and guest socket handshake, inspect runtime PIDs/limits while guest waits, then stop/prove/delete before accepting readiness or removing files. No launch JSON, tenant database/source, or runtime-state read. file:Lstat@2369,file:OpenFile@1797,file:Read@1434,file:ReadAll@4903 9ab0d2ea08c766c2cf2c39562e134419b218ae714e7931560cc96da5107e67e2
+internal/instancectl/gvisorprobe.go Server.runGVisorProbe legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 6 fix round 1, applying the controller rulings: serialized probe construction uses root random nonce/fixed paths, root-only O_EXCL fixture, abstract listener, typed verified bundle/unit and context recheck. Read bounded root-owned nonce-bound output and the guest socket handshake; inspect kernel/proc runtime and limits while guest waits. Termination uses inactive/not-loaded state, no job/PIDs and empty cgroup, never per-command stop-post records. Keep the prior pass during the run and publish report plus runtime identity once, after cleanup; any failed attempt invalidates it and records the bounded diagnostic. A private package-test-only operations struct substitutes paths, executable preparation and output opening; production keeps GVisorProbePaths, fixed output/procfs, ensureExe and execsandbox.OpenRootFile. No new tenant-controlled path, launch/source/database read, or runtime-state read. file:Lstat@2452,file:OpenFile@1887,file:Read@1577,file:ReadAll@4796 893229809de0f7213f0d2931094c653d85f3dc4787c237e647a8357c1c70363a
internal/instancectl/gvisorprobe_linux.go gvisorProbeProcesses legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read kernel cgroup.procs under the fixed probe subtree and /proc/<numeric PID> exe, cgroup, cmdline, task directory and children. Require pinned-set executable paths, in-subtree membership, live gofer/Sentry and no descendant outside the unit. PIDs come from kernel/systemd evidence, never a request. file:ReadDir@1895,file:ReadFile@1085,file:ReadFile@1381,file:ReadFile@2022,file:ReadFile@468,file:Readlink@925,file:WalkDir@279 f83c97c76a1584b3ae4ac34d4098902c7b805a970ce6dc5c8378e787c694ab0a
-internal/instancectl/gvisorunit.go Server.finishPreviousGVisorRun legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Lstat only the validated run unit retained controller drop-in. Before replacing it require inactive/empty proof and successful owning-unit runtime delete status. Does not inspect runtime state. file:Lstat@161 2fcbb0fe5caeba134519668b419e317ea5ee106c3994e10c02bca50c00b7de0b
+internal/instancectl/gvisorunit.go Server.finishPreviousGVisorRun legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 6 fix round 1: Lstat only the root-derived retained run drop-in; when present, stop and require terminal unit/no job/no PIDs/empty cgroup through the existing proof. No ExecStopPost status dependency. Per the explicit ruling, stale runtime metadata is inert and the next ignored ExecStartPre runsc delete -force removes it. file:Lstat@161 28836624c17a0ef444382aae2c660b500697cac35d67a6b84921823e3569ab92
internal/instancectl/ocibundle.go Server.gvisorExecutable legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Resolve prepared root-owned app link through existing native live or validated staged target; production passes fixed checked root file/directory helpers. file:EvalSymlinks@217 c64f3dc10842930f1c594db2ece7f41ac8bdde0d5907e510a179aee5dc7f1a21
internal/instancectl/ocibundle.go Server.gvisorExecutableWith legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read only prepared root-owned app/live links and live directory listing after ancestor checks; reject staged target without retained successful validation, revalidate staged digest after checked resolved regular executable metadata, require exact live host -> ../app. No launch/source/database file is opened. file:ReadDir@1611,file:Readlink@1822,file:Readlink@711 f6a646dfcd1483b9d2aefad5ed4fd0bc015deb5d07eb928c303227f2190aff5f
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. Task 6: Pass the already root-resolved numeric carlos uid/gid alongside the serialized probe nonce in the OCI environment. No added mount, launch parsing, or filesystem read. data-literal@1187 064e8089b8b53b09eed7ebb8d2c050084a7beb091043a8c5667f3266f3cb0977
@@ -179,7 +178,6 @@ internal/instancectl/ocibundle.go readCarlosUser legacy accepted-legacy accepted
internal/instancectl/sandbox.go Server.requestFamily legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read the registry route through the existing root-provided HostDemo callback for gVisor public starts and reject held or unsupported routes before preparation. Native registry/egress behavior remains unchanged; fixed policy receives no readiness state. registry:Status@429,whole:Route@318,whole:Route@397,whole:Route@542 dfb40d756f97cc8aa68626b550ad341a9ddd796493de158d3f99ee20c9614fed
internal/instancectl/sandbox.go Server.unitFamily legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Classify only retained mode, claims/demo flags, role and route runtime/demo shape; gVisor public starts require a route and only private probe/build may omit it. No I/O or readiness-driven fallback. registry:Runtime@630,whole:Route@614,whole:Route@794,whole:Route@852 bed900b96d6b79417c25954e25144ec00c6388a0951ffd405b9788f103851d06
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/instancectl/sandboxstop.go Server.stopRunFamiliesID legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Derive both original unit names from a validated instance ID; retain the original-run fence through stop/inactive/job/kernel proof, retained owning-unit delete status, bundle/skeleton removal and drop-in removal/reload. Lstat only the derived root-owned drop-in, never runtime-state files. file:Lstat@589 fe81c4c488fe38b794f27891827b3634350aa6a8f326d44e2cf00a5646bd0fde
internal/instanceexec/probe_gvisor.go checkGVisorFacts legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Evaluate guest probe facts only. Census labels the boolean Openat2 field as a file read, but this pure evaluator performs no I/O or root action. file:Openat2@845 0fbb701794c0c747fb23628a1e3ed9f791d3024e2001df8040809b8f7544bae1
internal/instanceexec/probe_gvisor.go type gvisorProbeFacts legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Guest evidence fields only; Openat2 is a boolean fact, not a syscall or filesystem read. file:Openat2@325 5b30f52a1aca92bfa18331e3a88ac84fbaa4b15765197f822446c1aff7884046
internal/instanceexec/probe_gvisor_linux.go runGVisorProbeChecks legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Unprivileged guest reads fixed /proc/self/status and /proc/version; checks root-supplied numeric identity, capabilities/NNP, pinned measured kernel signature, io_uring ENOSYS, loopback/public TCP refusal, absent nonce-derived host fixture and unreachable root abstract socket. Checks existing safe-open behavior at its own fixed data directory and serves a nonce socket in its own host-visible run mount until root acknowledges process/limit proof. No host root authority or tenant-selected path. data-literal@2263,file:Lstat@2161,file:Openat2@2230,file:ReadFile@1287,file:ReadFile@607 413c4f54d74b42a5242cf9b73781898d8f71213500a42f18d876975036fe10c1
@@ -227,5 +225,5 @@ internal/host/systemapply.go systemApplier.stageCandidate legacy accepted-legacy
@coverage internal/execsandbox c7bd59e07acf65b54d2c020a9b380b64a7319569ff8cf183a33a3dbcc2360b8d
@coverage internal/host 31bd5f36055951dd77509481de7ba03c5d130d99e5eded05a53ec93f3ace0682
@coverage internal/host/units 93402572d2fc9c32b563820a36d565afa2ed951637bde9561fe2e845137a6524
-@coverage internal/instancectl 589fd344fd4bab65cb485a8a0dc550b279ac141d9048d9f133a172d709c03cd7
+@coverage internal/instancectl 16edee001e5a53faad8da40a94a86496cb5d0c9aeca55f7e6aea00188d53d674
@coverage internal/instanceexec f45ee9b5ec7862c3a07fd9270b38df322c91e73f13e297813698dee30b8efd2c