Commit Graph

40264 Commits

Author SHA1 Message Date
H.J. Lu
881546979d x86_64: Sort fpu/multiarch/Makefile
Sort Makefile variables using scripts/sort-makefile-lines.py.

No code generation changes observed in libm.  No regressions on x86_64.
2023-08-10 11:23:25 -07:00
Adhemerval Zanella
c73c96a4a1 i686: Fix build with --disable-multiarch
Since i686 provides the fortified wrappers for memcpy, mempcpy,
memmove, and memset on the same string implementation, the static
build tries to optimized it by not tying the fortified wrappers
to string routine (to avoid pulling the fortify function if
they are not required).

Checked on i686-linux-gnu building with different option:
default and --disable-multi-arch plus default, --disable-default-pie,
--enable-fortify-source={2,3}, and --enable-fortify-source={2,3}
with --disable-default-pie.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-08-10 10:29:29 -03:00
Adhemerval Zanella
51cb52214f x86_64: Fix build with --disable-multiarch (BZ 30721)
With multiarch disabled, the default memmove implementation provides
the fortify routines for memcpy, mempcpy, and memmove.  However, it
does not provide the internal hidden definitions used when building
with fortify enabled.  The memset has a similar issue.

Checked on x86_64-linux-gnu building with different options:
default and --disable-multi-arch plus default, --disable-default-pie,
--enable-fortify-source={2,3}, and --enable-fortify-source={2,3}
with --disable-default-pie.
Tested-by: Andreas K. Huettel <dilfridge@gentoo.org>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-08-10 10:29:29 -03:00
Joseph Myers
b163fca6c3 Add PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG etc. from Linux 6.4 to sys/ptrace.h
Linux 6.4 adds new constants PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG
and PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG.  Add those to all
relevant sys/ptrace.h headers, along with adding the associated
argument structure to bits/ptrace-shared.h (named struct
__ptrace_sud_config there following the usual convention for such
structures).

Tested for x86_64 and with build-many-glibcs.py.
2023-08-08 14:38:22 +00:00
Joseph Myers
c8c20039c7 Add PACKET_VNET_HDR_SZ from Linux 6.4 to netpacket/packet.h
Linux 6.4 adds a new constant PACKET_VNET_HDR_SZ; add it to glibc's
netpacket/packet.h.

Tested for x86_64.
2023-08-08 14:37:45 +00:00
Samuel Thibault
e3ae80adbc hurd: Make error_t an int in C++
Making error_t defined to enum __error_t_codes conveniently makes the
debugger print symbolic values, but in C++ int is not interoperable with
enum __error_t_codes, leading to C++ application build issues, so let's
revert error_t to int in C++.
2023-08-08 16:07:57 +02:00
Joseph Myers
3fcfb76bab Use binutils 2.41 branch in build-many-glibcs.py
This patch makes build-many-glibcs.py use binutils 2.41 branch.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2023-08-08 12:53:50 +00:00
наб
92861d93cd linux: statvfs: allocate spare for f_type
This is the only missing part in struct statvfs.
The LSB calls [f]statfs() deprecated, and its weird types are definitely
off-putting. However, its use is required to get f_type.

Instead, allocate one of the six spares to f_type,
copied directly from struct statfs.
This then becomes a small glibc extension to the standard interface
on Linux and the Hurd, instead of two different interfaces, one of which
is quite odd due to being an ABI type, and there no longer is any reason
to use statfs().

The underlying kernel type is a mess, but all architectures agree on u32
(or more) for the ABI, and all filesystem magicks are 32-bit integers.
We don't lose any generality by using u32, and by doing so we both make
the API consistent with the Hurd, and allow C++
  switch(f_type) { case RAMFS_MAGIC: ...; }

Also fix tst-statvfs so that it actually fails;
as it stood, all it did was return 0 always.
Test statfs()' and statvfs()' f_types are the same.

Link: https://lore.kernel.org/linux-man/f54kudgblgk643u32tb6at4cd3kkzha6hslahv24szs4raroaz@ogivjbfdaqtb/t/#u
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2023-08-08 09:29:06 -03:00
наб
a9847e2c66 hurd: statvfs: __f_type -> f_type
No further changes needed ([f]statvfs() just cast to struct statfs *
and call [f]statfs()).

Link: https://lore.kernel.org/linux-man/f54kudgblgk643u32tb6at4cd3kkzha6hslahv24szs4raroaz@ogivjbfdaqtb/t/#u
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2023-08-08 09:29:06 -03:00
Samuel Thibault
53da64d1cf htl: Initialize ___pthread_self early
When using jemalloc, malloc() needs to use TSD, while libpthread
initialization needs malloc(). Having ___pthread_self set early to some
static storage allows TSD to work early, thus allowing jemalloc and
libpthread to initialize together.

This incidentaly simplifies __pthread_enable/disable_asynccancel and
__pthread_self, now that ___pthread_self is always initialized.
2023-08-08 12:19:29 +02:00
Samuel Thibault
644aa127b9 htl: Add support for static TSD data
When using jemalloc, malloc() needs to use TSD, while libpthread
initialization needs malloc(). Supporting a static TSD area allows jemalloc
and libpthread to initialize together.
2023-08-08 12:17:48 +02:00
Sajan Karumanchi
dcad5c8578 x86: Fix for cache computation on AMD legacy cpus.
Some legacy AMD CPUs and hypervisors have the _cpuid_ '0x8000_001D'
set to Zero, thus resulting in zeroed-out computed cache values.
This patch reintroduces the old way of cache computation as a
fail-safe option to handle these exceptions.
Fixed 'level4_cache_size' value through handle_amd().

Reviewed-by: Premachandra Mallappa <premachandra.mallappa@amd.com>
Tested-by: Florian Weimer <fweimer@redhat.com>
2023-08-06 19:10:42 +05:30
Samuel Thibault
53850f044f hurd: Rework generating errno.h
We only need to give to gawk the headers that actually define error
numbers, so let's rather filter out the other included headers early.
2023-08-06 22:35:01 +02:00
Samuel Thibault
41d8c3bc33 powerpc longjmp: Fix build after chk hidden builtin fix
04bf7d2d8a ("chk: Add and fix hidden builtin definitions for *_chk")
added an #undef for longjmp and siglongjmp to compensate for the
definition in include/setjmp.h, but missed doing so for the powerpc
version too.

Fixes: 04bf7d2d8a ("chk: Add and fix hidden builtin definitions for
*_chk")
2023-08-04 10:03:59 +02:00
Yang Yujie
c579293f67 LoongArch: Fix static PIE condition for toolchain bootstrapping.
This patch allows the static PIE startfile rcrt1.o to be built
without requiring libgcc_s.so from GCC, which depends on libc
in the first place.
2023-08-04 14:04:37 +08:00
Samuel Thibault
04bf7d2d8a chk: Add and fix hidden builtin definitions for *_chk
Otherwise on gnu-i686 there are unwanted PLT entries in libc.so when
fortification is enabled.

Tested for i686-gnu, x86_64-gnu, i686-linux-gnu and x86_64-linux-gnu
2023-08-03 22:46:48 +02:00
Samuel Thibault
cbf4aa422c tst-realpath-toolong: return "unsupported" when PATH_MAX is undefined
When PATH_MAX is undefined, realpath cannot ever ENAMETOOLONG, so
this test is unsupported.
2023-08-03 22:43:27 +02:00
Samuel Thibault
2345bc44bb Subject: hurd: Make __realpath return EINVAL on NULL buf
As Posix and stdlib/test-canon.c expects it, and rather than letting
pathconf crash.
2023-08-03 22:42:29 +02:00
Samuel Thibault
5e4435f960 tst-*glob*: Do not check d_name size
Posix says that d_name is of unspecified size, and sizeof(d_name)
should not be used. It is indeed only 1-byte long in bits/dirent.h. We
can instead explictly provide the actual allocated size to
__strcpy_chk.
2023-08-03 22:41:45 +02:00
Florian Weimer
d97a12704b hurd: Do not include full <stdarg.h> in <hurd.h>
This fixes a hurd/check-installed-headers-c failure with
-std=c89 #define _FORTIFY_SOURCE 1:

In file included from ../hurd/hurd.h:354,
                 from ../sysdeps/hurd/include/hurd.h:2,
                 from /tmp/cih_test_9IaUwa.c:10:
/home/bmg/install/compilers/i686-gnu/lib/gcc/i686-glibc-gnu/13.2.1/include/stdarg.h:54:34: error: "__STDC_VERSION__" is not defined, evaluates to 0 [-Werror=undef]
   54 | #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L \
      |                                  ^~~~~~~~~~~~~~~~
/home/bmg/install/compilers/i686-gnu/lib/gcc/i686-glibc-gnu/13.2.1/include/stdarg.h:55:8: error: "__cplusplus" is not defined, evaluates to 0 [-Werror=undef]
   55 |     || __cplusplus + 0 >= 201103L
      |        ^~~~~~~~~~~
cc1: all warnings being treated as errors

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2023-08-03 10:25:52 +02:00
Andreas Schwab
fc72b6d7d8 iconv: restore verbosity with unrecognized encoding names (bug 30694)
Commit 91927b7c76 ("Rewrite iconv option parsing [BZ #19519]") changed the
iconv program to call __gconv_open directly instead of the iconv_open
wrapper, but the former does not set errno.  Update the caller to
interpret the return codes like iconv_open does.
2023-08-02 13:30:04 +02:00
Adhemerval Zanella Netto
78ceef25d6 configure: Remove --enable-all-warnings option
The option is not activelly tested and has bitrotten, to fix it
would require a lot of work and multiple fixes.  A better option
would to evaluate each option and enable the warning if it makes
sense.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-08-01 15:35:25 -03:00
Joseph Myers
bd154cdb9e Add IP_PROTOCOL from Linux 6.4 to bits/in.h
Linux 6.4 adds a new constant IP_PROTOCOL; add it to glibc's
bits/in.h.

Tested for x86_64.
2023-08-01 17:22:12 +00:00
Joseph Myers
47b76f6d1d Update kernel version to 6.4 in header constant tests
This patch updates the kernel version in the tests tst-mman-consts.py,
tst-mount-consts.py and tst-pidfd-consts.py to 6.4.  (There are no new
constants covered by these tests in 6.4 that need any other header
changes.)

Tested with build-many-glibcs.py.
2023-08-01 12:43:04 +00:00
Mahesh Bodapati
21841f0d56 PowerPC: Influence cpu/arch hwcap features via GLIBC_TUNABLES
This patch enables the option to influence hwcaps used by PowerPC.
The environment variable, GLIBC_TUNABLES=glibc.cpu.hwcaps=-xxx,yyy,-zzz....,
can be used to enable CPU/ARCH feature yyy, disable CPU/ARCH feature xxx
and zzz, where the feature name is case-sensitive and has to match the ones
mentioned in the file{sysdeps/powerpc/dl-procinfo.c}.

Note that the hwcap tunables only used in the IFUNC selection.
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2023-08-01 07:41:17 -05:00
Joe Simmons-Talbott
5c37d20652 vfprintf-internal: Get rid of alloca.
Avoid potential stack overflow from unbounded alloca.  Use the existing
scratch_buffer instead.

Add testcases to exercise the code as suggested by Adhemerval Zanella Netto.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2023-08-01 12:32:49 +00:00
Florian Weimer
510fc20d73 stdlib: Improve tst-realpath compatibility with source fortification
On GCC before 11, IPA can make the fortified realpath aware that the
buffer size is not large enough (8 bytes instead of PATH_MAX bytes).
Fix this by using a buffer that is large enough.
2023-08-01 10:27:15 +02:00
Andreas K. Hüttel
78ca34d8c5
Open master branch for glibc 2.39 development
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-31 20:07:55 +02:00
Andreas K. Hüttel
36f2487f13
NEWS: Fix typos
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-31 19:54:16 +02:00
Andreas K. Hüttel
f5305638bc
Create ChangeLog.old/ChangeLog.27
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-30 21:45:27 +02:00
Andreas K. Hüttel
e5da48e5ec
Increase version numbers
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-30 21:35:28 +02:00
Andreas K. Hüttel
d09871da52
INSTALL: regenerate
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-30 21:16:02 +02:00
Andreas K. Hüttel
d5e321d154
NEWS: minor wording fixes
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-30 19:43:50 +02:00
Andreas K. Hüttel
1822328274
install.texi: Build was tested with binutils 2.41 (just released)
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-30 19:31:41 +02:00
Andreas K. Hüttel
14126ff059
install.texi: Update versions of most recent build tools
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-27 23:00:59 +02:00
Andreas K. Hüttel
1d5355ddbb
contrib.texi: Update for 2.38
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-27 21:42:57 +02:00
H.J. Lu
1547d6a64f <sys/platform/x86.h>: Add APX support
Add support for Intel Advanced Performance Extensions:

https://www.intel.com/content/www/us/en/developer/articles/technical/advanced-performance-extensions-apx.html

to <sys/platform/x86.h>.
2023-07-27 08:42:32 -07:00
Andreas K. Hüttel
c8c8dbbf27
translations: update cs, nl, vi
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-27 00:21:13 +02:00
Adhemerval Zanella Netto
784ae96811 string: Fix tester build with fortify enable with gcc 6
When building with fortify enabled, GCC 6 issues an warning the fortify
wrapper might overflow the destination buffer.  However, GCC does not
provide a specific flag to disable the warning (the failure is tied to
-Werror).  So to avoid disable all errors, only enable the check for
GCC 7 or newer.

Checked on i686-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-07-26 10:45:49 -03:00
Adhemerval Zanella Netto
dbc4b032dc linux: Fix i686 with gcc6
On __convert_scm_timestamps GCC 6 issues an warning that tvts[0]/tvts[1]
maybe be used uninitialized, however it would be used if type is set to a
value different than 0 (done by either COMPAT_SO_TIMESTAMP_OLD or
COMPAT_SO_TIMESTAMPNS_OLD) which will fallthrough to 'common' label.

It does not show with gcc 7 or more recent versions.

Checked on i686-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-07-26 09:45:55 -03:00
Adhemerval Zanella Netto
0b1a76c577 i386: Remove memset_chk-nonshared.S
Similar to memcpy, mempcpy, and memmove there is no need for an
specific memset_chk-nonshared.S.  It can be provided by
memset-ia32.S itself for static library.

Checked on i686-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-07-26 09:45:55 -03:00
Adhemerval Zanella Netto
f8f9a27257 i386: Fix build with --enable-fortify=3
The i386 string routines provide multiple internal definitions
for memcpy, memmove, and mempcpy chk routines:

  $ objdump -t libc.a | grep __memcpy_chk
  00000000 g     F .text  0000000e __memcpy_chk
  00000000 g     F .text  00000013 __memcpy_chk
  $ objdump -t libc.a | grep __mempcpy_chk
  00000000 g     F .text  0000000e __mempcpy_chk
  00000000 g     F .text  00000013 __mempcpy_chk
  $ objdump -t libc.a | grep __memmove_chk
  00000000 g     F .text  0000000e __memmove_chk
  00000000 g     F .text  00000013 __memmove_chk

Although is not an issue for normal static builds, with fortify=3
glibc itself might use the fortify chk functions and thus static
build might fail with multiple definitions.  For instance:

x86_64-glibc-linux-gnu-gcc -m32 -march=i686 -o [...]math/test-signgam-uchar-static -nostdlib -nostartfiles -static -static-pie [...]
x86_64-glibc-linux-gnu/bin/ld: [...]/libc.a(mempcpy-ia32.o):
in function `__mempcpy_chk': [...]/glibc-git/string/../sysdeps/i386/i686/mempcpy.S:32: multiple definition of `__mempcpy_chk';
[...]/libc.a(mempcpy_chk-nonshared.o):[...]/debug/../sysdeps/i386/mempcpy_chk.S:28: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [../Rules:298:

There is no need for mem*-nonshared.S, the __mem*_chk routines
are already provided by the assembly routines.

Checked on i686-linux-gnu with gcc 13 built with fortify=1,2,3 and
without fortify.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-07-26 09:45:55 -03:00
Adhemerval Zanella Netto
df43ea489c posix: Fix test-errno build with fortify enable
With gcc 11.3.1, building with -D_FORTIFY_SOURCE=2 shows:

In function ‘getgroups’,
    inlined from ‘do_test’ at test-errno.c:129:12:
../misc/sys/cdefs.h:195:6: error: argument 1 value -1 is negative
[-Werror=stringop-overflow=]
  195 |    ? __ ## f ## _alias (__VA_ARGS__)
      \
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../posix/bits/unistd.h:115:10: note: in expansion of macro
‘__glibc_fortify’
  115 |   return __glibc_fortify (getgroups, __size, sizeof (__gid_t),
      |          ^~~~~~~~~~~~~~~
../posix/bits/unistd.h: In function ‘do_test’:
../posix/bits/unistd-decl.h:135:28: note: in a call to function
‘__getgroups_alias’ declared with attribute ‘access (write_only, 2, 1)’
  135 | extern int __REDIRECT_NTH (__getgroups_alias, (int __size,
      __gid_t __list[]),
      |                            ^~~~~~~~~~~~~~~~~
../misc/sys/cdefs.h:264:6: note: in definition of macro ‘__REDIRECT_NTH’
  264 |      name proto __asm__ (__ASMNAME (#alias)) __THROW

It builds fine with gcc 12 and gcc 13.

Checked on x86_64-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-07-26 09:45:46 -03:00
Adhemerval Zanella Netto
648c3b574d powerpc: Fix powerpc64 strchrnul build with old gcc
The compiler might not see that internal definition is an alias
due the libc_ifunc macro, which redefines __strchrnul.  With
gcc 6 it fails with:

In file included from <command-line>:0:0:
./../include/libc-symbols.h:472:33: error: ‘__EI___strchrnul’ aliased to
undefined symbol ‘__GI___strchrnul’
   extern thread __typeof (name) __EI_##name \
                                 ^
./../include/libc-symbols.h:468:3: note: in expansion of macro
‘__hidden_ver2’
   __hidden_ver2 (, local, internal, name)
   ^~~~~~~~~~~~~
./../include/libc-symbols.h:476:29: note: in expansion of macro
‘__hidden_ver1’
 #  define hidden_def(name)  __hidden_ver1(__GI_##name, name, name);
                             ^~~~~~~~~~~~~
./../include/libc-symbols.h:557:32: note: in expansion of macro
‘hidden_def’
 # define libc_hidden_def(name) hidden_def (name)
                                ^~~~~~~~~~
../sysdeps/powerpc/powerpc64/multiarch/strchrnul.c:38:1: note: in
expansion of macro ‘libc_hidden_def’
 libc_hidden_def (__strchrnul)
 ^~~~~~~~~~~~~~~

Use libc_ifunc_hidden as stpcpy.  Checked on powerpc64 with
gcc 6 and gcc 13.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-07-26 09:45:22 -03:00
Adhemerval Zanella Netto
0eb6b2725b sunrpc: Fix netname build with older gcc
The -Wformat-overflow was added by gcc 8.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-07-26 09:45:22 -03:00
Adhemerval Zanella Netto
7dfa534ef0 malloc: Fix set-freeres.c with gcc 6
Old GCC might trigger the the comparison will always evaluate as ‘true’
warnig for static build:

set-freeres.c:87:14: error: the comparison will always evaluate as
‘true’ for the address of ‘__libc_getgrgid_freemem_ptr’ will never be
NULL [-Werror=address]
   if (&__ptr != NULL)      \

So add pragma weak for all affected usages.

Checked on x86_64 and i686 with gcc 6 and 13.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-07-26 09:45:22 -03:00
Andreas K. Hüttel
b40f5f84c4
NEWS: Insert autogenerated list of fixed bugs
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-25 23:59:25 +02:00
Andreas K. Hüttel
aa4aae3df9
NEWS: Mention AArch64 libmvec under build requirements again
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-25 23:55:17 +02:00
Andreas K. Hüttel
653433cdf0
NEWS: Minor editorial changes
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-25 23:49:07 +02:00
Aurelien Jarno
a3eac15251 MIPS: Update mips32 and mip64 libm test ulps
Generated on a Cavium Octeon III 2 board running Linux version 4.19.249
and GCC 13.1.0.

Needed due to commit cf7ffdd8a5 ("added pair of inputs for hypotf in
binary32").
2023-07-25 22:20:57 +02:00