-
-
Notifications
You must be signed in to change notification settings - Fork 431
[Crash]: quinn-udp-0.5.10 mod.rs:54:37: no control buffer space remaining #2155
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
Comments
Are you implying this is a regression in 0.5.10? |
I'm not sure if it's a regression, but it did happen in 0.5.10 per this line: thread 'tokio-runtime-worker' panicked at .cargo/registry/src/index.crates.io-6f17d22bba15001f/**quinn-udp-0.5.10/**src/cmsg/mod.rs:54:37 |
Yes, I'm asking: did you run your VPN software (what software is this?) with earlier versions of quinn-udp without running into this crash? |
This is indeed the first time I've encountered this crash. However, this isn't because earlier versions were crash-free and 0.5.10 suddenly introduced the issue. Rather, I've only just started using this library beginning with version 0.5.10 itself." The crash happened right at the moment when the VPN (still developing) was switched on. I managed to reproduce it several times, but it's not a 100% thing. |
And in my toml: quinn = { version = "0.11.6" } |
cc @mxinden |
It would be useful to test with 0.5.9 (and perhaps earlier versions that have the |
@JayZhao in addition to djc's ask above, can you also try to reproduce the issue with the following patch applied? diff --git a/quinn-udp/src/unix.rs b/quinn-udp/src/unix.rs
index c39941d5..26fcce2d 100644
--- a/quinn-udp/src/unix.rs
+++ b/quinn-udp/src/unix.rs
@@ -543,7 +543,7 @@ fn recv(io: SockRef<'_>, bufs: &mut [IoSliceMut<'_>], meta: &mut [RecvMeta]) ->
Ok(1)
}
-const CMSG_LEN: usize = 88;
+const CMSG_LEN: usize = 176;
fn prepare_msg(
transmit: &Transmit<'_>, |
@mxinden I failed to reproduce this crash even on 0.5.10 after several times, weird. I will try this patch too, thanks. |
This panic is from writing a cmsg buffer, which in theory we should be able to both manually compute and empirically test a worst-case for. |
As a complete newbee to Rust, I was wondering if you might consider replacing |
With the above in mind, I think an panic instead of returning an error is the way to go. |
Hey, guys, with the help of AI and some luck I may have found the source of this crash: Bug Report: Control Message Buffer Space Issue on macOS with apple_fast FeatureSummaryWhen using the ReproductionThis issue can be consistently reproduced on macOS when:
Root Cause AnalysisThe root cause is an API mismatch when handling control messages on macOS with
EvidenceLogging the structure sizes confirms the mismatch:
The error occurs when trying to get the next control message header after successfully adding the first one:
Only 16 bytes of the 88-byte buffer are used, confirming that this is not a true "out of space" issue:
Impact and Limitations
ConclusionThis issue is not a bug in macOS, but a fundamental API incompatibility when mixing Apple's private |
Also: /*
/*
|
Which parts of the remaining text can be trusted? Did you write and run the code to produce the evidence yourself? If
I'm not sure what you're trying to illustrate here. Please use code blocks. |
I am assuming you are referring to the code below: quinn/quinn-udp/src/cmsg/unix.rs Lines 45 to 46 in 8d6e48c
As far as I can tell, the cast to Thanks for the additional work @JayZhao. The use of AI for debugging is a great idea. That said, can you please try to confirm your hypothesis above without? |
I looked deeper into this later, the root of crash is this: When sending a packet using sendmsg_x, after adding the first control message (16 bytes) and there are still 88-16 = 72 bytes avaiable, you always trigger this bug: Then, "no control buffer space remaining" is reported while you still have 72 bytes in the buffer space and causing panic. I don't know low level networking much so I just disabled all control messages when using sendmsg_x and it worked fine. |
Not quite equivalent, since that's a macro that accesses fields by name, but AFAICT the types have the same layout up to those fields anyway, so yeah it should be fine in practice |
Happened when I switched my VPN on.
iOS 18.2
The text was updated successfully, but these errors were encountered: