Bind from chroot with O_PATH #7163
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 197 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.316
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7163"
general
weight: 0.35
ajoshua2004
What type of PR is this?
What this PR does / why we need it:
Using
O_PATHdoes not grant read or write access to files or directories upon opening, making the opened/proc/self/df/Nless useful, as they have no permissions. This allows simplifying the difference between files and directories.The fix is specifically for files, but I opted to add it for both files and directories, let me know if you prefer to revert.
With the previous
O_RDRW, we couldn't mount twice the same file in two parallel stage if one of the stage is executing the file and would receive aETXTBSYerror instead.As far as I can tell we do not need the file to be read-write since the writeability of the layer is handled via an overlay anyhow.
It should keep the same safety as what the original code was guarding against (https://access.redhat.com/security/cve/cve-2024-11218) as far as I can tell, and is close to what Buildkit is doing in https://github.com/moby/buildkit/blob/master/executor/oci/spec_linux.go#L338.
Note that BuildKit also sets
O_CLOEXEC, which is probably a good idea, but would need to be set in open_unix.go asMSG_CMSG_CLOEXEC. I have not done that change for now, but can add it too if you prefer.How to verify it
See the tests
Which issue(s) this PR fixes:
Fixes #7162
Special notes for your reviewer:
Does this PR introduce a user-facing change?
``
release-note
``Properly support mounting the same file in separate stages while one of the stage executes the file