From patchwork Fri Oct 11 19:15:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 176028 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1171840ill; Fri, 11 Oct 2019 12:16:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMPbjupvOkwIpiq78yVQabN7pQ2qdlcdrPlGR6kDNyzCef6W9mfUKOWwGM42E8H/fnAbUH X-Received: by 2002:a17:906:520a:: with SMTP id g10mr15369455ejm.85.1570821385711; Fri, 11 Oct 2019 12:16:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570821385; cv=none; d=google.com; s=arc-20160816; b=cCGtVZrgtj91bzKZ/zxhCqH6od2HnadqqhwmrUxczSOtyS+GTNCeX2qgzxbijtVCn3 E/cltkRZJVvajaZgJGzknxF2DibQjAoHW6+6znFtjhsO/ObcBt++2ZnVl60z21nGki5R f3ft2xcL37WWqwpzvdrGtmPwecwGyRdOTZCYXeHj1H/Hljw61BRY+qgBXOqc7xD1NJCw HZ04fyt/SjXaexiNnRpEuvo1Dh8kOsrLDQNflhx+0sB0dH7Ic0QHfVees/bdvrSPgCxR D9YpvACaq3tmlPay2KhYkfZeo40UegLNzGu4TXv56j1cCEguqzC8FIzvNx4x0JRWNhUt 1BoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature:delivered-to :sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature; bh=DIkUAopx2giCnFW47p4R+6/ec4A8EJQ9AWGT/n+f598=; b=rDHn5BtZLjvmVY3HzPBpLloxZS8l3JgBp8crHLEN8kvgX15i6YNWoFYKzg4m1XVR7V kCvxT6OILdtLypUplSYICy07U45yEpq00MGQwoUfRE/9/o5lihv0ihfkz/z5EkzPIvKl TY3o/cQV+ZjnsMxsMyW2pSS6XLqRmkxnIO3d94jWNgN+cvayhWnZdsAHZYHDH/HyL9Hr fFEVpFIgcJfBJymbwnvtNHBcKljYT7/rnW+1GsWn0EpT94mltC09bY9FF3r90v2akboT PqJRUYsdBXa1TKqj7jrD8Qay8v0K28vHEEmth/cK8BdPBQkdpGMQhJOGULMpHYzXr6Ra 99Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=q6TKYP71; dkim=pass header.i=@linaro.org header.s=google header.b=XYDecINt; spf=pass (google.com: domain of libc-alpha-return-105882-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-105882-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id si6si5992656ejb.195.2019.10.11.12.16.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Oct 2019 12:16:25 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-105882-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=q6TKYP71; dkim=pass header.i=@linaro.org header.s=google header.b=XYDecINt; spf=pass (google.com: domain of libc-alpha-return-105882-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-105882-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; q=dns; s= default; b=qq3p9jVeQZY7SbKejucL2srHNidqkcLv6jP9Ry6j3LR6Qgr8Qnush JQycGpY6E6X230GIRaznBiIpcbcchkdka5bkwp+hu+SPoktxtK9SGjPIHYM6LPLB 1Z/kPkr0xCF0vkcFzINRAMIyaXqYuhrq2mObdVaJee+JCJIBwwen4U= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; s=default; bh=cKtj//WuHz9KtK1pgjxzxAVAgzU=; b=q6TKYP71SmCM9vM8fORqcOcvdSB2 Cq1Kb5mrfxbd4As09A5vC+tM9MoqTyWObh1ggmzSit1iLxHJt2r02eYV1x1jhau+ jU65PvNePxfFZ0byq59JqRtVxATv54nWSKw8VfW3A5TBXCL6dS/vXCMyQrTzTzTJ D4BuH/U+0LoOsUs= Received: (qmail 23289 invoked by alias); 11 Oct 2019 19:16:07 -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 23254 invoked by uid 89); 11 Oct 2019 19:16:04 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=1627, SPARC X-HELO: mail-qk1-f175.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=DIkUAopx2giCnFW47p4R+6/ec4A8EJQ9AWGT/n+f598=; b=XYDecINtmkAVDTwzZoR/p2ZbJd3VDAxAmwVowoeTnLWA2ImvRQPN0WBHyWPI7oEmTI fHsdwJ9tCaKc3u6v/SG6sLaibxD7hAxVxI9zkWxMcA69ovteUSfsvJ/1TuVpUbV8UVNz lq1ng/nAuw/jbfY+8aQvqm1yYpgJ4+Fw8zGnzxQvPZtf7twaaaF4V47qks61nRKzJ8uJ YWOUssKNBokvOZUMInDSdft3Wpd6mGovrzZ+AQ62/MRWQGMr1P3nD5LYQkGdG27Vf9OR 8t2mI2edbJt833JFvcJ73dGI5BCQwuljsL2kaU5Vt3UPu4yBKMkbinPAD38VKABltc9b OGwA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "Paul A . Clarke" Subject: [PATCH 1/3] ipc: Refactor sysvipc internal definitions Date: Fri, 11 Oct 2019 16:15:52 -0300 Message-Id: <20191011191554.10870-1-adhemerval.zanella@linaro.org> This patch refactor the internal sysvipc in two main points: 1. Add a new __ASSUME_SYSVIPC_DEFAULT_IPC_64 to infer the __IPC_64 value in wire-up or ipc syscall. The defaut value assumed for __IPC_64 is also changed from 0x100 to 0x0, aligning with Linux generic UAPI. The idea is to simplify the Linux 5.1 wire-up for sysvipc syscalls for some 32-bit ABIs (which expectes __IPC_64 being 0x0) and simplify new ports (which would not require add a ipc_priv.h to override the __IPC_64 value). 2. It removes some duplicated definition from sysvipc compat code at ipc_priv.h. The idea is also to make it simpler to enable the new wireup sysvipc on Linux v5.1. There is no semantic change expected on any port. Checked with a build against all affected ABIs. * sysdeps/unix/sysv/linux/ipc_priv.h (__OLD_IPC_ID_TYPE, __OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define. (__old_ipc_perm): Use the new defines. * sysdeps/unix/sysv/linux/alpha/ipc_priv.h (__OLD_IPC_ID_TYPE, __OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define. (__old_ipc_perm): Use the new defines. * sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h (__OLD_IPC_ID_TYPE, __OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define. (__old_ipc_perm): Use the new defines. * sysdeps/unix/sysv/linux/powerpc/ipc_priv.h (__OLD_IPC_ID_TYPE, __OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define. (__old_ipc_perm): Use the new defines. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Define. * sysdeps/unix/sysv/linux/alpha/kernel-features.h (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Undefine. * sysdeps/unix/sysv/linux/arm/kernel-features.h (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise. * sysdeps/unix/sysv/linux/mips/kernel-features.h (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise. * sysdeps/unix/sysv/linux/sparc/kernel-features.h [!__arch64__] (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise. * sysdeps/unix/sysv/linux/nios2/kernel-features.h: New file. * sysdeps/unix/sysv/linux/hppa/ipc_priv.h: Remove file. * sysdeps/unix/sysv/linux/ia64/ipc_priv.h: Likewise. * sysdeps/unix/sysv/linux/nios2/ipc_priv.h: Likewise. * sysdeps/unix/sysv/linux/csky/ipc_priv.h: Likewise. * sysdeps/unix/sysv/linux/riscv/ipc_priv.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/ipc_priv.h: Likewise. --- sysdeps/unix/sysv/linux/alpha/ipc_priv.h | 18 +++-------- .../unix/sysv/linux/alpha/kernel-features.h | 3 ++ sysdeps/unix/sysv/linux/arm/kernel-features.h | 2 ++ sysdeps/unix/sysv/linux/hppa/ipc_priv.h | 21 ------------ .../unix/sysv/linux/i386/kernel-features.h | 1 + sysdeps/unix/sysv/linux/ia64/ipc_priv.h | 21 ------------ sysdeps/unix/sysv/linux/ipc_priv.h | 31 +++++++++++++----- sysdeps/unix/sysv/linux/kernel-features.h | 3 ++ .../unix/sysv/linux/m68k/kernel-features.h | 1 + .../sysv/linux/microblaze/kernel-features.h | 1 + .../unix/sysv/linux/mips/kernel-features.h | 2 ++ .../unix/sysv/linux/mips/mips64/ipc_priv.h | 18 +++-------- sysdeps/unix/sysv/linux/nios2/ipc_priv.h | 21 ------------ .../ipc_priv.h => nios2/kernel-features.h} | 9 +++--- sysdeps/unix/sysv/linux/powerpc/ipc_priv.h | 28 +++------------- .../unix/sysv/linux/powerpc/kernel-features.h | 1 + sysdeps/unix/sysv/linux/riscv/ipc_priv.h | 21 ------------ .../unix/sysv/linux/s390/kernel-features.h | 1 + sysdeps/unix/sysv/linux/sh/kernel-features.h | 1 + .../unix/sysv/linux/sparc/kernel-features.h | 3 ++ .../unix/sysv/linux/sparc/sparc64/ipc_priv.h | 20 ++++-------- sysdeps/unix/sysv/linux/x86_64/ipc_priv.h | 32 ------------------- 22 files changed, 65 insertions(+), 194 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/hppa/ipc_priv.h delete mode 100644 sysdeps/unix/sysv/linux/ia64/ipc_priv.h delete mode 100644 sysdeps/unix/sysv/linux/nios2/ipc_priv.h rename sysdeps/unix/sysv/linux/{csky/ipc_priv.h => nios2/kernel-features.h} (75%) delete mode 100644 sysdeps/unix/sysv/linux/riscv/ipc_priv.h delete mode 100644 sysdeps/unix/sysv/linux/x86_64/ipc_priv.h -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h index 881d943063..0bf9da5694 100644 --- a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h +++ b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h @@ -16,17 +16,7 @@ License along with the GNU C Library; if not, see . */ -#include /* For __key_t */ - -#define __IPC_64 0x100 - -struct __old_ipc_perm -{ - __key_t __key; /* Key. */ - unsigned int uid; /* Owner's user ID. */ - unsigned int gid; /* Owner's group ID. */ - unsigned int cuid; /* Creator's user ID. */ - unsigned int cgid; /* Creator's group ID. */ - unsigned int mode; /* Read/write permission. */ - unsigned short int __seq; /* Sequence number. */ -}; +#define __OLD_IPC_ID_TYPE unsigned int +#define __OLD_IPC_MODE_TYPE unsigned int +#define __OLD_IPC_SEQ_TYPE unsigned short int +#include diff --git a/sysdeps/unix/sysv/linux/alpha/kernel-features.h b/sysdeps/unix/sysv/linux/alpha/kernel-features.h index 3928b4b62c..ac127adff7 100644 --- a/sysdeps/unix/sysv/linux/alpha/kernel-features.h +++ b/sysdeps/unix/sysv/linux/alpha/kernel-features.h @@ -52,4 +52,7 @@ # undef __ASSUME_STATX #endif +/* Alpha support old sysvipc even being a 64-bit architecture. */ +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 + #endif /* _KERNEL_FEATURES_H */ diff --git a/sysdeps/unix/sysv/linux/arm/kernel-features.h b/sysdeps/unix/sysv/linux/arm/kernel-features.h index 6b32970e2b..d66f3a4ab7 100644 --- a/sysdeps/unix/sysv/linux/arm/kernel-features.h +++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h @@ -54,3 +54,5 @@ #if __BYTE_ORDER == __BIG_ENDIAN # define __ASSUME_SYSVIPC_BROKEN_MODE_T #endif + +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 diff --git a/sysdeps/unix/sysv/linux/hppa/ipc_priv.h b/sysdeps/unix/sysv/linux/hppa/ipc_priv.h deleted file mode 100644 index a52e2c7b37..0000000000 --- a/sysdeps/unix/sysv/linux/hppa/ipc_priv.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Old SysV permission definition for Linux. Hppa version. - Copyright (C) 2017-2019 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 - . */ - -#include /* For __key_t */ - -#define __IPC_64 0x0 diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h index 8e982c41e6..33ba18e791 100644 --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h @@ -45,6 +45,7 @@ /* i686 only supports ipc syscall. */ #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 #undef __ASSUME_CLONE_DEFAULT #define __ASSUME_CLONE_BACKWARDS 1 diff --git a/sysdeps/unix/sysv/linux/ia64/ipc_priv.h b/sysdeps/unix/sysv/linux/ia64/ipc_priv.h deleted file mode 100644 index 29451a379a..0000000000 --- a/sysdeps/unix/sysv/linux/ia64/ipc_priv.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Old SysV permission definition for Linux. IA64 version. - Copyright (C) 2017-2019 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 - . */ - -#include /* For __key_t */ - -#define __IPC_64 0x0 diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h index deae555bfb..20c6873d94 100644 --- a/sysdeps/unix/sysv/linux/ipc_priv.h +++ b/sysdeps/unix/sysv/linux/ipc_priv.h @@ -17,18 +17,33 @@ . */ #include /* For __key_t */ - -#define __IPC_64 0x100 +#include + +#ifdef __ASSUME_SYSVIPC_DEFAULT_IPC_64 +# define __IPC_64 0x0 +#else +# define __IPC_64 0x100 +#endif + +#ifndef __OLD_IPC_ID_TYPE +# define __OLD_IPC_ID_TYPE unsigned short int +#endif +#ifndef __OLD_IPC_MODE_TYPE +# define __OLD_IPC_MODE_TYPE unsigned short int +#endif +#ifndef __OLD_IPC_SEQ_TYPE +# define __OLD_IPC_SEQ_TYPE unsigned short int +#endif struct __old_ipc_perm { __key_t __key; /* Key. */ - unsigned short int uid; /* Owner's user ID. */ - unsigned short int gid; /* Owner's group ID. */ - unsigned short int cuid; /* Creator's user ID. */ - unsigned short int cgid; /* Creator's group ID. */ - unsigned short int mode; /* Read/write permission. */ - unsigned short int __seq; /* Sequence number. */ + __OLD_IPC_ID_TYPE uid; /* Owner's user ID. */ + __OLD_IPC_ID_TYPE gid; /* Owner's group ID. */ + __OLD_IPC_ID_TYPE cuid; /* Creator's user ID. */ + __OLD_IPC_ID_TYPE cgid; /* Creator's group ID. */ + __OLD_IPC_MODE_TYPE mode; /* Read/write permission. */ + __OLD_IPC_SEQ_TYPE __seq; /* Sequence number. */ }; #define SEMCTL_ARG_ADDRESS(__arg) &__arg.array diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 7305686081..e6be76ff46 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -85,6 +85,9 @@ /* Support for SysV IPC through wired syscalls. All supported architectures either support ipc syscall and/or all the ipc correspondent syscalls. */ #define __ASSUME_DIRECT_SYSVIPC_SYSCALLS 1 +/* The generic default __IPC_64 value is 0x0, however some architectures + require a different value of 0x100. */ +#define __ASSUME_SYSVIPC_DEFAULT_IPC_64 1 /* All supported architectures reserve a 32-bit for MODE field in sysvipc ipc_perm. However, some kernel ABI interfaces still expect a 16-bit diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h index becc05d4dd..7ff9b5e28d 100644 --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h @@ -53,3 +53,4 @@ /* m68k only supports ipc syscall. */ #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS #define __ASSUME_SYSVIPC_BROKEN_MODE_T +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h index 19c77a42bd..2dd9810f93 100644 --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h @@ -72,3 +72,4 @@ #if __BYTE_ORDER == __BIG_ENDIAN # define __ASSUME_SYSVIPC_BROKEN_MODE_T #endif +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h index a284417253..7123b362ee 100644 --- a/sysdeps/unix/sysv/linux/mips/kernel-features.h +++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h @@ -50,3 +50,5 @@ #undef __ASSUME_CLONE_DEFAULT #define __ASSUME_CLONE_BACKWARDS 1 + +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 diff --git a/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h index 10d5c52dd0..459ee3d2e7 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h @@ -16,17 +16,7 @@ License along with the GNU C Library; if not, see . */ -#include - -#define __IPC_64 0x100 - -struct __old_ipc_perm -{ - __key_t __key; /* Key. */ - int uid; /* Owner's user ID. */ - int gid; /* Owner's group ID. */ - int cuid; /* Creator's user ID. */ - int cgid; /* Creator's group ID. */ - int mode; /* Read/write permission. */ - unsigned short int __seq; /* Sequence number. */ -}; +#define __OLD_IPC_ID_TYPE int +#define __OLD_IPC_MODE_TYPE int +#define __OLD_IPC_SEQ_TYPE unsigned short int +#include diff --git a/sysdeps/unix/sysv/linux/nios2/ipc_priv.h b/sysdeps/unix/sysv/linux/nios2/ipc_priv.h deleted file mode 100644 index 7e15313999..0000000000 --- a/sysdeps/unix/sysv/linux/nios2/ipc_priv.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Old SysV permission definition for Linux. Nios II version. - Copyright (C) 2017-2019 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 - . */ - -#include /* For __key_t */ - -#define __IPC_64 0x0 diff --git a/sysdeps/unix/sysv/linux/csky/ipc_priv.h b/sysdeps/unix/sysv/linux/nios2/kernel-features.h similarity index 75% rename from sysdeps/unix/sysv/linux/csky/ipc_priv.h rename to sysdeps/unix/sysv/linux/nios2/kernel-features.h index e8e8a256ea..c95e7051d9 100644 --- a/sysdeps/unix/sysv/linux/csky/ipc_priv.h +++ b/sysdeps/unix/sysv/linux/nios2/kernel-features.h @@ -1,5 +1,6 @@ -/* Old SysV permission definition for Linux. C-SKY version. - Copyright (C) 2017-2019 Free Software Foundation, Inc. +/* Set flags signalling availability of kernel features based on given + kernel version number. NIOS2 version. + Copyright (C) 2019 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 @@ -16,6 +17,6 @@ License along with the GNU C Library; if not, see . */ -#include /* For __key_t */ +#include_next -#define __IPC_64 0x0 +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 diff --git a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h index 96372bc9ad..a8ebf23cd2 100644 --- a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h +++ b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h @@ -16,27 +16,7 @@ License along with the GNU C Library; if not, see . */ -#include /* For __key_t */ - -#define __IPC_64 0x100 - -struct __old_ipc_perm -{ - __key_t __key; /* Key. */ - unsigned int uid; /* Owner's user ID. */ - unsigned int gid; /* Owner's group ID. */ - unsigned int cuid; /* Creator's user ID. */ - unsigned int cgid; /* Creator's group ID. */ - unsigned int mode; /* Read/write permission. */ - unsigned short int __seq; /* Sequence number. */ -}; - -#define SEMCTL_ARG_ADDRESS(__arg) &__arg.array - -#define MSGRCV_ARGS(__msgp, __msgtyp) \ - ((long int []){ (long int) __msgp, __msgtyp }) - -#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \ - (__nsops), 0, (__sops), (__timeout) - -#include +#define __OLD_IPC_ID_TYPE unsigned int +#define __OLD_IPC_MODE_TYPE unsigned int +#define __OLD_IPC_SEQ_TYPE unsigned short int +#include diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h index d177a91ab3..b93f7f8f13 100644 --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h @@ -46,6 +46,7 @@ /* powerpc only supports ipc syscall. */ #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 #undef __ASSUME_CLONE_DEFAULT #define __ASSUME_CLONE_BACKWARDS 1 diff --git a/sysdeps/unix/sysv/linux/riscv/ipc_priv.h b/sysdeps/unix/sysv/linux/riscv/ipc_priv.h deleted file mode 100644 index dd755a9f2c..0000000000 --- a/sysdeps/unix/sysv/linux/riscv/ipc_priv.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Old SysV permission definition for Linux. RISC-V version. - Copyright (C) 2018-2019 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 - . */ - -#include /* For __key_t */ - -#define __IPC_64 0x0 diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h index 6dca32c6c7..f1f8dad305 100644 --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h @@ -50,6 +50,7 @@ #ifndef __s390x__ # define __ASSUME_SYSVIPC_BROKEN_MODE_T #endif +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 #undef __ASSUME_CLONE_DEFAULT #define __ASSUME_CLONE_BACKWARDS2 diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h index fae54c8df5..dce9d41653 100644 --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h @@ -48,6 +48,7 @@ #if __BYTE_ORDER == __BIG_ENDIAN # define __ASSUME_SYSVIPC_BROKEN_MODE_T #endif +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 /* Support for several syscalls was added in 4.8. */ #if __LINUX_KERNEL_VERSION < 0x040800 diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h index c523461d95..25194117f6 100644 --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h @@ -60,6 +60,9 @@ /* sparc only supports ipc syscall. */ #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS +#ifndef __arch64__ +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 +#endif /* Support for the renameat2 syscall was added in 3.16. */ #if __LINUX_KERNEL_VERSION < 0x031000 diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h index 00f8510056..414755f15a 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h @@ -16,26 +16,18 @@ License along with the GNU C Library; if not, see . */ -#include /* For __key_t */ - -#define __IPC_64 0x0 - -struct __old_ipc_perm -{ - __key_t __key; /* Key. */ - unsigned int uid; /* Owner's user ID. */ - unsigned int gid; /* Owner's group ID. */ - unsigned int cuid; /* Creator's user ID. */ - unsigned int cgid; /* Creator's group ID. */ - unsigned int mode; /* Read/write permission. */ - unsigned short int __seq; /* Sequence number. */ -}; +#define __OLD_IPC_ID_TYPE unsigned int +#define __OLD_IPC_MODE_TYPE unsigned int +#define __OLD_IPC_SEQ_TYPE unsigned short int +#include /* SPARC semctl multiplex syscall expects the union pointed address, not the union address itself. */ +#undef SEMCTL_ARG_ADDRESS #define SEMCTL_ARG_ADDRESS(__arg) __arg.array /* Also for msgrcv it does not use the kludge on final 2 arguments. */ +#undef MSGRCV_ARGS #define MSGRCV_ARGS(__msgp, __msgtyp) __msgp, __msgtyp #define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \ diff --git a/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h b/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h deleted file mode 100644 index e89c9b56c5..0000000000 --- a/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Old SysV permission definition for Linux. x86_64 version. - Copyright (C) 2016-2019 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 - . */ - -#include /* For __key_t */ - -#define __IPC_64 0x0 - -struct __old_ipc_perm -{ - __key_t __key; /* Key. */ - unsigned short uid; /* Owner's user ID. */ - unsigned short gid; /* Owner's group ID. */ - unsigned short cuid; /* Creator's user ID. */ - unsigned short cgid; /* Creator's group ID. */ - unsigned short mode; /* Read/write permission. */ - unsigned short int __seq; /* Sequence number. */ -}; From patchwork Fri Oct 11 19:15:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 176027 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1171689ill; Fri, 11 Oct 2019 12:16:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqw8o10OT91vHZ3SJbeiwQCuUm30HshPt0JVJQEDcSuSKl7p2wbJV9fJAVfjvsf2NzbBHQdD X-Received: by 2002:a17:906:ce46:: with SMTP id se6mr15619725ejb.103.1570821376551; Fri, 11 Oct 2019 12:16:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570821376; cv=none; d=google.com; s=arc-20160816; b=nvKxkNq17Xhem4Yt66QukCpsr8RrEpyxhv/C9zZpnxSxrzypqJp+aaYAVTFpi7zNih 9Q69NrX0vOAcMr6q8/17Lxnx3QSZbbigujPji7yijfapSTGrnwbjZkuBD7HxULyMcsBy TNx9njeLWL6D4NuneaJm3k4dvRb+pO3xHFM/UKKC5oYgCqS/w+SBI1P0XUP5fqATo9RG gKmsqOmS3PP9WD4y9tc6AjLIQxmpTE7wGxyuuv/fP/T1zzT7KqdYujW+1g56FllxNSGf mcECMVuX6hwQlCFc3C30g4mjXqOgQdolncx9hNDIGZEF/2ytIhHKnqRRyajnBvQ266DK FMmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=Npi3AonLUAw/XPyH4gi//ZyctTSAs6KE8Zj2nE5RxmI=; b=ngQ4r0g+UGZScc6Ejw9o0oXxoSpnQsLAVxFsWcAWZ1H3+quWb3OOLKz0L7rIbTZAHD E5qFDTjeb8uFzGW8Nv8e1nf3+mknh3qD6o9mMhsn52/axpjYeh6r/EA1MeiUsotZfs60 Xn+M5GM3+eCGtJV1x0fN0qM2yyJkyyPb3QvsPunWgcjOSsZnvxTxCISjU3DStNT4wvnn f+2Gd6Ao/pVCe9Q3Aooik5d7V9KEWt6WTkF99Q1g/HX9FWhUxlRT6qOAs3ueBmMFsGNa /JU7YH4Fhb5snoBko39OC4iTzBBqGObvSWRUklhQb+XO2lgb7eW7iS6lf3L1901HN1om 0djg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=vPR9NX+N; dkim=pass header.i=@linaro.org header.s=google header.b=obhvBwmg; spf=pass (google.com: domain of libc-alpha-return-105881-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-105881-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id h4si6518183edd.189.2019.10.11.12.16.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Oct 2019 12:16:16 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-105881-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=vPR9NX+N; dkim=pass header.i=@linaro.org header.s=google header.b=obhvBwmg; spf=pass (google.com: domain of libc-alpha-return-105881-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-105881-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=InsB5HEsXbg4Rz+g3SauoG3Ps5bz5Ft vLd8k7zTLiZoifW8kx9PRyRWu0d35MxJSYLvtQaehC4UZ87ziW5tvusSnZy+WWJN NVRCaKFZlMhxf23/c8RNyFu3VusvIJbgFbcizWWoaQJ8YykYKKfmTAROYmYFkyy9 KMzQpazlmUcw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=ZCkvej6nZzcCUIx1IapYkWf2B58=; b=vPR9N X+NXnXU+lxXnp3BoGl9NzKh+7/uJwl3ghLZlrWQdOJDwGUVS4l6984T3quhtXpH8 08eykk+6ZaRJ0B1OWB6eFrgCeWs6uBOov0Ll/kkg9PusWmenf0juYjptn5+1TRNR 6+7K8+OIdXr5bPip9SuA9fCRPxXcxVbIny8mCA= Received: (qmail 23277 invoked by alias); 11 Oct 2019 19:16:07 -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 23250 invoked by uid 89); 11 Oct 2019 19:16:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:3101 X-HELO: mail-qk1-f195.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Npi3AonLUAw/XPyH4gi//ZyctTSAs6KE8Zj2nE5RxmI=; b=obhvBwmgWCpgj160P99/2TigXk15kt/GRU4vm4ZNrW11KccVIvMRd2wBelTBtmEkR6 MiC1tvWVj+mQ2W3ienJ0BQYnoE3LwC+Y3gEDVjYtkQeK7uNncNWObM08x8o2gsgBXGfI TeAdjKTvl5Nq46bdz4iQCmqSzmdz8XJzT3MrNKD+DDj4qlBa0YanUdtapstWMjgiEYzb AVt2J+fErBh4XSW+7xNmqL4Vlp9Wi/KsSyXQpKY570nrR1AprmvfXcR7VyLttqU8Hq1U cYyYrKP10XVcTWGT/HvTyHnp9Cy2LSQmAd5LfvB6vF1wqP97nYPasdqMOymN/0+PHzZ0 5a4A== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "Paul A . Clarke" Subject: [PATCH 2/3] sysvipc: Implement semop based on semtimedop Date: Fri, 11 Oct 2019 16:15:53 -0300 Message-Id: <20191011191554.10870-2-adhemerval.zanella@linaro.org> In-Reply-To: <20191011191554.10870-1-adhemerval.zanella@linaro.org> References: <20191011191554.10870-1-adhemerval.zanella@linaro.org> Besides semop being a subset of semtimedop, new 32-bit architectures on Linux are not expected to provide the syscall (only the 64-bit time semtimedop). Also, Linux 5.1 only wired-up semtimedop for the 64-bit architectures that missed it (powerpc, s390, and sparc). This simplifies the code to support it. Checked on x86_64-linux-gnu and i686-linux-gnu. * include/sys/sem.h: New file. * sysdeps/unix/sysv/linux/semop.c (semop): Call internal semtimedop. * sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Add internal alias. * sysvipc/semtimedop.c (semtimedop): Likewise. --- include/sys/sem.h | 11 ++++++++++- sysdeps/unix/sysv/linux/semop.c | 6 +----- sysdeps/unix/sysv/linux/semtimedop.c | 6 ++++-- sysvipc/semtimedop.c | 6 ++++-- 4 files changed, 19 insertions(+), 10 deletions(-) -- 2.17.1 diff --git a/include/sys/sem.h b/include/sys/sem.h index b0fb201bd0..bab548c3f7 100644 --- a/include/sys/sem.h +++ b/include/sys/sem.h @@ -1 +1,10 @@ -#include +#ifndef _SYS_SEM_H +# include + +# ifndef _ISOMAC + +__typeof__ (semtimedop) __semtimedop attribute_hidden; +libc_hidden_proto (__semtimedop) + +# endif +#endif diff --git a/sysdeps/unix/sysv/linux/semop.c b/sysdeps/unix/sysv/linux/semop.c index 687fdcb805..e111b9aa3d 100644 --- a/sysdeps/unix/sysv/linux/semop.c +++ b/sysdeps/unix/sysv/linux/semop.c @@ -26,9 +26,5 @@ int semop (int semid, struct sembuf *sops, size_t nsops) { -#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS - return INLINE_SYSCALL_CALL (semop, semid, sops, nsops); -#else - return INLINE_SYSCALL_CALL (ipc, IPCOP_semop, semid, nsops, 0, sops); -#endif + return __semtimedop (semid, sops, nsops, NULL); } diff --git a/sysdeps/unix/sysv/linux/semtimedop.c b/sysdeps/unix/sysv/linux/semtimedop.c index f34a7fb920..5f1b205c2b 100644 --- a/sysdeps/unix/sysv/linux/semtimedop.c +++ b/sysdeps/unix/sysv/linux/semtimedop.c @@ -24,8 +24,8 @@ /* Perform user-defined atomical operation of array of semaphores. */ int -semtimedop (int semid, struct sembuf *sops, size_t nsops, - const struct timespec *timeout) +__semtimedop (int semid, struct sembuf *sops, size_t nsops, + const struct timespec *timeout) { #ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS return INLINE_SYSCALL_CALL (semtimedop, semid, sops, nsops, timeout); @@ -34,3 +34,5 @@ semtimedop (int semid, struct sembuf *sops, size_t nsops, SEMTIMEDOP_IPC_ARGS (nsops, sops, timeout)); #endif } +weak_alias (__semtimedop, semtimedop) +libc_hidden_def (__semtimedop) diff --git a/sysvipc/semtimedop.c b/sysvipc/semtimedop.c index 5ca4d47ee3..68707d6ade 100644 --- a/sysvipc/semtimedop.c +++ b/sysvipc/semtimedop.c @@ -22,11 +22,13 @@ /* Perform user-defined atomical operation of array of semaphores. */ int -semtimedop (int semid, struct sembuf *sops, size_t nsops, - const struct timespec *timeout) +__semtimedop (int semid, struct sembuf *sops, size_t nsops, + const struct timespec *timeout) { __set_errno (ENOSYS); return -1; } +weak_alias (__semtimedop, semtimedop) +libc_hidden_def (__semtimedop) stub_warning (semtimedop) From patchwork Fri Oct 11 19:15:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 176029 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1172003ill; Fri, 11 Oct 2019 12:16:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwE2ezKZQV4PtxPvkKvdbU8Ep2NXUGVBJZ8rdZQS/gGbcH2lhofL1W1bSQDr2g0l7Z9P2Z X-Received: by 2002:a17:906:790:: with SMTP id l16mr16172957ejc.270.1570821394229; Fri, 11 Oct 2019 12:16:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570821394; cv=none; d=google.com; s=arc-20160816; b=CFHZxlbp2WdVQ6kWtAUTfRSPvsHHwtvxck5Xp1lxarh6m74cIRQl6ZQ30fVMbIiZ07 yhjbwv61aEKHXHANpuZO5eZsEu3sRdcj9r6EAjegC+YgCqUeXnz1pzRCrBQV1B2PFcnn dSd8vCV1DPmrK2+gzadQpc3UjBk3WwJB8pVZsopx5d7JBh19KwNKVJ+R2O6v0h5KsKox wqwoxtnJmenPQveqy+yKqGbO8gRemXPSe2U/FFiakod6Nd+IHMwg1rn9SNWzfAbGYFC3 nhjwGlfEWo39oGEc5gnpvQAgpg0LrnuNxHu2BXBxqs04DRP+PAzgkj6hAb1Thnli0dpc aURg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=OcX+PscacZDZajRqBXPyFfanh+gpwMR0zmyD+BsLDe0=; b=xQ5cfX7uKXiXJ0fRMzc/7FqtONt2C4sjFcUdzDGrlQsiwvDhpgDNZCyls8Q9RURoP4 xtOQECxltXQs8taw/cv7px8lMIZXw+0n7410FhldYwnvnGLVDYVL8xq1xMr8djMwy8yF v6SQcjKuFZ5Zngtz64zbO8raoDueJJ5uxN9Zm73SrcFxrNDj9CzSjFDYWcDVEkPjgusi NeCF5A+TFXp0jnBp1jWcBm2phx7eU/r8BFtJxrzU4n3iOvFOv46n1a5jjpI66tinNmK6 yanWDbsuHoYbZSAvAfD7WOKmuDGu+kUId+ut2JONkLSOd4ImGRUuHScAcOeUVP06rwsK cnPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=OMsZNo+L; dkim=pass header.i=@linaro.org header.s=google header.b=vZQgy9N2; spf=pass (google.com: domain of libc-alpha-return-105883-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-105883-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id g5si5881395ejp.350.2019.10.11.12.16.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Oct 2019 12:16:34 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-105883-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=OMsZNo+L; dkim=pass header.i=@linaro.org header.s=google header.b=vZQgy9N2; spf=pass (google.com: domain of libc-alpha-return-105883-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-105883-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=QR9BpC7nTgaTUZk8hKC6s6NcbiR+Gpn 0v+7X7StfK/x78fVqwNjnBO0Pc72bvhmKVVCKG+4RBrs85hz9C6i3oslnpu/Otqy 0ydxuX9Nqe+AOgVeqfZGFn6DU82ejPkbi6QyDiGchtzieAGMIvF/IpedDq7hNIWg 39HmdWER8UcI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=qa74+M+6m4PaDMjyUROb1/9KW1g=; b=OMsZN o+LwvlBgjz+Sb2duf13CU/h8vlAlt8qQ9nC/gNAZ4Ftc6+SuUTpC2wbRLMWhE1au LH6H38+km4f5gXEP7njVf6U44wXyMIKckgiWC8ze1BrF3psx7S/DgZwbYuS+ah1o U53enqb2Lp5NlMEbx1YVfzlaNJyR1cj34FsNb8= Received: (qmail 23318 invoked by alias); 11 Oct 2019 19:16:07 -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 23262 invoked by uid 89); 11 Oct 2019 19:16:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=ILP32 X-HELO: mail-qt1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OcX+PscacZDZajRqBXPyFfanh+gpwMR0zmyD+BsLDe0=; b=vZQgy9N2EXMVEgv422zqU6yEGhICzwy5shJ4KJN8qsuYyTedgCquoiDnEztugIJfzh Au6QBEK0wv2LwDjoVwFgE3ooTEW+errsATbmEvKHbiY2L7HHCGxtV9fwiQlrL14av00B HxdT3aPyaSIyTGl6UQlLPcby4ppvsEyrPnBajwYmxIehUvVmIayfDOZr7l3ErEnhQEn2 eI6zJmS3RT1ELfvn7Q6VnEGDlIXuu68cDwR+FdNy9IH4i8cv5Ar7UXWHfjf+20WeLkCy +CfdDtS+XO0omSfW1/ws8hPvHZ1cClqLGgOtC99D/Qdtnub0OOprganazRrGVZk1olEA Rg9g== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "Paul A . Clarke" Subject: [PATCH 3/3] Update sysvipc kernel-features.h files for Linux 5.1 Date: Fri, 11 Oct 2019 16:15:54 -0300 Message-Id: <20191011191554.10870-3-adhemerval.zanella@linaro.org> In-Reply-To: <20191011191554.10870-1-adhemerval.zanella@linaro.org> References: <20191011191554.10870-1-adhemerval.zanella@linaro.org> Linux 5.1 adds missing SySV IPC syscalls to the syscall table for remanining one that still uses the ipc syscall on glibc (m68k, mips-o32, powerpc, s390, sh, and sparc32). However the newly added direct ipc syscall are different than the old ones: 1. They do not expect IPC_64, meaning __IPC_64 should be set to zero when new syscalls are used. And new syscalls can not be used for compat functions like __old_semctl (to emulated old sysvipc it requires to use the old __NR_ipc syscall without __IPC_64). Thus IPC_64 is redefined for newer kernels on affected ABIs. 2. semtimedop and semop does not exist on 32-bit ABIs (only semtimedop_time64 is supplied). The provided syscall wrappers only uses the wire-up syscall if __NR_semtimedop and __NR_semop are also defined. Checked on x86_64-linux-gnu and i686-linux-gnu on both a 4.15 kernel configure with default options and sysvipc tests on a 5.1.2 kernel with --enable-kernel=5.1. I also checked the sysvipc tests on alpha, hppa, mips (32, 64, and n32), powerpc (32, 64, 64le), sparc (32, 64), and s390 (32, 64). * sysdeps/unix/sysv/linux/i386/kernel-features.h. (__ASSUME_DIRECT_SYSVIPC_SYSCALLS): Only undefine if [__LINUX_KERNEL_VERSION < 0x050100]. (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_DIRECT_SYSVIPC_SYSCALLS, __ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise. * sysdeps/unix/sysv/linux/mips/kernel-features.h (__ASSUME_DIRECT_SYSVIPC_SYSCALLS, __ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_DIRECT_SYSVIPC_SYSCALLS, __ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_DIRECT_SYSVIPC_SYSCALLS, __ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_DIRECT_SYSVIPC_SYSCALLS, __ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise. * sysdeps/unix/sysv/linux/sparc/kernel-features.h (__ASSUME_DIRECT_SYSVIPC_SYSCALLS, __ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise. * sysdeps/unix/sysv/linux/msgctl.c (__old_msgctl): Only use wire-up syscall if __ASSUME_SYSVIPC_DEFAULT_IPC_64 is not defined. * sysdeps/unix/sysv/linux/semctl.c (__old_semctl): Likewise. * sysdeps/unix/sysv/linux/shmctl.c (__old_shmctl): Likewise. * sysdeps/unix/sysv/linux/semop.c (semop): Only use wire-up if __NR_semop is also defined. * sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Likewise. --- sysdeps/unix/sysv/linux/i386/kernel-features.h | 8 +++++--- sysdeps/unix/sysv/linux/m68k/kernel-features.h | 8 +++++--- sysdeps/unix/sysv/linux/mips/kernel-features.h | 12 ++++++++---- sysdeps/unix/sysv/linux/msgctl.c | 6 +++++- sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 8 +++++--- sysdeps/unix/sysv/linux/s390/kernel-features.h | 8 +++++--- sysdeps/unix/sysv/linux/semctl.c | 6 +++++- sysdeps/unix/sysv/linux/semtimedop.c | 4 +++- sysdeps/unix/sysv/linux/sh/kernel-features.h | 8 +++++--- sysdeps/unix/sysv/linux/shmctl.c | 6 +++++- sysdeps/unix/sysv/linux/sparc/kernel-features.h | 10 ++++++---- 11 files changed, 57 insertions(+), 27 deletions(-) -- 2.17.1 Tested-by: Paul A. Clarke diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h index 33ba18e791..9db3b3a31c 100644 --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h @@ -43,9 +43,11 @@ # undef __ASSUME_SENDTO_SYSCALL #endif -/* i686 only supports ipc syscall. */ -#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS -#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 +/* i686 only supports ipc syscall before 5.1. */ +#if __LINUX_KERNEL_VERSION < 0x050100 +# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 +#endif #undef __ASSUME_CLONE_DEFAULT #define __ASSUME_CLONE_BACKWARDS 1 diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h index 7ff9b5e28d..76f90ff8b4 100644 --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h @@ -50,7 +50,9 @@ # undef __ASSUME_SET_ROBUST_LIST #endif -/* m68k only supports ipc syscall. */ -#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS +/* m68k only supports ipc syscall before 5.1. */ +#if __LINUX_KERNEL_VERSION < 0x050100 +# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 +#endif #define __ASSUME_SYSVIPC_BROKEN_MODE_T -#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h index 7123b362ee..ad5b1ace82 100644 --- a/sysdeps/unix/sysv/linux/mips/kernel-features.h +++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h @@ -31,8 +31,12 @@ pairs to start with an even-number register. */ #if _MIPS_SIM == _ABIO32 # define __ASSUME_ALIGNED_REGISTER_PAIRS 1 -/* mips32 only supports ipc syscall. */ -# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS +/* mips32 only supports ipc syscall before 5.1. */ +# if __LINUX_KERNEL_VERSION < 0x050100 +# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 +# else +# endif /* The o32 MIPS fadvise64 syscall behaves as fadvise64_64. */ # define __ASSUME_FADVISE64_AS_64_64 1 @@ -40,6 +44,8 @@ /* mips32 support wire-up network syscalls. */ # define __ASSUME_RECV_SYSCALL 1 # define __ASSUME_SEND_SYSCALL 1 +#else +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 #endif /* Define that mips64-n32 is a ILP32 ABI to set the correct interface to @@ -50,5 +56,3 @@ #undef __ASSUME_CLONE_DEFAULT #define __ASSUME_CLONE_BACKWARDS 1 - -#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c index 19d5ded19f..71b89c1153 100644 --- a/sysdeps/unix/sysv/linux/msgctl.c +++ b/sysdeps/unix/sysv/linux/msgctl.c @@ -111,7 +111,11 @@ int attribute_compat_text_section __old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf) { -#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS +#if defined __ASSUME_DIRECT_SYSVIPC_SYSCALLS \ + && !defined __ASSUME_SYSVIPC_DEFAULT_IPC_64 + /* For architecture that have wire-up msgctl but also have __IPC_64 to a + value different than default (0x0), it means the old syscall was done + using __NR_ipc. */ return INLINE_SYSCALL_CALL (msgctl, msqid, cmd, buf); #else return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd, 0, buf); diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h index b93f7f8f13..96a2c4b2aa 100644 --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h @@ -44,9 +44,11 @@ #include_next -/* powerpc only supports ipc syscall. */ -#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS -#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 +/* powerpc only supports ipc syscall before 5.1. */ +#if __LINUX_KERNEL_VERSION < 0x050100 +# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 +#endif #undef __ASSUME_CLONE_DEFAULT #define __ASSUME_CLONE_BACKWARDS 1 diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h index f1f8dad305..0fbd16ab85 100644 --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h @@ -45,12 +45,14 @@ # undef __ASSUME_SENDTO_SYSCALL #endif -/* s390 only supports ipc syscall. */ -#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS +/* s390 only supports ipc syscall before 5.1. */ +#if __LINUX_KERNEL_VERSION < 0x050100 +# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 +#endif #ifndef __s390x__ # define __ASSUME_SYSVIPC_BROKEN_MODE_T #endif -#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 #undef __ASSUME_CLONE_DEFAULT #define __ASSUME_CLONE_BACKWARDS2 diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c index e7f48e4093..9444515537 100644 --- a/sysdeps/unix/sysv/linux/semctl.c +++ b/sysdeps/unix/sysv/linux/semctl.c @@ -168,7 +168,11 @@ __old_semctl (int semid, int semnum, int cmd, ...) break; } -# ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS +#if defined __ASSUME_DIRECT_SYSVIPC_SYSCALLS \ + && !defined __ASSUME_SYSVIPC_DEFAULT_IPC_64 + /* For architecture that have wire-up semctl but also have __IPC_64 to a + value different than default (0x0), it means the old syscall was done + using __NR_ipc. */ return INLINE_SYSCALL_CALL (semctl, semid, semnum, cmd, arg.array); # else return INLINE_SYSCALL_CALL (ipc, IPCOP_semctl, semid, semnum, cmd, diff --git a/sysdeps/unix/sysv/linux/semtimedop.c b/sysdeps/unix/sysv/linux/semtimedop.c index 5f1b205c2b..eade9ec36a 100644 --- a/sysdeps/unix/sysv/linux/semtimedop.c +++ b/sysdeps/unix/sysv/linux/semtimedop.c @@ -27,7 +27,9 @@ int __semtimedop (int semid, struct sembuf *sops, size_t nsops, const struct timespec *timeout) { -#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS + /* semtimedop wire-up syscall is not exported for 32-bit ABIs (they have + semtimedop_time64 instead with uses a 64-bit time_t). */ +#if defined __ASSUME_DIRECT_SYSVIPC_SYSCALLS && defined __NR_semtimedop return INLINE_SYSCALL_CALL (semtimedop, semid, sops, nsops, timeout); #else return INLINE_SYSCALL_CALL (ipc, IPCOP_semtimedop, semid, diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h index dce9d41653..e9048a6474 100644 --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h @@ -43,12 +43,14 @@ before the offset. */ #define __ASSUME_PRW_DUMMY_ARG 1 -/* sh only supports ipc syscall. */ -#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS +/* sh only supports ipc syscall before 5.1. */ +#if __LINUX_KERNEL_VERSION < 0x050100 +# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 +#endif #if __BYTE_ORDER == __BIG_ENDIAN # define __ASSUME_SYSVIPC_BROKEN_MODE_T #endif -#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 /* Support for several syscalls was added in 4.8. */ #if __LINUX_KERNEL_VERSION < 0x040800 diff --git a/sysdeps/unix/sysv/linux/shmctl.c b/sysdeps/unix/sysv/linux/shmctl.c index 606c8dcd6b..c4b6d06360 100644 --- a/sysdeps/unix/sysv/linux/shmctl.c +++ b/sysdeps/unix/sysv/linux/shmctl.c @@ -111,7 +111,11 @@ int attribute_compat_text_section __old_shmctl (int shmid, int cmd, struct __old_shmid_ds *buf) { -#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS +#if defined __ASSUME_DIRECT_SYSVIPC_SYSCALLS \ + && !defined __ASSUME_SYSVIPC_DEFAULT_IPC_64 + /* For architecture that have wire-up shmctl but also have __IPC_64 to a + value different than default (0x0), it means the old syscall was done + using __NR_ipc. */ return INLINE_SYSCALL_CALL (shmctl, shmid, cmd, buf); #else return INLINE_SYSCALL_CALL (ipc, IPCOP_shmctl, shmid, cmd, 0, buf); diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h index 25194117f6..ea9a2a8212 100644 --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h @@ -58,10 +58,12 @@ # undef __NR_pause #endif -/* sparc only supports ipc syscall. */ -#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS -#ifndef __arch64__ -# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 +/* sparc only supports ipc syscall before 5.1. */ +#if __LINUX_KERNEL_VERSION < 0x050100 +# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS +# if !defined __arch64__ +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 +# endif #endif /* Support for the renameat2 syscall was added in 3.16. */