Skip to content

seccomp: accept syscall group names in both --extra-deny-syscall and --extra-allow-syscall - #167

Open
congwang-mk wants to merge 1 commit into
mainfrom
unify-syscall-groups
Open

seccomp: accept syscall group names in both --extra-deny-syscall and --extra-allow-syscall#167
congwang-mk wants to merge 1 commit into
mainfrom
unify-syscall-groups

Conversation

@congwang-mk

Copy link
Copy Markdown
Contributor

--extra-deny-syscall and --extra-allow-syscall treated group names asymmetrically, and the allow side failed silently:

  • deny accepted only individual syscall names, so denying SysV IPC took four flags naming each member syscall;
  • allow accepted group names but validated nothing: a typo (--extra-allow-syscall sysvipc) built a sandbox that silently kept the group blocked, and the existing unit test even asserted that no-op.

Both flags now resolve names through a shared SYSCALL_GROUPS table (currently just sysv_ipc):

  • --extra-deny-syscall accepts a syscall name or a group name; groups expand to their member syscalls in resolve_blocklist, for both the supervised and no-supervisor blocklists.
  • --extra-allow-syscall accepts group names only; unknown names are rejected with the known-group list in the error. Individual syscalls stay non-re-allowable on purpose: punching single-syscall holes in the default blocklist can bypass the mediation boundary (io_uring being the canonical example).
  • Allow/deny conflicts fail at build time: the same group on both sides, or a deny of a member syscall of an allowed group. The check has to be up front because the BPF layout places notif JEQs before deny JEQs, so an allowed group routing a syscall to notif would silently shadow a kernel-level deny of that same syscall.

Docs updated (sandbox-reference.md, python README). New unit tests cover group expansion in both blocklists, unknown-name rejection on both flags, rejection of individual syscall names on the allow side, and both conflict shapes.

…--extra-allow-syscall

The two flags treated group names asymmetrically and partly silently:
deny accepted only individual syscall names (denying SysV IPC took four
flags naming each member), while allow accepted group names but
validated nothing, so a typo like "sysvipc" built a sandbox that kept
the group blocked with no error. Both flags now resolve names through a
shared SYSCALL_GROUPS table: deny accepts a syscall or group name and
expands groups to their members, allow accepts group names only and
rejects unknown ones (re-allowing arbitrary single syscalls could punch
holes in the mediation boundary, io_uring being the canonical example),
and allow/deny conflicts fail at build time because the BPF layout
places notif JEQs before deny JEQs, so an allowed group routing a
syscall to notif would silently shadow a kernel-level deny of that same
syscall.

Signed-off-by: Cong Wang <cwang@multikernel.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant