glibc/include
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
..
arpa CVE-2016-10739: getaddrinfo: Fully parse IPv4 address strings [BZ #20018] 2019-01-21 21:26:03 +01:00
bits Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
gnu Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
net
netinet Remove --enable-obsolete-nsl configure flag 2020-07-08 17:25:57 +02:00
programs Use 2020 as copyright year. 2020-04-27 10:34:52 -04:00
protocols
rpc Remove --enable-obsolete-nsl configure flag 2020-07-08 17:25:57 +02:00
rpcsvc Remove --enable-obsolete-nsl configure flag 2020-07-08 17:25:57 +02:00
sys sysv: linux: Add 64-bit time_t variant for semctl 2020-07-09 12:05:35 -03:00
aio.h
aliases.h Remove --enable-obsolete-nsl configure flag 2020-07-08 17:25:57 +02:00
alloc_buffer.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
alloca.h Remove macros extend_alloca, extend_alloca_account [BZ #18023] 2018-06-27 19:20:37 +02:00
allocate_once.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
ar.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
argp-fmtstream.h Mark internal argp functions with attribute_hidden [BZ #18822] 2017-10-01 15:10:27 -07:00
argp.h ldbl-opt: Add argp_error and argp_failure (bug 23983) 2019-03-01 15:21:32 -03:00
argz.h Use libc_hidden_* for argz_next, __argz_next (bug 15105). 2018-02-15 21:00:02 +00:00
array_length.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
assert.h Introduce NO_RTLD_HIDDEN, make hurd use it instead of NO_HIDDEN 2017-10-03 01:33:38 +02:00
atomic.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
byteswap.h
complex.h float128: Add private _Float128 declarations for libm. 2017-05-15 10:23:28 -03:00
cpio.h
crypt.h
ctype.h Use libc_hidden_* for tolower, toupper (bug 15105). 2018-02-23 13:54:53 +00:00
des.h
dirent.h <dirent.h>: Remove wrong comment about getdents64 declaration 2019-10-09 11:31:03 +02:00
dlfcn.h Remove --enable-obsolete-nsl configure flag 2020-07-08 17:25:57 +02:00
dso_handle.h Mark __dso_handle as hidden [BZ #18822] 2017-09-26 16:53:44 -07:00
elf.h elf: Refuse to dlopen PIE objects [BZ #24323] 2019-06-18 16:42:10 +02:00
endian.h
envz.h
err.h ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally 2020-03-25 14:34:23 -05:00
errno.h hurd: Fix accessing errno from rtld 2018-03-25 00:48:01 +01:00
error.h ldbl-opt: Add error and error_at_line (bug 23984) 2019-03-01 15:26:36 -03:00
execinfo.h
fcntl.h Fix Linux fcntl OFD locks for non-LFS architectures (BZ#20251) 2018-06-26 13:22:53 -03:00
features.h Update version numbers for 2.31 release 2020-02-01 17:16:54 +05:30
fenv.h Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h. 2018-09-04 19:52:06 +00:00
file_change_detection.h Move implementation of <file_change_detection.h> into a C file 2020-02-18 13:44:48 +01:00
float.h Make totalorder and totalordermag functions take pointer arguments. 2019-08-15 15:18:34 +00:00
fmtmsg.h
fnmatch.h
fpu_control.h Hide internal __setfpucw function [BZ #18822] 2017-10-01 17:52:15 -07:00
fstab.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
fts.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
ftw.h
gconv.h
getopt_int.h
getopt.h
glob.h Hide internal __glob64 function [BZ #18822] 2017-10-01 18:02:10 -07:00
gmp.h Mark internal gmp functions with attribute_hidden [BZ #18822] 2017-10-01 15:15:30 -07:00
gnu-versions.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
grp-merge.h
grp.h Remove --enable-obsolete-nsl configure flag 2020-07-08 17:25:57 +02:00
gshadow.h Mark internal gshadow functions with attribute_hidden [BZ #18822] 2017-10-01 15:19:17 -07:00
iconv.h
ifaddrs.h hurd: Fix getifaddrs' and freeifaddrs' symbol exposition 2017-09-28 01:05:18 +02:00
ifreq.h Hide internal __ifreq function [BZ #18822] 2017-10-01 17:35:46 -07:00
ifunc-impl-list.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
inline-hashtab.h ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486] 2020-02-15 11:01:23 +01:00
intprops.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
inttypes.h Move inttypes.h and stdint.h to stdlib. 2019-03-13 09:42:09 -04:00
langinfo.h
lastlog.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
libc-diag.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
libc-internal.h Remove NO_CTORS_DTORS_SECTIONS macro 2020-05-18 15:39:34 +02:00
libc-pointer-arith.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
libc-symbols.h Remove --enable-obsolete-nsl configure flag 2020-07-08 17:25:57 +02:00
libgen.h
libintl.h Document the internal _ and N_ macros 2020-05-06 17:35:40 +02:00
limits.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
link.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
list_t.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
list.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
locale.h
loop_unroll.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
malloc.h ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486] 2020-02-15 11:01:23 +01:00
math-narrow-eval.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math.h float128: use builtin_signbitf128 always 2020-05-04 13:18:45 -05:00
mcheck.h
memory.h
mntent.h Hide internal __hasmntopt function [BZ #18822] 2017-10-01 17:37:42 -07:00
monetary.h Rename __LONG_DOUBLE_USES_FLOAT128 to __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 2020-04-30 08:52:08 -05:00
mqueue.h y2038: linux: Provide __mq_timedreceive_time64 implementation 2020-04-06 23:05:11 +02:00
netdb.h Remove --enable-obsolete-nsl configure flag 2020-07-08 17:25:57 +02:00
netgroup.h
nl_types.h
nss.h nss: Export nscd hash function as __nss_hash [BZ #22459] 2017-11-23 14:08:11 +01:00
nsswitch.h
obstack.h
plural-exp.h Hide internal __gettextparse function [BZ #18822] 2017-10-01 17:31:05 -07:00
poll.h
printf.h Rename __LONG_DOUBLE_USES_FLOAT128 to __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 2020-04-30 08:52:08 -05:00
pthread.h
pty.h
pwd.h Remove --enable-obsolete-nsl configure flag 2020-07-08 17:25:57 +02:00
random-bits.h y2038: Replace __clock_gettime with __clock_gettime64 2020-05-20 16:45:16 +02:00
re_comp.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
regex.h Hide internal regex functions [BZ #18822] 2017-10-01 15:53:15 -07:00
regexp.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
resolv.h Obsolete p_secstodate. 2017-11-22 22:21:10 +00:00
rounding-mode.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
rtld-malloc.h ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486] 2020-02-15 11:01:23 +01:00
sched.h Add hidden prototypes for __sched_getparam, __sched_getscheduler 2020-02-20 08:57:01 +01:00
scratch_buffer.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
search.h misc: Add twalk_r function 2019-05-02 11:42:51 +02:00
set-hooks.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
setjmp.h Make totalorder and totalordermag functions take pointer arguments. 2019-08-15 15:18:34 +00:00
sgtty.h
shadow.h Remove --enable-obsolete-nsl configure flag 2020-07-08 17:25:57 +02:00
shlib-compat.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
signal.h string: Add sigabbrev_np and sigdescr_np 2020-07-07 14:57:14 -03:00
spawn.h posix: Use posix_spawn for wordexp 2019-10-09 17:48:41 -03:00
stab.h
stackinfo.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
stap-probe.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
stdc-predef.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
stdint.h Move inttypes.h and stdint.h to stdlib. 2019-03-13 09:42:09 -04:00
stdio_ext.h
stdio.h string: Add strerrorname_np and strerrordesc_np 2020-07-07 15:02:57 -03:00
stdlib.h Rename __LONG_DOUBLE_USES_FLOAT128 to __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 2020-04-30 08:52:08 -05:00
string.h string: Add sigabbrev_np and sigdescr_np 2020-07-07 14:57:14 -03:00
strings.h
struct___timespec64.h y2038: include: Move struct __timespec64 definition to a separate file 2020-04-06 23:05:11 +02:00
struct___timeval64.h y2038: include: Move struct __timeval64 definition to a separate file 2020-05-05 19:36:25 +02:00
stubs-prologue.h
syscall.h
sysexits.h
syslog.h
tar.h
termios.h Hide internal __tcgetattr function [BZ #18822] 2017-10-01 17:48:24 -07:00
tgmath.h
time.h y2038: include: Move struct __timeval64 definition to a separate file 2020-05-05 19:36:25 +02:00
ttyent.h
uchar.h
ucontext.h
ulimit.h
unistd.h hurd: Fix ld.so __access override from libc 2019-12-01 21:05:56 +00:00
utime.h
utmp.h Mark internal utmp functions with attribute_hidden [BZ #18822] 2017-10-01 15:51:56 -07:00
values.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
verify.h posix: Sync regex with gnulib 2019-11-06 09:20:52 -03:00
wait.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
wchar.h Rename __LONG_DOUBLE_USES_FLOAT128 to __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 2020-04-30 08:52:08 -05:00
wctype.h Remove __need macros from stdio.h and wchar.h. 2017-06-08 13:58:17 -04:00
wordexp.h