Skip to content

fix(atomic): fall back when Linux FICLONE is denied with EPERM - #829

Merged
steipete merged 3 commits into
openclaw:mainfrom
Mohl:fix/linux-ficlone-eperm-fallback
Oct 5, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
Mohl:fix/linux-ficlone-eperm-fallback

Conversation

@Mohl

@Mohl Mohl commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Linux containers whose seccomp or LSM policy denies FICLONE with EPERM caused native copies with clone: "auto" to fail instead of copying bytes. The file-clone primitive now classifies that ioctl denial as unavailable cloning: auto uses the existing guarded ordinary-copy path, while always reports unsupported-platform and removes the stage. Strict copyTree cloning 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 --locked and 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. Full pnpm check passed 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.

@Mohl
Mohl requested a review from a team as a code owner October 3, 2026 11:04
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P1 Urgent regression or broken agent/channel workflow affecting real users now. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 11:15 PM ET / October 5, 2026, 03:15 UTC (Revision 6).

ClawSweeper review

What this changes

Linux 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
Reviewed head: 6fe1c458485a699b12a71806d8093b1e0dfb92ed

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with retained real-container evidence, bounded safety behavior, and targeted regression coverage meets normal good PR quality.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Retained historical container proof is corroborated by the related PR's real LXC Root.copyIn A/B run with a rebuilt native addon and correct after-fix bytes. The current production owner preserves the proven ioctl classification and adds isolated real-seccomp coverage for automatic copying, required-clone rejection, and cleanup. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Retained historical container proof is corroborated by the related PR's real LXC Root.copyIn A/B run with a rebuilt native addon and correct after-fix bytes. The current production owner preserves the proven ioctl classification and adds isolated real-seccomp coverage for automatic copying, required-clone rejection, and cleanup. No stored-data contract changes.
Evidence reviewed 8 items Pinned introduced change: The complete introduced diff changes only FICLONE EPERM classification, regression coverage, the support probe, writing documentation, and the Unreleased changelog.
Current main still needs the fix: Main does not classify FICLONE EPERM as unavailable cloning, so automatic copying propagates the failure instead of selecting its existing fallback.
Latest release remains affected: The inspected v0.23.0 implementation also omits EPERM from clone-unavailable errors; this behavior is not already shipped.
Findings None None.
Security None None.

How this fits together

fs-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]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test growth production +6/-0; tests +90/-1 Production growth is limited to the errno classification and its safety rationale; most additions cover real syscall denial.

Root-cause cluster

Relationship: canonical
Canonical: #829
Summary: Both branches address the same FICLONE EPERM classification; this PR incorporates the related contributor's rationale and has a verified mergeable head.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best 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.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Real-container evidence establishes failed automatic file copying with reported downstream package-update failures.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Retained historical container proof is corroborated by the related PR's real LXC Root.copyIn A/B run with a rebuilt native addon and correct after-fix bytes. The current production owner preserves the proven ioctl classification and adds isolated real-seccomp coverage for automatic copying, required-clone rejection, and cleanup. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. Retained historical container proof is corroborated by the related PR's real LXC Root.copyIn A/B run with a rebuilt native addon and correct after-fix bytes. The current production owner preserves the proven ioctl classification and adds isolated real-seccomp coverage for automatic copying, required-clone rejection, and cleanup. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: The complete introduced diff changes only FICLONE EPERM classification, regression coverage, the support probe, writing documentation, and the Unreleased changelog. (native/src/unix.rs:897, 6fe1c458485a)
  • Current main still needs the fix: Main does not classify FICLONE EPERM as unavailable cloning, so automatic copying propagates the failure instead of selecting its existing fallback. (native/src/unix.rs:885, e8f4c4f23ca9)
  • Latest release remains affected: The inspected v0.23.0 implementation also omits EPERM from clone-unavailable errors; this behavior is not already shipped. (native/src/unix.rs:885, 223a30531ea8)
  • Guarded fallback and strict cloning: Automatic fallback retains descriptors and recreates the stage exclusively with no-follow protection. Clone cleanup failures become EIO rather than selecting fallback. Required cloning maps ENOTSUP to unsupported-platform in src/copy-file-input.ts; native/src/clone_linux.rs retains its separate strict tree-clone behavior. (native/src/file_copy.rs:159, 6fe1c458485a)
  • Proof continuity and real-container corroboration: The previous completed review at fix(atomic): fall back when Linux FICLONE is denied with EPERM #829 (comment) retains sufficient historical real-container proof. The captured related PR fix(copy): fall back to ordinary copy when seccomp denies FICLONE #831 reports public Root.copyIn A/B execution with a rebuilt native addon on Proxmox LXC: helper-failed without EPERM classification and correct copied bytes with it. Earlier-head source independently confirms the same classification; current-head changes preserve that behavior. The current captured context identity is sourceRevision 962ea45a6ca86aa7ee8d634f55e004c5135b37dfec5a2a7d1731e2067ed8bd30. Historical evidence is not attributed to the rewritten current body.
  • Focused production-path regression: The isolated Linux test installs a real seccomp filter denying ioctl(FICLONE), verifies the injected errno, exercises the production copy owner, checks automatic-copy bytes, and verifies required-clone rejection and stage cleanup. This is supplemental to the retained container proof; target code was not executed during this read-only review. (native/src/file_copy.rs:687, 6fe1c458485a)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (5 earlier review cycles)
  • reviewed 2026-10-03T11:08:45.649Z sha d51c928 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-03T12:00:01.854Z sha ce08d5f :: needs maintainer review before merge. :: none
  • reviewed 2026-10-03T18:21:24.947Z sha ce08d5f :: needs maintainer review before merge. :: none
  • reviewed 2026-10-05T01:12:08.631Z sha ce08d5f :: blocked before merge. :: none
  • reviewed 2026-10-05T02:45:14.740Z sha ce08d5f :: blocked before merge. :: none

@Mohl
Mohl force-pushed the fix/linux-ficlone-eperm-fallback branch from d51c928 to ce08d5f Compare October 3, 2026 11:55
@Mohl

Mohl commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

force-push happened to correct for wrong / unverified commit signatures

Mohl and others added 3 commits October 4, 2026 20:09
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]>
@steipete
steipete force-pushed the fix/linux-ficlone-eperm-fallback branch from ce08d5f to 6fe1c45 Compare October 5, 2026 03:11
@steipete
steipete merged commit 0712807 into openclaw:main Oct 5, 2026
47 checks passed
steipete added a commit that referenced this pull request Oct 5, 2026
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
steipete added a commit that referenced this pull request Oct 5, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 Urgent regression or broken agent/channel workflow affecting real users now. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants