seccomp: allow socket(2) only for an allow-list of families #1324
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.36) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 196 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.316
Real PR Conversation Timeline
1 comments
"Review active on #1324"
general
weight: 0.35
ricardobranco777
The default profile allowed socket(2) for every address family except AF_VSOCK, so any family the profile does not know about, such as AF_ALG, passes seccomp and relies on the LSM or the kernel config to be refused. Docker blocks AF_ALG deliberately.
Replace the catch-all allow rules with one allow rule per family, using the same list as moby/profiles (allowedSocketDomains). Families that are not listed now fail with ENOSYS, the profile default. AF_VSOCK keeps its explicit EPERM rule, and AF_NETLINK keeps the NETLINK_AUDIT restriction that depends on CAP_AUDIT_WRITE.
The allow rules compare the full 64-bit argument, so a value with the upper 32 bits set does not match and is denied, and no mask is needed.
This also makes socket and socketpair agree on which families they accept.
On ABIs that use socketcall(2) the arguments cannot be filtered by seccomp, so these rules apply to the direct socket and socketpair syscalls only. That limitation already existed and is unchanged.
Tested with podman and the regenerated seccomp.json: socket(AF_ALG) returned EACCES with the previous profile (SELinux) and EAFNOSUPPORT with SELinux labelling disabled, so seccomp did not stop it. It now returns ENOSYS. AF_UNIX, AF_INET, AF_INET6 and AF_NETLINK still work, NETLINK_AUDIT still needs CAP_AUDIT_WRITE, and AF_VSOCK is still EPERM.
Add tests for the allow-list and the NETLINK_AUDIT rule, and regenerate seccomp.json.
<!--- Please read the contributing guidelines before proceeding --->