Architectural Invariant Design: Synchronous eBPF LSM Namespace and Unshare Privilege Escalation Prevention
Synchronous eBPF LSM Namespace and Unshare Privilege Escalation Prevention defines an industrial-grade behavioral standard for devops engineering. Enforces synchronous in-kernel blocking of container breakout and unshare privilege escalation attempts via Cilium Tetragon eBPF Linux Security Module (LSM) hooks. Prevents kernel execution of unauthorized namespace creation (CLONE_NEWUSER) and capability escalation by triggering immediate SIGKILL actions prior to syscall completion. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.
Hazard Analysis: What Breaks Without This Rule
The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:
| Failure Mode | AI Symptom (The Anti-Pattern) | Severity | Production Impact & Remedy |
|---|---|---|---|
| AI Hallucination & Deprecation Drift | Relying on Asynchronous Audit-Only Kprobes for Container Breakout Detection | Critical | Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production. Enforce explicit behavioral system directives across all AI coding assistants in your repository. |
| Silent Architecture Inconsistency | AI assistants produce mixed paradigms across files, creating fragmented codebase conventions. | Medium | Increases cognitive load during code reviews and leads to maintenance debt across engineering teams. Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails. |
Step-by-Step Production Directives
Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:
Engineers MUST ALWAYS declare TracingPolicy or TracingPolicyNamespaced resources under apiVersion 'cilium.io/v1alpha1' with explicit 'Sigkill' or 'Override' actions for unauthorized namespace operations.
Engineers MUST ALWAYS declare TracingPolicy or TracingPolicyNamespaced resources under apiVersion 'cilium.io/v1alpha1' with explicit 'Sigkill' or 'Override' actions for unauthorized namespace operations.
Engineers MUST NOT rely on passive observability, post-hoc alerts, or unconstrained tracepoints for known privilege escalation vectors such as unshare with CLONE_NEWUSER.
Engineers MUST NOT rely on passive observability, post-hoc alerts, or unconstrained tracepoints for known privilege escalation vectors such as unshare with CLONE_NEWUSER.
TracingPolicy resources MUST bind to LSM hooks (e.g., 'lsm/create_user_ns', 'lsm/capable') or synchronous kprobe hooks with immediate enforcement capabilities rather than purely asynchronous tracepoints.
TracingPolicy resources MUST bind to LSM hooks (e.g., 'lsm/create_user_ns', 'lsm/capable') or synchronous kprobe hooks with immediate enforcement capabilities rather than purely asynchronous tracepoints.
Selectors MUST explicitly filter for non-root or unauthorized namespace contexts and target suspicious flag masks (such as CLONE_NEWUSER
Selectors MUST explicitly filter for non-root or unauthorized namespace contexts and target suspicious flag masks (such as CLONE_NEWUSER: 0x10000000) inside container boundaries.
Infrastructure deployments MUST ensure Tetragon is deployed with 'tetragon.enableProcessCred=true' and verified LSM BPF program attachment in the underlying host Linux kernel (>= 5.7 with BPF_LSM enabled).
Infrastructure deployments MUST ensure Tetragon is deployed with 'tetragon.enableProcessCred=true' and verified LSM BPF program attachment in the underlying host Linux kernel (>= 5.7 with BPF_LSM enabled).
Frequently Asked Technical Questions
Common questions developers face when configuring AI coding assistants for this stack:
Q:Why is Synchronous eBPF LSM Namespace and Unshare Privilege Escalation Prevention critical for AI coding assistants?
Enforces synchronous in-kernel blocking of container breakout and unshare privilege escalation attempts via Cilium Tetragon eBPF Linux Security Module (LSM) hooks. Prevents kernel execution of unauthorized namespace creation (CLONE_NEWUSER) and capability escalation by triggering immediate SIGKILL actions prior to syscall completion. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.
Q:How does adopting this rule prevent AI hallucinations?
This rule explicitly declares what the AI must avoid (Relying on Asynchronous Audit-Only Kprobes for Container Breakout Detection) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.
Q:Which AI coding environments are supported?
This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).
Q:Can I combine this rule with other technology stacks?
Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.