glibc/sysdeps/unix/sysv/linux/mips
Adhemerval Zanella 2f959dfe84 sysvipc: Set ipc_perm mode as mode_t (BZ#18231)
This patch sets the mode field in ipc_perm as mode_t for all architectures,
as POSIX specification [1].  The changes required are as follow:

  1. It moves the ipc_perm definition out of ipc.h to its own header
     ipc_perm.h.  It also allows consolidate the IPC_* definition on
     only one header.

  2. The generic implementation follow the kernel ipc64_perm size so the
     syscall can be made directly without temporary buffer copy.  However,
     since glibc defines the MODE field as mode_t, it omits the __PAD1 field
     (since glibc does not export mode_t as 16-bit for any architecture).

     It is a two-fold improvement:

     2.1. New implementation which follow Linux UAPI will not need to
	  provide an arch-specific ipc-perm.h header neither wrongly
          use the wrong 16-bit definition from previous default ipc.h
	  (as csky did).

     2.1. It allows consolidate ipc_perm definition for architectures that
          already provide mode_t as 32-bit.

  3. All kernel ABIs for the supported architectures already provides the
     expected padding for mode type extension to 32-bit.  However, some
     architectures the padding has the wrong placement, so it requires
     the ipc control routines (msgctl, semctl, and shmctl) to adjust the
     mode field accordingly.  Currently they are armeb, microblaze, m68k,
     s390, and sheb.

     A new assume is added, __ASSUME_SYSVIPC_BROKEN_MODE_T, which the
     required ABIs define.

  4. For the ABIs that define __ASSUME_SYSVIPC_BROKEN_MODE_T, it also
     require compat symbols that do not adjust the mode field.

Checked on arm-linux-gnueabihf, aarch64-linux-gnu, powerpc64le-linux-gnu,
and x86_64-linux-gnu. I also checked the sysvipc tests on hppa-linux-gnu,
sh4-linux-gnu, s390x-linux-gnu, and s390-linux-gnu.

I also did a sanity test against armeb qemu usermode for the sysvipc
tests.

	[BZ #18231]
	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
	bits/ipc-perm.h.
	* sysdeps/unix/sysv/linux/aarch64/bits/ipc.h: Remove file.
	* sysdeps/unix/sysv/linux/alpha/bits/ipc.h: Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/ipc.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/ipc.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/ipc.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/ipc.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/ipc.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/ipc.h: Likewise.
	* sysdeps/unix/sysv/linux/arm/kernel-features.h
	[__BYTE_ORDER == __BIG_ENDIAN] (__ASSUME_SYSVIPC_BROKEN_MODE_T):
	Define.
	* sysdeps/sysv/linux/microblaze/kernel-features.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/kernel-features.h
	[!__s390x__] (__ASSUME_SYSVIPC_BROKEN_MODE_T): Define.
	* sysdeps/unix/sysv/linux/sh/kernel-features.h
	(__ASSUME_SYSVIPC_BROKEN_MODE_T): Define.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/ipc-perm.h: New file.
	* sysdeps/unix/sysv/linux/powerpc/bits/ipc-perm.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/ipc-perm.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/ipc.h (ipc_perm): Move to
	bits/ipc-perm.h.
	* sysdeps/unix/sysv/linux/hppa/bits/ipc-perm.h: New file.
	* sysdeps/unix/sysv/linux/kernel-features.h: Add comment about
	__ASSUME_SYSVIPC_BROKEN_MODE_T semantic.
	* sysdeps/unix/sysv/linux/msgctl.c (DEFAULT_VERSION): Define as
	2.31 if __ASSUME_SYSVIPC_BROKEN_MODE_T is defined.
	(msgctl_syscall, __msgctl_mode16): New symbol.
	(__new_msgctl): Add bits for __ASSUME_SYSVIPC_BROKEN_MODE_T.
	* sysdeps/unix/sysv/linux/semctl.c: Likewise.
	* sysdeps/unix/sysv/linux/shmctl.c: Likewise.
	* sysdeps/unix/sysv/linux/arm/be/libc.abilist (GLIBC_2.31): Add
	msgctl, semctl, and shmctl.
	* sysdeps/sysv/linux/microblaze/be/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/be/libc.abilist: Likewise.
	* conform/data/sys/ipc.h-data: Only xfail {struct ipc_perm} mode_t
	mode for Hurd.
	* sysdeps/unix/sysv/linux/m68k/Versions (libc) [GLIBC_2.31]: Add
	msgctl, semctl, and shmctl.
	* sysdeps/unix/sysv/linux/arm/be/Versions: New file.
	* sysdeps/unix/sysv/linux/microblaze/be/Versions: Likewise.
	* sysdeps/unix/sysv/linux/sh/be/Versions: Likewise.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_ipc.h.html
2019-10-10 17:33:27 -03:00
..
bits sysvipc: Set ipc_perm mode as mode_t (BZ#18231) 2019-10-10 17:33:27 -03:00
mips32 nptl: Move pthread_attr_setschedparam implementation into libc 2019-10-07 20:00:38 +02:00
mips64 mips: Do not malloc on getdents64 fallback 2019-10-09 17:34:38 -03:00
sys Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
____longjmp_chk.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
_test_and_set.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
brk.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
clone.S Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
configure mips: Force RWX stack for hard-float builds that can run on pre-4.8 kernels 2019-08-23 16:38:04 +00:00
configure.ac mips: Force RWX stack for hard-float builds that can run on pre-4.8 kernels 2019-08-23 16:38:04 +00:00
dl-cache.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
dl-static.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
getcontext.S Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
getrlimit64.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
getsysstats.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
Implies NPTL is no longer an add-on! 2014-07-07 09:29:06 -07:00
kernel_rt_sigframe.h Rename struct ucontext tag (bug 21457). 2017-06-26 22:03:58 +00:00
kernel_sigaction.h linux: Consolidate sigaction implementation 2018-04-05 17:09:50 -03:00
kernel_stat.h Allow [f]statfs64 to alias [f]statfs 2016-11-22 09:59:12 -08:00
kernel_termios.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
kernel-features.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
ldsodefs.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
libc-abis MIPS support for GNU hash 2019-08-29 20:11:42 +00:00
makecontext.S Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
Makefile mips: Force RWX stack for hard-float builds that can run on pre-4.8 kernels 2019-08-23 16:38:04 +00:00
mmap_info.h posix: Fix large mmap64 offset for mips64n32 (BZ#24699) 2019-07-10 16:52:50 -03:00
pipe.S
readelflib.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
register-dump.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
setcontext.S Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
setrlimit64.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
shlib-versions Remove configuration name patterns from shlib-versions. 2014-09-12 12:28:47 +00:00
sigcontextinfo.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
swapcontext.S Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
syscalls.list Consolidate Linux send implementation 2017-03-09 15:22:06 +01:00
sysdep.h Fix vDSO initialization on arm and mips 2019-09-24 13:40:26 +02:00
ucontext_i.sym
ustat.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
Versions VDSO support for MIPS 2016-04-12 11:05:13 +01:00
vfork.S Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
xstatconv.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00