Repository navigation
fix(selene-manager): harden multi-rank packed handling, protocol validation, and resource reclamation - #612
Merged
Conversation
yatesdr
force-pushed
the
fix/selene-manager-hardening
branch
3 times, most recently
from
November 29, 2026 17:27
555f4b5 to
d3d4f40
Compare
Several `selene-manager` paths accepted unvalidated peer metadata or multi-process packed operations that could cause out-of-bounds arena reads/writes, panics, or permanent slot and resource leaks. - Reject multi-process (`world >= 2`) packed `PutBegin` and `PinAck` grants cleanly instead of sizing an arena extent to compressed bytes and passing uncompressed window lengths to `pass::run` or concurrent rank writers (`selene-manager/src/pool/store_bridge.rs`, `selene-manager/src/pool/claims.rs`). - Cap scopes at 64 ranks and 1 TiB record sizes in `validate_scope`, replace panicking `next_power_of_two` calls with `checked_next_power_of_two`, check `PinAck` page and reservation bounds before allocating `PlannedWindow` vectors, and use checked arithmetic in `windows::plan` (`selene-manager/src/pool/mod.rs`, `selene-manager/src/store.rs`, `selene-manager/src/pool/claims.rs`, `selene-manager/src/pool/windows.rs`). - Reparent replaced nodes to root in `Index::reparent_to_root` when rootless fallback converts a linked replacement to a root record, and refuse evicting page-only ancestors with active readers in `evict_accounted` (`selene/src/shared/index.rs`, `selene-manager/src/store.rs`). - Reclaim terminal remote-channel `Pinned` exports on source disconnect, resolve rank-agent fences by `aid`, verify scope and rank secrets before keeping peer agents across rank-0 reconnect, bound and prune idle scopes, fall back to `kill(pid, 0)` when `pidfd_open` is unavailable, cap and time out TLS handshakes on `--listen`, and call `hub.shutdown()` before aborting `pool_task` (`selene-manager/src/pool/claims.rs`, `selene-manager/src/pool/ranks.rs`, `selene-manager/src/pool/core.rs`, `selene-manager/src/local.rs`, `selene-manager/src/control.rs`). The manager now rejects malformed or unsupported multi-process packed requests safely, resists oversize-geometry DoS inputs, keeps `Tree` topology consistent across rootless replacements, and reclaims remote export slots and shutdown resources cleanly. Validated on Linux (rebased onto post-NVIDIA#607 main `5df8edd3c`), GB10, and SM120 hardware across `selene` and `selene-manager`. Signed-off-by: yatesdr <6937857+yatesdr@users.noreply.github.com> Design-Signed-Off-By: yatesdr; design-review=2e5b
yatesdr
force-pushed
the
fix/selene-manager-hardening
branch
from
November 29, 2026 17:31
d3d4f40 to
1f9ee76
Compare
Collaborator
|
A case file has been opened for 612. Future reviews will auto-run 90 minutes after code updates are pushed.
|
Collaborator
Review StoppedAuto-Review halted due to finding: It was already fixed another way (merged or on the main branch), or is no longer needed for another reason. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this change is needed
Several
selene-managerpaths accepted unvalidated peer metadata or multi-process packed operations that could cause out-of-bounds arena reads/writes, panics, or permanent slot and connection resource leaks (beyond the items already landed in#607):world >= 2) packedPutBeginandPinAckgrants sized an arena extent to compressed bytes while passing uncompressed window lengths topass::runor concurrent rank writers.validate_scopeallowed unbounded rank counts and record sizes;store.rsused panickingnext_power_of_two;claims.rsplanned window vectors before validating reservation andmax_pagesbounds; andwindows::plancould overflowfirst_page + pages.Index;evict_accountedcould evict page-only ancestors with active readers;session_claims_lostleaked terminal remote-channelPinnedexports on source disconnect; idle scopes grew unbounded;agent_fence_by_idcould misresolve rank 0; rank-0 reconnect did not check scope/rank secret compatibility;watch_piddid not retryEINTRor fall back whenpidfd_openis unavailable;--listenTLS handshakes were uncapped and untimed; andcontrol.rsabortedpool_taskbefore callinghub.shutdown().Hardening these checks directly inside
selene-managerandselene/src/shared/index.rscloses every crash, OOB, DoS, and leak vector without changing wire compatibility.What changed
selene-manager/src/pool/store_bridge.rs,selene-manager/src/pool/claims.rs): Reject multi-process (world >= 2) packedPutBeginandPinAckgrants cleanly.selene-manager/src/pool/mod.rs,selene-manager/src/store.rs,selene-manager/src/pool/claims.rs,selene-manager/src/pool/windows.rs): Cap scopes at 64 ranks and 1 TiB record sizes invalidate_scope; usechecked_next_power_of_twoinstore.rs; verifyreserved_bytes(NoWindows) andmax_pages(CopyError) before allocatingPlannedWindowvectors; checkfirst_page.checked_add(pages)and checked arithmetic inwindows::plan.selene/src/shared/index.rs,selene-manager/src/store.rs): AddIndex::reparent_to_rootand invoke it inpublish_putwhen rootless fallback converts a linked replacement to root; guard!node.location.reading()inevict_accounted.selene-manager/src/pool/claims.rs,selene-manager/src/pool/ranks.rs,selene-manager/src/pool/core.rs,selene-manager/src/local.rs,selene-manager/src/control.rs): Reclaim terminal remote-channelPinnedexports insession_claims_lost; bound and prune idle scopes (MAX_SCOPES = 64); resolve rank-agent fences viaaid; verify scope and rank secrets across rank-0 reconnect; retryEINTRand fall back tokill(pid, 0)polling inwatch_pid; cap--listenTLS handshakes at 64 concurrent with a 5s timeout; invokehub.shutdown()beforepool_task.abort().reparent_to_root_detaches_old_parent_and_updates_tail_pages,validate_scope_rejects_more_than_64_ranks_and_oversize_records, andplan_rejects_first_page_u32_overflow.Expected benefit and measured result
selene-managersafely rejects malformed or unsupported multi-process packed requests, resists oversize-geometry DoS inputs, maintains consistentIndexparent links across rootless replacements, bounds idle scope memory and TLS handshakes, and reclaims remote export slots and shutdown resources cleanly.Supporting evidence
#607main(5df8edd3c):RUSTFLAGS="-D warnings" cargo check --locked --manifest-path selene/Cargo.toml --all-targets --features codec,rdmaandselene-manager --lib --bins --tests: passed with 0 warnings.cargo test --locked --release --manifest-path selene/Cargo.toml --features codec --lib: 540/540 passed.cargo test --locked --release --manifest-path selene-manager/Cargo.toml --lib --test builder --test offload --test packed --test pool_claims --test pool_net --test pool_store: 186/186 lib (1 ignored) +builder3/3 +offload2/2 +packed9/9 +pool_claims36/36 +pool_net6/6 +pool_store11/11 passed.flare run+selene-managerbaseline vs patched qualification on SM120 (cn5:DeepSeek-V4.1-Flash-1017TP4,GLM-5.3-FlashTP2/TP4off/cpu/gpu,Qwen3.8-Flash-NextTP1/TP2 including wiped-local-disk pool-only cold restore) and GB10 (cn6–cn9: 3-node TP2 and 4-node TP4 cross-host pool retirement & restore): 0 panics, 0 leaked pins/slots, 0 quarantined bytes, clean shutdowns.#496/#497/#607, and CPU tests were re-run after rebasing onto5df8edd3c.Discord: D-Rock