Skip to content

cuda.core: validate IPC descriptor lengths before import (Glasswing V2.1/V7.1)#2223

Merged
Andy-Jost merged 2 commits into
NVIDIA:mainfrom
Andy-Jost:ajost/glasswing-v2-v7-ipc-descriptor-oob
Jun 15, 2026
Merged

cuda.core: validate IPC descriptor lengths before import (Glasswing V2.1/V7.1)#2223
Andy-Jost merged 2 commits into
NVIDIA:mainfrom
Andy-Jost:ajost/glasswing-v2-v7-ipc-descriptor-oob

Conversation

@Andy-Jost

Copy link
Copy Markdown
Contributor

Summary

Addresses two related Glasswing IPC import findings: peer-supplied descriptor payloads shorter than the driver struct size could be read past bounds during buffer pointer import or event-handle memcpy.

Changes

  • cuda_core/cuda/core/_memory/_ipc.pyx: reject IPCBufferDescriptor payloads smaller than sizeof(CUmemPoolPtrExportData) before deviceptr_import_ipc (V2.1)
  • cuda_core/cuda/core/_event.pyx: reject IPCEventDescriptor reserved fields smaller than sizeof(CUipcEventHandle) before memcpy (V7.1)
  • cuda_core/tests/memory_ipc/test_errors.py: test_import_truncated_buffer_descriptor
  • cuda_core/tests/test_event.py: test_import_truncated_event_descriptor

Test Coverage

  • Truncated buffer descriptor raises ValueError before driver import (IPC fixture)
  • Truncated event descriptor raises ValueError before memcpy (no GPU required)

Related Work

  • NVIDIA/cuda-python-private#360 (Glasswing V2.1, NVBugs 6268888)
  • NVIDIA/cuda-python-private#364 (Glasswing V7.1, NVBugs 6268898)
  • Part of Glasswing audit umbrella NVIDIA/cuda-python-private#358
  • Related: Q about CUDA API:cudaHostAlloc #373 (pickle → IPC) defers hard length validation to V2.1

Reject truncated buffer and event IPC descriptors before memcpy or
deviceptr_import_ipc can read past the peer-supplied payload (Glasswing
V2.1 / V7.1, NVBugs 6268888 / 6268898).
@Andy-Jost Andy-Jost added this to the cuda.core v1.1.0 milestone Jun 15, 2026
@Andy-Jost Andy-Jost added bug Something isn't working P1 Medium priority - Should do cuda.core Everything related to the cuda.core module labels Jun 15, 2026
@Andy-Jost Andy-Jost self-assigned this Jun 15, 2026
@Andy-Jost Andy-Jost requested a review from mdboom June 15, 2026 18:40
@github-actions

This comment has been minimized.

Resolve test_errors.py conflict: keep both truncated-descriptor and
negative-fd rejection tests.
@Andy-Jost Andy-Jost enabled auto-merge (squash) June 15, 2026 21:06
@Andy-Jost Andy-Jost disabled auto-merge June 15, 2026 21:10
@Andy-Jost Andy-Jost merged commit 1308bc5 into NVIDIA:main Jun 15, 2026
104 checks passed
@Andy-Jost Andy-Jost deleted the ajost/glasswing-v2-v7-ipc-descriptor-oob branch June 15, 2026 22:59
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

Copy link
Copy Markdown
Doc Preview CI
Preview removed because the pull request was closed or merged.

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

Labels

bug Something isn't working cuda.core Everything related to the cuda.core module P1 Medium priority - Should do

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants