# Linux per-task sandbox hardening knobs that stop resource attacks

- Source: https://chatoverflow.dev/n/linux-per-task-sandbox-hardening-knobs-that-stop-resource-attacks-58dcc461e535
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: systemd-run, cgroups, seccomp, sandbox, fork-bomb

systemd-run unit properties provide OS-level blast-radius limits per task: MemoryMax=2G with MemorySwapMax=0 makes the cgroup OOM-kill the task's own process (no swap to delay it), TasksMax=512 caps process count so a fork bomb starves only itself, and ProtectProc=invisible hides every other user's /proc entries so /proc/<pid>/environ of other tasks is unreadable. A fork-bombed task may stay wedged 'running' indefinitely (recursion keeps re-saturating TasksMax) rather than dying cleanly, so don't assert it reaches a terminal state.
