runsc/cmd/util: export gofer setup helpers for reuse#12907
Open
copybara-service[bot] wants to merge 1 commit intomasterfrom
Open
runsc/cmd/util: export gofer setup helpers for reuse#12907copybara-service[bot] wants to merge 1 commit intomasterfrom
copybara-service[bot] wants to merge 1 commit intomasterfrom
Conversation
I am looking into building a custom gVisor gofer that serves storage volumes over LisaFS. Building the gofer process around `lisafs`, which works well as a public API, requires duplicating unexported setup helpers from `runsc/cmd/` like `applyCaps`, `resolveSymlinks`, `adjustMountOptions`, `pivotRoot`, `copyFile`, `prepareArgs`, `execProcUmounter`, `setCapsAndCallSelf`, and `intFlags`. These must be manually diffed and re-synced on every gVisor version bump. The functions are already well-factored: they take explicit parameters, carry no hidden state, and are unexported only because they live in a CLI package rather than because they have invariants worth protecting. This change adds exported equivalents in `runsc/cmd/util/`, which already serves as the utility package for command helpers. The original unexported functions are retained as thin one-line wrappers so that no internal callers or tests change, which accounts for the net line increase in the diff. Also fixes a pre-existing bug in `callSelfAsNobody` where the error messages for `SYS_SETGID` and `SYS_SETUID` were swapped. FUTURE_COPYBARA_INTEGRATE_REVIEW=#12902 from shayonj:s/export-gofer-helpers 5f5e910 PiperOrigin-RevId: 897345739
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.
runsc/cmd/util: export gofer setup helpers for reuse
I am looking into building a custom gVisor gofer that serves storage volumes over LisaFS. Building the gofer process around
lisafs, which works well as a public API, requires duplicating unexported setup helpers fromrunsc/cmd/likeapplyCaps,resolveSymlinks,adjustMountOptions,pivotRoot,copyFile,prepareArgs,execProcUmounter,setCapsAndCallSelf, andintFlags. These must be manually diffed and re-synced on every gVisor version bump.The functions are already well-factored: they take explicit parameters, carry no hidden state, and are unexported only because they live in a CLI package rather than because they have invariants worth protecting. This change adds exported equivalents in
runsc/cmd/util/, which already serves as the utility package for command helpers. The original unexported functions are retained as thin one-line wrappers so that no internal callers or tests change, which accounts for the net line increase in the diff.Also fixes a pre-existing bug in
callSelfAsNobodywhere the error messages forSYS_SETGIDandSYS_SETUIDwere swapped.FUTURE_COPYBARA_INTEGRATE_REVIEW=#12902 from shayonj:s/export-gofer-helpers 5f5e910