Architectural Invariant Design: Cilium eBPF Host-Routing Tail-Call sk_buff Context Preservation and Telemetry Invariant
Cilium eBPF Host-Routing Tail-Call sk_buff Context Preservation and Telemetry Invariant defines an industrial-grade behavioral standard for security engineering. Enforces strict control buffer (cb[]) alignment and security identity preservation across eBPF BPF-to-BPF tail calls in Cilium host-routing and L7 proxy redirect paths. Eliminates policy bypass and silent packet drops caused by unanchored skb metadata shifts and unhandled tail-call dispatch exhaustion. Ensures full telemetry synchronization and verifier-compliant pointer re-validation across execution boundaries. 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 | Unchecked Control Buffer Mutation and Silent Fallthrough During Tail-Call Failure | 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 persist and re-anchor security identity (src_id/dst_id) and packet marks in struct __sk_buff cb[] prior to dispatching any bpf_tail_call.
Engineers MUST ALWAYS persist and re-anchor security identity (src_id/dst_id) and packet marks in struct __sk_buff cb[] prior to dispatching any bpf_tail_call.
Engineers MUST NOT allow silent fallthrough after a bpf_tail_call() invocation
Engineers MUST NOT allow silent fallthrough after a bpf_tail_call() invocation; tail calls that exceed execution limits or target missing indices MUST explicitly emit a drop telemetry event and return TC_ACT_SHOT.
Code SHOULD re-validate all pointer offsets (ctx->data and ctx->data_end) immediately at the entry point of any tail-called program to comply with eBPF verifier memory boundaries.
Code SHOULD re-validate all pointer offsets (ctx->data and ctx->data_end) immediately at the entry point of any tail-called program to comply with eBPF verifier memory boundaries.
Services MUST ensure that L7 proxy redirect flags (CB_PROXY_MAGIC) are not overwritten or zeroed out during intermediate L3/L4 routing stages.
Services MUST ensure that L7 proxy redirect flags (CB_PROXY_MAGIC) are not overwritten or zeroed out during intermediate L3/L4 routing stages.
Components NEVER execute raw skb reallocation or headroom adjustments across tail-call chains without realigning the embedded security context.
Components NEVER execute raw skb reallocation or headroom adjustments across tail-call chains without realigning the embedded security context.
Frequently Asked Technical Questions
Common questions developers face when configuring AI coding assistants for this stack:
Q:Why is Cilium eBPF Host-Routing Tail-Call sk_buff Context Preservation and Telemetry Invariant critical for AI coding assistants?
Enforces strict control buffer (cb[]) alignment and security identity preservation across eBPF BPF-to-BPF tail calls in Cilium host-routing and L7 proxy redirect paths. Eliminates policy bypass and silent packet drops caused by unanchored skb metadata shifts and unhandled tail-call dispatch exhaustion. Ensures full telemetry synchronization and verifier-compliant pointer re-validation across execution boundaries. 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 (Unchecked Control Buffer Mutation and Silent Fallthrough During Tail-Call Failure) 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.