[Security] Fix P2P ZMQ socket exhaustion via unbounded peer sessions (#51504)

Signed-off-by: jperezde <jperezde@redhat.com>
Signed-off-by: Juan Pérez de Algaba <jperezde@redhat.com>
Co-authored-by: Robert Shaw <114415538+robertgshaw2-redhat@users.noreply.github.com>
Co-authored-by: Itay Etelis <92247226+Etelis@users.noreply.github.com>
This commit is contained in:
Juan Pérez de Algaba
2026-10-11 11:39:11 -04:00
committed by GitHub
co-authored by Robert Shaw Itay Etelis
parent 239a3fa3a8
commit 93d2cab35e
9 changed files with 711 additions and 41 deletions
+18
View File
@@ -233,6 +233,9 @@ if TYPE_CHECKING:
VLLM_NIXL_SIDE_CHANNEL_PORT: int = 5600
VLLM_P2P_SIDE_CHANNEL_HOST: str = "localhost"
VLLM_P2P_SIDE_CHANNEL_PORT: int = 5710
VLLM_P2P_MAX_PEERS: int = 128
VLLM_P2P_HANDSHAKE_TIMEOUT_S: int = 30
VLLM_P2P_IDLE_TIMEOUT_S: int = 300
VLLM_EC_SIDE_CHANNEL_HOST: str = "localhost"
VLLM_EC_SIDE_CHANNEL_PORT: int = 5601
VLLM_MOONCAKE_BOOTSTRAP_PORT: int = 8998
@@ -1739,6 +1742,21 @@ environment_variables: dict[str, Callable[[], Any]] = {
"VLLM_P2P_SIDE_CHANNEL_PORT": lambda: int(
os.getenv("VLLM_P2P_SIDE_CHANNEL_PORT", "5710")
),
# Maximum number of concurrent P2P peer sessions. Limits ZMQ socket
# consumption to prevent denial-of-service via unbounded peer
# creation from client-supplied kv_transfer_params. Default: 128.
"VLLM_P2P_MAX_PEERS": lambda: int(os.getenv("VLLM_P2P_MAX_PEERS", "128")),
# Seconds to wait for a P2P peer handshake to complete (connected
# but not yet ready). Sessions exceeding this deadline are reaped.
# Prevents never-responding peers from accumulating indefinitely.
"VLLM_P2P_HANDSHAKE_TIMEOUT_S": lambda: int(
os.getenv("VLLM_P2P_HANDSHAKE_TIMEOUT_S", "30")
),
# Seconds a P2P session may remain idle (no pending work, no
# messages) before it is eligible for eviction. Idle eviction runs
# only when remaining peer slots are within 8 of VLLM_P2P_MAX_PEERS.
# Default: 300. Set to 0 to disable.
"VLLM_P2P_IDLE_TIMEOUT_S": lambda: int(os.getenv("VLLM_P2P_IDLE_TIMEOUT_S", "300")),
# IP address used for the EC connector's ZMQ side channel
# (producer ROUTER bind, consumer DEALER dial).
"VLLM_EC_SIDE_CHANNEL_HOST": lambda: os.getenv(