PyTorch CUDACachingAllocator memory corruption via caching_allocator_delete
PyTorch 2.6.0 crashes when torch.cuda.memory.caching_allocator_delete is called on certain device pointers, failing to locate the corresponding memory block. The crash in the NativeCachingAllocator::free function causes program abort.
What happened
PyTorch version 2.6.0 crashes with an 'Aborted' error when the torch.cuda.memory.caching_allocator_delete function is called on certain memory pointers.
Investigation found that the crash occurs in the NativeCachingAllocator::free function at c10/cuda/CUDACachingAllocator.cpp#L3406, where a TORCH_CHECK assertion fails when the function cannot locate an allocated block corresponding to the provided device pointer.
Reported impact
The crash causes the program to abort, resulting in denial of service to applications using this memory management function.
Classification
Sources and evidence
This record was researched and written by the Index, based on the following original reporting.