Skip to content

UCT/ZE/IPC: Allow peers to import IPC handles without CMA - #12441

Open
yafshar wants to merge 4 commits into
openucx:masterfrom
intel-staging:fix/ze-ipc-ptrace-peers
Open

yafshar wants to merge 4 commits into
openucx:masterfrom
intel-staging:fix/ze-ipc-ptrace-peers

Conversation

@yafshar

@yafshar yafshar commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

What?

Call ucs_sys_ptrace_enable_peers() from uct_ze_ipc_md_open(), and add a regression test.

Follow-up to #12165, which did the same for cuda_ipc.

Why?

A ze_ipc importer duplicates the exporter's dma-buf fd with pidfd_getfd(), which must pass the ptrace access check against the exporter. Under Yama ptrace_scope 1, a peer on the same node that is not an ancestor of the exporter passes only if the exporter called prctl(PR_SET_PTRACER), or if the peer has CAP_SYS_PTRACE. Before this change, ze_ipc did not grant the
exception itself. CMA can grant it during resource discovery, but if no applicable exception is in place, an unprivileged peer can get EPERM from pidfd_getfd() and the import fails. ze_ipc has no fallback for a failed import: UCT put/get return an error. In our UCP tag_bw run over ze_ipc, the rendezvous then did not complete and both sides waited until the timeout.

How?

  • Call the helper in md_open, the same as cuda_ipc and CMA, guarded by SYS_pidfd_open and SYS_pidfd_getfd, like the import path.

  • The exception is process-wide. Under Yama ptrace_scope=1, PR_SET_PTRACER_ANY removes Yama's ancestry restriction for otherwise permitted callers, not just UCX peers. Closing the MD does not restore the previous setting. UCP opens every MD before it filters UCX_TLS, so excluding ze_ipc from UCX_TLS does not prevent this call. UCX_MODULES=^ze suppresses this ZE call, but CMA can still grant the same process-wide exception: it sets it while querying its resources, regardless of UCX_TLS.

  • New test test_ze_ipc_rma_xproc.md_open_allows_peers runs in an exec'd copy of the test, so that the test's own prctl() calls (the reset and the retry below) do not change the gtest process. That copy:

    1. checks that it can take one of its own fds with pidfd_getfd(), and skips on ENOSYS or EPERM (missing syscall or a syscall filter);
    2. clears its exception and checks that a forked child cannot take the fd (skips if it can, e.g. with CAP_SYS_PTRACE);
    3. opens the ze_ipc MD and checks that the child now can;
    4. if the child still gets EPERM, retries with PR_SET_PTRACER_ANY set by the test. The test fails if that retry succeeds, because the MD should have granted access, and skips if access is still denied.

    Any other error fails the test. It skips unless ptrace_scope is 1. If another library in the process grants the exception while the MD opens, the test also passes without the fix.

For both comparisons below, Yama ptrace_scope was 1, CAP_SYS_PTRACE was dropped, and no exception granted by another component was in effect when access was checked.

On B60 and B70, the regression test failed without the fix and passed with it, including with CMA disabled. Separately, on B60 with CMA disabled, UCT put/get and UCP tag_bw over ze_ipc failed without the fix and passed with it.

Simulated EPERM and ENOSYS produced the expected skips. The existing ZE gtest suite completed successfully on both nodes, with 10 skips per run.

Signed-off-by: Yaser Afshar <yaser.afshar@intel.com>
Signed-off-by: Yaser Afshar <yaser.afshar@intel.com>
Signed-off-by: Yaser Afshar <yaser.afshar@intel.com>
Signed-off-by: Yaser Afshar <yaser.afshar@intel.com>
@yafshar
yafshar requested review from a team and j-xiong as code owners November 23, 2026 17:28
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Review complete — no issues found.

@yafshar
yafshar requested a review from tvegas1 November 23, 2026 19:54
@svc-ucx

svc-ucx commented Nov 24, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Tests roce on worker 1) · commit b16694fd

TL;DR: udx/test_proto_reset.rndv_am_bcopy/0 hung — the very first 70 KB tag send over ud_x with RNDV_THRESH=0 RNDV_SCHEME=am never completed, burning four consecutive 180 s request/flush deadlines and finally aborting the whole gtest binary; this is in the UD rndv/AM path and is unrelated to PR #12441 (which only touches uct/ze/ipc), so re-run and track it as a UD rndv/am hang.

Full analysis

Summary: roce on worker 1 gtest job aborted (make: *** [Makefile:5017: test] Aborted (core dumped)) in udx/test_proto_reset.rndv_am_bcopy/0 <ud_x> after repeated "request ... did not complete on time" errors.

Root cause: A hang, not a slow test. The test starts at 01:17:24.30 and the next output is 01:20:24.43 — a clean 180 s gap (the gtest default deadline), repeated four times (01:20:24, 01:23:24, 01:26:25, 01:29:25). Those four expirations map exactly to the first phase of reset_protocol(): the single wireup message's send+recv requests (wait_reqs, test_ucp_request.cc:392) and then the two flush_workers() requests (ucp_test.cc:311 request %p did not complete on time). This is all before any protocol restart happens, so the restart machinery is not implicated — the plain 70 KB rndv/am/bcopy transfer over ud_x simply never completed. The downstream failures are cascade effects of that stall: test_ucp_request.cc:374 (wait_any 10 s deadline, at 01:29:36, 11 s after the last stall), test_ucp_request.cc:255 (m_completed false — the EP flush inside restart() also never completed), and finally test_helpers.cc:57 "Connection timed out - abort testing" → SIGABRT with the backtrace parked in ucp_test::progress()/check_events(). Notably no "Endpoint timeout" was reported, so the UD EP was considered alive while the multi-fragment rndv/AM payload never finished — consistent with a stuck/lost UD fragment or a pending-queue stall, aggravated by the test's own IB_TX_QUEUE_LEN=65 override (test_ucp_request.cc:133).

Implicated commit: unknown — not the PR commit. [REDACTED:Hex High Entropy String] / PR #12441 ("UCT/ZE/IPC: Allow peers to import IPC handles without CMA") touches only the ZE IPC transport, which is not exercised by this ud_x/RoCE test. Suspects to check on master for the UD stall (most recent changes to that path): f53da7f0 (Thomas Vegas, refcounted TTL-based AH cache), 0ee470a8 (Ilia Yastrebov, generation ID in UD dest_id), 183a66db (Ilia Yastrebov, keep-alive for private UD EPs).

File: test/gtest/ucp/test_ucp_request.cc:512 (test definition) / :392 (the wait_reqs that hung); reported failures at test/gtest/ucp/test_ucp_request.cc:374 and :255; timeout printed from test/gtest/ucp/ucp_test.cc:311

Suggested fix: Re-run the job to confirm the failure is not reproducible for this PR — the diff cannot affect ud_x, so do not block #12441 on it. For the real defect, open a flaky/hang issue for test_proto_reset.rndv_am_bcopy on ud_x and reproduce locally with UCX_TLS=ud_x UCX_RNDV_THRESH=0 UCX_RNDV_SCHEME=am UCX_IB_TX_QUEUE_LEN=65 and a 70 KB tag send, with UCX_LOG_LEVEL=trace_data on the UD EP to see whether a rndv/AM fragment or the ATS/ACK is lost. Two concrete leads: (a) the IB_TX_QUEUE_LEN=65 override at test_ucp_request.cc:133 makes the UD TX queue pathologically small — verify UD correctly resends/drains pending when the queue is exhausted, and consider raising that value if it is only meant to force pending-queue pressure for the restart phase, not the wireup phase; (b) audit the recent UD AH-cache/dest_id/keep-alive commits above for a dropped-packet path that leaves a rndv/AM transfer permanently incomplete while keep-alive still considers the EP healthy. Do not raise the gtest deadline — the process was hung, not making progress.

Related: PR #12441 (#12441, the PR under test — unrelated to the failure); possibly relevant to the restart/flush path: #12266 "UCP/FLUSH: Flush the other lanes after the pending lane", #12322 "UCP/RMA: Fix restart of partially sent PUT requests"

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 75b793e6-8f8b-4206-ba38-fce33c1769df in the triage console for the audit trail.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants