seccomp: allow fsync, fchmod, ftruncate and epoll_pwait2 at runtime - #109
Open
perbu wants to merge 1 commit into
Open
seccomp: allow fsync, fchmod, ftruncate and epoll_pwait2 at runtime#109perbu wants to merge 1 commit into
perbu wants to merge 1 commit into
Conversation
The Runtime filter omitted four syscalls the default emulation layer can
issue on behalf of an ordinary guest, so each one killed the VMM process
with SIGSYS instead of being served:
fsync, fchmod, ftruncate - handlers at system_calls.cpp:1915, :2051
and :3228, all in the default safe set
epoll_pwait2 - the epoll_wait handler takes the
preempt_epoll_wait() path, which is on by
default, and that path issues epoll_pwait2
rather than the epoll_wait the guest asked
for
None of these widens the sandbox: all four operate on an fd the emulation
layer already translated, and the fd was approved when it was opened.
ftruncate moves out of init_rules(), which no longer needs to name it
separately now that runtime_rules() carries it.
Adds four tests to tests/unit/seccomp.cpp, one per syscall, each running
the guest under the Runtime filter in a forked child so the SIGSYS is
contained. The suite previously only exercised printf/write under that
filter, which is why the drift went unnoticed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
The Runtime filter was missing four syscalls the default emulation layer can issue for an ordinary guest, so each one killed the VMM process with SIGSYS rather than being served:
fsyncsystem_calls.cpp:1915fchmod:2051ftruncate:3228epoll_pwait2epoll_waithandler'spreempt_epoll_wait()path, which is on by defaultAll three handlers are installed before the
unsafe_syscallsboundary, so they are in the default safe set.None of these widens the sandbox: every one operates on an fd the emulation layer already translated, and that fd was approved when it was opened.
ftruncatemoves out ofinit_rules(), which no longer needs to name it now thatruntime_rules()carries it.I left
fdatasyncout even though it pairs naturally withfsync— there is noSYS_fdatasynchandler, so allowing it would widen the filter beyond what the emulation layer can actually issue.Adds four tests, one per syscall, each running the guest under the Runtime filter in a forked child so the SIGSYS is contained.
tests/unit/seccomp.cppgoes from 7/11 to 11/11.This is drift the existing tests structurally could not catch: they only exercised
printf/writeunder the Runtime filter. A generic guard — a smoke guest walking the whole safe syscall surface, or a CI check diffingstrace -f -cagainstruntime_rules()— would be worth adding separately.🤖 Generated with Claude Code