Skip to content

Fix uninitialized read in uninitialized_copy_n - #5811

Merged
bernhardmgruber merged 1 commit into
NVIDIA:mainfrom
bernhardmgruber:fix_uninit_read
Sep 9, 2025
Merged

bernhardmgruber merged 1 commit into
NVIDIA:mainfrom
bernhardmgruber:fix_uninit_read

Conversation

@bernhardmgruber

Copy link
Copy Markdown
Contributor

We need to tighten the check to use copy_n only when the copy ctor also has no side effect.

Fixes: #5809

We need to tighten the check to use copy_n only when the copy ctor also has no side effect.

Fixes: NVIDIA#5809
@bernhardmgruber
bernhardmgruber requested a review from a team as a code owner September 8, 2025 16:20
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Sep 8, 2025
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Sep 8, 2025
@github-actions

github-actions Bot commented Sep 8, 2025

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 3h 26m: Pass: 100%/154 | Total: 5d 17h | Max: 3h 19m | Hits: 77%/177577

See results here.

@bernhardmgruber
bernhardmgruber merged commit ee141c6 into NVIDIA:main Sep 9, 2025
@bernhardmgruber
bernhardmgruber deleted the fix_uninit_read branch September 9, 2025 07:08
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Sep 9, 2025
Naraenda pushed a commit to ROCm/rocm-libraries that referenced this pull request Oct 26, 2026
…initialized_copy_n (NVIDIA/cccl#5811)

Upstream: NVIDIA/cccl@ee141c6

- Clean port (system/cuda): uninitialized_copy_n only delegates to copy_n when construction AND assignment are trivial.
- HIP counterpart: no change: the copy_n fast path in uninitialized_copy_n was ported to system/cuda only (performance-only, item 4b2201184c4); hip uninitialized_copy still always placement-constructs, so the bug does not exist there
- test/ counterpart: none (no upstream test change)
- Not compiled, tests not run (per human)

Co-Authored-By: Claude <noreply@anthropic.com>
amd-jmahovsky added a commit to ROCm/rocm-libraries that referenced this pull request Oct 28, 2026
…ialized_copy delegates to copy_n

Related upstream commit: 4b2201184c4 Use `thrust::copy` in `thrust::uninitialized_copy[_n]` in CUDA system when possible (NVIDIA/cccl#5181)
Related upstream commit: ee141c6b175 Fix uninitialized read in uninitialized_copy_n (NVIDIA/cccl#5811)
Related local port commit: 9d7099b
Related local port commit: c91e8ff

Both upstream commits were ported to system/cuda only, with the HIP
counterpart marked "no change: performance-only". Bring system/hip in line:

- hip_rocprim::uninitialized_copy_n now delegates to hip_rocprim::copy_n
  when the output value type is trivially constructible from, and
  trivially assignable from, the input reference (the #5811 condition).
  For trivially relocatable device-to-device copies this turns the
  placement-new parallel_for kernel into a hipMemcpyAsync.
- copy_n is forward-declared rather than included, as upstream does, to
  avoid the circular include via internal/copy_cross_system.h.
- Includes follow upstream's granular libhipcxx headers
  (__iterator/distance.h, __iterator/incrementable_traits.h, and the
  is_trivially_{constructible,assignable} traits actually used).

Not compiled, tests not run (per human)

Co-Authored-By: Claude <noreply@anthropic.com>
Naraenda pushed a commit to ROCm/rocm-libraries that referenced this pull request Oct 29, 2026
…initialized_copy_n (NVIDIA/cccl#5811)

Upstream: NVIDIA/cccl@ee141c6

- Clean port (system/cuda): uninitialized_copy_n only delegates to copy_n when construction AND assignment are trivial.
- HIP counterpart: no change: the copy_n fast path in uninitialized_copy_n was ported to system/cuda only (performance-only, item 4b2201184c4); hip uninitialized_copy still always placement-constructs, so the bug does not exist there
- test/ counterpart: none (no upstream test change)
- Not compiled, tests not run (per human)

Co-Authored-By: Claude <noreply@anthropic.com>
Naraenda pushed a commit to ROCm/rocm-libraries that referenced this pull request Oct 29, 2026
…initialized_copy_n (NVIDIA/cccl#5811)

Upstream: NVIDIA/cccl@ee141c6

- Clean port (system/cuda): uninitialized_copy_n only delegates to copy_n when construction AND assignment are trivial.
- HIP counterpart: no change: the copy_n fast path in uninitialized_copy_n was ported to system/cuda only (performance-only, item 4b2201184c4); hip uninitialized_copy still always placement-constructs, so the bug does not exist there
- test/ counterpart: none (no upstream test change)
- Not compiled, tests not run (per human)

Co-Authored-By: Claude <noreply@anthropic.com>
Naraenda pushed a commit to ROCm/rocm-libraries that referenced this pull request Oct 29, 2026
…ialized_copy delegates to copy_n

Related upstream commit: 4b2201184c4 Use `thrust::copy` in `thrust::uninitialized_copy[_n]` in CUDA system when possible (NVIDIA/cccl#5181)
Related upstream commit: ee141c6b175 Fix uninitialized read in uninitialized_copy_n (NVIDIA/cccl#5811)
Related local port commit: 9d7099b
Related local port commit: c91e8ff

Both upstream commits were ported to system/cuda only, with the HIP
counterpart marked "no change: performance-only". Bring system/hip in line:

- hip_rocprim::uninitialized_copy_n now delegates to hip_rocprim::copy_n
  when the output value type is trivially constructible from, and
  trivially assignable from, the input reference (the #5811 condition).
  For trivially relocatable device-to-device copies this turns the
  placement-new parallel_for kernel into a hipMemcpyAsync.
- copy_n is forward-declared rather than included, as upstream does, to
  avoid the circular include via internal/copy_cross_system.h.
- Includes follow upstream's granular libhipcxx headers
  (__iterator/distance.h, __iterator/incrementable_traits.h, and the
  is_trivially_{constructible,assignable} traits actually used).

Not compiled, tests not run (per human)

Co-Authored-By: Claude <noreply@anthropic.com>
Naraenda pushed a commit to ROCm/rocm-libraries that referenced this pull request Oct 30, 2026
…initialized_copy_n (NVIDIA/cccl#5811)

Upstream: NVIDIA/cccl@ee141c6

- Clean port (system/cuda): uninitialized_copy_n only delegates to copy_n when construction AND assignment are trivial.
- HIP counterpart: no change: the copy_n fast path in uninitialized_copy_n was ported to system/cuda only (performance-only, item 4b2201184c4); hip uninitialized_copy still always placement-constructs, so the bug does not exist there
- test/ counterpart: none (no upstream test change)
- Not compiled, tests not run (per human)

Co-Authored-By: Claude <noreply@anthropic.com>
Beanavil pushed a commit to ROCm/rocm-libraries that referenced this pull request Oct 30, 2026
…initialized_copy_n (NVIDIA/cccl#5811)

Upstream: NVIDIA/cccl@ee141c6

- Clean port (system/cuda): uninitialized_copy_n only delegates to copy_n when construction AND assignment are trivial.
- HIP counterpart: no change: the copy_n fast path in uninitialized_copy_n was ported to system/cuda only (performance-only, item 4b2201184c4); hip uninitialized_copy still always placement-constructs, so the bug does not exist there
- test/ counterpart: none (no upstream test change)
- Not compiled, tests not run (per human)

Co-Authored-By: Claude <noreply@anthropic.com>
amd-jmahovsky added a commit to ROCm/rocm-libraries that referenced this pull request Oct 30, 2026
…ialized_copy delegates to copy_n

Related upstream commit: 4b2201184c4 Use `thrust::copy` in `thrust::uninitialized_copy[_n]` in CUDA system when possible (NVIDIA/cccl#5181)
Related upstream commit: ee141c6b175 Fix uninitialized read in uninitialized_copy_n (NVIDIA/cccl#5811)
Related local port commit: 9d7099b
Related local port commit: c91e8ff

Both upstream commits were ported to system/cuda only, with the HIP
counterpart marked "no change: performance-only". Bring system/hip in line:

- hip_rocprim::uninitialized_copy_n now delegates to hip_rocprim::copy_n
  when the output value type is trivially constructible from, and
  trivially assignable from, the input reference (the #5811 condition).
  For trivially relocatable device-to-device copies this turns the
  placement-new parallel_for kernel into a hipMemcpyAsync.
- copy_n is forward-declared rather than included, as upstream does, to
  avoid the circular include via internal/copy_cross_system.h.
- Includes follow upstream's granular libhipcxx headers
  (__iterator/distance.h, __iterator/incrementable_traits.h, and the
  is_trivially_{constructible,assignable} traits actually used).

Not compiled, tests not run (per human)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[BUG]: compute-sanitizer initcheck regression in texture_transform_iterator tests

2 participants