unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/5] sysvipc: Fix compat msgctl
@ 2019-05-16 15:12 Adhemerval Zanella
  2019-05-16 15:12 ` [PATCH 2/5] sysvipc: Move __IPC_64 to kernel-features.h Adhemerval Zanella
                   ` (4 more replies)
  0 siblings, 5 replies; 23+ messages in thread
From: Adhemerval Zanella @ 2019-05-16 15:12 UTC (permalink / raw)
  To: libc-alpha

The __IPC64 flags is meant to be used to enable the new sysv struct
format when the architectures supports it (ARCH_WANT_IPC_PARSE_VERSION
config flag on Linux kernel).

This currently issue only affects alpha.

	* sysdeps/unix/sysv/linux/msgctl.c (__old_msgctl): Remove __IPC_64
	usage.
---
 sysdeps/unix/sysv/linux/msgctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c
index e4f78adda1..2d49567686 100644
--- a/sysdeps/unix/sysv/linux/msgctl.c
+++ b/sysdeps/unix/sysv/linux/msgctl.c
@@ -62,7 +62,7 @@ attribute_compat_text_section
 __old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf)
 {
 #ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
-  return INLINE_SYSCALL_CALL (msgctl, msqid, cmd | __IPC_64, buf);
+  return INLINE_SYSCALL_CALL (msgctl, msqid, cmd, buf);
 #else
   return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd, 0, buf);
 #endif
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 2/5] sysvipc: Move __IPC_64 to kernel-features.h
  2019-05-16 15:12 [PATCH 1/5] sysvipc: Fix compat msgctl Adhemerval Zanella
@ 2019-05-16 15:12 ` Adhemerval Zanella
  2019-05-16 15:38   ` Andreas Schwab
  2019-05-16 15:12 ` [PATCH 3/5] sysvipc: Consolidate semtimedop s390 Adhemerval Zanella
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 23+ messages in thread
From: Adhemerval Zanella @ 2019-05-16 15:12 UTC (permalink / raw)
  To: libc-alpha

This patch moves the __IPC_64 definition from ipc_priv.h header to
kernel-features.h.  It also changes the expected value for newer ports
from 0x100 to 0x0, aligning with Linux UAPI.  The idea is to simplify
the Linux 5.1 wire-up of sysvipc syscalls for some 32-bit ABI, which
expected __IPC_64 to be 0x0 (thus tying its value to minimum supported
kernel version).

There is no semantic change expected on any port.  Checked with a build
against all affected ABIs.

	* sysdeps/unix/sysv/linux/alpha/ipc_priv.h (__IPC_64): Remove
	definition.
	* sysdeps/unix/sysv/linux/ipc_priv.h (__IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h (__IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/ipc_priv.h (__IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h (__IPC_64):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/ipc_priv.h (__IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/csky/ipc_priv.h: Remove file.
	* sysdeps/unix/sysv/linux/hppa/ipc_priv.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/ipc_priv.h: Likewise.
	* sysdeps/unix/sysv/linux/nios2/ipc_priv.h: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/ipc_priv.h: Likewise.
	* sysdeps/unix/sysv/linux/riscv/ipc_priv.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/kernel-features.h (__IPC_64): Define.
	* sysdeps/unix/sysv/linux/arm/kernel-features.h (__IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/i386/kernel-features.h (__IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/kernel-features.h (__IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h (__IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__IPC_64):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__IPC_64):
	Likewise.
	* sysdeep/unix/sysv/linux/mips/kernel-features.h (__IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/s390/kernel-features.h (__IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/sh/kernel-features.h (__IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/nios2/kernel-features.h: New file.
	* sysdeps/unix/sysv/linux/sparc/kernel-features.h [!__arch64__]
	(__IPC_64): Define.
---
 sysdeps/unix/sysv/linux/alpha/ipc_priv.h      |  2 --
 .../unix/sysv/linux/alpha/kernel-features.h   |  4 ++++
 sysdeps/unix/sysv/linux/arm/kernel-features.h |  8 +++++++
 sysdeps/unix/sysv/linux/csky/ipc_priv.h       | 21 -------------------
 sysdeps/unix/sysv/linux/hppa/ipc_priv.h       | 21 -------------------
 .../unix/sysv/linux/i386/kernel-features.h    |  7 +++++++
 sysdeps/unix/sysv/linux/ia64/ipc_priv.h       | 21 -------------------
 sysdeps/unix/sysv/linux/ipc_priv.h            |  2 --
 sysdeps/unix/sysv/linux/kernel-features.h     |  1 +
 .../unix/sysv/linux/m68k/kernel-features.h    |  8 +++++++
 .../sysv/linux/microblaze/kernel-features.h   |  7 +++++++
 .../unix/sysv/linux/mips/kernel-features.h    |  8 +++++++
 .../unix/sysv/linux/mips/mips64/ipc_priv.h    |  2 --
 sysdeps/unix/sysv/linux/nios2/ipc_priv.h      | 21 -------------------
 .../ipc_priv.h => nios2/kernel-features.h}    | 17 ++++++++++-----
 sysdeps/unix/sysv/linux/powerpc/ipc_priv.h    |  2 --
 .../unix/sysv/linux/powerpc/kernel-features.h |  8 +++++++
 sysdeps/unix/sysv/linux/riscv/ipc_priv.h      | 21 -------------------
 .../unix/sysv/linux/s390/kernel-features.h    |  8 +++++++
 sysdeps/unix/sysv/linux/sh/kernel-features.h  |  3 +++
 .../unix/sysv/linux/sparc/kernel-features.h   |  9 ++++++++
 .../unix/sysv/linux/sparc/sparc64/ipc_priv.h  |  2 --
 sysdeps/unix/sysv/linux/x86_64/ipc_priv.h     |  2 --
 23 files changed, 83 insertions(+), 122 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/csky/ipc_priv.h
 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/{aarch64/ipc_priv.h => nios2/kernel-features.h} (62%)
 delete mode 100644 sysdeps/unix/sysv/linux/riscv/ipc_priv.h

diff --git a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
index fc5e713f42..8b91e2f9fa 100644
--- a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
@@ -18,8 +18,6 @@
 
 #include <sys/ipc.h>  /* For __key_t  */
 
-#define __IPC_64	0x100
-
 struct __old_ipc_perm
 {
   __key_t __key;		/* Key.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/kernel-features.h b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
index f3298b234e..00f7d44df0 100644
--- a/sysdeps/unix/sysv/linux/alpha/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
@@ -22,6 +22,10 @@
 
 #include_next <kernel-features.h>
 
+/* Alpha support old sysvipc even being a 64-bit architecture.  */
+#undef __IPC_64
+#define __IPC_64              0x100
+
 /* There never has been support for fstat64.  */
 #undef __ASSUME_STATFS64
 #define __ASSUME_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/arm/kernel-features.h b/sysdeps/unix/sysv/linux/arm/kernel-features.h
index 2d2d355844..4f5c621f82 100644
--- a/sysdeps/unix/sysv/linux/arm/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h
@@ -17,6 +17,9 @@
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _KERNEL_FEATURES_H
+#define _KERNEL_FEATURES_H 1
+
 #include_next <kernel-features.h>
 
 /* The ARM kernel before 3.14.3 may or may not support
@@ -50,3 +53,8 @@
 
 #undef __ASSUME_CLONE_DEFAULT
 #define __ASSUME_CLONE_BACKWARDS	1
+
+#undef __IPC_64
+#define __IPC_64			0x100
+
+#endif /* _KERNEL_FEATURE_H  */
diff --git a/sysdeps/unix/sysv/linux/csky/ipc_priv.h b/sysdeps/unix/sysv/linux/csky/ipc_priv.h
deleted file mode 100644
index e1beadb2a0..0000000000
--- a/sysdeps/unix/sysv/linux/csky/ipc_priv.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Old SysV permission definition for Linux.  C-SKY 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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sys/ipc.h>  /* For __key_t  */
-
-#define __IPC_64	0x0
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 5e170a9a2b..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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sys/ipc.h>  /* 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 3ac725b5a2..5a26328d97 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -17,6 +17,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _KERNEL_FEATURES_H
+#define _KERNEL_FEATURES_H 1
+
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
@@ -45,6 +48,10 @@
 
 /* i686 only supports ipc syscall.  */
 #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+#undef __IPC_64
+#define __IPC_64                        0x100
 
 #undef __ASSUME_CLONE_DEFAULT
 #define __ASSUME_CLONE_BACKWARDS	1
+
+#endif /* _KERNEL_FEATURES_H  */
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 6b2438cd03..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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sys/ipc.h>  /* 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 7f517eb6fd..65adbb093e 100644
--- a/sysdeps/unix/sysv/linux/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/ipc_priv.h
@@ -18,8 +18,6 @@
 
 #include <sys/ipc.h>  /* For __key_t  */
 
-#define __IPC_64	0x100
-
 struct __old_ipc_perm
 {
   __key_t __key;			/* Key.  */
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index bc5c959f58..8fb6078de5 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -80,6 +80,7 @@
 /* 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
+#define __IPC_64				0x0
 
 /* Support for p{read,write}v2 was added in 4.6.  However Linux default
    implementation does not assume the __ASSUME_* and instead use a fallback
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 1976724362..8e81bb98ef 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -17,6 +17,9 @@
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _KERNEL_FEATURES_H
+#define _KERNEL_FEATURES_H 1
+
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
@@ -52,3 +55,8 @@
 
 /* m68k only supports ipc syscall.  */
 #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+
+#undef __IPC_64
+#define __IPC_64                        0x100
+
+#endif /* _KERNEL_FEATURES_H  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index 8df19400af..84b813d6ab 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -15,6 +15,8 @@
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _KERNEL_FEATURES_H
+#define _KERNEL_FEATURES_H 1
 
 /* All supported kernel versions for MicroBlaze have these syscalls.  */
 #define __ASSUME_SOCKET_SYSCALL		1
@@ -72,3 +74,8 @@
 
 #undef __ASSUME_CLONE_DEFAULT
 #define __ASSUME_CLONE_BACKWARDS3
+
+#undef __IPC_64
+#define __IPC_64                        0x100
+
+#endif /* _KERNEL_FEATURES_H  */
diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h
index c341c3fa10..d90d87a5b0 100644
--- a/sysdeps/unix/sysv/linux/mips/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h
@@ -17,6 +17,9 @@
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _KERNEL_FEATURES_H
+#define _KERNEL_FEATURES_H 1
+
 #include <sgidefs.h>
 
 #include_next <kernel-features.h>
@@ -27,6 +30,9 @@
 # undef __ASSUME_SET_ROBUST_LIST
 #endif
 
+#undef __IPC_64
+#define __IPC_64                        0x100
+
 /* Define this if your 32-bit syscall API requires 64-bit register
    pairs to start with an even-number register.  */
 #if _MIPS_SIM == _ABIO32
@@ -50,3 +56,5 @@
 
 #undef __ASSUME_CLONE_DEFAULT
 #define __ASSUME_CLONE_BACKWARDS	1
+
+#endif /* _KERNEL_FEATURES_H  */
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
index bb31656069..ab5db79e25 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
@@ -18,8 +18,6 @@
 
 #include <sys/ipc.h>
 
-#define __IPC_64	0x100
-
 struct __old_ipc_perm
 {
   __key_t __key;		/* Key.  */
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 d6e6be797a..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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sys/ipc.h>  /* For __key_t  */
-
-#define __IPC_64	0x0
diff --git a/sysdeps/unix/sysv/linux/aarch64/ipc_priv.h b/sysdeps/unix/sysv/linux/nios2/kernel-features.h
similarity index 62%
rename from sysdeps/unix/sysv/linux/aarch64/ipc_priv.h
rename to sysdeps/unix/sysv/linux/nios2/kernel-features.h
index cf55907693..813177f7b7 100644
--- a/sysdeps/unix/sysv/linux/aarch64/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/nios2/kernel-features.h
@@ -1,5 +1,6 @@
-/* Old SysV permission definition for Linux.  AArch64 version.
-   Copyright (C) 2016-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
@@ -13,9 +14,15 @@
    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
+   License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sys/ipc.h>  /* For __key_t  */
+#ifndef _KERNEL_FEATURES_H
+#define _KERNEL_FEATURES_H 1
 
-#define __IPC_64	0x0
+#include_next <kernel-features.h>
+
+#undef __IPC_64
+#define __IPC_64                        0x100
+
+#endif /* _KERNEL_FEATURES_H */
diff --git a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
index 3450933f56..1c480ac0dd 100644
--- a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
@@ -18,8 +18,6 @@
 
 #include <sys/ipc.h>  /* For __key_t  */
 
-#define __IPC_64	0x100
-
 struct __old_ipc_perm
 {
   __key_t __key;			/* Key.  */
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index 413a185db3..b0fd94b139 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -17,6 +17,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _KERNEL_FEATURES_H
+#define _KERNEL_FEATURES_H 1
+
 /* New syscalls added for PowerPC in 2.6.37.  */
 #define __ASSUME_SOCKET_SYSCALL	1
 #define __ASSUME_BIND_SYSCALL		1
@@ -47,5 +50,10 @@
 /* powerpc only supports ipc syscall.  */
 #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
 
+#undef __IPC_64
+#define __IPC_64                        0x100
+
 #undef __ASSUME_CLONE_DEFAULT
 #define __ASSUME_CLONE_BACKWARDS	1
+
+#endif /* _KERNEL_FEATURES_H  */
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 ea957a56be..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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sys/ipc.h>  /* 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 8fdf38c454..12338c0090 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -17,6 +17,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _KERNEL_FEATURES_H
+#define _KERNEL_FEATURES_H 1
+
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
@@ -48,5 +51,10 @@
 /* s390 only supports ipc syscall.  */
 #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
 
+#undef __IPC_64
+#define __IPC_64                        0x100
+
 #undef __ASSUME_CLONE_DEFAULT
 #define __ASSUME_CLONE_BACKWARDS2
+
+#endif /* _KERNEL_FEATURES_H  */
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 767df721b8..1f8e140232 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -44,6 +44,9 @@
 /* sh only supports ipc syscall.  */
 #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
 
+#undef __IPC_64
+#define __IPC_64                        0x100
+
 /* Support for several syscalls was added in 4.8.  */
 #if __LINUX_KERNEL_VERSION < 0x040800
 # undef __ASSUME_RENAMEAT2
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index f441bd811d..4cbe8399ac 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -17,6 +17,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _KERNEL_FEATURES_H
+#define _KERNEL_FEATURES_H 1
+
 #include_next <kernel-features.h>
 
 /* 32-bit SPARC kernels do not support
@@ -60,6 +63,10 @@
 
 /* sparc only supports ipc syscall.  */
 #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+#ifndef __arch64__
+# undef __IPC_64
+# define __IPC_64                            0x100
+#endif
 
 /* Support for the renameat2 syscall was added in 3.16.  */
 #if __LINUX_KERNEL_VERSION < 0x031000
@@ -79,3 +86,5 @@
    (INLINE_CLONE_SYSCALL).  */
 #undef __ASSUME_CLONE_DEFAULT
 #define __ASSUME_CLONE_BACKWARDS	1
+
+#endif /* _KERNEL_FEATURES_H  */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
index 8936aed022..685c25439b 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
@@ -18,8 +18,6 @@
 
 #include <sys/ipc.h>  /* For __key_t  */
 
-#define __IPC_64	0x0
-
 struct __old_ipc_perm
 {
   __key_t __key;		/* Key.  */
diff --git a/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h b/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
index 1ac288aa65..ab44949e6d 100644
--- a/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
@@ -18,8 +18,6 @@
 
 #include <sys/ipc.h>  /* For __key_t  */
 
-#define __IPC_64	0x0
-
 struct __old_ipc_perm
 {
   __key_t __key;		/* Key.  */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 3/5] sysvipc: Consolidate semtimedop s390
  2019-05-16 15:12 [PATCH 1/5] sysvipc: Fix compat msgctl Adhemerval Zanella
  2019-05-16 15:12 ` [PATCH 2/5] sysvipc: Move __IPC_64 to kernel-features.h Adhemerval Zanella
@ 2019-05-16 15:12 ` Adhemerval Zanella
  2019-05-16 15:41   ` Florian Weimer
  2019-05-16 15:12 ` [PATCH 4/5] ipc: Refactor sysvipc compat type Adhemerval Zanella
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 23+ messages in thread
From: Adhemerval Zanella @ 2019-05-16 15:12 UTC (permalink / raw)
  To: libc-alpha

This patch consolidates the s390-32 semtimedop implementation by defining
a arch-specific SEMTIMEDOP_IPC_ARGS to rearrange the arguments expected
by s390 Linux kABI.  The idea is to avoid have multiples semtimedop
implementation changes for Linux v5.1 change to enable wire-up sysvipc
support.

Checked with a s390-linux-gnu and checking that resulting semtimedop
objects do not change.

	* sysdeps/unix/sysv/linux/ipc_priv.h (SEMTIMEDOP_IPC_ARGS): New
	define.
	* sysdpes/unix/sysv/linux/s390/s390-32/ipc_priv.h: New file.
	* sysdeps/unix/sysv/linux/s390/semtimedop.c: Remove file.
	* sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Use
	SEMTIMEDOP_IPC_ARGS for calls with __NR_ipc.
---
 sysdeps/unix/sysv/linux/ipc_priv.h            |  3 ++
 .../unix/sysv/linux/s390/s390-32/ipc_priv.h   | 29 +++++++++++++++
 sysdeps/unix/sysv/linux/s390/semtimedop.c     | 36 -------------------
 sysdeps/unix/sysv/linux/semtimedop.c          |  4 +--
 4 files changed, 34 insertions(+), 38 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/ipc_priv.h
 delete mode 100644 sysdeps/unix/sysv/linux/s390/semtimedop.c

diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h
index 65adbb093e..49018c1b28 100644
--- a/sysdeps/unix/sysv/linux/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/ipc_priv.h
@@ -34,4 +34,7 @@ struct __old_ipc_perm
 #define MSGRCV_ARGS(__msgp, __msgtyp) \
   ((long int []){ (long int) __msgp, __msgtyp })
 
+#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \
+  (__nsops), 0, (__sops), (__timeout)
+
 #include <ipc_ops.h>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/ipc_priv.h b/sysdeps/unix/sysv/linux/s390/s390-32/ipc_priv.h
new file mode 100644
index 0000000000..9d74e92289
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/ipc_priv.h
@@ -0,0 +1,29 @@
+/* Arch-specific SysV IPC definitions for Linux.  s390 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
+   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/>.  */
+
+#include <sysdeps/unix/sysv/linux/ipc_priv.h>
+
+/* The s390 sys_ipc variant has only five parameters instead of six
+   (as for default variant) and the only difference is the handling of
+   SEMTIMEDOP where on s390 the third parameter is used as a pointer
+   to a struct timespec where the generic variant uses fifth parameter.  */
+#undef SEMTIMEDOP_IPC_ARGS
+#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \
+  (__nsops), (__timeout), (__sops)
+
+#include <ipc_ops.h>
diff --git a/sysdeps/unix/sysv/linux/s390/semtimedop.c b/sysdeps/unix/sysv/linux/s390/semtimedop.c
deleted file mode 100644
index 772ee432a9..0000000000
--- a/sysdeps/unix/sysv/linux/s390/semtimedop.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 2003-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
-
-   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/>.  */
-
-#include <sys/sem.h>
-#include <ipc_priv.h>
-#include <sysdep.h>
-#include <errno.h>
-
-/* Perform user-defined atomical operation of array of semaphores.  */
-
-int
-semtimedop (int semid, struct sembuf *sops, size_t nsops,
-	    const struct timespec *timeout)
-{
-  /* The s390 sys_ipc variant has only five parameters instead of six
-     (as for default variant) and the only difference is the handling of
-     SEMTIMEDOP where on s390 the third parameter is used as a pointer
-     to a struct timespec where the generic variant uses fifth parameter.  */
-  return INLINE_SYSCALL_CALL (ipc, IPCOP_semtimedop, semid, nsops, timeout,
-			      sops);
-}
diff --git a/sysdeps/unix/sysv/linux/semtimedop.c b/sysdeps/unix/sysv/linux/semtimedop.c
index 961c6d1f0b..1d746c4117 100644
--- a/sysdeps/unix/sysv/linux/semtimedop.c
+++ b/sysdeps/unix/sysv/linux/semtimedop.c
@@ -30,7 +30,7 @@ semtimedop (int semid, struct sembuf *sops, size_t nsops,
 #ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
   return INLINE_SYSCALL_CALL (semtimedop, semid, sops, nsops, timeout);
 #else
-  return INLINE_SYSCALL_CALL (ipc, IPCOP_semtimedop, semid, nsops, 0, sops,
-			      timeout);
+  return INLINE_SYSCALL_CALL (ipc, IPCOP_semtimedop, semid,
+			      SEMTIMEDOP_IPC_ARGS (nsops, sops, timeout));
 #endif
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 4/5] ipc: Refactor sysvipc compat type
  2019-05-16 15:12 [PATCH 1/5] sysvipc: Fix compat msgctl Adhemerval Zanella
  2019-05-16 15:12 ` [PATCH 2/5] sysvipc: Move __IPC_64 to kernel-features.h Adhemerval Zanella
  2019-05-16 15:12 ` [PATCH 3/5] sysvipc: Consolidate semtimedop s390 Adhemerval Zanella
@ 2019-05-16 15:12 ` Adhemerval Zanella
  2019-05-16 15:12 ` [PATCH 5/5] Update sysvipc kernel-features.h files for Linux 5.1 Adhemerval Zanella
  2019-05-16 15:36 ` [PATCH 1/5] sysvipc: Fix compat msgctl Florian Weimer
  4 siblings, 0 replies; 23+ messages in thread
From: Adhemerval Zanella @ 2019-05-16 15:12 UTC (permalink / raw)
  To: libc-alpha

This patch removes some duplicated definition from sysvipc compat code.
The idea is to make it simple to enable the new wireup sysvipc on Linux
v5.1 for some 32 bits ABIs.

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): Remove definition.
	* 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): Remove definition.
	* sysdeps/unix/sysv/linux/powerpc/ipc_priv.h (__OLD_IPC_ID_TYPE,
	__OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
	(__old_ipc_perm, SEMCTL_ARG_ADDRESS, MSGRCV_ARGS): Remove definitions.
	* sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h (__OLD_IPC_ID_TYPE,
	__OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
	(__old_ipc_perm): Remove definition.
	* sysdeps/unix/sysv/linux/x86_64/ipc_priv.h: Remove file.
---
 sysdeps/unix/sysv/linux/alpha/ipc_priv.h      | 16 +++-------
 sysdeps/unix/sysv/linux/ipc_priv.h            | 27 +++++++++++++----
 .../unix/sysv/linux/mips/mips64/ipc_priv.h    | 16 +++-------
 sysdeps/unix/sysv/linux/powerpc/ipc_priv.h    | 23 +++-----------
 .../unix/sysv/linux/sparc/sparc64/ipc_priv.h  | 18 ++++-------
 sysdeps/unix/sysv/linux/x86_64/ipc_priv.h     | 30 -------------------
 6 files changed, 39 insertions(+), 91 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/x86_64/ipc_priv.h

diff --git a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
index 8b91e2f9fa..fa79bddcf3 100644
--- a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
@@ -16,15 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sys/ipc.h>  /* For __key_t  */
-
-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 <sysdeps/unix/sysv/linux/ipc_priv.h>
diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h
index 49018c1b28..1f9583d42a 100644
--- a/sysdeps/unix/sysv/linux/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/ipc_priv.h
@@ -16,17 +16,30 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _IPC_PRIV_H
+#define _IPC_PRIV_H
+
 #include <sys/ipc.h>  /* For __key_t  */
 
+#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
@@ -38,3 +51,5 @@ struct __old_ipc_perm
   (__nsops), 0, (__sops), (__timeout)
 
 #include <ipc_ops.h>
+
+#endif /* _IPC_PRIV_H  */
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
index ab5db79e25..682ec35662 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
@@ -16,15 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sys/ipc.h>
-
-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 <sysdeps/unix/sysv/linux/ipc_priv.h>
diff --git a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
index 1c480ac0dd..f641ed9a32 100644
--- a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
@@ -16,22 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sys/ipc.h>  /* For __key_t  */
-
-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 })
-
-#include <ipc_ops.h>
+#define __OLD_IPC_ID_TYPE    unsigned int
+#define __OLD_IPC_MODE_TYPE  unsigned int
+#define __OLD_IPC_SEQ_TYPE   unsigned short int
+#include <sysdeps/unix/sysv/linux/ipc_priv.h>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
index 685c25439b..3d813fe9e6 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
@@ -16,24 +16,18 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sys/ipc.h>  /* For __key_t  */
-
-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 <sysdeps/unix/sysv/linux/ipc_priv.h>
 
 /* 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
 
 #include <ipc_ops.h>
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 ab44949e6d..0000000000
--- a/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
+++ /dev/null
@@ -1,30 +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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sys/ipc.h>  /* For __key_t  */
-
-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.  */
-};
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 5/5] Update sysvipc kernel-features.h files for Linux 5.1
  2019-05-16 15:12 [PATCH 1/5] sysvipc: Fix compat msgctl Adhemerval Zanella
                   ` (2 preceding siblings ...)
  2019-05-16 15:12 ` [PATCH 4/5] ipc: Refactor sysvipc compat type Adhemerval Zanella
@ 2019-05-16 15:12 ` Adhemerval Zanella
  2019-05-17 21:00   ` Stepan Golosunov
  2019-05-16 15:36 ` [PATCH 1/5] sysvipc: Fix compat msgctl Florian Weimer
  4 siblings, 1 reply; 23+ messages in thread
From: Adhemerval Zanella @ 2019-05-16 15:12 UTC (permalink / raw)
  To: libc-alpha

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.

	* sysdeps/unix/sysv/linux/i386/kernel-features.h
	(__ASSUME_DIRECT_SYSVIPC_SYSCALLS): Only undefine if
	[__LINUX_KERNEL_VERSION < 0x050100].
	(__IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	(__ASSUME_DIRECT_SYSVIPC_SYSCALLS, __IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/mips/kernel-features.h
	(__ASSUME_DIRECT_SYSVIPC_SYSCALLS, __IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
	(__ASSUME_DIRECT_SYSVIPC_SYSCALLS, __IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/s390/kernel-features.h
	(__ASSUME_DIRECT_SYSVIPC_SYSCALLS, __IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/sh/kernel-features.h
	(__ASSUME_DIRECT_SYSVIPC_SYSCALLS, __IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/sparc/kernel-features.h
	(__ASSUME_DIRECT_SYSVIPC_SYSCALLS, __IPC_64): Likewise.
	* sysdeps/unix/sysv/linux/msgctl.c (__old_msgctl): Only use wire-up
	syscall if __IPC_64 is different than 0x0.
	* 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 define.
	* sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Likewise.
---
 sysdeps/unix/sysv/linux/i386/kernel-features.h    | 10 ++++++----
 sysdeps/unix/sysv/linux/m68k/kernel-features.h    | 11 ++++++-----
 sysdeps/unix/sysv/linux/mips/kernel-features.h    | 14 +++++++++-----
 sysdeps/unix/sysv/linux/msgctl.c                  |  5 ++++-
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 11 ++++++-----
 sysdeps/unix/sysv/linux/s390/kernel-features.h    | 11 ++++++-----
 sysdeps/unix/sysv/linux/semctl.c                  |  5 ++++-
 sysdeps/unix/sysv/linux/semop.c                   |  4 +++-
 sysdeps/unix/sysv/linux/semtimedop.c              |  4 +++-
 sysdeps/unix/sysv/linux/sh/kernel-features.h      | 11 ++++++-----
 sysdeps/unix/sysv/linux/shmctl.c                  |  5 ++++-
 sysdeps/unix/sysv/linux/sparc/kernel-features.h   | 11 +++++++----
 12 files changed, 64 insertions(+), 38 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index 5a26328d97..e08af61501 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -46,10 +46,12 @@
 # undef __ASSUME_SENDTO_SYSCALL
 #endif
 
-/* i686 only supports ipc syscall.  */
-#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
-#undef __IPC_64
-#define __IPC_64                        0x100
+/* i686 only supports ipc syscall before 5.1.  */
+#if __LINUX_KERNEL_VERSION < 0x050100
+# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+# undef __IPC_64
+# define __IPC_64                       0x100
+#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 8e81bb98ef..cec0be6b2b 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -53,10 +53,11 @@
 # undef __ASSUME_SET_ROBUST_LIST
 #endif
 
-/* m68k only supports ipc syscall.  */
-#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
-
-#undef __IPC_64
-#define __IPC_64                        0x100
+/* m68k only supports ipc syscall before 5.1.  */
+#if __LINUX_KERNEL_VERSION < 0x050100
+# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+# undef __IPC_64
+# define __IPC_64                       0x100
+#endif
 
 #endif /* _KERNEL_FEATURES_H  */
diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h
index d90d87a5b0..2a7c125d5b 100644
--- a/sysdeps/unix/sysv/linux/mips/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h
@@ -30,15 +30,16 @@
 # undef __ASSUME_SET_ROBUST_LIST
 #endif
 
-#undef __IPC_64
-#define __IPC_64                        0x100
-
 /* Define this if your 32-bit syscall API requires 64-bit register
    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 __IPC_64
+#  define __IPC_64                      0x100
+# endif
 
 /* The o32 MIPS fadvise64 syscall behaves as fadvise64_64.  */
 # define __ASSUME_FADVISE64_AS_64_64		1
@@ -46,6 +47,9 @@
 /* mips32 support wire-up network syscalls.  */
 # define __ASSUME_RECV_SYSCALL		1
 # define __ASSUME_SEND_SYSCALL		1
+#else
+# undef __IPC_64
+# define __IPC_64                       0x100
 #endif
 
 /* Define that mips64-n32 is a ILP32 ABI to set the correct interface to
diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c
index 2d49567686..d45e00253b 100644
--- a/sysdeps/unix/sysv/linux/msgctl.c
+++ b/sysdeps/unix/sysv/linux/msgctl.c
@@ -61,7 +61,10 @@ int
 attribute_compat_text_section
 __old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf)
 {
-#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+  /* For architecture that have wire-up sysvctl but do not define __IPC_64
+     to a value different than default (0x0), it means the old syscall was
+     done using __NR_ipc.  */
+#if defined(__ASSUME_DIRECT_SYSVIPC_SYSCALLS) && __IPC_64 != 0x0
   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 b0fd94b139..7cfeaff946 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -47,11 +47,12 @@
 
 #include_next <kernel-features.h>
 
-/* powerpc only supports ipc syscall.  */
-#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
-
-#undef __IPC_64
-#define __IPC_64                        0x100
+/* powerpc only supports ipc syscall before 5.1.  */
+#if __LINUX_KERNEL_VERSION < 0x050100
+# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+# undef __IPC_64
+# define __IPC_64                       0x100
+#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 12338c0090..c455cec1af 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -48,11 +48,12 @@
 # undef __ASSUME_SENDTO_SYSCALL
 #endif
 
-/* s390 only supports ipc syscall.  */
-#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
-
-#undef __IPC_64
-#define __IPC_64                        0x100
+/* s390 only supports ipc syscall before 5.1.  */
+#if __LINUX_KERNEL_VERSION < 0x050100
+# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+# undef __IPC_64
+# define __IPC_64                       0x100
+#endif
 
 #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 d428400681..a9d9ee74ec 100644
--- a/sysdeps/unix/sysv/linux/semctl.c
+++ b/sysdeps/unix/sysv/linux/semctl.c
@@ -98,7 +98,10 @@ __old_semctl (int semid, int semnum, int cmd, ...)
       break;
     }
 
-# ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+  /* For architecture that have wire-up sysvctl but do not define __IPC_64
+     to a value different than default (0x0), it means the old syscall was
+     done using __NR_ipc.  */
+# if defined (__ASSUME_DIRECT_SYSVIPC_SYSCALLS) && __IPC_64 != 0x0
   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/semop.c b/sysdeps/unix/sysv/linux/semop.c
index 119ee06878..61649e3f41 100644
--- a/sysdeps/unix/sysv/linux/semop.c
+++ b/sysdeps/unix/sysv/linux/semop.c
@@ -26,7 +26,9 @@
 int
 semop (int semid, struct sembuf *sops, size_t nsops)
 {
-#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+  /* semop wire-up syscall is not exported for 32-bit ABIs (they have
+     semtimedop_time64 instead with uses a 64-bit time_t).  */
+#ifdef __NR_semop
   return INLINE_SYSCALL_CALL (semop, semid, sops, nsops);
 #else
   return INLINE_SYSCALL_CALL (ipc, IPCOP_semop, semid, nsops, 0, sops);
diff --git a/sysdeps/unix/sysv/linux/semtimedop.c b/sysdeps/unix/sysv/linux/semtimedop.c
index 1d746c4117..6bbca1e16f 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
+  /* semop wire-up syscall is not exported for 32-bit ABIs (they have
+     semtimedop_time64 instead with uses a 64-bit time_t).  */
+#ifdef __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 1f8e140232..1060d2fe8b 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -41,11 +41,12 @@
    before the offset.  */
 #define __ASSUME_PRW_DUMMY_ARG	1
 
-/* sh only supports ipc syscall.  */
-#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
-
-#undef __IPC_64
-#define __IPC_64                        0x100
+/* sh only supports ipc syscall before 5.1.  */
+#if __LINUX_KERNEL_VERSION < 0x050100
+# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+# undef __IPC_64
+# define __IPC_64                       0x100
+#endif
 
 /* 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 b322f205f8..5d9d9d15a7 100644
--- a/sysdeps/unix/sysv/linux/shmctl.c
+++ b/sysdeps/unix/sysv/linux/shmctl.c
@@ -63,7 +63,10 @@ int
 attribute_compat_text_section
 __old_shmctl (int shmid, int cmd, struct __old_shmid_ds *buf)
 {
-#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+  /* For architecture that have wire-up sysvctl but do not define __IPC_64
+     to a value different than default (0x0), it means the old syscall was
+     done using __NR_ipc.  */
+#if defined (__ASSUME_DIRECT_SYSVIPC_SYSCALLS) && __IPC_64 != 0x0
   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 4cbe8399ac..11e1c8582a 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -62,10 +62,13 @@
 #endif
 
 /* sparc only supports ipc syscall.  */
-#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
-#ifndef __arch64__
-# undef __IPC_64
-# define __IPC_64                            0x100
+/* sparc only supports ipc syscall before 5.1.  */
+#if __LINUX_KERNEL_VERSION < 0x050100
+# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+# if !defined __arch64__
+#  undef __IPC_64
+#  define __IPC_64                           0x100
+# endif
 #endif
 
 /* Support for the renameat2 syscall was added in 3.16.  */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH 1/5] sysvipc: Fix compat msgctl
  2019-05-16 15:12 [PATCH 1/5] sysvipc: Fix compat msgctl Adhemerval Zanella
                   ` (3 preceding siblings ...)
  2019-05-16 15:12 ` [PATCH 5/5] Update sysvipc kernel-features.h files for Linux 5.1 Adhemerval Zanella
@ 2019-05-16 15:36 ` Florian Weimer
  2019-05-16 19:06   ` Adhemerval Zanella
  4 siblings, 1 reply; 23+ messages in thread
From: Florian Weimer @ 2019-05-16 15:36 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

* Adhemerval Zanella:

> The __IPC64 flags is meant to be used to enable the new sysv struct
> format when the architectures supports it (ARCH_WANT_IPC_PARSE_VERSION
> config flag on Linux kernel).

Doesn't this need a bug number (with a description of the impact in the
bug, if possible).

Thanks,
Florian

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/5] sysvipc: Move __IPC_64 to kernel-features.h
  2019-05-16 15:12 ` [PATCH 2/5] sysvipc: Move __IPC_64 to kernel-features.h Adhemerval Zanella
@ 2019-05-16 15:38   ` Andreas Schwab
  2019-05-16 18:57     ` Adhemerval Zanella
  0 siblings, 1 reply; 23+ messages in thread
From: Andreas Schwab @ 2019-05-16 15:38 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On Mai 16 2019, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:

> diff --git a/sysdeps/unix/sysv/linux/arm/kernel-features.h b/sysdeps/unix/sysv/linux/arm/kernel-features.h
> index 2d2d355844..4f5c621f82 100644
> --- a/sysdeps/unix/sysv/linux/arm/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h
> @@ -17,6 +17,9 @@
>     License along with the GNU C Library.  If not, see
>     <http://www.gnu.org/licenses/>.  */
>  
> +#ifndef _KERNEL_FEATURES_H
> +#define _KERNEL_FEATURES_H 1

Why do you need to add the guards (and only for some of them)?

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 3/5] sysvipc: Consolidate semtimedop s390
  2019-05-16 15:12 ` [PATCH 3/5] sysvipc: Consolidate semtimedop s390 Adhemerval Zanella
@ 2019-05-16 15:41   ` Florian Weimer
  2019-05-16 19:09     ` Adhemerval Zanella
  0 siblings, 1 reply; 23+ messages in thread
From: Florian Weimer @ 2019-05-16 15:41 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

* Adhemerval Zanella:

> diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h
> index 65adbb093e..49018c1b28 100644
> --- a/sysdeps/unix/sysv/linux/ipc_priv.h
> +++ b/sysdeps/unix/sysv/linux/ipc_priv.h
> @@ -34,4 +34,7 @@ struct __old_ipc_perm
>  #define MSGRCV_ARGS(__msgp, __msgtyp) \
>    ((long int []){ (long int) __msgp, __msgtyp })
>  
> +#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \
> +  (__nsops), 0, (__sops), (__timeout)

Maybe add a reference to the s390 version?

> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/ipc_priv.h b/sysdeps/unix/sysv/linux/s390/s390-32/ipc_priv.h
> new file mode 100644
> index 0000000000..9d74e92289

> +/* The s390 sys_ipc variant has only five parameters instead of six
> +   (as for default variant) and the only difference is the handling of
> +   SEMTIMEDOP where on s390 the third parameter is used as a pointer
> +   to a struct timespec where the generic variant uses fifth parameter.  */
> +#undef SEMTIMEDOP_IPC_ARGS
> +#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \
> +  (__nsops), (__timeout), (__sops)

I find “and the only difference is” a bit confusing here.  Maybe write
“.  The difference is” instead?

Rest of the patch looks okay to me.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/5] sysvipc: Move __IPC_64 to kernel-features.h
  2019-05-16 15:38   ` Andreas Schwab
@ 2019-05-16 18:57     ` Adhemerval Zanella
  2019-05-20  7:42       ` Andreas Schwab
  0 siblings, 1 reply; 23+ messages in thread
From: Adhemerval Zanella @ 2019-05-16 18:57 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-alpha



On 16/05/2019 12:38, Andreas Schwab wrote:
> On Mai 16 2019, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
> 
>> diff --git a/sysdeps/unix/sysv/linux/arm/kernel-features.h b/sysdeps/unix/sysv/linux/arm/kernel-features.h
>> index 2d2d355844..4f5c621f82 100644
>> --- a/sysdeps/unix/sysv/linux/arm/kernel-features.h
>> +++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h
>> @@ -17,6 +17,9 @@
>>     License along with the GNU C Library.  If not, see
>>     <http://www.gnu.org/licenses/>.  */
>>  
>> +#ifndef _KERNEL_FEATURES_H
>> +#define _KERNEL_FEATURES_H 1
> 
> Why do you need to add the guards (and only for some of them)?
> 
> Andreas.
> 

I added as I tried to build against the ABI and saw failures. The main
different is different than other __ASSUME flags, __IPC_64 is redefined.  
And this make compiler throw a lot of redefine error. For ARM specifically:

In file included from ../sysdeps/unix/sysv/linux/arm/kernel-features.h:23,
                 from ../sysdeps/unix/sysv/linux/lowlevellock-futex.h:25,
                 from ../sysdeps/nptl/lowlevellock.h:23,
                 from ../nptl/descr.h:29,
                 from ../sysdeps/arm/nptl/tls.h:42,
                 from ../sysdeps/unix/sysv/linux/arm/tls.h:23,
                 from ../sysdeps/unix/sysv/linux/arm/sysdep.h:33,
                 from <stdin>:2:
../sysdeps/unix/sysv/linux/kernel-features.h:83: error: "__IPC_64" redefined [-Werror]
 #define __IPC_64    0x0
 
In file included from ../sysdeps/unix/sysv/linux/sysdep.h:19,
                 from ../sysdeps/unix/sysv/linux/arm/sysdep.h:27,
                 from <stdin>:2:
../sysdeps/unix/sysv/linux/arm/kernel-features.h:58: note: this is the location of the previous definition
 #define __IPC_64   0x100

In general I think unguarded headers file are error-prone.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 1/5] sysvipc: Fix compat msgctl
  2019-05-16 15:36 ` [PATCH 1/5] sysvipc: Fix compat msgctl Florian Weimer
@ 2019-05-16 19:06   ` Adhemerval Zanella
  0 siblings, 0 replies; 23+ messages in thread
From: Adhemerval Zanella @ 2019-05-16 19:06 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha



On 16/05/2019 12:36, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> The __IPC64 flags is meant to be used to enable the new sysv struct
>> format when the architectures supports it (ARCH_WANT_IPC_PARSE_VERSION
>> config flag on Linux kernel).
> 
> Doesn't this need a bug number (with a description of the impact in the
> bug, if possible).
> 
> Thanks,
> Florian
> 

I have opened https://sourceware.org/bugzilla/show_bug.cgi?id=24570 and
also updated locally it fixes it.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 3/5] sysvipc: Consolidate semtimedop s390
  2019-05-16 15:41   ` Florian Weimer
@ 2019-05-16 19:09     ` Adhemerval Zanella
  2019-05-17  9:13       ` Florian Weimer
  0 siblings, 1 reply; 23+ messages in thread
From: Adhemerval Zanella @ 2019-05-16 19:09 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha



On 16/05/2019 12:41, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h
>> index 65adbb093e..49018c1b28 100644
>> --- a/sysdeps/unix/sysv/linux/ipc_priv.h
>> +++ b/sysdeps/unix/sysv/linux/ipc_priv.h
>> @@ -34,4 +34,7 @@ struct __old_ipc_perm
>>  #define MSGRCV_ARGS(__msgp, __msgtyp) \
>>    ((long int []){ (long int) __msgp, __msgtyp })
>>  
>> +#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \
>> +  (__nsops), 0, (__sops), (__timeout)
> 
> Maybe add a reference to the s390 version?

What about: 

/* This macro is required to handle the s390 variants, which passes the
   arguments in a different order than default.  */

> 
>> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/ipc_priv.h b/sysdeps/unix/sysv/linux/s390/s390-32/ipc_priv.h
>> new file mode 100644
>> index 0000000000..9d74e92289
> 
>> +/* The s390 sys_ipc variant has only five parameters instead of six
>> +   (as for default variant) and the only difference is the handling of
>> +   SEMTIMEDOP where on s390 the third parameter is used as a pointer
>> +   to a struct timespec where the generic variant uses fifth parameter.  */
>> +#undef SEMTIMEDOP_IPC_ARGS
>> +#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \
>> +  (__nsops), (__timeout), (__sops)
> 
> I find “and the only difference is” a bit confusing here.  Maybe write
> “.  The difference is” instead?

Ack, I change it locally.

> 
> Rest of the patch looks okay to me.
> 
> Thanks,
> Florian
> 

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 3/5] sysvipc: Consolidate semtimedop s390
  2019-05-16 19:09     ` Adhemerval Zanella
@ 2019-05-17  9:13       ` Florian Weimer
  2019-05-17 12:30         ` Adhemerval Zanella
  0 siblings, 1 reply; 23+ messages in thread
From: Florian Weimer @ 2019-05-17  9:13 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

* Adhemerval Zanella:

> On 16/05/2019 12:41, Florian Weimer wrote:
>> * Adhemerval Zanella:
>> 
>>> diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h
>>> index 65adbb093e..49018c1b28 100644
>>> --- a/sysdeps/unix/sysv/linux/ipc_priv.h
>>> +++ b/sysdeps/unix/sysv/linux/ipc_priv.h
>>> @@ -34,4 +34,7 @@ struct __old_ipc_perm
>>>  #define MSGRCV_ARGS(__msgp, __msgtyp) \
>>>    ((long int []){ (long int) __msgp, __msgtyp })
>>>  
>>> +#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \
>>> +  (__nsops), 0, (__sops), (__timeout)
>> 
>> Maybe add a reference to the s390 version?
>
> What about: 
>
> /* This macro is required to handle the s390 variants, which passes the
>    arguments in a different order than default.  */

Isn't this for s390 (31-bit) only?

Thanks,
Florian

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 3/5] sysvipc: Consolidate semtimedop s390
  2019-05-17  9:13       ` Florian Weimer
@ 2019-05-17 12:30         ` Adhemerval Zanella
  2019-05-17 12:44           ` Florian Weimer
  2019-05-17 19:09           ` Arnd Bergmann
  0 siblings, 2 replies; 23+ messages in thread
From: Adhemerval Zanella @ 2019-05-17 12:30 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha



> Il giorno 17 mag 2019, alle ore 06:13, Florian Weimer <fweimer@redhat.com> ha scritto:
> 
> * Adhemerval Zanella:
> 
>>> On 16/05/2019 12:41, Florian Weimer wrote:
>>> * Adhemerval Zanella:
>>> 
>>>> diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h
>>>> index 65adbb093e..49018c1b28 100644
>>>> --- a/sysdeps/unix/sysv/linux/ipc_priv.h
>>>> +++ b/sysdeps/unix/sysv/linux/ipc_priv.h
>>>> @@ -34,4 +34,7 @@ struct __old_ipc_perm
>>>> #define MSGRCV_ARGS(__msgp, __msgtyp) \
>>>>   ((long int []){ (long int) __msgp, __msgtyp })
>>>> 
>>>> +#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \
>>>> +  (__nsops), 0, (__sops), (__timeout)
>>> 
>>> Maybe add a reference to the s390 version?
>> 
>> What about: 
>> 
>> /* This macro is required to handle the s390 variants, which passes the
>>   arguments in a different order than default.  */
> 
> Isn't this for s390 (31-bit) only?
> 

Indeed, I will change to “s390-32 variant”.

> Thanks,
> Florian

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 3/5] sysvipc: Consolidate semtimedop s390
  2019-05-17 12:30         ` Adhemerval Zanella
@ 2019-05-17 12:44           ` Florian Weimer
  2019-05-17 19:09           ` Arnd Bergmann
  1 sibling, 0 replies; 23+ messages in thread
From: Florian Weimer @ 2019-05-17 12:44 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

* Adhemerval Zanella:

>> Il giorno 17 mag 2019, alle ore 06:13, Florian Weimer <fweimer@redhat.com> ha scritto:
>> 
>> * Adhemerval Zanella:
>> 
>>>> On 16/05/2019 12:41, Florian Weimer wrote:
>>>> * Adhemerval Zanella:
>>>> 
>>>>> diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h
>>>>> index 65adbb093e..49018c1b28 100644
>>>>> --- a/sysdeps/unix/sysv/linux/ipc_priv.h
>>>>> +++ b/sysdeps/unix/sysv/linux/ipc_priv.h
>>>>> @@ -34,4 +34,7 @@ struct __old_ipc_perm
>>>>> #define MSGRCV_ARGS(__msgp, __msgtyp) \
>>>>>   ((long int []){ (long int) __msgp, __msgtyp })
>>>>> 
>>>>> +#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \
>>>>> +  (__nsops), 0, (__sops), (__timeout)
>>>> 
>>>> Maybe add a reference to the s390 version?
>>> 
>>> What about: 
>>> 
>>> /* This macro is required to handle the s390 variants, which passes the
>>>   arguments in a different order than default.  */
>> 
>> Isn't this for s390 (31-bit) only?
>> 
>
> Indeed, I will change to “s390-32 variant”.

Thanks, looks good to me.

Florian

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 3/5] sysvipc: Consolidate semtimedop s390
  2019-05-17 12:30         ` Adhemerval Zanella
  2019-05-17 12:44           ` Florian Weimer
@ 2019-05-17 19:09           ` Arnd Bergmann
  2019-05-20 13:29             ` Adhemerval Zanella
  1 sibling, 1 reply; 23+ messages in thread
From: Arnd Bergmann @ 2019-05-17 19:09 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: Florian Weimer, GNU C Library

On Fri, May 17, 2019 at 2:30 PM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
> > Il giorno 17 mag 2019, alle ore 06:13, Florian Weimer <fweimer@redhat.com> ha scritto:
> >
> > * Adhemerval Zanella:
> >
> >>> On 16/05/2019 12:41, Florian Weimer wrote:
> >>> * Adhemerval Zanella:
> >>>
> >>>> diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h
> >>>> index 65adbb093e..49018c1b28 100644
> >>>> --- a/sysdeps/unix/sysv/linux/ipc_priv.h
> >>>> +++ b/sysdeps/unix/sysv/linux/ipc_priv.h
> >>>> @@ -34,4 +34,7 @@ struct __old_ipc_perm
> >>>> #define MSGRCV_ARGS(__msgp, __msgtyp) \
> >>>>   ((long int []){ (long int) __msgp, __msgtyp })
> >>>>
> >>>> +#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \
> >>>> +  (__nsops), 0, (__sops), (__timeout)
> >>>
> >>> Maybe add a reference to the s390 version?
> >>
> >> What about:
> >>
> >> /* This macro is required to handle the s390 variants, which passes the
> >>   arguments in a different order than default.  */
> >
> > Isn't this for s390 (31-bit) only?
> >
>
> Indeed, I will change to “s390-32 variant”.

According to the kernel sources, the odd sys_s390_ipc function is
used in both native 64-bit and compat 32-bit variants. The 64-bit
s390 ABI also started out with a maximum of five arguments,
so the wrapper was kept there, see:

arch/s390/kernel/syscalls/syscall.tbl:117  common       ipc
sys_s390_ipc compat_sys_s390_ipc

       Arnd

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 5/5] Update sysvipc kernel-features.h files for Linux 5.1
  2019-05-16 15:12 ` [PATCH 5/5] Update sysvipc kernel-features.h files for Linux 5.1 Adhemerval Zanella
@ 2019-05-17 21:00   ` Stepan Golosunov
  2019-05-20 12:31     ` Adhemerval Zanella
  0 siblings, 1 reply; 23+ messages in thread
From: Stepan Golosunov @ 2019-05-17 21:00 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

16.05.2019 в 12:12:49 -0300 Adhemerval Zanella написал:
> diff --git a/sysdeps/unix/sysv/linux/semop.c b/sysdeps/unix/sysv/linux/semop.c
> index 119ee06878..61649e3f41 100644
> --- a/sysdeps/unix/sysv/linux/semop.c
> +++ b/sysdeps/unix/sysv/linux/semop.c
> @@ -26,7 +26,9 @@
>  int
>  semop (int semid, struct sembuf *sops, size_t nsops)
>  {
> -#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +  /* semop wire-up syscall is not exported for 32-bit ABIs (they have

There is no semop on 64-bit ABIs too.

> +     semtimedop_time64 instead with uses a 64-bit time_t).  */
> +#ifdef __NR_semop
>    return INLINE_SYSCALL_CALL (semop, semid, sops, nsops);
>  #else
>    return INLINE_SYSCALL_CALL (ipc, IPCOP_semop, semid, nsops, 0, sops);

> diff --git a/sysdeps/unix/sysv/linux/semtimedop.c b/sysdeps/unix/sysv/linux/semtimedop.c
> index 1d746c4117..6bbca1e16f 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
> +  /* semop wire-up syscall is not exported for 32-bit ABIs (they have

semtimedop, not semop.  And on the three 64-bit ABIs the newly added
syscall is still called semtimedop.  __ASSUME_DIRECT_SYSVIPC_SYSCALLS
condition is still needed for them here (otherwise the new syscall
will be used even when __LINUX_KERNEL_VERSION < 0x050100).

> +     semtimedop_time64 instead with uses a 64-bit time_t).  */
> +#ifdef __NR_semtimedop
>    return INLINE_SYSCALL_CALL (semtimedop, semid, sops, nsops, timeout);
>  #else
>    return INLINE_SYSCALL_CALL (ipc, IPCOP_semtimedop, semid,

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/5] sysvipc: Move __IPC_64 to kernel-features.h
  2019-05-16 18:57     ` Adhemerval Zanella
@ 2019-05-20  7:42       ` Andreas Schwab
  2019-05-20 11:53         ` Adhemerval Zanella
  0 siblings, 1 reply; 23+ messages in thread
From: Andreas Schwab @ 2019-05-20  7:42 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On Mai 16 2019, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:

> In file included from ../sysdeps/unix/sysv/linux/arm/kernel-features.h:23,
>                  from ../sysdeps/unix/sysv/linux/lowlevellock-futex.h:25,
>                  from ../sysdeps/nptl/lowlevellock.h:23,
>                  from ../nptl/descr.h:29,
>                  from ../sysdeps/arm/nptl/tls.h:42,
>                  from ../sysdeps/unix/sysv/linux/arm/tls.h:23,
>                  from ../sysdeps/unix/sysv/linux/arm/sysdep.h:33,
>                  from <stdin>:2:
> ../sysdeps/unix/sysv/linux/kernel-features.h:83: error: "__IPC_64" redefined [-Werror]
>  #define __IPC_64    0x0
>  
> In file included from ../sysdeps/unix/sysv/linux/sysdep.h:19,
>                  from ../sysdeps/unix/sysv/linux/arm/sysdep.h:27,
>                  from <stdin>:2:
> ../sysdeps/unix/sysv/linux/arm/kernel-features.h:58: note: this is the location of the previous definition
>  #define __IPC_64   0x100

I think trying to put __IPC_64 in kernel-features.h is the wrong way to
solve this.

> In general I think unguarded headers file are error-prone.

kernel-features.h is special since it is chain-loaded.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/5] sysvipc: Move __IPC_64 to kernel-features.h
  2019-05-20  7:42       ` Andreas Schwab
@ 2019-05-20 11:53         ` Adhemerval Zanella
  2019-05-20 12:20           ` Andreas Schwab
  0 siblings, 1 reply; 23+ messages in thread
From: Adhemerval Zanella @ 2019-05-20 11:53 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-alpha



On 20/05/2019 04:42, Andreas Schwab wrote:
> On Mai 16 2019, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
> 
>> In file included from ../sysdeps/unix/sysv/linux/arm/kernel-features.h:23,
>>                  from ../sysdeps/unix/sysv/linux/lowlevellock-futex.h:25,
>>                  from ../sysdeps/nptl/lowlevellock.h:23,
>>                  from ../nptl/descr.h:29,
>>                  from ../sysdeps/arm/nptl/tls.h:42,
>>                  from ../sysdeps/unix/sysv/linux/arm/tls.h:23,
>>                  from ../sysdeps/unix/sysv/linux/arm/sysdep.h:33,
>>                  from <stdin>:2:
>> ../sysdeps/unix/sysv/linux/kernel-features.h:83: error: "__IPC_64" redefined [-Werror]
>>  #define __IPC_64    0x0
>>  
>> In file included from ../sysdeps/unix/sysv/linux/sysdep.h:19,
>>                  from ../sysdeps/unix/sysv/linux/arm/sysdep.h:27,
>>                  from <stdin>:2:
>> ../sysdeps/unix/sysv/linux/arm/kernel-features.h:58: note: this is the location of the previous definition
>>  #define __IPC_64   0x100
> 
> I think trying to put __IPC_64 in kernel-features.h is the wrong way to
> solve this.

I don't a strong preference here, one option is to parametrize even more
the __IPC_64 with another flag that set/unset by kernel-features.h and
then handled by ipc-priv.h or whatever.  However I think this is more 
unnecessary complexity.

> 
>> In general I think unguarded headers file are error-prone.
> 
> kernel-features.h is special since it is chain-loaded.

Does it really to continue to be chain-loaded? It limits the way we
code it to just set/unset.

> 
> Andreas.
> 

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/5] sysvipc: Move __IPC_64 to kernel-features.h
  2019-05-20 11:53         ` Adhemerval Zanella
@ 2019-05-20 12:20           ` Andreas Schwab
  2019-05-20 12:30             ` Adhemerval Zanella
  0 siblings, 1 reply; 23+ messages in thread
From: Andreas Schwab @ 2019-05-20 12:20 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On Mai 20 2019, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:

> I don't a strong preference here, one option is to parametrize even more
> the __IPC_64 with another flag that set/unset by kernel-features.h and
> then handled by ipc-priv.h or whatever.  However I think this is more 
> unnecessary complexity.

Can't you use __ASSUME_DIRECT_SYSVIPC_SYSCALLS for that?

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/5] sysvipc: Move __IPC_64 to kernel-features.h
  2019-05-20 12:20           ` Andreas Schwab
@ 2019-05-20 12:30             ` Adhemerval Zanella
  2019-05-20 12:38               ` Adhemerval Zanella
  0 siblings, 1 reply; 23+ messages in thread
From: Adhemerval Zanella @ 2019-05-20 12:30 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-alpha



On 20/05/2019 09:20, Andreas Schwab wrote:
> On Mai 20 2019, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
> 
>> I don't a strong preference here, one option is to parametrize even more
>> the __IPC_64 with another flag that set/unset by kernel-features.h and
>> then handled by ipc-priv.h or whatever.  However I think this is more 
>> unnecessary complexity.
> 
> Can't you use __ASSUME_DIRECT_SYSVIPC_SYSCALLS for that?
> 

I think it feasible, I will adjust the patchset.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 5/5] Update sysvipc kernel-features.h files for Linux 5.1
  2019-05-17 21:00   ` Stepan Golosunov
@ 2019-05-20 12:31     ` Adhemerval Zanella
  0 siblings, 0 replies; 23+ messages in thread
From: Adhemerval Zanella @ 2019-05-20 12:31 UTC (permalink / raw)
  To: Stepan Golosunov; +Cc: libc-alpha



On 17/05/2019 18:00, Stepan Golosunov wrote:
> 16.05.2019 в 12:12:49 -0300 Adhemerval Zanella написал:
>> diff --git a/sysdeps/unix/sysv/linux/semop.c b/sysdeps/unix/sysv/linux/semop.c
>> index 119ee06878..61649e3f41 100644
>> --- a/sysdeps/unix/sysv/linux/semop.c
>> +++ b/sysdeps/unix/sysv/linux/semop.c
>> @@ -26,7 +26,9 @@
>>  int
>>  semop (int semid, struct sembuf *sops, size_t nsops)
>>  {
>> -#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
>> +  /* semop wire-up syscall is not exported for 32-bit ABIs (they have
> 
> There is no semop on 64-bit ABIs too.

It does for architectures that already had the sysvipc wire-up before the
time64_t patchset, x86_64 for instance where its value is 65.

> 
>> +     semtimedop_time64 instead with uses a 64-bit time_t).  */
>> +#ifdef __NR_semop
>>    return INLINE_SYSCALL_CALL (semop, semid, sops, nsops);
>>  #else
>>    return INLINE_SYSCALL_CALL (ipc, IPCOP_semop, semid, nsops, 0, sops);
> 
>> diff --git a/sysdeps/unix/sysv/linux/semtimedop.c b/sysdeps/unix/sysv/linux/semtimedop.c
>> index 1d746c4117..6bbca1e16f 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
>> +  /* semop wire-up syscall is not exported for 32-bit ABIs (they have
> 
> semtimedop, not semop.  And on the three 64-bit ABIs the newly added
> syscall is still called semtimedop.  __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> condition is still needed for them here (otherwise the new syscall
> will be used even when __LINUX_KERNEL_VERSION < 0x050100).

Thanks, I fixed the comment and added back the __ASSUME_DIRECT_SYSVIPC_SYSCALLS
along with the __NR_* check as well. 

> 
>> +     semtimedop_time64 instead with uses a 64-bit time_t).  */
>> +#ifdef __NR_semtimedop
>>    return INLINE_SYSCALL_CALL (semtimedop, semid, sops, nsops, timeout);
>>  #else
>>    return INLINE_SYSCALL_CALL (ipc, IPCOP_semtimedop, semid,

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/5] sysvipc: Move __IPC_64 to kernel-features.h
  2019-05-20 12:30             ` Adhemerval Zanella
@ 2019-05-20 12:38               ` Adhemerval Zanella
  0 siblings, 0 replies; 23+ messages in thread
From: Adhemerval Zanella @ 2019-05-20 12:38 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-alpha



On 20/05/2019 09:30, Adhemerval Zanella wrote:
> 
> 
> On 20/05/2019 09:20, Andreas Schwab wrote:
>> On Mai 20 2019, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
>>
>>> I don't a strong preference here, one option is to parametrize even more
>>> the __IPC_64 with another flag that set/unset by kernel-features.h and
>>> then handled by ipc-priv.h or whatever.  However I think this is more 
>>> unnecessary complexity.
>>
>> Can't you use __ASSUME_DIRECT_SYSVIPC_SYSCALLS for that?
>>
> 
> I think it feasible, I will adjust the patchset.
> 

In fact the problem is __ASSUME_DIRECT_SYSVIPC_SYSCALLS does not hold
all the information.  Alpha, arm, microblaze, mips-n{32,64}, and nios
assumes the default of __ASSUME_DIRECT_SYSVIPC_SYSCALLS, but requires
__IPC_64 set to 0x100. 

While the newly added wire-up for i686, m68k, mips-o32, powerpc, s390,
and sparc requires would require __IPC_64 set to 0x100.  That's why
we will need to set __IPC_64 as architecture base or add an extra
__ASSUME flag to export this information.  I don't have a preference
here, assuming __IPC_64 is either 0x0 or 0x100 we can just set the
default value of 0x0 with a __ASSUME_SYSVIPC_DEFAULT_IPC_64 and 
undef on the required architectures to use 0x100.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 3/5] sysvipc: Consolidate semtimedop s390
  2019-05-17 19:09           ` Arnd Bergmann
@ 2019-05-20 13:29             ` Adhemerval Zanella
  0 siblings, 0 replies; 23+ messages in thread
From: Adhemerval Zanella @ 2019-05-20 13:29 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Florian Weimer, GNU C Library



On 17/05/2019 16:09, Arnd Bergmann wrote:
> On Fri, May 17, 2019 at 2:30 PM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>> Il giorno 17 mag 2019, alle ore 06:13, Florian Weimer <fweimer@redhat.com> ha scritto:
>>>
>>> * Adhemerval Zanella:
>>>
>>>>> On 16/05/2019 12:41, Florian Weimer wrote:
>>>>> * Adhemerval Zanella:
>>>>>
>>>>>> diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h
>>>>>> index 65adbb093e..49018c1b28 100644
>>>>>> --- a/sysdeps/unix/sysv/linux/ipc_priv.h
>>>>>> +++ b/sysdeps/unix/sysv/linux/ipc_priv.h
>>>>>> @@ -34,4 +34,7 @@ struct __old_ipc_perm
>>>>>> #define MSGRCV_ARGS(__msgp, __msgtyp) \
>>>>>>   ((long int []){ (long int) __msgp, __msgtyp })
>>>>>>
>>>>>> +#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \
>>>>>> +  (__nsops), 0, (__sops), (__timeout)
>>>>>
>>>>> Maybe add a reference to the s390 version?
>>>>
>>>> What about:
>>>>
>>>> /* This macro is required to handle the s390 variants, which passes the
>>>>   arguments in a different order than default.  */
>>>
>>> Isn't this for s390 (31-bit) only?
>>>
>>
>> Indeed, I will change to “s390-32 variant”.
> 
> According to the kernel sources, the odd sys_s390_ipc function is
> used in both native 64-bit and compat 32-bit variants. The 64-bit
> s390 ABI also started out with a maximum of five arguments,
> so the wrapper was kept there, see:
> 
> arch/s390/kernel/syscalls/syscall.tbl:117  common       ipc
> sys_s390_ipc compat_sys_s390_ipc
> 

Thanks for remind me this is not for 31-bit only. I moved the
sysdeps/unix/sysv/linux/s390/s390-32/ipc_priv.h to 
sysdeps/unix/sysv/linux/s390/ipc_priv.h.

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2019-05-20 13:29 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16 15:12 [PATCH 1/5] sysvipc: Fix compat msgctl Adhemerval Zanella
2019-05-16 15:12 ` [PATCH 2/5] sysvipc: Move __IPC_64 to kernel-features.h Adhemerval Zanella
2019-05-16 15:38   ` Andreas Schwab
2019-05-16 18:57     ` Adhemerval Zanella
2019-05-20  7:42       ` Andreas Schwab
2019-05-20 11:53         ` Adhemerval Zanella
2019-05-20 12:20           ` Andreas Schwab
2019-05-20 12:30             ` Adhemerval Zanella
2019-05-20 12:38               ` Adhemerval Zanella
2019-05-16 15:12 ` [PATCH 3/5] sysvipc: Consolidate semtimedop s390 Adhemerval Zanella
2019-05-16 15:41   ` Florian Weimer
2019-05-16 19:09     ` Adhemerval Zanella
2019-05-17  9:13       ` Florian Weimer
2019-05-17 12:30         ` Adhemerval Zanella
2019-05-17 12:44           ` Florian Weimer
2019-05-17 19:09           ` Arnd Bergmann
2019-05-20 13:29             ` Adhemerval Zanella
2019-05-16 15:12 ` [PATCH 4/5] ipc: Refactor sysvipc compat type Adhemerval Zanella
2019-05-16 15:12 ` [PATCH 5/5] Update sysvipc kernel-features.h files for Linux 5.1 Adhemerval Zanella
2019-05-17 21:00   ` Stepan Golosunov
2019-05-20 12:31     ` Adhemerval Zanella
2019-05-16 15:36 ` [PATCH 1/5] sysvipc: Fix compat msgctl Florian Weimer
2019-05-16 19:06   ` Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).