Skip to main content

GPU Memory Residue: Data Left Behind in VRAM, Local Memory and Registers Between Workloads


For executives​

When a GPU workload ends, its data does not necessarily leave the GPU. Model weights, user prompts, KV caches holding whole conversations and intermediate results can stay in GPU memory until something overwrites them, and the next workload to allocate that memory may be another tenant. Researchers have shown leftover data recovered from GPU local memory and registers across processes, and NVIDIA has fixed uninitialized-memory leaks in its own driver. For a cloud customer running regulated data, whether a provider clears GPU memory between tenants is a compliance question as much as a security one. Reading leftovers needs no exploit and no privileges, so it raises no alarms in tools that look for exploits.

Why this is a GPU problem​

On a CPU, the operating system guarantees that freshly allocated memory pages arrive zeroed, so one process never sees another's leftovers. GPU memory is managed by the GPU driver, not the kernel's virtual memory system, and cudaMalloc returns blocks without clearing them. Whatever was last written there is still there.

What can be left behind​

  • Model weights: a served model's parameters stay resident for as long as it is loaded.
  • Inference inputs and outputs: user queries, images and documents copied to the GPU for processing.
  • KV cache: transformer models cache attention state for each conversation, so the cache can hold the history of many users' sessions.
  • Intermediate activations: internal results that often reveal more about inputs than final outputs do.

Three layers of residue​

  • Device memory (VRAM). A new allocation can contain data from the same process, a previous process or, on shared GPUs, a previous tenant. NVIDIA's own January 2025 bulletin fixed CVE-2024-53869, a leak of uninitialized memory from the Linux Unified Memory driver.
  • Local memory. LeftoverLocals (CVE-2023-4969), disclosed by Tyler Sorensen of Trail of Bits on January 16, 2024, showed that a co-resident process could read data another process left in GPU local memory, and reconstructed a language model's responses from it with high precision. Affected GPUs came from AMD, Apple, Qualcomm and Imagination. NVIDIA confirmed its devices were not affected, and the issue was not observed on Arm or Intel GPUs. It is included here because it shows that a fast on-chip memory region can outlive the kernel that used it; Sorensen is also a co-author of the Behind Bars MIG side-channel paper.
  • Registers. Whispering Pixels research showed GPU registers not cleared between programs on some architectures, letting a later program read an earlier one's values. AMD fixed it with an opt-in mode that clears registers and costs performance (CVE-2024-21969). The general lesson applies to any GPU: hardware state is not private between workloads unless something clears it.

The cloud lifecycle​

Customer A's session loads a model, serves requests and ends. The GPU returns to the pool and is assigned to customer B. Unless the provider clears GPU memory in between, B can allocate memory that still holds A's data, and code that reads memory before writing it, which malicious code does deliberately, recovers it. MIG does not change this within an instance: memory inside a MIG instance is not automatically cleared when one tenant's session ends and the next begins.

Mitigations​

  • Clearing between tenants: providers can scrub GPU memory when a GPU or MIG instance changes hands, at a cost in time that grows with memory size.
  • Clearing in the application: workloads handling sensitive data can zero their own buffers before freeing them.
  • Confidential computing: NVIDIA's confidential computing mode encrypts GPU memory per VM on supported GPUs, in whole-GPU pass-through configurations.
  • Dedicated hardware: no next tenant, no residue.

Detection​

Reading residue is legitimate-looking: allocate memory, copy it to the host. The tell is the order. A process that allocates large GPU buffers and copies them back to the host without ever writing to them, or runs kernels that read freshly allocated memory before writing it, is harvesting what someone else left. Seeing that needs per-process allocation and transfer events from the driver, and inspection of the kernels a process launches, attributed to the tenant and GPU instance involved.