Commit Graph

36827 Commits

Author SHA1 Message Date
Florian Weimer
5a664d7ae8 nptl: Move elision implementations into libc
The elision interfaces are closely aligned between the targets that
implement them, so declare them in the generic <lowlevellock.h>
file.

Empty .c stubs are provided, so that fewer makefile updates
under sysdeps are needed.  Also simplify initialization via
__libc_early_init.

The symbols __lll_clocklock_elision, __lll_lock_elision,
__lll_trylock_elision, __lll_unlock_elision, __pthread_force_elision
move into libc.  For the time being, non-hidden references are used
from libpthread to access them, but once that part of libpthread
is moved into libc, hidden symbols will be used again.  (Hidden
references seem desirable to reduce the likelihood of transactions
aborts.)
2021-02-23 14:59:34 +01:00
Samuel Thibault
597d0267b5 NEWS: Add missing bug closures 2021-02-23 13:36:06 +01:00
Paul Zimmermann
90197376d5 added rt to malloc/Depend [BZ #27132]
This avoids a failure when a new glibc version is compiled with an older
system librt. Patch proposed by Florian Weimer.
2021-02-23 10:04:45 +01:00
H.J. Lu
89de9d3958 x86: Use x86/nptl/pthreaddef.h
1. Move sysdeps/i386/nptl/pthreaddef.h to sysdeps/x86/nptl/pthreaddef.h.
2. Remove sysdeps/x86_64/nptl/pthreaddef.h.

Reviewed-by: DJ Delorie <dj@redhat.com>
2021-02-22 15:52:56 -08:00
Florian Weimer
b5be9ae77e nptl: Move futex-internal into libc
This moves  __futex_abstimed_wait64 and
__futex_abstimed_wait_cancelable64 and exports these functions as
GLIBC_PRIVATE.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-02-22 18:30:52 +01:00
Florian Weimer
2f4019de81 nptl: Move lowlevellock into libc [BZ #15648]
And export __lll_lock_wait and __lll_lock_wait_private as
GLIBC_PRIVATE.  This should eliminate the need for the previous
riscv kludge.
2021-02-22 18:30:52 +01:00
Florian Weimer
541e53c9dd nptl: Move futex-internal.c into main nptl directory
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-02-22 18:30:52 +01:00
Florian Weimer
f720ce680e nptl: Reformat Versions
One symbol per line, lexicographically ordered.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-02-22 18:30:52 +01:00
Florian Weimer
3f232aa36d nptl: Split libpthread-routines into one routine per line
And sort the lines lexicographically.  This will make it easier to review
patches which move symbols from libpthread to libc.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-02-22 18:30:52 +01:00
Florian Weimer
feb741bb81 x86: Remove unused variables for raw cache sizes from cacheinfo.h 2021-02-22 17:36:03 +01:00
Joseph Myers
8a7b4dc6d0 Use Linux 5.11 in build-many-glibcs.py.
This patch makes build-many-glibcs.py use Linux 5.11.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2021-02-22 16:11:21 +00:00
H.J. Lu
ba230b6387 <bits/platform/x86.h>: Correct x86_cpu_TBM
x86_cpu_TBM should be x86_cpu_index_80000001_ecx + 21.
2021-02-22 04:31:51 -08:00
H.J. Lu
ebbb8c9f64 x86_64/clone.S: Upate comments 2021-02-22 04:30:38 -08:00
H.J. Lu
f8ff5a3cc2 i386/clone.S: Remove redundant EBX load
There is no neeed for

	call	L(here)
L(here):
	popl	%ebx
	addl	$_GLOBAL_OFFSET_TABLE_+[.-L(here)], %ebx

before

	movl	%eax, %ebx
2021-02-22 04:29:19 -08:00
Szabolcs Nagy
fb37ef6960 aarch64: Remove the unused __read_tp symbol
This was likely a mistake in the original aarch64 port copied over
from arm: on aarch64 tpidr_el0 register is always available.

The __read_tp symbol is visible with static linking, but it's not
part of the public ABI so it should be safe to remove.
2021-02-22 09:17:12 +00:00
Florian Weimer
418f5783d9 build-many-glibcs.py: Use make -O for more consistent log output
The -O option avoids interleaving (e.g.) compiler error messages
with other build messages, and makes attribution of messages to
commands easier.

According to my tests, the impact on build time is within the noise.
2021-02-22 09:39:14 +01:00
Naohiro Tamura
e9e7f24543 configure: Replace obsolete AC_TRY_LINK with AC_LINK_IFELSE
This patch replaces obsolete AC_TRY_LINK with AC_LINK_IFELSE.
It has been confirmed that GNU 'autoconf' 2.69 doesn't change the
'configure' file and suppressed obsolete warning.
2021-02-21 18:39:01 -05:00
Naohiro Tamura
3907c7bf0f configure: Remove obsolete AC_CHECK_TOOL_PREFIX
This patch removes obsolete AC_CHECK_TOOL_PREFIX.
It has been confirmed that AC_CHECK_TOOL_PREFIX is defined as NOP in
GNU 'autoconf' 2.69 [1], so we can safely remove it.
The 'configure' file has been deleted one blank line by the 'autoconf'
2.69 command .

   [1] autoconf-2.69/share/autoconf/autoconf/programs.m4
   181 # AC_CHECK_TOOL_PREFIX
   182 # --------------------
   183 AU_DEFUN([AC_CHECK_TOOL_PREFIX])
2021-02-21 18:35:30 -05:00
Naohiro Tamura
8310307403 configure: Replace obsoleted AC_HELP_STRING with AS_HELP_STRING
This patch replaces obsoleted AC_HELP_STRING with AS_HELP_STRING.
As of Glibc 2.33, INSTALL says "GNU 'autoconf' 2.69 (exactly)" is
required. So we can safely replace obsoleted macro without worrying
about older autoconf.
This change doesn't affect the contents of "configure" file.
2021-02-21 16:29:43 -05:00
Joseph Myers
83908b3a1e Update syscall lists for Linux 5.11.
Linux 5.11 has one new syscall, epoll_pwait2.  Update
syscall-names.list and regenerate the arch-syscall.h headers with
build-many-glibcs.py update-syscalls.

Tested with build-many-glibcs.py.
2021-02-19 21:16:27 +00:00
John David Anglin
96b8038f12 Correct hppa EFD_NONBLOCK, IN_NONBLOCK, SFD_NONBLOCK and TFD_NONBLOCK defines. 2021-02-19 17:08:47 +00:00
Florian Weimer
044e603b69 string: Work around GCC PR 98512 in rawmemchr 2021-02-19 13:29:00 +01:00
Lukasz Majewski
7b15dabfdd tst: time: Provide Y2038 tests for mktime (tst-mktime4.c)
This change adds new test to assess mktime's functionality.

To be more specific - following use cases are checked:
- Pass struct tm as epoch time
- Pass struct tm as value just before Y2038 threshold (returned
  value shall be 0x7FFFFFFF)
- Pass struct tm as the first value after Y2038 threshold
  (expected value - 0x80000000)

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-02-16 20:41:45 +01:00
Lukasz Majewski
13c0b30b24 tst: Provide test for difftime
This change adds new test to assess difftime's functionality by
adding some arbitrary offsets to current time_t value (read via
time).

If 64 bit time_t is supported, the same procedure is applied around
the threshold of Y2038 time overflow.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-02-16 20:37:27 +01:00
Lukasz Majewski
0ca1a95d3b tst: Provide test for ctime
This change adds new test to assess ctime's functionality.

To be more specific - following use cases are checked:
- Pass time_t value as 0 to check if epoch time is converted
- Pass time_t as max value for 32 bit systems
- Pass time_t as the first value after Y2038 threshold

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-02-16 20:36:47 +01:00
Lukasz Majewski
2323a34260 tst: Provide test for sched_rr_get_interval
This change adds new test to assess sched_rr_get_interval's
functionality.

To be more specific - following use cases are checked:
- If the read interval is correct
- If the proper ABI is used - to check if adjacent data is not
  overwritten

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-02-16 20:35:37 +01:00
Stefan Liebler
25251c0707 S390: Add new hwcap values.
The new hwcap values indicate support for arch14 architecture.
2021-02-16 16:31:20 +01:00
Szabolcs Nagy
fb1905eed8 aarch64: Fix sys/ptrace.h if linux headers are included
If the linux asm/ptrace.h is included before sys/ptrace.h that
breaks the newly added declarations there, so undef the names
that may be defined as macros in the linux header.
2021-02-15 13:42:01 +00:00
Florian Weimer
ebcf45a16c elf: Do not copy vDSO soname when setting up link map
The kernel does not put the vDSO at special addresses, so writev can
write the name directly.  Also remove the incorrect comment about not
setting l_name.

Andy Lutomirski confirmed in
<https://lore.kernel.org/linux-api/442A16C0-AE5A-4A44-B261-FE6F817EAF3C@amacapital.net/>
that this copy is not necessary.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-02-12 18:34:03 +01:00
H.J. Lu
ce4a94b12e x86: Remove the extra space between "# endif"
Remove the extra space between "# endif" left over from

commit f380868f6d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Dec 24 15:43:34 2020 -0800

    Remove _ISOMAC check from <cpu-features.h>
2021-02-12 07:50:29 -08:00
Adhemerval Zanella
4458eb1257 hurd: Fix fstatfs build failure
It was added by 1bfbaf7130 where it added a libc_hidden_proto for
__fstatfs but it didn't update the Hurd version as well.

Checked with a build for i686-gnu.
2021-02-11 17:45:24 -03:00
Adhemerval Zanella
7eb3000f9f linux: Remove stat-check.c
The check is moved to LFS fstatat implementation (since it is the
code that actually implements the syscall).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-02-11 08:02:16 -03:00
Adhemerval Zanella
d2fa24f239 linux: Remove overflow.h
The header is not used anywhere.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-02-11 08:01:10 -03:00
Adhemerval Zanella
1566d3c43f linux: Consolidate internal_statvfs
Remove the internal_statvfs64.c and open code the implementation
on internal_statvfs.c.  The alpha is now unrequired, the generic
implementation also handles it.

Also, remove unused includes on internal_statvfs.c, and remove
unused arguments on __internal_statvfs{64}.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-02-11 08:00:48 -03:00
Adhemerval Zanella
52f527d6f1 linux: Consolidate statvfs implementations
There is no need to handle ENOSYS on fstatfs64 call, required only
for alpha (where is already fallbacks to fstatfs).

Checked on x86_64-linux-gnu.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-02-11 08:00:41 -03:00
Adhemerval Zanella
6ea1603d65 linux: Consolidate fstatvfs implementations
There is no need to handle ENOSYS on fstatfs64 call, required only
for alpha (where is already fallbacks to fstatfs).  The wordsize
internal_statvfs64.c is removed, since how the LFS support is
provided by fstatvfs64.c (used on 64-bit architectures as well).

Checked on x86_64-linux-gnu.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-02-11 08:00:28 -03:00
Adhemerval Zanella
f6e616435d linux: Consolidate statfs implementations
The __NR_statfs64 syscall is supported on all architectures but
aarch64, mips64, riscv64, and x86_64.  And newer ABIs also uses
the new statfs64 interface (where the struct size is used as
second argument).

So the default implementation now uses:

  1. __NR_statfs64 for non-LFS call and handle overflow directly
     There is no need to handle __NR_statfs since all architectures
     that only support are LFS only.

  2. __NR_statfs if defined or __NR_statfs64 otherwise for LFS
     call.

Alpha is the only outlier, since it is a 64-bit architecture which
provides non-LFS interface and only provides __NR_statfs64 on
newer kernels (v5.1+).

Checked on x86_64-linux-gnu.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-02-11 08:00:11 -03:00
Adhemerval Zanella
1bfbaf7130 linux: Consolidate fstatfs implementations
The __NR_fstatfs64 syscall is supported on all architectures but
aarch64, mips64, riscv64, and x86_64.  And newer ABIs also uses
the new fstatfs64 interface (where the struct size is used as
first argument).

So the default implementation now uses:

  1. __NR_fstatfs64 for non-LFS call and handle overflow directly
     There is no need to handle __NR_fstatfs since all architectures
     that only support are LFS only.

  2. __NR_fstatfs if defined or __NR_fstatfs64 otherwise for LFS
     call.

Alpha is the only outlier, it is a 64-bit architecture which
provides non-LFS interface and only provides __NR_fstatfs64 on
newer kernels (5.1+).

Checked on x86_64-linux-gnu.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-02-11 07:58:31 -03:00
Adhemerval Zanella
e7702cb56e linux: Set LFS statfs as default
Currently glibc has three different struct statfs{64} definitions:

  1. Non-LFS support where non-LFS and LFS struct have different
     size: alpha, arm, hppa, i686, m68k, microblaze, mips (all abis),
     powerpc32, s390, sh4, and sparc.

  2. Non-LFS support where non-LFS and LFS struct have the same
     size: csky and nios2.

  3. Only LFS support (where both struct have the same size): arc,
     ia64, powerpc64 (including LE), riscv (both 32 and 64 bits),
     s390x, sparc64, and x86 (including x32).

The STATFS_IS_STATFS64/__STATFS_MATCHES_STATFS64 does not tell apart
between 1. and 2. since for both the only difference is the struct
size (for 2. both non-LFS and LFS uses the same syscall, where for
1. the old non-LFS is used for [f]statfs).

This patch move the generic statfs.h for both csky and nios2, and
make the default definitions for newer ABIs to assume that only
LFS will be support (so there is no need to keep no-LFS and LFS
struct statfs with the same size, it will be implicit).

This patch does not change the code generation.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-02-11 07:58:09 -03:00
Adhemerval Zanella
36260d5035 linux: Set default kernel_stat.h to LFS
The XSTAT_IS_XSTAT64 and STAT_IS_KERNEL_STAT flags are now set to 1 and
STATFS_IS_STATFS64 is set to __STATFS_MATCHES_STATFS64.  This makes the
default ABI for newer ports to provide only LFS calls.

A copy of non-LFS support is provided to 32-bit ABIS with non-LFS
support (arm, csky, i386, m68k, nios2, s390, and sh).  Is also allows
to remove the 64-bit ports, which already uses the default values.

This patch does not change the code generation.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-02-11 07:58:05 -03:00
Adhemerval Zanella
4b221ec9ee linux: Fix STATFS_IS_STATFS64 definition
aarch64, arc, ia64, mips64, powerpc64, riscv32, riscv64, s390x, sparc64,
and x86_64 defines STATFS_IS_STATFS64 to 0, but all of them alias
statfs to statfs64 and the struct statfs has the same and layout of
struct statfs64.

The correct definition will be used on the [f]statfs[64] consolidation.

This patch does not change code generation since the symbols are
implemented using the auto-generation syscall for all the aforementioned
ABIs.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-02-11 07:57:57 -03:00
Siddhesh Poyarekar
228f30ab47 tunables: Disallow negative values for some tunables
The glibc.malloc.mmap_max tunable as well as al of the INT_32 tunables
don't have use for negative values, so pin the hardcoded limits in the
non-negative range of INT.  There's no real benefit in any of those
use cases for the extended range of unsigned, so I have avoided added
a new type to keep things simple.
2021-02-10 19:08:33 +05:30
Siddhesh Poyarekar
a1b8b06a55 x86: Use SIZE_MAX instead of (long int)-1 for tunable range value
The tunable types are SIZE_T, so set the ranges to the correct maximum
value, i.e. SIZE_MAX.
2021-02-10 19:08:33 +05:30
Siddhesh Poyarekar
61117bfa1b tunables: Simplify TUNABLE_SET interface
The TUNABLE_SET interface took a primitive C type argument, which
resulted in inconsistent type conversions internally due to incorrect
dereferencing of types, especialy on 32-bit architectures.  This
change simplifies the TUNABLE setting logic along with the interfaces.

Now all numeric tunable values are stored as signed numbers in
tunable_num_t, which is intmax_t.  All calls to set tunables cast the
input value to its primitive type and then to tunable_num_t for
storage.  This relies on gcc-specific (although I suspect other
compilers woul also do the same) unsigned to signed integer conversion
semantics, i.e. the bit pattern is conserved.  The reverse conversion
is guaranteed by the standard.
2021-02-10 19:08:33 +05:30
Xiaoming Ni
e604a5e4bb setrlimit/getrlimit: Use __nonnull to avoid null pointer
Add __nonnull((2)) to the setrlimit()/getrlimit() function declaration
to avoid null pointer access.

-----
v2
  According to the suggestions of the Adhemerval Zanella and Zack Weinberg:
    use __nonnull() to check null pointers in the compilation phase.
    do not add pointer check code to setrlimit()/getrlimit().
    The validity of the "resource" parameter is checked in the syscall.
v1
  https://public-inbox.org/libc-alpha/20201230114131.47589-1-nixiaoming@huawei.com/
-----
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-02-10 08:36:17 -03:00
Naohiro Tamura
7960c5eea9 benchtests: Updated json bench-variant attribute
This patch updates json "bench-variant" attribute of "bench-memset.c"
to "default" so that the script "benchtests/scripts/plot_strings.py"
can generate a file "memset_time_default_linear.png".
Without this patch, the script "benchtests/scripts/plot_strings.py"
generates a file "memset_time__linear.png" which has inconsistent form
with "memcpy_time_default_linear.png" and
"memmove_time_default_linear.png".
2021-02-10 08:50:26 +05:30
Adhemerval Zanella
36c604ed36 regex: stop using alloca
It syncs with gnulib version 87ed1f9c4.  No functional changes is
expected.

Checked on x86_64-linux-gnu.
2021-02-09 16:58:16 -03:00
Adhemerval Zanella
f3e5c7262e regexec: remove alloca usage in build_trtable
It syncs with gnulib version 1731fef3d.  On build_trtable prevent
inlining, so that it doesn't bloat the caller's stack and use auto
variables instead of alloca/malloc.

After these changes, build_trtable's total stack allocation is
only 20 KiB on a 64-bit machine, and this is less than glibc's 64
KiB cutoff so there's little point to using alloca to shrink it.

Checked on x86_64-linux-gnu.
2021-02-09 16:57:56 -03:00
Adhemerval Zanella
f0908ba118 regex: remove alloca usage on regex set_regs
It syncs with gnulib version b6207ab38.  It replaces the regmatch_t
with a dynarray list.

Checked on x86_64-linux-gnu.
2021-02-09 16:57:55 -03:00
Adhemerval Zanella
de0e1b45b0 malloc: Sync dynarray with gnulib
It syncs with gnulib version a8bac4d49.  The main changes are:

  - Remove the usage of anonymous union within DYNARRAY_STRUCT.
  - Use DYNARRAY_FREE instead of DYNARRAY_NAME (free) so that
    Gnulib does not change 'free' to 'rpl_free'.
  - Use __nonnull instead of __attribute__ ((nonnull ())).
  - Use __attribute_maybe_unused__ instead of
    __attribute__ ((unused, nonnull (1))).
  - Use of _Noreturn instead of _attribute__ ((noreturn)).

The only difference with gnulib is:

--- glibc
+++ gnulib
@@ -18,6 +18,7 @@

 #include <dynarray.h>
 #include <stdio.h>
+#include <stdlib.h>

 void
 __libc_dynarray_at_failure (size_t size, size_t index)
@@ -27,7 +28,6 @@
   __snprintf (buf, sizeof (buf), "Fatal glibc error: "
               "array index %zu not less than array length %zu\n",
               index, size);
- __libc_fatal (buf);
 #else
  abort ();
 #endif

It seems a wrong sync from gnulib (the code is used on loader and
thus it requires __libc_fatal instead of abort).

Checked on x86_64-linux-gnu.
2021-02-09 16:57:54 -03:00