Skip to content

[BUG]: DeviceMemoryResource.register() segfaults when IPC is not enabled #2568

Description

@fedonman

Is this a duplicate?

No.

Type of Bug

Runtime Error

Component

cuda.core

Describe the bug

DeviceMemoryResource.register() and PinnedMemoryResource.register() crash the interpreter with SIGSEGV when the memory resource does not have IPC enabled, including the default resource returned by Device().memory_resource. No exception is raised, so the call cannot be guarded with try.

The cause is an unconditional read of self._ipc_data in MP_register (cuda_core/cuda/core/_memory/_ipc.pyx), which is None unless IPC is enabled.

Present in released cuda-core 1.0.1, 1.1.0 and 1.1.1, and on main.

How to Reproduce

import uuid
from cuda.core import Device, DeviceMemoryResource

d = Device()
d.set_current()
DeviceMemoryResource(d).register(uuid.uuid4())

Run from a parent process, the child dies with no output at all:

stdout: ''
stderr: ''
returncode: -11 -> SIGSEGV

Expected behavior

register() should raise RuntimeError("Memory resource is not IPC-enabled"), matching the allocation_handle property on the same class.

Operating System

Ubuntu 24.04 on WSL2

Output from running nvidia-smi on the command line:

Sun Aug  9 11:22:15 2026       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 610.43.02              KMD Version: 610.62        CUDA UMD Version: 13.3     |
+-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 4060 Ti     On  |   00000000:01:00.0  On |                  N/A |
|  0%   41C    P8              5W /  160W |    2399MiB /   8188MiB |      8%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNeeds the team's attention

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions