[BUG]: `register()` accepts a mismatched UUID under `python -O`
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 68/100
Línea de trabajo
Comienza con DeviceMemoryResource.register(), PinnedMemoryResource.register() y la ruta MP_register descrita en el issue. Reproduce la discrepancia tanto con python como con python -O y, después, inspecciona la comprobación de UUID. El trabajo estará terminado cuando ambos puntos de entrada rechacen de forma coherente una UUID que no coincida y conserven la UUID del recurso.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Is this a duplicate?
- I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct
Type of Bug
Silent Failure
Component
cuda.core
Describe the bug
DeviceMemoryResource.register() and PinnedMemoryResource.register() check that the UUID they are given matches the resource's own with a bare assert in MP_register, so the check is absent whenever CPython runs with -O. The call then registers the resource under the other key and rewrites the resource's UUID, and mr.uuid reports the new value from then on.
How to Reproduce
import uuid
from cuda.core import Device, DeviceMemoryResource, DeviceMemoryResourceOptions
dev = Device(); dev.set_current()
mr = DeviceMemoryResource(dev, DeviceMemoryResourceOptions(ipc_enabled=True))
try:
mr.register(uuid.UUID("00000000-0000-0000-0000-000000000001"))
except AssertionError:
print("rejected")
else:
print("accepted, uuid is now", mr.uuid)
$ python repro.py
rejected
$ python -O repro.py
accepted, uuid is now 00000000-0000-0000-0000-000000000001
Expected behavior
register() should reject a UUID that is not the resource's own whether or not CPython was started with -O. Assertions are removed under -O, so the check as written does not exist in an optimized interpreter and the resource silently takes on the other key instead of raising.
Operating System
Ubuntu 26.04 LTS
nvidia-smi output
Tue Aug 25 15:01:31 2026
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 595.84 Driver Version: 595.84 CUDA Version: 13.2 |
+-----------------------------------------+------------------------+----------------------+
| 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 3050 ... Off | 00000000:01:00.0 Off | N/A |
| N/A 59C P3 749W / 30W | 11MiB / 4096MiB | 8% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
- Lenguaje dominante
- Cython
- Estrellas
- 3.4k
- Forks
- 329
- Merge medio
- 1 d 22 h
- PR fusionados (30 d)
- 113
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de NVIDIA/cuda-python
-
bug cuda.core
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
NVIDIA/cuda-python#2886 · 1 comentario ·
-
triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
NVIDIA/cuda-python#2717 ·
-
triage
Dificultad 1/5 1-3 horas Aptitud para principiantes 90/100
NVIDIA/cuda-python#2712 ·
-
[BUG]: LocatedHeaderDir is mutable, so callers can poison the cached header-directory lookup Abiertotriage
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
NVIDIA/cuda-python#2646 · 1 reacción ·
-
cuda.core triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
NVIDIA/cuda-python#2435 · 1 comentario ·
Todos los issues de NVIDIA/cuda-python
Issues similares
-
货币战争手改优先级配置缺少列表元素类型校验(P3) Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
syfoud/Simulated_Scepter#172 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
crossplane/crossplane#7859 ·
-
bot:ai-assisted component:compact-js status:untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
midnightntwrk/midnight-sdk#403 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nightscout/nocturne#1379 ·