quinn icon indicating copy to clipboard operation
quinn copied to clipboard

`recvmmsg` is disallowed by seccomp on Android x86

Open mxinden opened this issue 1 year ago • 4 comments

What happened

We attempted switching Firefox Nightly to use quinn-udp for QUIC UDP I/O by default recently, though we had to roll back due to an error on Android x86. Investigating further, it seems like seccomp on Android x86 disallows sendmsg and recvmmsg. All details are in Bugzilla Bug 1910594 and 1910360.

Reasoning

Looking at e.g. Android 13's SYSCALLS.TXT we can see support for sendmsg and recvmmsg on 64bit (lp64) and ARM:

# sockets
// [...]
ssize_t       __sendmsg:sendmsg(int, const struct msghdr*, unsigned int)  arm,lp64
// [...]
int           __recvmmsg:recvmmsg(int, struct mmsghdr*, unsigned int, int, const struct timespec*)   arm,lp64

While on x86, only the indirect calls through socketcall are allowed:

# sockets for x86. These are done as an "indexed" call to socketcall syscall.
// [...]
int           __sendmsg:socketcall:16(int, const struct msghdr*, unsigned int)  x86
// [...]
int           __recvmmsg:socketcall:19(int, struct mmsghdr*, unsigned int, int, const struct timespec*)   x86

Potential Solution

libuv has faced the same issue (see https://github.com/libuv/libuv/issues/2923). On x86 they use the indirect syscalls through socketcall (see https://github.com/libuv/libuv/pull/2925).

Historical context

The above might be due to historical reasons:

On x86-32, socketcall() was historically the only entry point for the sockets API. However, starting in Linux 4.3, direct system calls are provided on x86-32 for the sockets API.

https://man7.org/linux/man-pages/man2/socketcall.2.html


I still have to investigate a bit before proposing a fix. Opening this issue early to track progress.

mxinden avatar Jul 31 '24 09:07 mxinden