From patchwork Fri Mar 25 13:56:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 11516 Received: (qmail 107986 invoked by alias); 25 Mar 2016 13:57:15 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 107965 invoked by uid 89); 25 Mar 2016 13:57:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=358, 21, 9 X-HELO: mail-qg0-f43.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=YYG4YNuq05z3buc7eBMZQdW5vzdQcNQFx/QA59v7/1w=; b=WVhyWhjQhxnOVKnU7qQdq1zr/+v5C70cQ8Pv5q7llrBWxW94nLO0C9b23PygyZSuYc h+FxENqAaSS03J58kVBg3PHmknTkOneC5xM4UllxuU9U4t95SIABm9zbwaS58aoyISHp PdmFs2qXY64fk2pHdJPJAHwkSclthrlT586mIml7xhPfZqnUfuXVDYxvTbDgH451j19A 9FaRuqis1AS7Lrnr1g0KIF5Ip4Rlw6ZJodUraS/7lX7aJDB78KNe5Lb44GEYvL6jw1Qn zRRLhzlFqvsXbgFkMFLgRWTBqQWwbSrY7LHaasUCq6LGmuv9TpgClKW0QTUSOuor02jL dTxA== X-Gm-Message-State: AD7BkJIpgL+s3bVyzdhV+ZNR3vrjMm7V3BuJo0DSVntPs5hb9q715ohVqNk9uxq75kGNdCAK X-Received: by 10.140.33.229 with SMTP id j92mr7054945qgj.20.1458914223693; Fri, 25 Mar 2016 06:57:03 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 1/3] Adjust kernel-features.h defaults for recvmsg and sendmsg Date: Fri, 25 Mar 2016 10:56:52 -0300 Message-Id: <1458914214-16908-2-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1458914214-16908-1-git-send-email-adhemerval.zanella@linaro.org> References: <1458914214-16908-1-git-send-email-adhemerval.zanella@linaro.org> This patch removes the auto-generation for recvmsg and sendmsg syscall and adjust the kernel-features.h for all architectures supported on Linux. This patch follows the idea of 'Adjust kernel-features.h defaults for socket syscalls.' (35ade9f11b9007ee9683529f2d33698ff35255c8) by define __ASSUME_SENDMSG_SYSCALL and __ASSUME_RECVMSG_SYSCALL as supported by default and undefine it for the architecture that do not support it directly. The main rationale is to make is easier add code wrapper over the syscall to fix BZ#16919 (recvmsg standard compliance). Tested on x86_64, i686, aarch64, armhf, and powerpc64le. * sysdeps/unix/sysv/linux/alpha/syscalls.list (recvmsg): Remove from auto-generation. (sendmsg): Likewise. * sysdeps/unix/sysv/linux/arm/syscalls.list (recvmsg): Likewise. (sendmsg): Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list (recvmsg): Likewise. (sendmsg): Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list (recvmsg): Likewise. (sendmsg): Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list (recvmsg): Likewise. (sendmsg): Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list (recvmsg): Likewise. (sendmsg): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list (recvmsg): Likewise. (sendmsg): Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (recvmsg): Likewise. (sendmsg): Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMSG_SYSCALL): Remove. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMSG_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_SENDMSG_SYSCALL): Undefine. [__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_RECVMSG_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_SENDMSG_SYSCALL): Define. (__ASSUME_RECVMSG_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/m68k/kernel-features.h [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMSG_SYSCALL): Remove. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMSG_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_SENDMSG_SYSCALL): Undefine. [__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_RECVMSG_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMSG_SYSCALL): Remove. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMSG_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_SENDMSG_SYSCALL): Undefine. [__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_RECVMSG_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_SENDMSG_SYSCALL): Undefine. (__ASSUME_RECVMSG_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_SENDMSG_SYSCALL): Likewise. (__ASSUME_RECVMSG_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_SENDMSG_SYSCALL): Likewise. (__ASSUME_RECVMSG_SYSCALL): Likewise. --- ChangeLog | 60 ++++++++++++++++++++++ sysdeps/unix/sysv/linux/alpha/syscalls.list | 2 - sysdeps/unix/sysv/linux/arm/syscalls.list | 2 - sysdeps/unix/sysv/linux/generic/syscalls.list | 2 - sysdeps/unix/sysv/linux/hppa/syscalls.list | 2 - sysdeps/unix/sysv/linux/i386/kernel-features.h | 4 +- sysdeps/unix/sysv/linux/ia64/syscalls.list | 2 - sysdeps/unix/sysv/linux/kernel-features.h | 8 +++ sysdeps/unix/sysv/linux/m68k/kernel-features.h | 4 +- .../unix/sysv/linux/microblaze/kernel-features.h | 2 - sysdeps/unix/sysv/linux/mips/syscalls.list | 2 - sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 2 - sysdeps/unix/sysv/linux/s390/kernel-features.h | 4 +- sysdeps/unix/sysv/linux/sh/kernel-features.h | 2 - .../unix/sysv/linux/sparc/sparc64/syscalls.list | 2 - sysdeps/unix/sysv/linux/x86_64/syscalls.list | 2 - 16 files changed, 74 insertions(+), 28 deletions(-) diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list index cad1fc3..0c9efcb 100644 --- a/sysdeps/unix/sysv/linux/alpha/syscalls.list +++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list @@ -27,9 +27,7 @@ getsockopt - getsockopt i:iiiBN __getsockopt getsockopt listen - listen i:ii __listen listen recv - recv Ci:ibni __libc_recv __recv recv recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom -recvmsg - recvmsg Ci:ipi __libc_recvmsg __recvmsg recvmsg send - send Ci:ibni __libc_send __send send -sendmsg - sendmsg Ci:ipi __libc_sendmsg __sendmsg sendmsg sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto setsockopt - setsockopt i:iiibn __setsockopt setsockopt shutdown - shutdown i:ii __shutdown shutdown diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list index c06954f..82402b1 100644 --- a/sysdeps/unix/sysv/linux/arm/syscalls.list +++ b/sysdeps/unix/sysv/linux/arm/syscalls.list @@ -43,9 +43,7 @@ getsockopt - getsockopt i:iiiBN __getsockopt getsockopt listen - listen i:ii __listen listen recv - recv Ci:ibni __libc_recv __recv recv recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom -recvmsg - recvmsg Ci:ipi __libc_recvmsg __recvmsg recvmsg send - send Ci:ibni __libc_send __send send -sendmsg - sendmsg Ci:ipi __libc_sendmsg __sendmsg sendmsg sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto setsockopt - setsockopt i:iiibn __setsockopt setsockopt shutdown - shutdown i:ii __shutdown shutdown diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list index 4b2e747..5993ab4 100644 --- a/sysdeps/unix/sysv/linux/generic/syscalls.list +++ b/sysdeps/unix/sysv/linux/generic/syscalls.list @@ -28,5 +28,3 @@ recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom setsockopt - setsockopt i:iiibn __setsockopt setsockopt getsockopt - getsockopt i:iiiBN __getsockopt getsockopt shutdown - shutdown i:ii __shutdown shutdown -sendmsg - sendmsg Ci:ipi __libc_sendmsg __sendmsg sendmsg -recvmsg - recvmsg Ci:ipi __libc_recvmsg __recvmsg recvmsg diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list index d29c358..1f3dfb0 100644 --- a/sysdeps/unix/sysv/linux/hppa/syscalls.list +++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list @@ -24,9 +24,7 @@ getsockopt - getsockopt i:iiiBN __getsockopt getsockopt listen - listen i:ii __listen listen recv - recv Ci:ibni __libc_recv __recv recv recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom -recvmsg - recvmsg Ci:ipi __libc_recvmsg __recvmsg recvmsg send - send Ci:ibni __libc_send __send send -sendmsg - sendmsg Ci:ipi __libc_sendmsg __sendmsg sendmsg sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto setsockopt - setsockopt i:iiibn __setsockopt setsockopt shutdown - shutdown i:ii __shutdown shutdown diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h index 45054f8..148963c 100644 --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h @@ -40,10 +40,8 @@ # define __ASSUME_GETPEERNAME_SYSCALL 1 # define __ASSUME_SENDTO_SYSCALL 1 # define __ASSUME_SENDTO_FOR_SEND_SYSCALL 1 -# define __ASSUME_SENDMSG_SYSCALL 1 # define __ASSUME_RECVFROM_SYSCALL 1 # define __ASSUME_RECVFROM_FOR_RECV_SYSCALL 1 -# define __ASSUME_RECVMSG_SYSCALL 1 # define __ASSUME_SHUTDOWN_SYSCALL 1 #endif @@ -51,4 +49,6 @@ #if __LINUX_KERNEL_VERSION < 0x040300 # undef __ASSUME_ACCEPT4_SYSCALL +# undef __ASSUME_SENDMSG_SYSCALL +# undef __ASSUME_RECVMSG_SYSCALL #endif diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list index 8642bac..68b6c9a 100644 --- a/sysdeps/unix/sysv/linux/ia64/syscalls.list +++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list @@ -28,9 +28,7 @@ getsockopt - getsockopt i:iiiBN __getsockopt getsockopt listen - listen i:ii __listen listen recv - recv Ci:ibni __libc_recv __recv recv recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom -recvmsg - recvmsg Ci:ipi __libc_recvmsg __recvmsg recvmsg send - send Ci:ibni __libc_send __send send -sendmsg - sendmsg Ci:ipi __libc_sendmsg __sendmsg sendmsg sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto setsockopt - setsockopt i:iiibn __setsockopt setsockopt shutdown - shutdown i:ii __shutdown shutdown diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 5a1b204..3fba4151 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -145,3 +145,11 @@ # define __ASSUME_SENDMMSG_SYSCALL 1 # define __ASSUME_SENDMMSG 1 #endif + +/* Support for recvmsg and sendmsg was added in 2.6.12 in most architectures, + with some added later (for instance 2.6.37 for powerpc) and for some only + through syscall (with wire-up syscall added in later versionsi). Define + __ASSUME_RECVMSG_SYSCALL and __ASUME_SENDMSG_SYSCALL if glibc uses direct + syscall, otherwise glibc will use socketcall. */ +#define __ASSUME_SENDMSG_SYSCALL 1 +#define __ASSUME_RECVMSG_SYSCALL 1 diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h index 646bc4b..dec04f0 100644 --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h @@ -34,10 +34,8 @@ # define __ASSUME_GETPEERNAME_SYSCALL 1 # define __ASSUME_SENDTO_SYSCALL 1 # define __ASSUME_SENDTO_FOR_SEND_SYSCALL 1 -# define __ASSUME_SENDMSG_SYSCALL 1 # define __ASSUME_RECVFROM_SYSCALL 1 # define __ASSUME_RECVFROM_FOR_RECV_SYSCALL 1 -# define __ASSUME_RECVMSG_SYSCALL 1 # define __ASSUME_SHUTDOWN_SYSCALL 1 #endif @@ -47,6 +45,8 @@ # undef __ASSUME_ACCEPT4_SYSCALL # undef __ASSUME_RECVMMSG_SYSCALL # undef __ASSUME_SENDMMSG_SYSCALL +# undef __ASSUME_SENDMSG_SYSCALL +# undef __ASSUME_RECVMSG_SYSCALL #endif /* No support for PI futexes or robust mutexes before 3.10 for m68k. */ diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h index 3938989..db471ef 100644 --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h @@ -35,8 +35,6 @@ #define __ASSUME_SHUTDOWN_SYSCALL 1 #define __ASSUME_GETSOCKOPT_SYSCALL 1 #define __ASSUME_SETSOCKOPT_SYSCALL 1 -#define __ASSUME_SENDMSG_SYSCALL 1 -#define __ASSUME_RECVMSG_SYSCALL 1 /* Support for the accept4 and recvmmsg syscalls was added in 2.6.33. */ #define __ASSUME_RECVMMSG_SYSCALL_WITH_SOCKETCALL 1 diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list index db731b1..cd946a0 100644 --- a/sysdeps/unix/sysv/linux/mips/syscalls.list +++ b/sysdeps/unix/sysv/linux/mips/syscalls.list @@ -21,9 +21,7 @@ getsockopt - getsockopt i:iiiBN __getsockopt getsockopt listen - listen i:ii __listen listen recv - recv Ci:ibni __libc_recv __recv recv recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom -recvmsg - recvmsg Ci:ipi __libc_recvmsg __recvmsg recvmsg send - send Ci:ibni __libc_send __send send -sendmsg - sendmsg Ci:ipi __libc_sendmsg __sendmsg sendmsg sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto setsockopt - setsockopt i:iiibn __setsockopt setsockopt shutdown - shutdown i:ii __shutdown shutdown diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h index 171c030..5449f18 100644 --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h @@ -36,8 +36,6 @@ #define __ASSUME_SHUTDOWN_SYSCALL 1 #define __ASSUME_GETSOCKOPT_SYSCALL 1 #define __ASSUME_SETSOCKOPT_SYSCALL 1 -#define __ASSUME_SENDMSG_SYSCALL 1 -#define __ASSUME_RECVMSG_SYSCALL 1 /* The sendmmsg syscall was added for PowerPC in 3.0. */ #define __ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL 1 diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h index a6f131b..b3edee4 100644 --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h @@ -34,10 +34,8 @@ # define __ASSUME_GETPEERNAME_SYSCALL 1 # define __ASSUME_SENDTO_SYSCALL 1 # define __ASSUME_SENDTO_FOR_SEND_SYSCALL 1 -# define __ASSUME_SENDMSG_SYSCALL 1 # define __ASSUME_RECVFROM_SYSCALL 1 # define __ASSUME_RECVFROM_FOR_RECV_SYSCALL 1 -# define __ASSUME_RECVMSG_SYSCALL 1 # define __ASSUME_SHUTDOWN_SYSCALL 1 #endif @@ -47,4 +45,6 @@ # undef __ASSUME_ACCEPT4_SYSCALL # undef __ASSUME_RECVMMSG_SYSCALL # undef __ASSUME_SENDMMSG_SYSCALL +# undef __ASSUME_SENDMSG_SYSCALL +# undef __ASSUME_RECVMSG_SYSCALL #endif diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h index 9b4d1c2..ad05fc3 100644 --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h @@ -36,8 +36,6 @@ #define __ASSUME_SHUTDOWN_SYSCALL 1 #define __ASSUME_GETSOCKOPT_SYSCALL 1 #define __ASSUME_SETSOCKOPT_SYSCALL 1 -#define __ASSUME_SENDMSG_SYSCALL 1 -#define __ASSUME_RECVMSG_SYSCALL 1 /* The sendmmsg syscall was added for SH in 3.0. */ #define __ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL 1 diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list index 3d1c1da..eecd837 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list @@ -11,9 +11,7 @@ getsockopt - getsockopt 5 __getsockopt getsockopt listen - listen 2 __listen listen recv - recv C:4 __libc_recv __recv recv recvfrom - recvfrom C:6 __libc_recvfrom __recvfrom recvfrom -recvmsg - recvmsg C:3 __libc_recvmsg __recvmsg recvmsg send - send C:4 __libc_send __send send -sendmsg - sendmsg C:3 __libc_sendmsg __sendmsg sendmsg sendto - sendto C:6 __libc_sendto __sendto sendto setsockopt - setsockopt 5 __setsockopt setsockopt shutdown - shutdown 2 __shutdown shutdown diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list index 2e4135f..d09d101 100644 --- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list +++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list @@ -26,8 +26,6 @@ getsockname - getsockname i:ipp __getsockname getsockname getsockopt - getsockopt i:iiiBN __getsockopt getsockopt listen - listen i:ii __listen listen recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom -recvmsg - recvmsg Ci:ipi __libc_recvmsg __recvmsg recvmsg -sendmsg - sendmsg Ci:ipi __libc_sendmsg __sendmsg sendmsg sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto setsockopt - setsockopt i:iiibn __setsockopt setsockopt shutdown - shutdown i:ii __shutdown shutdown