Seccomp — System Call Filtering
Seccomp reduces the system-call interface available to a thread. Strict mode allows a very small set of operations; filter mode evaluates a BPF-based program against syscall metadata, with actions such as allow, return an error or terminate. The architecture and syscall ABI matter: a filter must not assume identical numbering across architectures. Filters do not replace filesystem permissions, capabilities, LSMs or workload isolation; syscall pointer arguments cannot be inspected as arbitrary memory by ordinary seccomp filtering. A reported filter mode does not identify allowed syscalls or guarantee policy quality. Seccomp state is per-thread; a program can use thread synchronization when installing a filter, but a leader status entry alone is not proof of uniform policy across threads. The single-threaded example reads its own Seccomp field and verifies a recognized mode. It does not install, bypass, weaken or probe a filter. Actual policy design and negative enforcement tests belong in an authorized isolated environment. Example prerequisites: Linux, Bash and Python 3 standard library; run as a non-root user in a private temporary working directory. Example scope: native read-only observation. Expected output: own seccomp mode recognized; policy not inferred. No system configuration changes.
Formal Syntax & Structure
/proc/self/status: Seccomp, Seccomp_filters (when available)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| Seccomp | integer mode | 0 disabled, 1 strict, 2 filter. |
| Seccomp_filters | integer count | Number of attached filters when the field is exposed. |
| action | policy result | Result selected by a filter; not inferred from mode. |
Return Value
Current status fields report mode and optionally count, not a decoded policy.
Working Example
python3 - <<'PY'from pathlib import Pathrows=dict(line.split(':',1) for line in Path('/proc/self/status').read_text().splitlines() if ':' in line)assert int(rows['Seccomp']) in (0,1,2)if 'Seccomp_filters' in rows: assert int(rows['Seccomp_filters'])>=0print('own seccomp mode recognized; policy not inferred')PY