Skip to content

seccomp: authorize prepared network operations before executing them - #283

Open
congwang-mk wants to merge 1 commit into
mainfrom
codex/policy-fn-connect-deny
Open

congwang-mk wants to merge 1 commit into
mainfrom
codex/policy-fn-connect-deny

Conversation

@congwang-mk

Copy link
Copy Markdown
Contributor

The supervisor previously called policy_fn after network dispatch had already connected or sent on the child's socket. A denied connect could return EPERM while leaving a usable connection, and a denied send could still reach its peer.

Have connect and send handlers return prepared operations containing owned arguments and destination metadata. The supervisor authorizes them before execution and drops them on denial. Deferred completion remains separate, so an approved blocking send can defer without nesting deferrals.

This covers IP and Unix connects, single sends, and send batches. Without a callback, prepared operations execute immediately. Preparing sendmmsg batches introduces a 64 MiB aggregate payload cap, which can shorten large batches even without a callback.

Validation: 901 unit tests and 526 integration tests passed. The full integration suite passed with reduced concurrency after earlier failures. Regressions check that denied connects and sends do not reach peers and that an approved partial send completes through the deferred path.

The supervisor called policy_fn after dispatch had already connected or
sent on the child's socket. Returning EPERM could leave a usable
connection behind or report a denial after a datagram reached its peer.

Have connect and send handlers return owned, prepared operations with
captured destination metadata. The supervisor asks the callback before
executing them and drops the operation on denial. Without a callback it
executes immediately. Keep deferred completion separate so a blocking
send can defer without producing a nested deferral that becomes EIO.

Prepare sendmmsg entries before sending and bound their combined payload
to 64 MiB. This can shorten a large batch even without a callback.

Add regressions for denied connects and sends reaching their peers, and
for an approved partial send completing through the deferred path.
All 901 unit tests and 526 integration tests passed, with reduced
concurrency for the full integration run.

Signed-off-by: Cong Wang <cwang@multikernel.io>

This branch has not been deployed

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