Repository navigation
Conversation
…stack Follow-ups from the reviews of #1160 and #1162, all fail-closed. - HostPIDNamespace requires procRoot to be a procfs (statfs) before the NSpid proof. - A gone container whose entry delete fails no longer matches ErrContainerGone, so start and the move heal fail instead of silently dropping the cleanup (CodeRabbit #1160 4802841890); an entry that is already gone (ErrKeyNotExist) counts as deleted, and a failed bind no longer leaves a binding active with no entry. - Start keeps an ErrCredUnrecorded binding only for the pending slot. - Tests: hadMove with ErrCredUnrecorded, the AdoptedPending fan-out, the holds() exclusion, MarkPod on a record that owes an unbind. - Type-only changes so the node-agent side builds for GOARCH=386 (the IG fork still needs its own patch). - Doc comments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Docs-exempt: internal fixes and tests in the unreleased NRI start gate stack Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
node-agent ships only linux/amd64 and linux/arm64 (Makefile, release workflows), and the IG fork does not build for 386, so the 32-bit type changes add nothing. Restore the four files to their previous form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Docs-exempt: reverts type-only changes, no behavior change on shipped platforms Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Human review is needed because VM qualification was not run for start-gate correctness that depends on real host procfs and shared pinned-map behavior during replacement.
No open issues 🎉
What changed in this PR
This PR hardens the sandbox-policy NRI start gate, addressing follow-ups from #1160 and #1162 on top of #1178.
Changes:
- Require procfs before accepting PID namespace evidence.
- Propagate gone-container cleanup failures and restrict unrecorded startup bindings to pending slots.
- Add regression tests, clarify comments, and adjust types for 386 compatibility; full 386 validation remains blocked.
| File | Description |
|---|---|
pkg/sandboxpolicy/sections_adoptedpending_test.go |
Tests adopted-mark fan-out and section errors. |
pkg/sandboxpolicy/integration/podcgroup_test.go |
Routes synthetic namespace checks through the file-proof helper. |
pkg/sandboxpolicy/integration/podcgroup_linux.go |
Requires procfs and clarifies namespace guarantees. |
pkg/sandboxpolicy/integration/nrigate.go |
Updates namespace-validation comments only. |
pkg/sandboxpolicy/integration/nrigate_copilot8_test.go |
Tests rejection of crafted non-procfs directories. |
pkg/sandboxpolicy/igbackend/markpod_oldpod_test.go |
Tests marking while an old unbind remains pending. |
pkg/sandboxpolicy/igbackend/imageindex.go |
Handles filesystem magic values on 32-bit architectures. |
pkg/sandboxpolicy/igbackend/imageevidence.go |
Makes filesystem flag comparisons architecture-compatible. |
pkg/sandboxpolicy/igbackend/adoptedpending_test.go |
Tests exclusion of currently held cgroups. |
pkg/hostfimsensor/v1/fimsensor_fanotify.go |
Uses architecture-compatible timestamp conversion. |
pkg/ebpf/gadgets/common/enforcement/pending_followups_test.go |
Covers move retries, cleanup failures, and startup guards. |
pkg/ebpf/gadgets/common/enforcement/bindings.go |
Preserves cleanup errors and guards pending-slot recovery. |
pkg/config/config.go |
Explicitly types the image-size default as int64. |
Review effort: Balanced
Performance Benchmark ResultsNode-Agent Resource Usage
Dedup EffectivenessNo data available. |
This branch has not been deployed
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.
Summary
Follow-ups from the reviews of #1160 (S1) and #1162 (S2), stacked on #1178. Every change fails closed.
HostPIDNamespacenow requiresprocRootto be a procfs (statfs) before trusting the NSpid proof.ErrKeyNotExist) counts as deleted, so an in-place replacement racing the old instance does not fail the start. A failed bind no longer leaves a binding active with no kernel entry behind it.ErrCredUnrecordedbinding only for the pending slot.ErrCredUnrecorded; theAdoptedPendingfan-out across sections; theholds()exclusion;MarkPodon a record that still owes an unbind.Validation:
go teston./pkg/sandboxpolicy/...and the enforcement packages in default,-tags startgate_vmtestand-race: all pass.TestServiceReportsUnexpectedExporterExit(skipped here; fixed in the gate follow-up PR); VM qualification.AI Review
Written with Claude Code (Claude Opus 5.5). One independent adversarial review: APPROVE with one MEDIUM (an already-deleted entry failed the start spuriously), fixed with a regression test and re-checked (APPROVE).
🤖 Generated with Claude Code