rpc : reject invalid top-level graph nodes in graph_compute - #25670
rpc : reject invalid top-level graph nodes in graph_compute#25670liminfei-amd wants to merge 1 commit into
Conversation
91b62a7 to
3900550
Compare
id 0 is a valid "no tensor" sentinel for optional sources, not for a top-level graph node. Reject any failed node reconstruction regardless of id, before running the graph. Fixes ggml-org#25299 Reported-by: professor-moody Assisted-by: GitHub Copilot
3900550 to
181b199
Compare
|
@ruixiang63 you reopened this PR back in July — would you be able to take a look, Rebased onto current master. The branch had gone stale and was conflicting. The I also removed a branch that my own change had made dead: once the guard returns The crash still reproduces on current master. Same test harness on both sides,
One thing I cannot do from here: the workflow runs on this head are all |
Overview
rpc_server::graph_compute()deserializes each top-level graph node id andresolves it through
create_node(). The old check only rejected anullptrresult when the wire id was non-zero, treating a
nullptrresult for id0as "expected" and letting it into
graph->nodes. id0is the wire sentinelfor "no tensor" and is valid for optional tensor sources (
src[]/view_src),but it is not a valid top-level graph node. The backend later dereferences
that node during graph planning, crashing the RPC server on a single crafted
GRAPH_COMPUTEmessage (device=0, n_nodes=1, node_id=0, n_tensors=0).Fixes #25299.
Reject every failed top-level node reconstruction before calling
ggml_backend_graph_compute(), regardless of id.Additional information
Verified with a localhost-only RPC client sending the malformed message above
against a CPU-only build (no ROCm/HIP): before the fix the server exits with
SIGSEGV; after the fix the malformed connection is closed and a subsequent
client can still connect and complete
HELLOnormally.A regression test (
test-rpc-invalid-graph-node) is included; it starts theRPC server, sends the crafted message, confirms the connection is dropped, and
verifies the server stays alive for new connections.
Requirements
create_node/graph_computecode, reproduced the crash and the fix's effect with a local RPC client, and can explain every line of the change.