Skip to content

ci: Disable systemd unified cgroups on GCP - #2803

Merged
larseggert merged 5 commits into
mozilla:mainfrom
larseggert:ci-gcp-fixes
Aug 8, 2025
Merged

larseggert merged 5 commits into
mozilla:mainfrom
larseggert:ci-gcp-fixes

Conversation

@larseggert

Copy link
Copy Markdown
Collaborator

No description provided.

@codecov

codecov Bot commented Jul 21, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.91%. Comparing base (5e018ba) to head (117c818).
⚠️ Report is 20 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2803      +/-   ##
==========================================
+ Coverage   94.89%   94.91%   +0.02%     
==========================================
  Files         115      115              
  Lines       34286    34286              
  Branches    34286    34286              
==========================================
+ Hits        32535    32543       +8     
+ Misses       1744     1734      -10     
- Partials        7        9       +2     
Components Coverage Δ
neqo-common 97.10% <ø> (ø)
neqo-crypto 89.64% <ø> (ø)
neqo-http3 93.71% <ø> (ø)
neqo-qpack 95.45% <ø> (ø)
neqo-transport 96.00% <ø> (+0.04%) ⬆️
neqo-udp 89.85% <ø> (ø)

@github-actions

Copy link
Copy Markdown
Contributor

Client/server transfer results

Performance differences relative to 5e018ba.

Transfer of 33554432 bytes over loopback, min. 100 runs. All unit-less numbers are in milliseconds.

Client vs. server (params) Mean ± σ Min Max MiB/s ± σ Δ main Δ main
google vs. google 450.9 ± 4.8 444.8 462.6 71.0 ± 6.7
google vs. neqo (cubic, paced) 270.5 ± 4.6 261.4 278.5 118.3 ± 7.0 -0.6 -0.2%
msquic vs. msquic 128.5 ± 16.5 106.4 203.8 249.1 ± 1.9
msquic vs. neqo (cubic, paced) 149.9 ± 26.8 121.5 245.7 213.5 ± 1.2 -6.6 -4.2%
neqo vs. google (cubic, paced) 751.4 ± 4.4 745.3 763.5 42.6 ± 7.3 0.5 0.1%
neqo vs. msquic (cubic, paced) 155.8 ± 5.4 148.6 178.3 205.3 ± 5.9 0.8 0.5%
neqo vs. neqo (cubic) 91.6 ± 4.9 83.1 109.1 349.2 ± 6.5 0.9 1.0%
neqo vs. neqo (cubic, paced) 94.0 ± 4.4 83.8 106.6 340.5 ± 7.3 💔 2.6 2.8%
neqo vs. neqo (reno) 91.6 ± 4.7 81.8 104.8 349.5 ± 6.8 0.8 0.9%
neqo vs. neqo (reno, paced) 90.3 ± 4.5 82.0 104.8 354.3 ± 7.1 💚 -2.2 -2.3%
neqo vs. quiche (cubic, paced) 193.7 ± 4.9 184.6 203.1 165.2 ± 6.5 💔 2.2 1.1%
neqo vs. s2n (cubic, paced) 217.1 ± 3.8 210.9 225.3 147.4 ± 8.4 💚 -1.6 -0.7%
quiche vs. neqo (cubic, paced) 160.2 ± 6.0 149.8 193.8 199.8 ± 5.3 1.4 0.9%
quiche vs. quiche 148.1 ± 4.8 138.7 162.5 216.0 ± 6.7
s2n vs. neqo (cubic, paced) 171.7 ± 4.8 162.6 185.5 186.4 ± 6.7 -0.8 -0.5%
s2n vs. s2n 248.1 ± 29.6 231.5 352.7 129.0 ± 1.1

Download data for profiler.firefox.com or download performance comparison data.

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark results

Performance differences relative to 5e018ba.

1-conn/1-100mb-resp/mtu-1504 (aka. Download)/client: No change in performance detected.
       time:   [198.23 ms 198.63 ms 199.13 ms]
       thrpt:  [502.18 MiB/s 503.45 MiB/s 504.46 MiB/s]
change:
       time:   [−0.1492% +0.1171% +0.3744%] (p = 0.42 > 0.05)
       thrpt:  [−0.3730% −0.1170% +0.1494%]

Found 3 outliers among 100 measurements (3.00%)
2 (2.00%) high mild
1 (1.00%) high severe

1-conn/10_000-parallel-1b-resp/mtu-1504 (aka. RPS)/client: No change in performance detected.
       time:   [303.24 ms 304.81 ms 306.37 ms]
       thrpt:  [32.640 Kelem/s 32.808 Kelem/s 32.977 Kelem/s]
change:
       time:   [−0.2616% +0.4848% +1.2390%] (p = 0.21 > 0.05)
       thrpt:  [−1.2239% −0.4825% +0.2623%]
1-conn/1-1b-resp/mtu-1504 (aka. HPS)/client: Change within noise threshold.
       time:   [27.832 ms 27.943 ms 28.066 ms]
       thrpt:  [35.630   B/s 35.788   B/s 35.930   B/s]
change:
       time:   [−1.6389% −0.8712% −0.0924%] (p = 0.03 < 0.05)
       thrpt:  [+0.0925% +0.8789% +1.6662%]

Found 3 outliers among 100 measurements (3.00%)
3 (3.00%) high severe

1-conn/1-100mb-req/mtu-1504 (aka. Upload)/client: Change within noise threshold.
       time:   [624.01 ms 627.91 ms 631.64 ms]
       thrpt:  [158.32 MiB/s 159.26 MiB/s 160.25 MiB/s]
change:
       time:   [−1.6584% −0.9351% −0.1265%] (p = 0.02 < 0.05)
       thrpt:  [+0.1267% +0.9439% +1.6863%]

Found 11 outliers among 100 measurements (11.00%)
2 (2.00%) low severe
7 (7.00%) low mild
2 (2.00%) high severe

decode 4096 bytes, mask ff: No change in performance detected.
       time:   [11.813 µs 11.843 µs 11.881 µs]
       change: [−0.8293% −0.1300% +0.5663%] (p = 0.73 > 0.05)

Found 16 outliers among 100 measurements (16.00%)
2 (2.00%) low severe
6 (6.00%) low mild
1 (1.00%) high mild
7 (7.00%) high severe

decode 1048576 bytes, mask ff: No change in performance detected.
       time:   [3.0208 ms 3.0449 ms 3.0841 ms]
       change: [−0.3533% +0.4995% +2.1354%] (p = 0.48 > 0.05)

Found 9 outliers among 100 measurements (9.00%)
9 (9.00%) high severe

decode 4096 bytes, mask 7f: No change in performance detected.
       time:   [19.997 µs 20.048 µs 20.105 µs]
       change: [−0.5687% −0.1486% +0.1855%] (p = 0.48 > 0.05)

Found 17 outliers among 100 measurements (17.00%)
2 (2.00%) low severe
4 (4.00%) low mild
1 (1.00%) high mild
10 (10.00%) high severe

decode 1048576 bytes, mask 7f: No change in performance detected.
       time:   [5.0424 ms 5.0538 ms 5.0668 ms]
       change: [−0.4883% −0.0854% +0.2806%] (p = 0.65 > 0.05)

Found 13 outliers among 100 measurements (13.00%)
13 (13.00%) high severe

decode 4096 bytes, mask 3f: No change in performance detected.
       time:   [8.2528 µs 8.2747 µs 8.3035 µs]
       change: [−0.6647% −0.1386% +0.4089%] (p = 0.63 > 0.05)

Found 9 outliers among 100 measurements (9.00%)
3 (3.00%) high mild
6 (6.00%) high severe

decode 1048576 bytes, mask 3f: No change in performance detected.
       time:   [1.5852 ms 1.5908 ms 1.5977 ms]
       change: [−0.8012% −0.1946% +0.3369%] (p = 0.51 > 0.05)

Found 5 outliers among 100 measurements (5.00%)
5 (5.00%) high severe

1000 streams of 1 bytes/multistream: No change in performance detected.
       time:   [27.149 ns 31.325 ns 39.480 ns]
       change: [−29.359% +0.6124% +43.579%] (p = 0.88 > 0.05)

Found 77 outliers among 500 measurements (15.40%)
32 (6.40%) high mild
45 (9.00%) high severe
Criterion.rs ERROR: Error in Gnuplot: line 0: Can't plot with an empty x range!

:
Criterion.rs ERROR: Error in Gnuplot:          line 0: Can't plot with an empty x range!
: No change in performance detected.

1000 streams of 1000 bytes/multistream
time: [26.859 ns 27.068 ns 27.299 ns]
change: [−1.8637% −0.7868% +0.3347%] (p = 0.17 > 0.05)

Found 93 outliers among 500 measurements (18.60%)
23 (4.60%) high mild
70 (14.00%) high severe
Criterion.rs ERROR: Error in Gnuplot: line 0: Can't plot with an empty x range!

: No change in performance detected.

coalesce_acked_from_zero 1+1 entries
time: [87.998 ns 88.308 ns 88.618 ns]
change: [−0.5836% −0.1186% +0.3515%] (p = 0.63 > 0.05)

Found 12 outliers among 100 measurements (12.00%)
10 (10.00%) high mild
2 (2.00%) high severe

coalesce_acked_from_zero 3+1 entries: No change in performance detected.
       time:   [105.40 ns 105.82 ns 106.28 ns]
       change: [−0.6504% +0.0147% +0.6349%] (p = 0.96 > 0.05)

Found 13 outliers among 100 measurements (13.00%)
13 (13.00%) high severe

coalesce_acked_from_zero 10+1 entries: No change in performance detected.
       time:   [104.71 ns 105.04 ns 105.44 ns]
       change: [−0.8980% −0.3705% +0.0981%] (p = 0.15 > 0.05)

Found 10 outliers among 100 measurements (10.00%)
5 (5.00%) low mild
5 (5.00%) high severe

coalesce_acked_from_zero 1000+1 entries: No change in performance detected.
       time:   [88.686 ns 88.779 ns 88.893 ns]
       change: [−0.6689% +0.3264% +1.2730%] (p = 0.55 > 0.05)

Found 14 outliers among 100 measurements (14.00%)
6 (6.00%) high mild
8 (8.00%) high severe

RxStreamOrderer::inbound_frame(): Change within noise threshold.
       time:   [107.19 ms 107.26 ms 107.32 ms]
       change: [−1.1590% −0.8504% −0.6581%] (p = 0.00 < 0.05)

Found 21 outliers among 100 measurements (21.00%)
11 (11.00%) low mild
9 (9.00%) high mild
1 (1.00%) high severe

sent::Packets::take_ranges: No change in performance detected.
       time:   [7.9993 µs 8.2155 µs 8.4208 µs]
       change: [−2.6334% +3.8419% +13.334%] (p = 0.43 > 0.05)

Found 22 outliers among 100 measurements (22.00%)
4 (4.00%) low severe
12 (12.00%) low mild
3 (3.00%) high mild
3 (3.00%) high severe

transfer/pacing-false/varying-seeds: No change in performance detected.
       time:   [37.414 ms 37.497 ms 37.580 ms]
       change: [−0.5382% −0.2241% +0.0868%] (p = 0.16 > 0.05)

Found 2 outliers among 100 measurements (2.00%)
1 (1.00%) low mild
1 (1.00%) high mild

transfer/pacing-true/varying-seeds: Change within noise threshold.
       time:   [37.975 ms 38.089 ms 38.205 ms]
       change: [−1.1393% −0.7486% −0.3411%] (p = 0.00 < 0.05)

Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild

transfer/pacing-false/same-seed: No change in performance detected.
       time:   [36.993 ms 37.081 ms 37.181 ms]
       change: [−0.3306% −0.0252% +0.2930%] (p = 0.88 > 0.05)

Found 5 outliers among 100 measurements (5.00%)
4 (4.00%) high mild
1 (1.00%) high severe

transfer/pacing-true/same-seed: No change in performance detected.
       time:   [38.835 ms 38.932 ms 39.034 ms]
       change: [−0.1587% +0.1892% +0.5474%] (p = 0.29 > 0.05)

Found 2 outliers among 100 measurements (2.00%)
1 (1.00%) high mild
1 (1.00%) high severe

Download data for profiler.firefox.com or download performance comparison data.

@larseggert
larseggert merged commit 2654211 into mozilla:main Aug 8, 2025
@larseggert
larseggert deleted the ci-gcp-fixes branch August 12, 2025 06:03
martinthomson pushed a commit to martinthomson/neqo that referenced this pull request Aug 21, 2025
github-merge-queue Bot pushed a commit that referenced this pull request Mar 13, 2026
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant