Commit Graph

37758 Commits

Author SHA1 Message Date
Florian Weimer
c87fcacc50 Linux: Fix fcntl, ioctl, prctl redirects for _TIME_BITS=64 (bug 28182)
__REDIRECT and __THROW are not compatible with C++ due to the ordering of the
__asm__ alias and the throw specifier. __REDIRECT_NTH has to be used
instead.

Fixes commit 8a40aff86b ("io: Add time64 alias
for fcntl"), commit 82c395d91e ("misc: Add
time64 alias for ioctl"), commit b39ffab860
("Linux: Add time64 alias for prctl").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-08-06 09:52:00 +02:00
Joseph Myers
fb89489636 Add INADDR_DUMMY from Linux 5.13 to netinet/in.h
Linux 5.13 adds an INADDR_DUMMY definition; add a corresponding
definition to glibc's netinet/in.h.  (This isn't strictly a new kernel
interface, rather a value defined in RFC 7600.)

Tested for x86_64.
2021-08-05 20:12:56 +00:00
Siddhesh Poyarekar
505a964ae0 tst-mxfast: Don't run with mcheck
The test may not show predictable behaviour with -lmcheck since the
padding won't always guarantee fastbin usage.
2021-08-05 07:36:55 +05:30
Adhemerval Zanella
3d9a539ee6 rt: Set the correct message queue for tst-mqueue10
Checked on x86_64-linux-gnu.
2021-08-04 17:38:38 -03:00
Adhemerval Zanella
c52eb066bc Update sparc libm-test-ulps 2021-08-04 17:38:38 -03:00
Adhemerval Zanella
5b86241a03 linux: Add sparck brk implementation
It turned that the generic implementation of brk() does not work
for sparc, since on failure kernel will just return the previous
input value without setting the conditional register.

This patches adds back a sparc32 and sparc64 implementation removed
by 720480934a.

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.
2021-08-04 17:38:30 -03:00
DJ Delorie
ac30324c67 test-dlclose-exit-race: avoid hang on pthread_create error
This test depends on the "last" function being called in a
different thread than the "first" function, as "last" posts
a semaphore that "first" is waiting on.  However, if pthread_create
fails - for example, if running in an older container before
the clone3()-in-container-EPERM fixes - exit() is called in the
same thread as everything else, the semaphore never gets posted,
and first hangs.

The fix is to pre-post that semaphore before a single-threaded
exit.

Reviewed-by: Arjun Shankar <arjun@redhat.com>
2021-08-04 15:33:21 -04:00
Siddhesh Poyarekar
b17e842a60 gethosts: Remove unused argument _type
The generated code is unchanged.
2021-08-04 02:23:43 +05:30
Samuel Thibault
df183287ff hurd: Avoid spurious warning
Compilers missing some flow analysis may think ss may be used
uninitialized.
2021-08-03 19:38:45 +02:00
Siddhesh Poyarekar
77a34079d8 gaiconf_init: Avoid double-free in label and precedence lists
labellist and precedencelist could get freed a second time if there
are allocation failures, so set them to NULL to avoid a double-free.

Reviewed-by: Arjun Shankar <arjun@redhat.com>
2021-08-03 21:11:03 +05:30
Siddhesh Poyarekar
45caed9d67 copy_and_spawn_sgid: Avoid double calls to close()
If close() on infd and outfd succeeded, reset the fd numbers so that
we don't attempt to close them again.

Reviewed-by: Arjun Shankar <arjun@redhat.com>
2021-08-03 21:10:53 +05:30
Siddhesh Poyarekar
1e0e6d656d iconv_charmap: Close output file when done
Reviewed-by: Arjun Shankar <arjun@redhat.com>
2021-08-03 21:10:29 +05:30
Siddhesh Poyarekar
5f9b78fe35 gconv_parseconfdir: Fix memory leak
The allocated `conf` would leak if we have to skip over the file due
to the underlying filesystem not supporting dt_type.

Reviewed-by: Arjun Shankar <arjun@redhat.com>
2021-08-03 21:10:20 +05:30
Siddhesh Poyarekar
b0234d79e7 ldconfig: avoid leak on empty paths in config file
Reviewed-by: Arjun Shankar <arjun@redhat.com>
2021-08-03 21:10:10 +05:30
Joseph Myers
2ee9b24f47 Fix build of nptl/tst-thread_local1.cc with GCC 12
The test nptl/tst-thread_local1.cc fails to build with GCC mainline
because of changes to what libstdc++ headers implicitly include what
other headers:

tst-thread_local1.cc: In function 'int do_test()':
tst-thread_local1.cc:177:5: error: variable 'std::array<std::pair<const char*, std::function<void(void* (*)(void*))> >, 2> do_thread_X' has initializer but incomplete type
  177 |     do_thread_X
      |     ^~~~~~~~~~~

Fix this by adding an explicit include of <array>.

Tested with build-many-glibcs.py for aarch64-linux-gnu.
2021-08-02 16:33:44 +00:00
Robbie Harwood
6069826312 nis: Fix leak on realloc failure in nis_getnames [BZ #28150]
If pos >= count but realloc fails, tmp will not have been placed in
getnames[pos] yet, and so will not be freed in free_null.  Detected
by Coverity.

Also remove misleading comment from nis_getnames(), since it actually
did properly release getnames when out of memory.

Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-08-02 11:14:20 -04:00
Paul Zimmermann
db737c79c6 Remove obsolete comments/name from several benchtest input files.
These comments refer to slow paths that were removed in
glibc 2.34 or earlier.  The corresponding "names" that yield
separate workload traces for "make bench" are thus obsolete.
We are however keeping the corresponding inputs.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2021-08-02 15:27:16 +02:00
Paul Zimmermann
4165dd2e95 Remove obsolete comments/name from acos-inputs, since slow path was removed. 2021-08-02 15:05:22 +02:00
Carlos O'Donell
a85c93c424 Open master branch for glibc 2.35 development 2021-08-01 21:54:40 -04:00
Carlos O'Donell
ae37d06c7d Update ChangeLog.old/ChangeLog.23. 2021-08-01 21:33:43 -04:00
Carlos O'Donell
cdf4cd5e60 Prepare for glibc 2.34 release.
Update version.h, and include/features.h.
2021-08-01 21:24:04 -04:00
Carlos O'Donell
e39d2b84a2 po/nl.po: Update Dutch translation. 2021-08-01 20:52:28 -04:00
Carlos O'Donell
06eae99ab4 Update install.texi, and regenerate INSTALL. 2021-08-01 16:48:43 -04:00
Carlos O'Donell
e502942eb8 Update translations. 2021-08-01 16:48:43 -04:00
Carlos O'Donell
2e2c08aa4d Update NEWS.
Suggestions by Florian Weimer, Andreas Schwab, and Alexander Monakov.

See:
https://sourceware.org/pipermail/libc-alpha/2021-July/129356.html
https://sourceware.org/pipermail/libc-alpha/2021-July/129357.html
https://sourceware.org/pipermail/libc-alpha/2021-July/129361.html
2021-08-01 16:47:56 -04:00
Mark Harris
cfdaa29f66 NEWS: Fix typos, grammar, and missing words
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-08-01 00:51:22 -04:00
Adhemerval Zanella
3908fa933a elf: Fix audit regression
Commit 03e187a41d added a regression when an audit module does not have
libc as DT_NEEDED (although unusual it is possible).

Checked on x86_64-linux-gnu.
2021-07-30 16:01:44 -03:00
Carlos O'Donell
c37fc3ebf0 Update libc.pot for 2.34 release. 2021-07-28 22:04:22 -04:00
H.J. Lu
91cc803d27 x86-64: Add Avoid_Short_Distance_REP_MOVSB
commit 3ec5d83d2a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat Jan 25 14:19:40 2020 -0800

    x86-64: Avoid rep movsb with short distance [BZ #27130]

introduced some regressions on Intel processors without Fast Short REP
MOV (FSRM).  Add Avoid_Short_Distance_REP_MOVSB to avoid rep movsb with
short distance only on Intel processors with FSRM.  bench-memmove-large
on Skylake server shows that cycles of __memmove_evex_unaligned_erms
improves for the following data size:

                                  before    after    Improvement
length=4127, align1=3, align2=0:  479.38    349.25      27%
length=4223, align1=9, align2=5:  405.62    333.25      18%
length=8223, align1=3, align2=0:  786.12    496.38      37%
length=8319, align1=9, align2=5:  727.50    501.38      31%
length=16415, align1=3, align2=0: 1436.88   840.00      41%
length=16511, align1=9, align2=5: 1375.50   836.38      39%
length=32799, align1=3, align2=0: 2890.00   1860.12     36%
length=32895, align1=9, align2=5: 2891.38   1931.88     33%
2021-07-28 13:23:57 -07:00
H.J. Lu
c25c32165d Typo: Rename HAVE_CLONE3_WAPPER to HAVE_CLONE3_WRAPPER 2021-07-28 10:19:08 -07:00
Florian Weimer
5f18453d1c build-many-glibcs.py: Add x86_64-linux-gnu-minimal configuration
This configuration exercises various --disable-* configure options.
It is expected to catch -Werror failures that only affect these
configurations.
2021-07-28 14:47:33 +02:00
Siddhesh Poyarekar
70d08ba204 tests: use xmalloc to allocate implementation array
The benchmark and tests must fail in case of allocation failure in the
implementation array.  Also annotate the x* allocators in support.h so
that the compiler has more information about them.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2021-07-28 17:45:19 +05:30
Siddhesh Poyarekar
b8e8bb324a xmalloc: Fix warnings with gcc analyzer
Tell the compiler that xmalloc family of allocators always return
non-NULL.  xrealloc in locale/programs also always returns non-NULL,
but that conflicts with default realloc behaviour and that of xrealloc
in libsupport, so keep it as is for now and resolve the differences
later.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2021-07-28 17:45:14 +05:30
Siddhesh Poyarekar
4aedc25f55 __cxa_thread_atexit_impl: Abort on allocation failure [BZ #18524]
Abort in the unlikely event that allocation fails when trying to
register a TLS destructor.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2021-07-28 13:55:42 +05:30
Siddhesh Poyarekar
fb1621a886 manual: Drop the .so suffix in libc_malloc_debug description
All references to libraries in the manual are without the .so prefix,
so do the same for libc_malloc_debug.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-07-27 07:54:46 +05:30
Samuel Thibault
de2f68c3c7 hurd: _Fork: unlock malloc before calling fork child hooks
The setitimer fork hook, fork_itimer, needs to call malloc inside
__mach_setup_tls, so we need to unlock malloc before calling it.
2021-07-27 02:03:01 +02:00
Siddhesh Poyarekar
ddcc612ce9 Exclude static tests for mcheck and malloc-check
mcheck and malloc-check no longer work with static binaries, so drop
those tests.

Reported-by: Samuel Thibault <samuel.thibault@gnu.org>
Tested-by: Samuel Thibault <samuel.thibault@gnu.org>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2021-07-26 10:47:46 +05:30
Arjun Shankar
e785361ce3 i386: Regenerate ulps
These failures were caught while building glibc master for Fedora Rawhide
which is built with `-mtune=generic -msse2 -mfpmath=sse'.
2021-07-25 22:29:27 +02:00
Siddhesh Poyarekar
d34ed66f96 manual: Document unsupported cases for interposition
These functions call the core allocator functions (realloc and malloc
respectively) and are hence guaranteed to allocate memory using the
correct functions when multiple allocators are interposed.  Having
these functions interposed in one allocator and not another may result
in confusion, hence discourage interposing them altogether.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2021-07-23 20:27:10 +05:30
H.J. Lu
7c124e3714 x86: Install <bits/platform/x86.h> [BZ #27958]
1. Install <bits/platform/x86.h> for <sys/platform/x86.h> which includes
<bits/platform/x86.h>.
2. Rename HAS_CPU_FEATURE to CPU_FEATURE_PRESENT which checks if the
processor has the feature.
3. Rename CPU_FEATURE_USABLE to CPU_FEATURE_ACTIVE which checks if the
feature is active.  There may be other preconditions, like sufficient
stack space or further setup for AMX, which must be satisfied before the
feature can be used.

This fixes BZ #27958.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-07-23 05:12:51 -07:00
Siddhesh Poyarekar
5b8d271571 Fix build and tests with --disable-tunables
Remove unused code and declare __libc_mallopt when !IS_IN (libc) to
allow the debug hook to build with --disable-tunables.

Also, run tst-ifunc-isa-2* tests only when tunables are enabled since
the result depends on it.

Tested on x86_64.

Reported-by: Matheus Castanho <msc@linux.ibm.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-07-23 13:57:56 +05:30
Samuel Thibault
9a7ab0769b hurd: Fix glob lstat compatibility
84f7ce8447 ("posix: Add glob64 with 64-bit time_t support") replaced
GLOB_NO_LSTAT with defining GLOB_LSTAT and GLOB_LSTAT64, but the posix
and gnu versions of the change were missing in the commit.
2021-07-22 20:31:52 +02:00
Florian Weimer
f032ac3b83 socket: Add time64 alias for setsockopt
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-07-22 19:16:26 +02:00
Florian Weimer
02c17c8c14 socket: Add time64 alias for getsockopt
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-07-22 19:16:25 +02:00
Siddhesh Poyarekar
6856975ed4 mcheck Fix malloc_usable_size [BZ #22057]
Interpose malloc_usable_size to return the correct mcheck value for
malloc_usable_size.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-22 18:38:16 +05:30
Siddhesh Poyarekar
1e5a5866cb Remove malloc hooks [BZ #23328]
Make malloc hooks symbols compat-only so that new applications cannot
link against them and remove the declarations from the API.  Also
remove the unused malloc-hooks.h.

Finally, mark all symbols in libc_malloc_debug.so as compat so that
the library cannot be linked against.

Add a note about the deprecation in NEWS.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-22 18:38:12 +05:30
Siddhesh Poyarekar
0552fd2c7d Move malloc_{g,s}et_state to libc_malloc_debug
These deprecated functions are only safe to call from
__malloc_initialize_hook and as a result, are not useful in the
general case.  Move the implementations to libc_malloc_debug so that
existing binaries that need it will now have to preload the debug DSO
to work correctly.

This also allows simplification of the core malloc implementation by
dropping all the undumping support code that was added to make
malloc_set_state work.

One known breakage is that of ancient emacs binaries that depend on
this.  They will now crash when running with this libc.  With
LD_BIND_NOW=1, it will terminate immediately because of not being able
to find malloc_set_state but with lazy binding it will crash in
unpredictable ways.  It will need a preloaded libc_malloc_debug.so so
that its initialization hook is executed to allow its malloc
implementation to work properly.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-22 18:38:10 +05:30
Siddhesh Poyarekar
b5bd5bfe88 glibc.malloc.check: Wean away from malloc hooks
The malloc-check debugging feature is tightly integrated into glibc
malloc, so thanks to an idea from Florian Weimer, much of the malloc
implementation has been moved into libc_malloc_debug.so to support
malloc-check.  Due to this, glibc malloc and malloc-check can no
longer work together; they use altogether different (but identical)
structures for heap management.  This should not make a difference
though since the malloc check hook is not disabled anywhere.
malloc_set_state does, but it does so early enough that it shouldn't
cause any problems.

The malloc check tunable is now in the debug DSO and has no effect
when the DSO is not preloaded.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-22 18:38:08 +05:30
Siddhesh Poyarekar
9dad716d4d mtrace: Wean away from malloc hooks
Wean mtrace away from the malloc hooks and move them into the debug
DSO.  Split the API away from the implementation so that we can add
the API to libc.so as well as libc_malloc_debug.so, with the libc
implementations being empty.

Update localplt data since memalign no longer has any callers after
this change.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-22 18:38:06 +05:30
Siddhesh Poyarekar
cc35896ea3 Simplify __malloc_initialized
Now that mcheck no longer needs to check __malloc_initialized (and no
other third party hook can since the symbol is not exported), make the
variable boolean and static so that it is used strictly within malloc.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-22 18:38:04 +05:30