Repository navigation
Improve resending of Initial on undecryptable - #2866
larseggert merged 2 commits into
Conversation
The goal here was to make the test more robust, but it turns out that the code could have been simpler as well. That is, rather than testing for a separate threshold, we can test instead for whether the saved datagram store is full. That was the same constant anyway. The test is made more robust by having it disable MLKEM, which ensures that there is just one Initial packet in each flight. The undecryptable packet is constructed manually (by rewriting an Initial).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2866 +/- ##
=======================================
Coverage 94.92% 94.93%
=======================================
Files 115 115
Lines 34484 34488 +4
Branches 34484 34488 +4
=======================================
+ Hits 32733 32740 +7
+ Misses 1742 1741 -1
+ Partials 9 7 -2
|
Failed Interop TestsQUIC Interop Runner, client vs. server, differences relative to a20e4e9. neqo-latest as client
neqo-latest as server
All resultsSucceeded Interop TestsQUIC Interop Runner, client vs. server neqo-latest as client
neqo-latest as server
Unsupported Interop TestsQUIC Interop Runner, client vs. server neqo-latest as client
neqo-latest as server
|
Benchmark resultsPerformance differences relative to a20e4e9. 1-conn/1-100mb-resp/mtu-1504 (aka. Download)/client: Change within noise threshold. time: [200.24 ms 200.67 ms 201.20 ms]
thrpt: [497.02 MiB/s 498.33 MiB/s 499.39 MiB/s]
change:
time: [−1.2710% −0.9307% −0.6117%] (p = 0.00 < 0.05)
thrpt: [+0.6154% +0.9395% +1.2873%]
1-conn/10_000-parallel-1b-resp/mtu-1504 (aka. RPS)/client: No change in performance detected. time: [303.63 ms 304.87 ms 306.14 ms]
thrpt: [32.665 Kelem/s 32.800 Kelem/s 32.935 Kelem/s]
change:
time: [−1.1425% −0.5125% +0.1136%] (p = 0.10 > 0.05)
thrpt: [−0.1135% +0.5151% +1.1557%]
1-conn/1-1b-resp/mtu-1504 (aka. HPS)/client: No change in performance detected. time: [27.733 ms 27.880 ms 28.046 ms]
thrpt: [35.655 B/s 35.868 B/s 36.058 B/s]
change:
time: [−0.6278% +0.0713% +0.8681%] (p = 0.85 > 0.05)
thrpt: [−0.8606% −0.0712% +0.6318%]
1-conn/1-100mb-req/mtu-1504 (aka. Upload)/client: 💔 Performance has regressed. time: [208.87 ms 209.21 ms 209.60 ms]
thrpt: [477.11 MiB/s 477.99 MiB/s 478.77 MiB/s]
change:
time: [+1.3794% +1.6220% +1.8562%] (p = 0.00 < 0.05)
thrpt: [−1.8224% −1.5961% −1.3606%]
decode 4096 bytes, mask ff: Change within noise threshold. time: [11.638 µs 11.681 µs 11.731 µs]
change: [+0.0196% +0.4467% +0.8930%] (p = 0.04 < 0.05)
decode 1048576 bytes, mask ff: No change in performance detected. time: [3.0086 ms 3.0183 ms 3.0296 ms]
change: [−0.4275% +0.0599% +0.5522%] (p = 0.82 > 0.05)
decode 4096 bytes, mask 7f: No change in performance detected. time: [19.367 µs 19.419 µs 19.475 µs]
change: [−0.8125% −0.3387% +0.0663%] (p = 0.14 > 0.05)
decode 1048576 bytes, mask 7f: No change in performance detected. time: [5.0863 ms 5.0991 ms 5.1124 ms]
change: [−0.3521% +0.0139% +0.3769%] (p = 0.93 > 0.05)
decode 4096 bytes, mask 3f: No change in performance detected. time: [5.5160 µs 5.5428 µs 5.5747 µs]
change: [−0.4126% −0.0375% +0.3248%] (p = 0.85 > 0.05)
decode 1048576 bytes, mask 3f: No change in performance detected. time: [1.7578 ms 1.7579 ms 1.7581 ms]
change: [−0.3878% −0.1267% +0.0094%] (p = 0.42 > 0.05)
coalesce_acked_from_zero 1+1 entries: No change in performance detected. time: [88.216 ns 88.549 ns 88.905 ns]
change: [−0.5687% −0.0528% +0.4873%] (p = 0.85 > 0.05)
coalesce_acked_from_zero 3+1 entries: No change in performance detected. time: [105.60 ns 105.92 ns 106.26 ns]
change: [−0.4587% −0.0325% +0.3818%] (p = 0.88 > 0.05)
coalesce_acked_from_zero 10+1 entries: No change in performance detected. time: [105.00 ns 105.39 ns 105.86 ns]
change: [−0.8257% −0.1794% +0.3734%] (p = 0.59 > 0.05)
coalesce_acked_from_zero 1000+1 entries: No change in performance detected. time: [88.954 ns 89.075 ns 89.216 ns]
change: [−8.0418% −2.4257% +1.1056%] (p = 0.52 > 0.05)
RxStreamOrderer::inbound_frame(): Change within noise threshold. time: [108.27 ms 108.43 ms 108.66 ms]
change: [+0.0428% +0.2175% +0.4361%] (p = 0.03 < 0.05)
sent::Packets::take_ranges: :green_heart: Performance has improved. time: [5.1041 µs 5.2327 µs 5.3907 µs]
change: [−41.665% −34.988% −20.486%] (p = 0.00 < 0.05)
transfer/pacing-false/varying-seeds: Change within noise threshold. time: [37.471 ms 37.567 ms 37.671 ms]
change: [+0.3615% +0.7567% +1.1354%] (p = 0.00 < 0.05)
transfer/pacing-true/varying-seeds: Change within noise threshold. time: [38.365 ms 38.483 ms 38.600 ms]
change: [+0.3742% +0.8222% +1.2808%] (p = 0.00 < 0.05)
transfer/pacing-false/same-seed: No change in performance detected. time: [37.164 ms 37.232 ms 37.301 ms]
change: [−0.0473% +0.2308% +0.4850%] (p = 0.09 > 0.05)
transfer/pacing-true/same-seed: Change within noise threshold. time: [38.638 ms 38.741 ms 38.851 ms]
change: [−1.2430% −0.9020% −0.5325%] (p = 0.00 < 0.05)
Download data for |
Client/server transfer resultsPerformance differences relative to a20e4e9. Transfer of 33554432 bytes over loopback, min. 100 runs. All unit-less numbers are in milliseconds.
Download data for |
* Improve resending of Initial on undecryptable The goal here was to make the test more robust, but it turns out that the code could have been simpler as well. That is, rather than testing for a separate threshold, we can test instead for whether the saved datagram store is full. That was the same constant anyway. The test is made more robust by having it disable MLKEM, which ensures that there is just one Initial packet in each flight. The undecryptable packet is constructed manually (by rewriting an Initial). * Rename the function
* Ignore all SCONE packets * SCONE transport parameter * Add SCONE indication * Log SCONE value * Add a connection-level test for SCONE * Clippy, review comments * Reduce log level for packet drops * Conditionally error on other version packets * Add a further test for Initial before docking two bytes * Fix the indication reservation and test it * chore(.github/check.yaml): remove obsolete run_benchmarks input (#2826) #2773 removed the benchmark trigger from `check.yaml`. Thus the input is no longer needed. Signed-off-by: Max Inden <mail@max-inden.de> * ci: Create cache on `merge_group` trigger (#2824) * ci: Create cache on `merge_group` trigger * Fix comment * refactor(http3): improve `FrameReader` `Debug` implementation (#2815) `FrameReader` owns a 2048 byte `buffer` ``` rust pub struct FrameReader { state: FrameReaderState, frame_type: HFrameType, frame_len: u64, buffer: [u8; MAX_READ_SIZE], } ``` This buffer is only used when reading from a stream, then consecutively decoding off the buffer. There is no need to print the entire buffer in its `Debug` implementation. See sample logging output below. ``` 0.036 DEBUG [RecvMessage stream_id:0] state=WaitingForResponseHeaders { frame_reader: FrameReader { state: GetLength { decoder: IncrementalDecoderUint { v: 0, remaining: None } }, frame_type: HFrameType(1), frame_len: 0, buffer: [0, 0, 0, 0, 0, ... ] } } ``` * chore(clippy): remove expect for needless_match (#2835) * chore(clippy): update to latest lints (#2837) * ci: Disable systemd unified cgroups on GCP (#2803) * build(deps): bump github/codeql-action from 3.29.7 to 3.29.8 (#2845) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.7 to 3.29.8. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@51f7732...76621b6) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 3.29.8 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump actions/cache from 4.2.3 to 4.2.4 (#2844) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Lars Eggert <lars@eggert.org> * build(deps): bump docker/login-action from 3.4.0 to 3.5.0 (#2846) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump actions/download-artifact from 4.3.0 to 5.0.0 (#2841) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Lars Eggert <lars@eggert.org> * ci: Use an older kernel with `cpuset` support for benchers (#2840) * fix(transport/frame): prevent potential overflow in padding decode (#2839) * test(transport/frame): decode padding frame > u16::MAX * fix(transport/frame): prevent potential overflow in padding decode Previously `neqo-transport` would use a `u16` to count the number of padding frames, i.e. `0`s. If an attacker sends more than `u16::MAX` `0`s, the counter would overflow. This commit returns a `Error::TooMuchData` instead. Note that the maximum UDP size is `u16::MAX`, thus in the real world, an attacker can not send more than `u16::MAX` padding frames. * Update neqo-common/src/codec.rs Co-authored-by: Martin Thomson <mt@lowentropy.net> Signed-off-by: Max Inden <mail@max-inden.de> --------- Signed-off-by: Max Inden <mail@max-inden.de> Co-authored-by: Martin Thomson <mt@lowentropy.net> * docs(transport/datagrams): remove outdated fn return docs (#2842) Signed-off-by: Max Inden <mail@max-inden.de> * refactor(crypto): improve `ResumptionToken` `Debug` impl (#2847) * refactor(crypto): improve `ResumptionToken` `Debug` impl Use `hex_snip_middle` to print token. See similar change in #2815. * test: debug impl * docs(transport): extend preprocess_packet docs on State::Closing (#2848) * ci: Use 6.11 kernel on GCP (#2849) * ci: Use implicit `$HOME` home directory (#2850) * feat: Optimize `neqo-qpack` (#2831) * feat: Optimize `neqo-qpack` Similar to #2827 * Address @martinthomson's comments * fix(http3): reduce visibility of internal functions (#2802) Mark functions not used in Firefox as pub(crate). This enables us to detect unused code and simplifies future refactorings. * refactor: unify most exchange_packets impls (#2851) This commit unifies various `exchange_packets` implementations across the codebase. * Make initial RTT configurable (#2825) Co-authored-by: Max Inden <mail@max-inden.de> * fix(bin): replace buggy `to_headers` with `FromStr` `impl` (#2833) * refactor(webtransport): rename WebTransportEvent::Session to NewSession (#2853) On a new WebTransport session a client emits `neqo_http3::client_events::WebTransportEvent::Session` and a server emits `neqo_http3::server_events::WebTransportServerEvent::NewSession`. For the sake of consistency, rename the former to `NewSession`. Also consistent with `neqo_http3:client_event::WebTransportEvent::NewStream`. * ci: No `mold` (#2857) It takes longer to install the mold package then performing the link. * docs(http3): remove partially outdated docs (#2859) * chore: Bump `sfv` to 0.14 (#2856) * Make the drop_handshake_packet_from_wrong_address robust (#2862) This test assumes that the server Initial is smaller than a single packet. That doesn't hold, even if we increase the size of that packet by a single byte. This test is a little more complex, but more robust. * Make discarded_initial_keys more robust (#2864) * Make discarded_initial_keys more robust Use split_datagram to make the dropping/dup counting more robust. Rename some variables to make them more obvious. * Fix import foul-up * Improve resending of Initial on undecryptable (#2866) * Improve resending of Initial on undecryptable The goal here was to make the test more robust, but it turns out that the code could have been simpler as well. That is, rather than testing for a separate threshold, we can test instead for whether the saved datagram store is full. That was the same constant anyway. The test is made more robust by having it disable MLKEM, which ensures that there is just one Initial packet in each flight. The undecryptable packet is constructed manually (by rewriting an Initial). * Rename the function * compatible_upgrade_large_initial robustness (#2863) * compatible_upgrade_large_initial robustness This strips padding from all the packets in the handshake. That makes all the accounting a lot simpler and robust. This is not generic, but if I find a use for it in other tests (which seems likely), it should be easy enough to factor it out. The padding test is a little fragile, but it accounts for the possibility of adding SCONE at some point. * Move the strip_padding function out * Make sure to strip padding * Move connection parameter defaults to the type (#2869) * Move connection parameter defaults to the type This is just a bunch of renaming, but it makes it possible to encapsulate better. * Update doc link * Move test_frame_writer use (#2870) * Move test_frame_writer use ... to ensure that it can be used for handshake packet types. Takes @larseggert's suggestion to assert that the packet isn't full. * Factor out the overfill test for datagrams * Improve the ALPN handling (#2871) * Improve the ALPN handling We went through and removed `unwrap()` calls and assertions from a lot of the code. This function gained a `Result` return value, but was still doing some asserting. Also, there are a few nice facilities in the std library that can make this a bit smoother than before. * Also take byte arrays, which is more general ( counts) * Add a test for the ALPN to get coverage back * Remove redundant & * Make only_server_initial more robust (#2865) This uses `split_datagram` again to ensure that our counting is accurate in case we can't coalesce sometimes. Signed-off-by: Martin Thomson <mt@lowentropy.net> * coalesce_05rtt robustness improvements (#2867) * compatible_upgrade_large_initial robustness This strips padding from all the packets in the handshake. That makes all the accounting a lot simpler and robust. This is not generic, but if I find a use for it in other tests (which seems likely), it should be easy enough to factor it out. The padding test is a little fragile, but it accounts for the possibility of adding SCONE at some point. * Move the strip_padding function out * Make the coalesce_05rtt test robust This was checking for dropped packets as if that made a significant difference. It does, because we want to make sure that no packet was dropped because it couldn't be decrypted, but we need to ensure that the packet padding wasn't masking real drops. The way to fix that is to strip padding where necessary. Factors out the code from the previous test. --------- Signed-off-by: Martin Thomson <mt@lowentropy.net> * A bunch of logging improvements (#2874) * A bunch of logging improvements There's a lot of places we were dumping Debug implementations to the log, without considering that they were big buffers of data. This fixes that. It also removes a few logging statements that were redundant and enables logging for anything using the test-fixture crate. * Get the imports right this time * Completely rewrite dup_server_flight1 (#2868) * compatible_upgrade_large_initial robustness This strips padding from all the packets in the handshake. That makes all the accounting a lot simpler and robust. This is not generic, but if I find a use for it in other tests (which seems likely), it should be easy enough to factor it out. The padding test is a little fragile, but it accounts for the possibility of adding SCONE at some point. * Move the strip_padding function out * Completely rewrite dup_server_flight1 This was very old and it showed. The new version is much more in line with other tests we've written recently. It also avoids a bunch of unnecessary back and forth. It covers all the cases properly as well. --------- Signed-off-by: Martin Thomson <mt@lowentropy.net> * Force coverage up by simplifying a test (#2872) * Force coverage up by simplifying a test * Even shorter * Enable the client-side assertion as well. * Fix packet_with_only_padding test (#2873) This test was broken - it wasn't correctly encrypting the modified packet. * PTO across packet number spaces better (#2878) This tweaks the change that @larseggert made to reduce the number of pointless handshake packets (Initial and Handshake both). Rather than cap the number of probes we send on a PTO, this keeps the limit of two packets, but disables the probing we do with PING frames once we have sent a packet of the indicated type. This merges the spaces that we probe when a PTO occurs. So we don't just probe the last space that fired the PTO timer. Because we time out Initial and Handshake packets at the same time often, that results in only probing the Handshake space. That's probably OK in most cases, but it can mean stalling Handshake if there is stuff to send at that level at a server. Because this allows more than one packet to be sent in Initial and Handshake packet number spaces, there are some tests that do precise counting and need to be adjusted. * fix: Don't call `finish` in `std::hash::Hash` implementations (#2881) At least I understand from the docs that is not needed: https://doc.rust-lang.org/std/hash/trait.Hash.html#implementing-hash * refactor(bin/server): simplify run() removing need for HttpServer::new (#2883) #2734 introduced a trait parameter into the `HTTPServer::process_multiple` trait function, thus making `HttpServer` no longer object safe. That required a couple of minor changes, solved via a new `HttpServer::new` function. `HttpServer` is consumed by `neqo-bin`, but also `http3server` in mozilla-firefox/firefox. The latter does not use `HttpServer::new`, but the trait requires implementing it anyways. This commit removes the need for `HttpServer::new`. * Fix compatible upgrade (#2877) * Fix compatible upgrade This changeset should have zero obvious effect right now, but this is preparatory for the change that will randomize the first packet number. This makes the whole version negotiation thing far more robust. It ensures that we correctly track the received packet numbers across multiple crypto states at both client and server. It changes how we confirm a compatible version upgrade, using the availability of Handshake keys as the definitive trigger. At the server, that means that the server has processed the ClientHello (which contains the client transport parameters and that is what the server needs. At the client, that means that the client has received at least one packet with the chosen value, which is what the client needs (any packet that makes progress on the handshake is enough). This fixes two bugs: 1. We previously committed a version when receiving any CRYPTO frame. If we received an Initial packet with a TLS HelloRetryRequest, that would have been wrong. That can happen if the server hadn't processed the ClientHello, but we were previously assuming that the server would have done so. 2. There are cases where a peer can send a v2 packet with a truncated packet number. They make the choice to truncate based on the largest acknowledged, which might be > 256 if they are doing first packet number randomization. Because we track the largest received packet number in the cryptographic send/receive state AND there is separate state for that for each version that might be used, if that truncated packet number is the first v2 packet we see, we fail to decrypt. That situation is not recoverable. There are now tests for these bugs, which are a little convoluted to setup, but not completely implausible. I've retained the case for compatible upgrade if the packet version in an Initial packet changes during the handshake. This is consistent with what the spec requires and it can avoid the need to do the fiddly stuff that follows. Fixing the packet number continuation thing was easy on the server: it is the one that decides to use a new version, so it can commit before it ever needs to decrypt anything. On the client, we have to be a little more careful. There's a tiny performance hit for doing the update, which entails looking at the crypto state for every version, but it should be modest overall. There was one other test that tests an error condition that becomes State::Closed rather than State::Closing as a result of deferring the version confirmation. * Mention MSRV Co-authored-by: Lars Eggert <lars@eggert.org> Signed-off-by: Martin Thomson <mt@lowentropy.net> * Capital idea Co-authored-by: Lars Eggert <lars@eggert.org> Signed-off-by: Martin Thomson <mt@lowentropy.net> * Remove outdated comment. Signed-off-by: Martin Thomson <mt@lowentropy.net> --------- Signed-off-by: Martin Thomson <mt@lowentropy.net> Co-authored-by: Lars Eggert <lars@eggert.org> * Address test changes (more padding now means rearrangement of handshake) * More tests with less flake * Moar robust testing * Finalize fixes for more tests * dafmt * Clippy * Fix some comments --------- Signed-off-by: Max Inden <mail@max-inden.de> Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Martin Thomson <mt@lowentropy.net> Co-authored-by: Lars Eggert <lars@eggert.org> Co-authored-by: Max Inden <mail@max-inden.de> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Adolfo Ochagavía <github@adolfo.ochagavia.nl>
The goal here was to make the test more robust, but it turns out that the code could have been simpler as well. That is, rather than testing for a separate threshold, we can test instead for whether the saved datagram store is full. That was the same constant anyway.
The test is made more robust by having it disable MLKEM, which ensures that there is just one Initial packet in each flight. The undecryptable packet is constructed manually (by rewriting an Initial).