runsc/fsgofer/filter: add Rules() for composable seccomp filters#12904
Merged
copybara-service[bot] merged 2 commits intomasterfrom Apr 15, 2026
Merged
runsc/fsgofer/filter: add Rules() for composable seccomp filters#12904copybara-service[bot] merged 2 commits intomasterfrom
copybara-service[bot] merged 2 commits intomasterfrom
Conversation
Add an exported Rules(opt Options) function that returns the merged seccomp SyscallRules for a gofer process without installing them. This allows custom gofer implementations to obtain the stock baseline rules and merge their own additional rules before installing: rules := filter.Rules(opts) rules.Merge(myNetworkingRules) // build and install program with rules The existing Install() function now delegates to Rules() internally. A deep copy is used to ensure the package-level rule variables are not mutated across calls.
c5224dc to
69a3328
Compare
PiperOrigin-RevId: 900250305
69a3328 to
7afc87c
Compare
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/fsgofer/filter: add Rules() for composable seccomp filters
Today
runsc/fsgofer/filterexports onlyInstall(opt Options) error, which builds and installs the seccomp program in one shot with no way to compose additional rules. I am looking into building a custom gofer over LisaFS that needs a small number of extra syscalls such as outbound TCP andsetns(CLONE_NEWNET)for namespace switching but otherwise wants the stock seccomp baseline. The only option today is to forkconfig.goand its arch-specific files and manually track upstream changes, which is a security concern because if upstream tightens a rule forks silently diverge and may run with a wider-than-intended syscall surface.This change adds
Rules(opt Options) seccomp.SyscallRules, which returns the merged baseline without installing it so custom gofers can compose their own rules on top.Install()now delegates toRules()internally. The implementation usesallowedSyscalls.Copy()to deep-copy the package-level rules before merging, which also fixes a latent issue where callingInstallmore than once would double-merge rules through the shared underlying map.FUTURE_COPYBARA_INTEGRATE_REVIEW=#12903 from shayonj:s/composable-seccomp c0b4b74