Commit Graph

42279 Commits

Author SHA1 Message Date
DJ Delorie 95b780c1d0 stdio: Add more setvbuf tests 2025-04-01 15:20:40 -04:00
DJ Delorie 81e74c8676 add ptmx support to test-container 2025-04-01 15:20:40 -04:00
Joseph Myers 7f163bd210 Update syscall lists for Linux 6.14
Linux 6.14 has no new syscalls.  Update the version number in
syscall-names.list to reflect that it is still current for 6.14.

Tested with build-many-glibcs.py.
2025-04-01 12:44:26 +00:00
Florian Weimer c6e2895695 x86: Link tst-gnu2-tls2-x86-noxsave{,c,xsavec} with libpthread
This fixes a test build failure on Hurd.

Fixes commit 145097dff1 ("x86: Use separate
variable for TLSDESC XSAVE/XSAVEC state size (bug 32810)").

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-03-31 21:33:18 +02:00
John David Anglin 38c3896d57 elf: Fix tst-origin build when toolchain defaults to --as-needed (BZ 32823)
Checked on aarch64-linux-gnu.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-03-31 16:01:16 -03:00
H.J. Lu 27b96e069a Raise the minimum GCC version to 12.1 [BZ #32539]
For all Linux distros with glibc 2.40 which I can find, GCC 14.2 is used
to compile glibc 2.40:

OS                    GCC      URL
AOSC                  14.2.0   https://aosc.io/
Arch Linux            14.2.0   https://archlinux.org/
ArchPOWER             14.2.0   https://archlinuxpower.org/
Artix                 14.2.0   https://artixlinux.org/
Debian                14.2.0   https://www.debian.org/
Devuan                14.2.0   https://www.devuan.org/
Exherbo               14.2.0   https://www.exherbolinux.org/
Fedora                14.2.1   https://fedoraproject.org/
Gentoo                14.2.1   https://gentoo.org/
Kali Linux            14.2.0   https://www.kali.org/
KaOS                  14.2.0   https://kaosx.us/
LiGurOS               14.2.0   https://liguros.gitlab.io/
Mageia                14.2.0   https://www.mageia.org/en/
Manjaro               14.2.0   https://manjaro.org/
NixOS                 14.2.0   https://nixos.org/
openmamba             14.2.0   https://openmamba.org/
OpenMandriva          14.2.0   https://openmandriva.org/
openSUSE              14.2.0   https://www.opensuse.org/
Parabola              14.2.0   https://www.parabola.nu/
PLD Linux             14.2.0   https://pld-linux.org/
PureOS                14.2.0   https://pureos.net/
Raspbian              14.2.0   http://raspbian.org/
Slackware             14.2.0   http://www.slackware.com/
Solus                 14.2.0   https://getsol.us/
T2 SDE                14.2.0   http://t2sde.org/
Ubuntu                14.2.0   https://www.ubuntu.com/
Wikidata              14.2.0   https://wikidata.org/

Support older versions of GCC to build glibc 2.42:

1. Need to work around bugs in older versions of GCC.
2. Can't use the new features in newer versions of GCC, which may be
required for new features, like _Float16 which requires GCC 12.1 or
above, in glibc,

The main benefit of supporting older versions of GCC is easier backport
of bug fixes to the older releases of glibc, which can be mitigated by
avoiding incompatible features in newer versions of GCC for critical bug
fixes.  Require GCC 12.1 or newer to build.  Remove GCC version check for
PowerPC and s390x.

TEST_CC and TEST_CXX can be used to test the glibc build with the older
versions of GCC.

For glibc developers who are using Linux OSes which don't come with GCC
12.1 or newer, they should build and install GCC 12.1 or newer to work
on glibc.

This fixes BZ #32539.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-03-31 08:04:29 -07:00
YLK dbb2880e61 Fix typo in comment 2025-03-31 10:54:52 -03:00
Samuel Zeter 87b5a759f4 manual: tidy the longopt.c example
- Change longopt.c's backticks to single quotes
- puts() does not use format specifiers

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-03-31 10:34:51 -03:00
Collin Funk ee33752b5d manual: Document functions adopted by POSIX.1-2024.
Here is a patch updating the documentation to mention GNU and BSD
extensions that were adopted by POSIX.1-2024.

* manual/llio.texi (Memory-mapped I/O): Add that MAP_ANON and
MAP_ANONYMOUS were added by POSIX.1-2024.
* manual/memory.texi (Changing Block Size): Mention that reallocarray
was added by POSIX.1-2024.
* manual/message.texi (Message Translation): Adjust wording to match
standardization.
(Translation with gettext): Mention the gettext family of functions were
added by POSIX.1-2024.
* manual/pattern.texi (Wildcard Matching): Mention that FNM_CASEFOLD was
added by POSIX.1-2024.
* manual/process.texi (Creating a Process): Mention that _Fork and
WCOREDUMP were added by POSIX.1-2024.
* manual/signal.texi (Miscellaneous Signals): Mention that SIGWINCH was
added by POSIX-1.2024.
* manual/startup.texi (Environment Access): Mention that secure_getenv
was added by POSIX.1-2024.
* manual/string.texi (Truncating Strings): Mention that strlcpy,
strlcat, wcslcpy, and wslcat were added by POSIX-1.2024.
(Search Functions): Document that memmem was added by POSIX-1.2024.
* manual/terminal.texi (Allocation): Mention that ptsname_r was added by
POSIX-1.2024.
* manual/threads.texi (Waiting with Explicit Clocks): Move node under
POSIX Threads.  Mention pthread_cond_clockwait,
pthread_rwlock_clockrdlock, and pthread_rwlock_clockwrlock were added by
POSIX-1.2024.
(Joining Threads): New node under Non-POSIX Extensions.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Signed-off-by: Collin Funk <collin.funk1@gmail.com>
2025-03-31 10:34:42 -03:00
Adhemerval Zanella 4352e2cc93 aarch64: Fix _dl_tlsdesc_dynamic unwind for pac-ret (BZ 32612)
When libgcc is built with pac-ret, it requires to autenticate the
unwinding frame based on CFI information.  The _dl_tlsdesc_dynamic
uses a custom calling convention, where it is responsible to save
and restore all registers it might use (even volatile).

The pac-ret support added by 1be3d6eb82
was added only on the slow-path, but the fast path also adds DWARF
Register Rule Instruction (cfi_adjust_cfa_offset) since it requires
to save/restore some auxiliary register.  It seems that this is not
fully supported neither by libgcc nor AArch64 ABI [1].

Instead, move paciasp/autiasp to function prologue/epilogue to be
used on both fast and slow paths.

I also corrected the _dl_tlsdesc_dynamic comment description, it was
copied from i386 implementation without any adjustment.

Checked on aarch64-linux-gnu with a toolchain built with
--enable-standard-branch-protection on a system with pac-ret
support.

[1]  https://github.com/ARM-software/abi-aa/blob/main/aadwarf64/aadwarf64.rst#id1

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2025-03-31 10:08:06 -03:00
Florian Weimer 145097dff1 x86: Use separate variable for TLSDESC XSAVE/XSAVEC state size (bug 32810)
Previously, the initialization code reused the xsave_state_full_size
member of struct cpu_features for the TLSDESC state size.  However,
the tunable processing code assumes that this member has the
original XSAVE (non-compact) state size, so that it can use its
value if XSAVEC is disabled via tunable.

This change uses a separate variable and not a struct member because
the value is only needed in ld.so and the static libc, but not in
libc.so.  As a result, struct cpu_features layout does not change,
helping a future backport of this change.

Fixes commit 9b7091415a ("x86-64:
Update _dl_tlsdesc_dynamic to preserve AMX registers").

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-29 09:17:38 +01:00
Florian Weimer 59585ddaa2 x86: Skip XSAVE state size reset if ISA level requires XSAVE
If we have to use XSAVE or XSAVEC trampolines, do not adjust the size
information they need.  Technically, it is an operator error to try to
run with -XSAVE,-XSAVEC on such builds, but this change here disables
some unnecessary code with higher ISA levels and simplifies testing.

Related to commit befe2d3c4d
("x86-64: Don't use SSE resolvers for ISA level 3 or above").

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-29 09:17:38 +01:00
Wilco Dijkstra b0897944cc malloc: Improve performance of __libc_malloc
Improve performance of __libc_malloc by splitting it into 2 parts: first handle
the tcache fastpath, then do the rest in a separate tailcalled function.
This results in significant performance gains since __libc_malloc doesn't need
to setup a frame and we delay tcache initialization and setting of errno until
later.

On Neoverse V2, bench-malloc-simple improves by 6.7% overall (up to 8.5% for
ST case) and bench-malloc-thread improves by 20.3% for 1 thread and 14.4% for
32 threads.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-03-28 15:31:34 +00:00
Maciej W. Rozycki 0a8e7ac95c stdio-common: Reject real data w/o exponent digits in scanf [BZ #12701]
Reject invalid formatted scanf real input data the exponent part of
which is comprised of an exponent introducing character, optionally
followed by a sign, and with no actual digits following.  Such data is a
prefix of, but not a matching input sequence and it is required by ISO C
to cause a matching failure.

Currently a matching success is instead incorrectly produced along with
the conversion result according to the input significand read and the
exponent of zero, with the significand and the exponent part wholly
consumed from input.

Correct an invalid `tstscanf.c' test accordingly that expects a matching
success for input data provided in the ISO C standard as an example for
a matching failure.

Enable input data that causes test failures without this fix in place.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-28 12:35:53 +00:00
Maciej W. Rozycki 0b390b5508 stdio-common: Reject significand prefixes in scanf [BZ #12701]
Reject invalid formatted scanf real input data that is comprised of a
hexadecimal prefix, optionally preceded by a sign, and with no actual
digits following owing to the field width restriction in effect.  Such
data is a prefix of, but not a matching input sequence and it is
required by ISO C to cause a matching failure.

Currently a matching success is instead incorrectly produced along with
the conversion result of zero, with the prefix wholly consumed from
input.  Where the end of input is marked by the end-of-file condition
rather than the field width restriction in effect a matching failure is
already correctly produced.

Enable input data that causes test failures without this fix in place.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-28 12:35:53 +00:00
Maciej W. Rozycki e78cb4f6bd stdio-common: Reject integer prefixes in scanf [BZ #12701]
Reject invalid formatted scanf integer input data that is comprised of a
binary or hexadecimal prefix, optionally preceded by a sign, and with no
actual digits following.  Such data is a prefix of, but not a matching
input sequence and it is required by ISO C to cause a matching failure.

Currently a matching success is instead incorrectly produced along with
the conversion result of zero, with the prefix wholly consumed from
input.

Enable input data that causes test failures without this fix in place.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-28 12:35:53 +00:00
Maciej W. Rozycki a26638424f stdio-common: Also reject exp char w/o significand in i18n scanf [BZ #13988]
Fix the handling of real 'scanf' input such as "+.e" as per BZ #13988
for the i18n case as well, complementing commit 6ecec3b616 ("Don't
accept exp char without preceding digits in scanf float parsing"), where
the 'e' character is incorrectly consumed from input.  Add a test case
matching stdio-common/bug26.c, with bits from localedata/tst-sscanf.c.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-28 12:35:53 +00:00
Maciej W. Rozycki 47076b3163 stdio-common: Add tests for formatted vsscanf input specifiers
Wire vsscanf into test infrastructure for formatted scanf input
specifiers.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-28 12:35:53 +00:00
Maciej W. Rozycki 53ee7ede43 stdio-common: Add tests for formatted vfscanf input specifiers
Wire vfscanf into test infrastructure for formatted scanf input
specifiers.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-28 12:35:53 +00:00
Maciej W. Rozycki 63c81fa0db stdio-common: Add tests for formatted vscanf input specifiers
Wire vscanf into test infrastructure for formatted scanf input
specifiers.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-28 12:35:52 +00:00
Maciej W. Rozycki bf6ac302cd stdio-common: Add tests for formatted sscanf input specifiers
Wire sscanf into test infrastructure for formatted scanf input
specifiers.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-28 12:35:52 +00:00
Maciej W. Rozycki 50576060c8 stdio-common: Add tests for formatted fscanf input specifiers
Wire fscanf into test infrastructure for formatted scanf input
specifiers.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-28 12:35:52 +00:00
Maciej W. Rozycki d527f34cb1 stdio-common: Add scanf long double data for Intel/Motorola 80-bit format
Add Makefile infrastructure, a format-specific test skeleton providing a
data comparison implementation that ignores bits of data representation
in memory that do not participate in holding floating-point data, and
`long double' real input data for targets using the Intel/Motorola
80-bit format.

Keep input data disabled and referring to BZ #12701 for entries that are
are currently incorrectly accepted as valid data, such as '0e', '0e+',
'0x', '0x8p', '0x0p-', etc.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-28 12:35:52 +00:00
Joseph Myers 75ad83f564 Implement C23 pown
C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the pown functions, which are like pow but with an
integer exponent.  That exponent has type long long int in C23; it was
intmax_t in TS 18661-4, and as with other interfaces changed after
their initial appearance in the TS, I don't think we need to support
the original version of the interface.  The test inputs are based on
the subset of test inputs for pow that use integer exponents that fit
in long long.

As the first such template implementation that saves and restores the
rounding mode internally (to avoid possible issues with directed
rounding and intermediate overflows or underflows in the wrong
rounding mode), support also needed to be added for using
SET_RESTORE_ROUND* in such template function implementations.  This
required math-type-macros-float128.h to include <fenv_private.h>, so
it can tell whether SET_RESTORE_ROUNDF128 is defined.  In turn, the
include order with <fenv_private.h> included before <math_private.h>
broke loongarch builds, showing up that
sysdeps/loongarch/math_private.h is really a fenv_private.h file
(maybe implemented internally before the consistent split of those
headers in 2018?) and needed to be renamed to fenv_private.h to avoid
errors with duplicate macro definitions if <math_private.h> is
included after <fenv_private.h>.

The underlying implementation uses __ieee754_pow functions (called
more than once in some cases, where the exponent does not fit in the
floating type).  I expect a custom implementation for a given format,
that only handles integer exponents but handles larger exponents
directly, could be faster and more accurate in some cases.

I encourage searching for worst cases for ulps error for these
implementations (necessarily non-exhaustively, given the size of the
input space).

Tested for x86_64 and x86, and with build-many-glibcs.py.
2025-03-27 10:44:44 +00:00
Florian Weimer be61b9493d support: Use unwinder in links-dso-program-c only with libgcc_s
Do not build links-dso-program-c with exception (unwinding) support
if libgcc_s is not available.  In this case, the unwinder may be
part of libgcc.a or libgcc_eh.a, depending on how GCC was built.
If the unwinder is in libgcc_eh.a only, linking links-dso-program-c
failed before this change.  After this change, the exception
handling landing pad is only generated if libgcc_s available,
avoiding an undefined _Unwind_Resume (or equivalent) symbol
reference in the non-libgcc_s case.

Fixes commit ffd36cc27407003a6f9efcb9c16370e3435c5b1d ("support: Use
unwinder in links-dso-program-c only with libgcc_s") and
commit 5dfbc3c43e ("support: Link
links-dso-program-c with libgcc_s only if available").
2025-03-26 17:46:40 +01:00
Wilco Dijkstra 1233da4943 malloc: Use __always_inline for simple functions
Use __always_inline for small helper functions that are critical for
performance.  This ensures inlining always happens when expected.
Performance of bench-malloc-simple improves by 0.6% on average on
Neoverse V2.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-03-26 13:17:51 +00:00
Collin Funk 3263675250 linux: Fix integer overflow warnings when including <sys/mount.h> [BZ #32708]
Using gcc -Wshift-overflow=2 -Wsystem-headers to compile a file
including <sys/mount.h> will cause a warning since 1 << 31 is undefined
behavior on platforms where int is 32-bits.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-03-25 23:55:08 -04:00
Wilco Dijkstra cd33535002 malloc: Use _int_free_chunk for remainders
When splitting a chunk, release the tail part by calling int_free_chunk.
This avoids inserting random blocks into tcache that were never requested
by the user.  Fragmentation will be worse if they are never used again.
Note if the tail is fairly small, we could avoid splitting it at all.
Also remove an oddly placed initialization of tcache in _libc_realloc.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-03-25 18:53:01 +00:00
Joseph Myers 8bac7f7a43 Use MPFR 4.2.2 and Linux 6.14 in build-many-glibcs.py
Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2025-03-25 18:29:01 +00:00
Maciej W. Rozycki 4bea073069 stdio-common: Add scanf long double data for IBM 128-bit format
Add Makefile infrastructure and IBM 128-bit 'long double' real input for
targets switching between the IEEE 754 binary128 and IBM 128-bit formats
with '-mabi=ieeelongdouble' and '-mabi=ibmlongdouble'.  Reuse IEEE 754
binary128 input data but with modified output file names so as not to
clash with the names used for IBM 128-bit format tests made with common
rules for the 'long double' data type.

Keep input data disabled and referring to BZ #12701 for entries that are
are currently incorrectly accepted as valid data, such as '0e', '0e+',
'0x', '0x8p', '0x0p-', etc.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-25 09:40:20 +00:00
Maciej W. Rozycki 771cda3c9c stdio-common: Add scanf long double data for IEEE 754 binary64 format
Add Makefile infrastructure and 64-bit `long double' real input data for
targets switching between the IEEE 754 binary64 and IEEE 754 binary128
formats with `-mlong-double-64' and `-mlong-double-128'.  Use modified
output file names for the IEEE 754 binary64 format so as not to clash
with the names used for IEEE 754 binary128 format tests made with common
rules for the 'long double' data type.

Keep input data disabled and referring to BZ #12701 for entries that are
are currently incorrectly accepted as valid data, such as '0e', '0e+',
'0x', '0x8p', '0x0p-', etc.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-25 09:40:20 +00:00
Maciej W. Rozycki 1890e63c86 stdio-common: Add scanf long double data for IEEE 754 binary128 format
Add Makefile infrastructure and `long double' real input data for
targets using the IEEE 754 binary128 format.

Keep input data disabled and referring to BZ #12701 for entries that are
are currently incorrectly accepted as valid data, such as '0e', '0e+',
'0x', '0x8p', '0x0p-', etc.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-25 09:40:20 +00:00
Maciej W. Rozycki 0b31161439 stdio-common: Add scanf double data for IEEE 754 binary64 format
Add Makefile infrastructure and `double' real input data for targets
using the IEEE 754 binary64 format.

Keep input data disabled and referring to BZ #12701 for entries that are
are currently incorrectly accepted as valid data, such as '0e', '0e+',
'0x', '0x8p', '0x0p-', etc.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-25 09:40:20 +00:00
Maciej W. Rozycki 26df22636d stdio-common: Add scanf float data for IEEE 754 binary32 format
Add Makefile infrastructure and `float' real input data for targets
using the IEEE 754 binary32 format.

Keep input data disabled and referring to BZ #12701 for entries that are
are currently incorrectly accepted as valid data, such as '0e', '0e+',
'0x', '0x8p', '0x0p-', etc.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-25 09:40:20 +00:00
Maciej W. Rozycki a2bacea239 stdio-common: Add scanf integer data for LP64 targets
Add Makefile infrastructure and `int' and `long' integer input data,
signed and unsigned, for LP64 targets.

While the size of `int' data is the same between ILP32 and LP64 targets,
resulting scanf output is different between them for out of range input
data and while ISO C and POSIX both say that the behavior is undefined
if the result of the conversion cannot be represented we want to keep
track of our output to prevent inadvertent changes.  Hence the use of
distinct `int' integer input data between ILP32 and LP64 targets.

Keep input data disabled and referring to BZ #12701 for entries that are
are currently incorrectly accepted as valid data, such as '0b' or '0x'.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-25 09:40:20 +00:00
Maciej W. Rozycki d7584e4d36 stdio-common: Add scanf integer data for ILP32 targets
Add Makefile infrastructure and `int' and `long' integer input data,
signed and unsigned, for ILP32 targets.

While the size of `int' data is the same between ILP32 and LP64 targets,
resulting scanf output is different between them for out of range input
data and while ISO C and POSIX both say that the behavior is undefined
if the result of the conversion cannot be represented we want to keep
track of our output to prevent inadvertent changes.  Hence the use of
distinct `int' integer input data between ILP32 and LP64 targets.

Keep input data disabled and referring to BZ #12701 for entries that are
are currently incorrectly accepted as valid data, such as '0b' or '0x'.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-25 09:40:20 +00:00
Maciej W. Rozycki d1a621b735 stdio-common: Add tests for formatted scanf input specifiers
Add a collection of tests for formatted scanf input specifiers covering
the b, d, i, o, u, x, and X integer conversions, the a, A, e, E, f, F,
g, and G floating-point conversions, and the [, c, and s character
conversions.  Also the hh, h, l, and ll length modifiers are covered
with the integer conversions as are the l and L length modifier with the
floating-point conversions.  The tests cover assignment suppressing and
the field width as well, verifying the number of assignments made, the
number of characters consumed and the value assigned.

Add the common test code here as well as test cases for scanf, and then
base Makefile infrastructure plus target-agnostic input data, for the
character conversions and the `char', `short', and `long long' integer
ones, signed and unsigned, with remaining input data and other functions
from the scanf family deferred to subsequent additions.

Keep input data disabled and referring to BZ #12701 for entries that are
currently incorrectly accepted as valid data, such as '0b' or '0x' with
the relevant integer conversions or sequences of an insufficient number
of characters with the c conversion.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-25 09:40:20 +00:00
Zhaoming Luo 0544df4f4a mach: Use the host_get_time64 to replace the deprecated host_get_time for CLOCK_REALTIME when it's available
Check the availability of host_get_time64 and use it to replace
host_get_time for CLOCK_REALTIME when it's available. Fall back to
host_get_time if gnumach does not support host_get_time64 but the
gnumach headers do.

host_get_time is deprecated
See https://git.savannah.gnu.org/cgit/hurd/gnumach.git/commit/?id=569df850cd7badd1e36132ad3b44aa76a4d27c25
However, it's kept for backward compactbility.

* config.h.in: Add HAVE_HOST_GET_TIME64 config entry.
* sysdeps/mach/clock_gettime.c: Use host_get_time64 for CLOCK_REALTIME
  when it's possible, fall to host_get_time otherwise.
* sysdeps/mach/configure: Check the existence of host_get_time64 RPC.
* sysdeps/mach/configure.ac: Check the existence of host_get_time64 RPC.
Message-ID: <20250324052042.19803-1-zhmingluo@163.com>
2025-03-25 01:10:10 +01:00
Samuel Thibault b62692d3c7 aio_suspend64: Fix clock discrepancy [BZ #32795]
cc5d5852c6 ("y2038: Convert aio_suspend to support 64 bit time")
switched from __clock_gettime (CLOCK_REALTIME, &now); to __clock_gettime64
(CLOCK_MONOTONIC, &ts);, but pthread_cond_timedwait is based on the
absolute realtime clock, so migrate to using pthread_cond_clockwait to
select CLOCK_MONOTONIC. Also fix AIO_MISC_WAIT into passing
CLOCK_MONOTONIC to __futex_abstimed_wait64.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-03-25 01:05:11 +01:00
Aaron Merey e3a6e85d67 Add _FORTIFY_SOURCE support for inet_pton
Add function __inet_pton_chk which calls __chk_fail when the size of
argument dst is too small.   inet_pton is redirected to __inet_pton_chk
or __inet_pton_warn when _FORTIFY_SOURCE is > 0.

Also add tests to debug/tst-fortify.c, update the abilist with
__inet_pton_chk and mention inet_pton fortification in maint.texi.

Co-authored-by: Frédéric Bérat <fberat@redhat.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-03-24 14:43:03 -04:00
Aaron Merey a71db81ed1 Prepare inet_pton to be fortified
Split inet_pton internals such as __inet_pton_length from the
inet_pton entry point.

This allows the internals to be built with fortification while
leaving the inet_pton entry point unchanged.

Co-authored-by: Frédéric Bérat <fberat@redhat.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-03-24 14:43:03 -04:00
Joseph Myers 2fb0009ff1 Update kernel version to 6.13 in header constant tests
There are no new constants covered by tst-mman-consts.py,
tst-mount-consts.py or tst-sched-consts.py in Linux 6.13 that need any
header changes, so update the kernel version in those tests.
(tst-pidfd-consts.py will need updating separately along with adding
new constants to glibc.)

Tested with build-many-glibcs.py.
2025-03-24 15:51:23 +00:00
Florian Weimer 5dfbc3c43e support: Link links-dso-program-c with libgcc_s only if available
Add a configure check to detect bootstrapping builds that do not
have libgcc_s.

Fixes commit 3e2be87832 ("support: Link
links-dso-program-c against libgcc_s").

Reviewed-by: Sam James <sam@gentoo.org>
2025-03-21 21:40:28 +01:00
Florian Weimer 2f8e8c9cb7 elf: Use +nolink-deps to add make-only dependency for tst-origin
The tst-origin test must link against liborigin-mod.so.  Correct
build order depends on a makefile rule dependency on
$(objpfx)liborigin-mod.so.  Use +nolink-deps to remvoe this
dependency from the linker command line.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-03-21 21:40:28 +01:00
Florian Weimer c3410db9d0 Makeconfig: Support $(+nolink-deps) in link flags
This allows adding dependencies to rules, but not linking against
them.

This is more or less a reimplementation of .EXTRA_PREREQS feature from
GNU make 4.3.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-03-21 21:40:28 +01:00
Adhemerval Zanella ed6a68bac7 debug: Improve '%n' fortify detection (BZ 30932)
The 7bb8045ec0 path made the '%n' fortify check ignore EMFILE errors
while trying to open /proc/self/maps, and this added a security
issue where EMFILE can be attacker-controlled thus making it
ineffective for some cases.

The EMFILE failure is reinstated but with a different error
message.  Also, to improve the false positive of the hardening for
the cases where no new files can be opened, the
_dl_readonly_area now uses  _dl_find_object to check if the
memory area is within a writable ELF segment.  The procfs method is
still used as fallback.

Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Arjun Shankar <arjun@redhat.com>
2025-03-21 15:46:48 -03:00
Adhemerval Zanella 1894e219dc Remove eloop-threshold.h
On both Linux and Hurd the __eloop_threshold() is always a constant
(40 and 32 respectively), so there is no need to always call
__sysconf (_SC_SYMLOOP_MAX) for Linux case (!SYMLOOP_MAX).  To avoid
a name clash with gnulib, rename the new file min-eloop-threshold.h.

Checked on x86_64-linux-gnu and with a build for x86_64-gnu.
Reviewed-by: DJ Delorie <dj@redhat.com>
2025-03-21 15:46:48 -03:00
Cupertino Miranda 855561a1fb malloc: missing initialization of tcache in _mid_memalign
_mid_memalign includes tcache code but does not attempt to initialize
tcaches.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-03-21 17:52:14 +00:00
Florian Weimer 3e2be87832 support: Link links-dso-program-c against libgcc_s
If C++ support is not available, links-dso-program-c is used
instead of the C++ version.  The C version was not linked against
libgcc_s, which meant that thread cancellation and the backtrace
function did not work in containers tests in that situation.

Reviewed-by: Sam James <sam@gentoo.org>
2025-03-21 11:45:00 +01:00
Frédéric Bérat 090dfa40a5 Add _FORTIFY_SOURCE support for inet_ntop
- Create the __inet_ntop_chk routine that verifies that the builtin size
of the destination buffer is at least as big as the size given by the
user.
- Redirect calls from inet_ntop to __inet_ntop_chk or __inet_ntop_warn
- Update the abilist for this new routine
- Update the manual to mention the new fortification

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-03-21 09:35:42 +01:00