Skip to content

fix(containment): permit pselect6 so cargo can download crates - #455

Merged
opieter-aws merged 4 commits into
mainfrom
feature/seccomp-pselect6
Nov 13, 2026
Merged

opieter-aws merged 4 commits into
mainfrom
feature/seccomp-pselect6

Conversation

@opieter-aws

Copy link
Copy Markdown
Contributor

Description

In a box on Linux, cargo cannot download anything. cargo add and cargo build stop with Unrecoverable error in select/poll. The libcurl that cargo vendors waits on its sockets with select(). glibc issues that as pselect6 on ARM64, and the permit filter refuses pselect6 with EPERM. curl treats any error other than EINTR as fatal.

This change adds pselect6 to WORKLOAD_PERMITTED on every architecture, and select on x86-64, both unrestricted.

  • What the operator gets: cargo can fetch the crates.io index and download crates in a Linux box.
  • Why it is safe: both calls only wait on descriptors the process already holds, as the permitted ppoll and epoll_pwait do. No reach is added.
  • Why x86 select too: x86-64 has a separate select call. Whether glibc there issues select or pselect6 was not checked, so both are permitted. The new filtered test runs raw select on x86 CI.
  • Interfaces and premises: none change.
  • Decisions: none. The containment AGENTS.md records the measurement under "Select waits".
  • Docs: crates/containment/AGENTS.md. No user page lists the permit table.

Related Issues

None.

Type of Change

Bug fix

Testing

Check Without the permit With the permit
select_waits_on_held_descriptors_under_the_filters (glibc select(), raw pselect6, raw x86 select on a readable pipe) fails, code 10 (glibc select() gets EPERM) passes
select_waits_are_permitted_and_unmediated fails passes
strace -f of cargo add serde in a box pselect6(...) = -1 EPERM, then Unrecoverable error in select/poll exit 0, crates in the registry cache
staging-boxy corpus cell RS-02 (cargo add clap, serde, serde_json, csv, then cargo test) Unrecoverable error in select/poll, permits=1 index updated and 27 crates downloaded, permits=230, denies=0; then stops at linker `cc` not found
  • The box runs were on ARM64 Amazon Linux 2023, with staging-boxy main (a090903) built against this branch (9d2896a0).
  • cargo fmt --check, cargo clippy --workspace --all-targets --all-features -D warnings and cargo test --workspace --all-features pass. On the busy test host, mcp_alias_fallback (Text file busy) and one policy timing test failed in the parallel run. Both passed on one thread, and neither touches seccomp.
  • Not run locally: x86-64. CI covers it.

Still blocked

  • RS-02 next stops at linker `cc` not found. The cc helper's grant names only the resolved compiler, so the /usr/bin/cc symlink is missing in the box. That is a separate fix.

Checklist

  • I have read the CONTRIBUTING document
  • I have reviewed and understand every line of code in this PR, including any generated by AI tools, and I can explain why it works
  • My change is focused and reasonably small; I have split unrelated work into separate PRs

Comment thread crates/containment/AGENTS.md Resolved
@github-actions

Copy link
Copy Markdown

Assessment: Comment

The pselect6 fix is correct and narrow: it covers the measured cargo failure on ARM64 and the path glibc 2.33+ takes on x86. The one finding is about evidence. The x86 select entry needs the source citation that the containment permit rule asks for (see the inline comment). The code does not need to change.

Checked and held
  • pselect6 adds no reach. It waits only on descriptors the process already holds. Its sigmask argument does no more than the permitted ppoll and rt_sigprocmask already do.
  • All pselect6 callers are covered: ARM64 glibc select() (cargo/libcurl), x86 glibc 2.33+ select() (checked locally on 2.43), and raw callers.
  • The table counts (115 + 18x, 118 + 19x) are correct. Both new tests and the count test pass on x86-64.
  • The probe exit codes are unique, and none collides with the filter-install code 40.
  • No frozen surface or root premise changes. The rationale is recorded in the containment AGENTS.md, following the waitid precedent.
  • No API review is needed, because this is an internal seccomp table.

The strace evidence and the RS-02 table make the ARM64 fix easy to verify.

@github-actions

Copy link
Copy Markdown

Assessment: Approve (posted as a comment)

Re-reviewed at 253695b. The only changes since 9d2896a are the evidence for select in the containment AGENTS.md and one code comment. The permit table and the tests did not change. The earlier finding is fixed. One small wording suggestion about dynamic and static linking is in the existing thread, and it does not block the merge.

Checked and held
  • The containment permit rule ("measured evidence and a compatibility rationale") is met. pselect6 has a measured trace, and x86 select cites the glibc source and the kernel's shared core_sys_select.
  • The doc no longer claims that the raw test rows show a caller needs these calls.
  • select_waits_on_held_descriptors_under_the_filters, select_waits_are_permitted_and_unmediated, and the permit count test pass at this head on x86-64 with glibc 2.43.
  • No frozen surface or root premise changes.

@github-actions

Copy link
Copy Markdown

Assessment: Approve (posted as a comment)

Re-reviewed at 9f97c71. This head rebases 253695b onto main (f40db21, #451 copy_file_range/sendfile). Measured against main, the PR's changes are the same as before. The only difference is the permit-count baselines, which moved to include #451's two entries. I have no new findings. The non-blocking static-versus-dynamic linking wording suggestion still stands in the existing thread.

Checked and held
  • The count arithmetic still holds after the rebase. fix(containment): permit copy_file_range and sendfile on Linux #451 moved main to 116 + 17x entries and 119 + 18x rules, and this PR adds one entry on every architecture plus one more on x86: 117 + 18x and 120 + 19x.
  • pselect6 and select sit alongside fix(containment): permit copy_file_range and sendfile on Linux #451's copy_file_range and sendfile without duplicates, and build_permit_rules uniqueness passes.
  • select_waits_on_held_descriptors_under_the_filters, select_waits_are_permitted_and_unmediated, and the count test pass at this head on x86-64.
  • The full containment lib suite on this runner gives the same 12 namespace-dependent failures on main and on this head, so they come from the environment. This head adds 2 passing tests.
  • No frozen surface or root premise changes.

@github-actions

Copy link
Copy Markdown

Important (non-blocking): 8ce75df deletes the "Select waits" section. After that, the repository has no record of the measurement or of the x86 select rationale behind these two permits, which the written rules require.

Rules:

  • Root AGENTS.md: "Put change rationale in the commit message. Put measurements, past defects, rejected alternatives, and implementation caveats in the crate's AGENTS.md."
  • crates/containment/AGENTS.md, "The seccomp filters permit, then restrict": "A new syscall stays denied until measured evidence and a compatibility rationale justify its addition."

Example: At this head, the strace result (pselect6 ... = -1 EPERM, then Unrecoverable error in select/poll), the RS-02 before-and-after numbers, and the glibc 2.32 and 2.34 and fs/select.c citations exist only in the PR body. The new commit has no body. The code comment in syscall.rs keeps a one-line rationale, but no measurement. Both earlier permits under "Linux, measured" keep the comment and a section: waitid in "Waiting for a child", and #451's copy_file_range/sendfile in "Optimized copies". A later reviewer who asks why x86 select is permitted would find no trace and no citation. The PR body is now stale in two places. It says "The containment AGENTS.md records the measurement under 'Select waits'", and it says x86 glibc behavior "was not checked".

Suggestion: Revert 8ce75df. If the section was dropped on purpose, for example to keep AGENTS.md short, put the measurement and the citations in the squash-commit message. Then update the PR body's "Decisions" line and its "Why x86 select too" bullet to say where the evidence lives. The previous thread on that section becomes moot either way.

@github-actions

Copy link
Copy Markdown

Assessment: Comment

Re-reviewed at 8ce75df. Since 9f97c71, the only change is that the "Select waits" section in crates/containment/AGENTS.md was deleted. The permit table, the tests, and the syscall.rs comment did not change, so the code findings from earlier rounds still hold. The one open item is where the evidence is recorded (see the comment above). The code is ready.

Checked and held
  • Relative to main (f40db21), the diff is now only syscall.rs (the table entries, count baselines 117 + 18x / 120 + 19x, and the unit test) and mod.rs (the filtered test).
  • The rationale comment in syscall.rs follows the fix(containment): permit copy_file_range and sendfile on Linux #451 copy_file_range precedent in form.
  • The earlier static-versus-dynamic linking suggestion no longer applies, because the sentence it targeted was deleted.

@opieter-aws
opieter-aws merged commit a800990 into main Nov 13, 2026
21 checks passed
@opieter-aws
opieter-aws deleted the feature/seccomp-pselect6 branch November 13, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area - Agent Containment bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants