Skip to content

seccomp: Use an allow-list for socket domains - #39

Merged
AkihiroSuda merged 2 commits into
moby:mainfrom
vvoland:seccomp-allowlist
Sep 16, 2026
Merged

AkihiroSuda merged 2 commits into
moby:mainfrom
vvoland:seccomp-allowlist

Conversation

@vvoland

@vvoland vvoland commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Replace the open-ended range checks with the Linux address families the default profile supports. AF_ALG and AF_VSOCK remain blocked, and unknown or future domains now receive the profile's default EPERM response.

@vvoland vvoland self-assigned this Aug 21, 2026
Replace the open-ended range checks with the Linux address families
the default profile supports. AF_ALG and AF_VSOCK remain blocked, and
unknown or future domains now receive the profile's default EPERM
response.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@vvoland
vvoland force-pushed the seccomp-allowlist branch from 4fac163 to f8d7350 Compare August 21, 2026 19:26
@thaJeztah

Copy link
Copy Markdown
Member

Quick LLM review; in case it could indeed be an option;

Do we need to expand the existing < AF_ALG rule into 37 equality rules? The security-relevant change is replacing the open-ended > AF_VSOCK rule. We could retain < AF_ALG and == AF_NFC, then explicitly allow only AF_KCM through AF_MCTP. That gives seven rules instead of 43, still blocks all future families from the current AF_MAX onward, and preserves the existing handling of AF_UNSPEC.
Apart from making the JSON substantially smaller, fewer conditional rules should also keep the generated multi-architecture BPF filter smaller.

@vvoland

vvoland commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

Done.
FYI, I wanted to generalize this so it could produce multiple ranges, but we're limited to just one < rule because of: opencontainers/runc#2735

Comment thread seccomp/default_linux.go
Comment thread seccomp/default_linux_test.go Outdated
Comment thread seccomp/default_linux_test.go
@thaJeztah
thaJeztah requested a review from AkihiroSuda August 24, 2026 20:32
runc splits multiple comparisons on the same syscall argument into
separate rules, so bounded ranges become unions and can allow blocked
domains.

Use one less-than rule for the consecutive domains below AF_ALG. The
only additional value it matches is AF_UNSPEC, which is not a creatable
domain.
Keep higher domains as equality rules so AF_ALG, AF_VSOCK, and unknown
or future domains remain blocked. This reduces the generated socket
entries from 43 to seven.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@vvoland
vvoland force-pushed the seccomp-allowlist branch from 23ce641 to 65adc7e Compare August 25, 2026 15:45

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah

Copy link
Copy Markdown
Member

@AkihiroSuda @djs55 PTAL

@vvoland

vvoland commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

@AkihiroSuda this one LGTY?

Comment thread seccomp/default_linux.go
var allowedSocketDomains = []uint64{
unix.AF_UNIX,
unix.AF_INET,
unix.AF_AX25,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread seccomp/default_linux.go
unix.AF_UNIX,
unix.AF_INET,
unix.AF_AX25,
unix.AF_IPX,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who still uses IPX, AppleTalk, etc. ?
Those protocol drivers aren't likely maintained well, and may potentially have vulns.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that would be the next step for me. The current state of this PR is to just switch to allow-list without behavior change yet.

Comment thread seccomp/default_linux.go
unix.AF_INET,
unix.AF_AX25,
unix.AF_IPX,
unix.AF_APPLETALK,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed from the kernel recently
https://www.phoronix.com/news/Linux-Drops-AppleTalk

@AkihiroSuda
AkihiroSuda merged commit 245180c into moby:main Sep 16, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

4 participants