← Back to Pull requests

UCP/DT: Fix use of freed IOV memory handles on request restart #12448

Closed
unknown closed this pull request without merging on Nov 26, 2026 18:20 UTC
View on GitHub
unknown unknown commented on Nov 23, 2026 21:41 UTC
Author

What?


Reset the pointer to the IOV memory handle array after
ucp_datatype_iter_iov_cleanup() frees the array.

Why?


On a failover endpoint, a zero-copy request whose operation fails is cleaned
up and then restarted. With UCP_DATATYPE_IOV the cleanup frees the memory
handle array but keeps the pointer, so the restart passes this check,
deregisters handles from the freed array and then registers new ones into it:

https://github.com/openucx/ucx/blob/cdc194bba6c1158689a3c4962fd8a732b3b4228e/src/ucp/dt/datatype_iter.inl#L805-L808

<details>
<summary>The new test without the fix</summary>

[ RUN      ] rcx/test_ucp_fault_tolerance_iov.zcopy_restart/1 <rc_x/get>
==3262023==ERROR: AddressSanitizer: heap-use-after-free on address 0x60600035af80 at pc 0x7fb7fefca140 bp 0x7fff5d827260 sp 0x7fff5d827250
READ of size 8 at 0x60600035af80 thread T0
    #0 0x7fb7fefca13f in ucp_datatype_iter_mem_dereg_single src/ucp/dt/datatype_iter.inl:306
    #1 0x7fb7fefca13f in ucp_datatype_iter_iov_mem_dereg src/ucp/dt/datatype_iter.c:150
    #2 0x7fb7fefe4bb4 in ucp_datatype_iter_mem_dereg src/ucp/dt/datatype_iter.inl:807
    #3 0x7fb7fefe4bb4 in ucp_proto_request_zcopy_clean src/ucp/proto/proto_common.inl:92
    #4 0x7fb7fefe4bb4 in ucp_proto_request_zcopy_reset src/ucp/proto/proto_common.c:938
    #5 0x7fb7fefe4bb4 in ucp_proto_request_zcopy_reset src/ucp/proto/proto_common.c:935
    #6 0x7fb7fefe6792 in ucp_proto_offload_zcopy_reset src/ucp/proto/proto_common.c:983
    #7 0x7fb7fefe329e in ucp_proto_request_restart src/ucp/proto/proto_common.c:871
    #8 0x7fb7feaee55f in uct_invoke_completion src/uct/base/uct_iface.h:1029
    #9 0x7fb7feaee55f in uct_rc_txqp_purge_outstanding src/uct/ib/rc/base/rc_ep.c:567
    #10 0x7fb7fe7365c0 in uct_rc_mlx5_iface_handle_failure src/uct/ib/mlx5/rc/rc_mlx5_iface.c:256
    ...

0x60600035af80 is located 0 bytes inside of 64-byte region [0x60600035af80,0x60600035afc0)
freed by thread T0 here:
    #0 0x7fb8001747e0 in __interceptor_free (/lib64/libasan.so.5+0xef7e0)
    #1 0x7fb7fefe0df5 in ucp_datatype_iter_iov_cleanup src/ucp/dt/datatype_iter.inl:328
    #2 0x7fb7fefe0df5 in ucp_datatype_iter_cleanup src/ucp/dt/datatype_iter.inl:353
    #3 0x7fb7fefe0df5 in ucp_proto_request_zcopy_complete_cb src/ucp/proto/proto_common.inl:120
    #4 0x7fb7fefe0df5 in ucp_proto_request_zcopy_complete src/ucp/proto/proto_common.inl:134
    #5 0x7fb7fefe0df5 in ucp_proto_request_zcopy_completion src/ucp/proto/proto_common.c:774
    #6 0x7fb7feaee55f in uct_invoke_completion src/uct/base/uct_iface.h:1029
    #7 0x7fb7feaee55f in uct_rc_txqp_purge_outstanding src/uct/ib/rc/base/rc_ep.c:567
    ...

</details>

How?


Set the pointer to NULL after the free, as the contiguous and SGL cleanups
do. The new test sends an IOV put or get once to find a lane of its protocol,
invalidates that lane on rc_x and sends the request again, so it restarts.

Diff: 362 lines (+271 / -91) across 4 files Reviewer: tvegas1 Review duration: 4119m
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 362 lines diff across 4 files
0.43
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.353
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #12448"
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: 42.6% (MEDIUM) · Higher = larger blast radius
42.6%
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: 16.9% · Safe to merge
16.9%
Repository