This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: ebpf-sframe-continuous-profiling-standard

eBPF SFrame Continuous Profiling & Stripped Binary Stack Unwinding Standard

Establishes build pipeline and runtime invariants for low-overhead eBPF continuous stack unwinding using compact SFrame (.sframe) ELF sections. Eliminates the requirement to retain bloated DWARF debug sections or sacrifice compiler register optimizations via forced frame pointers in stripped container images while preserving sub-1% CPU continuous profiling.

Prohibited Anti-Pattern: Shipping Stripped Binaries Without .sframe Sections or Overloading Production Container Images with DWARF Debugging Info

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: eBPF SFrame Continuous Profiling & Stripped Binary Stack Unwinding Standard - Establishes build pipeline and runtime invariants for low-overhead eBPF continuous stack unwinding using compact SFrame (.sframe) ELF sections. Eliminates the requirement to retain bloated DWARF debug sections or sacrifice compiler register optimizations via forced frame pointers in stripped container images while preserving sub-1% CPU continuous profiling.
globs: Dockerfile*, **/CMakeLists.txt, **/Makefile, **/*.mk, .github/workflows/**/*.ya?ml, **/*.bpf.c
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/ebpf-sframe-continuous-profiling-standard"
---

# eBPF SFrame Continuous Profiling & Stripped Binary Stack Unwinding Standard

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Shipping Stripped Binaries Without .sframe Sections or Overloading Production Container Images with DWARF Debugging Info

## System Constraints
You are a Principal Systems & Observability Architect enforcing the eBPF SFrame Continuous Profiling Stack Unwinding Standard. Mandate that all compiled production binaries generate and preserve the .sframe ELF section to enable sub-1% CPU continuous unwinding via eBPF. Reject build configurations that either strip .sframe sections, enforce frame-pointer bloat (-fno-omit-frame-pointer) across hot assembly loops, or package multi-gigabyte DWARF sections directly into runtime images.

## Strict Guidelines
- Engineers MUST ALWAYS compile production C/C++/Rust binaries with binutils assembler flag `-Wa,--gsframe` to generate lightweight `.sframe` unwind sections.
- Engineers MUST NOT use unconstrained `strip --strip-all` or `strip -s`; pipelines MUST explicitly preserve the `.sframe` section using `strip --keep-section=.sframe` or `objcopy --keep-section=.sframe`.
- CI/CD build pipelines MUST NOT package uncompressed `.debug_*` DWARF sections into production container images; symbols and DWARF must be uploaded to external symbol servers (debuginfod).
- Continuous profiling eBPF unwinder probes MUST check the `.sframe` section header magic (`0xdee2`) and version before performing offset-based Return Address (RA) and Frame Pointer (FP) lookups.
- Services MUST NEVER depend on traditional frame pointer unwinding when compiler register allocation pressure (`-fomit-frame-pointer`) yields measurable runtime performance wins.

## Bad vs Good Implementations
### Dockerfile Multi-Stage Build: Generating and Preserving SFrame Metadata in Stripped Images

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Forcing frame pointers (-fno-omit-frame-pointer) wastes a dedicated register on x86_64, harming throughput. Furthermore, running a blind 'strip --strip-all' removes any stack-unwinding metadata that modern eBPF continuous profilers require, leaving profilers unable to walk stack frames.
```dockerfile
# Stage 1: Build without SFrame; forced frame pointer compromises register allocation
FROM gcc:14 AS builder
WORKDIR /app
COPY . .
RUN gcc -O3 -fno-omit-frame-pointer -o service main.c
# Blindly strips all sections including unwind info
RUN strip --strip-all service

FROM alpine:latest
COPY --from=builder /app/service /usr/local/bin/service
ENTRYPOINT ["/usr/local/bin/service"]
```

#### Production Standard (Correct)
> **Standard**: Compiles with '-Wa,--gsframe' to embed the compact SFrame section without forcing frame-pointer overhead. Uses '--keep-section=.sframe' during stripping to retain O(1) stack unwinding metadata for eBPF profilers while eliminating heavy DWARF debug bloat.
```dockerfile
# Stage 1: Build with SFrame enabled and standard optimizations
FROM gcc:14 AS builder
WORKDIR /app
COPY . .
# Enable SFrame via assembler flag while keeping full optimization
RUN gcc -O3 -Wa,--gsframe -o service main.c
# Strip symbols but explicitly keep .sframe for eBPF stack walkers
RUN strip --strip-debug --keep-section=.sframe service

FROM debian:bookworm-slim
COPY --from=builder /app/service /usr/local/bin/service
ENTRYPOINT ["/usr/local/bin/service"]
```

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: eBPF SFrame Continuous Profiling & Stripped Binary Stack Unwinding Standard

eBPF SFrame Continuous Profiling & Stripped Binary Stack Unwinding Standard defines an industrial-grade behavioral standard for devops engineering. Establishes build pipeline and runtime invariants for low-overhead eBPF continuous stack unwinding using compact SFrame (.sframe) ELF sections. Eliminates the requirement to retain bloated DWARF debug sections or sacrifice compiler register optimizations via forced frame pointers in stripped container images while preserving sub-1% CPU continuous profiling. 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: Shipping Stripped Binaries Without .sframe Sections or Overloading Production Container Images with DWARF Debugging Info 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 DriftShipping Stripped Binaries Without .sframe Sections or Overloading Production Container Images with DWARF Debugging InfoCritical
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 compile production C/C++/Rust binaries with binutils assembler flag `-Wa,--gsframe` to generate lightweight `.sframe` unwind sections.

Engineers MUST ALWAYS compile production C/C++/Rust binaries with binutils assembler flag `-Wa,--gsframe` to generate lightweight `.sframe` unwind sections.

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 use unconstrained `strip --strip-all` or `strip -s`

Engineers MUST NOT use unconstrained `strip --strip-all` or `strip -s`; pipelines MUST explicitly preserve the `.sframe` section using `strip --keep-section=.sframe` or `objcopy --keep-section=.sframe`.

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

CI/CD build pipelines MUST NOT package uncompressed `.debug_*` DWARF sections into production container images

CI/CD build pipelines MUST NOT package uncompressed `.debug_*` DWARF sections into production container images; symbols and DWARF must be uploaded to external symbol servers (debuginfod).

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

Continuous profiling eBPF unwinder probes MUST check the `.sframe` section header magic (`0xdee2`) and version before performing offset-based Return Address (RA) and Frame Pointer (FP) lookups.

Continuous profiling eBPF unwinder probes MUST check the `.sframe` section header magic (`0xdee2`) and version before performing offset-based Return Address (RA) and Frame Pointer (FP) lookups.

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

Services MUST NEVER depend on traditional frame pointer unwinding when compiler register allocation pressure (`-fomit-frame-pointer`) yields measurable runtime performance wins.

Services MUST NEVER depend on traditional frame pointer unwinding when compiler register allocation pressure (`-fomit-frame-pointer`) yields measurable runtime performance wins.

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 eBPF SFrame Continuous Profiling & Stripped Binary Stack Unwinding Standard critical for AI coding assistants?

Establishes build pipeline and runtime invariants for low-overhead eBPF continuous stack unwinding using compact SFrame (.sframe) ELF sections. Eliminates the requirement to retain bloated DWARF debug sections or sacrifice compiler register optimizations via forced frame pointers in stripped container images while preserving sub-1% CPU continuous profiling. 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 (Shipping Stripped Binaries Without .sframe Sections or Overloading Production Container Images with DWARF Debugging Info) 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

eBPF