diff --git a/.config/hakari.toml b/.config/hakari.toml
index 0ce14b4ccc0..8c3121e3b07 100644
--- a/.config/hakari.toml
+++ b/.config/hakari.toml
@@ -22,7 +22,7 @@ platforms = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-pc-win
# exact-versions = true
[traversal-excludes]
-workspace-members = ["moq-mux-fuzz", "moq-net-fuzz", "moq-quic-fuzz", "moq-rtmp-fuzz"]
+workspace-members = ["moq-mux-fuzz", "moq-net-fuzz", "moq-quic-fuzz", "moq-rtmp-fuzz", "moq-sock-fuzz", "moq-uring-fuzz"]
[final-excludes]
workspace-members = ["kio-macros"]
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index b6603ec04e2..cf62178c604 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -379,7 +379,8 @@ jobs:
# `js worklet-matrix` loads `?worklet` output through the bundlers pinned in test/worklet.
recipe: ["gate", "gh test-integration", "rs doctest --workspace", "test drill-sensitivity", "rs uring", "test drain", "test json-properties", "test resume-model", "test route-key-model", "test route-sweep", "rs quic-sim", "rs rung-disable", "test drill impaired", "rs cli-export", "rs hls-conformance", "rs quic-stress", "rs audio-devices", "rs multicast", "rs render-sw", "test qmux", "rs v4l2", "js worklet-matrix"]
include:
- # Miri interprets kio's and moq-net's in-memory unsafe; too slow for the merge gate.
+ # Miri interprets kio's and moq-net's in-memory unsafe and moq-sock's and moq-uring's
+ # control-message walks; too slow for the merge gate.
- recipe: rs miri
nightly: true
components: miri, rust-src
@@ -817,7 +818,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- target: [lite, announce, ietf, varint, path, pattern, ingest, request, session_lite, session_ietf, packet, params, streamid, streams, frame, connection, fmp4, mkv, ts, flv, cmaf, annexb, catalog, amf0]
+ target: [lite, announce, ietf, varint, path, pattern, ingest, request, session_lite, session_ietf, packet, params, streamid, streams, frame, connection, fmp4, mkv, ts, flv, cmaf, annexb, catalog, amf0, sock_cmsg, uring_cmsg]
# A whole session runs at 50 to 90 inputs a second, and its coverage still climbs
# after five minutes, so it gets fifteen.
include:
diff --git a/Cargo.lock b/Cargo.lock
index 1132e624f15..da82825057b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4788,6 +4788,14 @@ dependencies = [
"workspace-hack",
]
+[[package]]
+name = "moq-sock-fuzz"
+version = "0.0.0"
+dependencies = [
+ "libfuzzer-sys",
+ "moq-sock",
+]
+
[[package]]
name = "moq-srt"
version = "0.3.11"
@@ -4953,6 +4961,14 @@ dependencies = [
"workspace-hack",
]
+[[package]]
+name = "moq-uring-fuzz"
+version = "0.0.0"
+dependencies = [
+ "libfuzzer-sys",
+ "moq-uring",
+]
+
[[package]]
name = "moq-v4l"
version = "0.1.0"
diff --git a/Cargo.toml b/Cargo.toml
index ac6bd9e54fe..8acd2da92ff 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,16 @@
[workspace]
# Keep source-only members discoverable in Maturin's dependency-pruned archive,
# including the separately packaged UniFFI generator.
-members = ["rs/*", "rs/kio/macros", "rs/moq-mux/fuzz", "rs/moq-net/fuzz", "rs/moq-quic/fuzz", "rs/moq-rtmp/fuzz"]
+members = [
+ "rs/*",
+ "rs/kio/macros",
+ "rs/moq-mux/fuzz",
+ "rs/moq-net/fuzz",
+ "rs/moq-quic/fuzz",
+ "rs/moq-rtmp/fuzz",
+ "rs/moq-sock/fuzz",
+ "rs/moq-uring/fuzz",
+]
default-members = [
"rs/bench-harness",
"rs/kio",
diff --git a/nix/Cargo.nix b/nix/Cargo.nix
index 74c1cc1a225..5773ad2d13e 100644
--- a/nix/Cargo.nix
+++ b/nix/Cargo.nix
@@ -390,6 +390,16 @@ rec {
# File a bug if you depend on any for non-debug work!
debug = internal.debugCrate { inherit packageId; };
};
+ "moq-sock-fuzz" = rec {
+ packageId = "moq-sock-fuzz";
+ build = internal.buildRustCrateWithFeatures {
+ packageId = "moq-sock-fuzz";
+ };
+
+ # Debug support which might change between releases.
+ # File a bug if you depend on any for non-debug work!
+ debug = internal.debugCrate { inherit packageId; };
+ };
"moq-srt" = rec {
packageId = "moq-srt";
build = internal.buildRustCrateWithFeatures {
@@ -440,6 +450,16 @@ rec {
# File a bug if you depend on any for non-debug work!
debug = internal.debugCrate { inherit packageId; };
};
+ "moq-uring-fuzz" = rec {
+ packageId = "moq-uring-fuzz";
+ build = internal.buildRustCrateWithFeatures {
+ packageId = "moq-uring-fuzz";
+ };
+
+ # Debug support which might change between releases.
+ # File a bug if you depend on any for non-debug work!
+ debug = internal.debugCrate { inherit packageId; };
+ };
"moq-v4l" = rec {
packageId = "moq-v4l";
build = internal.buildRustCrateWithFeatures {
@@ -21128,6 +21148,36 @@ rec {
packageId = "workspace-hack";
}
];
+ features = {
+ };
+ resolvedDefaultFeatures = [ "fuzz" ];
+ };
+ "moq-sock-fuzz" = rec {
+ crateName = "moq-sock-fuzz";
+ version = "0.0.0";
+ edition = "2024";
+ crateBin = [
+ {
+ name = "sock_cmsg";
+ path = "fuzz_targets/sock_cmsg.rs";
+ requiredFeatures = [ ];
+ }
+ ];
+ src = lib.cleanSourceWith {
+ filter = sourceFilter;
+ src = ../rs/moq-sock/fuzz;
+ };
+ dependencies = [
+ {
+ name = "libfuzzer-sys";
+ packageId = "libfuzzer-sys";
+ }
+ {
+ name = "moq-sock";
+ packageId = "moq-sock";
+ features = [ "fuzz" ];
+ }
+ ];
};
"moq-srt" = rec {
@@ -22059,6 +22109,12 @@ rec {
packageId = "moq-shaper";
target = { target, features }: ("linux" == target."os" or null);
}
+ {
+ name = "moq-sock";
+ packageId = "moq-sock";
+ target = { target, features }: ("linux" == target."os" or null);
+ features = [ "fuzz" ];
+ }
{
name = "moq-tokio";
packageId = "moq-tokio";
@@ -22151,6 +22207,7 @@ rec {
features = {
"_manual" = [ "kio/manual" ];
"default" = [ "quic" ];
+ "fuzz" = [ "moq-sock/fuzz" ];
"qlog" = [ "moq-quic?/qlog" ];
"quic" = [
"dep:moq-congestion"
@@ -22163,10 +22220,40 @@ rec {
"_manual"
"_probe"
"default"
+ "fuzz"
"qlog"
"quic"
];
};
+ "moq-uring-fuzz" = rec {
+ crateName = "moq-uring-fuzz";
+ version = "0.0.0";
+ edition = "2024";
+ crateBin = [
+ {
+ name = "uring_cmsg";
+ path = "fuzz_targets/uring_cmsg.rs";
+ requiredFeatures = [ ];
+ }
+ ];
+ src = lib.cleanSourceWith {
+ filter = sourceFilter;
+ src = ../rs/moq-uring/fuzz;
+ };
+ dependencies = [
+ {
+ name = "libfuzzer-sys";
+ packageId = "libfuzzer-sys";
+ }
+ {
+ name = "moq-uring";
+ packageId = "moq-uring";
+ usesDefaultFeatures = false;
+ features = [ "fuzz" ];
+ }
+ ];
+
+ };
"moq-v4l" = rec {
crateName = "moq-v4l";
version = "0.1.0";
diff --git a/quest/m1/README.md b/quest/m1/README.md
index 691c39204a3..023270ee2cf 100644
--- a/quest/m1/README.md
+++ b/quest/m1/README.md
@@ -57,8 +57,7 @@ m4 default, so changes are proven before they ship: the
[sim rule checks](/quest/m1/quic-sim-rules.md),
[relay parser fuzz targets](/quest/m1/fuzz-relay-parsers.md), and from m4
the relay on the sim (landed),
-[mutation testing](/quest/m1/mutants.md), and
-[peer-reachable unsafe](/quest/m1/wire-fuzz-coverage.md). OSS-Fuzz stays in m4 (maintainer, same round): it mostly waits on
+[mutation testing](/quest/m1/mutants.md), and peer-reachable unsafe. OSS-Fuzz stays in m4 (maintainer, same round): it mostly waits on
google/oss-fuzz.
Left in m4 without a pick: Kani, Miri seeds and TSan, the JS corpus, and
bindings interop.
diff --git a/quest/m1/fuzz-relay-parsers.md b/quest/m1/fuzz-relay-parsers.md
index 948bcd2e54c..cdb6d640c21 100644
--- a/quest/m1/fuzz-relay-parsers.md
+++ b/quest/m1/fuzz-relay-parsers.md
@@ -34,5 +34,4 @@ Public API: none. Wire: none.
## Related
-- [Peer-reachable unsafe](/quest/m1/wire-fuzz-coverage.md) - the moq-sock, moq-uring, and moq-c targets
- [OSS-Fuzz](/quest/m4/oss-fuzz.md) - runs these around the clock once it lands
diff --git a/quest/m1/wire-fuzz-coverage.md b/quest/m1/wire-fuzz-coverage.md
deleted file mode 100644
index 5660dd7cd2c..00000000000
--- a/quest/m1/wire-fuzz-coverage.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# [M] Peer-reachable unsafe has invariant fuzz targets and runs under Miri
-
-## Goal
-
-The hand-written unsafe that peer input reaches in `moq-uring` and `moq-sock` runs under Miri or a fuzz target of its own, asserting more than "it did not panic". Other peer-facing decoders, such as the media importers and RTMP's AMF0, are outside this quest.
-
-The moq-net half is done: the `ingest` and `request` targets cover the incremental group ingest and request-stream framing, and the seeds include prefixes at and past every cap. What remains: `rs/moq-uring` and `rs/moq-sock` have no fuzz target and no Miri run. `moq-c`'s unsafe is the C ABI, reached by its C caller rather than by a peer, so it is not part of this quest. Their cmsg walks bound every length by the buffer, with unit tests, but nothing searches for the next mistake.
-
-## Plan
-
-Decided 2026-10-22 from the security audit, with the maintainer:
-
-- Add a target for `moq-sock`'s cmsg walk (`cmsg::Iter` and `ControlMetadata::decode` in `rs/moq-sock/src/udp/unix.rs`) and for `moq-uring`'s `RecvMeta::parse` (`rs/moq-uring/src/udp.rs`). Both walks must stop at a malformed length and keep what came before it: build well-formed control messages from the input, append a malformed header and arbitrary bytes, and assert the walk reads the same metadata as the well-formed prefix, and the metadata a reference model expects from it.
-- Add the crates whose unsafe is reachable from a peer to `just rs miri` (`sh/rs/miri.sh`), which Nightly already runs for `kio` and `moq-net`.
-- Wire every target and the Miri run into the nightly gate, and keep the merge-gate replay of committed regressions.
-
-The point is the invariant, not the coverage number: a target that only checks for a panic would miss the bugs this audit is about.
-
-Each crate follows moq-net's shape (`rs/moq-net/fuzz/README.md`): the target body in a `fuzz` module, documented as test support behind the `fuzz` feature, so the crate's own tests replay `fuzz/regressions/` on stable, a one-line shim per target, an `--exclude` in the `no_fuzz` list of `rs/justfile`, and a row in `nightly.yml`'s fuzz matrix. Target names must stay unique across crates.
-
-`moq-sock`'s known overread is fixed: [moq-dev/moq#7394](https://github.com/moq-dev/moq/pull/7394) (merged 2026-11-01) bounds `CMsg::decode` (`rs/moq-sock/src/udp/cmsg/mod.rs`), which now returns `None` for a short message, so neither target waits on anything. `just rs miri` and its nightly job already exist ([moq-dev/moq#7315](https://github.com/moq-dev/moq/pull/7315)); this quest adds its crates to them.
-
-Decided 2026-11-13 (maintainer, /quest-plan on what testing to add): ✅ m1
-(rejected: staying in m4). This unsafe is reachable by any peer.
-
-Public API: none. Wire: none.
-
-## Related
-
-- [CI cost and latency](/quest/m0/ci/README.md) - where the nightly budget lives
diff --git a/quest/m4/codec-kani.md b/quest/m4/codec-kani.md
index e1f8645fba0..a9a4e2d93b4 100644
--- a/quest/m4/codec-kani.md
+++ b/quest/m4/codec-kani.md
@@ -38,7 +38,3 @@ the way a model can.
timeout to hide it.
Public API: none. Wire: none.
-
-## Related
-
-- [Wire fuzz coverage](/quest/m1/wire-fuzz-coverage.md) - the fuzz targets and Miri run beside these proofs
diff --git a/quest/m4/miri-seeds-tsan.md b/quest/m4/miri-seeds-tsan.md
index cd03fd4293f..e0c1876f160 100644
--- a/quest/m4/miri-seeds-tsan.md
+++ b/quest/m4/miri-seeds-tsan.md
@@ -36,5 +36,4 @@ Public API: none. Wire: none.
## Related
-- [Wire fuzz coverage](/quest/m1/wire-fuzz-coverage.md) - adds moq-uring and moq-sock to the same Miri recipe
- [Drop kio's epoch fence](/quest/m5/crossbeam-pin-fence.md) - the ordering in kio's log these runs watch
diff --git a/quest/m4/oss-fuzz.md b/quest/m4/oss-fuzz.md
index 41b4adc8c3e..8322195fe65 100644
--- a/quest/m4/oss-fuzz.md
+++ b/quest/m4/oss-fuzz.md
@@ -24,7 +24,7 @@ maintainer's account once the maintainer has reviewed its draft files and PR
text (rejected: waiting to decide). The maintainer accepts OSS-Fuzz's 90-day
disclosure deadline.
-Nightly gives each of its 22 codec targets five minutes and the two
+Nightly gives each of its 24 codec targets five minutes and the two
whole-session targets (`session_lite`, `session_ietf`) fifteen. That finds
shallow bugs and replays the corpus; it rarely reaches deep states, and the
session targets' coverage still climbs when their run ends.
@@ -42,7 +42,3 @@ session targets' coverage still climbs when their run ends.
handled: reproduce, fix on `main`, commit the input, backport when serious.
Public API: none. Wire: none.
-
-## Related
-
-- [Wire fuzz coverage](/quest/m1/wire-fuzz-coverage.md) - adds the moq-sock and moq-uring targets OSS-Fuzz would also run
diff --git a/quest/m5/errqueue-truncation.md b/quest/m5/errqueue-truncation.md
index fab62c36388..593b8a4ac8b 100644
--- a/quest/m5/errqueue-truncation.md
+++ b/quest/m5/errqueue-truncation.md
@@ -13,7 +13,3 @@ Moved to m5 2026-11-12 (maintainer, /quest-audit): no consumer; parked rather th
Decided 2026-11-01 (maintainer, follow-up planning after the 2026-11-01 /quest-afk run): match the receive paths. Walk the cmsgs that fit (the iterator is already bounded by the returned control length), return the decoded entry if one is complete, and warn once through a `Once` as `decode_recv` in `unix.rs` does. Extend the existing mocked `MSG_ERRQUEUE` test (`LinuxError::decode`, about line 309) with a truncated case.
Public API: none. Wire: none.
-
-## Related
-
-- [Wire fuzz coverage](/quest/m1/wire-fuzz-coverage.md) - fuzzes the cmsg walks this path shares
diff --git a/rs/justfile b/rs/justfile
index 257edbe3a64..a16553ef475 100644
--- a/rs/justfile
+++ b/rs/justfile
@@ -13,7 +13,7 @@ set working-directory := '..'
# needs a nightly toolchain and sanitizer flags, so `just rs fuzz` is the one recipe
# that may compile it. Every `--workspace` below therefore carries this, as does
# sh/rs/select.sh, since it cannot read this.
-no_fuzz := "--exclude moq-net-fuzz --exclude moq-quic-fuzz --exclude moq-mux-fuzz --exclude moq-rtmp-fuzz"
+no_fuzz := "--exclude moq-net-fuzz --exclude moq-quic-fuzz --exclude moq-mux-fuzz --exclude moq-rtmp-fuzz --exclude moq-sock-fuzz --exclude moq-uring-fuzz"
default:
just check
diff --git a/rs/moq-sock/Cargo.toml b/rs/moq-sock/Cargo.toml
index ce61dcc5c7b..2dc895d0fa2 100644
--- a/rs/moq-sock/Cargo.toml
+++ b/rs/moq-sock/Cargo.toml
@@ -12,6 +12,11 @@ rust-version.workspace = true
keywords = ["quic", "networking", "reuseport"]
categories = ["network-programming"]
+[features]
+# Exposes the `fuzz/` harness's target body and seeds through the `udp::fuzz` module, on 64-bit
+# Linux. Off by default.
+fuzz = []
+
[dependencies]
arc-swap = "1.9"
core_affinity = "0.8"
@@ -35,6 +40,13 @@ workspace-hack = { path = "../workspace-hack" }
[target.'cfg(target_vendor = "apple")'.dev-dependencies]
nix = { workspace = true }
+# Writes the generated fuzzer corpus to disk. Needs the `fuzz` feature, so a default
+# `--all-targets` build skips it rather than failing to find the module.
+[[example]]
+name = "fuzz-seeds"
+path = "examples/fuzz-seeds.rs"
+required-features = ["fuzz"]
+
[[bench]]
name = "demux"
harness = false
diff --git a/rs/moq-sock/examples/fuzz-seeds.rs b/rs/moq-sock/examples/fuzz-seeds.rs
new file mode 100644
index 00000000000..b3cc2480433
--- /dev/null
+++ b/rs/moq-sock/examples/fuzz-seeds.rs
@@ -0,0 +1,30 @@
+//! Write the generated fuzzer corpus to disk: `fuzz-seeds
` fills
+//! `//` with one file per seed.
+//!
+//! `just rs fuzz` runs this before each session, so the corpus always matches the
+//! inputs in `moq_sock::udp::fuzz` rather than whatever was generated last. The
+//! target exists only on 64-bit Linux, so elsewhere this writes nothing.
+
+#[cfg(all(target_os = "linux", target_pointer_width = "64"))]
+fn main() {
+ let root = std::env::args().nth(1).expect("usage: fuzz-seeds ");
+ let root = std::path::Path::new(&root);
+
+ for (target, _) in moq_sock::udp::fuzz::TARGETS {
+ let dir = root.join(target);
+ std::fs::create_dir_all(&dir).expect("could not create the seed directory");
+ }
+
+ let seeds = moq_sock::udp::fuzz::seeds();
+ for (index, seed) in seeds.iter().enumerate() {
+ let path = root.join(seed.target).join(format!("{index}.bin"));
+ std::fs::write(&path, &seed.data).expect("could not write a seed");
+ }
+
+ println!("wrote {} seeds to {}", seeds.len(), root.display());
+}
+
+#[cfg(not(all(target_os = "linux", target_pointer_width = "64")))]
+fn main() {
+ eprintln!("the fuzz targets run only on 64-bit Linux");
+}
diff --git a/rs/moq-sock/fuzz/.gitignore b/rs/moq-sock/fuzz/.gitignore
new file mode 100644
index 00000000000..bfd3bed6c97
--- /dev/null
+++ b/rs/moq-sock/fuzz/.gitignore
@@ -0,0 +1,5 @@
+target
+corpus
+seeds
+artifacts
+coverage
diff --git a/rs/moq-sock/fuzz/Cargo.toml b/rs/moq-sock/fuzz/Cargo.toml
new file mode 100644
index 00000000000..f52add5c0a9
--- /dev/null
+++ b/rs/moq-sock/fuzz/Cargo.toml
@@ -0,0 +1,35 @@
+# The libFuzzer harness for moq-sock's receive control-message walk. `just rs fuzz sock_cmsg`
+# drives it, and nightly.yml runs it for five minutes.
+#
+# A workspace member so it shares the root lockfile, which is the only thing that
+# keeps its resolve from drifting when a sibling it depends on is bumped. It is
+# excluded from every gate that means "all of it" instead: libFuzzer needs a nightly
+# toolchain and sanitizer flags, so nothing in `check` or `test` may compile it.
+#
+# The target body lives in `moq-sock`'s `udp::fuzz` module, not here: the walk is
+# private, and sharing the body is what lets the crate's own tests replay the corpus
+# on stable and under Miri.
+[package]
+name = "moq-sock-fuzz"
+version = "0.0.0"
+license = "MIT OR Apache-2.0"
+publish = false
+edition = "2024"
+autobins = false
+
+[package.metadata]
+cargo-fuzz = true
+
+[[bin]]
+name = "sock_cmsg"
+path = "fuzz_targets/sock_cmsg.rs"
+test = false
+doc = false
+bench = false
+
+[dependencies]
+libfuzzer-sys = "0.4"
+moq-sock = { workspace = true, features = ["fuzz"] }
+
+[lints]
+workspace = true
diff --git a/rs/moq-sock/fuzz/README.md b/rs/moq-sock/fuzz/README.md
new file mode 100644
index 00000000000..e1aa1e56c7b
--- /dev/null
+++ b/rs/moq-sock/fuzz/README.md
@@ -0,0 +1,62 @@
+# Fuzzing moq-sock
+
+Coverage-guided fuzzing of the receive control-message walk: the unsafe code that steps
+through the kernel's control buffer (`udp::cmsg::Iter`) by the lengths written in it, and
+reads each payload as a C struct (`ControlMetadata::decode` for a datagram,
+`LinuxError::decode` for an error-queue entry, whose offender address an ICMP sender
+chooses).
+
+```bash
+cargo install --locked cargo-fuzz
+just rs fuzz sock_cmsg
+```
+
+Extra arguments pass through to libFuzzer, so `just rs fuzz sock_cmsg -- -max_total_time=300`
+bounds a run. The Nightly workflow runs it for five minutes, resumes from the previous run's
+minimized corpus, and uploads failure inputs as workflow artifacts. It runs only on 64-bit
+Linux.
+
+## How it fits together
+
+The target body is not in `fuzz_targets/`; it is in `moq-sock`'s `udp::fuzz` module
+(`src/udp/fuzz.rs`), because the walk is private, and so `just check` replays it on the
+pinned stable toolchain and `just rs miri` runs its seeds under Miri. moq-uring's
+`uring_cmsg` target reads the same input format through `udp::fuzz::Control`. See
+[moq-mux's README](../../moq-mux/fuzz/README.md) for the corpus layout and calling
+`cargo fuzz` directly.
+
+## Input format
+
+A run of control messages, then optionally a malformed end. Each message is an opcode,
+then a payload length byte and the payload, zero-padded if the input runs short. An
+opcode below 9 names a level and type from the table in `src/udp/fuzz.rs` (`UDP_GRO`,
+`SCM_TIMESTAMPNS`, the TOS and traffic class, both packet infos, both error-queue
+types); opcode 9 spells out its level and type as two native `i32`s. Opcodes 10 and 11
+end the buffer with a header whose length is too short or runs past the buffer, followed
+by the rest of the input; opcode 12 ends it with fewer bytes than a header. Opcodes wrap
+modulo 13.
+
+The messages are laid out as the kernel writes them: each header, its payload, and padding
+to `CMSG_SPACE`.
+
+## What the target asserts
+
+Beyond "does not panic": the walk reports exactly what a reference model reads from the
+well-formed messages' bytes, with or without the malformed end after them, so a malformed
+length stops the walk and keeps everything before it. The model reads each field at its
+byte offset rather than through the C structs, applies messages in order, and skips a
+payload too short for its type. The reported stride is never zero, since a zero stride
+would split a coalesced receive into empty datagrams forever.
+
+## When something fails
+
+libFuzzer writes the input to `artifacts/sock_cmsg/crash-` and prints the `cargo fuzz`
+command to reproduce it. Fix the bug, then commit the input:
+
+```bash
+mkdir -p rs/moq-sock/fuzz/regressions/sock_cmsg
+cp rs/moq-sock/fuzz/artifacts/sock_cmsg/crash- rs/moq-sock/fuzz/regressions/sock_cmsg/
+```
+
+`udp::fuzz::tests::regressions` replays everything under `regressions//` as part
+of the normal test suite, so the case stays covered.
diff --git a/rs/moq-sock/fuzz/fuzz_targets/sock_cmsg.rs b/rs/moq-sock/fuzz/fuzz_targets/sock_cmsg.rs
new file mode 100644
index 00000000000..b90b51dea3b
--- /dev/null
+++ b/rs/moq-sock/fuzz/fuzz_targets/sock_cmsg.rs
@@ -0,0 +1,7 @@
+#![no_main]
+
+use libfuzzer_sys::fuzz_target;
+
+fuzz_target!(|data: &[u8]| {
+ moq_sock::udp::fuzz::sock_cmsg(data);
+});
diff --git a/rs/moq-sock/fuzz/regressions/README.md b/rs/moq-sock/fuzz/regressions/README.md
new file mode 100644
index 00000000000..98d2afc6eb1
--- /dev/null
+++ b/rs/moq-sock/fuzz/regressions/README.md
@@ -0,0 +1,8 @@
+# Regressions
+
+Failing inputs the fuzzer found, one file per input, in a directory named after its
+target (`sock_cmsg/`). `udp::fuzz::tests::regressions` replays them on the stable
+toolchain as part of `just check`, so a bug found by fuzzing stays fixed without anyone
+running the fuzzer again.
+
+See [../README.md](../README.md) for the workflow.
diff --git a/rs/moq-sock/src/udp/fuzz.rs b/rs/moq-sock/src/udp/fuzz.rs
new file mode 100644
index 00000000000..f640ab01195
--- /dev/null
+++ b/rs/moq-sock/src/udp/fuzz.rs
@@ -0,0 +1,590 @@
+//! Test support, enabled by the `fuzz` feature: the `sock_cmsg` fuzz target body for the
+//! receive control-message walk, its seeds, and the control-buffer builder that moq-uring's
+//! `uring_cmsg` target shares.
+//!
+//! The walk is the unsafe code a received datagram reaches: `cmsg::Iter` steps through the
+//! kernel's control buffer by the lengths written in it, and each payload is read as a C struct.
+//! An input describes well-formed control messages, laid out as the kernel lays them, optionally
+//! followed by a malformed header and arbitrary bytes. The walk must read exactly what a byte-level
+//! reference model reads from the well-formed messages, whether or not the malformed tail follows.
+//! The body lives here rather than in `fuzz/fuzz_targets/` because the walk is private, and so the
+//! tests below replay it on stable and under Miri.
+//!
+//! It tracks the crate's internals, so it can change in any release. See `fuzz/README.md` for the
+//! workflow.
+
+use std::{
+ ffi::c_int,
+ mem::{self, MaybeUninit},
+ net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6},
+ ptr,
+ time::Duration,
+};
+
+use super::{EcnCodepoint, RecvMeta, TransportError, cmsg, imp::decode_recv, linux::LinuxError};
+
+/// One fuzz target body.
+pub type Target = fn(&[u8]);
+
+/// Every target, keyed by the name of its `fuzz_targets/.rs` shim.
+pub const TARGETS: &[(&str, Target)] = &[("sock_cmsg", sock_cmsg)];
+
+/// The control messages an input names by index; anything else is spelled out in full.
+const KINDS: &[(c_int, c_int)] = &[
+ (libc::SOL_UDP, libc::UDP_GRO),
+ (libc::SOL_SOCKET, libc::SCM_TIMESTAMPNS),
+ (libc::IPPROTO_IP, libc::IP_TOS),
+ (libc::IPPROTO_IP, libc::IP_RECVTOS),
+ (libc::IPPROTO_IP, libc::IP_PKTINFO),
+ (libc::IPPROTO_IPV6, libc::IPV6_TCLASS),
+ (libc::IPPROTO_IPV6, libc::IPV6_PKTINFO),
+ (libc::IPPROTO_IP, libc::IP_RECVERR),
+ (libc::IPPROTO_IPV6, libc::IPV6_RECVERR),
+];
+
+/// The input's opcodes after the indexed kinds.
+const RAW: u8 = KINDS.len() as u8;
+const SHORT: u8 = RAW + 1;
+const LONG: u8 = RAW + 2;
+const TRUNCATED: u8 = RAW + 3;
+const OPS: u8 = RAW + 4;
+
+/// `CMSG_LEN(0)`, the header every message starts with.
+fn header_len() -> usize {
+ // SAFETY: a pure size computation.
+ unsafe { libc::CMSG_LEN(0) as usize }
+}
+
+/// One well-formed control message.
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub struct Message {
+ /// `cmsg_level`.
+ pub level: c_int,
+ /// `cmsg_type`.
+ pub kind: c_int,
+ /// The payload, whatever its length.
+ pub payload: Vec,
+}
+
+impl Message {
+ /// A message carrying `value`'s bytes: a padding-free C struct or integer, as the kernel
+ /// writes. Private, since a safe caller could pass a padded type.
+ fn new(level: c_int, kind: c_int, value: T) -> Self {
+ Self {
+ level,
+ kind,
+ payload: raw(value),
+ }
+ }
+}
+
+/// How a control buffer ends after its well-formed messages.
+#[derive(Clone, Copy, Debug)]
+pub enum End {
+ /// Nothing follows.
+ Clean,
+ /// A header whose length is shorter than a header, `n % CMSG_LEN(0)`.
+ Short(u8),
+ /// A header whose length runs `n + 1` bytes past the buffer, or `usize::MAX` for 255.
+ Long(u8),
+ /// Fewer bytes than a header.
+ Truncated,
+}
+
+/// A control buffer decoded from a fuzz input.
+pub struct Control {
+ /// The well-formed messages, in order.
+ pub messages: Vec,
+ /// The kernel's layout of `messages`: each header and payload, padded to `CMSG_SPACE`.
+ pub prefix: Vec,
+ /// `prefix` followed by whatever the input's [`End`] appends.
+ pub full: Vec,
+}
+
+impl Control {
+ /// Decode an input: messages until an end opcode or the input runs out.
+ ///
+ /// A message is an opcode below the length of the `KINDS` table, or `RAW` followed by its level and type
+ /// as native `i32`s, then a payload length byte and the payload, zero-padded if the input
+ /// runs short. `SHORT` and `LONG` take a length parameter and a kind index for the malformed
+ /// header, then use the rest of the input as the bytes after it. `TRUNCATED` appends the rest,
+ /// cut short of a header.
+ pub fn parse(data: &[u8]) -> Self {
+ let mut input = Input(data);
+ let mut messages = Vec::new();
+ let mut prefix = Vec::new();
+ let mut tail = Vec::new();
+
+ while let Some(op) = input.byte() {
+ let (level, kind) = match op % OPS {
+ RAW => (input.int(), input.int()),
+ SHORT | LONG => {
+ let param = input.byte().unwrap_or(0);
+ let (level, kind) = KINDS[input.byte().unwrap_or(0) as usize % KINDS.len()];
+ let junk = input.rest();
+ let len = if op % OPS == SHORT {
+ param as usize % header_len()
+ } else if param == u8::MAX {
+ usize::MAX
+ } else {
+ header_len() + junk.len() + 1 + param as usize
+ };
+ tail = header(len, level, kind);
+ tail.extend_from_slice(junk);
+ break;
+ }
+ TRUNCATED => {
+ let junk = input.rest();
+ tail = junk[..junk.len().min(header_len() - 1)].to_vec();
+ break;
+ }
+ index => KINDS[index as usize],
+ };
+ let len = input.byte().unwrap_or(0) as usize;
+ let mut payload = input.take(len).to_vec();
+ payload.resize(len, 0);
+ let message = Message { level, kind, payload };
+ layout(&message, &mut prefix);
+ messages.push(message);
+ }
+
+ let mut full = prefix.clone();
+ full.extend_from_slice(&tail);
+ Self { messages, prefix, full }
+ }
+
+ /// Encode `messages` and `end` as an input [`Control::parse`] reads back, with `junk` after a
+ /// malformed header or truncated to fit under one.
+ pub fn input(messages: &[Message], end: End, junk: &[u8]) -> Vec {
+ let mut out = Vec::new();
+ for message in messages {
+ match KINDS.iter().position(|&kind| kind == (message.level, message.kind)) {
+ Some(index) => out.push(index as u8),
+ None => {
+ out.push(RAW);
+ out.extend_from_slice(&message.level.to_ne_bytes());
+ out.extend_from_slice(&message.kind.to_ne_bytes());
+ }
+ }
+ out.push(u8::try_from(message.payload.len()).expect("a seed payload fits a length byte"));
+ out.extend_from_slice(&message.payload);
+ }
+ match end {
+ End::Clean => return out,
+ End::Short(param) => out.extend_from_slice(&[SHORT, param, 0]),
+ End::Long(param) => out.extend_from_slice(&[LONG, param, 0]),
+ End::Truncated => out.push(TRUNCATED),
+ }
+ out.extend_from_slice(junk);
+ out
+ }
+
+ /// Inputs for every target that walks a control buffer: the receive sets a socket enables,
+ /// the error queue's entries, and payloads one byte short, each followed by every [`End`].
+ pub fn seeds() -> Vec> {
+ let gro = Message::new::(libc::SOL_UDP, libc::UDP_GRO, 1200);
+ let stamp = Message::new(
+ libc::SOL_SOCKET,
+ libc::SCM_TIMESTAMPNS,
+ libc::timespec {
+ tv_sec: 1_700_000_000,
+ tv_nsec: 123_456_789,
+ },
+ );
+ let v4 = Message::new(
+ libc::IPPROTO_IP,
+ libc::IP_PKTINFO,
+ libc::in_pktinfo {
+ ipi_ifindex: 2,
+ ipi_spec_dst: libc::in_addr {
+ s_addr: u32::from_ne_bytes([192, 0, 2, 1]),
+ },
+ ipi_addr: libc::in_addr {
+ s_addr: u32::from_ne_bytes([192, 0, 2, 2]),
+ },
+ },
+ );
+ let v6 = |ip: Ipv6Addr| {
+ Message::new(
+ libc::IPPROTO_IPV6,
+ libc::IPV6_PKTINFO,
+ libc::in6_pktinfo {
+ ipi6_addr: libc::in6_addr { s6_addr: ip.octets() },
+ ipi6_ifindex: 2,
+ },
+ )
+ };
+ let tos = Message::new(libc::IPPROTO_IP, libc::IP_TOS, 0b10u8);
+ let tclass = Message::new::(libc::IPPROTO_IPV6, libc::IPV6_TCLASS, 0b11);
+ let error = |kind, origin, offender: &[u8]| {
+ let mut message = Message::new(
+ libc::IPPROTO_IP,
+ kind,
+ libc::sock_extended_err {
+ ee_errno: libc::EMSGSIZE as u32,
+ ee_origin: origin,
+ ee_type: 3,
+ ee_code: 4,
+ ee_pad: 0,
+ ee_info: 1400,
+ ee_data: 0,
+ },
+ );
+ message.payload.extend_from_slice(offender);
+ message
+ };
+ let sin = sockaddr(SocketAddr::from(([198, 51, 100, 7], 4443)));
+ let sin6 = sockaddr(SocketAddr::from((Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 7), 4443)));
+ let unspec = (libc::AF_UNSPEC as libc::sa_family_t).to_ne_bytes();
+ let short = |message: &Message| Message {
+ payload: message.payload[..message.payload.len() - 1].to_vec(),
+ ..message.clone()
+ };
+
+ let sets = [
+ vec![gro.clone(), stamp.clone(), v4.clone(), tos.clone()],
+ vec![
+ gro.clone(),
+ stamp.clone(),
+ v6(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 2)),
+ tclass.clone(),
+ ],
+ vec![v6(Ipv4Addr::new(192, 0, 2, 2).to_ipv6_mapped()), tos.clone()],
+ vec![error(libc::IP_RECVERR, libc::SO_EE_ORIGIN_ICMP, &sin)],
+ vec![error(libc::IPV6_RECVERR, libc::SO_EE_ORIGIN_ICMP6, &sin6)],
+ vec![error(libc::IP_RECVERR, libc::SO_EE_ORIGIN_LOCAL, &unspec)],
+ [&gro, &stamp, &v4, &tclass].map(short).to_vec(),
+ ];
+ let ends = [
+ End::Clean,
+ End::Short(0),
+ End::Short(u8::MAX),
+ End::Long(0),
+ End::Long(u8::MAX),
+ End::Truncated,
+ ];
+ let junk = gro.payload.repeat(8);
+ sets.iter()
+ .flat_map(|set| ends.map(|end| Self::input(set, end, &junk)))
+ .collect()
+ }
+}
+
+/// A cursor over an input that reads zeros once it runs out.
+struct Input<'a>(&'a [u8]);
+
+impl<'a> Input<'a> {
+ fn byte(&mut self) -> Option {
+ let (&first, rest) = self.0.split_first()?;
+ self.0 = rest;
+ Some(first)
+ }
+
+ fn take(&mut self, len: usize) -> &'a [u8] {
+ let (head, rest) = self.0.split_at(len.min(self.0.len()));
+ self.0 = rest;
+ head
+ }
+
+ fn int(&mut self) -> c_int {
+ let mut bytes = [0; 4];
+ let head = self.take(4);
+ bytes[..head.len()].copy_from_slice(head);
+ c_int::from_ne_bytes(bytes)
+ }
+
+ fn rest(&mut self) -> &'a [u8] {
+ self.take(usize::MAX)
+ }
+}
+
+/// A `cmsghdr`'s bytes.
+fn header(len: usize, level: c_int, kind: c_int) -> Vec {
+ // SAFETY: all-zero is a valid `cmsghdr`.
+ let mut header: libc::cmsghdr = unsafe { mem::zeroed() };
+ header.cmsg_len = len as _;
+ header.cmsg_level = level;
+ header.cmsg_type = kind;
+ // `cmsghdr` is plain integers with no padding on 64-bit Linux, as the assertion below checks.
+ raw(header)
+}
+
+const _: () = assert!(size_of::() == 16);
+
+/// Append `message` as the kernel writes it: the header, the payload, and padding to
+/// `CMSG_SPACE`.
+fn layout(message: &Message, out: &mut Vec) {
+ let start = out.len();
+ // SAFETY: pure size computations.
+ let (len, space) = unsafe {
+ (
+ libc::CMSG_LEN(message.payload.len() as _) as usize,
+ libc::CMSG_SPACE(message.payload.len() as _) as usize,
+ )
+ };
+ out.extend_from_slice(&header(len, message.level, message.kind));
+ out.extend_from_slice(&message.payload);
+ out.resize(start + space, 0);
+}
+
+/// A socket address's kernel bytes.
+fn sockaddr(addr: SocketAddr) -> Vec {
+ match addr {
+ SocketAddr::V4(v4) => raw(libc::sockaddr_in {
+ sin_family: libc::AF_INET as libc::sa_family_t,
+ sin_port: v4.port().to_be(),
+ sin_addr: libc::in_addr {
+ s_addr: u32::from_ne_bytes(v4.ip().octets()),
+ },
+ sin_zero: [0; 8],
+ }),
+ SocketAddr::V6(v6) => raw(libc::sockaddr_in6 {
+ sin6_family: libc::AF_INET6 as libc::sa_family_t,
+ sin6_port: v6.port().to_be(),
+ sin6_flowinfo: v6.flowinfo(),
+ sin6_addr: libc::in6_addr {
+ s6_addr: v6.ip().octets(),
+ },
+ sin6_scope_id: v6.scope_id(),
+ }),
+ }
+}
+
+/// A plain C value's bytes.
+///
+/// Only for the padding-free structs and integers the kernel writes into control messages:
+/// padding bytes would be uninitialized.
+fn raw(value: T) -> Vec {
+ // SAFETY: `value` is a live `T`, readable for its size, with no padding per the contract above.
+ unsafe { std::slice::from_raw_parts(ptr::from_ref(&value).cast::(), size_of::()) }.to_vec()
+}
+
+/// The datagram length every walk reports, which is also the stride without `UDP_GRO`.
+const DATAGRAM: usize = 1500;
+
+/// The control-message walk reads what the reference model reads from the well-formed messages,
+/// with or without the malformed tail after them, and never reports a zero stride.
+pub fn sock_cmsg(data: &[u8]) {
+ let control = Control::parse(data);
+ let expected = Expected::model(&control.messages);
+ for buffer in [&control.prefix, &control.full] {
+ let actual = Expected::walk(buffer);
+ assert_eq!(
+ actual,
+ expected,
+ "{} messages, {} bytes",
+ control.messages.len(),
+ buffer.len()
+ );
+ assert!(actual.stride > 0, "a zero stride never ends a GRO split");
+ }
+}
+
+/// What a receive and an error-queue read report.
+#[derive(Debug, PartialEq)]
+struct Expected {
+ ecn: Option,
+ dst_ip: Option,
+ interface_index: Option,
+ stride: usize,
+ timestamp: Option,
+ /// The first error-queue entry: its offender and errno.
+ error: Option<(Option, i32)>,
+}
+
+impl Expected {
+ /// Walk `control` as a receive and as an error-queue read.
+ fn walk(control: &[u8]) -> Self {
+ // The kernel's buffer is aligned for `cmsghdr`; a `u64` array is too.
+ let mut buffer = vec![0u64; control.len().div_ceil(8)];
+ // SAFETY: `buffer` holds at least `control.len()` bytes.
+ unsafe { ptr::copy_nonoverlapping(control.as_ptr(), buffer.as_mut_ptr().cast::(), control.len()) };
+ // SAFETY: all-zero is a valid `msghdr`.
+ let mut hdr: libc::msghdr = unsafe { mem::zeroed() };
+ hdr.msg_control = buffer.as_mut_ptr().cast();
+ hdr.msg_controllen = control.len() as _;
+
+ let mut name = MaybeUninit::::zeroed();
+ // SAFETY: `sockaddr_in` fits in `sockaddr_storage`.
+ unsafe {
+ name.as_mut_ptr().cast::().write(libc::sockaddr_in {
+ sin_family: libc::AF_INET as libc::sa_family_t,
+ sin_port: 4443u16.to_be(),
+ sin_addr: libc::in_addr { s_addr: 0 },
+ sin_zero: [0; 8],
+ })
+ };
+ let meta: RecvMeta = decode_recv(&name, &hdr, 0, DATAGRAM).expect("the name is an IPv4 address");
+
+ // SAFETY: `hdr` points at `buffer`, aligned and initialized for its whole length.
+ let error = unsafe { cmsg::Iter::new(&hdr) }
+ .find_map(LinuxError::decode)
+ .map(TransportError::from)
+ .map(|error| (error.addr, error.raw_errno));
+
+ Self {
+ ecn: meta.ecn,
+ dst_ip: meta.dst_ip,
+ interface_index: meta.interface_index,
+ stride: meta.stride,
+ timestamp: meta.timestamp,
+ error,
+ }
+ }
+
+ /// What each message means, read from its bytes rather than through the C structs, applied
+ /// in order; a payload too short for its type is skipped.
+ fn model(messages: &[Message]) -> Self {
+ let mut expected = Self {
+ ecn: None,
+ dst_ip: None,
+ interface_index: None,
+ stride: DATAGRAM,
+ timestamp: None,
+ error: None,
+ };
+ for Message { level, kind, payload } in messages {
+ let p = payload.as_slice();
+ match (*level, *kind) {
+ (libc::IPPROTO_IP, libc::IP_TOS | libc::IP_RECVTOS) if !p.is_empty() => {
+ expected.ecn = EcnCodepoint::from_bits(p[0]);
+ }
+ (libc::IPPROTO_IPV6, libc::IPV6_TCLASS) if p.len() >= 4 => {
+ expected.ecn = EcnCodepoint::from_bits(i32::from_ne_bytes(bytes(p, 0)) as u8);
+ }
+ // in_pktinfo: ifindex, the route's preferred source, then the destination.
+ (libc::IPPROTO_IP, libc::IP_PKTINFO) if p.len() >= 12 => {
+ expected.dst_ip = Some(Ipv4Addr::from(bytes::<4>(p, 8)).into());
+ expected.interface_index = Some(i32::from_ne_bytes(bytes(p, 0)) as u32);
+ }
+ // in6_pktinfo: the destination, then ifindex.
+ (libc::IPPROTO_IPV6, libc::IPV6_PKTINFO) if p.len() >= 20 => {
+ expected.dst_ip = Some(Ipv6Addr::from(bytes::<16>(p, 0)).into());
+ expected.interface_index = Some(u32::from_ne_bytes(bytes(p, 16)));
+ }
+ (libc::SOL_UDP, libc::UDP_GRO) if p.len() >= 4 => {
+ let stride = i32::from_ne_bytes(bytes(p, 0));
+ if stride > 0 {
+ expected.stride = stride as usize;
+ }
+ }
+ (libc::SOL_SOCKET, libc::SCM_TIMESTAMPNS) if p.len() >= 16 => {
+ let secs = u64::try_from(i64::from_ne_bytes(bytes(p, 0))).unwrap_or(0);
+ let nanos = u32::try_from(i64::from_ne_bytes(bytes(p, 8))).unwrap_or(0);
+ expected.timestamp = Some(Duration::new(secs, nanos));
+ }
+ _ => {}
+ }
+ if expected.error.is_none() {
+ expected.error = error(*level, *kind, p);
+ }
+ }
+ expected
+ }
+}
+
+/// An error-queue entry: a 16-byte `sock_extended_err`, then the offender's address.
+fn error(level: c_int, kind: c_int, p: &[u8]) -> Option<(Option, i32)> {
+ if !matches!(level, libc::IPPROTO_IP | libc::IPPROTO_IPV6) || !matches!(kind, libc::IP_RECVERR | libc::IPV6_RECVERR)
+ {
+ return None;
+ }
+ if p.len() < 18 {
+ return None;
+ }
+ let errno = u32::from_ne_bytes(bytes(p, 0)) as i32;
+ let offender = match c_int::from(u16::from_ne_bytes(bytes(p, 16))) {
+ libc::AF_UNSPEC => None,
+ libc::AF_INET if p.len() >= 16 + 16 => Some(SocketAddr::V4(SocketAddrV4::new(
+ Ipv4Addr::from(bytes::<4>(p, 20)),
+ u16::from_be_bytes(bytes(p, 18)),
+ ))),
+ libc::AF_INET6 if p.len() >= 16 + 28 => Some(SocketAddr::V6(SocketAddrV6::new(
+ Ipv6Addr::from(bytes::<16>(p, 24)),
+ u16::from_be_bytes(bytes(p, 18)),
+ u32::from_ne_bytes(bytes(p, 20)),
+ u32::from_ne_bytes(bytes(p, 40)),
+ ))),
+ _ => return None,
+ };
+ Some((offender, errno))
+}
+
+/// `N` bytes of `p` from `at`.
+fn bytes(p: &[u8], at: usize) -> [u8; N] {
+ p[at..at + N].try_into().expect("the caller checked the length")
+}
+
+/// One input to start a target from.
+pub struct Seed {
+ /// The target it feeds, a key of [`TARGETS`].
+ pub target: &'static str,
+ /// The input.
+ pub data: Vec,
+}
+
+/// The starting corpus, from [`Control::seeds`].
+pub fn seeds() -> Vec {
+ Control::seeds()
+ .into_iter()
+ .map(|data| Seed {
+ target: "sock_cmsg",
+ data,
+ })
+ .collect()
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ /// Every seed holds a message and passes, so the fuzzer starts from real receives. Runs under
+ /// Miri, which checks the walk's pointer arithmetic on each.
+ #[test]
+ fn seeds_pass() {
+ for (index, seed) in seeds().iter().enumerate() {
+ assert!(!Control::parse(&seed.data).messages.is_empty(), "seed {index} is empty");
+ sock_cmsg(&seed.data);
+ }
+ }
+
+ /// The model reads the seeds' receive sets as the socket tests expect.
+ #[test]
+ fn model_reads_the_seeds() {
+ let control = Control::parse(&seeds()[0].data);
+ let expected = Expected::model(&control.messages);
+ assert_eq!(expected.stride, 1200);
+ assert_eq!(expected.ecn, Some(EcnCodepoint::Ect0));
+ assert_eq!(expected.dst_ip, Some(Ipv4Addr::new(192, 0, 2, 2).into()));
+ assert_eq!(expected.interface_index, Some(2));
+ assert_eq!(expected.timestamp, Some(Duration::new(1_700_000_000, 123_456_789)));
+ }
+
+ /// A zero `UDP_GRO` size keeps the datagram's own length as its stride.
+ #[test]
+ fn zero_gro_keeps_the_stride() {
+ let gro = Message::new::(libc::SOL_UDP, libc::UDP_GRO, 0);
+ sock_cmsg(&Control::input(&[gro], End::Clean, &[]));
+ }
+
+ /// Replay the inputs committed under `fuzz/regressions/`, so a bug the fuzzer found stays
+ /// fixed on the stable toolchain, in the suite CI already runs.
+ #[test]
+ #[cfg_attr(miri, ignore = "reads the regression files, which Miri's isolation refuses")]
+ fn regressions() {
+ let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("fuzz/regressions");
+
+ for (name, target) in TARGETS {
+ // Nothing has failed yet for this target; `fuzz/README.md` says what to drop in here
+ // when something does.
+ let Ok(entries) = std::fs::read_dir(root.join(name)) else {
+ continue;
+ };
+ for entry in entries {
+ let path = entry.expect("could not read the regression directory").path();
+ let data = std::fs::read(&path).expect("could not read a regression input");
+ target(&data);
+ }
+ }
+ }
+}
diff --git a/rs/moq-sock/src/udp/mod.rs b/rs/moq-sock/src/udp/mod.rs
index 1017f2d6974..e72f3493b47 100644
--- a/rs/moq-sock/src/udp/mod.rs
+++ b/rs/moq-sock/src/udp/mod.rs
@@ -52,6 +52,11 @@ mod imp;
#[cfg(any(target_os = "linux", target_os = "android"))]
mod linux;
+// The control-message walk's fuzz target. Linux only, where the fuzzer runs, and 64-bit, which the
+// reference model's struct layouts assume.
+#[cfg(all(any(test, feature = "fuzz"), target_os = "linux", target_pointer_width = "64"))]
+pub mod fuzz;
+
#[cfg(windows)]
#[path = "windows.rs"]
mod imp;
diff --git a/rs/moq-sock/src/udp/unix.rs b/rs/moq-sock/src/udp/unix.rs
index 30f50d9c1fa..c72e69e2e5b 100644
--- a/rs/moq-sock/src/udp/unix.rs
+++ b/rs/moq-sock/src/udp/unix.rs
@@ -780,8 +780,13 @@ impl ControlMetadata {
}
#[cfg(any(target_os = "linux", target_os = "android"))]
(libc::SOL_UDP, libc::UDP_GRO) => {
- if let Some(stride) = unsafe { cmsg.decode::() } {
- self.stride = stride as usize;
+ // A zero stride would split the payload into empty datagrams forever, so it keeps the
+ // datagram's own length, as a negative one does.
+ if let Some(stride) =
+ unsafe { cmsg.decode::() }.and_then(|stride| usize::try_from(stride).ok())
+ && stride > 0
+ {
+ self.stride = stride;
}
}
#[cfg(any(target_os = "linux", target_os = "android"))]
diff --git a/rs/moq-sock/src/udp/windows.rs b/rs/moq-sock/src/udp/windows.rs
index b6f99d1501b..b62a8a0ed68 100644
--- a/rs/moq-sock/src/udp/windows.rs
+++ b/rs/moq-sock/src/udp/windows.rs
@@ -236,7 +236,11 @@ impl UdpSocketState {
(WinSock::IPPROTO_UDP, UDP_COALESCED_INFO) => {
// Has type u32 (aka DWORD) per
// https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-udp-socket-options
- if let Some(segment) = unsafe { cmsg.decode::() } {
+ // A zero stride would split the payload into empty datagrams forever, so it keeps
+ // the datagram's own length.
+ if let Some(segment) = unsafe { cmsg.decode::() }
+ && segment > 0
+ {
stride = segment;
}
}
diff --git a/rs/moq-uring/Cargo.toml b/rs/moq-uring/Cargo.toml
index 38daa99a52c..8edbf67bb63 100644
--- a/rs/moq-uring/Cargo.toml
+++ b/rs/moq-uring/Cargo.toml
@@ -32,6 +32,8 @@ _manual = ["kio/manual"]
# Builds `moq-uring-probe`, the relay benchmarks' host check. A binary rather than an
# example, so building it skips the dev-dependencies. For the bench harness.
_probe = []
+# Exposes the `fuzz/` harness's target body and seeds through the `udp::fuzz` module, on 64-bit.
+fuzz = ["moq-sock/fuzz"]
[target.'cfg(target_os = "linux")'.dependencies]
bytes = "1"
@@ -72,6 +74,8 @@ io-uring = { workspace = true }
libc = { workspace = true }
# The socket-queue benchmark's rate-limited path.
moq-shaper = { path = "../moq-shaper" }
+# The control-message fuzz target's input format, which its tests replay.
+moq-sock = { path = "../moq-sock", features = ["fuzz"] }
moq-tokio = { path = "../moq-tokio", default-features = false, features = ["quic"] }
# Tests run workers on a manual clock.
moq-uring = { path = ".", features = ["_manual"] }
@@ -86,6 +90,13 @@ serde_json = { workspace = true }
tempfile = { workspace = true }
tracing = "0.1"
+# Writes the generated fuzzer corpus to disk. Needs the `fuzz` feature, so a default
+# `--all-targets` build skips it rather than failing to find the module.
+[[example]]
+name = "fuzz-seeds"
+path = "examples/fuzz-seeds.rs"
+required-features = ["fuzz"]
+
[[bench]]
name = "udp_tokio"
harness = false
diff --git a/rs/moq-uring/examples/fuzz-seeds.rs b/rs/moq-uring/examples/fuzz-seeds.rs
new file mode 100644
index 00000000000..c9b8bc263bd
--- /dev/null
+++ b/rs/moq-uring/examples/fuzz-seeds.rs
@@ -0,0 +1,30 @@
+//! Write the generated fuzzer corpus to disk: `fuzz-seeds ` fills
+//! `//` with one file per seed.
+//!
+//! `just rs fuzz` runs this before each session, so the corpus always matches the
+//! inputs in `moq_uring::udp::fuzz` rather than whatever was generated last. The
+//! target exists only on 64-bit Linux, so elsewhere this writes nothing.
+
+#[cfg(all(target_os = "linux", target_pointer_width = "64"))]
+fn main() {
+ let root = std::env::args().nth(1).expect("usage: fuzz-seeds ");
+ let root = std::path::Path::new(&root);
+
+ for (target, _) in moq_uring::udp::fuzz::TARGETS {
+ let dir = root.join(target);
+ std::fs::create_dir_all(&dir).expect("could not create the seed directory");
+ }
+
+ let seeds = moq_uring::udp::fuzz::seeds();
+ for (index, seed) in seeds.iter().enumerate() {
+ let path = root.join(seed.target).join(format!("{index}.bin"));
+ std::fs::write(&path, &seed.data).expect("could not write a seed");
+ }
+
+ println!("wrote {} seeds to {}", seeds.len(), root.display());
+}
+
+#[cfg(not(all(target_os = "linux", target_pointer_width = "64")))]
+fn main() {
+ eprintln!("the fuzz targets run only on 64-bit Linux");
+}
diff --git a/rs/moq-uring/fuzz/.gitignore b/rs/moq-uring/fuzz/.gitignore
new file mode 100644
index 00000000000..bfd3bed6c97
--- /dev/null
+++ b/rs/moq-uring/fuzz/.gitignore
@@ -0,0 +1,5 @@
+target
+corpus
+seeds
+artifacts
+coverage
diff --git a/rs/moq-uring/fuzz/Cargo.toml b/rs/moq-uring/fuzz/Cargo.toml
new file mode 100644
index 00000000000..8e746b5932c
--- /dev/null
+++ b/rs/moq-uring/fuzz/Cargo.toml
@@ -0,0 +1,35 @@
+# The libFuzzer harness for moq-uring's receive control-message walk. `just rs fuzz uring_cmsg`
+# drives it, and nightly.yml runs it for five minutes.
+#
+# A workspace member so it shares the root lockfile, which is the only thing that
+# keeps its resolve from drifting when a sibling it depends on is bumped. It is
+# excluded from every gate that means "all of it" instead: libFuzzer needs a nightly
+# toolchain and sanitizer flags, so nothing in `check` or `test` may compile it.
+#
+# The target body lives in `moq-uring`'s `udp::fuzz` module, not here: the walk is
+# private, and sharing the body is what lets the crate's own tests replay the corpus
+# on stable and under Miri.
+[package]
+name = "moq-uring-fuzz"
+version = "0.0.0"
+license = "MIT OR Apache-2.0"
+publish = false
+edition = "2024"
+autobins = false
+
+[package.metadata]
+cargo-fuzz = true
+
+[[bin]]
+name = "uring_cmsg"
+path = "fuzz_targets/uring_cmsg.rs"
+test = false
+doc = false
+bench = false
+
+[dependencies]
+libfuzzer-sys = "0.4"
+moq-uring = { workspace = true, features = ["fuzz"] }
+
+[lints]
+workspace = true
diff --git a/rs/moq-uring/fuzz/README.md b/rs/moq-uring/fuzz/README.md
new file mode 100644
index 00000000000..300899d94ba
--- /dev/null
+++ b/rs/moq-uring/fuzz/README.md
@@ -0,0 +1,48 @@
+# Fuzzing moq-uring
+
+Coverage-guided fuzzing of the receive control-message walk, `RecvMeta::parse` in
+`src/udp.rs`: the unsafe code that steps through the kernel's control buffer by the lengths
+written in it and reads each payload as a C struct, once per received datagram.
+
+```bash
+cargo install --locked cargo-fuzz
+just rs fuzz uring_cmsg
+```
+
+Extra arguments pass through to libFuzzer, so `just rs fuzz uring_cmsg -- -max_total_time=300`
+bounds a run. The Nightly workflow runs it for five minutes, resumes from the previous run's
+minimized corpus, and uploads failure inputs as workflow artifacts. It runs only on 64-bit
+Linux, as the crate does.
+
+## How it fits together
+
+The target body is not in `fuzz_targets/`; it is in `moq-uring`'s `udp::fuzz` module
+(`src/udp/fuzz.rs`), because the walk is private, and so `just check` replays it on the
+pinned stable toolchain and `just rs miri` runs its seeds under Miri.
+
+Inputs use moq-sock's format and seeds, `moq_sock::udp::fuzz::Control`, described in
+[moq-sock's README](../../moq-sock/fuzz/README.md), so a buffer that splits the two walks
+replays against both. See [moq-mux's README](../../moq-mux/fuzz/README.md) for the corpus
+layout and calling `cargo fuzz` directly.
+
+## What the target asserts
+
+Beyond "does not panic": the walk reports exactly what a reference model reads from the
+well-formed messages' bytes, with or without the malformed end after them, so a malformed
+length stops the walk and keeps everything before it. The model reads each field at its
+byte offset rather than through the C structs and applies messages in order; unlike
+moq-sock, a recognized message without a valid value clears its field. The reported
+stride is never zero.
+
+## When something fails
+
+libFuzzer writes the input to `artifacts/uring_cmsg/crash-` and prints the
+`cargo fuzz` command to reproduce it. Fix the bug, then commit the input:
+
+```bash
+mkdir -p rs/moq-uring/fuzz/regressions/uring_cmsg
+cp rs/moq-uring/fuzz/artifacts/uring_cmsg/crash- rs/moq-uring/fuzz/regressions/uring_cmsg/
+```
+
+`udp::fuzz::tests::regressions` replays everything under `regressions//` as part
+of the normal test suite, so the case stays covered.
diff --git a/rs/moq-uring/fuzz/fuzz_targets/uring_cmsg.rs b/rs/moq-uring/fuzz/fuzz_targets/uring_cmsg.rs
new file mode 100644
index 00000000000..c4757298fe4
--- /dev/null
+++ b/rs/moq-uring/fuzz/fuzz_targets/uring_cmsg.rs
@@ -0,0 +1,7 @@
+#![no_main]
+
+use libfuzzer_sys::fuzz_target;
+
+fuzz_target!(|data: &[u8]| {
+ moq_uring::udp::fuzz::uring_cmsg(data);
+});
diff --git a/rs/moq-uring/fuzz/regressions/README.md b/rs/moq-uring/fuzz/regressions/README.md
new file mode 100644
index 00000000000..45d6b04bb15
--- /dev/null
+++ b/rs/moq-uring/fuzz/regressions/README.md
@@ -0,0 +1,8 @@
+# Regressions
+
+Failing inputs the fuzzer found, one file per input, in a directory named after its
+target (`uring_cmsg/`). `udp::fuzz::tests::regressions` replays them on the stable
+toolchain as part of `just check`, so a bug found by fuzzing stays fixed without anyone
+running the fuzzer again.
+
+See [../README.md](../README.md) for the workflow.
diff --git a/rs/moq-uring/src/udp.rs b/rs/moq-uring/src/udp.rs
index e13c3b5dab9..b3192f1e683 100644
--- a/rs/moq-uring/src/udp.rs
+++ b/rs/moq-uring/src/udp.rs
@@ -55,6 +55,11 @@ use crate::metrics::Counters;
use crate::shared::{Cqe, Op, Shared};
use crate::worker::Owner;
+// The control-message walk's fuzz target, on 64-bit, which the reference model's struct layouts
+// assume.
+#[cfg(all(any(test, feature = "fuzz"), target_pointer_width = "64"))]
+pub mod fuzz;
+
/// `CMSG_SPACE` of a `len`-byte payload.
const fn cmsg_space(len: usize) -> usize {
// SAFETY: a pure size computation.
diff --git a/rs/moq-uring/src/udp/fuzz.rs b/rs/moq-uring/src/udp/fuzz.rs
new file mode 100644
index 00000000000..1247f06c8c2
--- /dev/null
+++ b/rs/moq-uring/src/udp/fuzz.rs
@@ -0,0 +1,189 @@
+//! Test support, enabled by the `fuzz` feature: the `uring_cmsg` fuzz target body for
+//! `RecvMeta::parse`, the receive control-message walk, plus its seeds.
+//!
+//! The walk is the unsafe code a received datagram reaches: it steps through the kernel's control
+//! buffer by the lengths written in it and reads each payload as a C struct. Inputs use moq-sock's
+//! format ([`Control`]): well-formed control messages laid out as the kernel lays them, optionally
+//! followed by a malformed header and arbitrary bytes. The walk must read exactly what a byte-level
+//! reference model reads from the well-formed messages, whether or not the malformed tail follows.
+//! The body lives here because the walk is private, and so the tests below replay it on stable and
+//! under Miri.
+//!
+//! It tracks the crate's internals, so it can change in any release. See `fuzz/README.md` for the
+//! workflow.
+
+use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
+use std::time::Duration;
+
+use moq_sock::udp::fuzz::{Control, Message};
+
+use super::{Ecn, RecvMeta, Wall};
+
+/// One fuzz target body.
+pub type Target = fn(&[u8]);
+
+/// Every target, keyed by the name of its `fuzz_targets/.rs` shim.
+pub const TARGETS: &[(&str, Target)] = &[("uring_cmsg", uring_cmsg)];
+
+/// `RecvMeta::parse` reads what the reference model reads from the well-formed messages, with
+/// or without the malformed tail after them, and never reports a zero stride.
+pub fn uring_cmsg(data: &[u8]) {
+ let control = Control::parse(data);
+ let expected = Expected::model(&control.messages);
+ for buffer in [&control.prefix, &control.full] {
+ let RecvMeta {
+ stride,
+ ecn,
+ dst_ip,
+ timestamp,
+ } = RecvMeta::parse(buffer);
+ let actual = Expected {
+ stride,
+ ecn,
+ dst_ip,
+ timestamp,
+ };
+ assert_eq!(
+ actual,
+ expected,
+ "{} messages, {} bytes",
+ control.messages.len(),
+ buffer.len()
+ );
+ assert_ne!(stride, Some(0), "a zero stride never ends a GRO split");
+ }
+}
+
+/// What a receive reports.
+#[derive(Debug, PartialEq)]
+struct Expected {
+ stride: Option,
+ ecn: Option,
+ dst_ip: Option,
+ timestamp: Option,
+}
+
+impl Expected {
+ /// What each message means, read from its bytes rather than through the C structs, applied
+ /// in order. A recognized message that does not hold a valid value clears its field.
+ fn model(messages: &[Message]) -> Self {
+ let mut expected = Self {
+ stride: None,
+ ecn: None,
+ dst_ip: None,
+ timestamp: None,
+ };
+ for Message { level, kind, payload } in messages {
+ let p = payload.as_slice();
+ match (*level, *kind) {
+ (libc::SOL_UDP, libc::UDP_GRO) => {
+ expected.stride = int(p)
+ .and_then(|stride| usize::try_from(stride).ok())
+ .filter(|&stride| stride > 0);
+ }
+ (libc::IPPROTO_IP, libc::IP_TOS) => expected.ecn = p.first().and_then(|&bits| Ecn::from_bits(bits)),
+ (libc::IPPROTO_IPV6, libc::IPV6_TCLASS) => {
+ expected.ecn = int(p).and_then(|value| Ecn::from_bits(value as u8));
+ }
+ // in_pktinfo: ifindex, the route's preferred source, then the destination.
+ (libc::IPPROTO_IP, libc::IP_PKTINFO) => {
+ expected.dst_ip = bytes::<4>(p, 8)
+ .filter(|_| p.len() >= 12)
+ .map(|ip| Ipv4Addr::from(ip).into());
+ }
+ // in6_pktinfo: the destination, then ifindex.
+ (libc::IPPROTO_IPV6, libc::IPV6_PKTINFO) => {
+ expected.dst_ip = bytes::<16>(p, 0)
+ .filter(|_| p.len() >= 20)
+ .map(|ip| Ipv6Addr::from(ip).into());
+ }
+ (libc::SOL_SOCKET, libc::SCM_TIMESTAMPNS) => {
+ expected.timestamp = (|| {
+ let secs = u64::try_from(i64::from_ne_bytes(bytes(p, 0)?)).ok()?;
+ let nanos = u32::try_from(i64::from_ne_bytes(bytes(p, 8)?)).ok()?;
+ Wall::UNIX_EPOCH.checked_add(Duration::new(secs, nanos))
+ })();
+ }
+ _ => {}
+ }
+ }
+ expected
+ }
+}
+
+/// A payload's leading native `c_int`.
+fn int(p: &[u8]) -> Option {
+ bytes(p, 0).map(i32::from_ne_bytes)
+}
+
+/// `N` bytes of `p` from `at`, if it holds them.
+fn bytes(p: &[u8], at: usize) -> Option<[u8; N]> {
+ p.get(at..at + N)?.try_into().ok()
+}
+
+/// One input to start a target from.
+pub struct Seed {
+ /// The target it feeds, a key of [`TARGETS`].
+ pub target: &'static str,
+ /// The input.
+ pub data: Vec,
+}
+
+/// The starting corpus, moq-sock's receive sets and malformed ends.
+pub fn seeds() -> Vec {
+ Control::seeds()
+ .into_iter()
+ .map(|data| Seed {
+ target: "uring_cmsg",
+ data,
+ })
+ .collect()
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ /// Every seed passes. Runs under Miri, which checks the walk's pointer arithmetic on each.
+ #[test]
+ fn seeds_pass() {
+ for seed in seeds() {
+ uring_cmsg(&seed.data);
+ }
+ }
+
+ /// The model reads the seeds' first receive set as the socket tests expect.
+ #[test]
+ fn model_reads_the_seeds() {
+ let control = Control::parse(&seeds()[0].data);
+ let expected = Expected::model(&control.messages);
+ assert_eq!(expected.stride, Some(1200));
+ assert_eq!(expected.ecn, Some(Ecn::Ect0));
+ assert_eq!(expected.dst_ip, Some(Ipv4Addr::new(192, 0, 2, 2).into()));
+ assert_eq!(
+ expected.timestamp,
+ Some(Wall::UNIX_EPOCH + Duration::new(1_700_000_000, 123_456_789))
+ );
+ }
+
+ /// Replay the inputs committed under `fuzz/regressions/`, so a bug the fuzzer found stays
+ /// fixed on the stable toolchain, in the suite CI already runs.
+ #[test]
+ #[cfg_attr(miri, ignore = "reads the regression files, which Miri's isolation refuses")]
+ fn regressions() {
+ let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("fuzz/regressions");
+
+ for (name, target) in TARGETS {
+ // Nothing has failed yet for this target; `fuzz/README.md` says what to drop in here
+ // when something does.
+ let Ok(entries) = std::fs::read_dir(root.join(name)) else {
+ continue;
+ };
+ for entry in entries {
+ let path = entry.expect("could not read the regression directory").path();
+ let data = std::fs::read(&path).expect("could not read a regression input");
+ target(&data);
+ }
+ }
+ }
+}
diff --git a/sh/coverage.test.py b/sh/coverage.test.py
index f07df6c0ae9..a243d904f40 100644
--- a/sh/coverage.test.py
+++ b/sh/coverage.test.py
@@ -134,8 +134,8 @@ def test_rust_measures_native_workspace_without_fuzz_targets(self):
build = calls[1][2:]
self.assertEqual(build[:3], ["llvm-cov", "nextest", "--no-fail-fast"])
self.assertIn("--workspace", build)
- for excluded in ("moq-net-fuzz", "moq-quic-fuzz", "moq-mux-fuzz", "moq-rtmp-fuzz"):
- self.assertIn(excluded, build)
+ for crate in ("moq-net", "moq-quic", "moq-mux", "moq-rtmp", "moq-sock", "moq-uring"):
+ self.assertIn(f"{crate}-fuzz", build)
self.assertIn("--tests", build)
self.assertIn("--test-threads", build)
self.assertIn("--json", calls[3])
diff --git a/sh/rs/coverage.sh b/sh/rs/coverage.sh
index 785fc804f7e..aa0b513cdc3 100644
--- a/sh/rs/coverage.sh
+++ b/sh/rs/coverage.sh
@@ -5,7 +5,7 @@ crate=${1:-workspace}
report=()
if [[ $crate == workspace ]]; then
# Fuzz targets require nightly.
- packages=(--workspace --exclude moq-net-fuzz --exclude moq-quic-fuzz --exclude moq-mux-fuzz --exclude moq-rtmp-fuzz)
+ packages=(--workspace --exclude moq-net-fuzz --exclude moq-quic-fuzz --exclude moq-mux-fuzz --exclude moq-rtmp-fuzz --exclude moq-sock-fuzz --exclude moq-uring-fuzz)
elif [[ $crate =~ ^[a-zA-Z0-9_-]+$ ]]; then
packages=(-p "$crate")
report=(-p "$crate")
diff --git a/sh/rs/miri.sh b/sh/rs/miri.sh
index ff28157d603..171e7f9d619 100755
--- a/sh/rs/miri.sh
+++ b/sh/rs/miri.sh
@@ -73,7 +73,7 @@ fi
ran=0
pass() {
local status=0
- cargo miri nextest run --locked --profile miri --no-fail-fast -p kio -p moq-net --lib \
+ cargo miri nextest run --locked --profile miri --no-fail-fast -p kio -p moq-net -p moq-sock -p moq-uring --lib \
-E "($1) & ($caller)" ${args[@]+"${args[@]}"} || status=$?
case $status in
0) ran=1 ;;
@@ -82,7 +82,11 @@ pass() {
esac
}
-pass '(package(kio) & not test(/^log::/)) | (package(moq-net) & (test(/^model::frame::/) | test(/^path::/)))'
+# moq-sock and moq-uring: the receive control-message walks, which the fuzz seeds drive
+# through every message kind and malformed end.
+pass '(package(kio) & not test(/^log::/)) | (package(moq-net) & (test(/^model::frame::/) | test(/^path::/)))
+ | (package(moq-sock) & (test(/^udp::cmsg::/) | test(/^udp::fuzz::/) | test(/^udp::linux::tests::decode_/)))
+ | (package(moq-uring) & (test(/^udp::fuzz::/) | test(/^udp::tests::(malformed_control|the_full_receive|a_zero_gro)/)))'
MIRIFLAGS="${MIRIFLAGS:+$MIRIFLAGS }-Zmiri-tree-borrows -Zmiri-ignore-leaks" \
pass '(package(kio) & test(/^log::/)) | (package(moq-net) & test(/^model::group::/))'
diff --git a/sh/rs/select.sh b/sh/rs/select.sh
index c45df0449c5..c5885383d1b 100755
--- a/sh/rs/select.sh
+++ b/sh/rs/select.sh
@@ -144,7 +144,7 @@ fi
# The `*-fuzz` crates need a nightly toolchain; only `just rs fuzz` compiles them.
if [[ "$packages" == ALL ]]; then
- flags=(--workspace --exclude moq-net-fuzz --exclude moq-quic-fuzz --exclude moq-mux-fuzz --exclude moq-rtmp-fuzz)
+ flags=(--workspace --exclude moq-net-fuzz --exclude moq-quic-fuzz --exclude moq-mux-fuzz --exclude moq-rtmp-fuzz --exclude moq-sock-fuzz --exclude moq-uring-fuzz)
else
# Space-separated `--package ` pairs; ids contain no spaces.
# shellcheck disable=SC2206
@@ -224,7 +224,7 @@ case "$action" in
| .targets[]
| select((.kind // [] | any(. == "bench" or . == "example")) or .test)
| (.["required-features"] // [])[]
- | "\($name)/\(.)"' | sort -u | tr '\n' ' '
+ | "\($name)/\(.)"' | LC_ALL=C sort -u | tr '\n' ' '
)
for feature in $required; do
[[ " ${features[*]-} " == *" $feature "* ]] || features+=("$feature")
diff --git a/sh/rs/select.test.py b/sh/rs/select.test.py
index 405aacbfc86..f320d7f6d33 100644
--- a/sh/rs/select.test.py
+++ b/sh/rs/select.test.py
@@ -10,7 +10,8 @@
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
-FUZZ_EXCLUDES = " ".join(f"--exclude {crate}-fuzz" for crate in ("moq-net", "moq-quic", "moq-mux", "moq-rtmp"))
+FUZZ_CRATES = ("moq-net", "moq-quic", "moq-mux", "moq-rtmp", "moq-sock", "moq-uring")
+FUZZ_EXCLUDES = " ".join(f"--exclude {crate}-fuzz" for crate in FUZZ_CRATES)
DEVICE_FEATURES = "moq-video/capture moq-audio/capture moq-audio/playback moq-cli/play moq-cli/openh264"
LINUX = os.uname().sysname == "Linux"