Repository navigation
sccache-dist: resolve toolchain and input paths from a chroot in the overlay builder - #2908
Merged
Merged
Conversation
…overlay builder Toolchains and inputs are packaged on the client and routinely contain absolute symlinks. Inside bubblewrap those resolve within the toolchain, but the overlay builder unpacks the archives, creates the cwd and output directories and reads the outputs back from the build server's own root directory, so the same paths could resolve to something else there than what the compiler saw. join_suffix also keeps `..` components, so output paths going above / were not clamped the way they are in the sandbox. Add run_in_root(), which runs a closure on a scoped thread after unshare(CLONE_FS) and chroot() into the unpack directory, and use it for the toolchain unpack, the inputs unpack and directory creation, and the output retrieval, so they all see the same tree as the sandboxed command. The chroot only affects that thread and ends with it.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2908 +/- ##
==========================================
- Coverage 78.00% 77.88% -0.13%
==========================================
Files 73 73
Lines 43136 43209 +73
==========================================
+ Hits 33650 33652 +2
- Misses 9486 9557 +71 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
1 task done
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.
Toolchains and inputs are packaged on the client and routinely contain absolute symlinks. Inside bubblewrap those resolve within the toolchain, but the overlay builder unpacks the archives, creates the cwd and output directories and reads the outputs back from the build server's own root directory, so the same paths could resolve to something else there than what the compiler saw. join_suffix also keeps
..components, so output paths going above / were not clamped the way they are in the sandbox.Add run_in_root(), which runs a closure on a scoped thread after unshare(CLONE_FS) and chroot() into the unpack directory, and use it for the toolchain unpack, the inputs unpack and directory creation, and the output retrieval, so they all see the same tree as the sandboxed command. The chroot only affects that thread and ends with it.