From 287ea095f153e05fd0e45c34d4046cea4786f6fa Mon Sep 17 00:00:00 2001 From: Ondrej Sury Date: Thu, 13 Jan 2022 00:04:57 +0100 Subject: [PATCH] Disable udp recvmmsg support on systems with MUSL libc The Linux kernel diverts from the POSIX specification for two members of struct msghdr making them size_t sized (instead of int and socklen_t). In glibc, the developers have decided to use that. However, the MUSL developers used padding for the struct and kept the members defined according to the POSIX. This creates a problem, because libuv doesn't use recvmmsg() library call where the padding members are correctly zeroed and instead calls the syscall directly, the struct msghdr is passed to the kernel with enormous values in those two members (because of the random junk in the padding members) and the syscall thus fail with EMSGSIZE. Disable udp recvmmsg support on systems with MUSL libc until the libuv starts zeroing the struct msghdr before passing it to the syscall. --- configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index ce8117b15d..035a7d0cff 100644 --- a/configure.ac +++ b/configure.ac @@ -553,6 +553,8 @@ PKG_CHECK_MODULES([LIBUV], [libuv >= 1.0.0], [], # libuv recvmmsg support AC_CHECK_DECLS([UV_UDP_RECVMMSG, UV_UDP_MMSG_FREE, UV_UDP_MMSG_CHUNK], [], [], [[#include ]]) +AS_CASE([$host], + [*-musl],[AC_DEFINE([HAVE_DECL_UV_UDP_RECVMMSG], [0], [Disable recvmmsg support on systems with MUSL glibc])]) # [pairwise: --enable-doh --with-libnghttp2=auto, --enable-doh --with-libnghttp2=yes, --disable-doh] AC_ARG_ENABLE([doh],