← Back to Pull requests

UCS/SYS: Add ucs_sys_lib_dlsym to find a symbol in a loaded library #12443

Closed
unknown closed this pull request without merging on Nov 26, 2026 08:12 UTC
View on GitHub
unknown unknown commented on Nov 23, 2026 19:44 UTC
Author

What?


Add ucs_sys_lib_dlsym(lib_addr, symbol), which returns a symbol defined by the loaded library containing lib_addr, and use it in GDRCopy for gdr_get_attribute.

Why?


Requested in https://github.com/openucx/ucx/pull/12181#discussion_r4664798123:
the ZE host-pointer import there needs the same lookup that uct_gdr_copy_using_dmabuf() open-codes, so it moves to UCS first. In UCS the same-library check is tested in test_sys without a GPU, in a shared build.

How?


  • dladdr(lib_addr) identifies the library, dlopen(RTLD_LAZY | RTLD_NOLOAD) opens it without loading anything, and dlsym() runs on that handle.

  • dlsym() on a handle also searches the library's dependencies, so the helper keeps GDRCopy's check that the symbol's object is the same library, and returns NULL otherwise.

  • The handle is closed before returning; the caller must keep the library loaded for as long as it uses the address. GDRCopy does, since the runtime is a dependency of the module.

  • test_sys covers a libucs symbol (found), a libucm symbol (found by plain dlsym() on the libucs handle, rejected by the helper), a missing symbol, and an address outside any library. The lookups through libucs skip when libucs is linked statically.
  • Testing


  • test_sys. and gdr_copy* gtests, including test_gdr_copy.cuda_async_qualification, with GDRCopy 2.7 so both

  • gdr_get_attribute declaration checks are enabled.
  • LD_DEBUG=bindings confirmed that the helper resolves gdr_get_attribute in the loaded GDRCopy runtime. The node's older GDRCopy kernel driver did not exercise DMA-BUF enablement.

  • Removing the same-library check makes test_sys.lib_dlsym_dependency fail.
  • Diff: 211 lines (+158 / -53) across 2 files Reviewer: tvegas1 Review duration: 3628m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 211 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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.320
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #12443"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 36.5% (MEDIUM) · Higher = larger blast radius
    36.5%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 14.4% · Safe to merge
    14.4%
    Repository