Commit Graph

34945 Commits

Author SHA1 Message Date
Joseph Myers
57700813eb 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.

(cherry picked from commit 9333498794)
2020-03-11 12:59:12 +01:00
Fangrui Song
75fa5fd7c3 Improve IFUNC check [BZ #25506]
GNU ld's RISCV port does not support IFUNC. ld -no-pie produces no
relocation and the test passed incorrectly. Be more rigid by testing
IRELATIVE explicitly.

Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit 87a698a216)
2020-03-08 14:07:19 +01:00
Adhemerval Zanella
d53f5cac50 malloc/tst-mallocfork2: Kill lingering process for unexpected failures
If the test fails due some unexpected failure after the children
creation, either in the signal handler by calling abort or in the main
loop; the created children might not be killed properly.

This patches fixes it by:

  * Avoid aborting in the signal handler by setting a flag that
    an error has occured and add a check in the main loop.

  * Add a atexit handler to handle kill child processes.

Checked on x86_64-linux-gnu.
2020-02-27 17:27:19 -03:00
Adhemerval Zanella
74d9b0811e riscv: Avoid clobbering register parameters in syscall
The riscv INTERNAL_SYSCALL macro might clobber the register
parameter if the argument itself might clobber any register (a function
call for instance).

This patch fixes it by using temporary variables for the expressions
between the register assignments (as indicated by GCC documentation,
6.47.5.2 Specifying Registers for Local Variables).

It is similar to the fix done for MIPS (bug 25523).

Checked with riscv64-linux-gnu-rv64imafdc-lp64d build.

(cherry picked from commit be74b42ee2)
2020-02-16 15:16:50 +01:00
Adhemerval Zanella
e1766196b6 microblaze: Avoid clobbering register parameters in syscall
The microblaze INTERNAL_SYSCALL macro might clobber the register
parameter if the argument itself might clobber any register (a function
call for instance).

This patch fixes it by using temporary variables for the expressions
between the register assignments (as indicated by GCC documentation,
6.47.5.2 Specifying Registers for Local Variables).

It is similar to the fix done for MIPS (bug 25523).

Checked with microblaze-linux-gnu and microblazeel-linux-gnu build.

(cherry picked from commit 6cc8fc7c15)
2020-02-16 15:16:10 +01:00
WANG Xuerui
b3be12767c 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 381a0c26d7).

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

(cherry picked from commit 4fbba6fe90)
2020-02-16 11:44:25 +01:00
WANG Xuerui
761c0e6086 mips: Use 'long int' and 'long long int' in linux syscall code
Style fixes only, no functional change.

(cherry picked from commit d3fbb18aa3)
2020-02-16 11:40:39 +01:00
John David Anglin
43598ef6e2 hppa: Align __clone stack argument to 8 bytes (Bug 25066)
The hppa architecture requires strict alignment for loads and stores.
As a result, the minimum stack alignment that will work is 8 bytes.
This patch adjusts __clone() to align the stack argument passed to it.
It also adjusts slightly some formatting.

This fixes the nptl/tst-tls1 test.

(cherry picked from commit e4c23a029a)
2020-02-05 22:13:40 +01:00
Florian Weimer
994e529a37 Remove incorrect alloc_size attribute from pvalloc [BZ #25401]
pvalloc is guarantueed to round up the allocation size to the page
size, so applications can assume that the memory region is larger
than the passed-in argument.  The alloc_size attribute cannot express
that.

The test case is based on a suggestion from Jakub Jelinek.

This fixes commit 9bf8e29ca1 ("malloc:
make malloc fail with requests larger than PTRDIFF_MAX (BZ#23741)").

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit 768c83b7f6)
2020-01-17 15:11:20 +01:00
Florian Weimer
858069cb60 login: Use pread64 in utmp implementation
This reduces the possible error scenarios considerably because
no longer can file seek fail, leaving the file descriptor in an
inconsistent state and out of sync with the cache.

As a result, it is possible to avoid setting file_offset to -1
to make an error persistent.  Instead, subsequent calls will retry
the operation and report any errors returned by the kernel.

This change also avoids reading the file from the start if pututline
is called multiple times, to work around lock acquisition failures
due to timeouts.

Change-Id: If21ea0c162c38830a89331ea93cddec14c0974de
(cherry picked from commit d4625a19fe)
2020-01-17 13:56:43 +01:00
Leandro Pereira
6359e79b4c Add nocancel version of pread64()
This is in preparation for changes in the dynamic linker so that
pread() is used instead of lseek()+read().

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit fed33b0fb0)
2020-01-17 13:56:43 +01:00
Florian Weimer
dfa1f9fe0d login: Introduce matches_last_entry to utmp processing
This simplifies internal_getut_nolock and fixes a regression,
introduced in commit be6b16d975
("login: Acquire write lock early in pututline [BZ #24882]")
in pututxline because __utmp_equal can only compare process-related
utmp entries.

Fixes: be6b16d975
Change-Id: Ib8a85002f7f87ee41590846d16d7e52bdb82f5a5
(cherry picked from commit 76a7c103eb)
2020-01-17 13:56:43 +01:00
Florian Weimer
83f793e6a6 login: Acquire write lock early in pututline [BZ #24882]
It has been reported that due to lack of fairness in POSIX file
locking, the current reader-to-writer lock upgrade can result in
lack of forward progress.  Acquiring the write lock directly
hopefully avoids this issue if there are only writers.

This also fixes bug 24882 due to the cache revalidation in
__libc_pututline.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Change-Id: I57e31ae30719e609a53505a0924dda101d46372e
(cherry picked from commit be6b16d975)
2020-01-17 13:56:29 +01:00
Florian Weimer
85da102c52 login: Add nonstring attributes to struct utmp, struct utmpx [BZ #24899]
Commit 7532837d7b ("The
-Wstringop-truncation option new in GCC 8 detects common misuses")
added __attribute_nonstring__ to bits/utmp.h, but it did not update
the parallel bits/utmpx.h header.  In struct utmp, the nonstring
attribute for ut_id was missing.

(cherry picked from commit c2adefbafc)
2020-01-17 13:56:00 +01:00
Florian Weimer
143cea84a0 login: Remove double-assignment of fl.l_whence in try_file_lock
Since l_whence is the second member of struct flock, it is written
twice.  The double-assignment is technically undefined behavior due to
the lack of a sequence point.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Change-Id: I2baf9e70690e723c61051b25ccbd510aec15976c
(cherry picked from commit b0a83ae71b)
2020-01-17 13:55:40 +01:00
Florian Weimer
f0cd1cfbe3 login: pututxline could fail to overwrite existing entries [BZ #24902]
The internal_getut_r function updates the file_offset variable and
therefore must always update last_entry as well.

Previously, if pututxline could not upgrade the read lock to a
write lock, internal_getut_r would update file_offset only,
without updating last_entry, and a subsequent call would not
overwrite the existing utmpx entry at file_offset, instead
creating a new entry.  This has been observed to cause unbounded
file growth in high-load situations.

This commit removes the buffer argument to internal_getut_r and
updates the last_entry variable directly, along with file_offset.

Initially reported and fixed by Ondřej Lysoněk.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
(cherry picked from commit 61d3db4281)
2020-01-17 13:55:35 +01:00
Florian Weimer
dbbd748c5f login: Use struct flock64 in utmp [BZ #24880]
Commit 06ab719d30 ("Fix Linux fcntl OFD
locks for non-LFS architectures (BZ#20251)") introduced the use of
fcntl64 into the utmp implementation.  However, the lock file
structure was not updated to struct flock64 at that point.

(cherry picked from commit 0d5b291753)
2020-01-17 13:55:03 +01:00
Florian Weimer
8baeebad9a login: Disarm timer after utmp lock acquisition [BZ #24879]
If the file processing takes a long time for some reason, SIGALRM can
arrive while the file is still being processed.  At that point, file
access will fail with EINTR.  Disarming the timer after lock
acquisition avoids that.  (If there was a previous alarm, it is the
responsibility of the caller to deal with the EINTR error.)

(cherry picked from commit 628598be7e)
2020-01-17 13:54:37 +01:00
Florian Weimer
16a5765042 login: Fix updwtmp, updwtmx unlocking
Commit 5a3afa9738 (login: Replace
macro-based control flow with function calls in utmp) introduced
a regression because after it, __libc_updwtmp attempts to unlock
the wrong file descriptor.

(cherry picked from commit 341da5b4b6)
2020-01-17 13:54:11 +01:00
Florian Weimer
2f02abb81c login: Replace macro-based control flow with function calls in utmp
(cherry picked from commit 5a3afa9738)
2020-01-17 13:54:11 +01:00
Florian Weimer
799f4baa1d login: Assume that _HAVE_UT_* constants are true
Make the GNU version of bits/utmp.h the generic version because
all remaining ports use it (with a sysdeps override for
Linux s390/s390x).

(cherry picked from commit a33b817f13)
2020-01-17 13:54:11 +01:00
Florian Weimer
b90aefd4ac login: Remove utmp backend jump tables [BZ #23518]
There is just one file-based implementation, so this dispatch
mechanism is unnecessary.  Instead of the vtable pointer
__libc_utmp_jump_table, use a non-negative file_fd as the indicator
that the backend is initialized.

(cherry picked from commit 1a7fe2ebe5)
2020-01-17 13:54:07 +01:00
Florian Weimer
50f20fe506 misc/test-errno-linux: Handle EINVAL from quotactl
In commit 3dd4d40b420846dd35869ccc8f8627feef2cff32 ("xfs: Sanity check
flags of Q_XQUOTARM call"), Linux 5.4 added checking for the flags
argument, causing the test to fail due to too restrictive test
expectations.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit 1f7525d924)
2019-12-05 17:30:13 +01:00
Kamlesh Kumar
4719e1851c <string.h>: Define __CORRECT_ISO_CPP_STRING_H_PROTO for Clang [BZ #25232]
Without the asm redirects, strchr et al. are not const-correct.

libc++ has a wrapper header that works with and without
__CORRECT_ISO_CPP_STRING_H_PROTO (using a Clang extension).  But when
Clang is used with libstdc++ or just C headers, the overloaded functions
with the correct types are not declared.

This change does not impact current GCC (with libstdc++ or libc++).

(cherry picked from commit 953ceff17a)
2019-12-05 16:54:47 +01:00
Florian Weimer
761452f127 x86: Assume --enable-cet if GCC defaults to CET [BZ #25225]
This links in CET support if GCC defaults to CET.  Otherwise, __CET__
is defined, yet CET functionality is not compiled and linked into the
dynamic loader, resulting in a linker failure due to undefined
references to _dl_cet_check and _dl_open_check.
2019-12-03 20:26:28 +01:00
Florian Weimer
5a08bdb1e7 libio: Disable vtable validation for pre-2.1 interposed handles [BZ #25203]
Commit c402355dfa ("libio: Disable
vtable validation in case of interposition [BZ #23313]") only covered
the interposable glibc 2.1 handles, in libio/stdfiles.c.  The
parallel code in libio/oldstdfiles.c needs similar detection logic.

Fixes (again) commit db3476aff1
("libio: Implement vtable verification [BZ #20191]").

Change-Id: Ief6f9f17e91d1f7263421c56a7dc018f4f595c21
(cherry picked from commit cb61630ed7)
2019-11-28 14:18:12 +01:00
Stefan Liebler
f4419b0d01 S390: Fix handling of needles crossing a page in strstr z15 ifunc-variant. [BZ #25226]
If the specified needle crosses a page-boundary, the s390-z15 ifunc variant of
strstr truncates the needle which results in invalid results.

This is fixed by loading the needle beyond the page boundary to v18 instead of v16.
The bug is sometimes observable in test-strstr.c in check1 and check2 as the
haystack and needle is stored on stack. Thus the needle can be on a page boundary.

check2 is now extended to test haystack / needles located on stack, at end of page
and on two pages.

This bug was introduced with commit 6f47401bd5
("S390: Add arch13 strstr ifunc variant.") and is already released in glibc 2.30.

(cherry picked from commit bfdb731438)
2019-11-27 12:38:58 +01:00
Marcin Kościelnicki
37c90e1173 rtld: Check __libc_enable_secure before honoring LD_PREFER_MAP_32BIT_EXEC (CVE-2019-19126) [BZ #25204]
The problem was introduced in glibc 2.23, in commit
b9eb92ab05
("Add Prefer_MAP_32BIT_EXEC to map executable pages with MAP_32BIT").

(cherry picked from commit d5dfad4326)
2019-11-22 13:09:23 +01:00
Emilio Cobos Álvarez
a4b3bbf71e Don't use a custom wrapper macro around __has_include (bug 25189).
This causes issues when using clang with -frewrite-includes to e.g.,
submit the translation unit to a distributed compiler.

In my case, I was building Firefox using sccache.

See [1] for a reduced test-case since I initially thought this was a
clang bug, and [2] for more context.

Apparently doing this is invalid C++ per [cpp.cond], which mentions [3]:

> The #ifdef and #ifndef directives, and the defined conditional
> inclusion operator, shall treat __has_include and __has_cpp_attribute
> as if they were the names of defined macros.  The identifiers
> __has_include and __has_cpp_attribute shall not appear in any context
> not mentioned in this subclause.

[1]: https://bugs.llvm.org/show_bug.cgi?id=43982
[2]: https://bugs.llvm.org/show_bug.cgi?id=37990
[3]: http://eel.is/c++draft/cpp.cond#7.sentence-2

Change-Id: Id4b8ee19176a9e4624b533087ba870c418f27e60
(cherry picked from commit bfa864e164)
2019-11-22 13:09:01 +01:00
DJ Delorie
919af705ee Base max_fast on alignment, not width, of bins (Bug 24903)
set_max_fast sets the "impossibly small" value based on,
eventually, MALLOC_ALIGNMENT.  The comparisons for the smallest
chunk used is, eventually, MIN_CHUNK_SIZE.  Note that i386
is the only platform where these are the same, so a smallest
chunk *would* be put in a no-fastbins fastbin.

This change calculates the "impossibly small" value
based on MIN_CHUNK_SIZE instead, so that we can know it will
always be impossibly small.

(cherry picked from commit ff12e0fb91)
2019-11-19 12:27:04 +01:00
Florian Weimer
09abef31a5 malloc: Various cleanups for malloc/tst-mxfast
(cherry picked from commit f9769a2397)
2019-11-19 12:26:20 +01:00
DJ Delorie
09b81b2bab Add glibc.malloc.mxfast tunable
* elf/dl-tunables.list: Add glibc.malloc.mxfast.
* manual/tunables.texi: Document it.
* malloc/malloc.c (do_set_mxfast): New.
(__libc_mallopt): Call it.
* malloc/arena.c: Add mxfast tunable.
* malloc/tst-mxfast.c: New.
* malloc/Makefile: Add it.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit c48d92b430)
2019-11-19 12:24:06 +01:00
Niklas Hambüchen
5f620768fb malloc: Fix missing accounting of top chunk in malloc_info [BZ #24026]
Fixes `<total type="rest" size="..."> incorrectly showing as 0 most
of the time.

The rest value being wrong is significant because to compute the
actual amount of memory handed out via malloc, the user must subtract
it from <system type="current" size="...">. That result being wrong
makes investigating memory fragmentation issues like
<https://bugzilla.redhat.com/show_bug.cgi?id=843478> close to
impossible.

(cherry picked from commit b6d2c4475d)
2019-11-19 12:23:07 +01:00
Dragan Mladjenovic
c347431fb5 mips: Force RWX stack for hard-float builds that can run on pre-4.8 kernels
Linux/Mips kernels prior to 4.8 could potentially crash the user
process when doing FPU emulation while running on non-executable
user stack.

Currently, gcc doesn't emit .note.GNU-stack for mips, but that will
change in the future. To ensure that glibc can be used with such
future gcc, without silently resulting in binaries that might crash
in runtime, this patch forces RWX stack for all built objects if
configured to run against minimum kernel version less than 4.8.

	* sysdeps/unix/sysv/linux/mips/Makefile
	(test-xfail-check-execstack):
	Move under mips-has-gnustack != yes.
	(CFLAGS-.o*, ASFLAGS-.o*): New rules.
	Apply -Wa,-execstack if mips-force-execstack == yes.
	* sysdeps/unix/sysv/linux/mips/configure: Regenerated.
	* sysdeps/unix/sysv/linux/mips/configure.ac
	(mips-force-execstack): New var.
	Set to yes for hard-float builds with minimum_kernel < 4.8.0
	or minimum_kernel not set at all.
	(mips-has-gnustack): New var.
	Use value of libc_cv_as_noexecstack
	if mips-force-execstack != yes, otherwise set to no.

(cherry picked from commit 33bc9efd91)
2019-11-05 14:57:13 -03:00
Gabriel F. T. Gomes
fca2d6186a Make tst-strftime2 and tst-strftime3 depend on locale generation
Building the test cases in parallel might make tst-strftime2 and
tst-strftime3 fail.  Simply re-running the test case (or building
serially) makes the problem go away.  This patch adds the necessary
dependency to allow parallel builds in the time subdirectory.

Tested for powerpc64le.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
(cherry picked from commit 52151051b3)
2019-10-31 21:49:14 +00:00
Stefan Liebler
5397c399f9 S390: Add new s390 platform z15.
The new IBM z15 is added to platform string array.
The macro _DL_PLATFORMS_COUNT is incremented.

(cherry picked from commit 2901743568)
2019-10-18 15:07:15 +02:00
Joseph Myers
a6aaabd036 Fix RISC-V vfork build with Linux 5.3 kernel headers.
Building glibc for RISC-V with Linux 5.3 kernel headers fails because
<linux/sched.h>, included in vfork.S for CLONE_* constants, contains a
structure definition not safe for inclusion in assembly code.

All other architectures already avoid use of that header in vfork.S,
either defining the CLONE_* constants locally or embedding the
required values directly in the relevant instruction, where they
implement vfork using the clone syscall (see the implementations for
aarch64, ia64, mips and nios2).  This patch makes the RISC-V version
define the constants locally like the other architectures.

Tested build for all three RISC-V configurations in
build-many-glibcs.py with Linux 5.3 headers.

	* sysdeps/unix/sysv/linux/riscv/vfork.S: Do not include
	<linux/sched.h>.
	(CLONE_VM): New macro.
	(CLONE_VFORK): Likewise.

(cherry picked from commit 8cacbcf4a9)
2019-09-20 21:28:34 +02:00
Aurelien Jarno
b1299aab22 alpha: force old OSF1 syscalls for getegid, geteuid and getppid [BZ #24986]
On alpha, Linux kernel 5.1 added the standard getegid, geteuid and
getppid syscalls (commit ecf7e0a4ad15287). Up to now alpha was using
the corresponding OSF1 syscalls through:
 - sysdeps/unix/alpha/getegid.S
 - sysdeps/unix/alpha/geteuid.S
 - sysdeps/unix/alpha/getppid.S

When building against kernel headers >= 5.1, the glibc now use the new
syscalls through sysdeps/unix/sysv/linux/syscalls.list. When it is then
used with an older kernel, the corresponding 3 functions fail.

A quick fix is to move the OSF1 wrappers under the
sysdeps/unix/sysv/linux/alpha directory so they override the standard
linux ones. A better fix would be to try the new syscalls and fallback
to the old OSF1 in case the new ones fail. This can be implemented in
a later commit.

Changelog:
	[BZ #24986]
        * sysdeps/unix/alpha/getegid.S: Move to ...
	* sysdeps/unix/sysv/linux/alpha/getegid.S: ... here.
        * sysdeps/unix/alpha/geteuid.S: Move to ...
	* sysdeps/unix/sysv/linux/alpha/geteuid.S: ... here.
        * sysdeps/unix/alpha/getppid.S: Move to ...
	* sysdeps/unix/sysv/linux/alpha/getppid.S: ... here
(cherry picked from commit 1a6566094d)
2019-09-14 20:08:02 +02:00
Adhemerval Zanella
3c3f8dc307 hppa: Update libm-tests-ulps
The make regen-ulps was done on a PA8900 with 8.3.0.

	* sysdeps/hppa/fpu/libm-test-ulps: Update.

(cherry picked from commit 3175dcc1e6)
2019-09-08 22:57:15 +02:00
Aurelien Jarno
5438639cff Update Alpha libm-test-ulps
Changelog:

	* sysdeps/alpha/fpu/libm-test-ulps: Regenerated using GCC 9.2.

(cherry picked from commit b5367a08ae)
2019-09-03 21:38:07 +02:00
Rafal Luzynski
d74461fa34 Chinese locales: Set first_weekday to 2 (bug 24682).
The first day of the week in China (Mainland) should be Monday according
to the national standard GB/T 7408-2005.  References:

* https://www.doc88.com/p-1166696540287.html
* https://unicode-org.atlassian.net/browse/CLDR-11510

	[BZ #24682]
	* NEWS: Mention this bug fixed.
	* localedata/locales/bo_CN (first_weekday): Add, set to 2 (Monday).
	* localedata/locales/ug_CN (first_weekday): Likewise.
	* localedata/locales/zh_CN (first_weekday): Likewise.

(cherry picked from commit c0fd3244e7)
2019-08-28 22:37:52 +02:00
Florian Weimer
be9a328c93 malloc: Remove unwanted leading whitespace in malloc_info [BZ #24867]
It was introduced in commit 6c8dbf00f5
("Reformat malloc to gnu style.").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit b0f6679bcd)
2019-08-01 16:48:12 +02:00
Carlos O'Donell
0a8262a1b2 Tag 2.30 release. 2019-08-01 00:29:31 -04:00
Carlos O'Donell
e712490684 Update install and NEWS for 2.30 release. 2019-08-01 00:22:46 -04:00
Carlos O'Donell
cc3bf31933 Update translations.
Update translations from translationproject.org for 2.29.9000.
2019-07-31 23:38:15 -04:00
Florian Weimer
0bfddfc944 iconv: Revert steps array reference counting changes
The changes introduce a memory leak for gconv steps arrays whose
first element is an internal conversion, which has a fixed
reference count which is not decremented.  As a result, after the
change in commit 50ce3eae5b, the steps
array is never freed, resulting in an unbounded memory leak.

This reverts commit 50ce3eae5b
("gconv: Check reference count in __gconv_release_cache
[BZ #24677]") and commit 7e740ab2e7
("libio: Fix gconv-related memory leak [BZ #24583]").  It
reintroduces bug 24583.  (Bug 24677 was just a regression caused by
the second commit.)
2019-07-31 11:43:59 +02:00
Joseph Myers
c86b8e7579 Restore r31 setting in powerpc32 swapcontext.
Commit ffe8a9a831, "powerpc: Remove
rt_sigreturn usage on context function", removed from powerpc32
swapcontext a setting of r31 that is relied upon in subsequent code.
I'm not sure why this didn't produce test failures in Adhemerval's
32-bit testing; in my (soft-float) testing in preparation for 2.30
release, I see several context-related failures

FAIL: stdlib/tst-makecontext2
FAIL: stdlib/tst-makecontext3
FAIL: stdlib/tst-setcontext
FAIL: stdlib/tst-setcontext2
FAIL: stdlib/tst-setcontext4
FAIL: stdlib/tst-setcontext7
FAIL: stdlib/tst-setcontext9
FAIL: stdlib/tst-swapcontext1

that did not appear in 2.29 testing.  This patch restores the removed
register setting in question, and thus fixes those failures.

Tested for powerpc (soft-float).

	* sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
	(__CONTEXT_FUNC_NAME): Restore setting of r31.
2019-07-30 14:05:11 +00:00
Florian Weimer
8a814e20d4 nptl: Use uintptr_t for address diagnostic in nptl/tst-pthread-getattr
Recent GCC versions warn about the attempt to return the address of a
local variable:

tst-pthread-getattr.c: In function ‘allocate_and_test’:
tst-pthread-getattr.c:54:10: error: function returns address of local variable [-Werror=return-local-addr]
   54 |   return mem;
      |          ^~~
In file included from ../include/alloca.h:3,
                 from tst-pthread-getattr.c:26:
../stdlib/alloca.h:35:23: note: declared here
   35 | # define alloca(size) __builtin_alloca (size)
      |                       ^~~~~~~~~~~~~~~~~~~~~~~
tst-pthread-getattr.c:51:9: note: in expansion of macro ‘alloca’
   51 |   mem = alloca ((size_t) (mem - target));
      |         ^~~~~~

The address itself is used in a check in the caller, so using
uintptr_t instead is reasonable.
2019-07-30 10:35:08 +02:00
Florian Weimer
b8b3d5a14e Linux: Move getdents64 to <dirent.h>
This matches the location of the declaration in musl.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-07-29 21:02:46 +02:00
Tulio Magno Quites Machado Filho
354e4c1add test-container: Install with $(sorted-subdirs) [BZ #24794]
Commit 35e038c1d2 started to use an
incomplete list of subdirs based on $(all-subdirs) causing
testroot.pristine to miss files from nss.

Tested if the list of files in testroot.pristine remains the same.

	[BZ #24794]
	* Makeconfig (all-subdirs): Improved source comments.
	* Makefile (testroot.pristine/install.stamp): Pass
	subdirs='$(sorted-subdirs)' to make install.
2019-07-29 10:31:06 -03:00