]> sourceware.org Git - glibc.git/log
glibc.git
3 years agobenchtests: Add ilogb* tests
Raphael Moreira Zinsly [Thu, 3 Dec 2020 13:41:02 +0000 (10:41 -0300)]
benchtests: Add ilogb* tests

Add a benchtest to ilogb, ilogbf and ilogbf128 based on the logb* benchtests.

3 years agopowerpc: Add optimized llogb* for POWER9
Raphael Moreira Zinsly [Thu, 25 Feb 2021 12:58:52 +0000 (09:58 -0300)]
powerpc: Add optimized llogb* for POWER9

The POWER9 builtins used to improve the ilogb* functions can be
used in the llogb* functions as well.

3 years agopowerpc: Add optimized ilogb* for POWER9
Raphael Moreira Zinsly [Tue, 23 Feb 2021 17:14:37 +0000 (14:14 -0300)]
powerpc: Add optimized ilogb* for POWER9

The instructions xsxexpdp and xsxexpqp introduced on POWER9 extract
the exponent from a double-precision and quad-precision floating-point
respectively, thus they can be used to improve ilogb, ilogbf and ilogbf128.

3 years agoglibcymbols.read_abilist: Add check for duplicate symbols
Florian Weimer [Tue, 16 Mar 2021 14:56:50 +0000 (15:56 +0100)]
glibcymbols.read_abilist: Add check for duplicate symbols

This detects some bogus abilist files.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoscripts/glibcsymbols.py: Extract from scripts/move-symbol-to-libc.py
Florian Weimer [Tue, 16 Mar 2021 14:56:50 +0000 (15:56 +0100)]
scripts/glibcsymbols.py: Extract from scripts/move-symbol-to-libc.py

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoLegacy unwinder: Remove definition of _Unwind_GetCFA
Florian Weimer [Tue, 16 Mar 2021 14:33:09 +0000 (15:33 +0100)]
Legacy unwinder: Remove definition of _Unwind_GetCFA

It is not actually used by the legacy unwinder linked into
libc.so, and it conflicts with the unwind-link functionality
in libpthread.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agosupport: Pass environ to child process
Siddhesh Poyarekar [Mon, 15 Mar 2021 11:53:30 +0000 (17:23 +0530)]
support: Pass environ to child process

Pass environ to posix_spawn so that the child process can inherit
environment of the test.

3 years agopowerpc: Update libm-test-ulps
Matheus Castanho [Mon, 1 Mar 2021 20:07:27 +0000 (14:07 -0600)]
powerpc: Update libm-test-ulps

Generated with 'make regen-ulps' on POWER8.

Tested on powerpc, powerpc64, and powerpc64le

3 years agoBuild libc-start with stack protector for SHARED
Siddhesh Poyarekar [Mon, 15 Mar 2021 14:55:00 +0000 (20:25 +0530)]
Build libc-start with stack protector for SHARED

This does not change the emitted code since __libc_start_main does not
return, but is important for formal flags compliance.

This also cleans up the cosmetic inconsistency in the stack protector
flags in csu, especially the incorrect value of STACK_PROTECTOR_LEVEL.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoBuild get-cpuid-feature-leaf.c without stack-protector [BZ #27555]
Siddhesh Poyarekar [Mon, 15 Mar 2021 14:54:45 +0000 (20:24 +0530)]
Build get-cpuid-feature-leaf.c without stack-protector [BZ #27555]

__x86_get_cpuid_feature_leaf is called during early startup, before
the stack check guard is initialized and is hence not safe to build
with stack-protector.

Additionally, IFUNC resolvers for static tst-ifunc-isa tests get
called too early for stack protector to be useful, so fix them to
disable stack protector for the resolver functions.

This fixes all failures seen with --enable-stack-protector=all
configuration.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoAdd inhibit_stack_protector to ifuncmain9 [BZ #25680]
David Hughes [Mon, 15 Mar 2021 14:53:39 +0000 (20:23 +0530)]
Add inhibit_stack_protector to ifuncmain9 [BZ #25680]

Enabling --enable-stack-protector=all causes the following tests to fail:

    FAIL: elf/ifuncmain9picstatic
    FAIL: elf/ifuncmain9static

Nick Alcock (who committed the stack protector code) marked the IFUNC
resolvers with inhibit_stack_protector when he done the original work and
suggested doing so again @ BZ #25680. This patch adds
inhibit_stack_protector to ifuncmain9.

After patch is applied, --enable-stack-protector=all does not fail the
above tests.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agosupport: Typo and formatting fixes
Siddhesh Poyarekar [Mon, 15 Mar 2021 10:30:06 +0000 (16:00 +0530)]
support: Typo and formatting fixes

- Add a newline to the end of error messages in transfer().
- Fixed the name of support_subprocess_init().

3 years agoelf: ld.so --help calls _dl_init_paths without a main map [BZ #27577]
Florian Weimer [Mon, 15 Mar 2021 09:33:43 +0000 (10:33 +0100)]
elf: ld.so --help calls _dl_init_paths without a main map [BZ #27577]

In this case, use the link map of the dynamic loader itself as
a replacement.  This is more than just a hack: if we ever support
DT_RUNPATH/DT_RPATH for the dynamic loader, reporting it for
ld.so --help (without further command line arguments) would be the
right thing to do.

Fixes commit 332421312576bd7095e70589154af99b124dd2d1 ("elf: Always
set l in _dl_init_paths (bug 23462)").

3 years agox86: Handle _SC_LEVEL1_ICACHE_LINESIZE [BZ #27444]
H.J. Lu [Sat, 6 Mar 2021 18:19:32 +0000 (10:19 -0800)]
x86: Handle _SC_LEVEL1_ICACHE_LINESIZE [BZ #27444]

commit 2d651eb9265d1366d7b9e881bfddd46db9c1ecc4
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Sep 18 07:55:14 2020 -0700

    x86: Move x86 processor cache info to cpu_features

missed _SC_LEVEL1_ICACHE_LINESIZE.

1. Add level1_icache_linesize to struct cpu_features.
2. Initialize level1_icache_linesize by calling handle_intel,
handle_zhaoxin and handle_amd with _SC_LEVEL1_ICACHE_LINESIZE.
3. Return level1_icache_linesize for _SC_LEVEL1_ICACHE_LINESIZE.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 years agoelf: Always set l in _dl_init_paths (bug 23462)
Carlos O'Donell [Fri, 12 Mar 2021 15:44:47 +0000 (16:44 +0100)]
elf: Always set l in _dl_init_paths (bug 23462)

After d1d5471579eb0426671bf94f2d71e61dfb204c30 ("Remove dead
DL_DST_REQ_STATIC code.") we always setup the link map l to make the
static and shared cases the same.  The bug is that in elf/dl-load.c
(_dl_init_paths) we conditionally set l only in the #ifdef SHARED
case, but unconditionally use it later.  The simple solution is to
remove the #ifdef SHARED conditional, because it's no longer needed,
and unconditionally setup l for both the static and shared cases. A
regression test is added to run a static binary with
LD_LIBRARY_PATH='$ORIGIN' which crashes before the fix and runs after
the fix.

Co-Authored-By: Florian Weimer <fweimer@redhat.com>
3 years agos390x: Regenerate ULPs.
Stefan Liebler [Fri, 12 Mar 2021 13:31:49 +0000 (14:31 +0100)]
s390x: Regenerate ULPs.

Updates needed after recent commit:
db3f7bb5586392d9809fc6397c7184983aed6008
"math: Remove slow paths from asin and acos [BZ #15267]"
Compre to the required ulps update for x86_64.

3 years agosupport: Add xpthread_kill
Adhemerval Zanella [Wed, 20 Jan 2021 17:32:23 +0000 (14:32 -0300)]
support: Add xpthread_kill

Checked on x86_64-linux-gnu.

3 years agonptl: Move fork into libc
Adhemerval Zanella [Tue, 19 Jan 2021 12:18:46 +0000 (09:18 -0300)]
nptl: Move fork into libc

This is part of the libpthread removal project:

   <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html>

Checked on x86_64-linux-gnu.

3 years agolinux: Use __libc_single_threaded on fork
Adhemerval Zanella [Mon, 18 Jan 2021 18:32:02 +0000 (15:32 -0300)]
linux: Use __libc_single_threaded on fork

Checked on x86_64-linux-gnu.

3 years agoposix: Consolidate register-atfork
Adhemerval Zanella [Mon, 18 Jan 2021 18:10:02 +0000 (15:10 -0300)]
posix: Consolidate register-atfork

Both htl and nptl uses a different data structure to implement atfork
handlers.  The nptl one was refactored by 27761a1042d to use a dynarray
which simplifies the code.

This patch moves the nptl one to be the generic implementation and
replace Hurd linked one.  Different than previous NPTL, Hurd also uses
a global lock, so performance should be similar.

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

3 years agonptl: Move Linux pthread_kill to nptl
Adhemerval Zanella [Thu, 3 Dec 2020 14:28:58 +0000 (11:28 -0300)]
nptl: Move Linux pthread_kill to nptl

The nptl already expects a Linux syscall internally.  Also
__is_internal_signal is used and the DEBUGGING_P check is removed.

Checked on x86_64-linux-gnu.

3 years agoio: Return UNSUPPORTED if filesystem do not support 64 bit timestamps
Adhemerval Zanella [Thu, 11 Mar 2021 12:30:33 +0000 (09:30 -0300)]
io: Return UNSUPPORTED if filesystem do not support 64 bit timestamps

Some Linux filesystems might not fully support 64 bit timestamps [1],
which make some Linux specific tests to fail when they check for the
functionality.

This patch adds a new libsupport function, support_path_support_time64,
that returns whether the target file supports or not 64 bit timestamps.
The support is checked by issuing a utimensat and verifying both the
last access and last modification time against a statx call.

The tests that might fail are also adjusted to check the file support
as well:

  $ dd if=/dev/zero of=loopbackfile.img bs=100M count=1
  1+0 records in
  1+0 records out
  104857600 bytes (105 MB, 100 MiB) copied, 0,0589568 s, 1,8 GB/s
  $ sudo losetup -fP loopbackfile.img
  $ mkfs.xfs loopbackfile.img
  meta-data=loopbackfile.img       isize=512    agcount=4, agsize=6400 blks
           =                       sectsz=512   attr=2, projid32bit=1
           =                       crc=1        finobt=1, sparse=1, rmapbt=0
           =                       reflink=1
  data     =                       bsize=4096   blocks=25600, imaxpct=25
           =                       sunit=0      swidth=0 blks
  naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
  log      =internal log           bsize=4096   blocks=1368, version=2
           =                       sectsz=512   sunit=0 blks, lazy-count=1
  realtime =none                   extsz=4096   blocks=0, rtextents=0
  $ mkdir loopfs
  $ sudo mount -o loop /dev/loop0 loopfs/
  $ sudo chown -R azanella:azanella loopfs
  $ TMPDIR=loopfs/ ./testrun.sh misc/tst-utimes
  error: ../sysdeps/unix/sysv/linux/tst-utimes.c:55: File loopfs//utimesfECsK1 does not support 64-bit timestamps

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1795576

3 years agotest-container: Always copy test-specific support files [BZ #27537]
DJ Delorie [Thu, 11 Mar 2021 17:50:02 +0000 (12:50 -0500)]
test-container: Always copy test-specific support files [BZ #27537]

There's a small chance that a fresh checkout will result in some of
the test-specific container files will have the same timestamp and
size, which breaks the rsync logic in test-container, resulting in
tests running with the wrong support files.

This patch changes the rsync logic to always copy the test-specific
files, which normally would always be copied anyway.  The rsync logic
for the testroot itself is unchanged.

3 years agomath: Remove mpa files (part 2) [BZ #15267]
Wilco Dijkstra [Thu, 11 Mar 2021 15:36:14 +0000 (15:36 +0000)]
math: Remove mpa files (part 2) [BZ #15267]

Previous commit was missing deleted files in sysdeps/ieee754/dbl-64.

Finally remove all mpa related files, headers, declarations, probes, unused
tables and update makefiles.

Reviewed-By: Paul Zimmermann <Paul.Zimmermann@inria.fr>
3 years agomath: Remove mpa files [BZ #15267]
Wilco Dijkstra [Wed, 10 Mar 2021 12:41:47 +0000 (12:41 +0000)]
math: Remove mpa files [BZ #15267]

Finally remove all mpa related files, headers, declarations, probes, unused
tables and update makefiles.

Reviewed-By: Paul Zimmermann <Paul.Zimmermann@inria.fr>
3 years agomath: Remove slow paths from atan2 [BZ #15267]
Wilco Dijkstra [Wed, 10 Mar 2021 12:41:20 +0000 (12:41 +0000)]
math: Remove slow paths from atan2 [BZ #15267]

Remove slow paths from atan2. Add ULP annotations.

Reviewed-By: Paul Zimmermann <Paul.Zimmermann@inria.fr>
3 years agomath: Remove slow paths from atan [BZ #15267]
Wilco Dijkstra [Wed, 10 Mar 2021 12:40:56 +0000 (12:40 +0000)]
math: Remove slow paths from atan [BZ #15267]

Remove slow paths from atan. Add ULP annotations.

Reviewed-By: Paul Zimmermann <Paul.Zimmermann@inria.fr>
3 years agomath: Remove slow paths in tan [BZ #15267]
Wilco Dijkstra [Wed, 10 Mar 2021 12:40:26 +0000 (12:40 +0000)]
math: Remove slow paths in tan [BZ #15267]

Remove slow paths in tan. Add ULP annotations. Merge 'number' into 'mynumber'.
Remove unused entries from tan constants.

Reviewed-By: Paul Zimmermann <Paul.Zimmermann@inria.fr>
3 years agomath: Remove slow paths from asin and acos [BZ #15267]
Wilco Dijkstra [Wed, 10 Mar 2021 12:39:56 +0000 (12:39 +0000)]
math: Remove slow paths from asin and acos [BZ #15267]

This patch series removes all remaining slow paths and related code.
First asin/acos, tan, atan, atan2 implementations are updated, and the final
patch removes the unused mpa files, headers and probes. Passes buildmanyglibc.

Remove slow paths from asin/acos. Add ULP annotations based on previous slow
path checks (which are approximate). Update AArch64 and x86_64 libm-test-ulps.

Reviewed-By: Paul Zimmermann <Paul.Zimmermann@inria.fr>
3 years agoio: Return EBAFD for negative file descriptor on fstat (BZ #27559)
Adhemerval Zanella [Thu, 11 Mar 2021 11:21:06 +0000 (08:21 -0300)]
io: Return EBAFD for negative file descriptor on fstat (BZ #27559)

Now that fstat is implemented on top fstatat we need to handle negative
inputs.  The implementation now rejects AT_FDCWD, which would otherwise
be accepted by the kernel.

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

3 years agoAllow gdb version 10 in pretty printer tests.
Stefan Liebler [Thu, 11 Mar 2021 09:45:15 +0000 (10:45 +0100)]
Allow gdb version 10 in pretty printer tests.

With gdb 10, the pretty printer tests are UNSUPPORTED::
The gdb version string (gdb -v) is incorrectly formatted.

This is observable in:
nptl/test-cond-printers, nptl/test-condattr-printers,
nptl/test-mutex-printers, nptl/test-mutexattr-printers,
nptl/test-rwlock-printers, nptl/test-rwlockattr-printers

After updating the regexp and building with debug-info,
all those tests are passing.

3 years agoUpdate kernel version to 5.11 in tst-mman-consts.py.
Joseph Myers [Wed, 10 Mar 2021 14:26:57 +0000 (14:26 +0000)]
Update kernel version to 5.11 in tst-mman-consts.py.

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

Tested with build-many-glibcs.py.

3 years agoLinux: misc/tst-ofdlocks-compat can be a regular test
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
Linux: misc/tst-ofdlocks-compat can be a regular test

Now that compat_symbol_reference works in non-internal tests.
Also do not build and run the test at all on architectures which
do not have the pre-2.28 symbol version of fcntl.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoLinux: dirent/tst-readdir64-compat can be a regular test
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
Linux: dirent/tst-readdir64-compat can be a regular test

compat_symbol_reference works in non-internal tests now.  Also
avoid building the test for unsupported configurations at all.
I verified by building with build-many-glibcs.py that GLIBC_2.1.3
works as the predecessor of GLIBC_2.2.  (Symbol versions in
the early days are complex.)

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agosunrpc: tst-svc_register can be a regular test
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
sunrpc: tst-svc_register can be a regular test

Now that compat_symbol_reference is not restricted to internal tests
anymore.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoresolv: tst-p_secstodate can be a regular test
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
resolv: tst-p_secstodate can be a regular test

Now that compat_symbol_reference works for non-internal tests, too.
Also do not build and run the tests on architectures which lack the
__p_secstodate compatibility symbol.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoposix: tst-spawn4-compat can be a regular test
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
posix: tst-spawn4-compat can be a regular test

compat_symbol_reference now works for non-internal tests, too.
Also stop building and running the tests on those architectures
that lack the test symbol versions.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoposix: tst-glob_lstat_compat no longer needs to be an internal test
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
posix: tst-glob_lstat_compat no longer needs to be an internal test

compat_symbol_reference is now available for regular tests as well.
Also avoid building and running the tests in case the pre-2.27
symbol version of glob is not available.  This avoids a spurious
UNSUPPORTED result.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agomath: test-matherr and test-matherr-2 can be regular tests
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
math: test-matherr and test-matherr-2 can be regular tests

compat_symbol_reference is now available without tests-internal.
Do not build the test at all on glibc versions that lack the symbols,
to avoid spurious UNSUPPORTED results.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agomath: $(libm-tests-compat) can be regular tests
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
math: $(libm-tests-compat) can be regular tests

tests-internal is no longer needed because compat_symbol_reference
now works in regular tests.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agomalloc: Turn tst-mallocstate into a non-internal test
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
malloc: Turn tst-mallocstate into a non-internal test

compat_symbol_reference no longer needs tests-internal.  Do not build
the test at all for newer targets, so that no spurious UNSUPPORTED
result is generated.  Use compat_symbol_reference for
__malloc_initialize_hook as well, eliminating the need for -rdynamic.

Reviewed-by: DJ Delorie <dj@redhat.com>
3 years ago<shlib-compat.h>: Support compat_symbol_reference for _ISOMAC
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
<shlib-compat.h>: Support compat_symbol_reference for _ISOMAC

This is helpful for testing compat symbols in cases where _ISOMAC
is activated implicitly due to -DMODULE_NAME=testsuite and cannot
be disabled easily.

3 years agonss: fix nss_database_lookup2's alternate handling [BZ #27416]
DJ Delorie [Tue, 16 Feb 2021 02:34:23 +0000 (21:34 -0500)]
nss: fix nss_database_lookup2's alternate handling [BZ #27416]

__nss_database_lookup2's extra arguments were left unused in the
nsswitch reloading patch set; this broke compat (default config
ignored) and shadow files (secondary name ignored) which relies on
these fallbacks.

This patch adds in the previous behavior by correcting the
initialization of the database list to reflect the fallbacks.  This
means that the nss_database_lookup2 interface no longer needs to be
passed the fallback info, so API and callers were adjusted.

Since all callers needed to be edited anyway, the calls were changed
from __nss_database_lookup2 to the faster __nss_database_get.  This
was an intended optimization which was deferred during the initial
lookup changes to avoid touching so many files.

The test case verifies that compat targets work (passwd) and that the
default configuration works (group).  Tested on x86-64.

3 years agoNEWS: Add entry for CVE-2021-27645
DJ Delorie [Wed, 3 Mar 2021 19:52:57 +0000 (14:52 -0500)]
NEWS: Add entry for CVE-2021-27645

3 years agotst: Add test for settimeofday
Lukasz Majewski [Sun, 7 Mar 2021 12:11:55 +0000 (13:11 +0100)]
tst: Add test for settimeofday

This code brings test to check if time on target machine is properly set.
To avoid any issues with altering the time:

- The time, which was set before the test was executed is restored.

- The time is altered only when cross-test-ssh.sh is executed with
  --allow-time-setting flag

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agotst: Add test for ntp_adjtime
Lukasz Majewski [Sun, 28 Feb 2021 22:26:21 +0000 (23:26 +0100)]
tst: Add test for ntp_adjtime

This test is a wrapper on tst-clock_adjtime test.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agotst: Add test for adjtimex
Lukasz Majewski [Sun, 28 Feb 2021 22:03:48 +0000 (23:03 +0100)]
tst: Add test for adjtimex

This test is a wrapper on tst-clock_adjtime test.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agotst: Modify tst-clock_adjtime to allow reuse of its code
Lukasz Majewski [Sun, 28 Feb 2021 22:02:54 +0000 (23:02 +0100)]
tst: Modify tst-clock_adjtime to allow reuse of its code

The tst-clock_adjtime can be adjusted to be reused for also testing
adjtimex.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agotst: Add test for clock_adjtime
Lukasz Majewski [Wed, 20 Jan 2021 11:10:42 +0000 (12:10 +0100)]
tst: Add test for clock_adjtime

This code privides test to check if time on target machine is properly
adjusted.
The time is altered only when cross-test-ssh.sh is executed with
--allow-time-setting flag.
As the delta added to CLOCK_REALTIME is only 1 sec the original time is
not restored and further tests are executed with this bias.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agotst: Add test for clock_settime
Lukasz Majewski [Mon, 18 Jan 2021 15:59:23 +0000 (16:59 +0100)]
tst: Add test for clock_settime

This code brings test to check if time on target machine is properly set.
To avoid any issues with altering the time:

- The time, which was set before the test was executed is restored.

- The time is altered only when cross-test-ssh.sh is executed with
  --allow-time-setting flag

Reviewed-by: DJ Delorie <dj@redhat.com>
3 years agosupport: Provide xclock_settime test helper function
Lukasz Majewski [Mon, 18 Jan 2021 15:53:26 +0000 (16:53 +0100)]
support: Provide xclock_settime test helper function

The xclock_settime is a wrapper function on the clock_settime syscall
to be used in the test code.

It checks if the GLIBC_TEST_ALLOW_TIME_SETTING env variable is defined
in the environment in which test is executed. If it is not - the test
ends as unsupported. Otherwise, the clock-settime is executed and return
value is assessed.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agotst: Extend cross-test-ssh.sh to specify if target date can be altered
Lukasz Majewski [Fri, 15 Jan 2021 15:40:39 +0000 (16:40 +0100)]
tst: Extend cross-test-ssh.sh to specify if target date can be altered

This code adds new flag - '--allow-time-setting' to cross-test-ssh.sh
script to indicate if it is allowed to alter the date on the system
on which tests are executed. This change is supposed to be used with
test systems, which use virtual machines for testing.

The GLIBC_TEST_ALLOW_TIME_SETTING env variable is exported to the
remote environment on which the eligible test is run and brings no
functional change when it is not.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoUpdate hppa libm-test-ulps
John David Anglin [Sun, 7 Mar 2021 17:23:34 +0000 (17:23 +0000)]
Update hppa libm-test-ulps

3 years agox86: Set minimum x86-64 level marker [BZ #27318]
H.J. Lu [Tue, 2 Feb 2021 21:45:58 +0000 (13:45 -0800)]
x86: Set minimum x86-64 level marker [BZ #27318]

Since the full ISA set used in an ELF binary is unknown to compiler,
an x86-64 ISA level marker indicates the minimum, not maximum, ISA set
required to run such an ELF binary.  We never guarantee a library with
an x86-64 ISA level v3 marker doesn't contain other ISAs beyond x86-64
ISA level v3, like AVX VNNI.  We check the x86-64 ISA level marker for
the minimum ISA set.  Since -march=sandybridge enables only some ISAs
in x86-64 ISA level v3, we should set the needed ISA marker to v2.
Otherwise, libc is compiled with -march=sandybridge will fail to run on
Sandy Bridge:

$ ./elf/ld.so ./libc.so
./libc.so: (p) CPU ISA level is lower than required: needed: 7; got: 3

Set the minimum, instead of maximum, x86-64 ISA level marker should have
no impact on the glibc-hwcaps directory assignment logic in ldconfig nor
ld.so.

3 years agoposix: glob, glob64 should not be declared __THROW [BZ #27522]
Florian Weimer [Fri, 5 Mar 2021 11:02:20 +0000 (12:02 +0100)]
posix: glob, glob64 should not be declared __THROW [BZ #27522]

These functions invoke callbacks with GLOB_ALTDIRFUNC, so they
are not leaf functions (as implied by _THROW).  Use __THROWNL
and __REDIRECT_NTHNL to express this.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Fix __pthread_clockjoin_np64 __pthread_timedjoin_np64 hidden proto
Adhemerval Zanella [Wed, 17 Feb 2021 14:10:52 +0000 (11:10 -0300)]
nptl: Fix __pthread_clockjoin_np64 __pthread_timedjoin_np64 hidden proto

They are both implemented in libpthread instead of libc.

3 years agolinux: Fix __thrd_sleep64 hidden definition
Adhemerval Zanella [Thu, 25 Feb 2021 23:43:13 +0000 (20:43 -0300)]
linux: Fix __thrd_sleep64 hidden definition

The symbol is exported by libc.

3 years agoUpdate arm libm-test-ulps
Adhemerval Zanella [Thu, 4 Mar 2021 19:12:42 +0000 (19:12 +0000)]
Update arm libm-test-ulps

3 years agoUpdate sparc libm-test-ulps
Adhemerval Zanella [Thu, 4 Mar 2021 20:40:20 +0000 (14:40 -0600)]
Update sparc libm-test-ulps

3 years ago[PATCH] pthread_once hangs when init routine throws an exception [BZ #18435]
Jakub Jelinek [Thu, 4 Mar 2021 14:15:33 +0000 (15:15 +0100)]
[PATCH] pthread_once hangs when init routine throws an exception [BZ #18435]

This is another attempt at making pthread_once handle throwing exceptions
from the init routine callback.  As the new testcases show, just switching
to the cleanup attribute based cleanup does fix the tst-once5 test, but
breaks the new tst-oncey3 test.  That is because when throwing exceptions,
only the unwind info registered cleanups (i.e. C++ destructors or cleanup
attribute), when cancelling threads and there has been unwind info from the
cancellation point up to whatever needs cleanup both unwind info registered
cleanups and THREAD_SETMEM (self, cleanup, ...) registered cleanups are
invoked, but once we hit some frame with no unwind info, only the
THREAD_SETMEM (self, cleanup, ...) registered cleanups are invoked.
So, to stay fully backwards compatible (allow init routines without
unwind info which encounter cancellation points) and handle exception throwing
we actually need to register the pthread_once cleanups in both unwind info
and in the THREAD_SETMEM (self, cleanup, ...) way.
If an exception is thrown, only the former will happen and we in that case
need to also unregister the THREAD_SETMEM (self, cleanup, ...) registered
handler, because otherwise after catching the exception the user code could
call deeper into the stack some cancellation point, get cancelled and then
a stale cleanup handler would clobber stack and probably crash.
If a thread calling init routine is cancelled and unwind info ends before
the pthread_once frame, it will be cleaned up through self->cleanup as
before.  And if unwind info is present, unwind_stop first calls the
self->cleanup registered handler for the frame, then it will call the
unwind info registered handler but that will already see __do_it == 0
and do nothing.

3 years agopowerpc: Regenerate ulps
Florian Weimer [Wed, 3 Mar 2021 17:39:17 +0000 (18:39 +0100)]
powerpc: Regenerate ulps

This time on a POWER8 machine.

3 years agos390x: Regenerate ulps
Arjun Shankar [Wed, 3 Mar 2021 11:22:08 +0000 (12:22 +0100)]
s390x: Regenerate ulps

For new test cases in commit 5a051454a9b5.

3 years agonss: Re-enable NSS module loading after chroot [BZ #27389]
DJ Delorie [Thu, 18 Feb 2021 20:26:30 +0000 (15:26 -0500)]
nss: Re-enable NSS module loading after chroot [BZ #27389]

The glibc 2.33 release enabled /etc/nsswitch.conf reloading,
and to prevent potential security issues like CVE-2019-14271
the re-loading of nsswitch.conf and all mdoules was disabled
when the root filesystem changes (see bug 27077).

Unfortunately php-lpfm and openldap both require the ability
to continue to load NSS modules after chroot. The packages
do not exec after the chroot, and so do not cause the
protections to be reset. The only solution is to re-enable
only NSS module loading (not nsswitch.conf reloading) and so
get back the previous glibc behaviour.

In the future we may introduce a way to harden applications
so they do not reload NSS modules once the root filesystem
changes, or that only files/dns are available pre-loaded
(or builtin).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 years agonscd: Fix double free in netgroupcache [BZ #27462]
DJ Delorie [Thu, 25 Feb 2021 21:08:21 +0000 (16:08 -0500)]
nscd: Fix double free in netgroupcache [BZ #27462]

In commit 745664bd798ec8fd50438605948eea594179fba1 a use-after-free
was fixed, but this led to an occasional double-free.  This patch
tracks the "live" allocation better.

Tested manually by a third party.

Related: RHBZ 1927877

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 years agotst: Fix tst-timerfd test
Lukasz Majewski [Sun, 28 Feb 2021 16:28:48 +0000 (17:28 +0100)]
tst: Fix tst-timerfd test

There were following problems discovered for tst-timerfd test:

1. Do not set the struct itimerspec's it_interval tv_sec to 2 seconds.
After this change the timerfd will trigger only once (the it_value is
only set in this case).

2. The 'val1' variable (including the call to timerfd_gettime) is not
needed anymore, as it is just enough to read the struct itimerspec
after sleep. As a consequence the 'val2' has been renamed to 'val'.

3. After calling timerfd_gettime, the value of struct itimerspec time,
when timer is running, is the remaining time. In the case of this test
it would be less than 1 second.
As a result the TEST_COMPARE macro logic had to be adjusted.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoi386: Regenerate ulps
Florian Weimer [Tue, 2 Mar 2021 14:41:29 +0000 (15:41 +0100)]
i386: Regenerate ulps

3 years agox86: Add CPU-specific diagnostics to ld.so --list-diagnostics
Florian Weimer [Wed, 24 Feb 2021 12:12:04 +0000 (13:12 +0100)]
x86: Add CPU-specific diagnostics to ld.so --list-diagnostics

3 years agox86: Automate generation of PREFERRED_FEATURE_INDEX_1 bitfield
Florian Weimer [Tue, 2 Mar 2021 13:58:05 +0000 (14:58 +0100)]
x86: Automate generation of PREFERRED_FEATURE_INDEX_1 bitfield

Use a .def file to define the bitfield layout, so that it is possible
to iterate over field members using the preprocessor.

3 years agold.so: Implement the --list-diagnostics option
Florian Weimer [Tue, 2 Mar 2021 13:38:42 +0000 (14:38 +0100)]
ld.so: Implement the --list-diagnostics option

3 years agopowerpc: Update libm-test-ulps
Matheus Castanho [Mon, 1 Mar 2021 20:07:27 +0000 (14:07 -0600)]
powerpc: Update libm-test-ulps

Generated with 'make regen-ulps'

Tested on powerpc, powerpc64, and powerpc64le

3 years agotst: Add test for utimes
Lukasz Majewski [Wed, 24 Feb 2021 23:58:56 +0000 (00:58 +0100)]
tst: Add test for utimes

This patch provides test for utimes. It uses wrapper to read
access and modification times to compare them with ones written by
utimes.

Moreover, access and modification times beyond the Y2038 threshold
date (i.e. 32 bit time_t overflow) are also checked.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agotst: Add test for utime
Lukasz Majewski [Wed, 24 Feb 2021 21:19:06 +0000 (22:19 +0100)]
tst: Add test for utime

This patch provides test for utime. It uses wrapper to read access
and modification times to compare them with ones written by utime.

Moreover, access and modification times beyond the Y2038 threshold
date (i.e. 32 bit time_t overflow) are also checked.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agotst: Add test for futimens
Lukasz Majewski [Mon, 8 Feb 2021 09:58:44 +0000 (10:58 +0100)]
tst: Add test for futimens

This patch provides test for futimens. It uses wrapper, which
reads access and modification time to compare them with ones
written by futimens.

Moreover, access and modification times beyond the Y2038 threshold
date (i.e. 32 bit time_t overflow) are also checked.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: __libc_cleanup_push/__libc_cleanup_pop require -fexceptions
Florian Weimer [Tue, 2 Mar 2021 09:49:03 +0000 (10:49 +0100)]
nptl: __libc_cleanup_push/__libc_cleanup_pop require -fexceptions

Do not define these macros if they do nothing in a particular
compilation, otherwise they can easily be used accidentally, while
not actually achieving anything.

3 years agoelf: Build __dl_iterate_phdr with unwinding support [BZ #27498]
Florian Weimer [Tue, 2 Mar 2021 09:46:45 +0000 (10:46 +0100)]
elf: Build __dl_iterate_phdr with unwinding support [BZ #27498]

3 years agonptl: Use <unwind-link.h> for accessing the libgcc_s unwinder
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
nptl: Use <unwind-link.h> for accessing the libgcc_s unwinder

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 years agoImplement _Unwind_Resume in libc on top of <unwind-link.h>
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
Implement _Unwind_Resume in libc on top of <unwind-link.h>

Temporarily move the arm _Unwind_Resume implementation to the file
used by libpthread.  It will be ported to <unwind-link.h> along with
the rest of nptl.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 years agoMove sysdeps/gnu/unwind-resume.c to sysdeps/generic/unwind-resume.c
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
Move sysdeps/gnu/unwind-resume.c to sysdeps/generic/unwind-resume.c

This change allows architecture-specific sysdeps directories to override
it.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 years ago__frame_state_for: Use <unwind-link.h> for unwinder access
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
__frame_state_for: Use <unwind-link.h> for unwinder access

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 years agosparc: Implement backtrace on top <unwind-link.h>
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
sparc: Implement backtrace on top <unwind-link.h>

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 years agom68k: Implement backtrace on top of <unwind-link.h>
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
m68k: Implement backtrace on top of <unwind-link.h>

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 years agoi386: Implement backtrace on top of <unwind-link.h>
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
i386: Implement backtrace on top of <unwind-link.h>

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 years agoarm: Implement backtrace on top of <unwind-link.h>
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
arm: Implement backtrace on top of <unwind-link.h>

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 years agobacktrace: Implement on top of <unwind-link.h>
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
backtrace: Implement on top of <unwind-link.h>

This reimplements the generic version of backtrace.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 years agoImplement <unwind-link.h> for dynamically loading the libgcc_s unwinder
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
Implement <unwind-link.h> for dynamically loading the libgcc_s unwinder

This will be used to consolidate the libgcc_s access for backtrace
and pthread_cancel.

Unlike the existing backtrace implementations, it provides some
hardening based on pointer mangling.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 years agoCorrect buffer end pointer in IO_wdefault_doallocate (BZ #26874)
Martin Sebor [Mon, 1 Mar 2021 05:05:39 +0000 (10:35 +0530)]
Correct buffer end pointer in IO_wdefault_doallocate (BZ #26874)

An experimental build of GCC 11 with an enhanced -Warray-bounds
reports a bug in IO_wdefault_doallocate where the function forms
an invalid past-the-end pointer to an allocated wchar_t buffer
by failingf to consider the scaling by sizeof (wchar_t).

The fix path below corrects this problem.  It keeps the buffer
size the same as opposed to increasing it according to what other
code like it does.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
3 years agoaarch64: update ulps.
Szabolcs Nagy [Mon, 1 Mar 2021 12:29:17 +0000 (12:29 +0000)]
aarch64: update ulps.

For new test cases in
commit 5a051454a9b50c27984bbc499ee1297de48e2dc8

3 years agoAdd inputs that generate larger error bounds
Paul Zimmermann [Fri, 26 Feb 2021 07:00:03 +0000 (08:00 +0100)]
Add inputs that generate larger error bounds

(Using values from https://members.loria.fr/PZimmermann/papers/accuracy.pdf)

3 years agoReduce the statically linked startup code [BZ #23323]
Florian Weimer [Thu, 25 Feb 2021 11:10:57 +0000 (12:10 +0100)]
Reduce the statically linked startup code [BZ #23323]

It turns out the startup code in csu/elf-init.c has a perfect pair of
ROP gadgets (see Marco-Gisbert and Ripoll-Ripoll, "return-to-csu: A
New Method to Bypass 64-bit Linux ASLR").  These functions are not
needed in dynamically-linked binaries because DT_INIT/DT_INIT_ARRAY
are already processed by the dynamic linker.  However, the dynamic
linker skipped the main program for some reason.  For maximum
backwards compatibility, this is not changed, and instead, the main
map is consulted from __libc_start_main if the init function argument
is a NULL pointer.

For statically linked binaries, the old approach based on linker
symbols is still used because there is nothing else available.

A new symbol version __libc_start_main@@GLIBC_2.34 is introduced because
new binaries running on an old libc would not run their ELF
constructors, leading to difficult-to-debug issues.

3 years agoposix: Falling back to non wide mode in case of encoding error [BZ #14185]
Adhemerval Zanella [Mon, 4 Jan 2021 17:26:30 +0000 (14:26 -0300)]
posix: Falling back to non wide mode in case of encoding error [BZ #14185]

Gnulib has added the proposed fix with aed23714d60 (done in 2005), but
recently with a glibc merge with 67306f6 (done in 2020 with sync back)
it has fallback to old semantic to return -1 on in case of failure.

From gnulib developer feedback it was an oversight.  Although the full
fix for BZ #14185 would require to rewrite fnmatch implementation to use
mbrtowc instead of mbsrtowcs on the full input, this mitigate the issue
and it has been used by gnulib for a long time.

This patch also removes the alloca usage on the string convertion to
wide characters before calling the internal function.

Checked on x86_64-linux-gnu.

3 years agonptl: Move elision implementations into libc
Florian Weimer [Tue, 23 Feb 2021 13:59:34 +0000 (14:59 +0100)]
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.)

3 years agoNEWS: Add missing bug closures
Samuel Thibault [Tue, 23 Feb 2021 12:35:34 +0000 (13:35 +0100)]
NEWS: Add missing bug closures

3 years agoadded rt to malloc/Depend [BZ #27132]
Paul Zimmermann [Tue, 23 Feb 2021 08:16:39 +0000 (09:16 +0100)]
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.

3 years agox86: Use x86/nptl/pthreaddef.h
H.J. Lu [Fri, 12 Feb 2021 17:57:30 +0000 (09:57 -0800)]
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>
3 years agonptl: Move futex-internal into libc
Florian Weimer [Mon, 22 Feb 2021 17:30:52 +0000 (18:30 +0100)]
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>
3 years agonptl: Move lowlevellock into libc [BZ #15648]
Florian Weimer [Mon, 22 Feb 2021 17:30:52 +0000 (18:30 +0100)]
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.

3 years agonptl: Move futex-internal.c into main nptl directory
Florian Weimer [Mon, 22 Feb 2021 17:30:52 +0000 (18:30 +0100)]
nptl: Move futex-internal.c into main nptl directory

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Reformat Versions
Florian Weimer [Mon, 22 Feb 2021 17:30:52 +0000 (18:30 +0100)]
nptl: Reformat Versions

One symbol per line, lexicographically ordered.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Split libpthread-routines into one routine per line
Florian Weimer [Mon, 22 Feb 2021 17:30:52 +0000 (18:30 +0100)]
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>
3 years agox86: Remove unused variables for raw cache sizes from cacheinfo.h
Florian Weimer [Mon, 22 Feb 2021 16:36:03 +0000 (17:36 +0100)]
x86: Remove unused variables for raw cache sizes from cacheinfo.h

This page took 0.084631 seconds and 5 git commands to generate.