Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2728 +/- ##
==========================================
- Coverage 76.32% 75.73% -0.60%
==========================================
Files 72 72
Lines 40180 39205 -975
==========================================
- Hits 30668 29692 -976
- Misses 9512 9513 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
223e16b to
03b3fcf
Compare
|
@sylvestre friendly ping; is there anything I can do to make this PR easier to review? |
|
Getting that PR to be merged would unblock PyTorch's build of sccache on riscv64. See https://github.com/pytorch/pytorch/pull/182278/changes#diff-0a862d15a4e6dff44196719a594b983aece596c7dc38eba416d83e12a95206e6 for details |
|
having tests that cover this change would be helpful :) |
|
@rrbutani gentle ping on that issue? happy to have a look on adding tests a well. |
03b3fcf to
d90f112
Compare
|
Thanks for the ping, apologies for the delay. I've updated the existing The first commit in this PR has only these changes; running (for example)
@sylvestre Is ^ sufficient? |
2c9184b to
05bb9da
Compare
|
@sylvestre friendly ping |
05bb9da to
f68f114
Compare
f68f114 to
e246288
Compare
|
@sylvestre could I get another CI run for this PR? |
|
@sylvestre friendly ping |
currently this fails with: ``` [2026-07-30T20:04:59Z WARN sccache::dist::http::server] Res 2 error: run build failed, caused by: Compilation execution failed, caused by: Failed to enter a new Linux namespace, caused by: EPERM: Operation not permitted ``` this error comes from: ```rust nix::sched::unshare(nix::sched::CloneFlags::CLONE_NEWNS) ``` and is expected. --- The next commit will update `sccache-dist server` to run successfully without root.
… root the approach here is more or less the same as in mozilla#1628: use `CLONE_NEWUSER` (unprivileged user namespace) to be able to create a mount namespace + mount the overlayFS mounts without permissions unlike mozilla#1628, this PR leverages [`bubblewrap`'s overlay mount functionality](containers/bubblewrap@f371022) (added in `v0.11.0`) to create the overlayFS mounts at the `sccache-dist` → `bwrap` compile command process boundary. This has a couple of upsides: - sidesteps the [safety issues](https://github.com/mozilla/sccache/blob/9fb6a2542c0d2e82846252be19bb377e5ca8885b/src/bin/sccache-dist/build.rs#L447-L458) in mozilla#1628 caused by forking the `sccache-dist` process - avoids the [issue](mozilla#1688) with overlay fs mounts not being unmounted once the compile command finishes that ultimately led to mozilla#1628 being [reverted](mozilla#1689) + though, I think this issue was actually caused by mozilla#1628 changing the default sandboxing codepath (i.e. `current_ns`) to call `CLONE_NEWNS` [in the `sccache-dist`'s `rouille` request handler thread](https://github.com/mozilla/sccache/blob/9fb6a2542c0d2e82846252be19bb377e5ca8885b/src/bin/sccache-dist/build.rs#L422-L429) instead of [in the thread spawned for a compile](https://github.com/mozilla/sccache/blob/c72eed63d78c8550b93133e9fa461a0c6ef7a30d/src/bin/sccache-dist/build.rs#L272-L276) (and not anything to do with the unprivileged user namespace logic) other notes: - previously deleting the build directory/the per-compile directories did not run into permission issues because `sccache-dist` was running as root closes mozilla#326, closes mozilla#1660 closes mozilla#1688 supersedes mozilla#2706
e246288 to
63dbffe
Compare
|
@sylvestre could I get a CI run for this PR? |
|
hi, this one can't be merged as it is:
|
|
Thank you for the feedback. I'll carve out some time to rebase this PR and address these comments in the coming week.
As mentioned in the OP I'm not sure what danger there being whiteouts in the compile inputs tarball would pose... as implemented, whiteouts in the form of 0/0 character devices are allowed. Do you want me to add an explicit check for such files (and have the test you requested ensure that such inputs are rejected)? |
|
needs to be rebased |
Note
I've opened this PR to get feedback on whether the direction here is acceptable. There are still a few items that need to be addressed (see
pendingbelow) before this is ready for merge.The approach here is more or less the same as in #1628: use
CLONE_NEWUSER(unprivileged user namespace) to be able to create a mount namespace + mount the overlayFS mounts without permissionsUnlike #1628, this PR leverages
bubblewrap's overlay mount functionality (added inv0.11.0) to create the overlayFS mounts at thesccache-dist→bwrapcompile command process boundary. This has a couple of upsides:sccache-distprocesscurrent_ns) to callCLONE_NEWNSin thesccache-dist'srouillerequest handler thread instead of in the thread spawned for a compile (and not anything to do with the unprivileged user namespace logic)other notes:
sccache-distwas running as rootpending/open questions:
userxattr.overlayxattrs in the compile inputs tarball?bubblewraphandle creating the mountpoint this isn't an optiontar::Archivedefaults to not restoringxattrsso I think the only consideration is whiteouts?closes #326, closes #1660, closes #1688, supersedes #2706