Commit Graph

34485 Commits

Author SHA1 Message Date
Florian Weimer
eef4d4f80c math: Enable <bits/math-finite.h> sysdeps override
sysdeps/ia64/fpu/bits/math-finite.h exists and will be installed on
ia64, but during the build, the default math/bits/math-finite.h file
is used, which is wrong.

Fixes commit 0ac5ae2335 ("Optimize
libm").
2019-02-08 21:06:51 +01:00
Florian Weimer
fdfbd47d92 Move generic <bits/unistd_ext.h> to a more regular location
No functional change; the previous path worked as well, but it
re-added the obsolete sysdeps/generic/bits directory, which was
removed (for the first time) in commit
c72565e5f1.

Fixes commit e47d82c99a ("Provide
<bits/unistd_ext.h> as a sysdeps header exclusively").
2019-02-08 21:06:11 +01:00
Patsy Franklin
11eb21c465 nss: Add tst-nss-files-hosts-long test [BZ #21915]
When the /etc/hosts file has a line longer than 1028
characters getent ahostsv4 and ahostsv6 will fail.

This test performs a getent call on a /etc/hosts file that contains
a very long line (greater than 1028) using the test-in-container
framework.
2019-02-08 14:38:27 -05:00
Florian Weimer
e47d82c99a Provide <bits/unistd_ext.h> as a sysdeps header exclusively
Non-sysdeps headers cannot be overriden by sysdeps headers across the
entire build, so it is necessary to turn such extension headers into
sysdeps headers themselves.  The approach here follows the existing
<bits/shm.h> header (although it uses sysdeps/gnu instead of
sysdeps/generic).

Fixes commit 1d0fc21382 ("Linux: Add
gettid system call wrapper [BZ #6399]") and commit
8f89ab216f ("posix: Fix missing wrapper
header for <bits/unistd_ext.h>").
2019-02-08 16:51:17 +01:00
Florian Weimer
8f89ab216f posix: Fix missing wrapper header for <bits/unistd_ext.h>
Fixes commit 1d0fc21382
("Linux: Add gettid system call wrapper [BZ #6399]").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-02-08 16:33:37 +01:00
TAMUKI Shoichi
144a794e0a tst-strftime2: Use array_length macros instead of magic numbers
ChangeLog:

	* time/tst-strftime2.c: Use array_length macros instead of magic
	numbers.
2019-02-08 22:03:14 +09:00
Florian Weimer
669ff911e2 nptl: Avoid fork handler lock for async-signal-safe fork [BZ #24161]
Commit 27761a1042 ("Refactor atfork
handlers") introduced a lock, atfork_lock, around fork handler list
accesses.  It turns out that this lock occasionally results in
self-deadlocks in malloc/tst-mallocfork2:

(gdb) bt
#0  __lll_lock_wait_private ()
    at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:63
#1  0x00007f160c6f927a in __run_fork_handlers (who=(unknown: 209394016),
    who@entry=atfork_run_prepare) at register-atfork.c:116
#2  0x00007f160c6b7897 in __libc_fork () at ../sysdeps/nptl/fork.c:58
#3  0x00000000004027d6 in sigusr1_handler (signo=<optimized out>)
    at tst-mallocfork2.c:80
#4  sigusr1_handler (signo=<optimized out>) at tst-mallocfork2.c:64
#5  <signal handler called>
#6  0x00007f160c6f92e4 in __run_fork_handlers (who=who@entry=atfork_run_parent)
    at register-atfork.c:136
#7  0x00007f160c6b79a2 in __libc_fork () at ../sysdeps/nptl/fork.c:152
#8  0x0000000000402567 in do_test () at tst-mallocfork2.c:156
#9  0x0000000000402dd2 in support_test_main (argc=1, argv=0x7ffc81ef1ab0,
    config=config@entry=0x7ffc81ef1970) at support_test_main.c:350
#10 0x0000000000402362 in main (argc=<optimized out>, argv=<optimized out>)
    at ../support/test-driver.c:168

If no locking happens in the single-threaded case (where fork is
expected to be async-signal-safe), this deadlock is avoided.
(pthread_atfork is not required to be async-signal-safe, so a fork
call from a signal handler interrupting pthread_atfork is not
a problem.)
2019-02-08 12:46:19 +01:00
Florian Weimer
d0bd87d4c0 ChangeLog: Correct date of last commit 2019-02-08 12:44:48 +01:00
Florian Weimer
1d0fc21382 Linux: Add gettid system call wrapper [BZ #6399]
This commit adds gettid to <unistd.h> on Linux, and not to the
kernel-independent GNU API.

gettid is now supportable on Linux because too many things assume a
1:1 mapping between libpthread threads and kernel threads.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-02-08 11:27:55 +01:00
Florian Weimer
f289e656ec rt: Turn forwards from librt to libc into compat symbols [BZ #24194]
As the  result of commit 6e6249d0b4
("BZ#14743: Move clock_* symbols from librt to libc."), in glibc 2.17,
clock_gettime, clock_getres, clock_settime, clock_getcpuclockid,
clock_nanosleep were added to libc, and the file rt/clock-compat.c
was added with forwarders to the actual implementations in libc.
These forwarders were wrapped in

#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_17)

so that they are not present for newer architectures (such as
powerpc64le) with a 2.17 or later ABI baseline.  But the forwarders
were not marked as compatibility symbols.  As a result, on older
architectures, historic configure checks such as

AC_CHECK_LIB(rt, clock_gettime)

still cause linking against librt, even though this is completely
unnecessary.  It also creates a needless porting hazard because
architectures behave differently when it comes to symbol availability.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-02-08 10:43:17 +01:00
Stefan Liebler
823624bdc4 Add compiler barriers around modifications of the robust mutex list for pthread_mutex_trylock. [BZ #24180]
While debugging a kernel warning, Thomas Gleixner, Sebastian Sewior and
Heiko Carstens found a bug in pthread_mutex_trylock due to misordered
instructions:
140:   a5 1b 00 01             oill    %r1,1
144:   e5 48 a0 f0 00 00       mvghi   240(%r10),0   <--- THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
14a:   e3 10 a0 e0 00 24       stg     %r1,224(%r10) <--- last THREAD_SETMEM of ENQUEUE_MUTEX_PI

vs (with compiler barriers):
140:   a5 1b 00 01             oill    %r1,1
144:   e3 10 a0 e0 00 24       stg     %r1,224(%r10)
14a:   e5 48 a0 f0 00 00       mvghi   240(%r10),0

Please have a look at the discussion:
"Re: WARN_ON_ONCE(!new_owner) within wake_futex_pi() triggerede"
(https://lore.kernel.org/lkml/20190202112006.GB3381@osiris/)

This patch is introducing the same compiler barriers and comments
for pthread_mutex_trylock as introduced for pthread_mutex_lock and
pthread_mutex_timedlock by commit 8f9450a0b7
"Add compiler barriers around modifications of the robust mutex list."

ChangeLog:

	[BZ #24180]
	* nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
2019-02-07 15:18:36 +01:00
Florian Weimer
8311c83f91 array_length: Make usable as a constant expression
Do not use a statement expression in array_length, so that
array_length can be used at file scope and as a constant expression.
Instead, put the _Static_assert into a struct (as a declaration),
and nest this in the expression using a sizeof expression.
2019-02-07 09:03:02 +01:00
Florian Weimer
94b63e6620 support: Implement xdlmopen
Put xdlmopen into its own file, to avoid disturbing static linking
tests (where dlmopen pulls in additional code).
2019-02-07 09:02:01 +01:00
Joseph Myers
c2d8f0b704 Avoid "inline" after return type in function definitions.
One group of warnings seen with -Wextra is warnings for static or
inline not at the start of a declaration (-Wold-style-declaration).

This patch fixes various such cases for inline, ensuring it comes at
the start of the declaration (after any static).  A common case of the
fix is "static inline <type> __always_inline"; the definition of
__always_inline starts with __inline, so the natural change is to
"static __always_inline <type>".  Other cases of the warning may be
harder to fix (one pattern is a function definition that gets
rewritten to be static by an including file, "#define funcname static
wrapped_funcname" or similar), but it seems worth fixing these cases
with inline anyway.

Tested for x86_64.

	* elf/dl-load.h (_dl_postprocess_loadcmd): Use __always_inline
	before return type, without separate inline.
	* elf/dl-tunables.c (maybe_enable_malloc_check): Likewise.
	* elf/dl-tunables.h (tunable_is_name): Likewise.
	* malloc/malloc.c (do_set_trim_threshold): Likewise.
	(do_set_top_pad): Likewise.
	(do_set_mmap_threshold): Likewise.
	(do_set_mmaps_max): Likewise.
	(do_set_mallopt_check): Likewise.
	(do_set_perturb_byte): Likewise.
	(do_set_arena_test): Likewise.
	(do_set_arena_max): Likewise.
	(do_set_tcache_max): Likewise.
	(do_set_tcache_count): Likewise.
	(do_set_tcache_unsorted_limit): Likewise.
	* nis/nis_subr.c (count_dots): Likewise.
	* nptl/allocatestack.c (advise_stack_range): Likewise.
	* sysdeps/ieee754/dbl-64/s_sin.c (do_cos): Likewise.
	(do_sin): Likewise.
	(reduce_sincos): Likewise.
	(do_sincos): Likewise.
	* sysdeps/unix/sysv/linux/x86/elision-conf.c
	(do_set_elision_enable): Likewise.
	(TUNABLE_CALLBACK_FNDECL): Likewise.
2019-02-06 17:16:43 +00:00
Florian Weimer
3b93559585 support: Use dlerror to detect NULL symbols in xdlsym 2019-02-06 16:45:25 +01:00
Florian Weimer
b433334065 x86: Remove unnecessary <stap-probe.h> include from lowlevellock.h
In the i386 case, it appears that the sole remaining LIBC_PROBE was
removed in commit a9fe4c5aa8 ("Support
six-argument syscalls from C for 32-bit x86, use generic
lowlevellock-futex.h (bug 18138)."), when
sysdeps/unix/sysv/linux/i386/lowlevellock-futex.h was replaced with
the generic version.

For x86_64, the relevant change is commit
76f71081cd ("Use generic
lowlevellock-futex.h in x86_64 lowlevellock.h."), again by using the
generic version of <lowlevellock-futex.h>.

Tested on i386 and x86_64, with and without --enable-systemtap.
2019-02-06 15:23:13 +01:00
Stefan Liebler
b6d8a999cd Fix wide char format specifier in libio/tst-bz24153.c.
On big endian systems the test fails with:
tst-bz24153.c:88: numeric comparison failure
   left: 1660944385 (0x63000001); from: ch
  right: 99 (0x63); from: L'c'
tst-bz24153.c:90: numeric comparison failure
   left: 1677721601 (0x64000001); from: ch
  right: 100 (0x64); from: L'd'
error: 2 test failures

One 'char' ("%c") is stored to the 'wchar_t *':
ch = 0x00000001 | 0x63000000

This patch is using "%lc" as format specifier to read a wchar_t.

ChangeLog:

	* libio/tst-bz24153.c (wide): Use wide char format specifier.
2019-02-06 12:29:02 +01:00
Stefan Liebler
94eeeec04b S390: Fix introduction of __wmemcmp and weak wmemcmp symbols.
The recent commit 65f7767a91
has introduced __wmemcmp and the weak alias wmemcmp.
This patch also introduces those symbols if glibc is build
with CFLAGS="-march=z13" where the ifunc is omitted.

ChangeLog:

	* sysdeps/s390/wmemcmp-vx.S: Add strong alias to
	__wmemcmp and weak alias to wmemcmp.
2019-02-06 09:10:31 +01:00
Stefan Liebler
bc79db3fd4 Fix alignment of TLS variables for tls variant TLS_TCB_AT_TP [BZ #23403]
The alignment of TLS variables is wrong if accessed from within a thread
for architectures with tls variant TLS_TCB_AT_TP.
For the main thread the static tls data is properly aligned.
For other threads the alignment depends on the alignment of the thread
pointer as the static tls data is located relative to this pointer.

This patch adds this alignment for TLS_TCB_AT_TP variants in the same way
as it is already done for TLS_DTV_AT_TP. The thread pointer is also already
properly aligned if the user provides its own stack for the new thread.

This patch extends the testcase nptl/tst-tls1.c in order to check the
alignment of the tls variables and it adds a pthread_create invocation
with a user provided stack.
The test itself is migrated from test-skeleton.c to test-driver.c
and the missing support functions xpthread_attr_setstack and xposix_memalign
are added.

ChangeLog:

	[BZ #23403]
	* nptl/allocatestack.c (allocate_stack): Align pointer pd for
	TLS_TCB_AT_TP tls variant.
	* nptl/tst-tls1.c: Migrate to support/test-driver.c.
	Add alignment checks.
	* support/Makefile (libsupport-routines): Add xposix_memalign and
	xpthread_setstack.
	* support/support.h: Add xposix_memalign.
	* support/xthread.h: Add xpthread_attr_setstack.
	* support/xposix_memalign.c: New File.
	* support/xpthread_attr_setstack.c: Likewise.
2019-02-06 09:06:34 +01:00
Florian Weimer
f1ac745583 arm: Use "nr" constraint for Systemtap probes [BZ #24164]
With the default "nor" constraint, current GCC will use the "o"
constraint for constants, after emitting the constant to memory.  That
results in unparseable Systemtap probe notes such as "-4@.L1052".
Removing the "o" alternative and using "nr" instead avoids this.
2019-02-05 13:01:08 +01:00
Joseph Myers
77dc0d8643 Fix assertion in malloc.c:tcache_get.
One of the warnings that appears with -Wextra is "ordered comparison
of pointer with integer zero" in malloc.c:tcache_get, for the
assertion:

  assert (tcache->entries[tc_idx] > 0);

Indeed, a "> 0" comparison does not make sense for
tcache->entries[tc_idx], which is a pointer.  My guess is that
tcache->counts[tc_idx] is what's intended here, and this patch changes
the assertion accordingly.

Tested for x86_64.

	* malloc/malloc.c (tcache_get): Compare tcache->counts[tc_idx]
	with 0, not tcache->entries[tc_idx].
2019-02-04 23:46:58 +00:00
Joseph Myers
7a0dcfc643 Remove duplicate initialization of field in nscd.
I'm looking at the warnings from building glibc with -Wextra, to see
if we could use -Wextra by default, possibly with a few of its
warnings disabled, and so benefit from warnings in -Wextra but not in
-Wall.  (The vast bulk of the extra warnings so produced are from
-Wunused-parameter -Wsign-compare -Wmissing-field-initializers
-Wtype-limits, so I expect those would be disabled at least at first.)

Various miscellaneous warnings show up with -Wextra that it clearly
seems to make sense to fix independent of whether we add -Wextra to
the normal options for building glibc.  This patch fixes one:
"initialized field overwritten [-Woverride-init]" in nscd.

Tested for x86_64.

	* nscd/connections.c (reqinfo): Initialize SHUTDOWN element only
	once.
2019-02-04 14:49:37 +00:00
Andreas Schwab
65f7767a91 Fix handling of collating elements in fnmatch (bug 17396, bug 16976)
This fixes the same bug in fnmatch that was fixed by commit 7e2f0d2d77 for
regexp matching.  As a side effect it also removes the use of an unbound
VLA.
2019-02-04 15:45:02 +01:00
H.J. Lu
3f635fb433 x86-64 memcmp: Use unsigned Jcc instructions on size [BZ #24155]
Since the size argument is unsigned. we should use unsigned Jcc
instructions, instead of signed, to check size.

Tested on x86-64 and x32, with and without --disable-multi-arch.

	[BZ #24155]
	CVE-2019-7309
	* NEWS: Updated for CVE-2019-7309.
	* sysdeps/x86_64/memcmp.S: Use RDX_LP for size.  Clear the
	upper 32 bits of RDX register for x32.  Use unsigned Jcc
	instructions, instead of signed.
	* sysdeps/x86_64/x32/Makefile (tests): Add tst-size_t-memcmp-2.
	* sysdeps/x86_64/x32/tst-size_t-memcmp-2.c: New test.
2019-02-04 06:31:13 -08:00
Florian Weimer
2ab5741b8a <spawn.h>: Add missing nonnull attributes and __restrict qualifiers
For consistency with execve, the __argv arguments are not marked
nonnull.
2019-02-04 14:37:05 +01:00
David Newall
8692ebdb12 elf: Implement --preload option for the dynamic linker 2019-02-04 13:35:12 +01:00
Matthew Malcomson
5e10136b3c testrun.sh: Exit in case of incorrect argument 2019-02-04 13:06:15 +01:00
Florian Weimer
221baae001 time: Avoid alignment gaps in __tzfile_read
By ordering the suballocations by decreasing alignment, alignment
gaps can be avoided.

Also use __glibc_unlikely for reading the transitions and type
indexes.  In the 8-byte case, two reads are now needed because the
transitions and type indexes are no longer adjacent.  The separate
call to __fread_unlocked does not matter from a performance point of
view because __tzfile_read is only invoked rarely.
2019-02-04 10:01:29 +01:00
Florian Weimer
b8c7238167 time: Use struct alloc_buffer in __tzfile_read
The computation of tzspec_len is moved in front of the total_size
computation, so that the allocation size computation and the
suballocations are next to each other.  Also add an assert that
tzspec_len is positive when it is actually used later.
2019-02-03 22:14:33 +01:00
Aurelien Jarno
11f382ee78 testsuite: stdlib/isomac.c: add missing include
When running the testsuite, building stdlib/isomac.c outputs the
following warning:

  gcc -O   -D_GNU_SOURCE -DIS_IN_build -include /home/aurel32/glibc-build/config.h isomac.c -o /home/aurel32/glibc-build/stdlib/isomac
  isomac.c: In function ‘get_null_defines’:
  isomac.c:260:3: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
     close (fd);
     ^~~~~
     pclose

Fix that by adding the <unistd.h> include.

Changelog:
	* stdlib/isomac.c: Include <unistd.h>.
2019-02-03 15:17:18 +01:00
Florian Weimer
77c7d55ece time: Use int, not long int, for internal GMT offsets
The GMT offset can be outside the range of a 16-bit int type, which
is presumably the reason why long int was used in struct tm.  We
cannot change struct tm, but we can change the internal type for
the offset.
2019-02-03 09:55:41 +01:00
Florian Weimer
ee9941f94e libio: Use stdin consistently for input functions [BZ #24153]
The internal _IO_stdin_ variable is not updated when the application
assigns to stdin, which is a GNU extension.
2019-02-03 09:38:24 +01:00
Florian Weimer
c70824b9a4 manual: Document lack of conformance of sched_* functions [BZ #14829]
On Linux, we define _POSIX_PRIORITY_SCHEDULING, but functions such
as sched_setparam and sched_setscheduler apply to individual threads,
not processes.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-02-02 14:15:27 +01:00
Joseph Myers
4dcbbc3b28 Require GCC 6.2 or later to build glibc.
As discussed during development for glibc 2.29, when we increased the
required minimum GCC version for building glibc to GCC 5, working
purely based on the times at which such requirements have been
increased in the past it would be appropriate for glibc 2.30 to
require GCC 6 (matching GCC 4.9 having been required for glibc 2.26).
Naming 6.2 specifically as the minimum version then means a separate
version requirement no longer needs to be specified for powerpc64le.

Thus, this patch increases the minimum to 6.2, removing the
documentation of the separate requirement for powerpc64le.  It does
not remove the powerpc64le configure test, or any __GNUC_PREREQ that
could be removed as not being in installed headers or files shared
with gnulib; I think such cleanups are best done separately.

Tested for x86_64.

	* configure.ac (libc_cv_compiler_ok): Require GCC 6.2 or later.
	* configure: Regenerated.
	* manual/install.texi (Tools for Compilation): Update minimum GCC
	version.
	* INSTALL: Regenerated.
2019-02-01 16:27:44 +00:00
Florian Weimer
6175507c06 support: Correct error message for TEST_COMPARE_STRING
It should say "string", not "blob".
2019-02-01 14:15:50 +01:00
Florian Weimer
baef194387 support: Handle AF_LOCAL, AF_UNSPEC in support_format_address_family 2019-02-01 14:15:50 +01:00
Florian Weimer
395599f0cf manual: Update struct sockaddr_in, struct sockaddr_sin6 description
Clarify the byte order of the the struct fields and document
sin6_flowinfo and sin6_scope_id.
2019-02-01 14:15:50 +01:00
Wilco Dijkstra
b06f4c0094 Cleanup clock_*time includes
Clock_gettime, settime and getres implementations are unncessarily
complex due to using defines and C file inclusion.  Simplify the
code by replacing the redundant defines and removing the inclusion,
making it much easier to understand.  No functional changes.

	* sysdeps/posix/clock_getres.c (__clock_getres): Cleanup.
	* sysdeps/unix/clock_gettime.c (__clock_gettime): Cleanup.
	* sysdeps/unix/clock_settime.c (__clock_settime): Cleanup.
	* sysdeps/unix/sysv/linux/clock_getres.c (__clock_getres): Cleanup.
	* sysdeps/unix/sysv/linux/clock_gettime.c (__clock_gettime): Cleanup.
	* sysdeps/unix/sysv/linux/clock_settime.c (__clock_settime): Cleanup.
2019-02-01 12:24:52 +00:00
Feng Xue
83d1cc42d8 aarch64: Optimized memchr specific to AmpereComputing emag
This version uses general register based memory instruction to load
data, because vector register based is slightly slower in emag.

Character-matching is performed on 16-byte (both size and alignment)
memory block in parallel each iteration.

    * sysdeps/aarch64/memchr.S (__memchr): Rename to MEMCHR.
    [!MEMCHR](MEMCHR): Set to __memchr.
    * sysdeps/aarch64/multiarch/Makefile (sysdep_routines):
    Add memchr_generic and memchr_nosimd.
    * sysdeps/aarch64/multiarch/ifunc-impl-list.c
    (__libc_ifunc_impl_list): Add memchr ifuncs.
    * sysdeps/aarch64/multiarch/memchr.c: New file.
    * sysdeps/aarch64/multiarch/memchr_generic.S: Likewise.
    * sysdeps/aarch64/multiarch/memchr_nosimd.S: Likewise.
2019-02-01 08:14:21 -05:00
Feng Xue
c7d3890ff5 aarch64: Optimized memset specific to AmpereComputing emag
This version uses general register based memory store instead of
vector register based, for the former is faster than the latter
in emag.

The fact that DC ZVA size in emag is 64-byte, is used by IFUNC
dispatch to select this memset, so that cost of runtime-check on
DC ZVA size can be saved.

    * sysdeps/aarch64/multiarch/Makefile (sysdep_routines):
    Add memset_emag.
    * sysdeps/aarch64/multiarch/ifunc-impl-list.c
    (__libc_ifunc_impl_list): Add __memset_emag to memset ifunc.
    * sysdeps/aarch64/multiarch/memset.c (libc_ifunc):
    Add IS_EMAG check for ifunc dispatch.
    * sysdeps/aarch64/multiarch/memset_base64.S: New file.
    * sysdeps/aarch64/multiarch/memset_emag.S: New file.
2019-02-01 07:59:18 -05:00
Feng Xue
07c3d1ec03 aarch64: Add AmpereComputing emag to tunable cpu list
Emag is a 64-bit CPU core released by AmpereComputing.

Add its name to cpu list, and corresponding macro as utilities for
later IFUNC dispatch.

    * manual/tunables.texi (Tunable glibc.cpu.name): Add emag.
    * sysdeps/unix/sysv/linux/aarch64/cpu-features.c (cpu_list):
    Add emag.
    * sysdeps/unix/sysv/linux/aarch64/cpu-features.h (IS_EMAG):
    New macro.
2019-02-01 07:59:18 -05:00
Stefan Liebler
114f792eae posix/tst-spawn: Fix racy tests in spawned processes.
From time to time I get fails in tst-spawn like:
tst-spawn.c:111: numeric comparison failure
   left: 0 (0x0); from: xlseek (fd2, 0, SEEK_CUR)
  right: 28 (0x1c); from: strlen (fd2string)
error: 1 test failures
tst-spawn.c:252: numeric comparison failure
   left: 1 (0x1); from: WEXITSTATUS (status)
  right: 0 (0x0); from: 0
error: 1 test failures

It turned out, that a child process is testing it's open file descriptors
with e.g. a sequence of testing the current position, setting the position
to zero and reading a specific amount of bytes.

Unfortunately starting with commit 2a69f853c0
the test is spawning a second child process which is sharing some of the
file descriptors.  If the test sequence as mentioned above is running in parallel
it leads to test failures.

As the second call of posix_spawn shall test a NULL pid argument,
this patch is just moving the waitpid of the first child
before the posix_spawn of the second child.

ChangeLog:

	* posix/tst-spawn do_test(): Move waitpid before posix_spawn.
2019-02-01 11:03:35 +01:00
Vineet Gupta
d5627550ae make-syscalls.sh: fix comment referencing syscall-template 2019-01-31 22:45:10 -05:00
Carlos O'Donell
5fc9ed4c40 nptl: Fix pthread_rwlock_try*lock stalls (Bug 23844)
For a full analysis of both the pthread_rwlock_tryrdlock() stall
and the pthread_rwlock_trywrlock() stall see:
https://sourceware.org/bugzilla/show_bug.cgi?id=23844#c14

In the pthread_rwlock_trydlock() function we fail to inspect for
PTHREAD_RWLOCK_FUTEX_USED in __wrphase_futex and wake the waiting
readers.

In the pthread_rwlock_trywrlock() function we write 1 to
__wrphase_futex and loose the setting of the PTHREAD_RWLOCK_FUTEX_USED
bit, again failing to wake waiting readers during unlock.

The fix in the case of pthread_rwlock_trydlock() is to check for
PTHREAD_RWLOCK_FUTEX_USED and wake the readers.

The fix in the case of pthread_rwlock_trywrlock() is to only write
1 to __wrphase_futex if we installed the write phase, since all other
readers would be spinning waiting for this step.

We add two new tests, one exercises the stall for
pthread_rwlock_trywrlock() which is easy to exercise, and one exercises
the stall for pthread_rwlock_trydlock() which is harder to exercise.

The pthread_rwlock_trywrlock() test fails consistently without the fix,
and passes after. The pthread_rwlock_tryrdlock() test fails roughly
5-10% of the time without the fix, and passes all the time after.

Signed-off-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Torvald Riegel <triegel@redhat.com>
Signed-off-by: Rik Prohaska <prohaska7@gmail.com>
Co-authored-by: Torvald Riegel <triegel@redhat.com>
Co-authored-by: Rik Prohaska <prohaska7@gmail.com>
2019-01-31 20:47:55 -05:00
Joseph Myers
932329a513 Use MPFR 4.0.2 in build-many-glibcs.py.
* scripts/build-many-glibcs.py (Context.checkout): Default MPFR
	version to 4.0.2.
2019-02-01 00:11:37 +00:00
Paul Pluzhnikov
5f10701fdc libio: use stdout in puts and putchar, etc [BZ #24051].
GLIBC explicitly allows one to assign a new FILE pointer to stdout and
other standard streams.  printf and wprintf were honouring assignment to
stdout and using the new value, but puts, putchar, and wide char variants
did not.

The stdout part is fixed here.  The stdin part will be fixed in a followup.
2019-01-31 14:07:45 -08:00
Paul Eggert
583dd860d5 regex: fix read overrun [BZ #24114]
Problem found by AddressSanitizer, reported by Hongxu Chen in:
https://debbugs.gnu.org/34140
* posix/regexec.c (proceed_next_node):
Do not read past end of input buffer.
2019-01-31 13:18:56 -08:00
Florian Weimer
2bac7daa58 nss_files: Fix /etc/aliases null pointer dereference [BZ #24059]
If /etc/aliases ends with a continuation line (a line that starts
with whitespace) which does not have a trailing newline character,
the file parser would crash due to a null pointer dereference.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-01-31 18:49:58 +01:00
Siddhesh Poyarekar
de44ab67aa Open master for 2.30 development 2019-01-31 22:39:14 +05:30
Siddhesh Poyarekar
56c86f5dd5 Tag 2.29 release
* version.h (RELEASE): Set to "stable".
	(VERSION): Set to "2.29".
	* include/features.h (__GLIBC_MINOR__): Set to 2.29.
2019-01-31 22:15:36 +05:30