Repository navigation
seccomp: FilterSpec type and one shared SandboxFeatures - #365
Open
congwang-mk wants to merge 2 commits into
Open
congwang-mk wants to merge 2 commits into
congwang-mk wants to merge 2 commits into
Conversation
The feature gates lived in three places: SandboxFeatures behind a one-field ResolvedSandbox wrapper, and a renamed copy of each flag on NotifPolicy. The child derived its own copy after fork to build the BPF filter while the parent derived another for the supervisor, so nothing tied the trapped syscalls to the handlers gated on the same facts. Derive SandboxFeatures once before fork, hand it to the child, and embed it in NotifPolicy in place of the copied flags. Signed-off-by: Cong Wang <cwang@multikernel.io>
seccomp_plan was a bag of free functions returning a notif list, a blocklist and an argument block, which every caller stitched together by hand, and context.rs re-exported them as public wrappers. The feature view also called back into it to learn whether sysinfo was denied. FilterSpec in seccomp/filter.rs owns the three parts and is the only way to assemble them. Its constructors name the three filters sandlock installs: supervised, deny_only and no_supervisor. The sysinfo check moves next to the deny list it depends on, so SandboxFeatures no longer needs the blocklist. Signed-off-by: Cong Wang <cwang@multikernel.io>
This branch has not been deployed
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.
Two refactors of the seccomp setup data structures. No behavior change intended.
Share one
SandboxFeaturesbetween the filter and the supervisorThe feature gates lived in three places:
SandboxFeaturesbehind a one-fieldResolvedSandboxwrapper, and a renamed copy of each flag onNotifPolicy. The child derived its own copy after fork to build the BPF filter while the parent derived another for the supervisor.resolved.rsbecomesfeatures.rs;ResolvedSandboxis removed.NotifPolicyholds onefeaturesfield in place of eleven copied flags (has_memory_limit,cow_enabled, ...).ChildSpawnArgs, which no longer needssandbox_name.Replace
seccomp_planwith aFilterSpectypeseccomp_planwas a set of free functions returning a notif list, a blocklist and an argument block, which each caller stitched together by hand, andcontext.rsre-exported them as public wrappers.seccomp_plan.rsmoves toseccomp/filter.rs.FilterSpecowns the three parts andassemble()is the only way to encode them.supervised,deny_only,no_supervisor.context::notif_syscalls,blocklist_syscall_numbers,no_supervisor_blocklist_syscall_numbersandarg_filterswrappers are removed.SandboxFeaturesno longer calls into the filter code andvirtual_sysinfois gone.Tests
context/tests.rstoseccomp/filter/tests.rs.Independent of #364 (different files).
🤖 Generated with Claude Code