Repository navigation
fix(atomic): fall back when Linux FICLONE is denied with EPERM - #829
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 11:15 PM ET / October 5, 2026, 03:15 UTC (Revision 6). ClawSweeper reviewWhat this changesLinux native file copies treat a denied clone ioctl as unavailable cloning, allowing automatic copies to use guarded copying while required cloning fails with cleanup. Merge readiness✅ Ready for maintainer review The fix remains necessary on current main and v0.23.0. The prior merge-conflict blocker is resolved, and no introduced correctness or security defect was found. Likely related people: steipete (verified area contributor; routing confidence medium). Priority: P1 Review scores
Verification
How this fits togetherfs-safe copies files through retained descriptors and guarded staging before publication. Clone policy selects cloning, ordinary copying, or an unsupported error without changing filesystem confinement. flowchart TD
A[Source and clone policy] --> B[Retain checked descriptors]
B --> C[Create exclusive stage]
C --> D{Clone result}
D -->|Success| E[Checked publication]
D -->|Unavailable and automatic| F[Guarded copying]
F --> E
D -->|Unavailable and required| G[Cleanup and unsupported error]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep the ioctl-specific fallback through existing guarded copy owners, preserving required-clone rejection, cleanup diagnostics, and strict tree cloning. Do we have a high-confidence way to reproduce the issue? Yes: denying ioctl(FICLONE) with EPERM reaches a clear current-main failure path, corroborated by real-container A/B evidence. This review did not execute target code. Is this the best way to solve the issue? Yes: classifying only clone unavailability reuses existing guarded fallback and leaves path-resolution permission failures and strict tree cloning intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e8f4c4f23ca9. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
d51c928 to
ce08d5f
Compare
|
force-push happened to correct for wrong / unverified commit signatures |
Container seccomp profiles (for example Proxmox LXC) deny the FICLONE ioctl with EPERM before any filesystem sees it. The Linux file-clone primitive only reclassified ENOTTY/EINVAL/EXDEV/ENOSYS/ENOTSUP as clone unavailable, so clone "auto" copies failed with helper-failed instead of continuing to the ordinary guarded copy. Treat EPERM from the FICLONE ioctl itself as unavailable cloning. Target creation has already succeeded at that point, and the fallback recreates the target through the same exclusive path as clone "never". The strict copyTree reflink primitive is unchanged. Related: openclaw/openclaw#164113 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
ce08d5f to
6fe1c45
Compare
Close the remaining XFS/ZFS copyTree capability gap after #829 by sharing the exclusive-target FICLONE errno classifier. Keep native cloning strict and preserve raw operational errors; TypeScript selects byte copying only after native workers settle and partial output is removed. Add isolated seccomp regressions for the file job and worker pool, plus auto/always partial-progress and residue-rejection coverage. Update copying docs and the Unreleased changelog. Validated with Rust workspace tests and Clippy on Linux/macOS, builds, focused tests, pnpm check (17,170 passing tests), all OS CI lanes, CodeQL, and clean P0-P2 Codex review. Refs: openclaw/openclaw#165257
Prepare `@openclaw/fs-safe` 0.23.1 from main, using the same 13-file scope as #826: root, native workspace, seven platform package versions, exact optional-dependency pins, and regenerated Cargo/pnpm lock entries. No implementation or dependency changes are included. Finalize the 2026-10-04 changelog with an empty Unreleased section above it. Highlights cover no-replace publication on gVisor/9p and other unsupported filesystems (#834, fixes #828), container-denied FICLONE fallback for single-file and tree copies (#829, #835), and nonblocking macOS FIFO watching (#830). The six fixes include PR links and contributor credit, including @Mohl and co-author @foxsky, @vishnukool, and @SebTardif. Validation: `pnpm build`, `pnpm check` (662 test files and 13,431 tests passed; 65 files and 4,108 tests skipped), `pnpm pack:check`, `node scripts/release-notes.mjs 0.23.1`, and `git diff --check` passed. The local build selected the installed rustup compiler explicitly because the default Homebrew Rust compiler could not see the WASM target. Codex autoreview is scoped-clean at P0–P2. Both generated lockfile diffs are limited to the intended version changes. Release publication remains exclusively through the signed v0.23.1 tag and release.yml trusted publishing. Exact-head CI passed on `26e42f21a6b568d3f6a37408dea6f3b89ccf10b3`: [CI](https://github.com/openclaw/fs-safe/actions/runs/37265555433), [coverage](https://github.com/openclaw/fs-safe/actions/runs/37265555421), [mutation proofs](https://github.com/openclaw/fs-safe/actions/runs/37265555402), [benchmarks](https://github.com/openclaw/fs-safe/actions/runs/37265555459), and [CodeQL](https://github.com/openclaw/fs-safe/actions/runs/37265555471). No runner reruns or failure exceptions were needed. Main remained at `04e370a3e39eb6e98e6cb54877a5941b6d688cde` before merge.
Linux containers whose seccomp or LSM policy denies
FICLONEwithEPERMcaused native copies withclone: "auto"to fail instead of copying bytes. The file-clone primitive now classifies that ioctl denial as unavailable cloning:autouses the existing guarded ordinary-copy path, whilealwaysreportsunsupported-platformand removes the stage. StrictcopyTreecloning is unchanged. This addresses the updater failure tracked in openclaw/openclaw#164113.The target was just created with
O_EXCL, so FICLONE's immutable/append-only destination explanation for EPERM does not apply. The fallback recreates the destination through the same guarded exclusive path and still fails closed if normal writes are denied. This deliberately differs from openat2's EPERM rule: it does not weaken path resolution. The rationale from @foxsky's duplicate #831 is incorporated inline, with co-author credit in the squash commit; a one-caller classification helper was unnecessary.The isolated Linux seccomp regression denies only
ioctl(FICLONE), verifies correct non-cloned bytes in auto mode, and verifies always-mode failure without a leftover stage. The writing guide, clone support probe, and Unreleased changelog are updated.Validation:
cargo test --workspace --lockedand Clippy passed on macOS; 64 focused copy tests passed with the native addon loaded (nine platform skips); Codex autoreview is clean at P0–P2. Exact-head Linux CI runs the seccomp regression, alongside the full OS matrix and CodeQL. Fullpnpm checkpassed lint, build, allocator-build, and documentation checks locally, but the full test phase was stopped after widespread timing failures on a busy host.Thanks @Mohl for the fix and seccomp regression, and @foxsky for the security rationale.
Exact-head CI passed on
6fe1c458485a699b12a71806d8093b1e0dfb92ed: all OS lanes, the Linux seccomp regression, mutation-policy proofs, coverage, benchmarks, and CodeQL. CI run.