Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for post-quantum key exchange #2020

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

stormshield-gt
Copy link
Contributor

@stormshield-gt stormshield-gt commented Oct 28, 2024

This PR adds a test for post-quantum key exchange. For now the test is failing to demonstrate the presence of a bug (https://github.com/quinn-rs/quinn/actions/runs/11549717021/job/32143264498?pr=2020). I will then propose a fix.

Note that I added a commit that exposed the key exchange group, like this was done for cipher in #2001

With post-quantum, the key_share extension of the TLS client hello gets really big (1222 bytes) so the client hello gets fragmented into 2 separated CRYPTO frames, each one into its own QUIC packet. A padding frame is added to the second packet and all packets are inside the same UDP datagram thanks to GSO.

When the QUIC server endpoint tries to respond, it panics, giving this backtrace:

Backtrace
$ RUST_LOG=trace cargo t --test post_quantum -F rustls-aws-lc-rs
2024-10-28T16:13:03.084803Z TRACE quinn_proto::endpoint: initial_dcid=c128d5678dc1a983c71117a67cc3a83c9a8af3cc
2024-10-28T16:13:03.086083Z TRACE quinn_proto::connection: wrote 1459 Initial CRYPTO bytes
2024-10-28T16:13:03.086432Z TRACE drive{id=0}:send{space=Initial pn=0}: quinn_proto::connection: CRYPTO: off 0 len 1141
2024-10-28T16:13:03.086685Z TRACE drive{id=0}:send{space=Initial pn=1}: quinn_proto::connection: CRYPTO: off 1141 len 318
2024-10-28T16:13:03.086744Z TRACE drive{id=0}:send{space=Initial pn=1}: quinn_proto::connection::packet_builder: PADDING * 822
2024-10-28T16:13:03.086825Z TRACE drive{id=0}: quinn_proto::connection: sending 2400 bytes in 2 datagrams
2024-10-28T16:13:03.087735Z TRACE first recv:frame{ty=CRYPTO}: quinn_proto::connection: consumed 1141 CRYPTO bytes
2024-10-28T16:13:03.087831Z TRACE quinn_proto::endpoint: new connection id=0 icid=c128d5678dc1a983c71117a67cc3a83c9a8af3cc
2024-10-28T16:13:03.087866Z TRACE quinn_proto::connection: got Initial packet (1200 bytes) from 127.0.0.1:40544 using id c128d5678dc1a983c71117a67cc3a83c9a8af3cc
2024-10-28T16:13:03.087949Z TRACE recv{space=Initial pn=1}:frame{ty=CRYPTO}: quinn_proto::connection: consumed 318 CRYPTO bytes
2024-10-28T16:13:03.089617Z TRACE recv{space=Initial pn=1}: quinn_proto::connection: Handshake keys ready
2024-10-28T16:13:03.089653Z TRACE recv{space=Initial pn=1}: quinn_proto::connection: wrote 1178 Initial CRYPTO bytes
2024-10-28T16:13:03.089743Z TRACE recv{space=Initial pn=1}: quinn_proto::connection: Data keys ready
2024-10-28T16:13:03.089816Z TRACE recv{space=Initial pn=1}: quinn_proto::connection: wrote 629 Handshake CRYPTO bytes
2024-10-28T16:13:03.089891Z TRACE recv{space=Initial pn=1}: quinn_proto::connection: negotiated max idle timeout Some(30s)
2024-10-28T16:13:03.090142Z TRACE drive{id=0}:send{space=Initial pn=0}: quinn_proto::connection: ACK ArrayRangeSet([0..2]), Delay = 2994us
2024-10-28T16:13:03.090182Z TRACE drive{id=0}:send{space=Initial pn=0}: quinn_proto::connection: CRYPTO: off 0 len 1178
thread 'post_quantum_key_exchange' panicked at quinn-proto/src/connection/mod.rs:612:29:
attempt to subtract with overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'post_quantum_key_exchange' panicked at quinn/src/mutex.rs:140:42:
called `Result::unwrap()` on an `Err` value: PoisonError { .. }
stack backtrace:
   0:     0x55964c496ed5 - std::backtrace_rs::backtrace::libunwind::trace::h649ab3318d3445c5
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x55964c496ed5 - std::backtrace_rs::backtrace::trace_unsynchronized::hf4bb60c3387150c3
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55964c496ed5 - std::sys::backtrace::_print_fmt::hd9186c800e44bd00
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:65:5
   3:     0x55964c496ed5 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h1b9dad2a88e955ff
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:40:26
   4:     0x55964c4c149b - core::fmt::rt::Argument::fmt::h351a7824f737a6a0
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/fmt/rt.rs:173:76
   5:     0x55964c4c149b - core::fmt::write::h4b5a1270214bc4a7
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/fmt/mod.rs:1182:21
   6:     0x55964c49412f - std::io::Write::write_fmt::h9d1e399061051a36
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/io/mod.rs:1827:15
   7:     0x55964c4986f1 - std::sys::backtrace::BacktraceLock::print::h68d41b51481bce5c
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:43:9
   8:     0x55964c4986f1 - std::panicking::default_hook::{{closure}}::h96ab15e9936be7ed
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:269:22
   9:     0x55964c498298 - std::panicking::default_hook::h3cacb9c27561ad33
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:293:9
  10:     0x55964be07f5a - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hd212b1446b2b2077
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:2084:9
  11:     0x55964be07f5a - test::test_main::{{closure}}::hd15ff34f3f68988b
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/test/src/lib.rs:136:21
  12:     0x55964c498f8f - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hce7569f4ca5d1b64
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:2084:9
  13:     0x55964c498f8f - std::panicking::rust_panic_with_hook::hfe205f6954b2c97b
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:808:13
  14:     0x55964c498bb7 - std::panicking::begin_panic_handler::{{closure}}::h6cb44b3a50f28c44
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:674:13
  15:     0x55964c497399 - std::sys::backtrace::__rust_end_short_backtrace::hf1c1f2a92799bb0e
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:168:18
  16:     0x55964c498844 - rust_begin_unwind
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5
  17:     0x55964bb13c63 - core::panicking::panic_fmt::h3d8fc78294164da7
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:74:14
  18:     0x55964bb14216 - core::result::unwrap_failed::hfa79a499befff387
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/result.rs:1679:5
  19:     0x55964be1b908 - core::result::Result<T,E>::unwrap::h3a03305824402a95
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/result.rs:1102:23
  20:     0x55964be1b908 - quinn::mutex::non_tracking::Mutex<T>::lock::h5a3ffe2c7efa99f2
                               at /home/tudyg/dev/forks/quinn/quinn/src/mutex.rs:140:24
  21:     0x55964be1ad9f - <quinn::connection::ConnectionRef as core::ops::drop::Drop>::drop::h85d66a83169616f2
                               at /home/tudyg/dev/forks/quinn/quinn/src/connection.rs:914:26
  22:     0x55964be18037 - core::ptr::drop_in_place<quinn::connection::ConnectionRef>::h903086317e3ec0de
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ptr/mod.rs:542:1
  23:     0x55964be1816b - core::ptr::drop_in_place<quinn::connection::ConnectionDriver>::he18d84c6e5b990ec
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ptr/mod.rs:542:1
  24:     0x55964be25f49 - quinn::connection::Connecting::new::{{closure}}::hd7ca6ad91c5d2b5d
                               at /home/tudyg/dev/forks/quinn/quinn/src/connection.rs:66:44
  25:     0x55964be3888e - <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll::h0d54f7365cb38873
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-0.1.40/src/instrument.rs:321:9
  26:     0x55964be2d883 - <core::pin::Pin<P> as core::future::future::Future>::poll::h349a775ba3e2b504
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/future/future.rs:123:9
  27:     0x55964be13d03 - tokio::runtime::task::core::Core<T,S>::poll::{{closure}}::h03a0ac5d5472d09d
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/core.rs:331:17
  28:     0x55964be13a31 - tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut::h39f24f258b345515
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/loom/std/unsafe_cell.rs:16:9
  29:     0x55964be13a31 - tokio::runtime::task::core::Core<T,S>::poll::h38e0c8f944a17bfd
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/core.rs:320:13
  30:     0x55964be2e62e - tokio::runtime::task::harness::poll_future::{{closure}}::hd9339d76b0f2d190
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:500:19
  31:     0x55964be4ebc1 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hdbdd0cc27b5d6aae
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panic/unwind_safe.rs:272:9
  32:     0x55964be4c5f9 - std::panicking::try::do_call::hfe6d0b765e551ee7
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:557:40
  33:     0x55964be4c02b - __rust_try
  34:     0x55964be4bd66 - std::panicking::try::h362f8ee63ef28cd5
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:521:19
  35:     0x55964be4bd66 - std::panic::catch_unwind::hdfc2a9a2537bf3ab
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panic.rs:350:14
  36:     0x55964be2dc10 - tokio::runtime::task::harness::poll_future::h01e1d3dadb58e325
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:488:18
  37:     0x55964be2ef4e - tokio::runtime::task::harness::Harness<T,S>::poll_inner::hf921f035847d8008
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:209:27
  38:     0x55964be2f927 - tokio::runtime::task::harness::Harness<T,S>::poll::hc70cbd6c144e30da
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:154:15
  39:     0x55964be2341d - tokio::runtime::task::raw::poll::haf027befd97b8e4a
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/raw.rs:271:5
  40:     0x55964c42a167 - tokio::runtime::task::raw::RawTask::poll::hbc81b645ab862b6a
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/raw.rs:201:18
  41:     0x55964bb39791 - tokio::runtime::task::LocalNotified<S>::run::he81b8555de3848bf
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/mod.rs:436:9
  42:     0x55964bb2f0ea - tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}::h67355865ac7ff044
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/current_thread/mod.rs:737:25
  43:     0x55964bb2d219 - tokio::runtime::coop::with_budget::hcfe509cd221e2d2e
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/coop.rs:107:5
  44:     0x55964bb2d219 - tokio::runtime::coop::budget::h1157c24e8030ad37
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/coop.rs:73:5
  45:     0x55964bb2d219 - tokio::runtime::scheduler::current_thread::Context::run_task::{{closure}}::h8a187be17915fcab
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/current_thread/mod.rs:359:43
  46:     0x55964bb2c386 - tokio::runtime::scheduler::current_thread::Context::enter::h1a750fd5f5f51da5
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/current_thread/mod.rs:423:19
  47:     0x55964bb2d0b1 - tokio::runtime::scheduler::current_thread::Context::run_task::hcc705cdeebe3df4a
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/current_thread/mod.rs:359:23
  48:     0x55964bb2e6d9 - tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::h12c671faad368d04
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/current_thread/mod.rs:736:35
  49:     0x55964bb2dcfb - tokio::runtime::scheduler::current_thread::CoreGuard::enter::{{closure}}::h4d6182df91698347
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/current_thread/mod.rs:774:68
  50:     0x55964bb1cada - tokio::runtime::context::scoped::Scoped<T>::set::h3224de03dd35862b
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/context/scoped.rs:40:9
  51:     0x55964bb34b0a - tokio::runtime::context::set_scheduler::{{closure}}::he4ecebc37a0c497b
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/context.rs:180:26
  52:     0x55964bb3369a - std::thread::local::LocalKey<T>::try_with::h570bfd39fc9175f0
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/thread/local.rs:283:12
  53:     0x55964bb32ecc - std::thread::local::LocalKey<T>::with::h4ff1f162be03a846
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/thread/local.rs:260:9
  54:     0x55964bb34a51 - tokio::runtime::context::set_scheduler::hddffee65f0bb575c
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/context.rs:180:9
  55:     0x55964bb2da5e - tokio::runtime::scheduler::current_thread::CoreGuard::enter::h8ab569a2580ddb4c
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/current_thread/mod.rs:774:27
  56:     0x55964bb2ddd1 - tokio::runtime::scheduler::current_thread::CoreGuard::block_on::hc619ccb065e7ac06
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/current_thread/mod.rs:683:19
  57:     0x55964bb2b71d - tokio::runtime::scheduler::current_thread::CurrentThread::block_on::{{closure}}::h37be45487e23ae9d
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/current_thread/mod.rs:191:28
  58:     0x55964bb225e2 - tokio::runtime::context::runtime::enter_runtime::h6b03172742bcb0e2
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/context/runtime.rs:65:16
  59:     0x55964bb2aef7 - tokio::runtime::scheduler::current_thread::CurrentThread::block_on::h145cdf67039d50cc
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/current_thread/mod.rs:179:9
  60:     0x55964bb247bf - tokio::runtime::runtime::Runtime::block_on_inner::h777ffa61536f6544
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/runtime.rs:361:47
  61:     0x55964bb24931 - tokio::runtime::runtime::Runtime::block_on::h3482e1be9fb14261
                               at /home/tudyg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/runtime.rs:335:13
  62:     0x55964bb242b3 - post_quantum::post_quantum_key_exchange::h29479e385094357a
                               at /home/tudyg/dev/forks/quinn/quinn/tests/post_quantum.rs:62:5
  63:     0x55964bb16947 - post_quantum::post_quantum_key_exchange::{{closure}}::hf918d448d564f164
                               at /home/tudyg/dev/forks/quinn/quinn/tests/post_quantum.rs:18:41
  64:     0x55964bb31296 - core::ops::function::FnOnce::call_once::h1f16e787afaf06a5
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:250:5
  65:     0x55964be0c59b - core::ops::function::FnOnce::call_once::h81f56a195fe4862e
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:250:5
  66:     0x55964be0c59b - test::__rust_begin_short_backtrace::h919c79c8b896f9e2
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/test/src/lib.rs:624:18
  67:     0x55964be0be45 - test::run_test_in_process::{{closure}}::h7b3d5751c5b4dd75
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/test/src/lib.rs:647:60
  68:     0x55964be0be45 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hdabd61465e4dbd80
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panic/unwind_safe.rs:272:9
  69:     0x55964be0be45 - std::panicking::try::do_call::hc813c79fd64b0a90
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:557:40
  70:     0x55964be0be45 - std::panicking::try::h055c5de7e7bfc209
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:521:19
  71:     0x55964be0be45 - std::panic::catch_unwind::h4265d6525195c807
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panic.rs:350:14
  72:     0x55964be0be45 - test::run_test_in_process::he72c277a35f96567
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/test/src/lib.rs:647:27
  73:     0x55964be0be45 - test::run_test::{{closure}}::h974e632522c0fbcf
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/test/src/lib.rs:568:43
  74:     0x55964bdd3e34 - test::run_test::{{closure}}::hdc2c89ce8b601dda
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/test/src/lib.rs:598:41
  75:     0x55964bdd3e34 - std::sys::backtrace::__rust_begin_short_backtrace::h342cb8e53aeb2076
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:152:18
  76:     0x55964bdd7562 - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::h67b1b5c1709ad95b
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/thread/mod.rs:538:17
  77:     0x55964bdd7562 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hd8c7a030ea8b7676
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panic/unwind_safe.rs:272:9
  78:     0x55964bdd7562 - std::panicking::try::do_call::h512c2ab2c15b7d31
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:557:40
  79:     0x55964bdd7562 - std::panicking::try::h5c2903f8937bc868
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:521:19
  80:     0x55964bdd7562 - std::panic::catch_unwind::h242c80217c2dbece
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panic.rs:350:14
  81:     0x55964bdd7562 - std::thread::Builder::spawn_unchecked_::{{closure}}::h6cb4494ebdd8caf7
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/thread/mod.rs:537:30
  82:     0x55964bdd7562 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h42193b008049ba94
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:250:5
  83:     0x55964c49d2db - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha1963004222e7822
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:2070:9
  84:     0x55964c49d2db - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1086ced1f7c494c2
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:2070:9
  85:     0x55964c49d2db - std::sys::pal::unix::thread::Thread::new::thread_start::ha8af9c992ef0b208
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/pal/unix/thread.rs:108:17
  86:     0x7f8734fad609 - start_thread
                               at /build/glibc-LcI20x/glibc-2.31/nptl/pthread_create.c:477:8
  87:     0x7f8734d7d353 - clone
                               at /build/glibc-LcI20x/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
  88:                0x0 - <unknown>
thread 'post_quantum_key_exchange' panicked at library/core/src/panicking.rs:229:5:
panic in a destructor during cleanup
thread caused non-unwinding panic. aborting.
error: test failed, to rerun pass `-p quinn --test post_quantum`

@stormshield-gt stormshield-gt changed the title Fix poll transmit and min mtu Add test for post-quantum key exchange Oct 28, 2024
quinn-proto/src/crypto/rustls.rs Outdated Show resolved Hide resolved
quinn/tests/post_quantum.rs Outdated Show resolved Hide resolved
quinn/tests/post_quantum.rs Outdated Show resolved Hide resolved
quinn/tests/post_quantum.rs Outdated Show resolved Hide resolved
@stormshield-gt stormshield-gt force-pushed the fix-poll-transmit-and-min-mtu branch 2 times, most recently from a6cc784 to efb41ef Compare October 28, 2024 11:18
@Ralith
Copy link
Collaborator

Ralith commented Nov 4, 2024

#2027 gets this test passing.

@stormshield-gt stormshield-gt marked this pull request as ready for review November 4, 2024 16:57
@stormshield-gt
Copy link
Contributor Author

I've rebased and split into 2 tests, one for the substract with overflow error and one for the debug_assert

@stormshield-gt stormshield-gt force-pushed the fix-poll-transmit-and-min-mtu branch 3 times, most recently from d8de272 to 9bda11a Compare November 5, 2024 07:49
@stormshield-gt
Copy link
Contributor Author

The freebsd job seems to failed because cmake is not installed on the runner

quinn-proto/src/crypto/rustls.rs Show resolved Hide resolved
quinn/tests/post_quantum.rs Outdated Show resolved Hide resolved
quinn/tests/post_quantum.rs Outdated Show resolved Hide resolved
@djc
Copy link
Member

djc commented Nov 6, 2024

The freebsd job seems to failed because cmake is not installed on the runner

Why does this PR change the build requirements? Can you change the job to install cmake?

@stormshield-gt stormshield-gt force-pushed the fix-poll-transmit-and-min-mtu branch 3 times, most recently from 68e16a2 to cb5aec9 Compare November 6, 2024 16:37
@stormshield-gt
Copy link
Contributor Author

That's because rustls-post-quantum is not optional and unconditionally brings aws-lc-rs. Sadly, it's not possible to have an optional dev dependency currently in cargo.

I used a "private" feature hack to work around this, like they do, for instance, in the reqwest crate. Please let me know if you have a better solution.

@stormshield-gt
Copy link
Contributor Author

stormshield-gt commented Nov 8, 2024

I've discovered a new corner case with min_mtu of 1433,
with the current feature setup (that avoids compiling aws-lc-rs on freebsd and android), the command to test locally is

RUST_LOG=trace cargo t --test post_quantum -F __rustls-post-quantum-test -- --show-output

Edit:

Note that the MTU of the loopback must me changed locally to make this work (that's explain why the test pass in the CI)

sudo ifconfig lo mtu 1460

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.

4 participants