pause: namespace membership, one pidfd lock, deadline; copy re-checks
Astra task 9 round 1 (5 Important).
F2: members are found by pid namespace (the sandbox's, or below it by
NS_GET_PARENT, namespaces pinned open), not by PPid. Each pass checks
every retained member stopped before listing /proc afresh; zombies run
nothing; unexplained /proc failures refuse (busy). F3: every pidfd use
(poll, retry SIGSTOP) is under the lock resume holds, resumed checked
again right before signalling, the map emptied on resume. F5: Hold
checks the monotonic deadline after the work and returns ErrBusy when
it passed, however the watchdog ran.
F1/F4 per the controller's ruling (no seccomp in slice 1; threat model
at pause.Hold): inside the pause, after the copy, copyWorkSite stats
again preview.json, every walked directory and copied file (dev, ino,
mode, size, mtime, ctime), lists every directory again, checks the
deadline, and refuses busy on any change.
Tests: go test ./internal/runner/pause/ -count=10 (ok 32.7 s);
go test -tags testbuild ./internal/runner/thin/ -run
'TestWorkSite|TestSnapshotWork|TestSnapshotRefuses|TestRecordedStart'
-count=2 (ok). Darwin build and vet ok; staticcheck clean.
RED (new tests against the round-0 code, as mutations): ancestry-only
membership lets an nsenter joiner run while paused ("joiner 120->880");
listing before checking settles with a late member running ("late
18->740"); no re-stat accepts a copy the self-resuming writer changed.
New adversary tests: a SIGCONT-timer writer is refused busy in 5/5
copies; SIGCONT peers and io_uring async writes leave copies unchanged
on 6.12 (each copy is busy or unchanged).
Mutations (each restored): no nested walk, ancestry-only, listing
before checking, expired ignored, zombies unsettle, and round 0's
skip-one, no settle check, S stopped, no watchdog, no deferred resume,
no namespace or start check, busy ignored: all fail a test. F3 guards
(recheck, map emptied) layered: both removed fails
RetryAfterTheWatchdogDoesNotStop. Copy: no re-stat, no times, no
ctime, no final deadline, no re-listing: each fails a test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 files changed,
+1,108
−158
internal/runner/pause/pause_linux.go+386 −137internal/runner/pause/pause_linux_test.go+283 −18internal/runner/thin/worksnap_adversary_linux_test.go+374 −0internal/runner/thin/worksnap_linux.go+65 −3
CI cancelled — superseded by a newer push — run details
CI log
=== prepare ===
ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws
ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
ci-box: user namespaces allowed: 233151
ci-box: cgroup: cgroup2fs
ci-box: disk /home/ci/work/repos/oficina__equipo/wt/specialists-slice-1: Type Size Avail | ext4 96G 84G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type Size Avail | ext4 96G 84G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 1.4s
ci-box: codex: fetched and verified in 3.5s
ci-box: codex-code-mode-host: fetched and verified in 1.3s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.3s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.8s
ci-box: pi: installed and verified in 7.3s
ci-box: opencode: installed and verified in 2.3s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 8.7s
ci-box: clone deepened in 4.7s
ci-box: file times set from content: 3353 files, 219 directories
ci-box: ready in 18.2s
=== copy ===
EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
ok amadan.net/oficina/equipo/internal/equipotest 0.147s
=== compile ===
go build ./...
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py compile
+ go build -tags testbuild ./...
5.5s
+ go list -export -test -tags testbuild -f ./...
5.3s
+ go list -export -test -tags browser,testbuild -f ./internal/equipo ./internal/equipotest ./internal/headless ./internal/idtest ./internal/plan3test ./internal/thintest
3.6s
rastrillo: budget size: 2 problem(s)
exit status 1
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -version
staticcheck 2026.1 (v0.7.0)
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 -version
Go: go1.26.11
Scanner: govulncheck@v1.8.0
DB: https://vuln.go.dev
DB updated: 2026-11-24 15:56:00 +0000 UTC
go run github.com/zricethezav/gitleaks/v8@v8.30.1 version
version is set by build process
=== check ===
--- shard 0 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-work: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadless$/^4c_rebase$|^TestHeadless$/^4b_ask$|^TestHeadless$/^4c_checks_card$|^TestHeadless$/^4_step_crash$' ./internal/headless
receipt: test step 1m19.28s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m17.173s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m17.17s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 61.63, cpu waiting 39.82%, memory waiting 0.00%, io waiting 0.45%
--- shard 1 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-review: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadless$/^4_review$|^TestHeadless$/^2b_access$|^TestHeadless$/^runner_crash$|^TestHeadless$/^2b_first_message$|^TestHeadless$/^4_checks_honest$|^TestHeadless$/^7_stream_resume$|^TestHeadless$/^2b_notebook$|^TestHeadless$/^2b_move_in$|^TestHeadless$/^2b_desk_failure$|^TestHeadless$/^cancel$' ./internal/headless
receipt: test step 1m20.544s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m17.811s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m17.81s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 61.63, cpu waiting 39.70%, memory waiting 0.00%, io waiting 0.43%
--- shard 2 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-connections: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadlessConnections$|^TestHeadlessTokenPasteEndToEnd$|^TestHeadlessTokenConnection$' ./internal/headless
receipt: test step 1m20.609s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m17.98s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m8.28s amadan.net/oficina/equipo/internal/headless TestHeadlessConnections
receipt: slow test 5.24s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenPasteEndToEnd
receipt: slow test 4.46s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenConnection
machine: 32 CPUs, load 61.63, cpu waiting 39.70%, memory waiting 0.00%, io waiting 0.43%
--- shard 3 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-mac: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestMacWorker$|^TestHeadlessAttachments$|^TestHeadlessPrewarm$|^TestHeadless$/^1_first_token$|^TestHeadless$/^6_quick_messages$|^TestHeadless$/^8_instance_restart$|^TestHeadless$/^3_runner_offline$' ./internal/headless
receipt: test step 1m18.525s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m15.934s amadan.net/oficina/equipo/internal/headless
receipt: slow test 38.21s amadan.net/oficina/equipo/internal/headless TestMacWorker
receipt: slow test 19.68s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 9.04s amadan.net/oficina/equipo/internal/headless TestHeadlessPrewarm
receipt: slow test 9s amadan.net/oficina/equipo/internal/headless TestHeadlessAttachments
machine: 32 CPUs, load 62.38, cpu waiting 39.82%, memory waiting 0.00%, io waiting 0.45%
--- shard 4 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-guards: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadlessCopyRotation$|^TestHeadlessPolicyGuards$|^TestHeadlessRunnerKillLeavesNoCopies$|^TestHeadlessNewHouseRuleStartsFresh$|^TestHeadless$/^3_engineering$|^TestHeadless$/^3_step_cancel$|^TestHeadless$/^3_step_contained$|^TestHeadless$/^3_step_refused$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless
receipt: test step 1m35.556s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m33.615s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m3.12s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 9.72s amadan.net/oficina/equipo/internal/headless TestHeadlessRunnerKillLeavesNoCopies
receipt: slow test 8.4s amadan.net/oficina/equipo/internal/headless TestHeadlessCopyRotation
receipt: slow test 7.38s amadan.net/oficina/equipo/internal/headless TestHeadlessPolicyGuards
receipt: slow test 4.99s amadan.net/oficina/equipo/internal/headless TestHeadlessNewHouseRuleStartsFresh
machine: 32 CPUs, load 58.73, cpu waiting 37.51%, memory waiting 0.00%, io waiting 0.33%
--- shard 5 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-rest: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^TestHeadless$/^4c_rebase$|^TestHeadless$/^4b_ask$|^TestHeadless$/^4c_checks_card$|^TestHeadless$/^4_step_crash$|^TestHeadless$/^4_review$|^TestHeadless$/^2b_access$|^TestHeadless$/^runner_crash$|^TestHeadless$/^2b_first_message$|^TestHeadless$/^4_checks_honest$|^TestHeadless$/^7_stream_resume$|^TestHeadless$/^2b_notebook$|^TestHeadless$/^2b_move_in$|^TestHeadless$/^2b_desk_failure$|^TestHeadless$/^cancel$|^TestHeadlessConnections$|^TestHeadlessTokenPasteEndToEnd$|^TestHeadlessTokenConnection$|^TestMacWorker$|^TestHeadlessAttachments$|^TestHeadlessPrewarm$|^TestHeadless$/^1_first_token$|^TestHeadless$/^6_quick_messages$|^TestHeadless$/^8_instance_restart$|^TestHeadless$/^3_runner_offline$|^TestHeadlessCopyRotation$|^TestHeadlessPolicyGuards$|^TestHeadlessRunnerKillLeavesNoCopies$|^TestHeadlessNewHouseRuleStartsFresh$|^TestHeadless$/^3_engineering$|^TestHeadless$/^3_step_cancel$|^TestHeadless$/^3_step_contained$|^TestHeadless$/^3_step_refused$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless
receipt: test step 2m59.11s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2m56.352s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m40.62s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistant
receipt: slow test 20.06s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 9.17s amadan.net/oficina/equipo/internal/headless TestHeadlessResearchHandoff
receipt: slow test 7.21s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistantAttachments
receipt: slow test 6.77s amadan.net/oficina/equipo/internal/headless TestHeadlessTurnBatching
machine: 32 CPUs, load 22.93, cpu waiting 10.72%, memory waiting 0.00%, io waiting 0.08%
--- shard 6 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane thintest: ./internal/thintest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test([^C]|C[^o]|Co[^n]|Con[^t])|^TestContract(Assistant|Outcome|Team|Handoff|HostAllowlist|HostIsPerPerson|Look|Use[A-Z]|RemoteCall|LanesRunAtOnce|NoMergeQuestionWhenGateMerges|PreviewHeldUntilPublishAnswer|PreviewNotHeldBelow19|PublishNeedsOwnerAnswer)' ./internal/thintest
receipt: test step 2m14.609s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2m12.603s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 9.84s amadan.net/oficina/equipo/internal/thintest TestContractTeamJobSettledStates
receipt: slow test 6.77s amadan.net/oficina/equipo/internal/thintest TestExplorePreviewsOff
receipt: slow test 3.99s amadan.net/oficina/equipo/internal/thintest TestContractTeamNudgePersonNeeds
receipt: slow test 3.95s amadan.net/oficina/equipo/internal/thintest TestContractPreviewHeldUntilPublishAnswer
receipt: slow test 2.65s amadan.net/oficina/equipo/internal/thintest TestContractTeamUpdatePersonNeeds
machine: 32 CPUs, load 38.62, cpu waiting 20.90%, memory waiting 0.00%, io waiting 0.17%
--- shard 7 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane thintest-contract: ./internal/thintest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^Test([^C]|C[^o]|Co[^n]|Con[^t])|^TestContract(Assistant|Outcome|Team|Handoff|HostAllowlist|HostIsPerPerson|Look|Use[A-Z]|RemoteCall|LanesRunAtOnce|NoMergeQuestionWhenGateMerges|PreviewHeldUntilPublishAnswer|PreviewNotHeldBelow19|PublishNeedsOwnerAnswer)' ./internal/thintest
receipt: test step 1m58.588s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m55.814s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 9.49s amadan.net/oficina/equipo/internal/thintest TestContractRetryPreviewUnverifiedMerge
receipt: slow test 9.05s amadan.net/oficina/equipo/internal/thintest TestContractPreviewNotScheduled
receipt: slow test 4.94s amadan.net/oficina/equipo/internal/thintest TestContractPublishNotOffered
receipt: slow test 4.57s amadan.net/oficina/equipo/internal/thintest TestContractMacRecheckMergeAuthority
receipt: slow test 2.96s amadan.net/oficina/equipo/internal/thintest TestContractPausedJob
machine: 32 CPUs, load 46.49, cpu waiting 27.09%, memory waiting 0.00%, io waiting 0.22%
--- shard 8 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-thin: ./internal/runner/thin
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./internal/runner/thin
amadan: job cancelled — a newer push superseded it
--- shard 9 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-bug: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestDirectBugWorkflow$|^TestEnrolKeepsTheRole$' ./internal/runner
receipt: test step 51.921s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 50.849s amadan.net/oficina/equipo/internal/runner
receipt: slow test 30.81s amadan.net/oficina/equipo/internal/runner TestDirectBugWorkflow
receipt: slow test 20.03s amadan.net/oficina/equipo/internal/runner TestEnrolKeepsTheRole
machine: 32 CPUs, load 53.50, cpu waiting 33.04%, memory waiting 0.00%, io waiting 0.72%
--- shard 10 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-plans: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestPlanWorkflowCandidateOrder$|^TestPlanWorkflowFeature$|^TestCoordinatorRecoveryCallRefusalKeepsServing$|^TestCoordinatorRefusalMatrix$' ./internal/runner
receipt: test step 1m0.783s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 59.324s amadan.net/oficina/equipo/internal/runner
receipt: slow test 49.23s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowCandidateOrder
receipt: slow test 44.26s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowFeature
receipt: slow test 8.43s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryCallRefusalKeepsServing
receipt: slow test 1.65s amadan.net/oficina/equipo/internal/runner TestCoordinatorRefusalMatrix
machine: 32 CPUs, load 59.34, cpu waiting 38.24%, memory waiting 0.00%, io waiting 0.61%
--- shard 11 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-rest: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^TestDirectBugWorkflow$|^TestEnrolKeepsTheRole$|^TestPlanWorkflowCandidateOrder$|^TestPlanWorkflowFeature$|^TestCoordinatorRecoveryCallRefusalKeepsServing$|^TestCoordinatorRefusalMatrix$' ./internal/runner
receipt: test step 36.578s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 35.467s amadan.net/oficina/equipo/internal/runner
receipt: slow test 5.14s amadan.net/oficina/equipo/internal/runner TestDirectFaultIsolation
receipt: slow test 3.29s amadan.net/oficina/equipo/internal/runner TestClaimRefusalsBackOff
receipt: slow test 3.17s amadan.net/oficina/equipo/internal/runner TestToolVerbUnderFakeHarness
receipt: slow test 3.14s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryRefusedKeepsServing
receipt: slow test 1.61s amadan.net/oficina/equipo/internal/runner TestReportPostsRetryExactRequest
machine: 32 CPUs, load 38.45, cpu waiting 22.40%, memory waiting 0.00%, io waiting 0.91%
--- shard 12 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-a started 30s late; cpu waiting 40.9%, load 31.52
test lane equipotest-a: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test[A-D]|^TestQ' ./internal/equipotest
rastrillo: budget test: go test failed
--- FAIL amadan.net/oficina/equipo/internal/equipotest TestDirectDeadReferencesRepository
=== RUN TestDirectDeadReferencesRepository
direct_cutover_test.go:221: repository reference inventory: exit status 1
docs/superpowers/plans/2026-11-28-dynamic-specialists-slice-1.md:109:5: unclassified equipo-runner
docs/superpowers/plans/CONTROLLER-BRIEF-specialists-slice-1.md:84:25: unclassified Paseo
docs/superpowers/specs/2026-11-28-dynamic-specialists.md:224:15: unclassified equipo-runner
internal/runner/pause/pause_linux.go:73:5: unclassified node
internal/runner/pause/pause_linux.go:106:50: unclassified node
internal/runner/pause/pause_linux.go:211:23: unclassified node
internal/runner/pause/pause_linux.go:223:17: unclassified node
internal/runner/pause/pause_linux.go:450:15: unclassified node
internal/runner/pause/pause_linux.go:461:18: unclassified node
internal/runner/pause/pause_linux.go:496:16: unclassified node
internal/runner/pause/pause_linux.go:537:7: unclassified node
internal/runner/pause/pause_linux_test.go:678:15: unclassified node
internal/runner/render/driver.go:302:3: unclassified Node
internal/runner/render/driver.go:302:13: unclassified Node
internal/runner/render/driver.go:302:25: unclassified node
internal/runner/render/driver.go:307:39: unclassified Node
internal/runner/render/driver_test.go:89:30: unclassified node
internal/runner/render/driver_test.go:90:20: unclassified node
internal/runner/render/driver_test.go:91:20: unclassified node
internal/runner/render/health_test.go:38:37: unclassified equipo-runner
internal/runner/render/page.go:351:6: unclassified Node
internal/runner/render/page.go:351:18: unclassified node
internal/runner/render/page.go:352:8: unclassified Node
internal/runner/render/page.go:353:2: unclassified Node
internal/runner/render/page.go:353:27: unclassified node
internal/runner/render/page.go:376:9: unclassified Node
internal/runner/render/page.go:376:26: unclassified node
internal/runner/render/page.go:379:7: unclassified Node
internal/runner/render/page.go:383:62: unclassified node
internal/runner/render/page.go:384:66: unclassified node
internal/runner/render/page.go:388:24: unclassified node
internal/runner/render/page.go:390:14: unclassified node
internal/runner/render/page.go:390:24: unclassified Node
internal/runner/render/page.go:391:9: unclassified node
internal/runner/render/page.go:391:23: unclassified Node
internal/runner/render/page.go:392:3: unclassified node
internal/runner/render/page.go:392:16: unclassified node
internal/runner/render/page.go:392:28: unclassified Node
internal/runner/render/page.go:394:36: unclassified node
internal/runner/render/page.go:395:20: unclassified node
internal/runner/render/page.go:396:24: unclassified Node
internal/runner/render/page.go:396:43: unclassified Node
internal/runner/render/page.go:397:12: unclassified Node
internal/runner/render/page.go:401:20: unclassified node
internal/runner/render/page.go:414:27: unclassified node
internal/runner/render/page.go:424:8: unclassified node
internal/runner/render/page.go:448:24: unclassified Node
internal/runner/render/page_test.go:197:77: unclassified Node
internal/runner/render/page_test.go:198:9: unclassified Node
internal/runner/render/page_test.go:198:14: unclassified Node
internal/runner/render/page_test.go:208:41: unclassified node
internal/runner/render/page_test.go:211:2: unclassified node
internal/runner/render/page_test.go:211:15: unclassified Node
internal/runner/render/page_test.go:221:23: unclassified node
internal/runner/render/page_test.go:227:13: unclassified Node
internal/runner/render/page_test.go:245:11: unclassified node
internal/runner/render/page_test.go:246:14: unclassified Node
internal/runner/render/report.go:151:44: unclassified node
internal/runner/thin/worksnap_linux.go:99:5: unclassified node
internal/runner/thin/worksnap_linux.go:126:24: unclassified node
internal/runner/thin/worksnap_linux.go:126:50: unclassified node
internal/runner/thin/worksnap_linux.go:143:9: unclassified node
reference scan: 3065 text files, 3330 matches, 62 failures
--- FAIL: TestDirectDeadReferencesRepository (2.37s)
--- FAIL amadan.net/oficina/equipo/internal/equipotest (package output)
FAIL
rastrillo-budget/v1 ran 1m7.688s
FAIL amadan.net/oficina/equipo/internal/equipotest 67.945s
receipt: test step 1m9.602s against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 0 cached, 0 without tests, 1 failed
receipt: slow package 1m7.688s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 29.23s amadan.net/oficina/equipo/internal/equipotest TestAuthorityCoreIntegration
receipt: slow test 29.08s amadan.net/oficina/equipo/internal/equipotest TestBootstrapNamesOwnersSetting
receipt: slow test 26.95s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelMigration
receipt: slow test 24.15s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfigurationFailuresAreAtomic
receipt: slow test 23.88s amadan.net/oficina/equipo/internal/equipotest TestAuthProductionConfig
exit status 1
+ go test -tags testbuild -timeout 15m -run '^Test[A-D]|^TestQ' -v -run '^TestDirectDeadReferencesRepository$' -count=1 ./internal/equipotest (retry, once)
FAILED TWICE ./internal/equipotest:TestDirectDeadReferencesRepository equipotest-a
=== RUN TestDirectDeadReferencesRepository
direct_cutover_test.go:221: repository reference inventory: exit status 1
docs/superpowers/plans/2026-11-28-dynamic-specialists-slice-1.md:109:5: unclassified equipo-runner
docs/superpowers/plans/CONTROLLER-BRIEF-specialists-slice-1.md:84:25: unclassified Paseo
docs/superpowers/specs/2026-11-28-dynamic-specialists.md:224:15: unclassified equipo-runner
internal/runner/pause/pause_linux.go:73:5: unclassified node
internal/runner/pause/pause_linux.go:106:50: unclassified node
internal/runner/pause/pause_linux.go:211:23: unclassified node
internal/runner/pause/pause_linux.go:223:17: unclassified node
internal/runner/pause/pause_linux.go:450:15: unclassified node
internal/runner/pause/pause_linux.go:461:18: unclassified node
internal/runner/pause/pause_linux.go:496:16: unclassified node
internal/runner/pause/pause_linux.go:537:7: unclassified node
internal/runner/pause/pause_linux_test.go:678:15: unclassified node
internal/runner/render/driver.go:302:3: unclassified Node
internal/runner/render/driver.go:302:13: unclassified Node
internal/runner/render/driver.go:302:25: unclassified node
internal/runner/render/driver.go:307:39: unclassified Node
internal/runner/render/driver_test.go:89:30: unclassified node
internal/runner/render/driver_test.go:90:20: unclassified node
internal/runner/render/driver_test.go:91:20: unclassified node
internal/runner/render/health_test.go:38:37: unclassified equipo-runner
internal/runner/render/page.go:351:6: unclassified Node
internal/runner/render/page.go:351:18: unclassified node
internal/runner/render/page.go:352:8: unclassified Node
internal/runner/render/page.go:353:2: unclassified Node
internal/runner/render/page.go:353:27: unclassified node
internal/runner/render/page.go:376:9: unclassified Node
internal/runner/render/page.go:376:26: unclassified node
internal/runner/render/page.go:379:7: unclassified Node
internal/runner/render/page.go:383:62: unclassified node
internal/runner/render/page.go:384:66: unclassified node
internal/runner/render/page.go:388:24: unclassified node
internal/runner/render/page.go:390:14: unclassified node
internal/runner/render/page.go:390:24: unclassified Node
internal/runner/render/page.go:391:9: unclassified node
internal/runner/render/page.go:391:23: unclassified Node
internal/runner/render/page.go:392:3: unclassified node
internal/runner/render/page.go:392:16: unclassified node
internal/runner/render/page.go:392:28: unclassified Node
internal/runner/render/page.go:394:36: unclassified node
internal/runner/render/page.go:395:20: unclassified node
internal/runner/render/page.go:396:24: unclassified Node
internal/runner/render/page.go:396:43: unclassified Node
internal/runner/render/page.go:397:12: unclassified Node
internal/runner/render/page.go:401:20: unclassified node
internal/runner/render/page.go:414:27: unclassified node
internal/runner/render/page.go:424:8: unclassified node
internal/runner/render/page.go:448:24: unclassified Node
internal/runner/render/page_test.go:197:77: unclassified Node
internal/runner/render/page_test.go:198:9: unclassified Node
internal/runner/render/page_test.go:198:14: unclassified Node
internal/runner/render/page_test.go:208:41: unclassified node
internal/runner/render/page_test.go:211:2: unclassified node
internal/runner/render/page_test.go:211:15: unclassified Node
internal/runner/render/page_test.go:221:23: unclassified node
internal/runner/render/page_test.go:227:13: unclassified Node
internal/runner/render/page_test.go:245:11: unclassified node
internal/runner/render/page_test.go:246:14: unclassified Node
internal/runner/render/report.go:151:44: unclassified node
internal/runner/thin/worksnap_linux.go:99:5: unclassified node
internal/runner/thin/worksnap_linux.go:126:24: unclassified node
internal/runner/thin/worksnap_linux.go:126:50: unclassified node
internal/runner/thin/worksnap_linux.go:143:9: unclassified node
reference scan: 3065 text files, 3330 matches, 62 failures
--- FAIL: TestDirectDeadReferencesRepository (2.39s)
FAIL
rastrillo-budget/v1 ran 2.388s
FAIL amadan.net/oficina/equipo/internal/equipotest 2.545s
FAIL
machine: 32 CPUs, load 55.63, cpu waiting 34.42%, memory waiting 0.00%, io waiting 0.30%
make: *** [Makefile:113: ci-shard] Error 1
amadan: step check shard 12 of 29 failed: exit status 2
--- shard 13 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-e started 30s late; cpu waiting 40.9%, load 31.52
test lane equipotest-e: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test[E-P]' ./internal/equipotest
receipt: test step 2m13.777s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2m11.723s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 20.8s amadan.net/oficina/equipo/internal/equipotest TestProjectsFailuresRollBack
receipt: slow test 20.78s amadan.net/oficina/equipo/internal/equipotest TestProjectWritesRequireCurrentOwner
receipt: slow test 20.78s amadan.net/oficina/equipo/internal/equipotest TestProjectsReopen
receipt: slow test 20.73s amadan.net/oficina/equipo/internal/equipotest TestProjectRetryAndRevision
receipt: slow test 20.73s amadan.net/oficina/equipo/internal/equipotest TestProjectOwnersAreMembers
machine: 32 CPUs, load 28.42, cpu waiting 13.99%, memory waiting 0.00%, io waiting 0.10%
--- shard 14 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-r started 30s late; cpu waiting 40.9%, load 31.52
test lane equipotest-r: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestR' ./internal/equipotest
amadan: job cancelled — a newer push superseded it
--- shard 15 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-rest started 30s late; cpu waiting 42.5%, load 31.52
test lane equipotest-rest: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^Test[A-D]|^TestQ|^Test[E-P]|^TestR' ./internal/equipotest
receipt: test step 1m9.169s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m7.326s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 26.23s amadan.net/oficina/equipo/internal/equipotest TestSigninNoProof
receipt: slow test 25.42s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedExistingTeam
receipt: slow test 25.39s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedRollback
receipt: slow test 23.62s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsUpgrade
receipt: slow test 23.42s amadan.net/oficina/equipo/internal/equipotest TestSpecialistSettings
machine: 32 CPUs, load 55.63, cpu waiting 36.55%, memory waiting 0.00%, io waiting 0.32%
--- shard 16 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: plan3test started 30s late; cpu waiting 42.5%, load 31.52
test lane plan3test: ./internal/plan3test
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./internal/plan3test
receipt: test step 56.147s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 53.821s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 3.88s amadan.net/oficina/equipo/internal/plan3test TestPlan3Upgrade
receipt: slow test 3.54s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3B
receipt: slow test 1.7s amadan.net/oficina/equipo/internal/plan3test TestConversationQuestionRace
receipt: slow test 1.66s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3A
receipt: slow test 1.34s amadan.net/oficina/equipo/internal/plan3test TestPlanMigrationUpgrade
machine: 32 CPUs, load 61.90, cpu waiting 39.28%, memory waiting 0.00%, io waiting 0.39%
--- shard 17 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: rest started 30s late; cpu waiting 42.5%, load 31.52
test lane rest: ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/diffscan ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/door ./internal/equipo/github ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/pause ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/push ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/idtest ./internal/ownermodetest ./internal/release ./internal/release/renderertest ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/pause ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/claude/realcli ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/render ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/forgekey ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/diffscan ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/door ./internal/equipo/github ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/pause ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/push ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/idtest ./internal/ownermodetest ./internal/release ./internal/release/renderertest ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/pause ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/claude/realcli ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/render ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/forgekey ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
cache miss: amadan.net/oficina/equipo/internal/copydesk: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/claude/realcli: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/forge: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/webread: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runnerproto: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/workspace: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/testci: its inputs changed
--- FAIL amadan.net/oficina/equipo/internal/runner/pause TestHoldStopsAReparentedDaemon
=== RUN TestHoldStopsAReparentedDaemon
pause_linux_test.go:603: daemon made no progress in 2s
pause_linux_test.go:69: sandbox stderr:
--- FAIL: TestHoldStopsAReparentedDaemon (2.37s)
--- FAIL amadan.net/oficina/equipo/internal/runner/pause (package output)
FAIL
FAIL amadan.net/oficina/equipo/internal/runner/pause 6.050s
--- FAIL amadan.net/oficina/equipo/internal/runner/webread TestTimeouts
=== RUN TestTimeouts
fetch_test.go:537: s1: {Source:s1 Origin:paul Parent: URL:https://shop.example.com/slow-body Hops:[{URL:https://shop.example.com/slow-body Address:151.101.1.1 Status:200}] Address:151.101.1.1 Status:200 Type:text/plain Bytes:5 SHA256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 Millis:300 Reason: File:s001.txt}
--- FAIL: TestTimeouts (0.61s)
--- FAIL amadan.net/oficina/equipo/internal/runner/webread (package output)
FAIL
rastrillo-budget/v1 ran 1.544s
FAIL amadan.net/oficina/equipo/internal/runner/webread 1.553s
--- FAIL amadan.net/oficina/equipo/internal/testci TestBudgetRecordsAreShort
=== RUN TestBudgetRecordsAreShort
budgets_file_test.go:37: .rastrillo/budgets.txt:41: reason is 214 bytes, over 200
budgets_file_test.go:37: .rastrillo/budgets.txt:74: reason is 232 bytes, over 200
--- FAIL: TestBudgetRecordsAreShort (0.00s)
--- FAIL amadan.net/oficina/equipo/internal/testci (package output)
FAIL
rastrillo-budget/v1 ran 1.723s
FAIL amadan.net/oficina/equipo/internal/testci 1.755s
budget note: internal/equipo took 2m23.535s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/equipo/chat took 24.811s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/equipo/github took 40.581s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/equipo/setup took 12.843s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/idtest took 1m53.127s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/release took 41.903s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/runner/containment took 59.471s, over the 15s its record on line 40 allows; reported only, timing fails on CI
budget note: internal/runner/forge took 23.118s, over the 20s its record on line 35 allows; reported only, timing fails on CI
budget note: internal/runner/provider/claude/realcli took 14.435s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/runner/provider/pi took 1m19.423s, over the 1m0s its record on line 27 allows; reported only, timing fails on CI
budget note: internal/runner/render took 1m29.77s, over the 10s the default allows; reported only, timing fails on CI
receipt: test step 2m28.967s against a 60s target (the gate's other steps are not in this figure)
receipt: 29 packages ran, 39 cached, 17 without tests, 3 failed
receipt: slow package 2m23.535s amadan.net/oficina/equipo/internal/equipo
receipt: slow package 1m53.127s amadan.net/oficina/equipo/internal/idtest
receipt: slow package 1m29.77s amadan.net/oficina/equipo/internal/runner/render
receipt: slow package 1m19.423s amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow package 1m10.265s amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow test 54.29s amadan.net/oficina/equipo/internal/idtest TestDoorRemembersOficinaID
rastrillo: budget test: go test failed
receipt: slow test 50.36s amadan.net/oficina/equipo/internal/runner/render TestLaunchNeverClaimsAnUnprovenEnd
receipt: slow test 46.01s amadan.net/oficina/equipo/internal/idtest TestDoorOficinaSettingsUnreadableIsNoLoop
receipt: slow test 45.52s amadan.net/oficina/equipo/internal/idtest TestDoorStepUpIsLocal
receipt: slow test 45.08s amadan.net/oficina/equipo/internal/idtest TestDoorForgetsOficinaIDForARefusedSession
exit status 1
+ go test -tags testbuild -timeout 15m -v -run '^TestHoldStopsAReparentedDaemon$' -count=1 ./internal/runner/pause (retry, once)
FAILED TWICE ./internal/runner/pause:TestHoldStopsAReparentedDaemon rest
=== RUN TestHoldStopsAReparentedDaemon
pause_linux_test.go:603: daemon made no progress in 2s
pause_linux_test.go:69: sandbox stderr:
--- FAIL: TestHoldStopsAReparentedDaemon (2.31s)
FAIL
FAIL amadan.net/oficina/equipo/internal/runner/pause 2.316s
FAIL
+ go test -tags testbuild -timeout 15m -v -run '^TestTimeouts$' -count=1 ./internal/runner/webread (retry, once)
##############################################################################
FLAKE ./internal/runner/webread:TestTimeouts rest 712372b7b2cdc2ec2702738f2c04831aa3ef8f5a 0.61s 21.41
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
+ go test -tags testbuild -timeout 15m -v -run '^TestBudgetRecordsAreShort$' -count=1 ./internal/testci (retry, once)
FAILED TWICE ./internal/testci:TestBudgetRecordsAreShort rest
=== RUN TestBudgetRecordsAreShort
budgets_file_test.go:37: .rastrillo/budgets.txt:41: reason is 214 bytes, over 200
budgets_file_test.go:37: .rastrillo/budgets.txt:74: reason is 232 bytes, over 200
--- FAIL: TestBudgetRecordsAreShort (0.00s)
FAIL
rastrillo-budget/v1 ran 0s
FAIL amadan.net/oficina/equipo/internal/testci 0.004s
FAIL
machine: 32 CPUs, load 19.94, cpu waiting 10.03%, memory waiting 0.00%, io waiting 0.07%
make: *** [Makefile:113: ci-shard] Error 1
amadan: step check shard 17 of 29 failed: exit status 2
--- shard 18 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-chat: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$' ./internal/headless
receipt: test step 1m25.483s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m23.647s amadan.net/oficina/equipo/internal/headless
receipt: slow test 39.04s amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
receipt: slow test 14.95s amadan.net/oficina/equipo/internal/headless TestBrowserDraftStreamsFormatted
receipt: slow test 10.56s amadan.net/oficina/equipo/internal/headless TestBrowserChat
receipt: slow test 7.42s amadan.net/oficina/equipo/internal/headless TestBrowserComposer
receipt: slow test 6.36s amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
machine: 32 CPUs, load 61.90, cpu waiting 39.28%, memory waiting 0.00%, io waiting 0.39%
--- shard 19 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-work: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$' ./internal/headless
receipt: test step 1m32.829s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m30.86s amadan.net/oficina/equipo/internal/headless
receipt: slow test 28.65s amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
receipt: slow test 21.33s amadan.net/oficina/equipo/internal/headless TestBrowserTaskThread
receipt: slow test 13.23s amadan.net/oficina/equipo/internal/headless TestBrowserReceiptFollowsReview
receipt: slow test 9.52s amadan.net/oficina/equipo/internal/headless TestBrowserTaskCard
receipt: slow test 9.35s amadan.net/oficina/equipo/internal/headless TestBrowserAskAfterMerge
machine: 32 CPUs, load 58.73, cpu waiting 38.59%, memory waiting 0.00%, io waiting 0.35%
--- shard 20 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-connections: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
receipt: test step 1m54.015s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m51.855s amadan.net/oficina/equipo/internal/headless
receipt: slow test 14.39s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsConversation
receipt: slow test 13.29s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAddPage
receipt: slow test 12.67s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAdd
receipt: slow test 11.25s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsSignInEmail
receipt: slow test 11.15s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsMeteredLimitRequired
machine: 32 CPUs, load 46.49, cpu waiting 28.78%, memory waiting 0.00%, io waiting 0.24%
--- shard 21 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-rest: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAskAfterMerge|TestBrowserCardAnswerSettlesAtBottom|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInEmail|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
receipt: test step 1m39.011s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m37.173s amadan.net/oficina/equipo/internal/headless
receipt: slow test 14.95s amadan.net/oficina/equipo/internal/headless TestBrowserThinkingAndCards
receipt: slow test 12.76s amadan.net/oficina/equipo/internal/headless TestBrowserWaitingTurns
receipt: slow test 10.86s amadan.net/oficina/equipo/internal/headless TestBrowserStalePageReloads
receipt: slow test 9.52s amadan.net/oficina/equipo/internal/headless TestBrowserMoveIn
receipt: slow test 7.62s amadan.net/oficina/equipo/internal/headless TestBrowserRefreshRace
machine: 32 CPUs, load 55.63, cpu waiting 35.52%, memory waiting 0.00%, io waiting 0.31%
--- shard 22 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-rest: ./internal/equipo
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserPreviewBlocksNavigation|TestBrowserPreviewPassExchange)$' ./internal/equipo
receipt: test step 4.484s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2.476s amadan.net/oficina/equipo/internal/equipo
receipt: slow test 1.8s amadan.net/oficina/equipo/internal/equipo TestBrowserPreviewPassExchange
receipt: slow test 670ms amadan.net/oficina/equipo/internal/equipo TestBrowserPreviewBlocksNavigation
browser lane browser-rest: ./internal/equipotest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserGitHubManifestCSP)$' ./internal/equipotest
receipt: test step 8.02s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 6.38s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 6.38s amadan.net/oficina/equipo/internal/equipotest TestBrowserGitHubManifestCSP
browser lane browser-rest: ./internal/idtest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserOficinaIDDoor|TestBrowserSmartDoor)$' ./internal/idtest
budget note: internal/idtest took 11.046s, over the 10s the default allows; reported only, timing fails on CI
receipt: test step 12.526s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 11.046s amadan.net/oficina/equipo/internal/idtest
receipt: slow test 8.82s amadan.net/oficina/equipo/internal/idtest TestBrowserSmartDoor
receipt: slow test 2.22s amadan.net/oficina/equipo/internal/idtest TestBrowserOficinaIDDoor
browser lane browser-rest: ./internal/plan3test
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestTeamsHierarchyBrowser)$' ./internal/plan3test
receipt: test step 4.153s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2.402s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 2.4s amadan.net/oficina/equipo/internal/plan3test TestTeamsHierarchyBrowser
browser lane browser-rest: ./internal/thintest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAccessEmojiByline|TestBrowserAccessFinalOutcomes|TestBrowserAccessRequest|TestBrowserAccessReview|TestBrowserActivitySubjects|TestBrowserAutonomySettings|TestBrowserCoordinatorQueue|TestBrowserEmptyConversation|TestBrowserEndedNoteStaysGone|TestBrowserHousekeeping|TestBrowserInnerGallery|TestBrowserInnerScreens|TestBrowserInstantThinking|TestBrowserInstantThinkingQueued|TestBrowserMachines|TestBrowserPausedWork|TestBrowserPhoneIndex|TestBrowserPlacementQuestionAndPending|TestBrowserProjectPlacement|TestBrowserProjectsList|TestBrowserReportActionFeedback|TestBrowserReportNextSteps|TestBrowserReportThread|TestBrowserRhythm|TestBrowserRollup|TestBrowserRosterAlignment|TestBrowserRosterDecisionStates|TestBrowserRosterQuietDay|TestBrowserRosterReports|TestBrowserRosterSetAside|TestBrowserRosterSubchat|TestBrowserRosterThinking|TestBrowserRosterVisual|TestBrowserSettingsHousekeepingGroups|TestBrowserSettingsMenu|TestBrowserSettingsRail|TestBrowserSettingsSaveBar|TestBrowserSettingsShots|TestBrowserSettingsStayOnPage|TestBrowserSettingsTeams|TestBrowserShipsButtons|TestBrowserSpecialistRows|TestBrowserSpendFollowsAnswers|TestBrowserTaskRows|TestBrowserTeamPanel|TestBrowserThinkingCycles|TestBrowserThinkingLinesClear|TestBrowserThinkingSteady|TestBrowserThinkingWords|TestBrowserTokenRowEmail|TestBrowserTrackPulse|TestBrowserTrackStarCentre|TestBrowserTryAgain)$' ./internal/thintest
amadan: job cancelled — a newer push superseded it
--- shard 23 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
shard 23: make test-quarantine
python3 scripts/ci-test.py quarantine
quarantine: 12 tests from scripts/ci-quarantine.txt; a failure is retried once, and a pass on the retry is reported as a flake
+ go test -tags testbuild -timeout 15m -v -run '^TestHeadlessConnections$/^A5_cancel_and_sign_out$|^TestHeadlessConnections$/^C4_claude_sign_in$|^TestHeadlessConnections$/^C5_engineering_failover$|^TestHeadlessConnections$/^C5_engineering_to_codex$|^TestHeadlessConnections$/^C5_engineering_waits$' ./internal/headless (53s)
ok ./internal/headless TestHeadlessConnections/A5_cancel_and_sign_out 4.53s
ok ./internal/headless TestHeadlessConnections/C4_claude_sign_in 1.23s
ok ./internal/headless TestHeadlessConnections/C5_engineering_failover 8.71s
ok ./internal/headless TestHeadlessConnections/C5_engineering_to_codex 9.30s
ok ./internal/headless TestHeadlessConnections/C5_engineering_waits 26.85s
+ go test -tags testbuild -timeout 15m -v -run '^TestHeadlessConnections$/^C5_review_auth$|^TestHeadlessConnections$/^C5_review_failover$|^TestHeadlessConnections$/^C5_review_on_codex$|^TestHeadlessConnections$/^C5_review_other_family_first$' ./internal/headless (63s)
ok ./internal/headless TestHeadlessConnections/C5_review_auth 23.07s
ok ./internal/headless TestHeadlessConnections/C5_review_failover 11.66s
ok ./internal/headless TestHeadlessConnections/C5_review_on_codex 10.08s
ok ./internal/headless TestHeadlessConnections/C5_review_other_family_first 15.42s
+ go test -tags testbuild -timeout 15m -v -run '^TestMixedVersions$' ./internal/headless (21s)
ok ./internal/headless TestMixedVersions 18.72s
+ go test -tags testbuild -timeout 15m -v -run '^TestCheckSandboxDeniedPathsTampering$' ./internal/runner/checks (2s)
ok ./internal/runner/checks TestCheckSandboxDeniedPathsTampering 0.77s
+ go test -tags testbuild -timeout 15m -v -run '^TestRunnerCancelAndSupersede$' ./internal/runner/thin (2s)
ok ./internal/runner/thin TestRunnerCancelAndSupersede 0.05s
quarantine: 0 flaked (passed on the retry), 0 failed
machine: 32 CPUs, load 59.63, cpu waiting 39.12%, memory waiting 0.00%, io waiting 0.59%
--- shard 24 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
shard 24: make runner-host
python3 scripts/runner-prerequisites.py
CGO_ENABLED=0 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run 'TestDirect|TestProvider|TestCheckSandbox' -count=1 ./internal/runner/provider/... ./internal/runner/checks
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run 'TestDirect|TestProvider|TestCheckSandbox' -count=1 ./internal/runner/provider/... ./internal/runner/checks
receipt: test step 13.543s against a 60s target (the gate's other steps are not in this figure)
receipt: 4 packages ran, 0 cached, 4 without tests, 0 failed
receipt: slow package 7.585s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 238ms amadan.net/oficina/equipo/internal/runner/provider/claude
receipt: slow package 136ms amadan.net/oficina/equipo/internal/runner/provider/codex
receipt: slow package 1ms amadan.net/oficina/equipo/internal/runner/provider
receipt: slow package 0s amadan.net/oficina/equipo/internal/runner/provider/claude/realcli
receipt: slow test 5.23s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsGoFixture
receipt: slow test 1.78s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPaths
receipt: slow test 440ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsCache
receipt: slow test 240ms amadan.net/oficina/equipo/internal/runner/provider/claude TestDirectJournalAdapterBarrier
receipt: slow test 130ms amadan.net/oficina/equipo/internal/runner/provider/codex TestDirectJournalAdapterBarrier
CGO_ENABLED=0 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run '^TestNamespace' -count=1 ./internal/runner/containment
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run '^TestNamespace' -count=1 ./internal/runner/containment
receipt: test step 4.012s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 3.027s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 310ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReadOnlyScratch
receipt: slow test 250ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryUnavailableProof
receipt: slow test 140ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryCleansScratch
receipt: slow test 120ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceDirectPolicyAdmission
receipt: slow test 100ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReapsOrphans
machine: 32 CPUs, load 16.49, cpu waiting 9.95%, memory waiting 0.00%, io waiting 1.28%
--- shard 25 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: runner-dead-references started 30s late; cpu waiting 40.9%, load 31.52
shard 25: make runner-dead-references lanes-check build vet fmt-check spacing budget migration-check
python3 scripts/runner-dead-references.py
docs/superpowers/plans/2026-11-28-dynamic-specialists-slice-1.md:109:5: unclassified equipo-runner
docs/superpowers/plans/CONTROLLER-BRIEF-specialists-slice-1.md:84:25: unclassified Paseo
docs/superpowers/specs/2026-11-28-dynamic-specialists.md:224:15: unclassified equipo-runner
internal/runner/pause/pause_linux.go:73:5: unclassified node
internal/runner/pause/pause_linux.go:106:50: unclassified node
internal/runner/pause/pause_linux.go:211:23: unclassified node
internal/runner/pause/pause_linux.go:223:17: unclassified node
internal/runner/pause/pause_linux.go:450:15: unclassified node
internal/runner/pause/pause_linux.go:461:18: unclassified node
internal/runner/pause/pause_linux.go:496:16: unclassified node
internal/runner/pause/pause_linux.go:537:7: unclassified node
internal/runner/pause/pause_linux_test.go:678:15: unclassified node
internal/runner/render/driver.go:302:3: unclassified Node
internal/runner/render/driver.go:302:13: unclassified Node
internal/runner/render/driver.go:302:25: unclassified node
internal/runner/render/driver.go:307:39: unclassified Node
internal/runner/render/driver_test.go:89:30: unclassified node
internal/runner/render/driver_test.go:90:20: unclassified node
internal/runner/render/driver_test.go:91:20: unclassified node
internal/runner/render/health_test.go:38:37: unclassified equipo-runner
internal/runner/render/page.go:351:6: unclassified Node
internal/runner/render/page.go:351:18: unclassified node
internal/runner/render/page.go:352:8: unclassified Node
internal/runner/render/page.go:353:2: unclassified Node
internal/runner/render/page.go:353:27: unclassified node
internal/runner/render/page.go:376:9: unclassified Node
internal/runner/render/page.go:376:26: unclassified node
internal/runner/render/page.go:379:7: unclassified Node
internal/runner/render/page.go:383:62: unclassified node
internal/runner/render/page.go:384:66: unclassified node
internal/runner/render/page.go:388:24: unclassified node
internal/runner/render/page.go:390:14: unclassified node
internal/runner/render/page.go:390:24: unclassified Node
internal/runner/render/page.go:391:9: unclassified node
internal/runner/render/page.go:391:23: unclassified Node
internal/runner/render/page.go:392:3: unclassified node
internal/runner/render/page.go:392:16: unclassified node
internal/runner/render/page.go:392:28: unclassified Node
internal/runner/render/page.go:394:36: unclassified node
internal/runner/render/page.go:395:20: unclassified node
internal/runner/render/page.go:396:24: unclassified Node
internal/runner/render/page.go:396:43: unclassified Node
internal/runner/render/page.go:397:12: unclassified Node
internal/runner/render/page.go:401:20: unclassified node
internal/runner/render/page.go:414:27: unclassified node
internal/runner/render/page.go:424:8: unclassified node
internal/runner/render/page.go:448:24: unclassified Node
internal/runner/render/page_test.go:197:77: unclassified Node
internal/runner/render/page_test.go:198:9: unclassified Node
internal/runner/render/page_test.go:198:14: unclassified Node
internal/runner/render/page_test.go:208:41: unclassified node
internal/runner/render/page_test.go:211:2: unclassified node
internal/runner/render/page_test.go:211:15: unclassified Node
internal/runner/render/page_test.go:221:23: unclassified node
internal/runner/render/page_test.go:227:13: unclassified Node
internal/runner/render/page_test.go:245:11: unclassified node
internal/runner/render/page_test.go:246:14: unclassified Node
internal/runner/render/report.go:151:44: unclassified node
internal/runner/thin/worksnap_linux.go:99:5: unclassified node
internal/runner/thin/worksnap_linux.go:126:24: unclassified node
internal/runner/thin/worksnap_linux.go:126:50: unclassified node
internal/runner/thin/worksnap_linux.go:143:9: unclassified node
reference scan: 3065 text files, 3330 matches, 62 failures
make[1]: *** [Makefile:238: runner-dead-references] Error 1
machine: 32 CPUs, load 31.52, cpu waiting 17.48%, memory waiting 0.00%, io waiting 1.01%
make: *** [Makefile:113: ci-shard] Error 2
amadan: step check shard 25 of 29 failed: exit status 2
--- shard 26 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: staticcheck started 30s late; cpu waiting 40.9%, load 31.52
shard 26: make staticcheck
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf,testbuild ./...
machine: 32 CPUs, load 53.50, cpu waiting 34.48%, memory waiting 0.00%, io waiting 0.70%
--- shard 27 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: govulncheck started 30s late; cpu waiting 40.9%, load 31.52
shard 27: make govulncheck
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 ./...
=== Symbol Results ===
No vulnerabilities found.
Your code is affected by 0 vulnerabilities.
This scan also found 1 vulnerability in packages you import and 10
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use '-show verbose' for more details.
machine: 32 CPUs, load 53.50, cpu waiting 34.48%, memory waiting 0.00%, io waiting 0.70%
--- shard 28 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: gitleaks started 30s late; cpu waiting 40.9%, load 31.52
shard 28: make gitleaks
[90m9:50PM[0m [32mINF[0m [1mUnknown SCM platform. Use --platform to include links in findings.[0m [36mhost=[0mamadan.net
[90m9:50PM[0m [32mINF[0m [1m1280 commits scanned.[0m
[90m9:50PM[0m [32mINF[0m [1mscanned ~69392680 bytes (69.39 MB) in 24.2s[0m
[90m9:50PM[0m [32mINF[0m [1mno leaks found[0m
machine: 32 CPUs, load 58.58, cpu waiting 34.48%, memory waiting 0.00%, io waiting 0.70%
diff --git a/internal/runner/pause/pause_linux.go b/internal/runner/pause/pause_linux.go| index faa45cd0..d0c7e18b 100644 |
| --- a/internal/runner/pause/pause_linux.go |
| +++ b/internal/runner/pause/pause_linux.go |
| @@ -6,6 +6,7 @@ import ( |
| "bytes" |
| "errors" |
| "fmt" |
| + "io/fs" |
| "os" |
| "strconv" |
| "strings" |
| @@ -22,36 +23,74 @@ const maxMembers = 4096 |
| // rescanEvery paces the passes over /proc while the sandbox stops. |
| const rescanEvery = time.Millisecond |
| +// Seams for the tests: the watchdog's timer, and a hook called at fixed |
| +// points of a pass ("scanned": /proc was listed; "retry": a member read |
| +// running and is about to be sent SIGSTOP again). Both are nil-safe and |
| +// unset in production. |
| +var ( |
| + afterFunc = time.AfterFunc |
| + testHook func(point string, pid int) |
| +) |
| + |
| +func hook(point string, pid int) { |
| + if testHook != nil { |
| + testHook(point, pid) |
| + } |
| +} |
| + |
| // Hold stops every process of the sandbox whose first process is p, calls |
| // fn while all of them are stopped, and resumes them on every way out: |
| // fn's return, its panic, or the bound passing. bound covers both the |
| // stopping and fn. When the bound passes first, the sandbox is resumed at |
| -// once (fn may still be running) and Hold returns ErrBusy after fn |
| -// returns: whatever fn read is not a paused read. fn gets the deadline so |
| -// it can give up early. |
| +// once (fn may still be running); whenever the deadline has passed by the |
| +// time fn returns, Hold returns ErrBusy, however the watchdog was |
| +// scheduled. fn gets the deadline so it can give up early. |
| +// |
| +// Members are found by pid namespace, not by parent pid: every process |
| +// whose pid namespace is p's (the sandbox's, pinned open for the pause) or |
| +// one nested below it, found by walking NS_GET_PARENT up from its own. |
| +// Each is opened as a pidfd, checked against the start time the scan |
| +// saw, and signalled through that pidfd only, so SIGSTOP and SIGCONT |
| +// reach that exact process or none. Every pass first checks that every |
| +// retained member reads stopped (each thread T or t, or dead) or has |
| +// exited, and only then lists /proc afresh; the pause is settled when a |
| +// pass finds both. A process forked before its parent stopped exists by |
| +// then, so that listing sees it. A /proc read that fails for any reason |
| +// but the process having gone refuses the pause (ErrBusy). |
| // |
| -// The descendants are found from /proc: every process whose parent chain |
| -// reaches p, each child started no earlier than its parent and in p's pid |
| -// namespace or one nested in it, so a reused pid is not taken for one. |
| -// Each is opened as a pidfd, checked against the start time the scan saw, |
| -// and signalled through that pidfd only, so SIGSTOP and SIGCONT reach that |
| -// exact process or none. The passes repeat until one full pass finds no |
| -// new process and every thread of every one reads stopped (T or t) or |
| -// dead (Z or X) in /proc/<pid>/task/<tid>/stat. |
| +// Threat model. The pause is for consistency, not containment: whatever |
| +// the sandbox does, the copy made inside the pause opens every path with |
| +// openat2 below the workspace root, through no link, and reads within the |
| +// caps (thin's copyWorkSite), so neither an escape nor an oversized read |
| +// depends on the pause holding. What the pause gives is a copy no |
| +// cooperating process changes while it is made. A process inside the |
| +// sandbox can still defeat that on purpose (a timer that sends itself |
| +// SIGCONT, two processes that SIGCONT each other, asynchronous I/O |
| +// submitted before it stopped): slice 1 installs no seccomp policy against |
| +// those, because such a sandbox already decides what its work tree holds |
| +// and can commit anything else afterwards. As defence in depth the copy |
| +// re-reads, still inside the pause, the identity and times (device, |
| +// inode, size, mtime, ctime) of every file and directory it read and |
| +// refuses (busy) on any change. |
| func Hold(p Process, bound time.Duration, fn func(deadline time.Time) error) error { |
| deadline := time.Now().Add(bound) |
| - h := &held{members: map[member]int{}} |
| + h := newHeld() |
| + defer h.closeNamespaces() |
| // Every way out resumes, a panic in fn included: deferred calls run |
| // while a panic unwinds, before it goes on up. |
| defer h.resume() |
| - watchdog := time.AfterFunc(bound, func() { h.resume() }) |
| + watchdog := afterFunc(bound, func() { h.resume() }) |
| defer watchdog.Stop() |
| if err := h.stop(p, deadline); err != nil { |
| return err |
| } |
| err := fn(deadline) |
| - if !h.resume() { |
| - // The watchdog resumed the sandbox while fn ran. |
| + // The deadline is checked on the monotonic clock, not inferred from |
| + // which resume ran first: a watchdog that has not run yet does not |
| + // make an overdue copy a paused one. |
| + expired := !time.Now().Before(deadline) |
| + first := h.resume() |
| + if expired || !first { |
| return ErrBusy |
| } |
| return err |
| @@ -63,11 +102,33 @@ type member struct { |
| start uint64 |
| } |
| +// nsEntry is a pid namespace already placed: inside the sandbox or not, |
| +// and the descriptor that keeps it (and so its inode number) alive for the |
| +// pause. |
| +type nsEntry struct { |
| + inside bool |
| + fd int |
| +} |
| + |
| +func newHeld() *held { |
| + return &held{members: map[member]int{}, ns: map[uint64]nsEntry{}, sandboxFD: -1, uid: os.Getuid()} |
| +} |
| + |
| type held struct { |
| + // mu serialises every use of a member's pidfd (signals, exit polls) |
| + // with resume, which closes them. |
| mu sync.Mutex |
| // members maps every process signalled SIGSTOP to its pidfd. |
| members map[member]int |
| resumed bool |
| + |
| + // The sandbox's pid namespace, ours, and the depth (NSpid fields) of |
| + // the sandbox's first process; ns caches each namespace seen. |
| + sandbox, ours uint64 |
| + sandboxFD int |
| + rootDepth int |
| + uid int |
| + ns map[uint64]nsEntry |
| } |
| // resume sends SIGCONT to every process stopped, through its pidfd, and |
| @@ -90,6 +151,15 @@ func (h *held) resume() bool { |
| return true |
| } |
| +func (h *held) closeNamespaces() { |
| + for _, e := range h.ns { |
| + unix.Close(e.fd) |
| + } |
| + if h.sandboxFD >= 0 { |
| + unix.Close(h.sandboxFD) |
| + } |
| +} |
| + |
| // stop signals SIGSTOP until the whole sandbox reads stopped. |
| func (h *held) stop(p Process, deadline time.Time) error { |
| if err := h.stopRoot(p); err != nil { |
| @@ -99,11 +169,7 @@ func (h *held) stop(p Process, deadline time.Time) error { |
| if !time.Now().Before(deadline) { |
| return ErrBusy |
| } |
| - tree, err := descendants(p) |
| - if err != nil { |
| - return err |
| - } |
| - settled, err := h.pass(tree) |
| + settled, err := h.pass() |
| if err != nil || settled { |
| return err |
| } |
| @@ -111,29 +177,55 @@ func (h *held) stop(p Process, deadline time.Time) error { |
| } |
| } |
| -// stopRoot checks that p is still the recorded process (its start time |
| -// and namespace, read after its pidfd is open so the pid cannot be reused |
| -// in between) and stops it first. |
| +// stopRoot pins p (pin) and stops it first. |
| func (h *held) stopRoot(p Process) error { |
| + fd, start, err := h.pin(p) |
| + if err != nil { |
| + return err |
| + } |
| + return h.signal(member{p.PID, start}, fd) |
| +} |
| + |
| +// pin checks that p is still the recorded process (its start time and |
| +// namespace, read after its pidfd is open, with the pidfd polled after so |
| +// the pid was not reused in between), keeps the sandbox's pid namespace |
| +// open for the pause, and returns p's pidfd. |
| +func (h *held) pin(p Process) (int, uint64, error) { |
| if p.PID <= 0 || p.StartTicks == 0 { |
| - return ErrGone |
| + return -1, 0, ErrGone |
| } |
| fd, err := unix.PidfdOpen(p.PID, 0) |
| if err != nil { |
| - return ErrGone |
| + return -1, 0, ErrGone |
| } |
| + fail := func(e error) (int, uint64, error) { unix.Close(fd); return -1, 0, e } |
| _, _, start, err := readStat(fmt.Sprintf("/proc/%d/stat", p.PID)) |
| - if err == nil && p.Namespace != "" { |
| - var ns string |
| - if ns, err = os.Readlink(fmt.Sprintf("/proc/%d/ns/pid", p.PID)); err == nil && ns != p.Namespace { |
| - err = ErrGone |
| - } |
| - } |
| if err != nil || start != p.StartTicks { |
| - unix.Close(fd) |
| - return ErrGone |
| + return fail(ErrGone) |
| } |
| - return h.signal(member{p.PID, start}, fd) |
| + nsFD, err := unix.Open(fmt.Sprintf("/proc/%d/ns/pid", p.PID), unix.O_RDONLY|unix.O_CLOEXEC, 0) |
| + if err != nil { |
| + return fail(ErrGone) |
| + } |
| + h.sandboxFD = nsFD |
| + if h.sandbox, err = inode(nsFD); err != nil || p.Namespace != "" && p.Namespace != fmt.Sprintf("pid:[%d]", h.sandbox) { |
| + return fail(ErrGone) |
| + } |
| + if h.rootDepth = nsDepth(p.PID); h.rootDepth < 2 || exited(fd) { |
| + // Not in a pid namespace of its own, or exited (its pid may have |
| + // been reused for what was read). |
| + return fail(ErrGone) |
| + } |
| + self, err := unix.Open("/proc/self/ns/pid", unix.O_RDONLY|unix.O_CLOEXEC, 0) |
| + if err != nil { |
| + return fail(ErrBusy) |
| + } |
| + h.ours, err = inode(self) |
| + unix.Close(self) |
| + if err != nil || h.ours == h.sandbox { |
| + return fail(ErrBusy) |
| + } |
| + return fd, start, nil |
| } |
| // signal keeps fd as m's pidfd and sends it SIGSTOP; it refuses once the |
| @@ -157,152 +249,305 @@ func (h *held) signal(m member, fd int) error { |
| return nil |
| } |
| -// pass stops each process of tree not yet stopped and reports whether |
| -// the sandbox is settled: no new process, and every thread stopped. |
| -func (h *held) pass(tree []proc) (bool, error) { |
| +// retry sends SIGSTOP again to a member that read running. The pidfd is |
| +// looked up, and resumed checked, under the lock resume holds, so the |
| +// signal never lands after the sandbox's SIGCONT or on a closed (or |
| +// reused) descriptor. |
| +func (h *held) retry(m member) error { |
| + h.mu.Lock() |
| + defer h.mu.Unlock() |
| + if h.resumed { |
| + return ErrBusy |
| + } |
| + fd, ok := h.members[m] |
| + if !ok { |
| + return ErrBusy |
| + } |
| + if err := unix.PidfdSendSignal(fd, unix.SIGSTOP, nil, 0); err != nil && err != unix.ESRCH { |
| + return ErrBusy |
| + } |
| + return nil |
| +} |
| + |
| +// pass checks every retained member, then lists /proc afresh and stops |
| +// every new member. It is settled when every retained member read stopped |
| +// (or exited) and the listing, made after, found no new one. |
| +func (h *held) pass() (bool, error) { |
| settled := true |
| - for _, d := range tree { |
| - m := member{d.pid, d.start} |
| - h.mu.Lock() |
| - fd, known := h.members[m] |
| - resumed := h.resumed |
| + h.mu.Lock() |
| + if h.resumed { |
| h.mu.Unlock() |
| - if resumed { |
| - return false, ErrBusy |
| + return false, ErrBusy |
| + } |
| + retained := make([]member, 0, len(h.members)) |
| + for m := range h.members { |
| + retained = append(retained, m) |
| + } |
| + h.mu.Unlock() |
| + known := map[int]uint64{} |
| + for _, m := range retained { |
| + known[m.pid] = m.start |
| + stopped, err := h.memberStopped(m) |
| + if err != nil { |
| + return false, err |
| } |
| - if !known { |
| + if !stopped { |
| settled = false |
| - fd, err := unix.PidfdOpen(d.pid, 0) |
| - if err == unix.ESRCH { |
| - continue // exited since the scan |
| - } |
| - if err != nil { |
| - return false, ErrBusy |
| - } |
| - // The pid may have been reused between the scan and the open: |
| - // the pidfd names whatever holds it now. |
| - if _, _, start, err := readStat(fmt.Sprintf("/proc/%d/stat", d.pid)); err != nil || start != d.start { |
| - unix.Close(fd) |
| - continue |
| - } |
| - if err := h.signal(m, fd); err != nil { |
| + hook("retry", m.pid) |
| + if err := h.retry(m); err != nil { |
| return false, err |
| } |
| + } |
| + } |
| + |
| + d, err := os.Open("/proc") |
| + if err != nil { |
| + return false, ErrBusy |
| + } |
| + names, err := d.Readdirnames(-1) |
| + d.Close() |
| + if err != nil { |
| + return false, ErrBusy |
| + } |
| + hook("scanned", 0) |
| + for _, name := range names { |
| + pid, err := strconv.Atoi(name) |
| + if err != nil || pid <= 0 { |
| continue |
| } |
| - if !allStopped(d, fd) { |
| - settled = false |
| - // Again: a thread may have been mid-call; SIGSTOP is idempotent. |
| - if err := unix.PidfdSendSignal(fd, unix.SIGSTOP, nil, 0); err != nil && err != unix.ESRCH { |
| - return false, ErrBusy |
| - } |
| + inside, err := h.inSandbox(pid) |
| + if errors.Is(err, errVanished) { |
| + continue |
| + } |
| + if err != nil { |
| + return false, err |
| + } |
| + if !inside { |
| + continue |
| + } |
| + _, _, start, err := readStat("/proc/" + name + "/stat") |
| + if gone(err) { |
| + continue |
| + } |
| + if err != nil { |
| + return false, ErrBusy |
| + } |
| + if s, ok := known[pid]; ok && s == start { |
| + continue |
| + } |
| + fd, err := unix.PidfdOpen(pid, 0) |
| + if err == unix.ESRCH { |
| + continue // exited and reaped since the listing: runs nothing |
| + } |
| + if err != nil { |
| + return false, ErrBusy |
| + } |
| + if exited(fd) { |
| + // A zombie (its parent, stopped, cannot reap it): runs nothing. |
| + unix.Close(fd) |
| + continue |
| + } |
| + // The pid may have been reused between the reads and the open: |
| + // the pidfd names whatever holds it now. Read again through it, |
| + // and look again on the next pass if anything moved. |
| + settled = false |
| + if _, _, s, err := readStat("/proc/" + name + "/stat"); err != nil || s != start { |
| + unix.Close(fd) |
| + continue |
| + } |
| + if inside, err := h.inSandbox(pid); err != nil || !inside || exited(fd) { |
| + unix.Close(fd) |
| + continue |
| + } |
| + if err := h.signal(member{pid, start}, fd); err != nil { |
| + return false, err |
| } |
| } |
| return settled, nil |
| } |
| -// allStopped: every thread of d reads stopped or dead, or d (its pidfd |
| -// fd) has exited. Anything unreadable for another reason counts as running. |
| -func allStopped(d proc, fd int) bool { |
| - dir := fmt.Sprintf("/proc/%d/task", d.pid) |
| +// memberStopped: every thread of m reads stopped or dead, or m has exited. |
| +// It holds the lock for its pidfd's poll; anything unreadable for another |
| +// reason than the process going refuses the pause. |
| +func (h *held) memberStopped(m member) (bool, error) { |
| + h.mu.Lock() |
| + defer h.mu.Unlock() |
| + if h.resumed { |
| + return false, ErrBusy |
| + } |
| + fd, ok := h.members[m] |
| + if !ok { |
| + return false, ErrBusy |
| + } |
| + if exited(fd) { |
| + return true, nil |
| + } |
| + dir := fmt.Sprintf("/proc/%d/task", m.pid) |
| tasks, err := os.ReadDir(dir) |
| if err != nil { |
| - return exited(fd) |
| + if gone(err) && exited(fd) { |
| + return true, nil |
| + } |
| + return false, ErrBusy |
| } |
| for _, task := range tasks { |
| state, _, start, err := readStat(dir + "/" + task.Name() + "/stat") |
| - if errors.Is(err, os.ErrNotExist) { |
| + if gone(err) { |
| continue // that thread exited |
| } |
| if err != nil { |
| - return false |
| + return false, ErrBusy |
| } |
| - if task.Name() == strconv.Itoa(d.pid) && start != d.start { |
| - return exited(fd) |
| + if task.Name() == strconv.Itoa(m.pid) && start != m.start { |
| + // The pid now names another process: m has exited (its pidfd |
| + // says so; otherwise refuse). |
| + if exited(fd) { |
| + return true, nil |
| + } |
| + return false, ErrBusy |
| } |
| switch state { |
| case 'T', 't', 'Z', 'X': |
| default: |
| - return false |
| + return false, nil |
| } |
| } |
| - return true |
| + return true, nil |
| } |
| -// exited reports whether the process behind pidfd fd has exited (a pidfd |
| -// polls readable then). |
| -func exited(fd int) bool { |
| - polls := []unix.PollFd{{Fd: int32(fd), Events: unix.POLLIN}} |
| - n, err := unix.Poll(polls, 0) |
| - return err == nil && n > 0 && polls[0].Revents&unix.POLLIN != 0 |
| -} |
| +var errVanished = errors.New("process vanished") |
| -// proc is one process of the sandbox as one scan of /proc saw it. |
| -type proc struct { |
| - pid, depth int |
| - start uint64 |
| +// gone: a /proc read failed because the process (or thread) is gone. |
| +func gone(err error) bool { |
| + return errors.Is(err, fs.ErrNotExist) || errors.Is(err, unix.ESRCH) |
| } |
| -// descendants scans /proc once and returns p and every process whose |
| -// parent chain reaches it. A child counts only when it started no earlier |
| -// than its parent and its pid namespace is p's or one nested in it (as |
| -// deep as p's or deeper, by NSpid), so a pid reused while the scan reads |
| -// is not taken for a member. |
| -func descendants(p Process) ([]proc, error) { |
| - d, err := os.Open("/proc") |
| +// inSandbox places pid's pid namespace: the sandbox's, one nested below it |
| +// (by NS_GET_PARENT up to the sandbox's), or neither. A process whose |
| +// namespace cannot be read (another user's, or one of ours that is not |
| +// dumpable) is outside when it is not ours (members all run as this user) |
| +// or sits shallower than the sandbox (NSpid); otherwise the pause is |
| +// refused. errVanished: the process went while it was read. |
| +func (h *held) inSandbox(pid int) (bool, error) { |
| + path := fmt.Sprintf("/proc/%d/ns/pid", pid) |
| + link, err := os.Readlink(path) |
| + if gone(err) { |
| + return false, errVanished |
| + } |
| if err != nil { |
| - return nil, ErrBusy |
| + return h.unreadable(pid) |
| + } |
| + var ino uint64 |
| + if _, err := fmt.Sscanf(link, "pid:[%d]", &ino); err != nil { |
| + return false, ErrBusy |
| + } |
| + switch ino { |
| + case h.sandbox: |
| + return true, nil |
| + case h.ours: |
| + return false, nil |
| + } |
| + // A cached inode is pinned open, so no other namespace has it. |
| + if e, ok := h.ns[ino]; ok { |
| + return e.inside, nil |
| + } |
| + fd, err := unix.Open(path, unix.O_RDONLY|unix.O_CLOEXEC, 0) |
| + if gone(err) { |
| + return false, errVanished |
| } |
| - names, err := d.Readdirnames(-1) |
| - d.Close() |
| if err != nil { |
| - return nil, ErrBusy |
| + return h.unreadable(pid) |
| } |
| - type entry struct { |
| - ppid int |
| - start uint64 |
| + if got, err := inode(fd); err != nil || got != ino { |
| + unix.Close(fd) |
| + return false, errVanished |
| } |
| - all := map[int]entry{} |
| - children := map[int][]int{} |
| - for _, name := range names { |
| - pid, err := strconv.Atoi(name) |
| - if err != nil || pid <= 0 { |
| - continue |
| + inside, err := h.below(fd) |
| + if err != nil { |
| + unix.Close(fd) |
| + return false, err |
| + } |
| + h.ns[ino] = nsEntry{inside: inside, fd: fd} |
| + return inside, nil |
| +} |
| + |
| +// below walks NS_GET_PARENT up from the namespace fd until it reaches the |
| +// sandbox's (inside), ours or one already placed, or cannot go further |
| +// (EPERM: above ours; outside). |
| +func (h *held) below(fd int) (bool, error) { |
| + cur := fd |
| + defer func() { |
| + if cur != fd { |
| + unix.Close(cur) |
| + } |
| + }() |
| + for range 64 { |
| + parent, err := unix.IoctlRetInt(cur, unix.NS_GET_PARENT) |
| + if err == unix.EPERM { |
| + return false, nil |
| } |
| - _, ppid, start, err := readStat("/proc/" + name + "/stat") |
| if err != nil { |
| - continue // exited while the scan read |
| + return false, ErrBusy |
| } |
| - all[pid] = entry{ppid, start} |
| - children[ppid] = append(children[ppid], pid) |
| - } |
| - root, ok := all[p.PID] |
| - if !ok || root.start != p.StartTicks { |
| - return nil, ErrGone |
| - } |
| - rootDepth := nsDepth(p.PID) |
| - if rootDepth == 0 { |
| - return nil, ErrGone |
| - } |
| - tree := []proc{{pid: p.PID, start: root.start, depth: rootDepth}} |
| - for i := 0; i < len(tree); i++ { |
| - parent := tree[i] |
| - for _, c := range children[parent.pid] { |
| - e := all[c] |
| - if e.start < parent.start { |
| - continue |
| - } |
| - depth := nsDepth(c) |
| - if depth < rootDepth { |
| - continue |
| - } |
| - tree = append(tree, proc{pid: c, start: e.start, depth: depth}) |
| - if len(tree) > maxMembers { |
| - return nil, ErrBusy |
| + if cur != fd { |
| + unix.Close(cur) |
| + } |
| + cur = parent |
| + ino, err := inode(cur) |
| + if err != nil { |
| + return false, ErrBusy |
| + } |
| + switch ino { |
| + case h.sandbox: |
| + return true, nil |
| + case h.ours: |
| + return false, nil |
| + } |
| + if e, ok := h.ns[ino]; ok { |
| + return e.inside, nil |
| + } |
| + } |
| + return false, ErrBusy |
| +} |
| + |
| +// unreadable places a process whose namespace cannot be read. |
| +func (h *held) unreadable(pid int) (bool, error) { |
| + raw, err := os.ReadFile(fmt.Sprintf("/proc/%d/status", pid)) |
| + if gone(err) { |
| + return false, errVanished |
| + } |
| + if err != nil { |
| + return false, ErrBusy |
| + } |
| + for _, line := range strings.Split(string(raw), "\n") { |
| + if rest, ok := strings.CutPrefix(line, "Uid:"); ok { |
| + for _, f := range strings.Fields(rest) { |
| + if f != strconv.Itoa(h.uid) { |
| + return false, nil |
| + } |
| } |
| } |
| } |
| - return tree, nil |
| + if depth := depthOf(raw); depth > 0 && depth < h.rootDepth { |
| + return false, nil |
| + } |
| + return false, ErrBusy |
| +} |
| + |
| +func inode(fd int) (uint64, error) { |
| + var st unix.Stat_t |
| + if err := unix.Fstat(fd, &st); err != nil { |
| + return 0, err |
| + } |
| + return st.Ino, nil |
| +} |
| + |
| +// exited reports whether the process behind pidfd fd has exited (a pidfd |
| +// polls readable then). |
| +func exited(fd int) bool { |
| + polls := []unix.PollFd{{Fd: int32(fd), Events: unix.POLLIN}} |
| + n, err := unix.Poll(polls, 0) |
| + return err == nil && n > 0 && polls[0].Revents&unix.POLLIN != 0 |
| } |
| // nsDepth is how many pid namespaces pid sits in, from ours down (the |
| @@ -312,7 +557,11 @@ func nsDepth(pid int) int { |
| if err != nil { |
| return 0 |
| } |
| - for _, line := range strings.Split(string(raw), "\n") { |
| + return depthOf(raw) |
| +} |
| + |
| +func depthOf(status []byte) int { |
| + for _, line := range strings.Split(string(status), "\n") { |
| if rest, ok := strings.CutPrefix(line, "NSpid:"); ok { |
| return len(strings.Fields(rest)) |
| } |
diff --git a/internal/runner/pause/pause_linux_test.go b/internal/runner/pause/pause_linux_test.go| index 550ec124..a6f11e5b 100644 |
| --- a/internal/runner/pause/pause_linux_test.go |
| +++ b/internal/runner/pause/pause_linux_test.go |
| @@ -12,6 +12,7 @@ import ( |
| "path/filepath" |
| "strconv" |
| "sync" |
| + "syscall" |
| "testing" |
| "time" |
| @@ -124,9 +125,12 @@ func (l *lockedBuffer) String() string { |
| return l.b.String() |
| } |
| -func sizes(dir string) map[string]int64 { |
| +func sizes(dir string, names ...string) map[string]int64 { |
| + if len(names) == 0 { |
| + names = writers |
| + } |
| out := map[string]int64{} |
| - for _, w := range writers { |
| + for _, w := range names { |
| if info, err := os.Stat(filepath.Join(dir, w)); err == nil { |
| out[w] = info.Size() |
| } |
| @@ -158,13 +162,17 @@ func allGrowing(t *testing.T, dir string, within time.Duration) { |
| } |
| } |
| -// movedOver reports the writers whose files changed over d. |
| -func movedOver(dir string, d time.Duration) []string { |
| - before := sizes(dir) |
| +// movedOver reports the writers (names; all of writers when none) whose |
| +// files changed over d. |
| +func movedOver(dir string, d time.Duration, names ...string) []string { |
| + if len(names) == 0 { |
| + names = writers |
| + } |
| + before := sizes(dir, names...) |
| time.Sleep(d) |
| - after := sizes(dir) |
| + after := sizes(dir, names...) |
| var moved []string |
| - for _, w := range writers { |
| + for _, w := range names { |
| if after[w] != before[w] { |
| moved = append(moved, fmt.Sprintf("%s %d->%d", w, before[w], after[w])) |
| } |
| @@ -172,6 +180,38 @@ func movedOver(dir string, d time.Duration) []string { |
| return moved |
| } |
| +// growingFile waits until dir/name exists and grows. |
| +func growingFile(t *testing.T, dir, name string, within time.Duration) { |
| + t.Helper() |
| + before := sizes(dir, name)[name] |
| + for deadline := time.Now().Add(within); ; { |
| + if now := sizes(dir, name)[name]; now > 0 && now != before { |
| + return |
| + } |
| + if time.Now().After(deadline) { |
| + t.Fatalf("%s made no progress in %s", name, within) |
| + } |
| + time.Sleep(5 * time.Millisecond) |
| + } |
| +} |
| + |
| +// join starts the writer named name inside the sandbox's user and pid |
| +// namespaces with nsenter, from outside: a member by namespace whose |
| +// parent (nsenter) is not one. |
| +func join(t *testing.T, p Process, dir, name string) { |
| + t.Helper() |
| + nsenter, err := exec.LookPath("nsenter") |
| + if err != nil { |
| + t.Skip("no nsenter") |
| + } |
| + cmd := exec.Command(nsenter, "--target", strconv.Itoa(p.PID), "--user", "--pid", "--preserve-credentials", "--", "sh", "-c", writerBody, name) |
| + cmd.Env = []string{"PATH=/usr/bin:/bin", "DIR=" + dir} |
| + if err := cmd.Start(); err != nil { |
| + t.Fatal(err) |
| + } |
| + t.Cleanup(func() { cmd.Process.Kill(); cmd.Wait() }) |
| +} |
| + |
| func writerSandbox(t *testing.T) (Process, string) { |
| dir := t.TempDir() |
| p := sandbox(t, dir, writersScript) |
| @@ -315,20 +355,52 @@ func TestHoldLeavesNothingStopped(t *testing.T) { |
| } |
| } |
| -// stoppedIn lists the sandbox's tasks that read stopped. |
| -func stoppedIn(t *testing.T, p Process) []string { |
| +// membersOf lists the pids Hold counts as the sandbox's. |
| +func membersOf(t *testing.T, p Process) []int { |
| t.Helper() |
| - tree, err := descendants(p) |
| + h := newHeld() |
| + defer h.closeNamespaces() |
| + fd, _, err := h.pin(p) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + unix.Close(fd) |
| + d, err := os.Open("/proc") |
| if err != nil { |
| t.Fatal(err) |
| } |
| + names, _ := d.Readdirnames(-1) |
| + d.Close() |
| + var out []int |
| + for _, name := range names { |
| + pid, err := strconv.Atoi(name) |
| + if err != nil { |
| + continue |
| + } |
| + inside, err := h.inSandbox(pid) |
| + if errors.Is(err, errVanished) { |
| + continue |
| + } |
| + if err != nil { |
| + t.Fatalf("placing %d: %v", pid, err) |
| + } |
| + if inside { |
| + out = append(out, pid) |
| + } |
| + } |
| + return out |
| +} |
| + |
| +// stoppedIn lists the sandbox's tasks that read stopped. |
| +func stoppedIn(t *testing.T, p Process) []string { |
| + t.Helper() |
| var out []string |
| - for _, d := range tree { |
| - tasks, _ := os.ReadDir(fmt.Sprintf("/proc/%d/task", d.pid)) |
| + for _, pid := range membersOf(t, p) { |
| + tasks, _ := os.ReadDir(fmt.Sprintf("/proc/%d/task", pid)) |
| for _, task := range tasks { |
| - state, _, _, err := readStat(fmt.Sprintf("/proc/%d/task/%s/stat", d.pid, task.Name())) |
| + state, _, _, err := readStat(fmt.Sprintf("/proc/%d/task/%s/stat", pid, task.Name())) |
| if err == nil && (state == 'T' || state == 't') { |
| - out = append(out, strconv.Itoa(d.pid)+"/"+task.Name()) |
| + out = append(out, strconv.Itoa(pid)+"/"+task.Name()) |
| } |
| } |
| } |
| @@ -383,14 +455,14 @@ func TestPassWaitsForStopped(t *testing.T) { |
| t.Fatal(err) |
| } |
| m := member{pid, start} |
| - h := &held{members: map[member]int{m: fd}} |
| + h := plainHeld(t) |
| + h.members[m] = fd |
| defer h.resume() |
| - tree := []proc{{pid: pid, start: start, depth: 1}} |
| - if settled, err := h.pass(tree); err != nil || settled { |
| + if settled, err := h.pass(); err != nil || settled { |
| t.Fatalf("a sleeping member settled the pass: %v %v", settled, err) |
| } |
| for deadline := time.Now().Add(2 * time.Second); ; { |
| - settled, err := h.pass(tree) |
| + settled, err := h.pass() |
| if err != nil { |
| t.Fatal(err) |
| } |
| @@ -416,3 +488,196 @@ func TestPassWaitsForStopped(t *testing.T) { |
| time.Sleep(time.Millisecond) |
| } |
| } |
| + |
| +// F2: a process that joined the sandbox's namespaces from outside (its |
| +// parent is not in the sandbox) is a member and is stopped. |
| +func TestHoldStopsANamespaceJoiner(t *testing.T) { |
| + p, dir := writerSandbox(t) |
| + join(t, p, dir, "joiner") |
| + growingFile(t, dir, "joiner", 10*time.Second) |
| + var moved []string |
| + if err := Hold(p, Bound, func(time.Time) error { |
| + moved = movedOver(dir, 300*time.Millisecond, append([]string{"joiner"}, writers...)...) |
| + return nil |
| + }); err != nil { |
| + t.Fatal(err) |
| + } |
| + if len(moved) > 0 { |
| + t.Fatalf("writers ran while paused: %v", moved) |
| + } |
| + growingFile(t, dir, "joiner", 2*time.Second) |
| +} |
| + |
| +// F2, forced: the first process is held but still running when a pass |
| +// starts; after the pass lists /proc it gains a new member (as a fork |
| +// finishing late would) and stops. The listing that pass made cannot have |
| +// seen the new member, so the pass must not settle: the member is found |
| +// by a later listing and is stopped before the pause settles. |
| +func TestPassForkAfterListing(t *testing.T) { |
| + dir := t.TempDir() |
| + p := sandbox(t, dir, "exec sleep 1000") |
| + h := newHeld() |
| + defer h.closeNamespaces() |
| + fd, start, err := h.pin(p) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + h.members[member{p.PID, start}] = fd // held, not yet signalled |
| + defer h.resume() |
| + fired := false |
| + testHook = func(point string, _ int) { |
| + if point != "scanned" || fired { |
| + return |
| + } |
| + fired = true |
| + join(t, p, dir, "late") |
| + growingFile(t, dir, "late", 10*time.Second) |
| + unix.PidfdSendSignal(fd, unix.SIGSTOP, nil, 0) |
| + for deadline := time.Now().Add(2 * time.Second); ; { |
| + if state, _, _, _ := readStat(fmt.Sprintf("/proc/%d/stat", p.PID)); state == 'T' { |
| + break |
| + } |
| + if time.Now().After(deadline) { |
| + t.Fatal("the first process never stopped") |
| + } |
| + time.Sleep(time.Millisecond) |
| + } |
| + } |
| + defer func() { testHook = nil }() |
| + for deadline := time.Now().Add(5 * time.Second); ; { |
| + settled, err := h.pass() |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if settled { |
| + break |
| + } |
| + if time.Now().After(deadline) { |
| + t.Fatal("never settled") |
| + } |
| + time.Sleep(time.Millisecond) |
| + } |
| + if !fired { |
| + t.Fatal("the hook never ran") |
| + } |
| + if moved := movedOver(dir, 300*time.Millisecond, "late"); len(moved) > 0 { |
| + t.Fatalf("a member made after the listing ran while settled: %v", moved) |
| + } |
| + h.resume() |
| + growingFile(t, dir, "late", 2*time.Second) |
| +} |
| + |
| +// F2, forced: a daemon whose parent is killed while a pass lists /proc |
| +// (so it is reparented mid-scan) is still a member and is stopped. |
| +func TestHoldStopsAReparentedDaemon(t *testing.T) { |
| + dir := t.TempDir() |
| + p := sandbox(t, dir, `sh -c 'sh -c "$W" daemon & exec sleep 1000' & wait`) |
| + growingFile(t, dir, "daemon", 10*time.Second) |
| + parent := 0 |
| + for _, pid := range membersOf(t, p) { |
| + if cl, _ := os.ReadFile(fmt.Sprintf("/proc/%d/cmdline", pid)); string(cl) == "sleep\x001000\x00" { |
| + parent = pid |
| + } |
| + } |
| + if parent == 0 { |
| + t.Fatal("no intermediate parent") |
| + } |
| + fired := false |
| + testHook = func(point string, _ int) { |
| + if point == "scanned" && !fired { |
| + fired = true |
| + syscall.Kill(parent, syscall.SIGKILL) |
| + } |
| + } |
| + defer func() { testHook = nil }() |
| + var moved []string |
| + if err := Hold(p, Bound, func(time.Time) error { |
| + moved = movedOver(dir, 300*time.Millisecond, "daemon") |
| + return nil |
| + }); err != nil { |
| + t.Fatal(err) |
| + } |
| + if !fired || len(moved) > 0 { |
| + t.Fatalf("hook fired %v; the reparented daemon ran while paused: %v", fired, moved) |
| + } |
| + growingFile(t, dir, "daemon", 2*time.Second) |
| +} |
| + |
| +// F3: the watchdog resumes (and closes every pidfd) between a member's |
| +// running read and its retry SIGSTOP, and the descriptor number is reused |
| +// by a fresh pidfd for the same process. The retry must not signal: the |
| +// member keeps running. |
| +func TestRetryAfterTheWatchdogDoesNotStop(t *testing.T) { |
| + cmd := exec.Command("sleep", "30") |
| + if err := cmd.Start(); err != nil { |
| + t.Skip("no sleep") |
| + } |
| + defer func() { cmd.Process.Kill(); cmd.Wait() }() |
| + pid := cmd.Process.Pid |
| + var start uint64 |
| + for deadline := time.Now().Add(2 * time.Second); ; { |
| + state, _, s, err := readStat(fmt.Sprintf("/proc/%d/stat", pid)) |
| + if err == nil && state == 'S' { |
| + start = s |
| + break |
| + } |
| + if time.Now().After(deadline) { |
| + t.Fatalf("sleep never slept: %c %v", state, err) |
| + } |
| + time.Sleep(time.Millisecond) |
| + } |
| + fd, err := unix.PidfdOpen(pid, 0) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + h := plainHeld(t) |
| + h.members[member{pid, start}] = fd |
| + reused := -1 |
| + testHook = func(point string, _ int) { |
| + if point == "retry" { |
| + h.resume() |
| + reused, _ = unix.PidfdOpen(pid, 0) |
| + } |
| + } |
| + defer func() { testHook = nil; unix.Close(reused) }() |
| + if _, err := h.pass(); !errors.Is(err, ErrBusy) { |
| + t.Fatalf("pass after resume: %v", err) |
| + } |
| + time.Sleep(50 * time.Millisecond) |
| + if state, _, _, _ := readStat(fmt.Sprintf("/proc/%d/stat", pid)); state == 'T' { |
| + t.Fatalf("stopped after the sandbox was resumed (reused descriptor %d, first %d)", reused, fd) |
| + } |
| +} |
| + |
| +// F5: a copy that runs past the deadline while the watchdog has not run |
| +// (delayed here) is still refused, and the sandbox is resumed. |
| +func TestHoldBusyWhenTheWatchdogIsLate(t *testing.T) { |
| + p, dir := writerSandbox(t) |
| + afterFunc = func(time.Duration, func()) *time.Timer { return time.AfterFunc(time.Hour, func() {}) } |
| + defer func() { afterFunc = time.AfterFunc }() |
| + err := Hold(p, 300*time.Millisecond, func(deadline time.Time) error { |
| + time.Sleep(time.Until(deadline) + 50*time.Millisecond) |
| + return nil |
| + }) |
| + if !errors.Is(err, ErrBusy) { |
| + t.Fatalf("an overdue copy: %v", err) |
| + } |
| + allGrowing(t, dir, 2*time.Second) |
| +} |
| + |
| +// plainHeld is a held for members outside any sandbox (plain test |
| +// processes): no namespace counts as the sandbox's, so a pass's listing |
| +// adds nothing and only its retained members matter. |
| +func plainHeld(t *testing.T) *held { |
| + t.Helper() |
| + h := newHeld() |
| + self, err := unix.Open("/proc/self/ns/pid", unix.O_RDONLY|unix.O_CLOEXEC, 0) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + h.ours, _ = inode(self) |
| + unix.Close(self) |
| + h.rootDepth = 1 << 20 |
| + t.Cleanup(h.closeNamespaces) |
| + return h |
| +} |
diff --git a/internal/runner/thin/worksnap_adversary_linux_test.go b/internal/runner/thin/worksnap_adversary_linux_test.go| new file mode 100644 |
| index 00000000..0ca82f45 |
| --- /dev/null |
| +++ b/internal/runner/thin/worksnap_adversary_linux_test.go |
| @@ -0,0 +1,374 @@ |
| +//go:build linux |
| + |
| +package thin |
| + |
| +import ( |
| + "errors" |
| + "fmt" |
| + "os" |
| + "path/filepath" |
| + "strconv" |
| + "sync/atomic" |
| + "testing" |
| + "time" |
| + "unsafe" |
| + |
| + "golang.org/x/sys/unix" |
| +) |
| + |
| +// Adversaries a sandbox may run against the pause (Astra task 9 round 1, |
| +// F1 and F4). The pause does not stop them; the copy must then refuse with |
| +// busy, by its check that nothing it read changed while it was made. |
| +// |
| +// The helpers run as this test binary, started inside the test's sandbox |
| +// with EQUIPO_WORKSNAP_HELPER naming one; init runs them before any test. |
| +func init() { |
| + switch os.Getenv("EQUIPO_WORKSNAP_HELPER") { |
| + case "": |
| + return |
| + case "selfcont": |
| + helperSelfCont(os.Getenv("FILE")) |
| + case "uring": |
| + helperURing(os.Getenv("FILE"), os.Getenv("READY")) |
| + } |
| + os.Exit(2) |
| +} |
| + |
| +// helperSelfCont arms a POSIX timer that sends this process SIGCONT every |
| +// millisecond, then overwrites FILE (same size, a new count) about every |
| +// 200 microseconds: stopped, it resumes itself. |
| +func helperSelfCont(file string) { |
| + var ev [64]byte // struct sigevent: value (8), signo (4), notify (4: SIGEV_SIGNAL = 0) |
| + *(*int32)(unsafe.Pointer(&ev[8])) = int32(unix.SIGCONT) |
| + var id int32 |
| + if _, _, e := unix.Syscall(unix.SYS_TIMER_CREATE, uintptr(unix.CLOCK_MONOTONIC), uintptr(unsafe.Pointer(&ev[0])), uintptr(unsafe.Pointer(&id))); e != 0 { |
| + os.Exit(3) |
| + } |
| + spec := [4]int64{0, 1_000_000, 0, 1_000_000} // interval, value |
| + if _, _, e := unix.Syscall6(unix.SYS_TIMER_SETTIME, uintptr(id), 0, uintptr(unsafe.Pointer(&spec[0])), 0, 0, 0); e != 0 { |
| + os.Exit(4) |
| + } |
| + f, err := os.OpenFile(file, os.O_WRONLY, 0) |
| + if err != nil { |
| + os.Exit(5) |
| + } |
| + for i := 0; ; i++ { |
| + f.WriteAt([]byte(fmt.Sprintf("%08d", i%100000000)), 0) |
| + time.Sleep(200 * time.Microsecond) |
| + } |
| +} |
| + |
| +// io_uring, by raw system calls (golang.org/x/sys has no ring types). |
| +type uringParams struct { |
| + sqEntries, cqEntries, flags, sqThreadCPU, sqThreadIdle, features, wqFd uint32 |
| + resv [3]uint32 |
| + sq struct { |
| + head, tail, ringMask, ringEntries, flags, dropped, array, resv1 uint32 |
| + userAddr uint64 |
| + } |
| + cq struct { |
| + head, tail, ringMask, ringEntries, overflow, cqes, flags, resv1 uint32 |
| + userAddr uint64 |
| + } |
| +} |
| + |
| +type uringSQE struct { |
| + opcode, flags uint8 |
| + ioprio uint16 |
| + fd int32 |
| + off, addr uint64 |
| + len, rwFlags uint32 |
| + userData uint64 |
| + bufIndex, personality uint16 |
| + spliceFdIn int32 |
| + addr3, pad uint64 |
| +} |
| + |
| +const ( |
| + uringOpWrite = 23 |
| + uringSQELink = 1 << 2 |
| + uringSQEAsync = 1 << 4 |
| + uringGetEvents = 1 |
| + uringChain = 128 |
| + uringBlock = 64 << 10 |
| +) |
| + |
| +// helperURing writes READY ("ok" or "unavailable"), then keeps submitting |
| +// chains of linked asynchronous O_DSYNC overwrites of FILE's first 64 KiB |
| +// (its size never changes) and waiting for each: work the kernel's io-wq |
| +// workers carry on with after the submitting thread stops. |
| +func helperURing(file, ready string) { |
| + say := func(s string) { os.WriteFile(ready, []byte(s), 0o600) } |
| + var p uringParams |
| + ring, _, e := unix.Syscall(unix.SYS_IO_URING_SETUP, uringChain, uintptr(unsafe.Pointer(&p)), 0) |
| + if e != 0 { |
| + say("unavailable: io_uring_setup: " + e.Error()) |
| + select {} |
| + } |
| + fd := int(ring) |
| + sqRing, err1 := unix.Mmap(fd, 0, int(p.sq.array+p.sqEntries*4), unix.PROT_READ|unix.PROT_WRITE, unix.MAP_SHARED|unix.MAP_POPULATE) |
| + cqRing, err2 := unix.Mmap(fd, 0x8000000, int(p.cq.cqes+p.cqEntries*16), unix.PROT_READ|unix.PROT_WRITE, unix.MAP_SHARED|unix.MAP_POPULATE) |
| + sqes, err3 := unix.Mmap(fd, 0x10000000, int(p.sqEntries)*int(unsafe.Sizeof(uringSQE{})), unix.PROT_READ|unix.PROT_WRITE, unix.MAP_SHARED|unix.MAP_POPULATE) |
| + target, err4 := unix.Open(file, unix.O_WRONLY|unix.O_DSYNC|unix.O_CLOEXEC, 0) |
| + if err := errors.Join(err1, err2, err3, err4); err != nil { |
| + say("unavailable: " + err.Error()) |
| + select {} |
| + } |
| + u32 := func(b []byte, off uint32) *uint32 { return (*uint32)(unsafe.Pointer(&b[off])) } |
| + sqTail, sqMask, sqArray := u32(sqRing, p.sq.tail), *u32(sqRing, p.sq.ringMask), p.sq.array |
| + cqHead, cqTail := u32(cqRing, p.cq.head), u32(cqRing, p.cq.tail) |
| + buf := make([]byte, uringBlock) |
| + for round := 0; ; round++ { |
| + for i := range buf { |
| + buf[i] = byte('a' + round%26) |
| + } |
| + tail := atomic.LoadUint32(sqTail) |
| + for i := uint32(0); i < uringChain; i++ { |
| + slot := (tail + i) & sqMask |
| + sqe := (*uringSQE)(unsafe.Pointer(&sqes[uintptr(slot)*unsafe.Sizeof(uringSQE{})])) |
| + *sqe = uringSQE{opcode: uringOpWrite, flags: uringSQEAsync, fd: int32(target), addr: uint64(uintptr(unsafe.Pointer(&buf[0]))), len: uringBlock} |
| + if i < uringChain-1 { |
| + sqe.flags |= uringSQELink |
| + } |
| + *u32(sqRing, sqArray+slot*4) = slot |
| + } |
| + atomic.StoreUint32(sqTail, tail+uringChain) |
| + if _, _, e := unix.Syscall6(unix.SYS_IO_URING_ENTER, uintptr(fd), uringChain, 0, 0, 0, 0); e != 0 { |
| + say("unavailable: io_uring_enter: " + e.Error()) |
| + select {} |
| + } |
| + if round == 0 { |
| + say("ok") |
| + } |
| + // Wait for the whole chain, then consume its completions. |
| + if _, _, e := unix.Syscall6(unix.SYS_IO_URING_ENTER, uintptr(fd), 0, uringChain, uringGetEvents, 0, 0); e != 0 && e != unix.EINTR { |
| + os.Exit(6) |
| + } |
| + atomic.StoreUint32(cqHead, atomic.LoadUint32(cqTail)) |
| + _ = runtimeKeep(buf) |
| + } |
| +} |
| + |
| +//go:noinline |
| +func runtimeKeep(b []byte) int { return len(b) } |
| + |
| +// adversarySnapshots runs snapshots while the adversary writes into |
| +// site/page.bin; each must be busy whenever the page changed while the |
| +// copy was made (seen from inside the pause by the workCopied seam). It |
| +// returns how many saw a change. |
| +func adversarySnapshots(t *testing.T, h *sandboxHandle, ws string, rounds int) (changed, busy int) { |
| + t.Helper() |
| + page := filepath.Join(ws, "site/page.bin") |
| + var moved bool |
| + workCopied = func() { |
| + before, _ := os.Stat(page) |
| + time.Sleep(150 * time.Millisecond) |
| + after, _ := os.Stat(page) |
| + moved = before == nil || after == nil || !before.ModTime().Equal(after.ModTime()) |
| + } |
| + defer func() { workCopied = nil }() |
| + for i := range rounds { |
| + moved = false |
| + stage := filepath.Join(t.TempDir(), "stage"+strconv.Itoa(i)) |
| + _, err := h.snapshot(ws, stage, "") |
| + if moved { |
| + changed++ |
| + } |
| + if errors.Is(err, errWorkBusy) { |
| + busy++ |
| + continue |
| + } |
| + if err != nil { |
| + t.Fatalf("round %d: %v", i, err) |
| + } |
| + if moved { |
| + t.Fatalf("round %d: the page changed while the copy was made, and the copy was accepted", i) |
| + } |
| + } |
| + return changed, busy |
| +} |
| + |
| +func adversaryTree(t *testing.T) string { |
| + files := siteFiles() |
| + files["site/page.bin"] = string(make([]byte, uringBlock)) |
| + return workTree(t, files, nil) |
| +} |
| + |
| +func helperSandbox(t *testing.T, env ...string) *sandboxHandle { |
| + t.Helper() |
| + self, err := os.Executable() |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + r := stepSandbox(t, append([]string{"BIN=" + self}, env...), `exec "$BIN" -test.run=NONE`) |
| + h := &sandboxHandle{} |
| + h.keep(r) |
| + return h |
| +} |
| + |
| +// waitMoving waits until file's mtime moves. |
| +func waitMoving(t *testing.T, file string) { |
| + t.Helper() |
| + first, _ := os.Stat(file) |
| + for deadline := time.Now().Add(10 * time.Second); ; { |
| + if now, err := os.Stat(file); err == nil && first != nil && !now.ModTime().Equal(first.ModTime()) { |
| + return |
| + } |
| + if time.Now().After(deadline) { |
| + t.Fatal("the adversary never wrote") |
| + } |
| + time.Sleep(5 * time.Millisecond) |
| + } |
| +} |
| + |
| +// F1: a process that resumes itself with a SIGCONT timer and overwrites |
| +// a page (same size) during the copy: every copy it changes is refused. |
| +func TestSnapshotRefusesASelfResumingWriter(t *testing.T) { |
| + ws := adversaryTree(t) |
| + page := filepath.Join(ws, "site/page.bin") |
| + h := helperSandbox(t, "EQUIPO_WORKSNAP_HELPER=selfcont", "FILE="+page) |
| + waitMoving(t, page) |
| + changed, busy := adversarySnapshots(t, h, ws, 5) |
| + t.Logf("%d of 5 copies saw the page change; %d refused busy", changed, busy) |
| + if changed == 0 { |
| + t.Fatal("the self-resuming writer never wrote during a copy: the test proves nothing") |
| + } |
| +} |
| + |
| +// F1: two processes that SIGCONT each other and stop themselves, one |
| +// overwriting the page each turn: every copy they change is refused, and |
| +// a copy they do not change is accepted. |
| +func TestSnapshotRefusesSIGCONTPeers(t *testing.T) { |
| + ws := adversaryTree(t) |
| + page := filepath.Join(ws, "site/page.bin") |
| + d := t.TempDir() |
| + peer := `echo $$ > "$D/$0.pid"; while [ ! -s "$D/$1.pid" ]; do :; done; read other < "$D/$1.pid"; i=0 |
| +while :; do kill -CONT $other; if [ "$0" = a ]; then i=$((i+1)); printf '%08d' $i 1<> "$PAGE"; fi; kill -STOP $$; done` |
| + r := stepSandbox(t, []string{"D=" + d, "PAGE=" + page, "P=" + peer}, `sh -c "$P" a b & sh -c "$P" b a & wait`) |
| + h := &sandboxHandle{} |
| + h.keep(r) |
| + waitMoving(t, page) |
| + changed, busy := adversarySnapshots(t, h, ws, 5) |
| + // Each copy is busy or saw no change (adversarySnapshots). Here the |
| + // pause's repeated SIGSTOPs usually catch both peers stopped at once, |
| + // after which neither can resume the other: then nothing changes. |
| + t.Logf("%d of 5 copies saw the page change; %d refused busy", changed, busy) |
| +} |
| + |
| +// F4: asynchronous writes (io_uring, linked O_DSYNC overwrites punted to |
| +// the kernel's workers) submitted before the pause and completing during |
| +// the copy: every copy they change is refused. Skipped where io_uring |
| +// is unavailable. (On 6.12 the chain does not advance while the |
| +// submitting process is stopped, so the copies see no change.) |
| +func TestSnapshotRefusesAsyncWrites(t *testing.T) { |
| + ws := adversaryTree(t) |
| + page := filepath.Join(ws, "site/page.bin") |
| + ready := filepath.Join(t.TempDir(), "ready") |
| + h := helperSandbox(t, "EQUIPO_WORKSNAP_HELPER=uring", "FILE="+page, "READY="+ready) |
| + for deadline := time.Now().Add(10 * time.Second); ; { |
| + raw, _ := os.ReadFile(ready) |
| + if string(raw) == "ok" { |
| + break |
| + } |
| + if len(raw) > 0 { |
| + t.Skipf("io_uring is unavailable here: %s", raw) |
| + } |
| + if time.Now().After(deadline) { |
| + t.Fatal("the io_uring helper never started") |
| + } |
| + time.Sleep(5 * time.Millisecond) |
| + } |
| + waitMoving(t, page) |
| + changed, busy := adversarySnapshots(t, h, ws, 5) |
| + t.Logf("%d of 5 copies saw the page change; %d refused busy", changed, busy) |
| +} |
| + |
| +// The copy's own check, driven from inside it (the workCopied seam runs |
| +// once every file is copied): any change to what it read refuses with |
| +// busy, a same-size overwrite whose mtime is put back (only ctime shows |
| +// it) included; and a deadline passing during the copy refuses too. |
| +func TestWorkSiteRefusesAChangeDuringTheCopy(t *testing.T) { |
| + restored := func(path string, write func()) func() { |
| + return func() { |
| + info, err := os.Stat(path) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + time.Sleep(20 * time.Millisecond) // past the timestamp granularity |
| + write() |
| + if err := os.Chtimes(path, info.ModTime(), info.ModTime()); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + } |
| + for name, change := range map[string]func(ws string) func(){ |
| + "a same-size overwrite, mtime put back": func(ws string) func() { |
| + p := filepath.Join(ws, "site/index.html") |
| + return restored(p, func() { os.WriteFile(p, []byte("<h1>HOME</h1>"), 0o644) }) |
| + }, |
| + "a new file in a directory": func(ws string) func() { |
| + return func() { os.WriteFile(filepath.Join(ws, "site/a/b/new.html"), []byte("x"), 0o644) } |
| + }, |
| + "a file removed": func(ws string) func() { |
| + return func() { os.Remove(filepath.Join(ws, "site/a/b/c/d.css")) } |
| + }, |
| + "preview.json rewritten, mtime put back": func(ws string) func() { |
| + p := filepath.Join(ws, "release/preview.json") |
| + return restored(p, func() { os.WriteFile(p, []byte(`{"output": "sitf"}`), 0o644) }) |
| + }, |
| + } { |
| + ws := workTree(t, siteFiles(), nil) |
| + workCopied = change(ws) |
| + _, _, err := copySite(t, ws, "") |
| + workCopied = nil |
| + if !errors.Is(err, errWorkBusy) { |
| + t.Errorf("%s: %v", name, err) |
| + } |
| + } |
| + // Nothing changed: accepted. |
| + ws := workTree(t, siteFiles(), nil) |
| + workCopied = func() { time.Sleep(20 * time.Millisecond) } |
| + _, _, err := copySite(t, ws, "") |
| + workCopied = nil |
| + if err != nil { |
| + t.Fatalf("an unchanged tree: %v", err) |
| + } |
| + // The deadline passes while the copy is being made. |
| + st, err := openSiteStage(filepath.Join(t.TempDir(), "stage")) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer st.close() |
| + deadline := time.Now().Add(time.Second) |
| + workCopied = func() { time.Sleep(time.Until(deadline) + 10*time.Millisecond) } |
| + defer func() { workCopied = nil }() |
| + if _, err := copyWorkSite(ws, st, "", deadline); !errors.Is(err, errWorkBusy) { |
| + t.Fatalf("a copy past its deadline: %v", err) |
| + } |
| +} |
| + |
| +// A directory whose names differ from the walk's is refused even when its |
| +// times are equal (a change within the same timestamp tick): unchanged |
| +// compares the names, here given as the walk would have seen them before |
| +// one file appeared. |
| +func TestWorkSiteUnchangedComparesNames(t *testing.T) { |
| + ws := workTree(t, siteFiles(), nil) |
| + w, err := openWorkRoot(ws) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer w.close() |
| + st, err := w.stat("site/a/b") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + seen := map[string]unix.Stat_t{"site/a/b": st} |
| + if err := w.unchanged(seen, map[string][]string{"site/a/b": {"c"}}); err != nil { |
| + t.Fatalf("the same names: %v", err) |
| + } |
| + for name, before := range map[string][]string{"one more now": {}, "one fewer now": {"c", "gone.html"}, "renamed": {"d"}} { |
| + if err := w.unchanged(seen, map[string][]string{"site/a/b": before}); !errors.Is(err, errWorkBusy) { |
| + t.Errorf("%s: %v", name, err) |
| + } |
| + } |
| +} |
diff --git a/internal/runner/thin/worksnap_linux.go b/internal/runner/thin/worksnap_linux.go| index 5ecf59e9..401812dd 100644 |
| --- a/internal/runner/thin/worksnap_linux.go |
| +++ b/internal/runner/thin/worksnap_linux.go |
| @@ -7,6 +7,7 @@ import ( |
| "io" |
| "os" |
| "path" |
| + "slices" |
| "sort" |
| "strings" |
| "time" |
| @@ -106,18 +107,58 @@ func (w workRoot) readFile(rel string, want unix.Stat_t, limit int64) ([]byte, e |
| if err := unix.Fstat(fd, &st); err != nil || st.Mode&unix.S_IFMT != unix.S_IFREG || st.Dev != want.Dev || st.Ino != want.Ino { |
| return nil, errPreviewConfig |
| } |
| - if st.Size < 0 || st.Size > limit || st.Size != want.Size { |
| + if st.Size < 0 || st.Size > limit { |
| return nil, errPreviewTooLarge |
| } |
| + if !sameFile(st, want) { |
| + // Changed since the walk saw it, while the step is paused. |
| + return nil, errWorkBusy |
| + } |
| buf := make([]byte, st.Size+1) |
| n, err := io.ReadFull(fdReader(fd), buf) |
| if err != io.ErrUnexpectedEOF && err != io.EOF || int64(n) != st.Size { |
| // A file that is not the size it said, while the step is paused. |
| - return nil, errPreviewTooLarge |
| + return nil, errWorkBusy |
| } |
| return buf[:n], nil |
| } |
| +// sameFile: the same inode, unchanged: device, inode, type and mode, |
| +// size, mtime and ctime (ctime moves on any write or change, a same-size |
| +// overwrite included, to the file system's timestamp granularity). |
| +func sameFile(a, b unix.Stat_t) bool { |
| + return a.Dev == b.Dev && a.Ino == b.Ino && a.Mode == b.Mode && a.Size == b.Size && |
| + a.Mtim == b.Mtim && a.Ctim == b.Ctim |
| +} |
| + |
| +// workCopied is called inside the pause once every file is copied, before |
| +// the copy checks nothing moved (a seam for the tests; nil in production). |
| +var workCopied func() |
| + |
| +// unchanged stats every path the copy read again, still inside the pause, |
| +// and lists every directory again, and refuses with errWorkBusy if |
| +// anything differs from what the walk saw: the defence against what the |
| +// pause cannot stop (see pause.Hold). Times move by the file system's |
| +// tick (coarse, a few milliseconds), so a change within the same tick as |
| +// the inode's last one shows only in a directory's names, not in a file's |
| +// times. |
| +func (w workRoot) unchanged(seen map[string]unix.Stat_t, listed map[string][]string) error { |
| + for rel, want := range seen { |
| + got, err := w.stat(rel) |
| + if err != nil || !sameFile(got, want) { |
| + return errWorkBusy |
| + } |
| + } |
| + for dir, want := range listed { |
| + budget := len(want) |
| + got, err := w.names(dir, &budget) |
| + if err != nil || !slices.Equal(slices.Sorted(slices.Values(got)), slices.Sorted(slices.Values(want))) { |
| + return errWorkBusy |
| + } |
| + } |
| + return nil |
| +} |
| + |
| type fdReader int |
| func (f fdReader) Read(p []byte) (int, error) { |
| @@ -189,7 +230,13 @@ func copyWorkSite(workspace string, st *siteStage, headers string, deadline time |
| if err != nil || cst.Mode&unix.S_IFMT != unix.S_IFREG { |
| return previewExport{}, errPreviewConfig |
| } |
| + // seen is every path read (the config, each directory listed, each |
| + // file copied), checked again once the copy is made. |
| + seen := map[string]unix.Stat_t{previewConfigPath: cst} |
| raw, err := w.readFile(previewConfigPath, cst, previewMaxConfig) |
| + if errors.Is(err, errWorkBusy) { |
| + return previewExport{}, err |
| + } |
| if err != nil { |
| return previewExport{}, errPreviewConfig |
| } |
| @@ -210,9 +257,12 @@ func copyWorkSite(workspace string, st *siteStage, headers string, deadline time |
| // takes.) This bounds what one listing holds in memory. |
| names := previewMaxFiles + previewMaxDirs |
| dirs := 0 |
| - if ost, err := w.stat(output); err != nil || ost.Mode&unix.S_IFMT != unix.S_IFDIR { |
| + ost, err := w.stat(output) |
| + if err != nil || ost.Mode&unix.S_IFMT != unix.S_IFDIR { |
| return previewExport{}, errPreviewConfig |
| } |
| + seen[output] = ost |
| + listed := map[string][]string{} |
| pending := []string{""} |
| for len(pending) > 0 { |
| if late() { |
| @@ -224,6 +274,7 @@ func copyWorkSite(workspace string, st *siteStage, headers string, deadline time |
| if err != nil { |
| return previewExport{}, err |
| } |
| + listed[path.Join(output, dir)] = list |
| for _, name := range list { |
| rel := path.Join(dir, name) |
| if strings.Count(rel, "/")+1 > previewMaxDepth { |
| @@ -242,6 +293,7 @@ func copyWorkSite(workspace string, st *siteStage, headers string, deadline time |
| if dirs++; dirs > previewMaxDirs { |
| return previewExport{}, errPreviewTooLarge |
| } |
| + seen[output+"/"+rel] = est |
| pending = append(pending, rel) |
| case unix.S_IFREG: |
| if skip { |
| @@ -251,6 +303,7 @@ func copyWorkSite(workspace string, st *siteStage, headers string, deadline time |
| return previewExport{}, err |
| } |
| entries = append(entries, entry{rel, est}) |
| + seen[output+"/"+rel] = est |
| default: |
| // A link, a FIFO, a socket, a device: never followed. |
| return previewExport{}, errPreviewConfig |
| @@ -278,5 +331,14 @@ func copyWorkSite(workspace string, st *siteStage, headers string, deadline time |
| return previewExport{}, err |
| } |
| } |
| + if workCopied != nil { |
| + workCopied() |
| + } |
| + if err := w.unchanged(seen, listed); err != nil { |
| + return previewExport{}, err |
| + } |
| + if late() { |
| + return previewExport{}, errWorkBusy |
| + } |
| return previewExport{Digest: st.digest(), Files: len(entries), Bytes: budget.bytes}, nil |
| } |