fix(udp): use libc::recvmmsg on Android x86 #1964
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://man7.org/linux/man-pages/man2/socketcall.2.html
Androids x86 even goes as far as automatically dispatching advanced socket calls (e.g.
socketorrecvmmsg) throughsocketcallin its Bionic libc:https://android.googlesource.com/platform/bionic/+/refs/tags/android-vts-14.0_r5/libc/SYSCALLS.TXT#19
In addition Android enables seccomp filtering since Android 8:
https://android-developers.googleblog.com/2017/07/seccomp-filter-in-android-o.html
Currently
quinn-udpcallsrecvmmsgdirectly on Android x86:quinn/quinn-udp/src/unix.rs
Lines 447 to 448 in c0b1e28
A direct
recvmmsgthroughlibc::syscall(libc::SYS_recvmmsgdoes not trigger the automatic Android x86 Bionic libc dispatch logic throughsocketcall, but instead calls the unimplementedrecvmmsgsyscall. Instead of triggering alibc::ENOSYS, seccomp disallows the call, thus leading to a panic of the application.This commit changes
quinn-udpto uselibc::recvmmsgon Android x86, thus leveraging Bionic's automatic dispatch ofrecvmmsgthroughsocketcall.Note that this commit only uses
libc::recvmmsgon Android x86, not any other Android or Linux variant. Thus quinn-udp would still support missinglibc::recvmmsgon those systems. See #1504.Fixes #1947.
Problem itself and fix reproducible on Firefox CI. See e.g. latest CI run
startup-x86.Still unable to reproduce via #1950. I assume this is due to still using a 64bit toolchain when testing
x86.//CC @link2xt following up on #1504, this might be of interest for you.