Skip to content

runsc/cmd/util: export gofer setup helpers for reuse#12907

Open
copybara-service[bot] wants to merge 1 commit intomasterfrom
test/cl897345739
Open

runsc/cmd/util: export gofer setup helpers for reuse#12907
copybara-service[bot] wants to merge 1 commit intomasterfrom
test/cl897345739

Conversation

@copybara-service
Copy link
Copy Markdown

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

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
@copybara-service copybara-service bot added the exported Issue was exported automatically label Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Issue was exported automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant