platform/upstream/glibc.git
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.

3 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>
3 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.

3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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).

3 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>
3 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>
3 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.").

3 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.

3 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>
3 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.

3 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.

3 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>
3 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.

3 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>
3 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.

3 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.

3 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>
3 years agoFix typo in NEWS file
Jonathan Wakely [Mon, 26 Oct 2020 11:46:00 +0000 (11:46 +0000)]
Fix typo in NEWS file

3 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>
3 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.

3 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).

3 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>
3 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).

3 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>
3 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>

3 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.

3 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.

3 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>
3 years agort: Fix typos in comments in <aio.h>
Jonny Grant [Mon, 19 Oct 2020 08:55:00 +0000 (10:55 +0200)]
rt: Fix typos in comments in <aio.h>

3 years agoC-SKY:Fix dynamic linker's name when mfloat-abi=softfp.
Cooper Qu [Fri, 16 Oct 2020 02:56:20 +0000 (10:56 +0800)]
C-SKY:Fix dynamic linker's name when mfloat-abi=softfp.

The dynamic linker should be chosen according to float abi, the
predefined macro __CSKY_HARD_FLOAT__ stand for architecure not
abi.

Reviewed-by: Mao Han <han_mao@linux.alibaba.com>
3 years agox86: Initialize CPU info via IFUNC relocation [BZ 26203]
H.J. Lu [Sat, 4 Jul 2020 13:35:49 +0000 (06:35 -0700)]
x86: Initialize CPU info via IFUNC relocation [BZ 26203]

X86 CPU features in ld.so are initialized by init_cpu_features, which is
invoked by DL_PLATFORM_INIT from _dl_sysdep_start.  But when ld.so is
loaded by static executable, DL_PLATFORM_INIT is never called.  Also
x86 cache info in libc.o and libc.a is initialized by a constructor
which may be called too late.  Since some fields in _rtld_global_ro
in ld.so are initialized by dynamic relocation, we can also initialize
x86 CPU features in _rtld_global_ro in ld.so and cache info in libc.so
by initializing dummy function pointers in ld.so and libc.so via IFUNC
relocation.

Key points:

1. IFUNC is always supported, independent of --enable-multi-arch or
--disable-multi-arch.  Linker generates IFUNC relocations from input
IFUNC objects and ld.so performs IFUNC relocations.
2. There are no IFUNC dependencies in ld.so before dynamic relocation
have been performed,
3. The x86 CPU features in ld.so is initialized by DL_PLATFORM_INIT
in dynamic executable and by IFUNC relocation in dlopen in static
executable.
4. The x86 cache info in libc.o is initialized by IFUNC relocation.
5. In libc.a, both x86 CPU features and cache info are initialized from
ARCH_INIT_CPU_FEATURES, not by IFUNC relocation, before __libc_early_init
is called.

Note: _dl_x86_init_cpu_features can be called more than once from
DL_PLATFORM_INIT and during relocation in ld.so.

3 years agoAdd NEWS entry for ftime compatibility move
Adhemerval Zanella [Fri, 16 Oct 2020 18:16:06 +0000 (15:16 -0300)]
Add NEWS entry for ftime compatibility move

3 years agosupport: Add create_temp_file_in_dir
Adhemerval Zanella [Thu, 15 Oct 2020 18:14:22 +0000 (15:14 -0300)]
support: Add create_temp_file_in_dir

It allows created a temporary file in a specified directory.

3 years agolinux: Add __readdir_unlocked
Adhemerval Zanella [Tue, 14 Apr 2020 20:22:29 +0000 (17:22 -0300)]
linux: Add __readdir_unlocked

And use it on readdir_r implementation.

Checked on i686-linux-gnu.

3 years agolinux: Simplify opendir buffer allocation
Adhemerval Zanella [Sun, 12 Apr 2020 20:42:35 +0000 (17:42 -0300)]
linux: Simplify opendir buffer allocation

The fallback allocation is removed, so the possible size constraint
should be analyzed just once; __alloc_dir assumes that 'statp'
argument is non-null, and the max_buffer_size move to close its
used.

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

3 years agolinux: Move posix dir implementations to Linux
Adhemerval Zanella [Sat, 11 Apr 2020 20:07:11 +0000 (17:07 -0300)]
linux: Move posix dir implementations to Linux

This generic implementation already expects a getdents API which
is Linux specific.  It also allows simplify it by assuming
_DIRENT_HAVE_D_RECLEN and _DIRENT_HAVE_D_OFF support.

The readdir are also expanded on each required implementation,
futher fixes and improvements will make parametrize the
implementation more complex.

Checked on x86_64-linux-gnu, i686-linux-gnu, and with a build
for all affected ABIs.

3 years agolinux: Add 64-bit time_t support for wait3
Adhemerval Zanella [Fri, 24 Jul 2020 18:05:19 +0000 (15:05 -0300)]
linux: Add 64-bit time_t support for wait3

It basically calls the 64-bit time_t wait4 internal symbol.

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

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agoMove ftime to a compatibility symbol
Adhemerval Zanella [Fri, 24 Jul 2020 16:42:01 +0000 (13:42 -0300)]
Move ftime to a compatibility symbol

It was made deprecated on 2.31, so it moves to compat symbol after
two releases.  It was also removed from exported symbol for riscv32
(since ABI will be supported on for 2.33).

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

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Fix time64 support for futimesat
Adhemerval Zanella [Fri, 10 Jul 2020 20:54:42 +0000 (17:54 -0300)]
linux: Fix time64 support for futimesat

The generic implementation does not support time64 and the default
one return overflow for invalid tv_sec with UTIME_NOW / UTIME_OMIT
(which is valid since tv_sec in such cases is ignored by the
kernel).

Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Use INTERNAL_SYSCALL on fstatat{64}
Adhemerval Zanella [Wed, 14 Oct 2020 17:31:38 +0000 (14:31 -0300)]
linux: Use INTERNAL_SYSCALL on fstatat{64}

Although not required by the standards, some code expects that a
successful stat call should not set errno.  However since aa03f722f3b99
'linux: Add {f}stat{at} y2038 support', on 32-bit systems with 32-bit
time_t supporrt, stat implementation will first issues __NR_statx and
if it fails with ENOSYS issue the system stat syscall.

On architecture running on kernel without __NR_statx support the
first call will set the errno to ENOSYS, even when the following stat
syscall might not fail.

This patch fixes by using INTERNAL_SYSCALL and only setting the errno
value when function returns.

Checked on i686-linux-gnu, x86_64-linux-gnu, sparc64-linux-gnu,
sparcv9-linux-gnu, powerpc64-linux-gnu, powerpc64le-linux-gnu,
arm-linux-gnueabihf, and aarch64-linux-gnu.

3 years agoshm tests: Append PID to names passed to shm_open [BZ #26737]
H.J. Lu [Thu, 15 Oct 2020 17:59:04 +0000 (10:59 -0700)]
shm tests: Append PID to names passed to shm_open [BZ #26737]

Append PID to names passed to shm_open in shm tests to avoid random

FAIL: rt/tst-shm-cancel
FAIL: rt/tst-shm

due to the same name passed to shm_open and shm_unlink when more than
one "make check" running in parallel on the same machine.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agosysvipc: Fix tst-sysvshm-linux on x32
Adhemerval Zanella [Thu, 15 Oct 2020 18:45:26 +0000 (15:45 -0300)]
sysvipc: Fix tst-sysvshm-linux on x32

The Linux shminfo fields are '__syscall_ulong_t' (which is 64-bit
for x32).  This patch fixes the test to compare againt the correct
type and to only clamp the value if '__syscall_ulong_t' is the same
size of 'unsigned long int'.

Checked on x86_64-linux-gnu-x32.

3 years agox86/CET: Update vfork to prevent child return
H.J. Lu [Wed, 16 Sep 2020 23:00:14 +0000 (16:00 -0700)]
x86/CET: Update vfork to prevent child return

Child of vfork should either call _exit or one of the exec family of
functions.  But normally there is nothing to prevent child of vfork from
return of the vfork-calling function.  Simpilfy x86 vfork when shadow
stack is in use to introduce mismatched shadow stack in child of vfork
to trigger SIGSEGV when the child returns from the function in which
vfork was called.

3 years agoresolv: Serialize processing in resolv/tst-resolv-txnid-collision
Florian Weimer [Thu, 15 Oct 2020 10:33:13 +0000 (12:33 +0200)]
resolv: Serialize processing in resolv/tst-resolv-txnid-collision

When switching name servers, response processing by two server
threads clobbers the global test state.  (There is still some
risk that this test is negatively impact by packet drops and
packet reordering, but this applies to many of the resolver tests
and is difficult to avoid.)

Fixes commit f1f00c072138af90ae6da180f260111f09afe7a3 ("resolv:
Handle transaction ID collisions in parallel queries (bug 26600)").

3 years agostatfs: add missing f_flags assignment
Chen Li [Mon, 12 Oct 2020 05:46:00 +0000 (13:46 +0800)]
statfs: add missing f_flags assignment

f_flags is added into struct statfs since Linux 2.6.36, which is lacked
in glibc's statfs64.c until now. So mount flags is uninitialized on
platforms having no statfs64 syscall in kernel, e.g., alpha and its derivation

3 years agoy2038: Remove not used __fstatat_time64 define
Lukasz Majewski [Tue, 13 Oct 2020 12:46:39 +0000 (14:46 +0200)]
y2038: Remove not used __fstatat_time64 define

This define is only present in the ./include/sys/stat.h file. As it is not
used in any other place it is eligible to be removed.

3 years agoy2038: nptl: Convert pthread_mutex_{clock|timed}lock to support 64 bit
Lukasz Majewski [Fri, 18 Sep 2020 18:54:13 +0000 (20:54 +0200)]
y2038: nptl: Convert pthread_mutex_{clock|timed}lock to support 64 bit

The pthread_mutex_clocklock and pthread_mutex_timedlock have been converted
to support 64 bit time.

This change uses:
- New __futex_clocklock_wait64 (instead of lll_timedwait)

from ./sysdeps/nptl/futex-helpers.c and

- New __futex_clocklock64 function (instead of lll_clocklock)
- New futex_lock_pi64

defined in sysdeps/nptl/futex-internal.h

The pthread_mutex_{clock|timed}lock only accepts absolute time.
Moreover, there is no need to check for NULL passed as *abstime pointer to the
syscalls as those calls have exported symbols marked with __nonull attribute
for abstime.

Some architectures - namely x86, powerpc and s390 - do support lock elision.
For those - adjustments have been made in arch specific elision-*.c files
to use __futex_clocklock64 instead of lll_clocklock.
The __lll_lock_elision (aliased to __lll_clocklock_elision in e.g.
sysdeps/unix/sysv/linux/s390/elision-timed.c) just uses, in this patch
provided, __futex_clocklock64.

For systems with __TIMESIZE != 64 && __WORDSIZE == 32:
- Conversions between 64 bit time to 32 bit are necessary
- Redirection to pthread_mutex_{clock|timed}lock will provide support for 64
bit time

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

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agosysvipc: Return EINVAL for invalid shmctl commands
Adhemerval Zanella [Tue, 29 Sep 2020 17:55:02 +0000 (14:55 -0300)]
sysvipc: Return EINVAL for invalid shmctl commands

It avoids regressions on possible future commands that might require
additional libc support.  The downside is new commands added by newer
kernels will need further glibc support.

Checked on x86_64-linux-gnu and i686-linux-gnu (Linux v4.15 and v5.4).

3 years agosysvipc: Fix IPC_INFO and SHM_INFO handling [BZ #26636]
Adhemerval Zanella [Tue, 29 Sep 2020 17:51:36 +0000 (14:51 -0300)]
sysvipc: Fix IPC_INFO and SHM_INFO handling [BZ #26636]

Both commands are Linux extensions where the third argument is either
a 'struct shminfo' (IPC_INFO) or a 'struct shm_info' (SHM_INFO) instead
of 'struct shmid_ds'.  And their information does not contain any time
related fields, so there is no need to extra conversion for __IPC_TIME64.

The regression testcase checks for Linux specifix SysV ipc message
control extension.  For SHM_INFO it tries to match the values against the
tunable /proc values and for MSG_STAT/MSG_STAT_ANY it check if the create\
shared memory is within the global list returned by the kernel.

Checked on x86_64-linux-gnu and on i686-linux-gnu (Linux v5.4 and on
Linux v4.15).

3 years agoAArch64: Use __memcpy_simd on Neoverse N2/V1
Wilco Dijkstra [Wed, 14 Oct 2020 12:56:21 +0000 (13:56 +0100)]
AArch64: Use __memcpy_simd on Neoverse N2/V1

Add CPU detection of Neoverse N2 and Neoverse V1, and select __memcpy_simd as
the memcpy/memmove ifunc.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoresolv: Handle transaction ID collisions in parallel queries (bug 26600)
Florian Weimer [Wed, 14 Oct 2020 08:54:39 +0000 (10:54 +0200)]
resolv: Handle transaction ID collisions in parallel queries (bug 26600)

If the transaction IDs are equal, the old check attributed both
responses to the first query, not recognizing the second response.
This fixes bug 26600.

3 years agosupport: Provide a way to clear the RA bit in DNS server responses
Florian Weimer [Wed, 14 Oct 2020 08:54:39 +0000 (10:54 +0200)]
support: Provide a way to clear the RA bit in DNS server responses

3 years agosupport: Provide a way to reorder responses within the DNS test server
Florian Weimer [Wed, 14 Oct 2020 08:54:39 +0000 (10:54 +0200)]
support: Provide a way to reorder responses within the DNS test server

3 years agoAdd missing stat/mknod symbol on libc.abilist some ABIs
Adhemerval Zanella [Tue, 13 Oct 2020 13:08:42 +0000 (10:08 -0300)]
Add missing stat/mknod symbol on libc.abilist some ABIs

It adds the missing new symbols from 8ed005daf0 and 589260cef8 (which
added versioned symbols for {f,l}stat{at}{64} and mknod{a}t) on some
libc.abilist ABIs.

3 years agomanual: correct the spelling of "MALLOC_PERTURB_" [BZ #23015]
Benno Schulenberg [Mon, 12 Oct 2020 15:15:58 +0000 (17:15 +0200)]
manual: correct the spelling of "MALLOC_PERTURB_" [BZ #23015]

Reported-by: Martin Dorey <martin.dorey@hds.com>
3 years agomanual: replace an obsolete collation example with a valid one
Benno Schulenberg [Mon, 12 Oct 2020 15:11:47 +0000 (17:11 +0200)]
manual: replace an obsolete collation example with a valid one

In the Spanish language, the digraph "ll" has not been considered a
separate letter since 1994:
  https://www.rae.es/consultas/exclusion-de-ch-y-ll-del-abecedario

Since January 1998 (commit 49891c106244888123557fca7fddda4fa1f96b1d),
glibc's locale data no longer specifies "ch" and "ll" as separate
collation elements.  So, it's better to not use "ll" in an example.

Also, the Czech "ch" is a better example as it collates in a more
surprising place.

3 years agortld: fix typo in comment
Rolf Eike Beer [Tue, 22 Sep 2020 12:12:59 +0000 (14:12 +0200)]
rtld: fix typo in comment

3 years agoelf: Add missing <dl-procinfo.h> header to elf/dl-usage.c
Matheus Castanho [Mon, 12 Oct 2020 09:28:18 +0000 (11:28 +0200)]
elf: Add missing <dl-procinfo.h> header to elf/dl-usage.c

3 years agohurd: support clock_gettime(CLOCK_PROCESS/THREAD_CPUTIME_ID)
Samuel Thibault [Sun, 11 Oct 2020 13:59:01 +0000 (13:59 +0000)]
hurd: support clock_gettime(CLOCK_PROCESS/THREAD_CPUTIME_ID)

* sysdeps/mach/clock_gettime.c (__clock_gettime): Add support for
CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID.

3 years agolinux: Move xmknod{at} to compat symbols
Adhemerval Zanella [Tue, 21 Jul 2020 18:53:53 +0000 (15:53 -0300)]
linux: Move xmknod{at} to compat symbols

It also decouple mknod{at} from xmknod{at}.  The riscv32 ABI was added
on 2.33, so it is safe to remove the old __xmknot{at} symbols and just
provide the newer mknod{at} ones.

Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Add {f}stat{at} y2038 support
Adhemerval Zanella [Mon, 20 Jul 2020 19:02:04 +0000 (16:02 -0300)]
linux: Add {f}stat{at} y2038 support

A new struct __stat{64}_t64 type is added with the required
__timespec64 time definition.  Only LFS is added, 64-bit time with
32-bit offsets is not supposed to be supported (no existing glibc
configuration supports such a combination).  It is done with an extra
__NR_statx call plus a conversion to the new __stat{64}_t64 type.
The statx call is done only for 32-bit time_t ABIs.

Internally some extra routines to copy from/to struct stat{64}
to struct __stat{64} used on multiple implementations (stat, fstat,
lstat, and fstatat) are added on a extra implementation
(stat_t64_cp.c).  Alse some extra routines to copy from statx to
__stat{64} is added on statx_cp.c.

Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Move {f}xstat{at} to compat symbols
Adhemerval Zanella [Sat, 18 Jul 2020 13:21:25 +0000 (10:21 -0300)]
linux: Move {f}xstat{at} to compat symbols

They are no interna uses anymore.  The riscv32 ABI was added on 2.33,
so it is safe to remove the old __{f,l}stat{at} symbols and just
provide the newer {f,l}stat{at} ones.

Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Disentangle fstatat from fxstatat
Adhemerval Zanella [Sat, 18 Jul 2020 11:20:46 +0000 (08:20 -0300)]
linux: Disentangle fstatat from fxstatat

It implements all the required syscall for the all Linux kABIS on
fstatat{64} instead of calling fxstatat{64}.

On non-LFS implementation, it handles 3 cases:

  1. New kABIs which uses generic pre 64-bit time Linux ABI (csky and
     nios): it issues __NR_fstat64 plus handle the overflow on st_ino,
     st_size, or st_blocks.

  2. Old KABIs with old non-LFS support (arm, i386, hppa, m68k,
     microblaze, mips32, s390, sh, powerpc, and sparc32): it issues
     __NR_fstatat64 and convert the result to struct stat.

  3. 64-bit kABI outliers (mips64 and mips64-n32): it issues
     __NR_newfstatat and convert the result to struct stat.

The generic LFS implementation handles multiple cases:

  1. XSTAT_IS_XSTAT64 being 1:

    1.1. 64-bit kABI (aarch64, ia64, powerpc64*, s390x, riscv64, and
         x86_64): it issues __NR_newfstatat.

    1.2. 64-bit kABI outlier (alpha): it issues __NR_fstatat64.

    1.3. 64-bit kABI outlier where struct stat64 does not match kernel
         one (sparc64): it issues __NR_fstatat64 and convert the result
         to struct stat64.

    1.4. 32-bit kABI with default 64-bit time_t (arc, riscv32): it
         issues __NR_statx and convert the result to struct stat64.

  2. Old ABIs with XSTAT_IS_XSTAT64 being 0:

    2.1. All kABIs with non-LFS support (arm, csky, i386, hppa, m68k,
         microblaze, nios2, sh, powerpc32, and sparc32): it issues
         __NR_fstatat64.

    2.2. 64-bit kABI outliers (mips64 and mips64-n32): it issues
         __NR_newfstatat and convert the result to struct stat64.

It allows to remove all the hidden definitions from the {f,l}xstat{64}
(some are still kept because Hurd requires it).

Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Implement {l}fstat{at} in terms of fstatat
Adhemerval Zanella [Fri, 17 Jul 2020 16:15:37 +0000 (13:15 -0300)]
linux: Implement {l}fstat{at} in terms of fstatat

Both fstatat and fstata64 calls the old fxstatat and fxstatat64
repectivelly with _STAT_VER, the one currently exported as default
for all ABIs.

Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Move the struct stat{64} to struct_stat.h
Adhemerval Zanella [Fri, 17 Jul 2020 12:18:39 +0000 (09:18 -0300)]
linux: Move the struct stat{64} to struct_stat.h

The common definitions are moved to a Linux generic stat.h while the
struct stat{64} definition are moved to a arch-specific struct_stat.h
header.

Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agoRemove mknod wrapper functions, move them to symbols
Adhemerval Zanella [Thu, 16 Jul 2020 19:46:52 +0000 (16:46 -0300)]
Remove mknod wrapper functions, move them to symbols

This patch removes the mknod and mknodat static wrapper and add the
symbols on the libc with the expected names.

Both the prototypes of the internal symbol linked by the static
wrappers and the inline redirectors are also removed from the installed
sys/stat.h header file.  The wrapper implementation license LGPL
exception is also removed since it is no longer statically linked to
binaries.

Internally the _STAT_VER* definitions are moved to the arch-specific
xstatver.h file.

Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agoRemove stat wrapper functions, move them to exported symbols
Adhemerval Zanella [Thu, 16 Jul 2020 14:06:51 +0000 (14:06 +0000)]
Remove stat wrapper functions, move them to exported symbols

This patch removes the stat, stat64, lstat, lstat64, fstat, fstat64,
fstatat, and fstatat64 static wrapper and add the symbol on the libc
with the expected names.

Both the prototypes of the internal symbol linked by the static
wrappers and the inline redirectors are also removed from the installed
sys/stat.h header file.  The wrapper implementation license LGPL
exception is also removed since it is no longer statically linked to
binaries.

Internally the _STAT_VER* definitions are moved to a arch-specific
xstatver.h file.  The internal defines that redirects internals
{f}stat{at} to their {f}xstat{at} counterparts are removed for Linux
(!NO_RTLD_HIDDEN).  Hurd still requires them since {f}stat{at} pulls
extra objects that makes the loader build fail otherwise (I haven't
dig into why exactly).

Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years ago<sys/platform/x86.h>: Add FSRCS/FSRS/FZLRM support
H.J. Lu [Thu, 8 Oct 2020 15:50:44 +0000 (08:50 -0700)]
<sys/platform/x86.h>: Add FSRCS/FSRS/FZLRM support

Add Fast Short REP CMP and SCA (FSRCS), Fast Short REP STO (FSRS) and
Fast Zero-Length REP MOV (FZLRM) support to <sys/platform/x86.h>.

3 years ago<sys/platform/x86.h>: Add Intel HRESET support
H.J. Lu [Thu, 8 Oct 2020 15:38:03 +0000 (08:38 -0700)]
<sys/platform/x86.h>: Add Intel HRESET support

Add Intel HRESET support to <sys/platform/x86.h>.

3 years ago<sys/platform/x86.h>: Add AVX-VNNI support
H.J. Lu [Thu, 8 Oct 2020 15:33:45 +0000 (08:33 -0700)]
<sys/platform/x86.h>: Add AVX-VNNI support

Add AVX-VNNI support to <sys/platform/x86.h>.

3 years ago<sys/platform/x86.h>: Add AVX512_FP16 support
H.J. Lu [Thu, 8 Oct 2020 15:24:47 +0000 (08:24 -0700)]
<sys/platform/x86.h>: Add AVX512_FP16 support

Add AVX512_FP16 support to <sys/platform/x86.h>.

3 years ago<sys/platform/x86.h>: Add Intel UINTR support
H.J. Lu [Thu, 8 Oct 2020 15:19:15 +0000 (08:19 -0700)]
<sys/platform/x86.h>: Add Intel UINTR support

Add Intel UINTR support to <sys/platform/x86.h>.

3 years agoelf: Do not pass GLRO(dl_platform), GLRO(dl_platformlen) to _dl_important_hwcaps
Florian Weimer [Fri, 9 Oct 2020 08:13:14 +0000 (10:13 +0200)]
elf: Do not pass GLRO(dl_platform), GLRO(dl_platformlen) to _dl_important_hwcaps

In the current code, the function can easily obtain the information
on its own.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoelf: Enhance ld.so --help to print HWCAP subdirectories
Florian Weimer [Fri, 9 Oct 2020 08:13:14 +0000 (10:13 +0200)]
elf: Enhance ld.so --help to print HWCAP subdirectories

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoelf: Add library search path information to ld.so --help
Florian Weimer [Fri, 9 Oct 2020 08:13:14 +0000 (10:13 +0200)]
elf: Add library search path information to ld.so --help

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agosunrpc: Adjust RPC function declarations to match Sun's (bug 26686]
Martin Sebor [Thu, 8 Oct 2020 18:53:09 +0000 (12:53 -0600)]
sunrpc: Adjust RPC function declarations to match Sun's (bug 26686]

Building Glibc with the latest GCC 11 shows a number of instances
of the new -Warray-parameter warning designed to encourage
consistency in the forms of array arguments in redeclarations of
the same function (and, ultimately, to enable the detection of out
of bounds accesses via such arguments).

To avoid the subset of these warnings for the RPC APIs, this patch
changes the declarations of these functions to match both their
definitions and the Oracle RPC documentation.

Besides avoiding the -Warray-parameter warnings the effect of this
change is for GCC to issue warnings when either the functions are
passed an array with fewer than MAXNETNAMELEN + 1 elements, or when
the functions themselves access elements outside the array bounds.

3 years agoAvoid GCC 11 -Warray-parameter warnings [BZ #26686].
Martin Sebor [Thu, 8 Oct 2020 18:46:03 +0000 (12:46 -0600)]
Avoid GCC 11 -Warray-parameter warnings [BZ #26686].

Building Glibc with the latest GCC 11 also shows a couple of instances
of the new -Warray-parameter warning in the thread db APIs.

To avoid these, this patch changes the deefinitions of the two functions
to match their definitions.

3 years agoelf: Make __rtld_env_path_list and __rtld_search_dirs global variables
Florian Weimer [Thu, 8 Oct 2020 13:33:00 +0000 (15:33 +0200)]
elf: Make __rtld_env_path_list and __rtld_search_dirs global variables

They have been renamed from env_path_list and rtld_search_dirs to
avoid linknamespace issues.

This change will allow future use these variables in diagnostics.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoelf: Print the full name of the dynamic loader in the ld.so help message
Florian Weimer [Thu, 8 Oct 2020 13:33:00 +0000 (15:33 +0200)]
elf: Print the full name of the dynamic loader in the ld.so help message

This requires defining a macro for the full path, matching the
-Wl,--dynamic-link= arguments used for linking glibc programs,
and ldd script.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoelf: Use the term "program interpreter" in the ld.so help message
Florian Weimer [Thu, 8 Oct 2020 13:33:00 +0000 (15:33 +0200)]
elf: Use the term "program interpreter" in the ld.so help message

This is the term that the ELF standard itself uses.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoscripts/update-copyrights: Update csu/version.c, elf/dl-usage.c
Florian Weimer [Thu, 8 Oct 2020 13:33:00 +0000 (15:33 +0200)]
scripts/update-copyrights: Update csu/version.c, elf/dl-usage.c

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoelf: Implement ld.so --version
Florian Weimer [Thu, 8 Oct 2020 13:33:00 +0000 (15:33 +0200)]
elf: Implement ld.so --version

This prints out version information for the dynamic loader and
exits immediately, without further command line processing
(which seems to match what some GNU tools do).

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Add missing cancellation flags on lockf
Adhemerval Zanella [Thu, 8 Oct 2020 13:27:40 +0000 (10:27 -0300)]
nptl: Add missing cancellation flags on lockf

It also removes CFLAGS-lockf.c duplicate rule.  It fixes
nptl/tst-cancelx16 on mips64-linux-gnu.

3 years agoUpdate mips64 libm-test-ulps
Adhemerval Zanella [Thu, 8 Oct 2020 12:46:00 +0000 (09:46 -0300)]
Update mips64 libm-test-ulps

3 years agoUpdate alpha libm-test-ulps
Adhemerval Zanella [Thu, 8 Oct 2020 12:45:26 +0000 (09:45 -0300)]
Update alpha libm-test-ulps

3 years agoelf: Implement ld.so --help
Florian Weimer [Thu, 8 Oct 2020 08:57:10 +0000 (10:57 +0200)]
elf: Implement ld.so --help

--help processing is deferred to the point where the executable has
been loaded, so that it is possible to eventually include information
from the main executable in the help output.

As suggested in the GNU command-line interface guidelines, the help
message is printed to standard output, and the exit status is
successful.

Handle usage errors closer to the GNU command-line interface
guidelines.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>