← Back to Pull requests

fix(dyninst): Resolve line probes within their source file #61373

Open
unknown opened this pull request with 344 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 25, 2026 13:41 UTC
Author

What does this PR do?

Line probes now resolve only to line-table rows from the file named by sourceFile.

Previously pickLineInjectionPC picked the first row with the requested line number anywhere in the method's PC ranges, ignoring the row's file. A probe could land in code inlined from another file, and a probe whose sourceFile named a different file still installed, with snapshots reporting that sourceFile.

Now a row is considered only when its recorded file and sourceFile match on path-component boundaries: either path may be a trailing part of the other, so base names, repository paths, module paths and build paths all match. \, ./, // and leading / or ../ are normalized; a sourceFile with .. after a named component, or with no named component, is rejected. A line probe whose sourceFile matches no row at that line fails with an invalid probe definition.

When sourceFile matches several files, the closest match is used: an exact recorded path first, then a recorded path that contains all of sourceFile. Among equally close matches, the method's declaring file comes first, then files of the method's own code, then files of code inlined into it; the caller's line state at the start of inlined code counts only when no row of the method's code at that line matches. A compiled copy of the method (an inlined instance or a generic shape) whose code at the line is only in other files is skipped, so the probe still installs in the copies that have it.

Motivation

Snapshots report sourceFile as the probe's file, so it should name the file the probe was actually placed in.

Possible drawbacks / trade-offs

A sourceFile whose trailing components differ from the path recorded in the binary no longer matches. Examples: a -trimpath build whose module path differs from the repository directory (module example.com/api in services/api/, sourceFile services/api/x.go), a Docker build that copies a subdirectory to /app, or a module-cache path with @vX when sourceFile omits the version. These probes installed before. Reviewers from Dynamic Instrumentation: please confirm which path form the UI sends for Go line probes.

Describe how you validated your changes

  • TestLineProbeSourceFile (GenerateIR on rc_tester): mismatching and .. cases fail on the base commit and pass with this change.

  • New TestLineFileMatches and TestPickLineInjectionPC cases.

  • pkg/dyninst/irgen, rcjson and decode tests pass on linux/arm64; irgen snapshot goldens (amd64 and arm64 binaries, go1.23–1.27) are unchanged. linux/amd64 compile-checked.

  • Not run locally: the eBPF pkg/dyninst end-to-end and pkg/dyninst/module tests (CI eBPF jobs).
  • Diff: 344 lines (+258 / -86) across 4 files Reviewer: grantseltzer Review duration: 8120m
    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 · 344 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.350
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #61373"
    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.4% (MEDIUM) · Higher = larger blast radius
    42.4%
    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.6% · Safe to merge
    22.6%