Skip to content

Switch to AppArmor/SELinux based socketcall block#52547

Merged
vvoland merged 6 commits into
moby:masterfrom
vvoland:revert-socketcall
May 6, 2026
Merged

Switch to AppArmor/SELinux based socketcall block#52547
vvoland merged 6 commits into
moby:masterfrom
vvoland:revert-socketcall

Conversation

@vvoland

@vvoland vvoland commented May 6, 2026

Copy link
Copy Markdown
Contributor

Seccomp cannot filter socketcall(2) arguments because the address family is behind a userspace pointer that BPF cannot dereference. Only an LSM (AppArmor or SELinux) can deny AF_ALG via the security_socket_create hook in the socketcall path.

CVE-2026-31431: Replace the socketcall(2) seccomp deny that broke 32-bit programs with targeted AppArmor (deny network alg) and SELinux (alg_socket) rules that block AF_ALG at the LSM layer, covering both socket(2) and socketcall(2) paths without disrupting legitimate 32-bit workloads.

vvoland and others added 6 commits May 6, 2026 15:22
Add a positive test that creates an AF_INET socket via int $0x80
socketcall to ensure the AppArmor "deny network alg" rule only
blocks AF_ALG and does not break legitimate socketcall usage.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Add a SELinux CIL module that denies AF_ALG socket creation for all
container domains.

Like AppArmor, SELinux hooks into the kernel's security_socket_create()
LSM callback, blocking AF_ALG regardless of whether the socket was
created via socket(2) or socketcall(2), without disrupting other
socketcall usage by 32-bit binaries.

This is shipped as a standalone CIL file for packaging repos to install
via semodule. It is not loaded by moby itself.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Seccomp cannot filter socketcall(2) arguments because the address
family is behind a userspace pointer that BPF cannot dereference.
Only an LSM (AppArmor or SELinux) can deny AF_ALG via the
security_socket_create hook in the socketcall path.

Skip the socketcall_int80 subtest when neither AppArmor nor SELinux
is reported by the daemon, since the test would always fail without
an LSM to enforce the deny rule.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Add "deny network alg," to the default AppArmor profile.

Unlike seccomp, which can only filter arguments of the direct socket(2)
syscall, AppArmor hooks into the kernel's security_socket_create() LSM
callback, which fires regardless of the syscall entry point. This means
AppArmor also blocks AF_ALG sockets created via the legacy socketcall(2)
multiplexer (used by 32-bit binaries), which seccomp cannot inspect
because the address family is behind a userspace pointer that BPF cannot
dereference.

Crucially, AppArmor can deny AF_ALG selectively without blocking
socketcall entirely.

A blanket seccomp socketcall deny broke all 32-bit networking since
glibc on i386 routes every socket operation through socketcall.

AppArmor operates at the socket layer, not the syscall layer, so it
blocks only the specific address family while leaving all other
socketcall usage intact.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
With the apparmor based block, it will now fail with EPERM

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
We now rely on the LSM-based solution for the hardening.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>

@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

We should really look at improving this at some point;

moby/daemon/info.go

Lines 191 to 195 in 3b630af

// fillSecurityOptions fills the [system.Info.SecurityOptions] field based
// on the daemon configuration.
//
// TODO(thaJeztah): consider making [system.Info.SecurityOptions] a structured response as originally intended in https://github.com/moby/moby/pull/26276
func (daemon *Daemon) fillSecurityOptions(v *system.Info, sysInfo *sysinfo.SysInfo, cfg *config.Config) {

@vvoland vvoland merged commit 2f47d15 into moby:master May 6, 2026
194 of 201 checks passed
@vvoland vvoland linked an issue May 6, 2026 that may be closed by this pull request
@samuelkarp

Copy link
Copy Markdown
Member

@vvoland Would you be interested in porting this to containerd as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SteamCMD Errors on 29.4.2

3 participants