AIDEFEND in Action AIA-0173 Validated Research

LeftoverLocals: A Shared GPU Can Expose Data From Another LLM Session

Trail of Bits researchers uncovered LeftoverLocals (public vulnerability ID CVE-2023-4969), a flaw where fast temporary memory inside certain GPUs keeps leftover data after a program finishes using it. On a shared affected GPU, a second process can read those leftover values across normal OS process boundaries. In a controlled demonstration using llama.cpp (a popular open-source tool for running LLMs locally), the researchers recovered intermediate calculation values from another session and reconstructed its generated LLM replies.

Privacy LeakageRuntime IsolationMulti-Tenant AIAI Infrastructure
2 applicable AIDEFEND defenses
Source: LeftoverLocals: Listening to LLM Responses Through Leaked GPU Local Memory 
Authors: Heidy Khlaaf and Tyler Sorensen (Trail of Bits)
Original article: Jan 16, 2024

Threat Analysis

  • GPUs have a separate memory boundary that CPU isolation does not automatically clear. GPU local memory is fast scratchpad space shared by a group of GPU threads during computation. If the GPU driver or hardware hands that scratchpad to the next job without wiping it, another compute program allowed on the same affected GPU can read whatever the previous job left behind, even when the operating system isolates the two processes on the CPU.
  • The LLM text reconstruction used a modified test build. Researchers ran WizardLM-7B (an open-source 7-billion-parameter language model) on an AMD Radeon RX 7900 XT GPU. To demonstrate full response recovery, they swapped in a test version of a matrix-vector multiplication routine (a core math step an LLM runs while generating each word) so the intermediate numbers stayed in local memory long enough to be read. The experiment proves the hardware data leak is real, while exact text reconstruction depends on the model, inference code, and GPU hardware.

Applicable AIDEFEND Defenses (2)

AID-H-009.002
Accelerator Firmware & Driver Patch Management
Very High
On affected AMD Linux GPUs that support the vendor’s mitigation, install the approved driver, turn on process-isolation mode, and read back the active setting on every in-scope partition after reboot or driver changes. This mode wipes workgroup local memory between processes, directly addressing the residual data leak demonstrated in this vulnerability.
AID-H-009.004
Accelerator Isolation & VRAM/KV-Cache Hygiene
Very High
When both the scheduler and an independent host inventory confirm that an entire physical GPU is dedicated to a single trust zone, an untrusted co-resident process cannot run on that card to read leftover local memory. Before reassigning that GPU to a different trust zone, independently verify that the cleanup boundary covers local memory.

What Defenders Should Do Now

  • Inventory shared GPUs and verify vendor mitigations. Identify which workloads share physical GPUs and match each exact hardware model and driver version against vendor advisories (such as AMD-SB-6010). On supported AMD Linux systems, verify that administrators enabled the vendor’s process-isolation mode and read that setting back on every applicable partition after every reboot, maintenance window, or driver change, because a patched driver version alone does not confirm that isolation is active.
  • Keep sensitive LLM workloads off unverified shared GPUs. Until a vendor mitigation is confirmed active, dedicate an entire physical GPU to one trust zone and inspect actual scheduling and device handoffs. Seeing separate containers or an allocated GPU slice in a dashboard does not by itself prove that GPU local memory was wiped between jobs.
  • Explicitly wipe scratchpad memory if you maintain custom GPU kernels. Trail of Bits recommends zeroing out used local memory at the end of each affected GPU kernel (the small compute program running directly on the GPU). Inspect or test the compiled binary before relying on this, because compilers can silently optimize away memory-clearing writes right before a kernel exits. If you cannot verify every kernel that touches sensitive data, keep affected GPUs dedicated.
  • If you rent external or cloud GPUs, confirm physical allocation and cross-tenant cleanup evidence. Customers who do not administer host drivers or schedulers should choose deployments supporting verified whole-GPU physical exclusivity for sensitive LLM workloads and inspect authenticated provider isolation evidence covering the actual serving path, especially how physical GPUs are assigned and how local memory is sanitized before cross-tenant reuse. Reserved capacity or a dedicated logical endpoint alone does not verify physical exclusivity or local-memory clearing.

Conclusion

AIDEFEND  maps LeftoverLocals to concrete accelerator-layer checks for installed drivers, active hardware isolation modes, and verified whole-GPU workload placement. Applying these controls directly to the physical GPU and memory regions used during inference closes the cross-process data residue gap.

Last updated: