]> sourceware.org Git - glibc.git/log
glibc.git
3 years agonptl: Replace lll_futex_{timed_}wait by futex-internal.h
Adhemerval Zanella [Mon, 23 Nov 2020 13:13:42 +0000 (10:13 -0300)]
nptl: Replace lll_futex_{timed_}wait by futex-internal.h

The idea is to make NPTL implementation to use on the functions
provided by futex-internal.h.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agonptl: Replace lll_timedwait with __futex_abstimed_wait64
Adhemerval Zanella [Sun, 22 Nov 2020 21:55:03 +0000 (18:55 -0300)]
nptl: Replace lll_timedwait with __futex_abstimed_wait64

Checked with x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agonptl: Replace __futex_clocklock_wait64 with __futex_abstimed_wait64
Adhemerval Zanella [Sat, 21 Nov 2020 20:39:44 +0000 (17:39 -0300)]
nptl: Replace __futex_clocklock_wait64 with __futex_abstimed_wait64

For non null timeouts, the __futex_clocklock_wait64 creates an a
relative timeout by subtracting the current time from the input
argument.  The same behavior can be obtained with FUTEX_WAIT_BITSET
without the need to calculate the relative timeout.  Besides consolidate
the code it also avoid the possible relative timeout issues [1].

The __futex_abstimed_wait64 needs also to return EINVAL syscall
errors.

Checked on x86_64-linux-gnu and i686-linux-gnu.

[1] https://sourceware.org/pipermail/libc-alpha/2020-November/119881.html

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agonptl: Remove _futex_clock_wait_bitset64
Adhemerval Zanella [Sat, 21 Nov 2020 14:40:46 +0000 (11:40 -0300)]
nptl: Remove _futex_clock_wait_bitset64

It can be replaced with a __futex_abstimed_wait64 call.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agonptl: Consolidate __futex_abstimed_wait_{cancelable}64
Adhemerval Zanella [Sat, 21 Nov 2020 13:39:26 +0000 (10:39 -0300)]
nptl: Consolidate __futex_abstimed_wait_{cancelable}64

The only different is how to issue the syscall.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agonptl: Extend __futex_abstimed_wait_cancelable64 comment
Adhemerval Zanella [Fri, 20 Nov 2020 13:58:51 +0000 (10:58 -0300)]
nptl: Extend __futex_abstimed_wait_cancelable64 comment

And add a small optimization to avoid setting the operation for the
32-bit time fallback operation.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agonptl: Remove clockwait_tid
Adhemerval Zanella [Mon, 23 Nov 2020 18:28:57 +0000 (15:28 -0300)]
nptl: Remove clockwait_tid

It can be replaced with a __futex_abstimed_wait_cancelable64 call,
with the advantage that there is no need to further clock adjustments
to create a absolute timeout.  It allows to remove the now ununsed
futex_timed_wait_cancel64 internal function.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agonptl: Remove futex_wait_cancelable
Adhemerval Zanella [Mon, 23 Nov 2020 18:26:42 +0000 (15:26 -0300)]
nptl: Remove futex_wait_cancelable

It is used solely on __pthread_cond_wait_common and the call can be
replaced by a __futex_abstimed_wait_cancelable64 one.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agonptl: Remove unused internal futex functions
Adhemerval Zanella [Fri, 20 Nov 2020 13:36:56 +0000 (10:36 -0300)]
nptl: Remove unused internal futex functions

The __futex_abstimed_wait usage was remove with 3102e28bd11 and the
__futex_abstimed_wait_cancelable by 323592fdc92 and b8d3e8fbaac.
The futex_lock_pi can be replaced by a futex_lock_pi64.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agoMark mtrace tests UNSUPPORTED if bug-ga2.mtrace or tst-leaks2.mtrace are missing
Stefan Liebler [Wed, 25 Nov 2020 07:30:17 +0000 (08:30 +0100)]
Mark mtrace tests UNSUPPORTED if bug-ga2.mtrace or tst-leaks2.mtrace are missing

Starting with commit 29fddfc7dfd6444fa61a256e9a0d0127545e1f2e, the
tests posix/bug-ga2 and resolv/tst-leaks2 are test-container tests.

If test-container.c returns with EXIT_UNSUPPORTED, the tests with
mtrace() are not executed and the mtrace files do not exist.

Therefore the "mtrace-analysis-part" of those tests are marked
UNSUPPORTED if the mtrace files are missing.

Reported-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
3 years agoelf: Fix uninitialized variable for _dl_write
Shuo Wang [Tue, 24 Nov 2020 19:42:18 +0000 (16:42 -0300)]
elf: Fix uninitialized variable for _dl_write

Variable ret in elf/dl-write.c is uninitialized, which should get
return value from __writev.

3 years agopowerpc: Make PT_THREAD_POINTER available to assembly code
Matheus Castanho [Mon, 19 Oct 2020 14:06:56 +0000 (11:06 -0300)]
powerpc: Make PT_THREAD_POINTER available to assembly code

PT_THREAD_POINTER is currenty defined inside a #ifndef __ASSEMBLER__ block, but
its usage should not be limited to C code, as it can be useful when accessing
the TLS from assembly code as well.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
3 years agoUse libnss_files.so for tests posix/bug-ga2 and resolv/tst-leaks2 [BZ #26821]
Stefan Liebler [Mon, 23 Nov 2020 09:51:24 +0000 (10:51 +0100)]
Use libnss_files.so for tests posix/bug-ga2 and resolv/tst-leaks2 [BZ #26821]

The tests posix/bug-ga2-mem and resolv/mtrace-tst-leaks2 are failing on
fedora 33 as mtrace reports memory leaks.

The /etc/nsswitch.conf differs between
Fedora 32: hosts:      files dns myhostname
Fedora 33: hosts:      files resolve [!UNAVAIL=return] myhostname dns

Therefore /lib64/libnss_resolve.so.2 (from systemd) and the dependencies
libgcc_s.so.1 and libpthread.so.0 are loaded.

Usually all malloc'ed resources from getaddrinfo / gethostbyname are freed
and the libraries are dlclose'd in nss/nsswitch.c:libc_freeres_fn (free_mem).
Unfortunately, /lib64/libnss_resolve.so.2 is marked with DF_1_NODELETE.
As this library is not unmapped, you'll see "Memory not freed".

Therefore those tests are now only relying on libnss_files.so by making
them test-container tests and providing the required configuration files.

By moving the tests to tests-container, those are now running with
"make check".  Therefore the mtrace part of the tests are also moved
from "make xcheck" to "make check".

bug-ga2.c is now using test-driver.c in order to support WAIT_FOR_DEBUGGER
environment variable.

3 years agohurd report-wait: Fix stpcpy usage
Samuel Thibault [Mon, 23 Nov 2020 00:31:41 +0000 (00:31 +0000)]
hurd report-wait: Fix stpcpy usage

We shall not overflow the size of the description parameter. This makes
describe_number and describe_port behave like strpcpy (except for not filling
all the end of buffer with zeroes) and _S_msg_report_wait use series of
stpncpy-like call. If we were to overflow, we can now detect it and
return ENOMEM.

3 years agohurd S_msg_report_wait: Fix detecting fd ports
Samuel Thibault [Mon, 23 Nov 2020 00:25:26 +0000 (00:25 +0000)]
hurd S_msg_report_wait: Fix detecting fd ports

_hurd_init_dtable stays set to non-NULL, so we have to run through both
_hurd_init_dtable and _hurd_dtable.

3 years agohurd S_msg_report_wait: Fix reporting ports
Samuel Thibault [Mon, 23 Nov 2020 00:24:03 +0000 (00:24 +0000)]
hurd S_msg_report_wait: Fix reporting ports

This fixes the parameter order of MSG_EXAMINE, thus fixing the detection
of e.g. fd ports for nicer output in ps WAIT output.

3 years agohurd: Fix strcpy calls
Samuel Thibault [Sun, 22 Nov 2020 23:15:36 +0000 (23:15 +0000)]
hurd: Fix strcpy calls

strcpy cannot be used with overlapping buffer, we have to use memmove
instead. strcpy also cannot be safely used when the destination buffer
is smaller that the source, we need to use strncpy to truncate the
source if needed.

3 years agohurd: Fix _S_msg_get/set_env_variable prototype
Samuel Thibault [Sun, 22 Nov 2020 09:59:17 +0000 (09:59 +0000)]
hurd: Fix _S_msg_get/set_env_variable prototype

_S_msg_get_env_variable and _S_msg_set_env_variable are taking string_t,
not char *.

Fixes a warning with gcc 11.

3 years agohurd: Enable using ifunc
Samuel Thibault [Fri, 13 Nov 2020 21:33:08 +0000 (21:33 +0000)]
hurd: Enable using ifunc

Bugs have been fixed in binutils/gcc/glibc.

3 years agoAdd {,sysdep-}ld-library-path make variable
Samuel Thibault [Fri, 13 Nov 2020 19:37:41 +0000 (19:37 +0000)]
Add {,sysdep-}ld-library-path make variable

On GNU/Hurd we not only need $(common-objpfx) in LD_LIBRARY_PATH when loading
dynamic objects, but also $(common-objpfx)/mach and $(common-objpfx)/hurd. This
adds an ld-library-path variable to be used as LD_LIBRARY_PATH basis in
Makefiles, and a sysdep-ld-library-path variable for sysdeps to add some
more paths, here mach/ and hurd/.

3 years agonptl: Move stack list variables into _rtld_global
Florian Weimer [Mon, 16 Nov 2020 18:33:30 +0000 (19:33 +0100)]
nptl: Move stack list variables into _rtld_global

Now __thread_gscope_wait (the function behind THREAD_GSCOPE_WAIT,
formerly __wait_lookup_done) can be implemented directly in ld.so,
eliminating the unprotected GL (dl_wait_lookup_done) function
pointer.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agohurd: let _dl_argv and __libc_stack_end be relro
Samuel Thibault [Sun, 15 Nov 2020 13:47:13 +0000 (13:47 +0000)]
hurd: let _dl_argv and __libc_stack_end be relro

libpthread does not switch stacks.

3 years agohurd: Remove some remnants of cthreads
Samuel Thibault [Sat, 14 Nov 2020 23:35:35 +0000 (23:35 +0000)]
hurd: Remove some remnants of cthreads

Libc has actually been using mach's lock-internal.h mutex for a long
time already.

3 years agonanosleep: Pass NULL when rem == NULL on ports with __TIMESIZE != 64
Lukasz Majewski [Thu, 12 Nov 2020 11:24:04 +0000 (12:24 +0100)]
nanosleep: Pass NULL when rem == NULL on ports with __TIMESIZE != 64

On ports with __TIMESIZE != 64 the remaining time argument always receives
pointer to struct __timespec64 instance. This is the different behavior
when compared to 64 bit versions of clock_nanosleep and nanosleep
functions, which receive NULL.

To avoid any potential issues, we also pass NULL when *rem pointer is
NULL.

Reported-by: Andreas Schwab <schwab@suse.de>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
3 years agoy2038: Convert thrd_sleep to support 64 bit time
Lukasz Majewski [Wed, 11 Nov 2020 23:24:48 +0000 (00:24 +0100)]
y2038: Convert thrd_sleep to support 64 bit time

The thrd_sleep function has been converted to support 64 bit time.
It was also necessary to provide Linux specific copy of it to avoid
problems on i686-gnu (i.e. HURD) port, which is not providing
clock_nanosleep() supporting 64 bit time.

The thrd_sleep is a wrapper on POSIX threads to provide C11 standard
threads interface. It directly calls __clock_nanosleep64().

Build tests:
./src/scripts/build-many-glibcs.py glibcs

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
3 years agoy2038: Convert mtx_timedlock to support 64 bit time
Lukasz Majewski [Wed, 11 Nov 2020 23:09:03 +0000 (00:09 +0100)]
y2038: Convert mtx_timedlock to support 64 bit time

The mtx_timedlock function has been converted to support 64 bit time.
It was also necessary to provide Linux specific copy of it to avoid
problems on i686-gnu (i.e. HURD) port, which is not providing
pthread_mutex_timedlock() supporting 64 bit time.

The mtx_timedlock is a wrapper on POSIX threads to provide C11 standard
threads interface. It directly calls __pthread_mutex_timedlock64().

Build tests:
./src/scripts/build-many-glibcs.py glibcs

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
3 years agoy2038: Convert cnd_timedwait to support 64 bit time
Lukasz Majewski [Thu, 29 Oct 2020 13:19:25 +0000 (14:19 +0100)]
y2038: Convert cnd_timedwait to support 64 bit time

The cnd_timedwait function has been converted to support 64 bit time.
It was also necessary to provide Linux specific copy of it to avoid
problems on i686-gnu (i.e. HURD) port, which is not providing
pthread_cond_timedwait() supporting 64 bit time.

Moreover, a linux specific copy of thrd_priv.h header file has been
added as well.

The cnd_timedwait is a wrapper on POSIX threads to provide C11 standard
threads interface. It directly calls __pthread_cond_timedwait64().

Build tests:
./src/scripts/build-many-glibcs.py glibcs

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
3 years agohurd: Drop CLOCK_MONOTONIC change which slipped in
Samuel Thibault [Fri, 13 Nov 2020 23:59:04 +0000 (00:59 +0100)]
hurd: Drop CLOCK_MONOTONIC change which slipped in

3 years agohurd: make ptsname fail with ENOTTY on non-master-pty
Samuel Thibault [Fri, 13 Nov 2020 23:51:49 +0000 (23:51 +0000)]
hurd: make ptsname fail with ENOTTY on non-master-pty

3 years agomach: Add missing assert.h include
Samuel Thibault [Fri, 13 Nov 2020 22:38:51 +0000 (22:38 +0000)]
mach: Add missing assert.h include

3 years agohurd: break relocation loop between libc.so and lib{mach,hurd}user.so
Samuel Thibault [Fri, 13 Nov 2020 15:56:51 +0000 (15:56 +0000)]
hurd: break relocation loop between libc.so and lib{mach,hurd}user.so

See
https://sourceware.org/pipermail/libc-alpha/2020-November/119575.html

lib{mach,hurd}user.so gets relocated before libc.so, but its references
to strpcpy and memcpy would need an ifunc decision, which e.g. on
x86 relies on cpu_features, but libc.so's _rtld_global_ro is not
relocated yet.

We can however just make lib{mach,hurd}user.so only call non-ifunc
functions, which can be relocated before libc.so is relocated.

3 years agoRemove obsolete defines for HPUX support from fcntl.h and update O_NONBLOCK.
John David Anglin [Fri, 13 Nov 2020 16:42:11 +0000 (16:42 +0000)]
Remove obsolete defines for HPUX support from fcntl.h and update O_NONBLOCK.

3 years agoRemove tls.h inclusion from internal errno.h
Adhemerval Zanella [Tue, 4 Feb 2020 13:29:04 +0000 (10:29 -0300)]
Remove tls.h inclusion from internal errno.h

The tls.h inclusion is not really required and limits possible
definition on more arch specific headers.

This is a cleanup to allow inline functions on sysdep.h, more
specifically on i386 and ia64 which requires to access some tls
definitions its own.

No semantic changes expected, checked with a build against all
affected ABIs.

3 years agonptl: Eliminate <smp.h> and __is_smp
Florian Weimer [Fri, 13 Nov 2020 14:19:41 +0000 (15:19 +0100)]
nptl: Eliminate <smp.h> and __is_smp

Most systems are SMP, so optimizing for the UP case is no longer
approriate.  A dynamic check based on the kernel identification
has been only implemented for i386 anyway.

To disable adaptive mutexes on sh, define DEFAULT_ADAPTIVE_COUNT
as zero for this architecture.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agopowerpc: Eliminate UP macro conditionals
Florian Weimer [Fri, 13 Nov 2020 14:19:41 +0000 (15:19 +0100)]
powerpc: Eliminate UP macro conditionals

The macro is never defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agox86: Remove UP macro. Define LOCK_PREFIX unconditionally.
Florian Weimer [Fri, 13 Nov 2020 14:19:41 +0000 (15:19 +0100)]
x86: Remove UP macro.  Define LOCK_PREFIX unconditionally.

The UP macro is never defined.  Also define LOCK_PREFIX
unconditionally, to the same string.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoalpha: Remove UP preprocessor conditionals
Florian Weimer [Fri, 13 Nov 2020 14:19:41 +0000 (15:19 +0100)]
alpha: Remove UP preprocessor conditionals

The macro is never defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agohurd: Make sure signals get started
Samuel Thibault [Fri, 13 Nov 2020 10:23:08 +0000 (10:23 +0000)]
hurd: Make sure signals get started

Now that _hurd_libc_proc_init is idempotent, we can always call it,
independently of the __libc_multiple_libcs test which may not match
whether signals should be started or not.

3 years agohurd: initialize libpthread before starting the signal thread
Samuel Thibault [Fri, 13 Nov 2020 01:10:42 +0000 (01:10 +0000)]
hurd: initialize libpthread before starting the signal thread

We cannot rely on csu calling __pthread_initialize_minimal before
posixland_init, in some cases _init gets called before that.

3 years agohurd: Make _hurd_libc_proc_init idempotent
Samuel Thibault [Fri, 13 Nov 2020 00:21:47 +0000 (00:21 +0000)]
hurd: Make _hurd_libc_proc_init idempotent

For the cases where _init is getting called several times during startup. Better
clean pointers anyway.

3 years agopowerpc: Add optimized stpncpy for POWER9
Raphael M Zinsly [Thu, 12 Nov 2020 16:12:24 +0000 (13:12 -0300)]
powerpc: Add optimized stpncpy for POWER9

Add stpncpy support into the POWER9 strncpy.

Reviewed-by: Matheus Castanho <msc@linux.ibm.com>
Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
3 years agopowerpc: Add optimized strncpy for POWER9
Raphael M Zinsly [Thu, 12 Nov 2020 16:12:24 +0000 (13:12 -0300)]
powerpc: Add optimized strncpy for POWER9

Similar to the strcpy P9 optimization, this version uses VSX to improve
performance.

Reviewed-by: Matheus Castanho <msc@linux.ibm.com>
Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
3 years agoDon't use nested function in test-ffs
Siddhesh Poyarekar [Thu, 12 Nov 2020 07:46:02 +0000 (13:16 +0530)]
Don't use nested function in test-ffs

There is no real need to use a nested function in that test, so break
it out so that it can build with clang too.

3 years agoUse __builtin___stpncpy_chk when available
Siddhesh Poyarekar [Thu, 12 Nov 2020 06:39:56 +0000 (12:09 +0530)]
Use __builtin___stpncpy_chk when available

The builtin has been available in gcc since 4.7.0 and in clang since
2.6.  This fixes stpncpy fortification with clang since it does a
better job of plugging in __stpncpy_chk in the right place than the
header hackery.

This has been tested by building and running all tests with gcc 10.2.1
and also with clang tip as of a few days ago (just the tests in debug/
since running all tests don't work with clang at the moment) to make
sure that both compilers pass the stpncpy tests.

3 years agotests: Remove NULL check for an array
Siddhesh Poyarekar [Wed, 11 Nov 2020 17:23:50 +0000 (22:53 +0530)]
tests: Remove NULL check for an array

The NULL check for an array on stack is pointless since it will always
be false, so drop it.

3 years agohurd: Move {,f,l}xstat{,at} and xmknod{at} to compat symbols
Samuel Thibault [Wed, 11 Nov 2020 22:47:13 +0000 (22:47 +0000)]
hurd: Move {,f,l}xstat{,at} and xmknod{at} to compat symbols

We do not actually need them, so we can move their implementations
into the standard {,f,l}stat{,at} variants and only keep compatibility
wrappers.

3 years agohurd: Notify the proc server later during initialization
Samuel Thibault [Wed, 11 Nov 2020 12:52:35 +0000 (12:52 +0000)]
hurd: Notify the proc server later during initialization

Notifying the proc server is an involved task, and unleashes various signal
handling etc. so we have to do this after e.g. ifunc relocations are
completed.

3 years agohtl: Initialize later
Samuel Thibault [Wed, 11 Nov 2020 10:35:10 +0000 (10:35 +0000)]
htl: Initialize later

Since htl does not actually need a stack switch, we can initialize it
like nptl is, avoiding all sorts of startup issues with ifunc.

More precisely, htl defines __pthread_initialize_minimal instead of the
elder _cthread_init_routine. We can then drop the stack switching dances.

3 years agohtl: Keep thread signals blocked during its initialization
Samuel Thibault [Wed, 11 Nov 2020 12:49:10 +0000 (12:49 +0000)]
htl: Keep thread signals blocked during its initialization

One may send signals immediately after creating a thread. We need to block them
until the thread is ready to run signal handlers.

3 years agohtl: Fix spurious symbols in namespaces
Samuel Thibault [Wed, 11 Nov 2020 14:39:51 +0000 (14:39 +0000)]
htl: Fix spurious symbols in namespaces

pthread_attr_{{get,set}stack{addr,size},setstack} were defining a strong alias
for no reason, turning them to weak.

3 years agoUse O_CLOEXEC in sysconf [BZ #26791]
Maximilian Krüger [Wed, 11 Nov 2020 10:21:30 +0000 (11:21 +0100)]
Use O_CLOEXEC in sysconf [BZ #26791]

If sysconf is used in multithreaded processes, various filedescriptors
may leak due to missing O_CLOEXEC.  This commit adds the flag.

3 years agostruct _Unwind_Exception alignment should not depend on compiler flags
Florian Weimer [Wed, 11 Nov 2020 10:59:11 +0000 (11:59 +0100)]
struct _Unwind_Exception alignment should not depend on compiler flags

__attribute__((__aligned__)) selects an alignment that depends on
the micro-architecture selected by GCC flags.  Enabling vector
extensions may increase the allignment.  This is a problem when
building glibc as a collection of ELF multilibs with different
GCC flags because ld.so and libc.so/libpthread.so/&c may end up
with a different layout of struct pthread because of the
changing offset of its struct _Unwind_Exception field.

Tested-By: Matheus Castanho <msc@linux.ibm.com>
3 years agohurd: keep only required PLTs in ld.so
Samuel Thibault [Tue, 10 Nov 2020 23:35:19 +0000 (23:35 +0000)]
hurd: keep only required PLTs in ld.so

We need NO_RTLD_HIDDEN because of the need for PLT calls in ld.so.
See Roland's comment in
https://sourceware.org/bugzilla/show_bug.cgi?id=15605
"in the Hurd it's crucial that calls like __mmap be the libc ones
instead of the rtld-local ones after the bootstrap phase, when the
dynamic linker is being used for dlopen and the like."

We used to just avoid all hidden use in the rtld ; this commit switches to
keeping only those that should use PLT calls, i.e. essentially those defined in
sysdeps/mach/hurd/dl-sysdep.c:

__assert_fail
__assert_perror_fail
__*stat64
_exit

This fixes a few startup issues, notably the call to __tunable_get_val that is
made before PLTs are set up.

3 years agohurd: Add missing startup calls
Samuel Thibault [Tue, 10 Nov 2020 23:50:04 +0000 (23:50 +0000)]
hurd: Add missing startup calls

DL_SYSDEP_INIT and DL_PLATFORM_INIT were not getting called, leading to
missing x86 platform tuning, now mandatory with 0f09154c6400
("x86: Initialize CPU info via IFUNC relocation [BZ 26203]")

3 years agoriscv: Get cache information through sysconf
Zong Li [Thu, 29 Oct 2020 17:33:38 +0000 (01:33 +0800)]
riscv: Get cache information through sysconf

Add support to query cache information on RISC-V through sysconf()
function. The cache information had been added in AUX vector of RISC-V
architecture in Linux kernel v.5.10-rc1.
Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com>
Acked-by: Palmer Dabbelt <palmerdabbelt@google.com>
3 years agoRISC-V: Add _dl_start_user.
Jim Wilson [Tue, 10 Nov 2020 00:53:23 +0000 (16:53 -0800)]
RISC-V: Add _dl_start_user.

This is required for the debugglibc.sh script to work.  Tested by
successfully using this patched script, and a riscv64-linux testsuite
run.

We could perhaps call RTLD_EPILOGUE for ENTRY_POINT before calling
RTLD_PROLOGUE for _dl_start_user, but I don't think it matters.

OK?

Jim

3 years agolinux: Allow adjtime with NULL argument [BZ #26833]
Adhemerval Zanella [Mon, 2 Nov 2020 19:18:29 +0000 (16:18 -0300)]
linux: Allow adjtime with NULL argument [BZ #26833]

The adjtime interface allows return the amount of time remaining
from any previous adjustment that has not yet been completed by
passing a NULL as first argument.  This was introduced with y2038
support 0308077e3a.

Checked on i686-linux-gnu.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agoaarch64: Add unwind information to _start (bug 26853)
Florian Weimer [Mon, 9 Nov 2020 10:31:04 +0000 (11:31 +0100)]
aarch64: Add unwind information to _start (bug 26853)

This adds CFI directives which communicate that the stack ends
with this function.

Fixes bug 26853.

3 years agobsd unlockpt: unlockpt needs to fail with EINVAL, not ENOTTY
Samuel Thibault [Sun, 8 Nov 2020 14:06:56 +0000 (14:06 +0000)]
bsd unlockpt: unlockpt needs to fail with EINVAL, not ENOTTY

The EINVAL error code is mandated by POSIX, while ptsname_r returns
ENOTTY, so we need to translate.

3 years agoRearrange bsd_getpt vs bsd_openpt and implement posix_openpt on BSD
Samuel Thibault [Tue, 26 May 2020 20:20:10 +0000 (22:20 +0200)]
Rearrange bsd_getpt vs bsd_openpt and implement posix_openpt on BSD

* sysdeps/unix/bsd/getpt.c (__getpt): Add oflag parameter, pass
it to the _open call and rename to...
(__bsd_openpt): ... new function.
(__getpt): Reimplement on top of __bsd_openpt.
(__posix_openpt): Replace stub with implementation on top of __bsd_openpt.
(posix_openpt): Remove stub warning.

3 years agoRemove __warndecl
Siddhesh Poyarekar [Thu, 5 Nov 2020 04:50:32 +0000 (10:20 +0530)]
Remove __warndecl

The macro is not used anymore, so remove it and warning-nop.c.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
3 years agoRemove __warn_memset_zero_len [BZ #25399]
Siddhesh Poyarekar [Tue, 3 Nov 2020 09:39:28 +0000 (15:09 +0530)]
Remove __warn_memset_zero_len [BZ #25399]

Non-gcc compilers (clang and possibly other compilers that do not
masquerade as gcc 5.0 or later) are unable to use
__warn_memset_zero_len since the symbol is no longer available on
glibc built with gcc 5.0 or later.  While it was likely an oversight
that caused this omission, the fact that it wasn't noticed until
recently (when clang closed the gap on _FORTIFY_SUPPORT) that the
symbol was missing.

Given that both gcc and clang are capable of doing this check in the
compiler, drop all remaining signs of __warn_memset_zero_len from
glibc so that no more objects are built with this symbol in future.

3 years agoiconv: Accept redundant shift sequences in IBM1364 [BZ #26224]
Arjun Shankar [Wed, 4 Nov 2020 11:19:38 +0000 (12:19 +0100)]
iconv: Accept redundant shift sequences in IBM1364 [BZ #26224]

The IBM1364, IBM1371, IBM1388, IBM1390 and IBM1399 character sets
share converter logic (iconvdata/ibm1364.c) which would reject
redundant shift sequences when processing input in these character
sets.  This led to a hang in the iconv program (CVE-2020-27618).

This commit adjusts the converter to ignore redundant shift sequences
and adds test cases for iconv_prog hangs that would be triggered upon
their rejection.  This brings the implementation in line with other
converters that also ignore redundant shift sequences (e.g. IBM930
etc., fixed in commit 692de4b3960d).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 years agomsg: Remove redundant #include <sys/msg.h> header
Lukasz Majewski [Thu, 22 Oct 2020 11:09:00 +0000 (13:09 +0200)]
msg: Remove redundant #include <sys/msg.h> header

The #include <sys/msg.h> is redundant as we do not use message specific
types for issuing syscalls to handle msg and shm. Only msgctl requires
this header.

Build tests:
./src/scripts/build-many-glibcs.py glibcs

3 years agotst-setuid1-static-ENV: Add $(common-objpfx)nss [BZ #26820]
H.J. Lu [Fri, 30 Oct 2020 18:09:55 +0000 (11:09 -0700)]
tst-setuid1-static-ENV: Add $(common-objpfx)nss [BZ #26820]

commit def674652eeac60c386d04733318b311f8a5b620
Author: Florian Weimer <fweimer@redhat.com>
Date:   Mon Apr 27 15:00:14 2020 +0200

    nptl/tst-setuid1-static: Improve isolation from system objects

    Static dlopen needs an LD_LIBRARY_PATH setting to avoid loading system
    libraries.

missed $(common-objpfx)nss.  Add $(common-objpfx)nss to LD_LIBRARY_PATH
for tst-setuid1-static to support

  struct passwd *pwd = getpwnam ("nobody");

in nptl/tst-setuid1.c.

3 years agoaarch64: Add variant PCS lazy binding test [BZ #26798]
Szabolcs Nagy [Mon, 26 Oct 2020 15:48:01 +0000 (15:48 +0000)]
aarch64: Add variant PCS lazy binding test [BZ #26798]

This test fails without bug 26798 fixed because some integer registers
likely get clobbered by lazy binding and variant PCS only allows x16
and x17 to be clobbered at call time.

The test requires binutils 2.32.1 or newer for handling variant PCS
symbols. SVE registers are not covered by this test, to avoid the
complexity of handling multiple compile- and runtime feature support
cases.

3 years agoaarch64: Fix DT_AARCH64_VARIANT_PCS handling [BZ #26798]
Szabolcs Nagy [Thu, 22 Oct 2020 16:55:01 +0000 (17:55 +0100)]
aarch64: Fix DT_AARCH64_VARIANT_PCS handling [BZ #26798]

The variant PCS support was ineffective because in the common case
linkmap->l_mach.plt == 0 but then the symbol table flags were ignored
and normal lazy binding was used instead of resolving the relocs early.
(This was a misunderstanding about how GOT[1] is setup by the linker.)

In practice this mainly affects SVE calls when the vector length is
more than 128 bits, then the top bits of the argument registers get
clobbered during lazy binding.

Fixes bug 26798.

4 years agohurd: Correct 'ethenet' spelling
Jonny Grant [Wed, 28 Oct 2020 23:09:43 +0000 (23:09 +0000)]
hurd: Correct 'ethenet' spelling

Signed-off-by: Jonny Grant <jg@jguk.org>
4 years agoAvoid -Wstringop-overflow warning in pthread_cleanup_push macros
Joseph Myers [Fri, 30 Oct 2020 22:25:42 +0000 (22:25 +0000)]
Avoid -Wstringop-overflow warning in pthread_cleanup_push macros

GCC 11 introduces a -Wstringop-overflow warning for calls to functions
with an array argument passed as a pointer to memory not large enough
for that array.  This includes the __sigsetjmp calls from
pthread_cleanup_push macros, because those use a structure in
__pthread_unwind_buf_t, which has a common initial subsequence with
jmp_buf but does not include the saved signal mask; this is OK in this
case because the second argument to __sigsetjmp is 0 so the signal
mask is not accessed.

To avoid this warning, use a function alias __sigsetjmp_cancel with
first argument an array of exactly the type used in the calls to the
function, if using GCC 11 or later.  With older compilers, continue to
use __sigsetjmp with a cast, to avoid any issues with compilers
predating the returns_twice attribute not applying the same special
handling to __sigsetjmp_cancel as to __sigsetjmp.

Tested with build-many-glibcs.py for arm-linux-gnueabi that this fixes
the testsuite build failures.

4 years agoDisable spurious -Warray-bounds for ypclnt.c (bug 26687)
Joseph Myers [Fri, 30 Oct 2020 21:40:25 +0000 (21:40 +0000)]
Disable spurious -Warray-bounds for ypclnt.c (bug 26687)

Included among the GCC 11 warnings listed in bug 26687, but not fixed
when that bug was marked as FIXED, are -Warray-bounds warnings in
nis/ypclnt.c.  These are all for different calls to the same piece of
code, which already has a comment explaining that the element accessed
is in a common prefix of the various structures.  On the basis of that
comment, this patch treats the warning as a false positive and
disables it for that code.

Tested with build-many-glibcs.py for arm-linux-gnueabi, where,
together with my previous two patches, this allows the build of glibc
to complete with GCC 11 (further build failures appear in the
testsuite).

Reviewed-by: DJ Delorie <dj@redhat.com>
4 years agoDo not use array parameter to new_composite_name (bug 26726)
Joseph Myers [Fri, 30 Oct 2020 21:39:12 +0000 (21:39 +0000)]
Do not use array parameter to new_composite_name (bug 26726)

Among the warnings causing a glibc build with GCC 11 to fail is one
for a call new_composite_name in setlocale.c.  The newnames argument
is declared as an array with __LC_LAST elements, but when the category
argument is not LC_ALL, it actually only has one element.  Since the
number of elements depends on the first argument to the function, it
seems clearer to declare the argument as a pointer.

Tested with build-many-glibcs.py for arm-linux-gnueabi, where this
allows the build to get further.

Reviewed-by: DJ Delorie <dj@redhat.com>
4 years agoDisable spurious -Wstringop-overflow for setjmp/longjmp (bug 26647)
Joseph Myers [Fri, 30 Oct 2020 21:38:31 +0000 (21:38 +0000)]
Disable spurious -Wstringop-overflow for setjmp/longjmp (bug 26647)

Building glibc with GCC 11 fails with (among other warnings) spurious
-Wstringop-overflow warnings from calls to setjmp and longjmp with a
pointer to a pthread_unwind_buf that is smaller than jmp_buf.  As
discussed in bug 26647, the warning in libc-start.c is a false
positive, because setjmp and longjmp do not access anything (the
signal mask) beyond the common prefix of the two structures, so this
patch disables the warning for that call to setjmp, as well as for two
calls in NPTL code that produce the same warning and look like false
positives for the same reason.

Tested with build-many-glibcs.py for arm-linux-gnueabi, where this
allows the build to get further.

Reviewed-by: DJ Delorie <dj@redhat.com>
4 years agomalloc debug: fix compile error when enable macro MALLOC_DEBUG > 1
liqingqing [Thu, 22 Oct 2020 09:11:44 +0000 (17:11 +0800)]
malloc debug: fix compile error when enable macro MALLOC_DEBUG > 1

malloc debug: fix compile error when enable macro MALLOC_DEBUG > 1.

this is because commit e9c4fe93b3855239752819303ca377dff0ed0553 has change the struct malloc_chunk's member "size" to "mchunk_size".

the reproduction is like that:
setp1: modify related Makefile.
vim ../glibc/malloc/Makefile
CPPFLAGS-malloc.o += -DMALLOC_DEBUG=2

step2: ../configure --prefix=/usr
       make -j32

this will cause the compile error:
/home/liqingqing/glibc_upstream/buildglibc/malloc/malloc.o
In file included from malloc.c:1899:0:
arena.c: In function 'dump_heap':
arena.c:422:58: error: 'struct malloc_chunk' has no member named 'size'
       fprintf (stderr, "chunk %p size %10lx", p, (long) p->size);
                                                          ^~
arena.c:428:17: error: 'struct malloc_chunk' has no member named 'size'
       else if (p->size == (0 | PREV_INUSE))

Reviewed-by: DJ Delorie <dj@redhat.com>
4 years agotst-tcfree2: adjust coding style.
liqingqing [Thu, 22 Oct 2020 06:23:14 +0000 (14:23 +0800)]
tst-tcfree2: adjust coding style.

tst-tcfree2: adjust coding style.

Reviewed-by: DJ Delorie <dj@redhat.com>
4 years agoelf: In ldconfig, extract the new_sub_entry function from search_dir
Florian Weimer [Fri, 30 Oct 2020 17:40:28 +0000 (18:40 +0100)]
elf: In ldconfig, extract the new_sub_entry function from search_dir

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoUse MPC 1.2.1 in build-many-glibcs.py.
Joseph Myers [Fri, 30 Oct 2020 17:16:54 +0000 (17:16 +0000)]
Use MPC 1.2.1 in build-many-glibcs.py.

This patch makes build-many-glibcs.py use the new MPC 1.2.1 release.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).

4 years agoArgument Syntax: Use "option", @option, and @command.
Carlos O'Donell [Wed, 28 Oct 2020 00:28:20 +0000 (20:28 -0400)]
Argument Syntax: Use "option", @option, and @command.

Suggested-by: David O'Brien <daobrien@redhat.com>
4 years agoelf: Unify old and new format cache handling code in ld.so
Florian Weimer [Fri, 30 Oct 2020 10:57:59 +0000 (11:57 +0100)]
elf: Unify old and new format cache handling code in ld.so

struct file_entry_new starts with the fields of struct file_entry,
so the code can be shared if the size computation is made dynamic.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agox86: Restore processing of cache size tunables in init_cacheinfo
Florian Weimer [Wed, 28 Oct 2020 14:53:26 +0000 (15:53 +0100)]
x86: Restore processing of cache size tunables in init_cacheinfo

Fixes and partially reverts commit 59803e81f96b479c17f583b31eac44b5
("x86: Optimizing memcpy for AMD Zen architecture.").

4 years agoMake elf.h header self contained.
Érico Rolim [Tue, 27 Oct 2020 14:17:41 +0000 (11:17 -0300)]
Make elf.h header self contained.

The elf/elf.h header is shared, verbatim, by the elfutils project.
However, elfutils can be used on systems with libcs other than glibc,
making the presence of __BEGIN_DECLS, __END_DECLS and <features.h> in
the file something that downstream distros may have to add patches for.

Furthermore, this file doesn't declare anything with language linkage,
so `extern "C" {}` blocks aren't necessary; it also doesn't have any
conditional definitions based on feature test macros, making inclusion
of features.h unnecessary.

4 years agox86: Optimizing memcpy for AMD Zen architecture.
Sajan Karumanchi [Wed, 28 Oct 2020 07:35:33 +0000 (13:05 +0530)]
x86: Optimizing memcpy for AMD Zen architecture.

Modifying the shareable cache '__x86_shared_cache_size', which is a
factor in computing the non-temporal threshold parameter
'__x86_shared_non_temporal_threshold' to optimize memcpy for AMD Zen
architectures.
In the existing implementation, the shareable cache is computed as 'L3
per thread, L2 per core'. Recomputing this shareable cache as 'L3 per
CCX(Core-Complex)' has brought in performance gains.
As per the large bench variant results, this patch also addresses the
regression problem on AMD Zen architectures.

Reviewed-by: Premachandra Mallappa <premachandra.mallappa@amd.com>
4 years agoHurd: Fix ftime build
Adhemerval Zanella [Tue, 27 Oct 2020 18:21:50 +0000 (15:21 -0300)]
Hurd: Fix ftime build

It does not provide __clock_gettime64, the ftime y2038 support is
moved to a Linux specific implementation.

Checked with a build for i686-linux-gnu and on x86_64-linux and
i686-linux-gnu.

4 years agoAdd IP_RECVERR_RFC4884 and IPV6_RECVERR_RFC4884 from Linux 5.9.
Joseph Myers [Tue, 27 Oct 2020 17:42:34 +0000 (17:42 +0000)]
Add IP_RECVERR_RFC4884 and IPV6_RECVERR_RFC4884 from Linux 5.9.

Add the new constants IP_RECVERR_RFC4884 and IPV6_RECVERR_RFC4884 from
Linux 5.9 to bits/in.h.

Tested for x86_64.

4 years agomisc: Add internal __getauxval2 function
Florian Weimer [Tue, 27 Oct 2020 09:42:10 +0000 (10:42 +0100)]
misc: Add internal __getauxval2 function

The explicit error return value (without in-band signaling) avoids
complicated steps to detect errors based on whether errno has been
updated.

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
4 years agoRemove NEWS entry about ftime removal
Adhemerval Zanella [Tue, 27 Oct 2020 13:43:37 +0000 (10:43 -0300)]
Remove NEWS entry about ftime removal

Now that it was reinstate with 30a0b167d3.

4 years agotime: Add 64-bit time_t support for ftime
Adhemerval Zanella [Mon, 19 Oct 2020 14:51:48 +0000 (11:51 -0300)]
time: Add 64-bit time_t support for ftime

It basically calls the 64-bit __clock_gettime64 and adds the overflow
check.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
4 years agoReinstate ftime and add deprecate message on ftime usage
Adhemerval Zanella [Mon, 19 Oct 2020 12:35:58 +0000 (09:35 -0300)]
Reinstate ftime and add deprecate message on ftime usage

This patch revert "Move ftime to a compatibility symbol" (commit
14633d3e568eb9770a7e5046eff257113e0453fb).

Checked on x86_64-linux-gnu and i686-linux-gnu.

4 years agoUpdate kernel version to 5.9 in tst-mman-consts.py.
Joseph Myers [Mon, 26 Oct 2020 16:40:50 +0000 (16:40 +0000)]
Update kernel version to 5.9 in tst-mman-consts.py.

This patch updates the kernel version in the test tst-mman-consts.py
to 5.9.  (There are no new MAP_* constants covered by this test in 5.9
that need any other header changes.)

Tested with build-many-glibcs.py.

4 years agoAmend grammar and add a description
Jonny Grant [Mon, 26 Oct 2020 14:55:14 +0000 (14:55 +0000)]
Amend grammar and add a description

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agoFix typo in NEWS file
Jonathan Wakely [Mon, 26 Oct 2020 11:46:00 +0000 (11:46 +0000)]
Fix typo in NEWS file

4 years agoRemove timing related checks of time/tst-cpuclock1
Stefan Liebler [Mon, 26 Oct 2020 09:51:28 +0000 (10:51 +0100)]
Remove timing related checks of time/tst-cpuclock1

Starting with the commit 04deeaa9ea74b0679dfc9d9155a37b6425f19a9f
"Fix time/tst-cpuclock1 intermitent failures" (2020-07-11),
this test fails quite often on s390x/s390 with one/multiple of those:
"before - after" / "nanosleep time" / "dead - after" ourside reasonable range.

On a zVM/kvm guest the CPUs are shared between multiple guests.
And even on the lpar (kvm host) the CPUs are usually shared between multiple lpars.
The defined CPUs for a lpar/zVM-system could also have lower weights compared
to other lpars which let the steal time further grow.

Usually I build (-j$(nproc)) and test (PARALLELMFLAGS="-j$(nproc)") glibc multiple
times, e.g. with different GCCs, on various lpars or zVM guests at the same time.
During this time, I've run the test for 13500 times and obvserved the following fails:
~600x "before - after"
~60x "nanosleep time"
~70x "dead - after"

I've also observed a lot of "before - after" fails on a intel kvm-guest while
building/testing glibc on it.

The mentioned commit has tighten the limits of valid tv_nsec ranges:
"before - after" (expected: 500000000):
100000000 ... 600000000
450000000 ... 550000000

"nanosleep time" (expected: 100000000):
100000000 ... 200000000
090000000 ... 120000000

"dead - after" (expected: 100000000):
-           ... 200000000
090000000 ... 120000000

The test itself forks a child process which chew_cpu (user- and kernel-space).
The parent process sleeps with nanosleep(0.5s) and measures the child_clock time:
diff = after - before
With much workload on the machine, the child won't make much progess
and it can fall much beyond the minimum limit.

Afterwards the parent process sleeps with clock_nanosleep (child_clock, 0.1s):
diff = afterns - after
The test currently also allows 0.9 * 0.1s which would be an error.
Depending on the workload, the maximum limit can exceed the 1.2 * 0.1s.

For "dead - after", the parent process kills the child process and waits long
enough to let the child finish dying. Then it gets the time of the child:
diff = dead - after
Note that diff also contains the time for the previous clock_nanosleep.
Thus you'll often see both fails at the same time.

After discussion on the mailing list, we've decided to keep the functional
checks for the clock* functions and remove the timing related checks as those
are prone to false positives.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agoUpdate syscall lists for Linux 5.9.
Joseph Myers [Fri, 23 Oct 2020 16:31:11 +0000 (16:31 +0000)]
Update syscall lists for Linux 5.9.

Linux 5.9 has one new syscall, close_range.  Update syscall-names.list
and regenerate the arch-syscall.h headers with build-many-glibcs.py
update-syscalls.

Tested with build-many-glibcs.py.

4 years agoUse Linux 5.9 in build-many-glibcs.py.
Joseph Myers [Thu, 22 Oct 2020 14:29:13 +0000 (14:29 +0000)]
Use Linux 5.9 in build-many-glibcs.py.

This patch makes build-many-glibcs.py use Linux 5.9.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).

4 years agoReword description of SXID_* tunable properties
Siddhesh Poyarekar [Thu, 22 Oct 2020 06:09:00 +0000 (11:39 +0530)]
Reword description of SXID_* tunable properties

The SXID_* tunable properties only influence processes that are
AT_SECURE, so make that a bit more explicit in the documentation and
comment.

Revisiting the code after a few years I managed to confuse myself, so
I imagine there could be others who may have incorrectly assumed like
I did that the SXID_ERASE tunables are not inherited by children of
non-AT_SECURE processes.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 years agoNew benchtest: pthread locks
DJ Delorie [Wed, 7 Oct 2020 21:04:12 +0000 (17:04 -0400)]
New benchtest: pthread locks

Performance benchmarks for various posix locks: mutex, rwlock,
spinlock, condvar, and semaphore.  Each test is performed with
an empty loop body or with a computationally "interesting" (i.e.
difficult to optimize away, and used just to allow lock code to
be "hidden" in the filler's CPU cycles).

4 years agoy2038: nptl: Provide __futex_clock_wait_bitset64 to support 64 bit bitset
Lukasz Majewski [Mon, 19 Oct 2020 13:05:47 +0000 (15:05 +0200)]
y2038: nptl: Provide __futex_clock_wait_bitset64 to support 64 bit bitset

The commit:
"y2038: nptl: Convert pthread_mutex_{clock|timed}lock to support 64 bit"
SHA1: 29e9874a048f47e2d46c40253036c8d2de921548

introduced support for 64 bit timeouts. Unfortunately, it was missing the
code for bitset - i.e. lll_futex_clock_wait_bitset C preprocessor macro
was used. As a result the 64 bit struct __timespec64 was coerced to 32
bit struct timespec and regression visible as timeout was observed
(nptl/tst-robust10 on s390).

Reported-by: Stefan Liebler <stli@linux.ibm.com>
Tested-by: Stefan Liebler <stli@linux.ibm.com>
4 years agoC-SKY: Make dynamic linker's name compitable with the older gcc.
Cooper Qu [Tue, 20 Oct 2020 15:00:59 +0000 (23:00 +0800)]
C-SKY: Make dynamic linker's name compitable with the older gcc.

__CSKY_HARD_FLOAT_ABI__ was added on gcc 11 to specify whether
-mfloat-abi=hard is set.  On older gcc, the float ABI is defined
solely with __CSKY_HARD_FLOAT__.  If __CSKY_HARD_FLOAT__ is set, it can
be either a hard-float ABI (gcc older than 11, or gcc11 -mfloat-abi=hard
(__CSKY_HARD_FLOAT_ABI__ is set) or -mfloat-abi=softfp
(__CSKY_HARD_FLOAT_ABI__ is not set). To be compatible with older gcc,
use __CSKY_HARD_FLOAT_FPU_SF__ identify if -mfloat-abi is supported,
because it is added to gcc at the same time as -mfloat-abi.

Reviewed-by: Mao Han  <han_mao@linux.alibaba.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

4 years agoRevert "C-SKY:Fix dynamic linker's name when mfloat-abi=softfp."
Mao Han [Tue, 20 Oct 2020 02:00:47 +0000 (10:00 +0800)]
Revert "C-SKY:Fix dynamic linker's name when mfloat-abi=softfp."

This reverts commit 7449320983b664aba506d7674ea0ce142dd3d4ed.

4 years agoMove vtimes to a compatibility symbol
Adhemerval Zanella [Fri, 16 Oct 2020 17:51:40 +0000 (14:51 -0300)]
Move vtimes to a compatibility symbol

I couldn't pinpoint which standard has added it, but no other POSIX
system supports it and/or no longer provide it.  The 'struct vtimes'
also has a lot of drawbacks due its limited internal type size.

I couldn't also see find any project that actually uses this symbol,
either in some dignostic way (such as sanitizer).  So I think it should
be safer to just move to compat symbol, instead of deprecated.  The
idea it to avoid new ports to export such broken interface (riscv32
for instance).

Checked on x86_64-linux-gnu and i686-linux-gnu.

4 years agoy2038: linux: Provide __time64 implementation
Lukasz Majewski [Wed, 14 Oct 2020 11:45:43 +0000 (13:45 +0200)]
y2038: linux: Provide __time64 implementation

In the glibc the time function can use vDSO (on power and x86 the
USE_IFUNC_TIME is defined), time syscall or 'default' time() from
./time/time.c (as a fallback).

In this patch the last function (time) has been refactored and moved
to ./sysdeps/unix/sysv/linux/time.c to be Linux specific.

The new __time64 explicit 64 bit function for providing 64 bit value of
seconds after epoch (by internally calling __clock_gettime64) has been
introduced.

Moreover, a 32 bit version - __time has been refactored to internally
use __time64.

The __time is now supposed to be used on systems still supporting 32 bit
time (__TIMESIZE != 64) - hence the necessary check for time_t potential
overflow.

The iFUNC vDSO direct call optimization has been removed from both i686 and
powerpc32 (USE_IFUNC_TIME is not defined for those architectures
anymore). The Linux kernel does not provide a y2038 safe implementation of
time neither it plans to provide it in the future, __clock_gettime64
should be used instead. Keeping support for this optimization would require
to handle another build permutation (!__ASSUME_TIME64_SYSCALLS &&
USE_IFUNC_TIME which adds more complexity and has limited use (since the
idea is to eventually have a y2038 safe glibc build).

Build tests:
./src/scripts/build-many-glibcs.py glibcs

Run-time tests:
- Run specific tests on ARM/x86 32bit systems (qemu):
https://github.com/lmajewski/meta-y2038 and run tests:
https://github.com/lmajewski/y2038-tests/commits/master

Above tests were performed with Y2038 redirection applied as well as
without to test proper usage of both __time64 and __time.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This page took 0.088549 seconds and 5 git commands to generate.