glibc/glibc-rh1344830.patch

925 lines
30 KiB
Diff
Raw Normal View History

commit 8e03c512202576ddabbf352fd1413f8bff749e76
Author: Florian Weimer <fweimer@redhat.com>
Date: Sun Jun 12 20:58:50 2016 +0200
recvmsg, sendmsg, recvmmsg, sendmmsg: 2.24 ABI revert compatibility
GLIBC_2.24 compatibility versions are added to be able to run old
binaries, so that use of the GLIBC_2.24 symbol versions can be phased
out gradually.
It uses an endian-agnostic, word-size approach to sanitize the upper
bits of the affected struct members, using the old struct definitions
without padding.
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 35e1ed4..7c3b452 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -124,9 +124,10 @@ ifeq ($(subdir),socket)
sysdep_headers += net/if_ppp.h net/ppp-comp.h \
net/ppp_defs.h net/if_arp.h net/route.h net/ethernet.h \
net/if_slip.h net/if_packet.h net/if_shaper.h
-sysdep_routines += cmsg_nxthdr
+sysdep_routines += cmsg_nxthdr msgcompat
CFLAGS-recvmmsg.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-sendmmsg.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-msgcompat.c = -fexceptions -fasynchronous-unwind-tables
endif
ifeq ($(subdir),sunrpc)
diff --git a/sysdeps/unix/sysv/linux/aarch64/Versions b/sysdeps/unix/sysv/linux/aarch64/Versions
index 9bd87fe..ae3742c 100644
--- a/sysdeps/unix/sysv/linux/aarch64/Versions
+++ b/sysdeps/unix/sysv/linux/aarch64/Versions
@@ -5,6 +5,10 @@ ld {
}
}
libc {
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
+
GLIBC_PRIVATE {
__vdso_clock_gettime;
__vdso_clock_getres;
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index 9cdb623..3878891 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -2089,3 +2089,7 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmmsg F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmmsg F
+GLIBC_2.24 sendmsg F
diff --git a/sysdeps/unix/sysv/linux/alpha/Versions b/sysdeps/unix/sysv/linux/alpha/Versions
index 29b82f9..31abb22 100644
--- a/sysdeps/unix/sysv/linux/alpha/Versions
+++ b/sysdeps/unix/sysv/linux/alpha/Versions
@@ -85,6 +85,9 @@ libc {
#errlist-compat 140
_sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
}
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
GLIBC_PRIVATE {
__libc_alpha_cache_shape;
}
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index f3f3c70..5ce7e10 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2000,6 +2000,10 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmmsg F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/arm/libc.abilist b/sysdeps/unix/sysv/linux/arm/libc.abilist
index a93803d..9f8eecc 100644
--- a/sysdeps/unix/sysv/linux/arm/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/libc.abilist
@@ -90,6 +90,8 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.4 GLIBC_2.4 A
GLIBC_2.4 _Exit F
GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
diff --git a/sysdeps/unix/sysv/linux/hppa/Versions b/sysdeps/unix/sysv/linux/hppa/Versions
index b5098b2..f0af95e 100644
--- a/sysdeps/unix/sysv/linux/hppa/Versions
+++ b/sysdeps/unix/sysv/linux/hppa/Versions
@@ -35,4 +35,7 @@ libc {
GLIBC_2.19 {
fanotify_mark;
}
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
}
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index 58ed133..421b6fe 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -1854,6 +1854,8 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/i386/Versions b/sysdeps/unix/sysv/linux/i386/Versions
index f3544ac..64d503b 100644
--- a/sysdeps/unix/sysv/linux/i386/Versions
+++ b/sysdeps/unix/sysv/linux/i386/Versions
@@ -45,6 +45,9 @@ libc {
# f*
fallocate64;
}
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
GLIBC_PRIVATE {
__modify_ldt;
}
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index 61cbae0..b7fc26c 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -2012,6 +2012,8 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index d40d264..e0df2e3 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -1876,6 +1876,10 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmmsg F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/m68k/Versions b/sysdeps/unix/sysv/linux/m68k/Versions
index 7ecc96e..2dc2e83 100644
--- a/sysdeps/unix/sysv/linux/m68k/Versions
+++ b/sysdeps/unix/sysv/linux/m68k/Versions
@@ -40,6 +40,9 @@ libc {
GLIBC_2.12 {
__m68k_read_tp;
}
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
GLIBC_PRIVATE {
__vdso_atomic_cmpxchg_32; __vdso_atomic_barrier;
}
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index 64432ae..f80cdfe 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -91,6 +91,8 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.4 GLIBC_2.4 A
GLIBC_2.4 _Exit F
GLIBC_2.4 _IO_2_1_stderr_ D 0x98
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index 8086c38..9132c26 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -1968,6 +1968,8 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/microblaze/Versions b/sysdeps/unix/sysv/linux/microblaze/Versions
index aa48a3c..2e93b8a 100644
--- a/sysdeps/unix/sysv/linux/microblaze/Versions
+++ b/sysdeps/unix/sysv/linux/microblaze/Versions
@@ -2,4 +2,7 @@ libc {
GLIBC_2.18 {
fallocate64;
}
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
}
diff --git a/sysdeps/unix/sysv/linux/microblaze/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/libc.abilist
index 8c4c3bb..9443927 100644
--- a/sysdeps/unix/sysv/linux/microblaze/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/libc.abilist
@@ -2089,3 +2089,5 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/Versions b/sysdeps/unix/sysv/linux/mips/mips32/Versions
index 9621fb5..c4f38d8 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/Versions
+++ b/sysdeps/unix/sysv/linux/mips/mips32/Versions
@@ -3,4 +3,7 @@ libc {
getrlimit64;
setrlimit64;
}
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
}
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index db014ed..69386b2 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -1943,6 +1943,8 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index 33ac881..62ba3f9 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -1941,6 +1941,8 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/Versions b/sysdeps/unix/sysv/linux/mips/mips64/n32/Versions
index 9621fb5..c4f38d8 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/Versions
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/Versions
@@ -3,4 +3,7 @@ libc {
getrlimit64;
setrlimit64;
}
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
}
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index b8b2c0e..49b2ad7 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -1939,6 +1939,8 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/Versions b/sysdeps/unix/sysv/linux/mips/mips64/n64/Versions
new file mode 100644
index 0000000..517d79a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/Versions
@@ -0,0 +1,5 @@
+libc {
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
+}
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 0741301..445db92 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -1934,6 +1934,10 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmmsg F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/msgcompat.c b/sysdeps/unix/sysv/linux/msgcompat.c
new file mode 100644
index 0000000..a9e4f6c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/msgcompat.c
@@ -0,0 +1,254 @@
+/* Temporary compatibility to bridge 2.24 ABI revert.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifdef SHARED
+
+#include <sys/socket.h>
+#include <socketcall.h>
+#include <sysdep-cancel.h>
+#include <shlib-compat.h>
+
+ssize_t
+__libc_recvmsg_224 (int fd, struct msghdr *msg, int flags)
+{
+ ssize_t ret;
+
+ /* POSIX specifies that both msghdr::msg_iovlen and msghdr::msg_controllen
+ to be int and socklen_t respectively. However Linux defines it as
+ both size_t. So for 64-bit it requires some adjustments by copying to
+ temporary header and zeroing the pad fields. */
+ struct msghdr hdr, *orig = msg;
+ if (msg != NULL)
+ {
+ hdr = *msg;
+ hdr.msg_iovlen = (int) hdr.msg_iovlen;
+ hdr.msg_controllen = (socklen_t) hdr.msg_controllen;
+ msg = &hdr;
+ }
+
+# ifdef __ASSUME_RECVMSG_SYSCALL
+ ret = SYSCALL_CANCEL (recvmsg, fd, msg, flags);
+# else
+ ret = SOCKETCALL_CANCEL (recvmsg, fd, msg, flags);
+# endif
+
+ if (orig != NULL)
+ *orig = hdr;
+
+ return ret;
+}
+compat_symbol (libc, __libc_recvmsg_224, recvmsg, GLIBC_2_24);
+
+ssize_t
+__sendmsg_224 (int fd, const struct msghdr *msg, int flags)
+{
+ /* POSIX specifies that both msghdr::msg_iovlen and msghdr::msg_controllen
+ to be int and socklen_t respectively. However Linux defines it as
+ both size_t. So for 64-bit it requires some adjustments by copying to
+ temporary header and zeroing the pad fields. */
+ struct msghdr hdr;
+ if (msg != NULL)
+ {
+ hdr = *msg;
+ hdr.msg_iovlen = (int) hdr.msg_iovlen;
+ hdr.msg_controllen = (socklen_t) hdr.msg_controllen;
+ msg = &hdr;
+ }
+
+# ifdef __ASSUME_SENDMSG_SYSCALL
+ return SYSCALL_CANCEL (sendmsg, fd, msg, flags);
+# else
+ return SOCKETCALL_CANCEL (sendmsg, fd, msg, flags);
+# endif
+}
+compat_symbol (libc, __sendmsg_224, sendmsg, GLIBC_2_24);
+
+
+
+/* Do not use the sendmmsg syscall on socketcall architectures unless
+ it was added at the same time as the socketcall support or can be
+ assumed to be present. */
+# if defined __ASSUME_SOCKETCALL \
+ && !defined __ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL \
+ && !defined __ASSUME_SENDMMSG_SYSCALL
+# undef __NR_sendmmsg
+# endif
+
+# if __WORDSIZE == 64
+static inline int
+send_mmsghdr (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags)
+{
+ /* Emulate kernel interface for vlen size. */
+ if (vlen > IOV_MAX)
+ vlen = IOV_MAX;
+ if (vlen == 0)
+ return 0;
+ /* POSIX specifies that both msghdr::msg_iovlen and msghdr::msg_controllen
+ to be int and socklen_t respectively, however Linux defines it as both
+ size_t. So for 64-bit it requires some adjustments by copying to
+ temporary header and zeroing the pad fields.
+ The problem is sendmmsg's msghdr may points to an already-filled control
+ buffer and modifying it is not part of sendmmsg contract (the data may
+ be in ro map). So interact over the msghdr calling the sendmsg that
+ adjust the header using a temporary buffer. */
+ for (unsigned int i = 0; i < vlen; i++)
+ {
+ ssize_t ret = __sendmsg_224 (fd, &vmessages[i].msg_hdr, flags);
+ if (ret < 0)
+ return -1;
+ vmessages[i].msg_len = ret;
+ }
+ return 1;
+}
+# endif
+
+int
+__sendmmsg_224 (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags)
+{
+# if __WORDSIZE == 64
+ return send_mmsghdr (fd, vmessages, vlen, flags);
+# elif defined __NR_sendmmsg
+ return SYSCALL_CANCEL (sendmmsg, fd, vmessages, vlen, flags);
+# elif defined __NR_socketcall
+# ifdef __ASSUME_SENDMMSG_SOCKETCALL
+ return SOCKETCALL_CANCEL (sendmmsg, fd, vmessages, vlen, flags);
+# else
+ static int have_sendmmsg;
+ if (__glibc_likely (have_sendmmsg >= 0))
+ {
+# if __WORDSIZE == 64
+ int ret = send_mmsghdr (fd, vmessages, vlen, flags);
+# else
+ int ret = SOCKETCALL_CANCEL (sendmmsg, fd, vmessages, vlen, flags);
+# endif
+ /* The kernel returns -EINVAL for unknown socket operations.
+ We need to convert that error to an ENOSYS error. */
+ if (__builtin_expect (ret < 0, 0)
+ && have_sendmmsg == 0
+ && errno == EINVAL)
+ {
+ /* Try another call, this time with an invalid file
+ descriptor and all other parameters cleared. This call
+ will not cause any harm and it will return
+ immediately. */
+ ret = SOCKETCALL_CANCEL (invalid, -1);
+ if (errno == EINVAL)
+ {
+ have_sendmmsg = -1;
+ __set_errno (ENOSYS);
+ }
+ else
+ {
+ have_sendmmsg = 1;
+ __set_errno (EINVAL);
+ }
+ return -1;
+ }
+ return ret;
+ }
+ __set_errno (ENOSYS);
+ return -1;
+# endif /* __ASSUME_SENDMMSG_SOCKETCALL */
+# else /* defined __NR_socketcall */
+ __set_errno (ENOSYS);
+ return -1;
+# endif
+}
+compat_symbol (libc, __sendmmsg_224, sendmmsg, GLIBC_2_24);
+
+/* Do not use the recvmmsg syscall on socketcall architectures unless
+ it was added at the same time as the socketcall support or can be
+ assumed to be present. */
+# if defined __ASSUME_SOCKETCALL \
+ && !defined __ASSUME_RECVMMSG_SYSCALL_WITH_SOCKETCALL \
+ && !defined __ASSUME_RECVMMSG_SYSCALL
+# undef __NR_recvmmsg
+# endif
+
+static inline void
+adjust_mmsghdr (struct mmsghdr *vmessages, unsigned int vlen)
+{
+# if __WORDSIZE == 64
+ /* POSIX specifies that both msghdr::msg_iovlen and msghdr::msg_controllen
+ to be int and socklen_t respectively. However Linux defines it as
+ both size_t. So for 64-bit it requires some adjustments by zeroing
+ the pad fields. */
+ struct mmsghdr *vmhdr = vmessages;
+ for (unsigned int i = 0; i != 0; i--, vmhdr++)
+ {
+ vmhdr->msg_hdr.msg_iovlen = (int) vmhdr->msg_hdr.msg_iovlen;
+ vmhdr->msg_hdr.msg_controllen
+ = (socklen_t) vmhdr->msg_hdr.msg_controllen;
+ }
+# endif
+}
+
+int
+__recvmmsg_224 (int fd, struct mmsghdr *vmessages, unsigned int vlen,
+ int flags, struct timespec *tmo)
+{
+# ifdef __NR_recvmmsg
+ adjust_mmsghdr (vmessages, vlen);
+ return SYSCALL_CANCEL (recvmmsg, fd, vmessages, vlen, flags, tmo);
+# elif defined __NR_socketcall
+# ifdef __ASSUME_RECVMMSG_SOCKETCALL
+ adjust_mmsghdr (vmessages, vlen);
+ return SOCKETCALL_CANCEL (recvmmsg, fd, vmessages, vlen, flags, tmo);
+# else
+ static int have_recvmmsg;
+ if (__glibc_likely (have_recvmmsg >= 0))
+ {
+ adjust_mmsghdr (vmessages, vlen);
+ int ret = SOCKETCALL_CANCEL (recvmmsg, fd, vmessages, vlen, flags,
+ tmo);
+ /* The kernel returns -EINVAL for unknown socket operations.
+ We need to convert that error to an ENOSYS error. */
+ if (__builtin_expect (ret < 0, 0)
+ && have_recvmmsg == 0
+ && errno == EINVAL)
+ {
+ /* Try another call, this time with an invalid file
+ descriptor and all other parameters cleared. This call
+ will not cause any harm and it will return
+ immediately. */
+ ret = SOCKETCALL_CANCEL (invalid, -1);
+ if (errno == EINVAL)
+ {
+ have_recvmmsg = -1;
+ __set_errno (ENOSYS);
+ }
+ else
+ {
+ have_recvmmsg = 1;
+ __set_errno (EINVAL);
+ }
+ return -1;
+ }
+ return ret;
+ }
+ __set_errno (ENOSYS);
+ return -1;
+# endif /* __ASSUME_RECVMMSG_SOCKETCALL */
+# else
+ __set_errno (ENOSYS);
+ return -1;
+# endif
+}
+compat_symbol (libc, __recvmmsg_224, recvmmsg, GLIBC_2_24);
+
+#endif /* SHARED */
diff --git a/sysdeps/unix/sysv/linux/nios2/Versions b/sysdeps/unix/sysv/linux/nios2/Versions
index e42c85f..93458f5 100644
--- a/sysdeps/unix/sysv/linux/nios2/Versions
+++ b/sysdeps/unix/sysv/linux/nios2/Versions
@@ -3,4 +3,7 @@ libc {
_flush_cache;
cacheflush;
}
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
}
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index fa04825..d854b6d 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -2130,3 +2130,5 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F
diff --git a/sysdeps/unix/sysv/linux/powerpc/Versions b/sysdeps/unix/sysv/linux/powerpc/Versions
index 8ebeea1..ab0db57 100644
--- a/sysdeps/unix/sysv/linux/powerpc/Versions
+++ b/sysdeps/unix/sysv/linux/powerpc/Versions
@@ -5,6 +5,9 @@ ld {
}
}
libc {
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
GLIBC_PRIVATE {
__vdso_get_tbfreq;
__vdso_clock_gettime;
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index 3d633c0..bcb4bd1 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -1972,6 +1972,8 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index a6b164b..01f4957 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -1977,6 +1977,8 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions b/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions
index a8e88b8..53e5527 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions
@@ -22,6 +22,9 @@ libc {
GLIBC_2.17 {
__ppc_get_timebase_freq;
}
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
}
librt {
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
index 7200b76..8348670 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
@@ -2177,3 +2177,7 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmmsg F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmmsg F
+GLIBC_2.24 sendmsg F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
index de62ecb..3de5d61 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
@@ -91,6 +91,10 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmmsg F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 _Exit F
GLIBC_2.3 _IO_2_1_stderr_ D 0xe0
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Versions b/sysdeps/unix/sysv/linux/s390/s390-32/Versions
index 1c120e8..afcc3fe 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/Versions
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/Versions
@@ -49,6 +49,9 @@ libc {
GLIBC_2.11 {
fallocate64;
}
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
}
libutil {
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index 8da0bc0..761f340 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -1972,6 +1972,8 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/Versions b/sysdeps/unix/sysv/linux/s390/s390-64/Versions
index 3f4d960..fde5aee 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/Versions
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/Versions
@@ -4,6 +4,9 @@ libc {
__register_frame; __register_frame_table; __deregister_frame;
__frame_state_for; __register_frame_info_table;
}
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
}
librt {
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index 59066a9..b7f5371 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -1873,6 +1873,10 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmmsg F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/sh/Versions b/sysdeps/unix/sysv/linux/sh/Versions
index e0938c4..ae5a00e 100644
--- a/sysdeps/unix/sysv/linux/sh/Versions
+++ b/sysdeps/unix/sysv/linux/sh/Versions
@@ -30,4 +30,7 @@ libc {
GLIBC_2.16 {
fanotify_mark;
}
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
}
diff --git a/sysdeps/unix/sysv/linux/sh/libc.abilist b/sysdeps/unix/sysv/linux/sh/libc.abilist
index 01ca9e6..fb58c06 100644
--- a/sysdeps/unix/sysv/linux/sh/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/libc.abilist
@@ -1858,6 +1858,8 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/sparc/Versions b/sysdeps/unix/sysv/linux/sparc/Versions
index 4dc1cd7..adbdec5 100644
--- a/sysdeps/unix/sysv/linux/sparc/Versions
+++ b/sysdeps/unix/sysv/linux/sparc/Versions
@@ -29,6 +29,9 @@ libc {
__getshmlba;
}
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
}
libpthread {
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index 245c1c6..01260e2 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -1964,6 +1964,8 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/Versions b/sysdeps/unix/sysv/linux/sparc/sparc64/Versions
index fbea1bb..f950070 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/Versions
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/Versions
@@ -8,6 +8,9 @@ libc {
# w*
wordexp;
}
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
}
librt {
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index 4478d13..8884d4e 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -1902,6 +1902,10 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmmsg F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/tile/Versions b/sysdeps/unix/sysv/linux/tile/Versions
index 13da68f..a68e181 100644
--- a/sysdeps/unix/sysv/linux/tile/Versions
+++ b/sysdeps/unix/sysv/linux/tile/Versions
@@ -11,6 +11,9 @@ libc {
fallocate64;
set_dataplane;
}
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
GLIBC_PRIVATE {
__syscall_error;
__vdso_clock_gettime;
diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
index c1a2613..81eea08 100644
--- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
@@ -2096,3 +2096,5 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F
diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/Versions b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/Versions
new file mode 100644
index 0000000..517d79a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/Versions
@@ -0,0 +1,5 @@
+libc {
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
+}
diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
index 35fbf8a..9ce9b57 100644
--- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
@@ -2096,3 +2096,7 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmmsg F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmmsg F
+GLIBC_2.24 sendmsg F
diff --git a/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
index c1a2613..81eea08 100644
--- a/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
+++ b/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
@@ -2096,3 +2096,5 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/Versions b/sysdeps/unix/sysv/linux/x86_64/64/Versions
new file mode 100644
index 0000000..517d79a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/64/Versions
@@ -0,0 +1,5 @@
+libc {
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
+}
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index c1054ce..03549b1 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -1853,6 +1853,10 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmmsg F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmmsg F
+GLIBC_2.24 sendmsg F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/x86_64/Versions b/sysdeps/unix/sysv/linux/x86_64/Versions
index 2a7ed28..bbef7e0 100644
--- a/sysdeps/unix/sysv/linux/x86_64/Versions
+++ b/sysdeps/unix/sysv/linux/x86_64/Versions
@@ -6,6 +6,9 @@ libc {
modify_ldt;
}
+ GLIBC_2.24 {
+ recvmsg; sendmsg;
+ }
}
librt {
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 2fd6d60..86dab3f 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -2096,3 +2096,5 @@ GLIBC_2.23 fts64_read F
GLIBC_2.23 fts64_set F
GLIBC_2.24 GLIBC_2.24 A
GLIBC_2.24 quick_exit F
+GLIBC_2.24 recvmsg F
+GLIBC_2.24 sendmsg F