feat: whitelist socket families and block legacy AIO via seccomp#61
Merged
koki-develop merged 1 commit intomainfrom Apr 30, 2026
Merged
Conversation
Generalize the previous AF_ALG-specific block to a whitelist that allows only AF_UNIX, AF_INET, AF_INET6, and AF_NETLINK. This removes a long tail of niche kernel subsystems (AF_PACKET, AF_VSOCK, AF_BLUETOOTH, AF_TIPC, AF_KEY, AF_NFC, etc.) that have significant historical CVE counts and zero legitimate sandbox use. socketpair() is restricted to AF_UNIX, the only family the kernel itself accepts. Also block the legacy libaio family (io_setup, io_destroy, io_submit, io_getevents, io_cancel, io_pgetevents) with ENOSYS, mirroring the existing io_uring block. No runtime in the image links against libaio. io_pgetevents is referenced by name on x86_64 (kafel's amd64 syscall db has it as 333) and by raw syscall number 292 on arm64 (kafel's aarch64 db is missing this entry). Tests cover representative blocked families (AF_PACKET, AF_VSOCK, AF_TIPC), the AF_NETLINK regression, the socketpair restriction, each legacy AIO syscall, both architectures of io_pgetevents, and a size=4 regression that catches accidental migration to the inline declaration form (which would over-block legitimate calls with non-zero high bits in the family arg).
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.
Summary
io_setup,io_destroy,io_submit,io_getevents,io_cancel,io_pgetevents) with ENOSYS, mirroring the existing io_uring block.io_pgeteventsis bound by name on x86_64 (kafel db has it as syscall 333) and by raw syscall number 292 on arm64 (kafel's aarch64 db is missing this entry; the asm-generic number is 292).familyarg (size=4) so the comparison is on the low 32 bits only — preserves the size=4 protection that motivated the original AF_ALG rule and avoids over-blocking legitimate calls with non-zero high bits.Why now
Generalization of the AF_ALG (Copy Fail / CVE-2026-31431) block. AF_ALG is one of many niche socket families with kernel attack-surface history; whitelisting captures the long tail in one rule. Verified against canonical Linux kernel headers, kafel source (
parser.y,codegen.c, syscall db), and BPF dump (dump_policy_bpffor both architectures).Verification
Test plan
🤖 Generated with Claude Code