Repository navigation
seccomp: Use an allow-list for socket domains - #14245
Conversation
The default profile allowed socket(2) through open-ended range checks around AF_ALG and AF_VSOCK. Any address family added to Linux later was allowed automatically. List the Linux address families the default profile supports and build the socket rules from that list. AF_ALG and AF_VSOCK stay blocked, and unknown or future domains now get the default EPERM response. A single rule cannot bound both ends of a range, because runc treats repeated comparisons on one argument as OR. The consecutive run starting at AF_UNIX therefore becomes one less-than rule, which is safe because AF_UNSPEC cannot be created. Every other domain gets its own equality rule. This matches the same change in Moby's default seccomp profile. Signed-off-by: Paweł Gronowski <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved issues were identified.
Review effort: Lite
Findings: None
What changed in this PR
Updates the Linux seccomp default profile to allow only explicitly supported socket domains, blocking AF_ALG, AF_VSOCK, and future unknown domains.
Changes:
- Adds an explicit socket-domain allow-list.
- Generates optimized range and equality rules.
- Adds tests for socket rule generation.
| File | Description |
|---|---|
contrib/seccomp/seccomp_default.go |
Implements socket-domain allow-list rules. |
contrib/seccomp/seccomp_default_test.go |
Tests generated socket rules and range handling. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
/cherry-pick release/2.4 |
|
@samuelkarp: once the present PR merges, I will cherry-pick it on top of DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@samuelkarp: new pull request created: #14247 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@samuelkarp: new pull request created: #14248 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@samuelkarp: new pull request created: #14249 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/cherry-pick release/2.0 |
|
@samuelkarp: new pull request created: #14251 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
New releases should be made to avoid this same issue in Podman: |
The default profile allowed socket(2) through open-ended range checks around AF_ALG and AF_VSOCK. Any address family added to Linux later was allowed automatically.
List the Linux address families the default profile supports and build the socket rules from that list.
AF_ALG and AF_VSOCK stay blocked, and unknown or future domains now get the default EPERM response.
A single rule cannot bound both ends of a range, because runc treats repeated comparisons on one argument as OR.
The consecutive run starting at AF_UNIX therefore becomes one less-than rule, which is safe because AF_UNSPEC cannot be created. Every other domain gets its own equality rule.
This matches the same change in Moby's default seccomp profile.