Skip to content

cuda.core: reject negative IPC allocation fds under -O (Glasswing V3.2) - #2219

Merged
Andy-Jost merged 1 commit into
NVIDIA:mainfrom
Andy-Jost:ajost/glasswing-v3-2-ipc-fd-validation
Jun 15, 2026
Merged

cuda.core: reject negative IPC allocation fds under -O (Glasswing V3.2)#2219
Andy-Jost merged 1 commit into
NVIDIA:mainfrom
Andy-Jost:ajost/glasswing-v3-2-ipc-fd-validation

Conversation

@Andy-Jost

Copy link
Copy Markdown
Contributor

Summary

Addresses Glasswing security finding V3.2 (NVBUG 6268893): IPCAllocationHandle._init used assert handle >= 0, which CPython strips under -O. Replace with an explicit ValueError so negative allocation handles (fds) are always rejected.

Changes

  • cuda_core/cuda/core/_memory/_ipc.pyx: raise ValueError when handle < 0 instead of asserting
  • cuda_core/tests/memory_ipc/test_errors.py: add test_ipc_allocation_handle_rejects_negative_fd

Test Coverage

  • test_ipc_allocation_handle_rejects_negative_fd — verifies IPCAllocationHandle._init(-1, None) raises ValueError with the expected message (behavior preserved under -O)

Related Work

  • NVIDIA/cuda-python-private#382 (Glasswing V3.2, NVBugs 6268893)
  • Part of Glasswing audit umbrella NVIDIA/cuda-python-private#358

Replace assert handle >= 0 with an explicit ValueError so fd validation
is not stripped when CPython runs with -O (Glasswing V3.2 / NVBugs 6268893).
@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 P2 Low priority - Nice to have 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 rparolinJune 15, 2026 17:10
@github-actions

This comment has been minimized.

@lijinf2lijinf2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@Andy-Jost
Andy-Jost merged commit 25abc36 into NVIDIA:mainJun 15, 2026
114 checks passed
@Andy-Jost
Andy-Jost deleted the ajost/glasswing-v3-2-ipc-fd-validation branch June 15, 2026 18:50
@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 moduleP2Low priority - Nice to have

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Andy-Jost@lijinf2