glibc/include/sys
Adhemerval Zanella dba950e317 sysv: linux: Add 64-bit time_t variant for semctl
Different than others 64-bit time_t syscalls, the SysIPC interface
does not provide a new set of syscall for y2038 safeness.  Instead it
uses unused fields in semid_ds structure to return the high bits for
the timestamps.

To provide a y2038 safe interface a new symbol __semctl64 is added
and __semctl is change to call it instead (it adds some extra buffer
copying for the 32 bit time_t implementation).

Two new structures are added:

  1. kernel_semid64_ds: used internally only on 32-bit architectures
     to issue the syscall.  A handful of architectures (hppa, i386,
     mips, powerpc32, sparc32) require specific implementations due
     their kernel ABI.

  2. semid_ds64: this is only for __TIMESIZE != 64 to use along with
     the 64-bit semctl.  It is different than the kernel struct because
     the exported 64-bit time_t might require different alignment
     depending on the architecture ABI.

So the resulting implementation does:

  1. For 64-bit architectures it assumes semid_ds already contains
     64-bit time_t fields and will result in just the __semctl symbol
     using the __semctl64 code.  The semid_ds argument is passed as-is
     to the syscall.

  2. For 32-bit architectures with default 64-bit time_t (newer ABIs
     such riscv32 or arc), it will also result in only one exported
     symbol but with the required high/low handling.

     It might be possible to optimize it further to avoid the
     kernel_semid64_ds to semun transformation if the exported ABI
     for the architectures matches the expected kernel ABI, but the
     implementation is already complex enough and don't think this
     should be a hotspot in any case.

  3. Finally for 32-bit architecture with both 32-bit and 64-bit time_t
     support we follow the already set way to provide one symbol with
     64-bit time_t support and implement the 32-bit time_t support
     using the 64-bit one.

     The default 32-bit symbol will allocate and copy the semid_ds
     over multiple buffers, but this should be deprecated in favor
     of the __semctl64 anyway.

Checked on i686-linux-gnu and x86_64-linux-gnu.  I also did some sniff
tests on powerpc, powerpc64, mips, mips64, armhf, sparcv9, and
sparc64.

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Tested-by: Alistair Francis <alistair.francis@wdc.com>
Tested-by: Vineet Gupta <vgupta@synopsys.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2020-07-09 12:05:35 -03:00
..
auxv.h Add a way to bypass the PLT when calling getauxval 2017-06-09 14:36:22 -03:00
bitypes.h
cdefs.h Rename __LONG_DOUBLE_USES_FLOAT128 to __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 2020-04-30 08:52:08 -05:00
dir.h
epoll.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
errno.h * include/sys/errno.h: New file. 2002-08-11 22:06:06 +00:00
fcntl.h
file.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
gmon_out.h
gmon.h Remove __bb_init_func and __bb_exit_func [BZ #21974] 2017-08-20 06:39:31 -07:00
ioctl.h Hide internal __ioctl function [BZ #18822] 2017-10-01 15:59:06 -07:00
ipc.h
mman.h Hide internal __mremap function [BZ #18822] 2017-10-01 16:02:04 -07:00
msg.h First steps to get conformtest fully working 2012-02-25 23:18:39 -05:00
param.h Split sys/param.h out into common file and sysdeps bits/param.h file. 2012-08-17 09:55:17 -07:00
poll.h y2038: linux: Provide __ppoll64 implementation 2019-11-11 14:41:43 +01:00
prctl.h Add a C wrapper for prctl [BZ #25896] 2020-04-30 10:42:43 -07:00
profil.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
queue.h
random.h hurd: Fix local PLT 2019-12-13 11:11:54 +01:00
resource.h linux: Use long time_t for wait4/getrusage 2020-04-02 09:21:06 -07:00
select.h First steps to get conformtest fully working 2012-02-25 23:18:39 -05:00
sem.h sysv: linux: Add 64-bit time_t variant for semctl 2020-07-09 12:05:35 -03:00
sendfile.h hurd: avoid PLT ref between sendfile and sendfile64 2018-06-16 00:44:57 +02:00
shm.h
signal.h
single_threaded.h Add the __libc_single_threaded variable 2020-07-06 11:15:58 +02:00
socket.h Use libc_hidden_* for __cmsg_nxthdr (bug 15105). 2018-02-15 20:59:12 +00:00
stat.h io: Implement lchmod using fchmodat [BZ #14578] 2020-02-12 08:43:59 +01:00
statfs.h Mark internal statfs functions with attribute_hidden [BZ #18822] 2017-10-01 15:18:25 -07:00
statvfs.h Mark internal statfs functions with attribute_hidden [BZ #18822] 2017-10-01 15:18:25 -07:00
sysinfo.h Hide internal sysinfo functions [BZ #18822] 2017-10-01 15:57:21 -07:00
syslog.h ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally 2020-03-25 14:34:23 -05:00
sysmacros.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
termios.h
time.h y2038: linux: Provide __adjtime64 implementation 2020-05-20 01:03:26 +02:00
timeb.h
times.h First steps to get conformtest fully working 2012-02-25 23:18:39 -05:00
ttychars.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
types.h
uio.h Hide __readv and __writev [BZ #18822] 2017-10-01 15:54:10 -07:00
un.h
unistd.h
utsname.h Introduce NO_RTLD_HIDDEN, make hurd use it instead of NO_HIDDEN 2017-10-03 01:33:38 +02:00
vfs.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
vlimit.h
vtimes.h
wait.h Implement waitpid in terms of wait4 2019-12-19 16:11:09 -03:00
xattr.h 2005-12-29 Roland McGrath <roland@frob.com> 2005-12-29 10:38:08 +00:00