glibc/conform/data
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
..
arpa Replace conformtest.pl with conformtest.py. 2018-11-09 13:54:06 +00:00
net conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
netinet hurd: Fix symbols exposition 2018-04-19 20:14:45 +02:00
sys sysvipc: Set ipc_perm mode as mode_t (BZ#18231) 2019-10-10 17:33:27 -03:00
aio.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
assert.h-data conformtest: Update expectations for some ISO C headers. 2012-05-01 20:05:49 +00:00
complex.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
cpio.h-data conformtest: Clean up expectations for POSIX for various headers. 2012-11-19 22:20:44 +00:00
ctype.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
dirent.h-data First steps to get conformtest fully working 2012-02-25 23:18:39 -05:00
dlfcn.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
errno.h-data conformtest: Clean up expectations for POSIX for more headers. 2012-11-19 22:21:47 +00:00
fcntl.h-data Replace conformtest.pl with conformtest.py. 2018-11-09 13:54:06 +00:00
fenv.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
float.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
fmtmsg.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
fnmatch.h-data First steps to get conformtest fully working 2012-02-25 23:18:39 -05:00
ftw.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
glob.h-data conformtest: Clean up expectations for POSIX for various headers. 2012-11-19 22:20:44 +00:00
grp.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
iconv.h-data First steps to get conformtest fully working 2012-02-25 23:18:39 -05:00
inttypes.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
iso646.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
langinfo.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
libgen.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
limits.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
locale.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
math.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
monetary.h-data First steps to get conformtest fully working 2012-02-25 23:18:39 -05:00
mqueue.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
ndbm.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
netdb.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
nl_types.h-data First steps to get conformtest fully working 2012-02-25 23:18:39 -05:00
poll.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
pthread.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
pwd.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
regex.h-data conformtest: Clean up expectations for POSIX for various headers. 2012-11-19 22:20:44 +00:00
sched.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
search.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
semaphore.h-data conformtest: Allow time.h inclusion from semaphore.h for XOPEN2K. 2017-04-28 16:52:16 +00:00
setjmp.h-data conformtest: Update expectations for more ISO C headers. 2012-05-09 10:05:14 +00:00
signal.h-data conform: XFAIL siginfo_t si_band test on sparc64 2018-10-25 14:36:57 +02:00
spawn.h-data Replace conformtest.pl with conformtest.py. 2018-11-09 13:54:06 +00:00
stdalign.h-data conformtest: Clean up / correct / expand C99 and C11 expectations. 2012-11-07 19:36:48 +00:00
stdarg.h-data conformtest: Correct XOPEN2K stdarg.h expectations. 2016-04-26 13:56:04 +00:00
stdbool.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
stddef.h-data conformtest: Update expectations for some ISO C headers. 2012-05-01 20:05:49 +00:00
stdint.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
stdio.h-data Don't install libio.h or _G_config.h. 2018-02-07 10:07:31 -05:00
stdlib.h-data Disallow use of DES encryption functions in new programs. 2018-06-29 16:53:18 +02:00
stdnoreturn.h-data conformtest: Clean up / correct / expand C99 and C11 expectations. 2012-11-07 19:36:48 +00:00
string.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
strings.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
syslog.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
tar.h-data conformtest: clean up POSIX expectations for semaphore.h, signal.h, tar.h. 2014-03-07 03:21:04 +00:00
termios.h-data Replace conformtest.pl with conformtest.py. 2018-11-09 13:54:06 +00:00
tgmath.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
threads.h-data nptl: Add C11 threads tss_* functions 2018-07-24 14:07:12 -03:00
time.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
uchar.h-data conformtest: Clean up / correct / expand C99 and C11 expectations. 2012-11-07 19:36:48 +00:00
ucontext.h-data conformtest: XFAIL uc_mcontext test for powerpc32 (bug 21635). 2017-06-20 17:51:36 +00:00
ulimit.h-data First steps to get conformtest fully working 2012-02-25 23:18:39 -05:00
unistd.h-data Disallow use of DES encryption functions in new programs. 2018-06-29 16:53:18 +02:00
utime.h-data Fix up POSIX testing in conformtest 2012-02-26 13:17:27 -05:00
utmpx.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
varargs.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
wchar.h-data Replace conformtest.pl with conformtest.py. 2018-11-09 13:54:06 +00:00
wctype.h-data conformtest: Fix XPG standard naming. 2017-04-27 20:29:35 +00:00
wordexp.h-data conformtest: Clean up expectations for POSIX for various headers. 2012-11-19 22:20:44 +00:00