seccomp Syscall Filtering

seccomp and seccomp-BPF for syscall filtering in containers, Docker default profiles, and writing custom filters.

Overview

seccomp (Secure Computing Mode) is a Linux kernel feature that restricts which system calls a process can make. It is the primary attack-surface-reduction mechanism used by Docker, Kubernetes, and browsers (Chrome/Firefox sandbox).

Modes

  • SECCOMP_MODE_STRICT — allows only read, write, exit, and sigreturn. Rarely used directly.
  • SECCOMP_MODE_FILTER — attaches a BPF program that inspects each syscall and returns an action: SECCOMP_RET_ALLOW, SECCOMP_RET_KILL_PROCESS, SECCOMP_RET_ERRNO, or SECCOMP_RET_TRAP.

Key concepts

  • BPF filter
  • SCMP_ACT_KILL_PROCESS
  • Docker default profile
  • RuntimeDefault

Interview questions

  • How does Docker use seccomp to reduce container attack surface, and what happens when you use --privileged?
  • A containerized application crashes with "Operation not permitted" only in production Kubernetes but works in dev Docker. What do you check?

Sign up free to read the full topic

More Linux topics

Start free on Cariara · Coding problems · System design studio