java-topology/whitepaper/outreach/vllm.md
russell@unturf.com 652608142a feat: close outreach doc gap — 276 docs (batches 11-16)
All projects with patches now have outreach docs. 276 new docs covering
CWE-407, CWE-312, CWE-362 across C, C++, Java, Python, Go, Rust, C#,
PHP, Ruby, JavaScript, Dart, Erlang, R, and more.

Outreach gap: 276 -> 0.
2026-04-15 13:57:42 -04:00

2.5 KiB
Raw Blame History

vLLM — CWE-407 Disclosure Brief (vllm-0001)

2026-04-13 · Patch available — awaiting upstream merge

Finding

One O(n²) defect in vLLM's LoRA adapter mapping. list.index() performs linear scans inside a per-token loop during LoRA index conversion, producing quadratic behavior. The code itself has a TODO acknowledging the issue. Patched.

The Defects

vllm-0001 (PATCHED — MEDIUM): vllm/lora/punica_wrapper/utils.py

# In convert_mapping() — fires per LoRA batch:
prompt_mapping: list[int] = [
    lora_index_to_id.index(x) if x > 0 else -1  # list.index() O(L) per token
    for x in mapping.prompt_mapping
]
# ...
for i in range(len(index_mapping_indices)):
    # TODO index can be slow. optimize
    lora_idx = (
        lora_index_to_id.index(index_mapping_indices[i])  # O(L) per token
        if index_mapping_indices[i] > 0 else -1
    )

lora_index_to_id.index() performs O(L) linear scan where L = number of loaded LoRA adapters. Called once per token in the batch, producing O(T×L) total.

Complexity Proof

vllm-0001: At T=2,048 tokens, L=64 loaded LoRA adapters:

  • Defective: 2,048 × 64 = 131,072 comparisons per batch
  • Fixed: 2,048 × 1 = 2,048 dict lookups
  • ~64× op reduction per batch. Fires on every LoRA inference batch.

Impact

vLLM is the leading open-source LLM serving engine, used in production for high-throughput inference. LoRA adapter serving is a primary feature for multi-tenant deployments. The mapping conversion fires on every batch when LoRA adapters are active. With many loaded adapters (common in multi-model serving), the linear scan compounds across every request.

The Fix

vllm-0001: Pre-build a reverse lookup dict:

# Before — O(T×L) with TODO acknowledging the problem
lora_index_to_id.index(x)

# After — O(T)
id_to_index: dict[int, int] = {
    v: i for i, v in enumerate(lora_index_to_id) if v is not None and v > 0
}
id_to_index[x]

Patch

Fix available: defects/vllm/patch/vllm-0001-lora-convert-mapping-index.patch

Single-file patch in vllm/lora/punica_wrapper/utils.py.

What We Ask

A patch is ready for review.

  1. Confirm receipt and assign a GitHub issue reference (vllm-project/vllm).
  2. Assess severity — fires on every LoRA inference batch in multi-adapter serving.
  3. Coordinate a disclosure date — we are targeting 90 days from first contact.
  4. We will credit the vLLM team in the public disclosure. Preferred acknowledgment format welcome.

Contact: see cover email. This brief is confidential until coordinated disclosure.