platform/upstream/glibc.git
4 years agoresolv: Fix file handle leak in __resolv_conf_load [BZ #25429]
Florian Weimer [Tue, 21 Jan 2020 16:11:01 +0000 (17:11 +0100)]
resolv: Fix file handle leak in __resolv_conf_load [BZ #25429]

res_vinit_1 did not close the stream on errors, only on success.
This change moves closing the stream to __resolv_conf_load, for both
the success and error cases.

Fixes commit 89f187a40fc0ad4e22838526bfe34d73f758b776 ("resolv: Use
getline for configuration file reading in res_vinit_1") and commit
3f853f22c87f0b671c0366eb290919719fa56c0e ("resolv: Lift domain search
list limits [BZ #19569] [BZ #21475]"), where memory allocation was
introduced into res_vinit_1.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoresolv: Use <file_change_detection.h> in __resolv_conf_get_current
Florian Weimer [Tue, 21 Jan 2020 15:52:33 +0000 (16:52 +0100)]
resolv: Use <file_change_detection.h> in __resolv_conf_get_current

Only minor functional changes (i.e., regarding the handling of
directories, which are now treated as empty files).

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoAdd STATX_ATTR_VERITY from Linux 5.5 to bits/statx-generic.h.
Joseph Myers [Thu, 13 Feb 2020 21:59:59 +0000 (21:59 +0000)]
Add STATX_ATTR_VERITY from Linux 5.5 to bits/statx-generic.h.

This patch adds the new STATX_ATTR_VERITY macro from Linux 5.5 to
glibc's bits/statx-generic.h.  (This only does anything if glibc is
being used with old kernel headers.)

Tested for x86_64.

4 years agoUse gcc -finput-charset=ascii for check-installed-headers.
Stefan Liebler [Thu, 13 Feb 2020 16:32:00 +0000 (17:32 +0100)]
Use gcc -finput-charset=ascii for check-installed-headers.

A non-ascii character in the installed headers leads now to:
error: failure to convert ascii to UTF-8

Such a finding in s390 specific fenv.h leads to fails in GCC testsuite.
See glibc commit 08aea89ef67c5780ae734073494df0a451bce20f.

Adding this gcc option also to our tests was proposed by Florian Weimer.

This change also found a hit in resource.h where now "microseconds" is used.
I've adjusted all the resource.h files.

I've used the following command to check for further hits in headers.
LC_ALL=C find -name "*.h" -exec grep -PHn "[\x80-\xFF]" {} \;

Tested on s390x and x86_64.

Reviewed-by: Zack Weinberg <zackw@panix.com>
4 years agomath/test-sinl-pseudo: Use stack protector only if available
Florian Weimer [Thu, 13 Feb 2020 16:01:15 +0000 (17:01 +0100)]
math/test-sinl-pseudo: Use stack protector only if available

This fixes commit 9333498794cde1d5cca518bad ("Avoid ldbl-96 stack
corruption from range reduction of pseudo-zero (bug 25487).").

4 years agoalpha: Fix static gettimeofday symbol
Adhemerval Zanella [Thu, 13 Feb 2020 11:27:27 +0000 (08:27 -0300)]
alpha: Fix static gettimeofday symbol

By undef strong_alias on alpha implementation, the
default_symbol_version macro becomes an empty macro on static build.
It fixes the issue introduced at c953219420.

Checked on alpha-linux-gnu with a 'make check run-built-tests=no'.

4 years agonss_nisplus: Use NSS_DECLARE_MODULE_FUNCTIONS
Florian Weimer [Wed, 12 Feb 2020 14:36:03 +0000 (15:36 +0100)]
nss_nisplus: Use NSS_DECLARE_MODULE_FUNCTIONS

Reviewed-by: DJ Delorie <dj@redhat.com>
4 years agonss_dns: Use NSS_DECLARE_MODULE_FUNCTIONS
Florian Weimer [Wed, 12 Feb 2020 10:47:49 +0000 (11:47 +0100)]
nss_dns: Use NSS_DECLARE_MODULE_FUNCTIONS

Reviewed-by: DJ Delorie <dj@redhat.com>
4 years agonss_files: Use NSS_DECLARE_MODULE_FUNCTIONS
Florian Weimer [Wed, 12 Feb 2020 10:47:40 +0000 (11:47 +0100)]
nss_files: Use NSS_DECLARE_MODULE_FUNCTIONS

Reviewed-by: DJ Delorie <dj@redhat.com>
4 years agonss_db: Use NSS_DECLARE_MODULE_FUNCTIONS
Florian Weimer [Wed, 12 Feb 2020 10:47:26 +0000 (11:47 +0100)]
nss_db: Use NSS_DECLARE_MODULE_FUNCTIONS

Reviewed-by: DJ Delorie <dj@redhat.com>
4 years agonss_compat: Use NSS_DECLARE_MODULE_FUNCTIONS
Florian Weimer [Wed, 12 Feb 2020 10:47:13 +0000 (11:47 +0100)]
nss_compat: Use NSS_DECLARE_MODULE_FUNCTIONS

Reviewed-by: DJ Delorie <dj@redhat.com>
4 years agonss_hesiod: Use NSS_DECLARE_MODULE_FUNCTIONS
Florian Weimer [Wed, 12 Feb 2020 10:46:59 +0000 (11:46 +0100)]
nss_hesiod: Use NSS_DECLARE_MODULE_FUNCTIONS

Reviewed-by: DJ Delorie <dj@redhat.com>
4 years agonss: Add function types and NSS_DECLARE_MODULE_FUNCTIONS macro to <nss.h>
Florian Weimer [Wed, 12 Feb 2020 14:27:37 +0000 (15:27 +0100)]
nss: Add function types and NSS_DECLARE_MODULE_FUNCTIONS macro to <nss.h>

This macro allows to add type safety to the implementation of NSS
service modules.

Reviewed-by: DJ Delorie <dj@redhat.com>
4 years agonss_compat: Do not use nss_* names for function pointers
Florian Weimer [Wed, 12 Feb 2020 10:30:06 +0000 (11:30 +0100)]
nss_compat: Do not use nss_* names for function pointers

A future commit will use these names for types of functions
in NSS service modules.

Reviewed-by: DJ Delorie <dj@redhat.com>
4 years agoAvoid ldbl-96 stack corruption from range reduction of pseudo-zero (bug 25487).
Joseph Myers [Wed, 12 Feb 2020 23:31:56 +0000 (23:31 +0000)]
Avoid ldbl-96 stack corruption from range reduction of pseudo-zero (bug 25487).

Bug 25487 reports stack corruption in ldbl-96 sinl on a pseudo-zero
argument (an representation where all the significand bits, including
the explicit high bit, are zero, but the exponent is not zero, which
is not a valid representation for the long double type).

Although this is not a valid long double representation, existing
practice in this area (see bug 4586, originally marked invalid but
subsequently fixed) is that we still seek to avoid invalid memory
accesses as a result, in case of programs that treat arbitrary binary
data as long double representations, although the invalid
representations of the ldbl-96 format do not need to be consistently
handled the same as any particular valid representation.

This patch makes the range reduction detect pseudo-zero and unnormal
representations that would otherwise go to __kernel_rem_pio2, and
returns a NaN for them instead of continuing with the range reduction
process.  (Pseudo-zero and unnormal representations whose unbiased
exponent is less than -1 have already been safely returned from the
function before this point without going through the rest of range
reduction.)  Pseudo-zero representations would previously result in
the value passed to __kernel_rem_pio2 being all-zero, which is
definitely unsafe; unnormal representations would previously result in
a value passed whose high bit is zero, which might well be unsafe
since that is not a form of input expected by __kernel_rem_pio2.

Tested for x86_64.

4 years agomips: Fix argument passing for inlined syscalls on Linux [BZ #25523]
WANG Xuerui [Wed, 12 Feb 2020 16:57:03 +0000 (00:57 +0800)]
mips: Fix argument passing for inlined syscalls on Linux [BZ #25523]

According to [gcc documentation][1], temporary variables must be used for
the desired content to not be call-clobbered.

Fix the Linux inline syscall templates by adding temporary variables,
much like what x86 did before
(commit 381a0c26d73e0f074c962e0ab53b99a6c327066d).

Tested with gcc 9.2.0, both cross-compiled and natively on Loongson
3A4000.

[1]: https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables.html

4 years agomips: Use 'long int' and 'long long int' in linux syscall code
WANG Xuerui [Wed, 12 Feb 2020 16:57:02 +0000 (00:57 +0800)]
mips: Use 'long int' and 'long long int' in linux syscall code

Style fixes only, no functional change.

4 years agoalpha: Use generic gettimeofday implementation
Adhemerval Zanella [Mon, 10 Feb 2020 20:59:57 +0000 (17:59 -0300)]
alpha: Use generic gettimeofday implementation

It makes alpha no longer reports information about a system-wide
time zone and moves the version logic on the alpha implementation.

Checked on a build and check-abi for alpha-linux-gnu.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
4 years agosunrpc: Properly clean up if tst-udp-timeout fails
Matheus Castanho [Wed, 12 Feb 2020 16:07:32 +0000 (13:07 -0300)]
sunrpc: Properly clean up if tst-udp-timeout fails

The macro TEST_VERIFY_EXIT is used several times on
sunrpc/tst-udp-timeout to exit the test if a condition evaluates to
false. The side effect is that the code to terminate the RPC server
process is not executed when the program calls exit, so that
sub-process stays alive.

This commit registers a clean up function with atexit to kill the
server process before exiting the main program.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
4 years agoelf: avoid stack allocation in dl_open_worker
David Kilroy [Wed, 12 Feb 2020 17:31:17 +0000 (14:31 -0300)]
elf: avoid stack allocation in dl_open_worker

As the sort was removed, there's no need to keep a separate map of
links. Instead, when relocating objects iterate over l_initfini
directly.

This allows us to remove the loop copying l_initfini elements into
map. We still need a loop to identify the first and last elements that
need relocation.

Tested by running the testsuite on x86_64.

4 years agoelf: avoid redundant sort in dlopen
David Kilroy [Wed, 12 Feb 2020 17:30:31 +0000 (14:30 -0300)]
elf: avoid redundant sort in dlopen

l_initfini is already sorted by dependency in _dl_map_object_deps(),
so avoid sorting again in dl_open_worker().

Tested by running the testsuite on x86_64.

4 years agoelf: Allow dlopen of filter object to work [BZ #16272]
David Kilroy [Wed, 12 Feb 2020 17:28:15 +0000 (14:28 -0300)]
elf: Allow dlopen of filter object to work [BZ #16272]

There are two fixes that are needed to be able to dlopen filter
objects. First _dl_map_object_deps cannot assume that map will be at
the beginning of l_searchlist.r_list[], as filtees are inserted before
map. Secondly dl_open_worker needs to ensure that filtees get
relocated.

In _dl_map_object_deps:

* avoiding removing relocation dependencies of map by setting
  l_reserved to 0 and otherwise processing the rest of the search
  list.

* ensure that map remains at the beginning of l_initfini - the list
  of things that need initialisation (and destruction). Do this by
  splitting the copy up. This may not be required, but matches the
  initialization order without dlopen.

Modify dl_open_worker to relocate the objects in new->l_inifini.
new->l_initfini is constructed in _dl_map_object_deps, and lists the
objects that need initialization and destruction. Originally the list
of objects in new->l_next are relocated. All of these objects should
also be included in new->l_initfini (both lists are populated with
dependencies in _dl_map_object_deps). We can't use new->l_prev to pick
up filtees, as during a recursive dlopen from an interposed malloc
call, l->prev can contain objects that are not ready for relocation.

Add tests to verify that symbols resolve to the filtee implementation
when auxiliary and filter objects are used, both as a normal link and
when dlopen'd.

Tested by running the testsuite on x86_64.

4 years agoUpdate translations
Siddhesh Poyarekar [Wed, 12 Feb 2020 14:43:57 +0000 (20:13 +0530)]
Update translations

Pull in translation update from translation.org.

4 years agoRename RWF_WRITE_LIFE_NOT_SET to RWH_WRITE_LIFE_NOT_SET following Linux 5.5.
Joseph Myers [Wed, 12 Feb 2020 13:37:16 +0000 (13:37 +0000)]
Rename RWF_WRITE_LIFE_NOT_SET to RWH_WRITE_LIFE_NOT_SET following Linux 5.5.

Linux 5.5 renames RWF_WRITE_LIFE_NOT_SET to RWH_WRITE_LIFE_NOT_SET,
with the old name kept as an alias.  This patch makes the
corresponding change in glibc.

Tested for x86_64.

4 years agoS390: Fix non-ascii character in fenv.h.
Stefan Liebler [Wed, 12 Feb 2020 08:10:56 +0000 (09:10 +0100)]
S390: Fix non-ascii character in fenv.h.

The comment "isn't" contained a non-ascii character which leads to
an error if compiled with -finput-charset=ascii:
error: failure to convert ascii to UTF-8

This is observable in GCC testsuite:
FAIL: 17_intro/headers/c++1998/charset.cc (test for excess errors)
FAIL: 17_intro/headers/c++2011/charset.cc (test for excess errors)
FAIL: 17_intro/headers/c++2014/charset.cc (test for excess errors)
FAIL: 17_intro/headers/c++2017/charset.cc (test for excess errors)
FAIL: 17_intro/headers/c++2020/charset.cc (test for excess errors)

Also rewrite the comment above.

Reported-by: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
4 years agoio: Add io/tst-lchmod covering lchmod and fchmodat
Florian Weimer [Tue, 11 Feb 2020 15:22:19 +0000 (16:22 +0100)]
io: Add io/tst-lchmod covering lchmod and fchmodat

4 years agoLinux: Emulate fchmodat with AT_SYMLINK_NOFOLLOW using O_PATH [BZ #14578]
Florian Weimer [Wed, 22 Jan 2020 18:01:20 +0000 (19:01 +0100)]
Linux: Emulate fchmodat with AT_SYMLINK_NOFOLLOW using O_PATH [BZ #14578]

/proc/self/fd files are special and chmod on O_PATH descriptors
in that directory operates on the symbolic link itself (like lchmod).

4 years agoio: Implement lchmod using fchmodat [BZ #14578]
Florian Weimer [Wed, 22 Jan 2020 17:56:04 +0000 (18:56 +0100)]
io: Implement lchmod using fchmodat [BZ #14578]

4 years agoAdd internal <file_change_detection.h> header file
Florian Weimer [Tue, 11 Feb 2020 12:52:06 +0000 (13:52 +0100)]
Add internal <file_change_detection.h> header file

The code started out with bits form resolv/resolv_conf.c, but it
was enhanced to deal with directories and FIFOs in a more predictable
manner.  A test case is included as well.

This will be used to implement the /etc/resolv.conf change detection.

This currently lives in a header file only.  Once there are multiple
users, the implementations should be moved into C files.

4 years agoelf.h: Add R_RISCV_IRELATIVE
Fangrui Song [Wed, 12 Feb 2020 06:10:19 +0000 (01:10 -0500)]
elf.h: Add R_RISCV_IRELATIVE

The number has been officially assigned by
https://github.com/riscv/riscv-elf-psabi-doc/pull/131
https://github.com/riscv/riscv-elf-psabi-doc/commit/d21ca40a7f56812a15e97450b7bc1599c0d35b82

4 years agoFix typo in the name for Wednesday in Kurdish [BZ #9809]
Mike FABIAN [Tue, 11 Feb 2020 09:17:12 +0000 (10:17 +0100)]
Fix typo in the name for Wednesday in Kurdish [BZ #9809]

4 years agodebug: Add missing locale dependencies of fortify tests
Florian Weimer [Mon, 10 Feb 2020 13:37:10 +0000 (14:37 +0100)]
debug: Add missing locale dependencies of fortify tests

The missing dependencies result in failures like this if make check
is invoked with sufficient parallelism for the debug subdirectory:

FAIL: debug/tst-chk2
FAIL: debug/tst-chk3
FAIL: debug/tst-chk4
FAIL: debug/tst-chk5
FAIL: debug/tst-chk6
FAIL: debug/tst-lfschk1
FAIL: debug/tst-lfschk2
FAIL: debug/tst-lfschk3
FAIL: debug/tst-lfschk4
FAIL: debug/tst-lfschk5
FAIL: debug/tst-lfschk6

4 years agohtl C11 threads: Avoid pthread_ symbols visibility in static library
Samuel Thibault [Mon, 10 Feb 2020 23:45:23 +0000 (23:45 +0000)]
htl C11 threads: Avoid pthread_ symbols visibility in static library

4 years agohurd: Add __pthread_spin_wait and use it
Samuel Thibault [Mon, 10 Feb 2020 22:06:33 +0000 (23:06 +0100)]
hurd: Add __pthread_spin_wait and use it

900778283ac3 ("htl: make pthread_spin_lock really spin") made
pthread_spin_lock really spin and not block, but the current users of
__pthread_spin_lock were assuming that it blocks, i.e. they use it as a
lightweight mutex fitting in just one int.

__pthread_spin_wait provides that support back.

4 years agoldbl-128ibm-compat: set PRINTF_CHK flag in {,v}sprintf_chk
Paul E. Murphy [Tue, 4 Feb 2020 15:21:19 +0000 (09:21 -0600)]
ldbl-128ibm-compat: set PRINTF_CHK flag in {,v}sprintf_chk

This should be unconditionally set to match the common implementation,
and fixes multiple test failures related to sprintf.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
4 years agoUse --disable-gdbserver in build-many-glibcs.py.
Joseph Myers [Mon, 10 Feb 2020 22:17:59 +0000 (22:17 +0000)]
Use --disable-gdbserver in build-many-glibcs.py.

Now that binutils-gdb has gdbserver at top level, an extra
--disable-gdbserver configure option is needed when configuring
binutils from a git checkout to avoid it also building gdbserver
unnecessarily (although fairly harmlessly).  This patch updates the
options used in build-many-glibcs.py accordingly (although this might
end up not being needed depending on what happens regarding whether
gdbserver gets built for host != target).

Tested with a build-many-glibcs.py compilers build for
aarch64-linux-gnu using binutils-gdb master.

4 years agoImprove random memcpy benchmark
Wilco Dijkstra [Mon, 10 Feb 2020 16:08:40 +0000 (16:08 +0000)]
Improve random memcpy benchmark

Improve the random memcpy benchmark.  Double the number of copies and
increase the memory sizes tested to 512KB.  Add a more detailed
distribution of memcpy alignment and sizes up to 4096 based on SPEC2017
traces.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
4 years agonptl: update default pthread-offsets.h
Andreas Schwab [Wed, 5 Feb 2020 16:33:30 +0000 (17:33 +0100)]
nptl: update default pthread-offsets.h

Remove unused definitions, and correct __PTHREAD_RWLOCK_FLAGS_OFFSET for
__WORDSIZE == 64.

4 years agonptl: add missing pthread-offsets.h
Andreas Schwab [Wed, 5 Feb 2020 17:09:04 +0000 (18:09 +0100)]
nptl: add missing pthread-offsets.h

All architectures using their own definition of struct
__pthread_rwlock_arch_t need to provide their own pthread-offsets.h.

4 years agohtl: Avoid a local plt for pthread_self
Samuel Thibault [Mon, 10 Feb 2020 12:22:31 +0000 (13:22 +0100)]
htl: Avoid a local plt for pthread_self

4 years agopthread: Move some join tests from nptl to sysdeps/pthread
Samuel Thibault [Mon, 10 Feb 2020 01:21:46 +0000 (01:21 +0000)]
pthread: Move some join tests from nptl to sysdeps/pthread

So they can be checked with htl too.

4 years agohtl: Make joining self return EDEADLK
Samuel Thibault [Mon, 10 Feb 2020 01:19:00 +0000 (01:19 +0000)]
htl: Make joining self return EDEADLK

4 years agopthread: Move most barrier tests from nptl to sysdeps/pthread
Samuel Thibault [Sun, 9 Feb 2020 23:14:35 +0000 (23:14 +0000)]
pthread: Move most barrier tests from nptl to sysdeps/pthread

So they can be checked with htl too.

4 years agohtl: Fix barrier_wait with one thread
Samuel Thibault [Sun, 9 Feb 2020 23:02:13 +0000 (23:02 +0000)]
htl: Fix barrier_wait with one thread

4 years agopthread: Move most sem tests from nptl to sysdeps/pthread
Samuel Thibault [Sun, 9 Feb 2020 22:55:12 +0000 (22:55 +0000)]
pthread: Move most sem tests from nptl to sysdeps/pthread

So they can be checked with htl too.

4 years agohtl: Make sem_wait/sem_timedwait interruptible
Samuel Thibault [Mon, 10 Feb 2020 00:52:50 +0000 (00:52 +0000)]
htl: Make sem_wait/sem_timedwait interruptible

4 years agohtl: Make sem_open return ENOSYS
Samuel Thibault [Sun, 9 Feb 2020 22:52:32 +0000 (22:52 +0000)]
htl: Make sem_open return ENOSYS

instead of EOPNOTSUPP, which is for sockets.

4 years agohtl: Add support for semaphore maximum value
Samuel Thibault [Sun, 9 Feb 2020 22:44:08 +0000 (22:44 +0000)]
htl: Add support for semaphore maximum value

4 years agopthread: Move key tests from nptl to sysdeps/pthread
Samuel Thibault [Sun, 9 Feb 2020 22:27:09 +0000 (22:27 +0000)]
pthread: Move key tests from nptl to sysdeps/pthread

So they can be checked with htl too.

4 years agohurd: Make nanosleep a cancellation point
Samuel Thibault [Sun, 9 Feb 2020 22:27:56 +0000 (22:27 +0000)]
hurd: Make nanosleep a cancellation point

4 years agohtl: Add support for libc cancellation points
Samuel Thibault [Sun, 9 Feb 2020 22:23:52 +0000 (22:23 +0000)]
htl: Add support for libc cancellation points

4 years agohtl: clean __pthread_get_cleanup_stack hidden proto
Samuel Thibault [Sun, 9 Feb 2020 23:13:24 +0000 (23:13 +0000)]
htl: clean __pthread_get_cleanup_stack hidden proto

4 years agohtl: XFAIL rwlock tests which need pshared support
Samuel Thibault [Sun, 9 Feb 2020 22:27:38 +0000 (22:27 +0000)]
htl: XFAIL rwlock tests which need pshared support

4 years agopthread: Move some rwlock tests from nptl to sysdeps/pthread
Samuel Thibault [Sun, 9 Feb 2020 20:07:51 +0000 (20:07 +0000)]
pthread: Move some rwlock tests from nptl to sysdeps/pthread

So they can be checked with htl too.

4 years agopthread: Move most once tests from nptl to sysdeps/pthread
Samuel Thibault [Sun, 9 Feb 2020 19:50:21 +0000 (19:50 +0000)]
pthread: Move most once tests from nptl to sysdeps/pthread

So they can be checked with htl too.

4 years agohtl: support cancellation during pthread_once
Samuel Thibault [Sun, 9 Feb 2020 19:43:43 +0000 (19:43 +0000)]
htl: support cancellation during pthread_once

4 years agopthread: Move most cond tests from nptl to sysdeps/pthread
Samuel Thibault [Sun, 9 Feb 2020 19:17:51 +0000 (19:17 +0000)]
pthread: Move most cond tests from nptl to sysdeps/pthread

So they can be checked with htl too.

4 years agohtl: make pthread_cond_destroy return EBUSY on waiters
Samuel Thibault [Sun, 9 Feb 2020 19:19:25 +0000 (19:19 +0000)]
htl: make pthread_cond_destroy return EBUSY on waiters

4 years agohtl: Report missing mutex lock on pthread_cond_*wait
Samuel Thibault [Sun, 9 Feb 2020 18:12:39 +0000 (18:12 +0000)]
htl: Report missing mutex lock on pthread_cond_*wait

4 years agohtl: Fix linking static testcases
Samuel Thibault [Sun, 9 Feb 2020 17:57:27 +0000 (17:57 +0000)]
htl: Fix linking static testcases

They need libpthread.a

4 years agohtl: Move __register_atfork from forward to own file
Samuel Thibault [Sun, 9 Feb 2020 17:55:37 +0000 (17:55 +0000)]
htl: Move __register_atfork from forward to own file

Since we need it also in the static linking case.

4 years agopthread: Move some attr tests from nptl to sysdeps/pthread
Samuel Thibault [Sun, 9 Feb 2020 17:30:30 +0000 (17:30 +0000)]
pthread: Move some attr tests from nptl to sysdeps/pthread

So they can be checked with htl too.

4 years agohtl: Fix default guard size
Samuel Thibault [Sun, 9 Feb 2020 17:27:38 +0000 (17:27 +0000)]
htl: Fix default guard size

When it is not hardcoded by the architecture with PAGESIZE, we need to
use the dynamic values from __vm_page_size.

4 years agopthread: Move most mutex tests from nptl to sysdeps/pthread
Samuel Thibault [Sun, 9 Feb 2020 17:15:47 +0000 (17:15 +0000)]
pthread: Move most mutex tests from nptl to sysdeps/pthread

So they can be checked with htl too.

XFAIL tst-mutex4, for which support is still missing in htl.

4 years agopthread: Move spin tests from nptl to sysdeps/pthread
Samuel Thibault [Sun, 9 Feb 2020 17:00:39 +0000 (17:00 +0000)]
pthread: Move spin tests from nptl to sysdeps/pthread

So they can be checked with htl too.

4 years agohtl: make pthread_spin_lock really spin
Samuel Thibault [Sun, 9 Feb 2020 16:54:58 +0000 (16:54 +0000)]
htl: make pthread_spin_lock really spin

__spin_lock would actually use gsync_wait to block, which is not what
pthread_spin_lock is about.

4 years agohtl: Avoid check-installed-headers looking at inlines
Samuel Thibault [Sun, 9 Feb 2020 16:41:24 +0000 (16:41 +0000)]
htl: Avoid check-installed-headers looking at inlines

4 years agohtl: Do not put spin_lock inlines in public headers
Samuel Thibault [Sun, 9 Feb 2020 16:34:26 +0000 (16:34 +0000)]
htl: Do not put spin_lock inlines in public headers

They were not getting used anyway.
Also do not make libsupport use them, it would make tests using it have
to be made to link against libmachuser for gsync_wait.

4 years agopthread: Move basic tests from nptl to sysdeps/pthread
Samuel Thibault [Sun, 9 Feb 2020 16:12:35 +0000 (16:12 +0000)]
pthread: Move basic tests from nptl to sysdeps/pthread

So they can be checked with htl too.

4 years agohtl: Fix calling pthread_exit in the child of a fork
Samuel Thibault [Sun, 9 Feb 2020 16:01:06 +0000 (17:01 +0100)]
htl: Fix calling pthread_exit in the child of a fork

We need to reset the threads counter, otherwise pthread_exit() would not
call exit(0).

4 years agox86: Remove <bits/select.h> and use the generic version
Florian Weimer [Sun, 9 Feb 2020 10:01:39 +0000 (11:01 +0100)]
x86: Remove <bits/select.h> and use the generic version

Particularly on CPUs without ERMS, the string instructions are slow,
so it is unclear whether this architecture-specific implementation is
in fact an optimization.

4 years agoC11 threads: Move implementation to sysdeps/pthread
Samuel Thibault [Mon, 13 Jan 2020 19:58:28 +0000 (19:58 +0000)]
C11 threads: Move implementation to sysdeps/pthread

so it gets shared by nptl and htl. Also add htl versions of thrd_current and
thrd_yield.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agohtl: Add C11 threads types definitions
Samuel Thibault [Mon, 13 Jan 2020 21:19:24 +0000 (21:19 +0000)]
htl: Add C11 threads types definitions

4 years agoC11 threads: make thrd_join more portable
Samuel Thibault [Mon, 13 Jan 2020 21:52:13 +0000 (21:52 +0000)]
C11 threads: make thrd_join more portable

by making a __pthread_join call instead of an equivalent __pthread_clockjoin_ex
call.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoC11 threads: Fix thrd_t / pthread_t compatibility assertion
Samuel Thibault [Mon, 13 Jan 2020 21:33:11 +0000 (21:33 +0000)]
C11 threads: Fix thrd_t / pthread_t compatibility assertion

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoC11 threads: do not require PTHREAD_DESTRUCTOR_ITERATIONS
Samuel Thibault [Mon, 13 Jan 2020 21:29:21 +0000 (21:29 +0000)]
C11 threads: do not require PTHREAD_DESTRUCTOR_ITERATIONS

It is optional in POSIX.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agonptl: Move nptl-specific types to separate header
Samuel Thibault [Mon, 13 Jan 2020 21:15:46 +0000 (21:15 +0000)]
nptl: Move nptl-specific types to separate header

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agohtl: Make __PTHREAD_ONCE_INIT more flexible
Samuel Thibault [Mon, 13 Jan 2020 21:17:44 +0000 (21:17 +0000)]
htl: Make __PTHREAD_ONCE_INIT more flexible

by moving its (struct __pthread_once) cast into PTHREAD_ONCE_INIT.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agohtl: Add support for C11 threads behavior
Samuel Thibault [Mon, 13 Jan 2020 20:05:08 +0000 (20:05 +0000)]
htl: Add support for C11 threads behavior

Essentially properly calling the thread function which returns an int
instead of a void*.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agohtl: Add missing internal functions declarations
Samuel Thibault [Mon, 13 Jan 2020 20:04:44 +0000 (20:04 +0000)]
htl: Add missing internal functions declarations

4 years agohtl: Rename _pthread_mutex_init/destroy to __pthread_mutex_init/destroy
Samuel Thibault [Mon, 13 Jan 2020 19:46:25 +0000 (19:46 +0000)]
htl: Rename _pthread_mutex_init/destroy to __pthread_mutex_init/destroy

4 years agohtl: Move internal mutex/rwlock symbols to GLIBC_PRIVATE
Samuel Thibault [Sat, 8 Feb 2020 23:49:53 +0000 (00:49 +0100)]
htl: Move internal mutex/rwlock symbols to GLIBC_PRIVATE

Their prototypes have never been made public, and they are not used outside
libc (checked on the whole Debian archive)

4 years agoLinux: Add io/tst-o_path-locks test
Florian Weimer [Sun, 9 Feb 2020 10:51:08 +0000 (11:51 +0100)]
Linux: Add io/tst-o_path-locks test

The O_PATH-based fchmodat emulation will rely on the fact that closing
an O_PATH descriptor never releases POSIX advisory locks, so this
commit adds a test case for this behavior.

4 years agosupport: Add the xlstat function
Florian Weimer [Sun, 9 Feb 2020 10:50:44 +0000 (11:50 +0100)]
support: Add the xlstat function

4 years agohtl: Remove duplicate files
Samuel Thibault [Sun, 9 Feb 2020 00:17:24 +0000 (01:17 +0100)]
htl: Remove duplicate files

The generic versions have the same content.

4 years agohtl: Remove unused files
Samuel Thibault [Sun, 9 Feb 2020 00:13:56 +0000 (01:13 +0100)]
htl: Remove unused files

These have never been used.

4 years agoresolv: Fix CNAME chaining in resolv/tst-resolv-ai_idn-common.c
Florian Weimer [Fri, 7 Feb 2020 17:48:04 +0000 (18:48 +0100)]
resolv: Fix CNAME chaining in resolv/tst-resolv-ai_idn-common.c

The second CNAME record optionally generated by the response function
used the question name, not the redirected name from the first CNAME.
This breaks the chain and results in failures of these IDNA tests if
CNAME owner names are checked as expected (which the current
implementation does not do).

4 years agoRemove a comment claiming that sin/cos round correctly.
Wilco Dijkstra [Fri, 7 Feb 2020 17:15:37 +0000 (17:15 +0000)]
Remove a comment claiming that sin/cos round correctly.

4 years agoy2038: linux: Provide __settimeofday64 implementation
Lukasz Majewski [Thu, 16 Jan 2020 22:14:27 +0000 (23:14 +0100)]
y2038: linux: Provide __settimeofday64 implementation

This patch provides new __settimeofday64 explicit 64 bit function for setting
64 bit time in the kernel (by internally calling __clock_settime64).
Moreover, a 32 bit version - __settimeofday has been refactored to internally
use __settimeofday64.

The __settimeofday is now supposed to be used on systems still supporting 32
bit time (__TIMESIZE != 64) - hence the necessary conversion of struct
timeval to 64 bit struct __timespec64.

Internally the settimeofday uses __settimeofday64. This patch is necessary
for having architectures with __WORDSIZE == 32 Y2038 safe.

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 __settimeofday64 and __settimeofday.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoy2038: Provide conversion helpers for struct __timeval64
Lukasz Majewski [Thu, 16 Jan 2020 22:44:59 +0000 (23:44 +0100)]
y2038: Provide conversion helpers for struct __timeval64

Those functions allow easy conversion between Y2038 safe, glibc internal
struct __timeval64 and other time related data structures (like struct timeval
or struct __timespec64).

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

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoy2038: alpha: Rename valid_timeval64_to_timeval to valid_timeval_to_timeval32
Lukasz Majewski [Tue, 28 Jan 2020 13:26:40 +0000 (14:26 +0100)]
y2038: alpha: Rename valid_timeval64_to_timeval to valid_timeval_to_timeval32

The name 'valid_timeval64_to_timeval' suggest conversion of struct
__timeval64 to struct timeval (as in ./include/time.h).

As on the alpha the struct timeval supports 64 bit time, it seems more
feasible to emphasis struct timeval32 in the conversion function name.

Hence the helper function naming change to 'valid_timeval_to_timeval32'.

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

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoy2038: alpha: Rename valid_timeval_to_timeval64 to valid_timeval32_to_timeval
Lukasz Majewski [Fri, 17 Jan 2020 14:29:56 +0000 (15:29 +0100)]
y2038: alpha: Rename valid_timeval_to_timeval64 to valid_timeval32_to_timeval

Without this patch the naming convention for functions to convert
struct timeval32 to struct timeval (which supports 64 bit time on Alpha) was
a bit misleading. The name 'valid_timeval_to_timeval64' suggest conversion
of struct timeval to struct __timeval64 (as in ./include/time.h).

As on alpha the struct timeval supports 64 bit time it seems more readable
to emphasis struct timeval32 in the conversion function name.

Hence the helper function naming change to 'valid_timeval32_to_timeval'.

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

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoy2038: Introduce struct __timeval64 - new internal glibc type
Lukasz Majewski [Thu, 16 Jan 2020 22:40:51 +0000 (23:40 +0100)]
y2038: Introduce struct __timeval64 - new internal glibc type

This type is a glibc's "internal" type similar to struct timeval but
whose tv_sec field is a __time64_t rather than a time_t, which makes it
Y2038-proof. This struct is NOT supposed to be passed to the kernel -
instead it shall be converted to struct __timespec64 and clock_[sg]ettime
syscalls shall be used (which are now Y2038 safe).

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

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoy2038: Define __suseconds64_t type to be used with struct __timeval64
Lukasz Majewski [Sat, 25 Jan 2020 21:33:41 +0000 (22:33 +0100)]
y2038: Define __suseconds64_t type to be used with struct __timeval64

The __suseconds64_t type is supposed to be the 64 bit type across all
architectures.

It would be mostly used internally in the glibc - however, when passed to
Linux kernel (very unlikely), if necessary, it shall be converted to 32
bit type (i.e. __suseconds_t)

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

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoUpdate kernel version to 5.5 in tst-mman-consts.py.
Joseph Myers [Fri, 7 Feb 2020 13:55:29 +0000 (13:55 +0000)]
Update kernel version to 5.5 in tst-mman-consts.py.

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

Tested with build-many-glibcs.py.

4 years agoUpdate syscall lists for Linux 5.5.
Joseph Myers [Fri, 7 Feb 2020 13:54:58 +0000 (13:54 +0000)]
Update syscall lists for Linux 5.5.

Linux 5.5 has no new syscalls to add to syscall-names.list, but it
does newly enable the clone3 syscall for AArch64.  This patch updates
the kernel version listed in syscall-names.list and regenerates the
AArch64 arch-syscall.h.

Tested with build-many-glibcs.py.

4 years agoNEWS: Set fill-column hint to 72
Siddhesh Poyarekar [Fri, 7 Feb 2020 02:27:04 +0000 (07:57 +0530)]
NEWS: Set fill-column hint to 72

Match up with list-fixed-bugs.py and also with the fact that many
email clients default to 72 chars when composing emails.

Reviewed-by: Joseph Myers <joseph@codesourcery.com>
4 years agoy2038: linux: Provide __timespec_get64 implementation
Lukasz Majewski [Wed, 15 Jan 2020 09:14:23 +0000 (10:14 +0100)]
y2038: linux: Provide __timespec_get64 implementation

This patch provides new instance of Linux specific timespec_get.c file placed
in ./sysdeps/unix/sysv/linux/.

When compared to this file version from ./time directory, it provides
__timespec_get64 explicit 64 bit function for getting 64 bit time in the
struct __timespec64 (for compilation using C11 standard).
Moreover, a 32 bit version - __timespec_get internally uses
__timespec_get64.

The __timespec_get is now supposed to be used on systems still supporting 32
bit time (__TIMESIZE != 64) - hence the necessary conversion to 32 bit struct
timespec.

Internally the timespec_get uses __clock_gettime64. This patch is necessary
for having architectures with __WORDSIZE == 32 Y2038 safe.

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 __timespec_get64 and __timespec_get.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoUse binutils 2.34 branch in build-many-glibcs.py.
Joseph Myers [Mon, 3 Feb 2020 20:38:27 +0000 (20:38 +0000)]
Use binutils 2.34 branch in build-many-glibcs.py.

This patch makes build-many-glibcs.py use binutils 2.34 branch.

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

4 years agoRun nptl/tst-pthread-getattr in a container
DJ Delorie [Mon, 3 Feb 2020 19:57:23 +0000 (14:57 -0500)]
Run nptl/tst-pthread-getattr in a container

See https://bugzilla.redhat.com/show_bug.cgi?id=1653942

This test depends on the kernel's assignment of memory regions, but
running under ld.so explicitly changes those assignments, sometimes
sufficiently to cause the test to fail (esp with address space
randomization).

The easiest way to "fix" the test, is to run it the way the user would
- without ld.so.  Running it in a container does that.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>