UCS/SYS: Add ucs_sys_lib_dlsym to find a symbol in a loaded library #12443
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
tvegas1
What?
Add
ucs_sys_lib_dlsym(lib_addr, symbol), which returns a symbol defined by the loaded library containinglib_addr, and use it in GDRCopy forgdr_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 intest_syswithout a GPU, in a shared build.How?
dladdr(lib_addr)identifies the library,dlopen(RTLD_LAZY | RTLD_NOLOAD)opens it without loading anything, anddlsym()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.test_syscovers a libucs symbol (found), a libucm symbol (found by plaindlsym()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.andgdr_copy*gtests, includingtest_gdr_copy.cuda_async_qualification, with GDRCopy 2.7 so bothgdr_get_attributedeclaration checks are enabled.LD_DEBUG=bindingsconfirmed that the helper resolvesgdr_get_attributein the loaded GDRCopy runtime. The node's older GDRCopy kernel driver did not exercise DMA-BUF enablement.test_sys.lib_dlsym_dependencyfail.