What is seccomp, and how does its default-deny profile with SCMP_ACT_ERRNO work?
seccomp (secure computing mode) is a kernel feature that filters a process's system calls — a firewall for syscalls. A whitelist profile sets a default action of SCMP_ACT_ERRNO (block with "operation not permitted") and explicitly allows only listed syscalls.
Every interaction between a program and the kernel is a system call (open a file, create a process, load a module…). seccomp filters which syscalls a process may make, in effect a firewall at the kernel boundary. Docker applies a default seccomp profile to every container that already blocks dangerous syscalls.
A profile is JSON with a defaultAction and a syscalls list:
{ "defaultAction": "SCMP_ACT_ERRNO", "architectures": ["SCMP_ARCH_X86_64", "…"], "syscalls": [ … ] }
defaultAction: SCMP_ACT_ERRNO— anything not explicitly allowed returns an error ("Operation not permitted"), i.e. a whitelist / default-deny policy.- The
syscallsentries then allow specific calls.
The other possible actions:
| Action | Effect |
|---|---|
SCMP_ACT_ALLOW |
Permit the syscall. |
SCMP_ACT_ERRNO |
Block it, returning an error — the call doesn't run. |
SCMP_ACT_KILL |
Kill the container (exit code 159). |
SCMP_ACT_TRAP |
Send SIGSYS without running the call. |
SCMP_ACT_TRACE |
For debugging/tracing. |
A profile allowing nothing can't even start a container (too few syscalls), which is why you adapt the default profile rather than write one from scratch — e.g. copy it and remove chmod/fchmod/fchmodat to forbid permission changes. Apply with --security-opt seccomp=profile.json.
* Unlisted syscalls return errno; only allow-listed ones reach the kernel. *
Go deeper:
Wikipedia: seccomp — the kernel syscall-filtering mechanism.
Docker Docs: Seccomp security profiles — Docker's default profile and how to customise it.