Repository navigation
fix(gateway): A confined grant worker cannot start a process by clone3 - #30
Merged
Merged
Conversation
The allow-list answers clone3 with ENOSYS, so the C library starts threads with clone, whose flags the filter checks for CLONE_THREAD. ADR 0002 records it as the one call outside the allow-list that does not kill. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ames its exception (#28) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This was referenced Nov 20, 2026
sodre
marked this pull request as ready for review
November 20, 2026 03:50
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #28
Summary
A compromised grant worker can no longer start a second process with
clone3. Operators change nothing: grant workers serve connections on threads as before.Choices the ticket left open:
ENOSYS, not "keepclone3". The ticket asked for the decision. Under the filter sandbox a second process would outlive the supervisor's kill of the grant worker and keep the grant's streams, so allowing it has no good reason to record. ADR 0002 holds the decision and supersedes ADR 0001's decision 5 for this one call. It is written asaccepted; merging this is the acceptance.no-clone3test setup stays. The allow-list now gives the answer that setup stood in for, so its three tests overlap the confined ones. It is kept because it runs the whole containment test as on a host withoutclone3(Docker's default profile, where Operators can choose the filter sandbox #23 will run it).Extras for the owner
mainon an arm64 workstation.runtime.py:331(assert site.cutoff.wait(1), the shared-mode cutoff on a retirement notice) failed in 7 of 8 runs oforigin/main's own build, and in 5 of 6 on this branch, on an aarch64 host (kernel 6.17, load average about 5). No source settles it.main, not from this change, and needs its own diagnosis: a slow cutoff or a one-second budget too tight for a busy host)Evidence
clone3docs/adr/0002-…, read by the test "Starting a process byclone3fails as unsupported", which asserts theENOSYSthe ADR decidesENOSYS: a confined grant worker cannot start a new process byclone3, shown by the containment test with a rawclone3call withoutCLONE_THREAD, and its threads still workclone3fails as unsupportedworkspace (ubuntu-latest)(containment test, x86-64),curl(runtime test, x86-64),gateway-arm64(both, arm64)clone3fails as unsupported (starting_another_process_by_clone3_fails_as_unsupported)left: GotThrough, right: Errno(38),22 passed, 1 failedclone3no-clone3setup (<test> stand-in no-clone3 <test> run):stand-in 0, clone3: expected success, got Errno(38),22 passed, 1 failedthis host has no clone3: the call fails unconfined too,23 passed, 0 failedAll on arm64, glibc 2.39, kernel 6.17, at ea413ce:
cargo test --locked -p countersign-gateway: containment test 23 passed, 0 failed (includingits_stream_arrives_and_its_threads_work, whose thread now starts byclone); the other suites 13 passed, 0 failed, 0 ignored.cargo clippy -p countersign-gateway --all-targets --locked -- -D warningsandcargo fmt --all -- --check: clean.python3 crates/countersign-gateway/tests/runtime.py target/debug/countersign-gateway, the real Gateway under the namespace sandbox: passed once at 936db20 (sidecar Gateway mTLS passed,shared Gateway mTLS passed,filter-killed grant worker fenced) and once in six runs at ea413ce. The other five failed atruntime.py:331, aftersidecar Gateway mTLS passed.origin/mainbuilt apart fails the same line in 7 of 8 runs (see the extra).This pull request's CI at ea413ce, runs 44666958013 (CI) and 44666957972 (Sidecar mTLS):
workspace (ubuntu-latest)rancargo test --workspace --lockedon x86-64,curlranruntime.pyon x86-64, andgateway-arm64rancargo test -p countersign-gatewayandruntime.pyon arm64. All passed, as did every other job.Not run: nothing. The runtime test's failures on the arm64 workstation are carried over to #32.
Merge Danger
Door: two-way. A revert allows
clone3again; nothing stored changes.Blast Radius: every grant worker's thread start.
The merge changes the Gateway binary and so its image at the next release. No configuration, flag or infrastructure changes. A C library that does not fall back from
clone3tocloneonENOSYScould not start threads in a grant worker; glibc and musl both do.Reviews
Correctness, Standards, Spec and Security, two rounds: 6 findings, all fixed
Round 1 pinned 936db20; round 2, the fix round, pinned ea413ce and found nothing under any heading. Security was read in the session against the diff, without the bundled review's sub-tasks, and found nothing in either round.
Correctness, round 1
clone3to succeed, so it fails on a host that refusesclone3itself. Fixed: the test notes such a host and skips the baseline, shown red and green under theno-clone3setup.no-clone3setup and its three tests now overlap the confined ones, and its doc called it a Docker-only quirk. Fixed: the doc says what the setup still covers; the tests stay.allow_list()'s doc comment still said every call outside it kills. Fixed: it names theclone3exception and ADR 0002.each_of_twoby hand and lost its messages. Fixed: it callseach_of_two.Standards, round 1
no-clone3setup of finding 2. Fixed: the doc says what the setup still covers.Tracking
Epic: E1 Run grant workers in a filter sandbox on hosts without namespaces
Spec: #21 Run grant workers in a filter sandbox on hosts without namespaces
Ticket: #28 The allow-list tells a thread from a new process under clone3
Flag: none
🤖 Generated with Claude Code