Repository navigation
base red: cmux-wg-tun reads its buffers without indexing (panic ratchet indexing_slicing 4 > 0, new crate) - #34220
Conversation
…et: clippy::indexing_slicing 4 in a new crate, must be 0) The direct push ad2c767..cc33e08 added cmux-wg-tun with four slice indexes (utun.rs interface_name x2, engine.rs drain_tun and drain_socket). The tip panic ratchet (fleet job e3cabfe8f3a4526406d20a58) counts them against a new crate's budget of 0. Each now reads with get(): the utun name takes the whole buffer when the kernel reports a longer length (as the min() did) and ends at its first NUL; a packet range or datagram length outside its buffer skips that read instead of panicking. No allow attributes.
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Review App of this head (app.zip, kept 1 day)
Shipped in:
|
|
Review (claude-opus-reviewer): SHIP at 6277862 Independent review (read-only). By reading, it compiles: the borrows are disjoint fields, Default holds for &[u8], and as_slice works on the array. Behavior inside the bounds is unchanged: the utun name equals the old min() and position() result, and an empty packet is still skipped. The only index expressions left are constant indexes into fixed arrays (fds[0..2]), which clippy does not lint. The PR adds no allow attribute and no other deny-lint site. |
|
Panic ratchet at the head 6277862: fleet step
macOS tests: step |
Summary
The tip panic ratchet is red:
cmux-wg-tun: clippy::indexing_slicing 4 > new crate (must be 0)(fleet jobe3cabfe8f3a4526406d20a58).cmux-wg-tuncame in lawrencecchen's direct pushad2c76731f28..cc33e089376e(commits b4f6d32 and d2b1b1c).Neither #34198 (the revert, which keeps the Rust crate) nor #34204 (the extension forward fix) changes this crate, so this PR fixes the red alone. It does not depend on either of them.
The four indexes now read with
get(), with noallow:utun.rsinterface_name: the name takes the whole buffer when the kernel reports a longer length (as the oldmin()did) and ends at its first NUL.engine.rsdrain_tun: a packet range outside the frame buffer, or an empty one, skips that packet.engine.rsdrain_socket: a datagram length outside its buffer stops the burst instead of panicking.Behavior inside the bounds is unchanged.
Changelog
none
Testing
python3 scripts/cmux-next/prepush-gate.py: no new violations.cmux-tui-rust-check.sh test engine::tests::, stepf74200465feb95b217cf67d8, green. It ran all 6 cmux-wg-tun tests (engine::tests::*) among 35 matched. 5 passed in the full run.a_socketpair_is_not_mistaken_for_utunfailed in the full run and passed alone (nextest FLAKY). That test calls onlyinterface_name, whose result this PR leaves unchanged for every in-bounds length, so the flake is in the crate from the push and not from this change; the crate owner must fix it. An earlier stepa809c4f688e9used the filtercmux_wg_tun, which selected 0 tests (exit 4) and proved nothing.cmux-tui-rust-check.sh panic, step16044e3cf8c0c17c9078de52. Result in a comment.Observed / Not run
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
Fixes the
clippy::indexing_slicingpanic ratchet violation incmux-wg-tunby replacing direct slice indexing withget()reads, so the new crate meets the required zero-violation budget.Written for commit 6277862. Summary will update on new commits.