-
-
Notifications
You must be signed in to change notification settings - Fork 431
quinn-udp: panic in CMsgHdr
decode
with fast-apple-datapath
on MacOS 10.15
#2214
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
I believe I found the root of this issue. We currently don't initialize (zeroize) the control message array before passing it to Line 509 in 8936cc0
While We then use quinn/quinn-udp/src/cmsg/unix.rs Lines 44 to 47 in 8936cc0
https://docs.rs/libc/latest/src/libc/unix/linux_like/linux/mod.rs.html#6021-6025 But in our case on MacOS 10.15 it does not seem to do it. I assume that MacOS 10.15 simply doesn't set the Thus on MacOS 10.15 we are seeing garbage values like the following:
Which can, depending on the concrete random values, then trigger the When we zero the control message array instead: - let mut ctrls = [cmsg::Aligned(MaybeUninit::<[u8; CMSG_LEN]>::uninit()); BATCH_SIZE];
+ let mut ctrls = [cmsg::Aligned([0u8; CMSG_LEN]); BATCH_SIZE];
https://docs.rs/libc/latest/src/libc/unix/linux_like/linux/mod.rs.html#6018-6020 In addition, we have our own safe-guard that will also filter it out: quinn/quinn-udp/src/cmsg/mod.rs Lines 116 to 124 in 8936cc0
Note that the Apple I will create a pull request in a bit. We might want to do the same on the other BSDs. |
`quinn-udp` with fast-apple-datapath previously did not initialize the control message array memory before passing it to `recvmsg_x`. On MacOS 10.15 `recvmsg_x` does not seem to set `msg_controllen`. Thus `CMSG_NXTHDR` reads beyond the control messages written by `recvmsg_x`, into the unitinialized memory region. With this commit, the control message array is initialized (with zeroes) before passing it to `recvmsg_x`, thus no longer reading unset control messages. See quinn-rs#2214 for details.
Documenting early findings thus far. Still debugging.
On Firefox's CI we see MacOS 10.15 failing the following
debug_assert_eq
.quinn/quinn-udp/src/cmsg/mod.rs
Lines 84 to 88 in 8936cc0
https://treeherder.mozilla.org/logviewer?job_id=505190482&repo=autoland&lineNumber=7087
//CC @larseggert
The text was updated successfully, but these errors were encountered: