← Back to Pull requests

feat(ebpf): Build minimized BTFs natively with Bazel #61206

Open
unknown opened this pull request with 337 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 24, 2026 09:01 UTC
Author

What does this PR do?

Builds minimized-btfs.tar.xz with Bazel instead of the invoke task, the S3-processed BTFHub archive and the btf-gen image.

  • corerelo extracts one stub ELF holding only the .BTF and CO-RE relocation records of the system-probe objects, so minimization reruns only when relocations change, not on every eBPF edit.

  • btfhub_archive lists the pinned DataDog/btfhub-archive commit (tracked by Renovate) and splits each arch's kernels into 64 buckets; a BTFHub bump reruns only the buckets that changed.

  • //pkg/ebpf:minimized_btfs runs bpftool gen min_core_btf per bucket and packs a deterministic tarball. //pkg/ebpf:minimized_btfs_test checks the stub minimizes 12 pinned kernels exactly like the real objects. Both need GitHub, so they are manual.

  • generate_minimized_btfs_{x64,arm64} now run those targets on the Bazel runners. Job names and the artifact are unchanged, so package, installer and KMT jobs consume it as before.

  • --//bazel/rules/ebpf:package_minimized_btfs (off by default) maps the tarball into the Bazel system-probe install tree.
  • <details>
    <summary>Functional changes</summary>

    | Before | After |
    | --- | --- |
    | generate_minimized_btfs_ waited for build_system-probe and build_processed_btfhub_archive | They start immediately and build the same CO-RE objects themselves |
    | Unchanged eBPF objects and BTFHub reused an S3 tarball; any change re-minimized every kernel | The Bazel remote cache reuses per-bucket results; only changed relocations or BTFHub buckets rerun |
    | Release branches were meant to skip the S3 cache, but the regex never matched | RUN_ALL_BUILDS and <major>.<minor>.x branches bypass the remote cache |
    | — | bazel test //pkg/ebpf:minimized_btfs_test checks stub/object equivalence on every run of the job |

    Unchanged: the tarball content and layout (identical to the legacy task for x86_64 and arm64), the Omnibus copy, and bazel test //... (the new targets are manual and the packaging flag is off).

    </details>

    Motivation

    Moves BTF minimization off the invoke task and its S3 cache so it is cached and reproducible like the rest of the Bazel build. The legacy pieces (build_processed_btfhub_archive, invoke tasks, CI_IMAGE_BTF_GEN variables) are deleted in a follow-up once this runs green in CI.

    Describe how you validated your changes

  • Built //pkg/ebpf:minimized_btfs on x86_64 and arm64 workspaces and compared it with the legacy generate-minimized-btfs output at the same BTFHub commit: identical trees (3576 BTFs on x86_64, 1711 on arm64).

  • minimized_btfs_test and the corerelo unit tests pass.

  • Largest bucket: 69 kernels, 279 s, 672 MB peak RSS.
  • Diff: 337 lines (+252 / -85) across 4 files Reviewer: chouquette Review duration: 10081m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.42) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 337 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.348
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #61206"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.2% (MEDIUM) · Higher = larger blast radius
    42.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.5% · Safe to merge
    22.5%