Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[BUG]: `register()` accepts a mismatched UUID under `python -O`

Đang mở
#2,697 2 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Andy-Jost đang làm issue này rồi.

Từ ngày 24/9/2026.

  • #2704 của @waterWang — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu với DeviceMemoryResource.register(), PinnedMemoryResource.register() và đường dẫn MP_register được mô tả trong issue. Tái hiện sự không khớp bằng cả python và python -O, sau đó kiểm tra phần kiểm tra UUID. Hoàn tất khi cả hai điểm vào đều nhất quán từ chối UUID không khớp và giữ nguyên UUID của resource.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug cuda.core P1
Is this a duplicate?
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 |
+-----------------------------------------+------------------------+----------------------+
Ngôn ngữ chính
Cython
Star
3.4k
Fork
334
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
123

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của NVIDIA/cuda-python

Tất cả issue của NVIDIA/cuda-python

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.