gvisor: the pre-start probe log names this attempt's failure
Fixes for Astra's findings on 9bce34d3: - P2: the "not started" line logged report.Lines[0], which is a prepended start-up mount line in production. It now logs this attempt's own fail line, taken before the mount lines are prepended. - P3: the flow test bounds the journal --since timestamp within the probe call instead of within a minute. The flow test now runs with a passing mount line prepended and checks that the logged check names the failure. Reverting the fix fails the test. Census re-proposed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 files changed,
+34
−11
docs/superpowers/notes/census-proposal-gvisor-probe-diag.md+2 −2internal/instancectl/gvisorprobe.go+10 −2internal/instancectl/gvisorprobe_flow_linux_test.go+18 −3internal/provision/testdata/plan14-root-reads-chain.tsv+1 −1internal/provision/testdata/plan14-root-reads-gvisor-probe-diag.tsv+3 −3
CI passed — run details
diff --git a/docs/superpowers/notes/census-proposal-gvisor-probe-diag.md b/docs/superpowers/notes/census-proposal-gvisor-probe-diag.md| index 1d96383e1..834ec3c4d 100644 |
| --- a/docs/superpowers/notes/census-proposal-gvisor-probe-diag.md |
| +++ b/docs/superpowers/notes/census-proposal-gvisor-probe-diag.md |
| @@ -4,7 +4,7 @@ Ruling `census-ruling-gvisor-probe-diag`. The independent reviewer approves or r |
| | unit | change | read sites | what changed | |
| |---|---|---|---| |
| -| `internal/instancectl/gvisorprobe.go` `Server.runGVisorProbe` | body | unchanged (4) | Diagnostic only: the failure dump runs journalctl for the fixed probe unit only once a start was asked for, with --since=@<this attempt's start time>, so it no longer replays earlier attempts; a failure before the start logs its verdict line instead. No new path, input or systemctl verb; probe steps unchanged. | |
| +| `internal/instancectl/gvisorprobe.go` `Server.runGVisorProbe` | body | unchanged (4) | Diagnostic only: the failure dump runs journalctl for the fixed probe unit only once a start was asked for, with --since=@<this attempt's start time>, so it no longer replays earlier attempts; a failure before the start logs this attempt's own fail line (taken before the start-up mount lines are prepended) instead. No new path, input or systemctl verb; probe steps unchanged. | |
| Envelopes re-pinned: `internal/instancectl`. |
| @@ -14,6 +14,6 @@ Recorded dispositions, which each change must still satisfy: |
| - `internal/instancectl/gvisorprobe.go` `Server.runGVisorProbe`: legacy, task accepted-legacy. Basis: 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. CI fix: route serialized nonce fixture/output cleanup through existing pinned removeGenFiles owner with closed gVisor selectors and fixed probe paths. Existing reads and stop proof unchanged; no new raw removal owner. |
| -Seal: `9668105384b1abd5009d76a73e37eef7f5c358eb5b08a3d1fe35f7c411e4d200` → `783b69536e061e6b11127b343b603cbfc3cde0868cf3f1ba91d60e26adadac84`. |
| +Seal: `9668105384b1abd5009d76a73e37eef7f5c358eb5b08a3d1fe35f7c411e4d200` → `fa99ea0187b69b5dd226919bb8d30c796d90b816574adc81af7ff17cc59aa079`. |
| Overlay: `internal/provision/testdata/plan14-root-reads-gvisor-probe-diag.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/instancectl/gvisorprobe.go b/internal/instancectl/gvisorprobe.go| index ad188d0b6..e82f328f4 100644 |
| --- a/internal/instancectl/gvisorprobe.go |
| +++ b/internal/instancectl/gvisorprobe.go |
| @@ -166,6 +166,9 @@ func (s *Server) runGVisorProbe(ctx context.Context) (report ProbeReport) { |
| return ProbeReport{Lines: []VerdictLine{{Check: check, Verdict: "fail", Detail: err.Error()}}} |
| } |
| defer func() { |
| + // This attempt's own verdict, before the start-up mount lines are |
| + // prepended: the pre-start log line below names what failed here. |
| + own := report |
| report = s.withStartLines(report) |
| s.mu.Lock() |
| if report.Ready { |
| @@ -183,8 +186,13 @@ func (s *Server) runGVisorProbe(ctx context.Context) (report ProbeReport) { |
| out = out[len(out)-4096:] |
| } |
| s.logf("instance-control: gvisor probe: %s (%v)", strings.TrimSpace(out), err) |
| - } else if !report.Ready && len(report.Lines) > 0 { |
| - s.logf("instance-control: gvisor probe: not started: %s %s", report.Lines[0].Check, report.Lines[0].Detail) |
| + } else if !report.Ready { |
| + for _, line := range own.Lines { |
| + if line.Verdict == "fail" { |
| + s.logf("instance-control: gvisor probe: not started: %s %s", line.Check, line.Detail) |
| + break |
| + } |
| + } |
| } |
| }() |
| if _, err := s.unitFamily(s.effectiveSandbox(), roleProbe, nil); err != nil { |
diff --git a/internal/instancectl/gvisorprobe_flow_linux_test.go b/internal/instancectl/gvisorprobe_flow_linux_test.go| index bb20025dd..45a4bb811 100644 |
| --- a/internal/instancectl/gvisorprobe_flow_linux_test.go |
| +++ b/internal/instancectl/gvisorprobe_flow_linux_test.go |
| @@ -37,6 +37,7 @@ type probeFlow struct { |
| nonces, events, logs []string |
| active bool |
| runs, reloads, journals int |
| + callStart time.Time |
| listener *net.UnixListener |
| conn *net.UnixConn |
| peer sync.WaitGroup |
| @@ -174,8 +175,9 @@ func newProbeFlow(t *testing.T) *probeFlow { |
| // probe's start, so a failure never replays older probes' journal. |
| if len(args) != 6 || strings.Join(args[:4], " ") != "journalctl --no-pager --output=cat --lines=20" || args[5] != "--unit="+gvisorProbeUnit || !strings.HasPrefix(args[4], "--since=@") { |
| t.Error(args) |
| - } else if since, err := strconv.ParseInt(strings.TrimPrefix(args[4], "--since=@"), 10, 64); err != nil || time.Since(time.Unix(since, 0)) > time.Minute { |
| - t.Error("journal window not bounded to this attempt", args[4]) |
| + } else if since, err := strconv.ParseInt(strings.TrimPrefix(args[4], "--since=@"), 10, 64); err != nil || since > time.Now().Unix() || (!f.callStart.IsZero() && since < f.callStart.Unix()) { |
| + // Within this probe call, allowing whole-second truncation. |
| + t.Error("journal window not bounded to this attempt", args[4], f.callStart) |
| } |
| deadline, ok := ctx.Deadline() |
| if !ok || time.Until(deadline) > 5*time.Second { |
| @@ -497,6 +499,10 @@ func TestGVisorFix1ProbeFailures(t *testing.T) { |
| ctx, cancel = context.WithTimeout(ctx, time.Second) |
| defer cancel() |
| } |
| + // A passing start-up mount line is prepended to every report in |
| + // production; the pre-start log must still name this failure. |
| + f.s.startLines = []VerdictLine{{Check: "mountpoint-data-instances", Verdict: "pass"}} |
| + f.callStart = time.Now() |
| rep := f.s.runGVisorProbe(ctx) |
| if rep.Ready { |
| t.Fatal("failed proof accepted") |
| @@ -506,7 +512,13 @@ func TestGVisorFix1ProbeFailures(t *testing.T) { |
| if strings.HasPrefix(fault, "guest/") { |
| expected = "probe-checks" |
| } |
| - if len(rep.Lines) != 1 || rep.Lines[0].Check != expected { |
| + var fails []VerdictLine |
| + for _, line := range rep.Lines { |
| + if line.Verdict == "fail" { |
| + fails = append(fails, line) |
| + } |
| + } |
| + if len(rep.Lines) != 2 || len(fails) != 1 || fails[0].Check != expected { |
| t.Fatalf("wrong failure: %+v, want %s", rep, expected) |
| } |
| w := httptest.NewRecorder() |
| @@ -525,6 +537,9 @@ func TestGVisorFix1ProbeFailures(t *testing.T) { |
| if f.journals != wantJournal || len(f.logs) != 1 || len(f.logs[0]) > 4200 || strings.Contains(f.logs[0], "journal-tail") != (wantJournal == 1) { |
| t.Fatal("diagnostic not bounded", fault, f.journals, f.runs, len(f.logs), f.logs) |
| } |
| + if wantJournal == 0 && !strings.Contains(f.logs[0], "not started: "+expected+" ") { |
| + t.Fatalf("pre-start log does not name the failure %s: %s", expected, f.logs[0]) |
| + } |
| f.s.mu.Lock() |
| token := f.s.gvisorProbeIdentity |
| f.s.mu.Unlock() |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 6913813e3..3e509e6e5 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -150,4 +150,4 @@ plan14-root-reads-no-negative-prime-724.tsv ab10145ee873e26b87a653f728cd0c973759 |
| plan14-root-reads-gvisor-probe-retry.tsv 499c08fd29787c5de2aa0197c05f82f6db0ab7760eb7d980bb24211e289e4c24 |
| plan14-root-reads-billing-dash-2-pages.tsv 499c08fd29787c5de2aa0197c05f82f6db0ab7760eb7d980bb24211e289e4c24 |
| plan14-root-reads-group-roll-verb.tsv 9668105384b1abd5009d76a73e37eef7f5c358eb5b08a3d1fe35f7c411e4d200 |
| -plan14-root-reads-gvisor-probe-diag.tsv 783b69536e061e6b11127b343b603cbfc3cde0868cf3f1ba91d60e26adadac84 |
| +plan14-root-reads-gvisor-probe-diag.tsv fa99ea0187b69b5dd226919bb8d30c796d90b816574adc81af7ff17cc59aa079 |
diff --git a/internal/provision/testdata/plan14-root-reads-gvisor-probe-diag.tsv b/internal/provision/testdata/plan14-root-reads-gvisor-probe-diag.tsv| index 085700ded..e3dc3f665 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-gvisor-probe-diag.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-gvisor-probe-diag.tsv |
| @@ -1,5 +1,5 @@ |
| # Census overlay gvisor-probe-diag, written by census-propose (#369). census-ruling-gvisor-probe-diag, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-gvisor-probe-diag.md. |
| # 1 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| -@legacy 5256984ec6774b37c1f795c054f95c4e3ec5854e380db9ff6a6614861728a505 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. CI fix: route serialized nonce fixture/output cleanup through existing pinned removeGenFiles owner with closed gVisor selectors and fixed probe paths. Existing reads and stop proof unchanged; no new raw removal owner.;rev3=census-ruling-gvisor-probe-diag;basis=Diagnostic only: the failure dump runs journalctl for the fixed probe unit only once a start was asked for, with --since=@<this attempt's start time>, so it no longer replays earlier attempts; a failure before the start logs its verdict line instead. No new path, input or systemctl verb; probe steps unchanged. file:Lstat@3082,file:OpenFile@2445,file:Read@2135,file:ReadAll@5444 f70a3fe9d3945a8b22cf32f8fafd447b5ba3d3c0c031ae3d11b4e5379f39768e |
| -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. CI fix: route serialized nonce fixture/output cleanup through existing pinned removeGenFiles owner with closed gVisor selectors and fixed probe paths. Existing reads and stop proof unchanged; no new raw removal owner.;rev3=census-ruling-gvisor-probe-diag;basis=Diagnostic only: the failure dump runs journalctl for the fixed probe unit only once a start was asked for, with --since=@<this attempt's start time>, so it no longer replays earlier attempts; a failure before the start logs its verdict line instead. No new path, input or systemctl verb; probe steps unchanged. file:Lstat@3082,file:OpenFile@2445,file:Read@2135,file:ReadAll@5444 f70a3fe9d3945a8b22cf32f8fafd447b5ba3d3c0c031ae3d11b4e5379f39768e |
| -@coverage internal/instancectl 71b1fe77cc6fc67d7394b4dc6168f926ff9917997b1018c98df780917d1c2c30 |
| +@legacy 0ad25a5c9ad7ea808f1d703690ea7b7b637e1c095f02ce4e6871cea98ba048e7 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. CI fix: route serialized nonce fixture/output cleanup through existing pinned removeGenFiles owner with closed gVisor selectors and fixed probe paths. Existing reads and stop proof unchanged; no new raw removal owner.;rev3=census-ruling-gvisor-probe-diag;basis=Diagnostic only: the failure dump runs journalctl for the fixed probe unit only once a start was asked for, with --since=@<this attempt's start time>, so it no longer replays earlier attempts; a failure before the start logs this attempt's own fail line (taken before the start-up mount lines are prepended) instead. No new path, input or systemctl verb; probe steps unchanged. file:Lstat@3281,file:OpenFile@2644,file:Read@2334,file:ReadAll@5643 84760d1565d9c6877179b8c74e25ce7e4700f5be4abeb14acb031eeb6d819d97 |
| +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. CI fix: route serialized nonce fixture/output cleanup through existing pinned removeGenFiles owner with closed gVisor selectors and fixed probe paths. Existing reads and stop proof unchanged; no new raw removal owner.;rev3=census-ruling-gvisor-probe-diag;basis=Diagnostic only: the failure dump runs journalctl for the fixed probe unit only once a start was asked for, with --since=@<this attempt's start time>, so it no longer replays earlier attempts; a failure before the start logs this attempt's own fail line (taken before the start-up mount lines are prepended) instead. No new path, input or systemctl verb; probe steps unchanged. file:Lstat@3281,file:OpenFile@2644,file:Read@2334,file:ReadAll@5643 84760d1565d9c6877179b8c74e25ce7e4700f5be4abeb14acb031eeb6d819d97 |
| +@coverage internal/instancectl 9c1897dd1cf984c7554759f4e0e6f14d880b162a582d05b88f99c8d3a6aa64e2 |