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-JostAndy-Jost added this to the cuda.core v1.1.0 milestone Jun 15, 2026
@Andy-JostAndy-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-JostAndy-Jost self-assigned this Jun 15, 2026
@Andy-Jost
Andy-Jost requested a review from mdboomJune 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:mainJun 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.

Andy-Jost added a commit to Andy-Jost/cuda-python that referenced this pull request Jul 8, 2026
Add a Highlights section, backfill PR/issue links on New features entries,
and add Bug fixes entries for the v1.1.0 IPC import hardening (NVIDIA#2219, NVIDIA#2223,
NVIDIA#2224), the ManagedBuffer.accessed_by torn-state fix (NVIDIA#2222), and graph node
attachment lifetimes (NVIDIA#2280).
Highlights (per review): the .pyi type-stub support and the new
cuda.core.texture module; NVLink enumeration is covered in New features /
Bug fixes rather than as a highlight. Also adds a New features entry for the
cuda.core.texture module (NVIDIA#467, NVIDIA#2095, NVIDIA#2307).
Andy-Jost added a commit to Andy-Jost/cuda-python that referenced this pull request Jul 8, 2026
Add a Highlights section, backfill PR/issue links on New features entries,
and add Bug fixes entries for the v1.1.0 IPC import hardening (NVIDIA#2219, NVIDIA#2223,
NVIDIA#2224), the ManagedBuffer.accessed_by torn-state fix (NVIDIA#2222), and graph node
attachment lifetimes (NVIDIA#2280).
Highlights (per review): the .pyi type-stub support and the new
cuda.core.texture module; NVLink enumeration is covered in New features /
Bug fixes rather than as a highlight. Also adds a New features entry for the
cuda.core.texture module (NVIDIA#467, NVIDIA#2095, NVIDIA#2307).
Andy-Jost added a commit that referenced this pull request Jul 8, 2026
* docs(core): finalize 1.1.0 release notes
Add a Highlights section, backfill PR/issue links on New features entries,
and add Bug fixes entries for the v1.1.0 IPC import hardening (#2219, #2223,
#2224), the ManagedBuffer.accessed_by torn-state fix (#2222), and graph node
attachment lifetimes (#2280).
Highlights (per review): the .pyi type-stub support and the new
cuda.core.texture module; NVLink enumeration is covered in New features /
Bug fixes rather than as a highlight. Also adds a New features entry for the
cuda.core.texture module (#467, #2095, #2307).
* Reorder API refs + ensure each section has currentmodule
the compilation toolchain is one of the unique selling points of cuda.core, but we are burying it deeply
---------
Co-authored-by: Leo Fang <leof@nvidia.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugSomething isn't workingcuda.coreEverything related to the cuda.core moduleP1Medium priority - Should do

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Andy-Jost@mdboom