This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: cilium-tetragon-ebpf-syscall-kill-invariant

Cilium Tetragon Kernel-Space Syscall Kill and Namespace Isolation Invariant

Enforces synchronous, sub-millisecond kernel-space mitigation against zero-day container escapes using Cilium Tetragon eBPF TracingPolicy definitions. Prevents unauthorized execution of dangerous syscalls (such as sys_enter_setns, sys_enter_pivot_root, and sys_enter_bpf) by directly terminating hostile execution contexts via kernel-level SIGKILL rather than relying on delayed userspace alerting.

Prohibited Anti-Pattern: Audit-Only Logging and Deferred Userspace Interception for Privilege Escalation and Container Escape Syscalls

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Cilium Tetragon Kernel-Space Syscall Kill and Namespace Isolation Invariant - Enforces synchronous, sub-millisecond kernel-space mitigation against zero-day container escapes using Cilium Tetragon eBPF TracingPolicy definitions. Prevents unauthorized execution of dangerous syscalls (such as sys_enter_setns, sys_enter_pivot_root, and sys_enter_bpf) by directly terminating hostile execution contexts via kernel-level SIGKILL rather than relying on delayed userspace alerting.
globs: k8s/**/*.yaml, deploy/**/*.yaml, infra/**/*.yaml, tetragon/**/*.yaml, helm/**/*.yaml
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/cilium-tetragon-ebpf-syscall-kill-invariant"
---

# Cilium Tetragon Kernel-Space Syscall Kill and Namespace Isolation Invariant

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Audit-Only Logging and Deferred Userspace Interception for Privilege Escalation and Container Escape Syscalls

## System Constraints
You are a Principal Security and DevOps Architect enforcing Cilium Tetragon eBPF kernel-level runtime invariants. You must mandate synchronous kernel-space enforcement via eBPF TracingPolicies with the Sigkill action for unauthorized namespace mutations, capability tampering, and raw bpf loading inside containerized workloads. Never allow passive log-only configurations or unconstrained selectors in production TracingPolicies.

## Strict Guidelines
- Engineers MUST ALWAYS declare 'Sigkill' actions in Tetragon TracingPolicy resources for forbidden namespace transition syscalls (sys_setns, sys_pivot_root, sys_unshare) targeting unprivileged workloads.
- Engineers MUST NOT rely on passive asynchronous audit logs or userspace admission webhooks to prevent zero-day container breakout vectors.
- TracingPolicies MUST explicitly scope enforcement to target namespaces or pod label selectors to avoid accidental node-level kernel panics or agent disruptions.
- Services running in non-root contexts MUST have kernel-level hooks blocking 'sys_enter_bpf' and 'sys_enter_ptrace' execution entirely.
- Components NEVER execute binary payloads from writable container directories (/tmp, /dev/shm, /var/tmp) without triggering kernel-level SIGKILL enforcement via Tetragon kprobe/tracepoint hooks.

## Bad vs Good Implementations
### Tetragon Container Escape Prevention: Syscall Interception and Sigkill

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Using 'action: Post' merely produces a telemetry event. The kernel executes the 'setns' syscall to completion, allowing an adversary to switch namespaces, access the host kernel namespace, and complete a container breakout before userspace tools can react.
```yaml
apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: audit-dangerous-syscalls
spec:
  kprobes:
    - call: "sys_setns"
      syscall: true
      args:
        - index: 0
          type: "int"
        - index: 1
          type: "int"
      # Flaw: Passive logging only. The attacker escapes the container
      # before the alert arrives at SIEM.
      selectors:
        - matchArgs:
            - index: 1
              operator: "Equal"
              values:
                - "0"
          matchActions:
            - action: Post
```

#### Production Standard (Correct)
> **Standard**: Uses 'TracingPolicyNamespaced' with 'action: Sigkill' directly inside kernel space via eBPF. The process attempting the unauthorized 'sys_setns' namespace hop is terminated synchronously sub-millisecond prior to privilege escalation, and an audit event is simultaneously posted.
```yaml
apiVersion: cilium.io/v1alpha1
kind: TracingPolicyNamespaced
metadata:
  name: block-container-escape-setns
  namespace: production
spec:
  podSelector:
    matchLabels:
      tier: backend
  kprobes:
    - call: "sys_setns"
      syscall: true
      args:
        - index: 0
          type: "int"
        - index: 1
          type: "int"
      selectors:
        - matchNamespaces:
            - "production"
          matchActions:
            # Invariant: Terminate the hostile process in-kernel before syscall completion
            - action: Sigkill
            - action: Post
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Recommended Agent Skills (askills.dev)

Ready-to-use executable skill functions tailored to this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Cilium Tetragon Kernel-Space Syscall Kill and Namespace Isolation Invariant

Cilium Tetragon Kernel-Space Syscall Kill and Namespace Isolation Invariant defines an industrial-grade behavioral standard for devops engineering. Enforces synchronous, sub-millisecond kernel-space mitigation against zero-day container escapes using Cilium Tetragon eBPF TracingPolicy definitions. Prevents unauthorized execution of dangerous syscalls (such as sys_enter_setns, sys_enter_pivot_root, and sys_enter_bpf) by directly terminating hostile execution contexts via kernel-level SIGKILL rather than relying on delayed userspace alerting. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Audit-Only Logging and Deferred Userspace Interception for Privilege Escalation and Container Escape Syscalls Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

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 ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftAudit-Only Logging and Deferred Userspace Interception for Privilege Escalation and Container Escape SyscallsCritical
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 InconsistencyAI 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.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS declare 'Sigkill' actions in Tetragon TracingPolicy resources for forbidden namespace transition syscalls (sys_setns, sys_pivot_root, sys_unshare) targeting unprivileged workloads.

Engineers MUST ALWAYS declare 'Sigkill' actions in Tetragon TracingPolicy resources for forbidden namespace transition syscalls (sys_setns, sys_pivot_root, sys_unshare) targeting unprivileged workloads.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST NOT rely on passive asynchronous audit logs or userspace admission webhooks to prevent zero-day container breakout vectors.

Engineers MUST NOT rely on passive asynchronous audit logs or userspace admission webhooks to prevent zero-day container breakout vectors.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

TracingPolicies MUST explicitly scope enforcement to target namespaces or pod label selectors to avoid accidental node-level kernel panics or agent disruptions.

TracingPolicies MUST explicitly scope enforcement to target namespaces or pod label selectors to avoid accidental node-level kernel panics or agent disruptions.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Services running in non-root contexts MUST have kernel-level hooks blocking 'sys_enter_bpf' and 'sys_enter_ptrace' execution entirely.

Services running in non-root contexts MUST have kernel-level hooks blocking 'sys_enter_bpf' and 'sys_enter_ptrace' execution entirely.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Components NEVER execute binary payloads from writable container directories (/tmp, /dev/shm, /var/tmp) without triggering kernel-level SIGKILL enforcement via Tetragon kprobe/tracepoint hooks.

Components NEVER execute binary payloads from writable container directories (/tmp, /dev/shm, /var/tmp) without triggering kernel-level SIGKILL enforcement via Tetragon kprobe/tracepoint hooks.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is Cilium Tetragon Kernel-Space Syscall Kill and Namespace Isolation Invariant critical for AI coding assistants?

Enforces synchronous, sub-millisecond kernel-space mitigation against zero-day container escapes using Cilium Tetragon eBPF TracingPolicy definitions. Prevents unauthorized execution of dangerous syscalls (such as sys_enter_setns, sys_enter_pivot_root, and sys_enter_bpf) by directly terminating hostile execution contexts via kernel-level SIGKILL rather than relying on delayed userspace alerting. 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 (Audit-Only Logging and Deferred Userspace Interception for Privilege Escalation and Container Escape Syscalls) 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.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

1 Rule in Stack

Cilium