Skip to content

Commit 77d0b5d

Browse files
ashetaia-amdgregkh
authored andcommitted
drm/amdkfd: Clear VRAM on allocation to prevent stale data exposure
commit ad52d61 upstream. KFD VRAM allocations set AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE but not AMDGPU_GEM_CREATE_VRAM_CLEARED, leaving freshly allocated VRAM with stale data from prior use observable by compute kernels. The GEM ioctl path already sets VRAM_CLEARED for all userspace allocations via amdgpu_gem_create_ioctl() and amdgpu_mode_dumb_create(). The KFD path was missing this flag, allowing stale page table remnants to leak into user buffers. This causes crashes in RCCL P2P transport where non-zero data in ptrExchange/head/tail fields corrupts the protocol handshake. Signed-off-by: Amir Shetaia <Amir.Shetaia@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 48fb221 commit 77d0b5d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1717,7 +1717,8 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
17171717
alloc_domain = AMDGPU_GEM_DOMAIN_GTT;
17181718
alloc_flags = 0;
17191719
} else {
1720-
alloc_flags = AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE;
1720+
alloc_flags = AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE |
1721+
AMDGPU_GEM_CREATE_VRAM_CLEARED;
17211722
alloc_flags |= (flags & KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC) ?
17221723
AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED : 0;
17231724

0 commit comments

Comments
 (0)