Skip to content

cuda.core: validate IPC buffer import size against mapped extent (Glasswing V2.2)#2224

Merged
Andy-Jost merged 1 commit into
NVIDIA:mainfrom
Andy-Jost:ajost/glasswing-v2-2-ipc-size-vs-extent
Jun 15, 2026
Merged

cuda.core: validate IPC buffer import size against mapped extent (Glasswing V2.2)#2224
Andy-Jost merged 1 commit into
NVIDIA:mainfrom
Andy-Jost:ajost/glasswing-v2-2-ipc-size-vs-extent

Conversation

@Andy-Jost

Copy link
Copy Markdown
Contributor

Summary

Addresses Glasswing finding V2.2 (NVBUG 6268889): a peer-supplied IPCBufferDescriptor.size was trusted as buf._size and used as the cuMemcpyAsync length without checking against the actual mapped allocation extent, enabling an oversized device copy when the receiver imported and copied a forged descriptor.

Changes

  • cuda_core/cuda/core/_memory/_ipc.pyx: after deviceptr_import_ipc, query CU_POINTER_ATTRIBUTE_RANGE_SIZE on the imported pointer and reject descriptors whose advertised size exceeds the mapped extent before calling Buffer_from_deviceptr_handle
  • cuda_core/tests/memory_ipc/test_errors.py: TestImportOversizedBufferDescriptorSize — cross-process harness that forges an oversized size on a valid export payload and asserts import raises ValueError

Test Coverage

  • TestImportOversizedBufferDescriptorSize — peer forges oversized size on a valid 64-byte export blob; child import raises ValueError (DeviceMR and PinnedMR parametrizations)

Related Work

Reject peer-supplied IPCBufferDescriptor sizes larger than the driver-reported
allocation extent before storing buf._size, preventing oversized cuMemcpyAsync
lengths on imported buffers (Glasswing V2.2).
@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 rwgk June 15, 2026 19:03
@github-actions

Copy link
Copy Markdown

@Andy-Jost Andy-Jost merged commit 3d78ffb into NVIDIA:main Jun 15, 2026
160 of 168 checks passed
@Andy-Jost Andy-Jost deleted the ajost/glasswing-v2-2-ipc-size-vs-extent branch June 15, 2026 22:58
github-actions Bot pushed a commit that referenced this pull request Jun 16, 2026
Removed preview folders for the following PRs:
- PR #2150
- PR #2217
- PR #2221
- PR #2224
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 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