Filip Ochnik spotted that one of the error jumps in gethosts fails to
call __resolv_context_put to release the resolver context.
Fixes commit 352f4ff9a2 ("resolv:
Introduce struct resolv_context [BZ #21668]") and commit
964263bb8d ("getaddrinfo: Release
resolver context on error in gethosts [BZ #21885]").
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
The commit 446997ff14 introduced
this new usage of resplen. If build with gcc 9 -march>=z13 on s390x,
the following warning occurs:
res_send.c: In function ‘__res_context_send’:
res_send.c:539:6: error: ‘resplen’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
539 | if (resplen > HFIXEDSZ)
| ^
Therefore this patch adds a further DIAG_IGNORE_NEEDS_COMMENT in the
same way as it was previously done for usages of resplen or n.
See commit d1bc2cbbed.
The translation project coordinator Benno Schulenberg suggested that
we could save space in our tarball by trimming the generated po files
by using msgattrib and dropping all untranslated, fuzzy and obsolete
messages. This patch updates the update-translations target to do
that. Testing indicates that the current po files reduce by over 65K
lines due to this trimming.
The latest translations in the translationproject URL need to be
merged in using msgmerge for the po files to be correctly updated,
otherwise we may end up getting odd results, such as the previous
translations update. This patch adds another step to the
update-translations Makefile target which does a msgmerge of the
downloaded po file with libc.pot and then uses that as the final
result.
The build has been failing on powerpc64le-linux-gnu with GCC 10
due to a maybe-uninitialized error:
../sysdeps/ieee754/dbl-64/mpa.c:875:6: error: ‘w.e’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
875 | EY -= EX;
| ^~
The warning is thrown because when __inv is called by __dvd *y is not
initialized and if t == 0 before calling __dbl_mp, EY will stay
uninitialized, as the function does not touch it in this case.
However, since t will be set to 1/t before calling __dbl_mp, t == 0 will
never happen, so we can instruct the compiler to ignore this case, which
suppresses the warning.
Tested on powerpc64le.
Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
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>
This test was failing in some powerpc systems as it was not checking
for ENOSPC return.
As said on the Linux man-pages and can be observed by the implementation
at mm/mprotect.c in the Linux Kernel source. The syscall pkey_alloc can
return EINVAL or ENOSPC. ENOSPC will indicate either that all keys are
in use or that the kernel does not support pkeys.
Reviewed-by: Gabriel F. T. Gomes <gabriel@inconstante.net.br>
GCC 10.0 enabled -fno-common by default and this started to point that
__cache_line_size had been implemented in 2 different places: loader and
libc.
In order to avoid this duplication, the libc variable has been removed
and the loader variable is moved to rtld_global_ro.
File sysdeps/unix/sysv/linux/powerpc/dl-auxv.h has been added in order
to reuse code for both static and dynamic linking scenarios.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Initialize dl_auxv, dl_hwcap and dl_hwcap2 in rtld_global_ro for DSOs
that have been statically dlopen'ed.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
The update-translation target seems to have downloaded outdated
translations for these languages. Revert them and try to figure out
if this is a problem with the target or an error in translations.
Without CET, a jump into a newly loaded object through an overwritten
link map often does not crash, it just executes some random code.
CET detects this in some cases because the function pointer does not
point to the start of a function in the replacement shared object,
so there is no ENDBR instruction.
The new test uses a small shared object and the existing dangling
link map to trigger the bug.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
We should clear GL(dl_initfirst) when freeing its link_map memory.
Tested on Fedora 31/x86-64 with CET.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
This patch updates build-many-glibcs.py for the move of GCC to git,
teaching it to do the initial checkout from git, to replace an SVN
checkout with a git one if --replace-sources is used, and to get the
commit identifier from a git checkout after updating it.
This new test was introduced with recent commit
591236f1a3.
If run on 32bit, it fails while renaming tst-ldconfig-ld-mod.so as there is no
/usr/lib64 directory. This patch is constructing the file name with help of
support_libdir_prefix.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* timezone/version: New file, also taken from tzcode2018i.
* timezone/README: Reword so that people needn't paw through
old ChangeLog files to see which version we're using, a process
that is error-prone. Update an obsolescent URL.
Test ldconfig after /etc/ld.so.conf update and verify a running process
observes changes to /etc/ld.so.cache.
The test uses the test-in-container framework.
Reviewed-by: Arjun Shankar <arjun@redhat.com>
Mostly English grammar and style improvements. The bullet list is
reorganized a little for clarity. The details of exactly which
Linux-based ports still report system-wide time zone information
from gettimeofday has been removed, as this is not intended to be
something people should rely on.
Also clarify the deprecation of older SPARC ISAs, based on the fact
that “SPARC version 7” is actually the very first version of the SPARC
ISA (Sun Microsystems was very fond of letting the marketing
department pick version numbers).
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
We no longer write manual ChangeLog entries since they are
auto-generated at release time. Drop dependency of the `make dist`
target on the file and document the fact that the latest ChangeLog
entries can be read in the highest numbered ChangeLog.N file in
ChangeLog.old.
The ChangeLog.old/ChangeLog.20 file for 2.31 will thus be generated
just before tagging a release.
Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
In commit aa706e13f4,
sysdeps/mips/ieee754/ieee754.h was changed to use GCC’s predefined
macro __LDBL_MANT_DIG__, instead of including <float.h> and using
LDBL_MANT_DIG (and therefore polluting the user namespace with all of
the macros defined in float.h). In order to support compilers that
don’t provide __LDBL_MANT_DIG__, there is a fallback #if block which
was supposed to include <float.h> and then define __LDBL_MANT_DIG__ to
LDBL_MANT_DIG. However, at some point during the development of the
patch, a typo was introduced, causing the fallback block to define
__LDBL_MANT_DIG__ to expand to __LDBL_MANT_DIG__.
Correct this typo.
Add another newline when the number of files differing is too large.
This is typical for across-the-board changes such as the copyright
year update that happened recently.
Without a proper size, we get MACH_RCV_TOO_LARGE instead of MACH_MSG_SUCCESS.
* sysdeps/mach/hurd/setitimer.c (timer_thread): Add return_code_type
field to received message, and set the receive size in __mach_msg call.
As explained on
https://sourceware.org/ml/libc-alpha/2020-01/msg00049.html
the presence of __errno_location in libpthread.so on GNU/Linux makes
libpthread getting linked in for libstdc++. This aligns on that behavior, to
avoid issues that only GNU/Hurd would get.
This follows bd60ce8652 ('nptl: Move pthread_atfork to libc_nonshared.a')
with the same rationale: there is no non-libpthread equivalent to be used
for making linking against libpthread optional.
libpthread_nonshared.a is unused after this, so remove it from the
build.
There is no ABI impact because pthread_atfork was implemented using
__register_atfork in libc even before this change.
pthread_atfork has to be a weak alias because pthread_* names are not
reserved in libc.
This patch avoid probing the __NR_clock_getttime64 syscall each time
__clock_gettime64 is issued on a kernel without 64 bit time support.
Once ENOSYS is obtained, only 32-bit clock_gettime are used.
The following snippet:
clock_getres (CLOCK_REALTIME, &(struct timespec) { 0 });
clock_getres (CLOCK_MONOTONIC, &(struct timespec) { 0 });
clock_getres (CLOCK_BOOTTIME, &(struct timespec) { 0 });
clock_getres (20, &(struct timespec) { 0 });
On a kernel without 64 bit time support issues the syscalls:
syscall_0x196(0, 0xffb83330, [...]) = -1 ENOSYS (Function not implemented)
clock_getres(CLOCK_REALTIME, {tv_sec=0, tv_nsec=1}) = 0
clock_getres(CLOCK_MONOTONIC, {tv_sec=0, tv_nsec=1}) = 0
clock_getres(CLOCK_BOOTTIME, {tv_sec=0, tv_nsec=1}) = 0
Checked on i686-linux-gnu on 4.15 kernel.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
No architecture currently defines the vDSO symbol. On archictures
with 64-bit time_t the HAVE_CLOCK_GETRES_VSYSCALL is renamed to
HAVE_CLOCK_GETRES64_VSYSCALL, it simplifies clock_gettime code.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
It was added on Linux 5.3 (commit 22ca962288c0a).
Checked on i686-linux-gnu with 5.3.0 kernel.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
This patch avoid probing the __NR_clock_getttime64 syscall each time
__clock_gettime64 is issued on a kernel without 64 bit time support.
Once ENOSYS is obtained, only 32-bit clock_gettime are used.
The following snippet:
clock_gettime (CLOCK_REALTIME, &(struct timespec) { 0 });
clock_gettime (CLOCK_MONOTONIC, &(struct timespec) { 0 });
clock_gettime (CLOCK_BOOTTIME, &(struct timespec) { 0 });
clock_gettime (20, &(struct timespec) { 0 });
On a kernel without 64 bit time support and with vDSO support results
on the following syscalls:
syscall_0x193(0, 0xff87ba30, [...]) = -1 ENOSYS (Function not implemented)
clock_gettime(CLOCK_BOOTTIME, {tv_sec=927082, tv_nsec=474382032}) = 0
clock_gettime(0x14 /* CLOCK_??? */, 0xff87b9f8) = -1 EINVAL (Invalid argument)
While on a kernel without vDSO support:
syscall_0x193(0, 0xbec95550, 0xb6ed2000, 0x1, 0xbec95550, 0) = -1 (errno 38)
clock_gettime(CLOCK_REALTIME, {tv_sec=1576615930, tv_nsec=638250162}) = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=1665478, tv_nsec=638779620}) = 0
clock_gettime(CLOCK_BOOTTIME, {tv_sec=1675418, tv_nsec=292932704}) = 0
clock_gettime(0x14 /* CLOCK_??? */, 0xbec95530) = -1 EINVAL (Invalid argument)
Checked on i686-linux-gnu on 4.15 kernel and on a 5.3 kernel.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
No architecture currently defines the vDSO symbol. On architectures
with 64-bit time_t the HAVE_CLOCK_GETTIME_VSYSCALL is renamed to
HAVE_CLOCK_GETTIME64_VSYSCALL, it simplifies clock_gettime code.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
This patch moves the vDSO setup from libc to loader code, just after
the vDSO link_map setup. For static case the initialization
is moved to _dl_non_dynamic_init instead.
Instead of using the mangled pointer, the vDSO data is set as
attribute_relro (on _rtld_global_ro for shared or _dl_vdso_* for
static). It is read-only even with partial relro.
It fixes BZ#24967 now that the vDSO pointer is setup earlier than
malloc interposition is called.
Also, vDSO calls should not be a problem for static dlopen as
indicated by BZ#20802. The vDSO pointer would be zero-initialized
and the syscall will be issued instead.
Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu,
arm-linux-gnueabihf, powerpc64le-linux-gnu, powerpc64-linux-gnu,
powerpc-linux-gnu, s390x-linux-gnu, sparc64-linux-gnu, and
sparcv9-linux-gnu. I also run some tests on mips.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
The code is similar to the one at elf/dl-reloc.c, where it checks for
the l_relro_size from the link_map (obtained from PT_GNU_RELRO header
from program headers) and calls_dl_protected_relro.
For testing I will use the ones proposed by Florian's patch
'elf: Add tests for working RELRO protection' [1].
Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
aarch64-linux-gnu, s390x-linux-gnu, and sparc64-linux-gnu. I also
check with --enable-static pie on x86_64-linux-gnu, i686-linux-gnu,
and aarch64-linux-gnu which seems the only architectures where
static PIE is actually working (as per 9d7a3741c9, on
arm-linux-gnueabihf, powerpc64{le}-linux-gnu, and s390x-linux-gnu
I am seeing runtime issues not related to my patch).
[1] https://sourceware.org/ml/libc-alpha/2019-10/msg00059.html
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
The IFUNC bypass to vDSO is used when USE_IFUNC_TIME is set.
Currently powerpc and x86 defines it. Otherwise the generic
implementation is used, which calls clock_gettime.
Checked on powerpc64le-linux-gnu, powerpc64-linux-gnu,
powerpc-linux-gnu-power4, x86_64-linux-gnu, and i686-linux-gnu.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
The IFUNC bypass to vDSO is used when USE_IFUNC_GETTIMEOFDAY is set.
Currently aarch64, powerpc*, and x86 defines it. Otherwise the
generic implementation is used, which calls clock_gettime.
Checked on aarch64-linux-gnu, powerpc64le-linux-gnu,
powerpc64-linux-gnu, powerpc-linux-gnu-power4, x86_64-linux-gnu,
and i686-linux-gnu.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
The clock_getres is a new implementation added on Linux 5.4
(abed3d826f2f).
Checked with a build against mips-linux-gnu and mips64-linux-gnu.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Add the missing time and clock_getres vDSO symbol names on x86.
For time, the iFUNC already uses expected name so it affects only
the static build.
The clock_getres is a new implementation added on Linux 5.3
(f66501dc53e72).
Checked on x86-linux-gnu and i686-linux-gnu.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>