Commit Graph

40069 Commits

Author SHA1 Message Date
Frédéric Bérat
b97c5efdca malloc/{memusage.c, memusagestat.c}: fix warn unused result
Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in
glibc.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-06-01 13:00:03 -04:00
Frédéric Bérat
e76ff03108 catgets/gencat.c: fix warn unused result
Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in
glibc.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-06-01 13:00:03 -04:00
Frédéric Bérat
32043daaaf tests: replace ftruncate by xftruncate
With fortification enabled, ftruncate calls return result needs to be
checked, has it gets the __wur macro enabled.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-06-01 12:45:13 -04:00
Frédéric Bérat
026a84a54d tests: replace write by xwrite
Using write without cheks leads to warn unused result when __wur is
enabled.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-06-01 12:40:05 -04:00
H.J. Lu
a8c8889978 x86-64: Use YMM registers in memcmpeq-evex.S
Since the assembly source file with -evex suffix should use YMM registers,
not ZMM registers, include x86-evex256-vecs.h by default to use YMM
registers in memcmpeq-evex.S
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
2023-06-01 09:21:14 -07:00
Siddhesh Poyarekar
6286cca2cb support: Don't fail on fchown when spawning sgid processes
In some cases (e.g. when podman creates user containers), the only other
group assigned to the executing user is nobody and fchown fails with it
because the group is not mapped.  Do not fail the test in this case,
instead exit as unsupported.

Reported-by: Frédéric Bérat <fberat@redhat.com>
Tested-by: Frédéric Bérat <fberat@redhat.com>
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-06-01 07:23:42 -04:00
Adhemerval Zanella
5f828ff824 io: Fix F_GETLK, F_SETLK, and F_SETLKW for powerpc64
Different than other 64 bit architectures, powerpc64 defines the
LFS POSIX lock constants  with values similar to 32 ABI, which
are meant to be used with fcntl64 syscall.  Since powerpc64 kABI
does not have fcntl, the constants are adjusted with the
FCNTL_ADJUST_CMD macro.

The 4d0fe291ae changed the logic of generic constants
LFS value are equal to the default values; which is now wrong
for powerpc64.

Fix the value by explicit define the previous glibc constants
(powerpc64 does not need to use the 32 kABI value, but it simplifies
the FCNTL_ADJUST_CMD which should be kept as compatibility).

Checked on powerpc64-linux-gnu and powerpc-linux-gnu.
2023-05-31 15:31:02 -03:00
Florian Weimer
b376bb01fb elf: Remove spurios SHARED conditional from elf/rtld.c
elf/rtld.c is only ever built in SHARED mode.
2023-05-31 07:35:07 +02:00
Paul Pluzhnikov
65cc53fe7c Fix misspellings in sysdeps/ -- BZ 25337 2023-05-30 23:02:29 +00:00
Adhemerval Zanella
4d0fe291ae io: Fix record locking contants on 32 bit arch with 64 bit default time_t (BZ#30477)
For architecture with default 64 bit time_t support, the kernel
does not provide LFS and non-LFS values for F_GETLK, F_GETLK, and
F_GETLK (the default value used for 64 bit architecture are used).

This is might be considered an ABI break, but the currenct exported
values is bogus anyway.

The POSIX lockf is not affected since it is aliased to lockf64,
which already uses the LFS values.

Checked on i686-linux-gnu and the new tests on a riscv32.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-05-30 08:53:07 -03:00
Adhemerval Zanella
1512599694 io: Re-flow and sort multiline Makefile definitions 2023-05-30 08:44:01 -03:00
Florian Weimer
d0f07f7df8 elf: Make more functions available for binding during dlclose (bug 30425)
Previously, after destructors for a DSO have been invoked, ld.so refused
to bind against that DSO in all cases.  Relax this restriction somewhat
if the referencing object is itself a DSO that is being unloaded.  This
assumes that the symbol reference is not going to be stored anywhere.

The situation in the test case can arise fairly easily with C++ and
objects that are built with different optimization levels and therefore
define different functions with vague linkage.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-05-30 13:25:50 +02:00
caiyinyu
3eed5f3a1e LoongArch: Fix inconsistency in SHMLBA macro values between glibc and kernel
The LoongArch glibc was using the value of the SHMLBA macro from common code,
which is __getpagesize() (16k), but this was inconsistent with the value of
the SHMLBA macro in the kernel, which is SZ_64K (64k). This caused several
shmat-related tests in LTP (Linux Test Project) to fail. This commit fixes
the issue by ensuring that the glibc's SHMLBA macro value matches the value
used in the kernel like other architectures.
2023-05-30 14:13:06 +08:00
Paul Pluzhnikov
630da022cb Fix misspellings in elf/ -- BZ 25337
Applying this commit results in bit-identical libc.so.6.
The elf/ld-linux-x86-64.so.2 does change, but only in .note.gnu.build-id

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-05-29 23:00:12 +00:00
Adhemerval Zanella
a1950a0758 riscv: Add the clone3 wrapper
It follows the internal signature:

  extern int clone3 (struct clone_args *__cl_args, size_t __size,
 int (*__func) (void *__arg), void *__arg);

Checked on riscv64-linux-gnu-rv64imafdc-lp64d.

Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
2023-05-29 17:39:57 -03:00
Dridi Boukelmoune
33d7c0e1cb posix: Add error message for EAI_OVERFLOW
Signed-off-by: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
Reviewed-by: Arjun Shankar <arjun@redhat.com>
2023-05-29 15:30:14 +02:00
Joe Simmons-Talbott
d9055634a3 setsourcefilter: Replace alloca with a scratch_buffer.
Use a scratch_buffer rather than either alloca or malloc to reduce the
possibility of a stack overflow.

Suggested-by: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2023-05-29 09:16:00 -04:00
Joe Simmons-Talbott
79b2667d1e time: strftime_l: Avoid an unbounded alloca.
Avoid possible stack overflow by removing alloca() and converting to
wide characters within the buffer.

Suggested-by: Paul Eggert <eggert@cs.ucla.edu>
2023-05-29 09:09:15 -04:00
Noah Goldstein
ed2f9dc942 x86: Use 64MB as nt-store threshold if no cacheinfo [BZ #30429]
If `non_temporal_threshold` is below `minimum_non_temporal_threshold`,
it almost certainly means we failed to read the systems cache info.

In this case, rather than defaulting the minimum correct value, we
should default to a value that gets at least reasonable
performance. 64MB is chosen conservatively to be at the very high
end. This should never cause non-temporal stores when, if we had read
cache info, we wouldn't have otherwise.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2023-05-27 21:32:57 -05:00
Samuel Thibault
9ffdcf5b79 hurd: Fix setting up signal thread stack alignment
x86_64 needs special alignment when calling functions, so we have to use
MACHINE_THREAD_STATE_SETUP_CALL for the signal thread when forking.
2023-05-28 00:30:26 +02:00
Samuel Thibault
0660ab264f mach: Fix startup with stack protector
thread_set_state() is used to set up TLS, so stack protection can not be
used yet.
2023-05-27 23:06:48 +02:00
Paul Pluzhnikov
64d9ebae87 Fix misspellings in manual/ -- BZ 25337 2023-05-27 16:41:44 +00:00
Paul Pluzhnikov
f58a8c1c15 Fix misspellings in iconv/ and iconvdata/ -- BZ 25337
All the changes are in comments or '#error' messages.
Applying this commit results in bit-identical rebuild of iconvdata/*.so

Reviewed-by: Florian Weimer <fw@deneb.enyo.de>
2023-05-27 16:37:14 +00:00
Joseph Myers
9a51f4e2b6 Add MFD_NOEXEC_SEAL, MFD_EXEC from Linux 6.3 to bits/mman-shared.h
Linux 6.3 adds new constants MFD_NOEXEC_SEAL and MFD_EXEC.  Add these
to bits/mman-shared.h (conditional on MFD_NOEXEC_SEAL not already
being defined, similar to the existing conditional on the older MFD_*
macros).

Tested for x86_64.
2023-05-26 15:04:51 +00:00
Joseph Myers
a33c211b11 Add IP_LOCAL_PORT_RANGE from Linux 6.3 to bits/in.h
Linux 6.3 adds a new constant IP_LOCAL_PORT_RANGE.  Add it to the
corresponding bits/in.h in glibc.

Tested for x86_64.
2023-05-26 15:04:13 +00:00
Joseph Myers
8754a4133e Add AT_RSEQ_* from Linux 6.3 to elf.h
Linux 6.3 adds constants AT_RSEQ_FEATURE_SIZE and AT_RSEQ_ALIGN; add
them to glibc's elf.h.  (Recall that, although elf.h is a
system-independent header, so far we've put AT_* constants there even
if Linux-specific, as discussed in bug 15794.  So rather than making
any attempt to fix that issue, the new constants are just added there
alongside the existing ones.)

Tested for x86_64.
2023-05-26 15:03:31 +00:00
Joe Simmons-Talbott
02f3d4c53a setipv4sourcefilter: Avoid using alloca.
Use a scratch_buffer rather than alloca/malloc to avoid potential stack
overflow.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-05-26 09:58:27 -04:00
Adhemerval Zanella
a363f70751 wchar: Define va_list for POSIX (BZ #30035)
This was uncovered by a recent clang change [1].  Different than ISO C,
POSIX states that va_list should be exported by wchar.h [2].

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

[1] https://reviews.llvm.org/D137268
[2] https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/basedefs/wchar.h.html
2023-05-25 16:43:29 -03:00
Roy Eldar
d2b1af4305 elf: add test for dl-printf
This patch checks _dl_debug_vdprintf, by passing various inputs to
_dl_dprintf and comparing the output with invocations of snprintf.

Signed-off-by: Roy Eldar <royeldar0@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2023-05-25 18:51:23 +02:00
Roy Eldar
dae8015273 elf: fix handling of negative numbers in dl-printf
_dl_debug_vdprintf is a bare-bones printf implementation; currently
printing a signed integer (using "%d" format specifier) behaves
incorrectly when the number is negative, as it just prints the
corresponding unsigned integer, preceeded by a minus sign.

For example, _dl_printf("%d", -1) would print '-4294967295'.

Signed-off-by: Roy Eldar <royeldar0@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2023-05-25 18:50:59 +02:00
Siddhesh Poyarekar
44d4d3bdcf elf: Update comment in open_path
f55727ca53 updated open_path to use the
r_search_path_struct struct but failed to update the comment.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-05-25 11:15:54 -04:00
Qixing ksyx Xue
dbfc83bdca elf: Add test for locating libraries in root dir (bug 30435)
When dlopen is being called, efforts have been made to improve
future lookup performance. This includes marking a search path
as non-existent using `stat`. However, if the root directory
is given as a search path, there exists a bug which erroneously
marks it as non-existing.

The bug is reproduced under the following sequence:

  1. dlopen is called to open a shared library, with at least:
     1) a dependency 'A.so' not directly under the '/' directory
        (e.g. /lib/A.so), and
     2) another dependency 'B.so' resides in '/'.
  2. for this bug to reproduce, 'A.so' should be searched *before* 'B.so'.
  3. it first tries to find 'A.so' in /, (e.g. /A.so):
     - this will (obviously) fail,
     - since it's the first time we have seen the '/' directory,
       its 'status' is 'unknown'.
  4. `buf[buflen - namelen - 1] = '\0'` is executed:
     - it intends to remove the leaf and its final slash,
     - because of the speciality of '/', its buflen == namelen + 1,
     - it erroneously clears the entire buffer.
  6. it then calls 'stat' with the empty buffer:
     - which will result in an error.
  7. so it marks '/' as 'nonexisting', future lookups will not consider
     this path.
  8. while /B.so *does* exist, failure to look it up in the '/'
     directory leads to a 'cannot open shared object file' error.

This patch fixes the bug by preventing 'buflen', an index to put '\0',
from being set to 0, so that the root '/' is always kept.
Relative search paths are always considered as 'existing' so this
wont be affected.

Writeup by Moody Liu <mooodyhunter@outlook.com>

Suggested-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Qixing ksyx Xue <qixingxue@outlook.com>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-05-25 11:10:54 -04:00
Adhemerval Zanella
a118dc3129 io: Re-flow and sort multiline Makefile definitions 2023-05-25 09:59:01 -03:00
Adhemerval Zanella
95c9a6e806 Fix special case for C2x strtol binary constant handling (BZ# 30371)
When the base is 0 or 2 and the first two characters are '0' and 'b',
but the rest are no binary digits.  In this case this is no error,
and strtol must return 0 and ENDPTR points to the 'x' or 'b'.

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

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2023-05-25 09:28:23 -03:00
Andreas Schwab
e0189b2540 rtld: properly handle root directory in load path (bug 30435)
Don't strip the trailing slash when checking for existence of a load path
element to handle the special case of the root directory.
2023-05-25 11:47:12 +02:00
Frédéric Bérat
7aec73c406 sysdeps/pthread/eintr.c: fix warn unused result
Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in
glibc.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-05-24 21:52:31 -04:00
Frédéric Bérat
a961e16ff6 sunrpc/netname.c: fix warn unused result
Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in
glibc.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-05-24 21:52:31 -04:00
Frédéric Bérat
d4ad86a0e1 locale/programs/locarchive.c: fix warn unused result
Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in
glibc.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-05-24 21:38:46 -04:00
Carlos O'Donell
da55fae9e2 support: Reformat Makefile.
Add list end markers.
Sort text using scripts/sort-makefile-lines.py.

No code generation changes observed in non-test binary artifacts.
No regressions on x86_64 and i686.
2023-05-23 22:03:41 -04:00
Paul Pluzhnikov
6b3ddc9ae5 Regenerate configure fragment -- BZ 25337.
In commit 0b25c28e02 I updated congure.ac
but neglected to regenerate updated configure.

Fix this here.
2023-05-23 16:21:29 +00:00
Paul Pluzhnikov
0b25c28e02 Fix misspellings in sysdeps/powerpc -- BZ 25337
All fixes are in comments, so the binaries should be identical
before/after this commit, but I can't verify this.

Reviewed-by: Rajalakshmi Srinivasaraghavan <rajis@linux.ibm.com>
2023-05-23 15:23:09 +00:00
Paul Pluzhnikov
d13733c166 Fix misspellings in sysdeps/unix -- BZ 25337
Applying this commit results in bit-identical rebuild of
libc.so.6 math/libm.so.6 elf/ld-linux-x86-64.so.2 mathvec/libmvec.so.1

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2023-05-23 11:59:23 +00:00
Paul Pluzhnikov
1e9d5987fd Fix misspellings in sysdeps/x86_64 -- BZ 25337.
Applying this commit results in bit-identical rebuild of libc.so.6
math/libm.so.6 elf/ld-linux-x86-64.so.2 mathvec/libmvec.so.1

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2023-05-23 10:25:11 +00:00
Samuel Thibault
ec9a66cd01 mach: Fix accessing mach_i386.h
Fixes: 196358ae26 ("mach: Fix installing mach_i386.h")
2023-05-23 09:46:47 +02:00
Paul Pluzhnikov
1d2971b525 Fix misspellings in sysdeps/x86_64/fpu/multiarch -- BZ 25337.
Applying this commit results in a bit-identical rebuild of
mathvec/libmvec.so.1 (which is the only binary that gets rebuilt).

Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
2023-05-23 03:28:58 +00:00
Samuel Thibault
196358ae26 mach: Fix installing mach_i386.h
We do not want mach_i386.h to get installed into machine/, but into
i386/ or x86_64/ depending where mach_i386.defs was found, i.e.
according to 32/64 bitness.
2023-05-23 01:47:05 +02:00
Samuel Thibault
6151d3b79a hurd: Fix making ld.so run static binaries with retry
We need O_EXEC for __rtld_execve
2023-05-23 01:47:05 +02:00
Ronan Pigott
8f59fc79b7 Add voice-admit DSCP code point from RFC-5865 2023-05-22 22:13:41 +02:00
Samuel Thibault
ea752260cc mach: Fix mach_setup_thread_impl with NULL stack_base
This is notably necessary for running the gmon thread.
2023-05-22 17:47:53 +00:00
Andreas Schwab
ea08d8dcea Remove last remnants of have-protected 2023-05-22 13:31:04 +02:00