]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
3 years agoUse support_open_dev_null_range io/tst-closefrom, misc/tst-close_range, and posix...
Adhemerval Zanella [Tue, 24 Aug 2021 19:15:50 +0000 (16:15 -0300)] 
Use support_open_dev_null_range io/tst-closefrom, misc/tst-close_range, and posix/tst-spawn5 (BZ #28260)

It ensures a continuous range of file descriptor and avoid hitting
the RLIMIT_NOFILE.

Checked on x86_64-linux-gnu.

(cherry picked from commit 6b20880b22d1d0fce7e9f506baa6fe2d5c7fcfdc)

3 years agosupport: Add support_open_dev_null_range
Adhemerval Zanella [Tue, 24 Aug 2021 19:12:24 +0000 (16:12 -0300)] 
support: Add support_open_dev_null_range

It returns a range of file descriptor referring to the '/dev/null'
pathname.  The function takes care of restarting the open range
if a file descriptor is found within the specified range and
also increases RLIMIT_NOFILE if required.

Checked on x86_64-linux-gnu.

(cherry picked from commit e814f4b04ee413a7bb3dfa43e74c8fb4abf58359)

3 years agonptl: Fix type of pthread_mutexattr_getrobust_np, pthread_mutexattr_setrobust_np...
Florian Weimer [Tue, 21 Sep 2021 05:12:56 +0000 (07:12 +0200)] 
nptl: Fix type of pthread_mutexattr_getrobust_np, pthread_mutexattr_setrobust_np (bug 28036)

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit f3e664563361dc17530113b3205998d1f19dc4d9)

3 years agonptl: pthread_kill needs to return ESRCH for old programs (bug 19193)
Florian Weimer [Mon, 20 Sep 2021 12:56:08 +0000 (14:56 +0200)] 
nptl: pthread_kill needs to return ESRCH for old programs (bug 19193)

The fix for bug 19193 breaks some old applications which appear
to use pthread_kill to probe if a thread is still running, something
that is not supported by POSIX.

(cherry picked from commit 95dba35bf05e4a5d69dfae5e9c9d4df3646a7f93)

3 years agoposix: Fix attribute access mode on getcwd [BZ #27476]
Aurelien Jarno [Fri, 10 Sep 2021 17:39:35 +0000 (19:39 +0200)] 
posix: Fix attribute access mode on getcwd [BZ #27476]

There is a GNU extension that allows to call getcwd(NULL, >0). It is
described in the documentation, but also directly in the unistd.h
header, just above the declaration.

Therefore the attribute access mode added in commit 06febd8c6705
is not correct. Drop it.

3 years agoAdd MADV_POPULATE_READ and MADV_POPULATE_WRITE from Linux 5.14 to bits/mman-linux.h
Joseph Myers [Tue, 14 Sep 2021 14:19:24 +0000 (14:19 +0000)] 
Add MADV_POPULATE_READ and MADV_POPULATE_WRITE from Linux 5.14 to bits/mman-linux.h

Linux 5.14 adds constants MADV_POPULATE_READ and MADV_POPULATE_WRITE
(with the same values on all architectures).  Add these to glibc's
bits/mman-linux.h.

Tested for x86_64.

(cherry picked from commit 3561106278cddd2f007bd27fd4c3e90caaf14b43)

3 years agoUpdate kernel version to 5.14 in tst-mman-consts.py
Joseph Myers [Tue, 14 Sep 2021 13:51:58 +0000 (13:51 +0000)] 
Update kernel version to 5.14 in tst-mman-consts.py

This patch updates the kernel version in the test tst-mman-consts.py
to 5.14.  (There are no new MAP_* constants covered by this test in
5.14 that need any other header changes.)

Tested with build-many-glibcs.py.

(cherry picked from commit 4b39e3498324d1aea802fea8d4b8764f5ddb4fd1)

3 years agoUpdate syscall lists for Linux 5.14
Joseph Myers [Wed, 8 Sep 2021 12:42:06 +0000 (12:42 +0000)] 
Update syscall lists for Linux 5.14

Linux 5.14 has two new syscalls, memfd_secret (on some architectures
only) and quotactl_fd.  Update syscall-names.list and regenerate the
arch-syscall.h headers with build-many-glibcs.py update-syscalls.

Tested with build-many-glibcs.py.

(cherry picked from commit 89dc0372a9055e7ef86fe19be6201fa0b16b2f0e)

3 years agoUse Linux 5.14 in build-many-glibcs.py
Joseph Myers [Tue, 7 Sep 2021 13:08:38 +0000 (13:08 +0000)] 
Use Linux 5.14 in build-many-glibcs.py

This patch makes build-many-glibcs.py use Linux 5.14.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).

(cherry picked from commit 4e04a47208e1712fcf202a6d9831f0900d575225)

3 years agoFix failing nss/tst-nss-files-hosts-long with local resolver
Aurelien Jarno [Thu, 2 Sep 2021 22:28:14 +0000 (00:28 +0200)] 
Fix failing nss/tst-nss-files-hosts-long with local resolver

When a local resolver like unbound is listening on the IPv4 loopback
address 127.0.0.1, the nss/tst-nss-files-hosts-long test fails. This is
due to:
- the default resolver in the absence of resolv.conf being 127.0.0.1
- the default DNS NSS database configuration in the absence of
  nsswitch.conf being 'hosts: dns [!UNAVAIL=return] file'

This causes the requests for 'test4' and 'test6' to first be sent to the
local resolver, which responds with NXDOMAIN in the likely case those
records do no exist. In turn that causes the access to /etc/hosts to be
skipped, which is the purpose of that test.

Fix that by providing a simple nsswitch.conf file forcing access to
/etc/hosts for that test. I have tested that the only changed result in
the testsuite is that test.

(cherry picked from commit 2738480a4b0866723fb8c633f36bdd34a8767581)

3 years agoiconvconfig: Fix behaviour with --prefix [BZ #28199]
Siddhesh Poyarekar [Mon, 13 Sep 2021 15:18:35 +0000 (20:48 +0530)] 
iconvconfig: Fix behaviour with --prefix [BZ #28199]

The consolidation of configuration parsing broke behaviour with
--prefix, where the prefix bled into the modules cache.  Accept a
prefix which, when non-NULL, is prepended to the path when looking for
configuration files but only the original directory is added to the
modules cache.

This has no effect on the codegen of gconv_conf since it passes NULL.

Reported-by: Patrick McCarty <patrick.mccarty@intel.com>
Reported-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Andreas Schwab <schwab@linux-m68k.org>
(cherry picked from commit 43cea6d5652b6b9e61ac6ecc69419c909b504f47)

3 years agonptl: Fix race between pthread_kill and thread exit (bug 12889)
Florian Weimer [Mon, 13 Sep 2021 09:06:08 +0000 (11:06 +0200)] 
nptl: Fix race between pthread_kill and thread exit (bug 12889)

A new thread exit lock and flag are introduced.  They are used to
detect that the thread is about to exit or has exited in
__pthread_kill_internal, and the signal is not sent in this case.

The test sysdeps/pthread/tst-pthread_cancel-select-loop.c is derived
from a downstream test originally written by Marek Polacek.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit 526c3cf11ee9367344b6b15d669e4c3cb461a2be)

3 years agonptl: pthread_kill, pthread_cancel should not fail after exit (bug 19193)
Florian Weimer [Mon, 13 Sep 2021 09:06:08 +0000 (11:06 +0200)] 
nptl: pthread_kill, pthread_cancel should not fail after exit (bug 19193)

This closes one remaining race condition related to bug 12889: if
the thread already exited on the kernel side, returning ESRCH
is not correct because that error is reserved for the thread IDs
(pthread_t values) whose lifetime has ended.  In case of a
kernel-side exit and a valid thread ID, no signal needs to be sent
and cancellation does not have an effect, so just return 0.

sysdeps/pthread/tst-kill4.c triggers undefined behavior and is
removed with this commit.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit 8af8456004edbab71f8903a60a3cae442cf6fe69)

3 years agosupport: Add support_wait_for_thread_exit
Florian Weimer [Mon, 30 Aug 2021 11:43:56 +0000 (13:43 +0200)] 
support: Add support_wait_for_thread_exit

(cherry picked from commit 032d74eaf6179100048a5bf0ce942e97dc8b9a60)

3 years agoMIPS: Setup errno for {f,l,}xstat
Jiaxun Yang [Tue, 7 Sep 2021 05:31:42 +0000 (13:31 +0800)] 
MIPS: Setup errno for {f,l,}xstat

{f,l,}xstat stub for MIPS is using INTERNAL_SYSCALL
to do xstat syscall for glibc ver, However it leaves
errno untouched and thus giving bad errno output.

Setup errno properly when syscall returns non-zero.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit 66016ec8aeefd40e016d7040d966484c764b0e9c)

3 years agox86-64: Use testl to check __x86_string_control
H.J. Lu [Sat, 28 Aug 2021 13:10:38 +0000 (06:10 -0700)] 
x86-64: Use testl to check __x86_string_control

Use testl, instead of andl, to check __x86_string_control to avoid
updating __x86_string_control.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit 3c8b9879cab6d41787bc5b14c1748f62fd6d0e5f)

3 years agoelf: Fix missing colon in LD_SHOW_AUXV output [BZ #28253]
Arjun Shankar [Fri, 20 Aug 2021 14:24:05 +0000 (16:24 +0200)] 
elf: Fix missing colon in LD_SHOW_AUXV output [BZ #28253]

This commit adds a missing colon in the AT_MINSIGSTKSZ entry in
the _dl_show_auxv function.

(cherry picked from commit 82fbcd7118d760492e2ecc9fa291e358b9ba0361)

3 years agolibrt: add test (bug 28213)
Nikita Popov [Thu, 12 Aug 2021 10:39:50 +0000 (16:09 +0530)] 
librt: add test (bug 28213)

This test implements following logic:
1) Create POSIX message queue.
   Register a notification with mq_notify (using NULL attributes).
   Then immediately unregister the notification with mq_notify.
   Helper thread in a vulnerable version of glibc
   should cause NULL pointer dereference after these steps.
2) Once again, register the same notification.
   Try to send a dummy message.
   Test is considered successfulif the dummy message
   is successfully received by the callback function.

Signed-off-by: Nikita Popov <npv1310@gmail.com>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
(cherry picked from commit 4cc79c217744743077bf7a0ec5e0a4318f1e6641)

3 years agolibrt: fix NULL pointer dereference (bug 28213)
Nikita Popov [Mon, 9 Aug 2021 14:47:34 +0000 (20:17 +0530)] 
librt: fix NULL pointer dereference (bug 28213)

Helper thread frees copied attribute on NOTIFY_REMOVED message
received from the OS kernel.  Unfortunately, it fails to check whether
copied attribute actually exists (data.attr != NULL).  This worked
earlier because free() checks passed pointer before actually
attempting to release corresponding memory.  But
__pthread_attr_destroy assumes pointer is not NULL.

So passing NULL pointer to __pthread_attr_destroy will result in
segmentation fault.  This scenario is possible if
notification->sigev_notify_attributes == NULL (which means default
thread attributes should be used).

Signed-off-by: Nikita Popov <npv1310@gmail.com>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
(cherry picked from commit b805aebd42364fe696e417808a700fdb9800c9e8)

4 years agoLinux: Fix fcntl, ioctl, prctl redirects for _TIME_BITS=64 (bug 28182)
Florian Weimer [Fri, 6 Aug 2021 07:51:38 +0000 (09:51 +0200)] 
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 8a40aff86ba5f64a3a84883e539cb67b ("io: Add time64 alias
for fcntl"), commit 82c395d91ea4f69120d453aeec398e30 ("misc: Add
time64 alias for ioctl"), commit b39ffab860cd743a82c91946619f1b8158
("Linux: Add time64 alias for prctl").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit c87fcacc50505d550f1bb038382bcc7ea73a5926)

4 years agoiconv_charmap: Close output file when done
Siddhesh Poyarekar [Tue, 3 Aug 2021 15:40:29 +0000 (21:10 +0530)] 
iconv_charmap: Close output file when done

Reviewed-by: Arjun Shankar <arjun@redhat.com>
(cherry picked from commit 1e0e6d656db9dfa12ef7eb67976385d3deb0d4ff)

4 years agocopy_and_spawn_sgid: Avoid double calls to close()
Siddhesh Poyarekar [Tue, 3 Aug 2021 15:40:53 +0000 (21:10 +0530)] 
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>
(cherry picked from commit 45caed9d67a00af917d8b5b88d4b5eb1225b7aef)

4 years agogaiconf_init: Avoid double-free in label and precedence lists
Siddhesh Poyarekar [Tue, 3 Aug 2021 15:41:03 +0000 (21:11 +0530)] 
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>
(cherry picked from commit 77a34079d8f3d63b61543bf3af93043f8674e4c4)

4 years agogconv_parseconfdir: Fix memory leak
Siddhesh Poyarekar [Tue, 3 Aug 2021 15:40:20 +0000 (21:10 +0530)] 
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>
(cherry picked from commit 5f9b78fe35d08739b6da1e5b356786d41116c108)

4 years agoldconfig: avoid leak on empty paths in config file
Siddhesh Poyarekar [Tue, 3 Aug 2021 15:40:10 +0000 (21:10 +0530)] 
ldconfig: avoid leak on empty paths in config file

Reviewed-by: Arjun Shankar <arjun@redhat.com>
(cherry picked from commit b0234d79e7d82475d1666f25326ec045c045b3ed)

4 years agoUpdate ChangeLog.old/ChangeLog.23. glibc-2.34
Carlos O'Donell [Mon, 2 Aug 2021 01:33:43 +0000 (21:33 -0400)] 
Update ChangeLog.old/ChangeLog.23.

4 years agoPrepare for glibc 2.34 release.
Carlos O'Donell [Mon, 2 Aug 2021 01:24:04 +0000 (21:24 -0400)] 
Prepare for glibc 2.34 release.

Update version.h, and include/features.h.

4 years agopo/nl.po: Update Dutch translation.
Carlos O'Donell [Mon, 2 Aug 2021 00:47:29 +0000 (20:47 -0400)] 
po/nl.po: Update Dutch translation.

4 years agoUpdate install.texi, and regenerate INSTALL.
Carlos O'Donell [Sun, 1 Aug 2021 20:36:25 +0000 (16:36 -0400)] 
Update install.texi, and regenerate INSTALL.

4 years agoUpdate translations.
Carlos O'Donell [Sun, 1 Aug 2021 03:24:51 +0000 (23:24 -0400)] 
Update translations.

4 years agoUpdate NEWS.
Carlos O'Donell [Sun, 1 Aug 2021 03:39:07 +0000 (23:39 -0400)] 
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

4 years agoNEWS: Fix typos, grammar, and missing words
Mark Harris [Sat, 31 Jul 2021 23:25:57 +0000 (16:25 -0700)] 
NEWS: Fix typos, grammar, and missing words

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agoelf: Fix audit regression
Adhemerval Zanella [Wed, 30 Jun 2021 03:21:18 +0000 (00:21 -0300)] 
elf: Fix audit regression

Commit 03e187a41d9 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.

4 years agoUpdate libc.pot for 2.34 release.
Carlos O'Donell [Thu, 29 Jul 2021 02:03:54 +0000 (22:03 -0400)] 
Update libc.pot for 2.34 release.

4 years agox86-64: Add Avoid_Short_Distance_REP_MOVSB
H.J. Lu [Fri, 23 Jul 2021 03:26:25 +0000 (20:26 -0700)] 
x86-64: Add Avoid_Short_Distance_REP_MOVSB

commit 3ec5d83d2a237d39e7fd6ef7a0bc8ac4c171a4a5
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%

4 years agoTypo: Rename HAVE_CLONE3_WAPPER to HAVE_CLONE3_WRAPPER
H.J. Lu [Wed, 28 Jul 2021 17:19:08 +0000 (10:19 -0700)] 
Typo: Rename HAVE_CLONE3_WAPPER to HAVE_CLONE3_WRAPPER

4 years agobuild-many-glibcs.py: Add x86_64-linux-gnu-minimal configuration
Florian Weimer [Wed, 28 Jul 2021 12:47:33 +0000 (14:47 +0200)] 
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.

4 years agotests: use xmalloc to allocate implementation array
Siddhesh Poyarekar [Wed, 28 Jul 2021 07:33:27 +0000 (13:03 +0530)] 
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>
4 years agoxmalloc: Fix warnings with gcc analyzer
Siddhesh Poyarekar [Wed, 28 Jul 2021 11:28:17 +0000 (16:58 +0530)] 
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>
4 years ago__cxa_thread_atexit_impl: Abort on allocation failure [BZ #18524]
Siddhesh Poyarekar [Wed, 28 Jul 2021 07:41:20 +0000 (13:11 +0530)] 
__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>
4 years agomanual: Drop the .so suffix in libc_malloc_debug description
Siddhesh Poyarekar [Tue, 27 Jul 2021 02:24:46 +0000 (07:54 +0530)] 
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>
4 years agohurd: _Fork: unlock malloc before calling fork child hooks
Samuel Thibault [Tue, 27 Jul 2021 00:03:01 +0000 (02:03 +0200)] 
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.

4 years agoExclude static tests for mcheck and malloc-check
Siddhesh Poyarekar [Mon, 26 Jul 2021 05:17:46 +0000 (10:47 +0530)] 
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>
4 years agoi386: Regenerate ulps
Arjun Shankar [Sun, 25 Jul 2021 20:29:27 +0000 (22:29 +0200)] 
i386: Regenerate ulps

These failures were caught while building glibc master for Fedora Rawhide
which is built with `-mtune=generic -msse2 -mfpmath=sse'.

4 years agomanual: Document unsupported cases for interposition
Siddhesh Poyarekar [Fri, 23 Jul 2021 14:56:01 +0000 (20:26 +0530)] 
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>
4 years agox86: Install <bits/platform/x86.h> [BZ #27958]
H.J. Lu [Sat, 5 Jun 2021 13:42:20 +0000 (06:42 -0700)] 
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>
4 years agoFix build and tests with --disable-tunables
Siddhesh Poyarekar [Fri, 23 Jul 2021 08:27:56 +0000 (13:57 +0530)] 
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>
4 years agohurd: Fix glob lstat compatibility
Samuel Thibault [Thu, 22 Jul 2021 18:29:57 +0000 (18:29 +0000)] 
hurd: Fix glob lstat compatibility

84f7ce84474c ("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.

4 years agosocket: Add time64 alias for setsockopt
Florian Weimer [Thu, 22 Jul 2021 17:12:13 +0000 (19:12 +0200)] 
socket: Add time64 alias for setsockopt

Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agosocket: Add time64 alias for getsockopt
Florian Weimer [Thu, 22 Jul 2021 17:12:12 +0000 (19:12 +0200)] 
socket: Add time64 alias for getsockopt

Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agomcheck Fix malloc_usable_size [BZ #22057]
Siddhesh Poyarekar [Thu, 22 Jul 2021 13:08:16 +0000 (18:38 +0530)] 
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>
4 years agoRemove malloc hooks [BZ #23328]
Siddhesh Poyarekar [Thu, 22 Jul 2021 13:08:12 +0000 (18:38 +0530)] 
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>
4 years agoMove malloc_{g,s}et_state to libc_malloc_debug
Siddhesh Poyarekar [Thu, 22 Jul 2021 13:08:10 +0000 (18:38 +0530)] 
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>
4 years agoglibc.malloc.check: Wean away from malloc hooks
Siddhesh Poyarekar [Thu, 22 Jul 2021 13:08:08 +0000 (18:38 +0530)] 
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>
4 years agomtrace: Wean away from malloc hooks
Siddhesh Poyarekar [Thu, 22 Jul 2021 13:08:06 +0000 (18:38 +0530)] 
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>
4 years agoSimplify __malloc_initialized
Siddhesh Poyarekar [Thu, 22 Jul 2021 13:08:04 +0000 (18:38 +0530)] 
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>
4 years agomcheck: Wean away from malloc hooks [BZ #23489]
Siddhesh Poyarekar [Thu, 22 Jul 2021 13:08:02 +0000 (18:38 +0530)] 
mcheck: Wean away from malloc hooks [BZ #23489]

Split the mcheck implementation into the debugging hooks and API so
that the API can be replicated in libc and libc_malloc_debug.so.  The
libc APIs always result in failure.

The mcheck implementation has also been moved entirely into
libc_malloc_debug.so and with it, all of the hook initialization code
can now be moved into the debug library.  Now the initialization can
be done independently of libc internals.

With this patch, libc_malloc_debug.so can no longer be used with older
libcs, which is not its goal anyway.  tst-vfork3 breaks due to this
since it spawns shell scripts, which in turn execute using the system
glibc.  Move the test to tests-container so that only the built glibc
is used.

This move also fixes bugs in the mcheck version of memalign and
realloc, thus allowing removal of the tests from tests-mcheck
exclusion list.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoMove malloc hooks into a compat DSO
Siddhesh Poyarekar [Thu, 22 Jul 2021 13:07:59 +0000 (18:37 +0530)] 
Move malloc hooks into a compat DSO

Remove all malloc hook uses from core malloc functions and move it
into a new library libc_malloc_debug.so.  With this, the hooks now no
longer have any effect on the core library.

libc_malloc_debug.so is a malloc interposer that needs to be preloaded
to get hooks functionality back so that the debugging features that
depend on the hooks, i.e. malloc-check, mcheck and mtrace work again.
Without the preloaded DSO these debugging features will be nops.
These features will be ported away from hooks in subsequent patches.

Similarly, legacy applications that need hooks functionality need to
preload libc_malloc_debug.so.

The symbols exported by libc_malloc_debug.so are maintained at exactly
the same version as libc.so.

Finally, static binaries will no longer be able to use malloc
debugging features since they cannot preload the debugging DSO.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoRemove __morecore and __default_morecore
Siddhesh Poyarekar [Thu, 22 Jul 2021 13:07:57 +0000 (18:37 +0530)] 
Remove __morecore and __default_morecore

Make the __morecore and __default_morecore symbols compat-only and
remove their declarations from the API.  Also, include morecore.c
directly into malloc.c; this should ideally get merged into malloc in
a future cleanup.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoRemove __after_morecore_hook
Siddhesh Poyarekar [Thu, 22 Jul 2021 13:07:54 +0000 (18:37 +0530)] 
Remove __after_morecore_hook

Remove __after_morecore_hook from the API and finalize the symbol so
that it can no longer be used in new applications.  Old applications
using __after_morecore_hook will find that their hook is no longer
called.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoMake mcheck tests conditional on GLIBC_2.23 or earlier
Siddhesh Poyarekar [Thu, 22 Jul 2021 13:07:41 +0000 (18:37 +0530)] 
Make mcheck tests conditional on GLIBC_2.23 or earlier

Targets with base versions of 2.24 or later won't have
__malloc_initialize_hook because of which the tests will essentially
be the same as the regular malloc tests.  Avoid running them instead
and save time.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoposix: Add sysconf(_SC_{MIN,}SIGSTKSZ) support
Samuel Thibault [Wed, 21 Jul 2021 23:23:02 +0000 (23:23 +0000)] 
posix: Add sysconf(_SC_{MIN,}SIGSTKSZ) support

4 years agomalloc: Fix tst-mallocfork3-malloc-check link
Samuel Thibault [Wed, 21 Jul 2021 22:40:57 +0000 (22:40 +0000)] 
malloc: Fix tst-mallocfork3-malloc-check link

It uses pthread.

4 years agoARC: elf: make type safe
Vineet Gupta [Thu, 30 Jul 2020 05:49:14 +0000 (22:49 -0700)] 
ARC: elf: make type safe

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
4 years agoARC: fp: (micro)optimize FPU_STATUS read by eliding FWE bit clearing
Vineet Gupta [Fri, 9 Jul 2021 21:56:18 +0000 (14:56 -0700)] 
ARC: fp: (micro)optimize FPU_STATUS read by eliding FWE bit clearing

Any FPU_STATUS write needs setting the FWE bit (31) whcih just provides
a "control signal" to enable explicit write (vs. the side-effect of FPU
instructions).  However this bit is RAZ and write-only, thus effectively
never stored in FPU_STATUS register. Thus when reading the register
there is no need to clear it. This shaves off a BCLR instruction from
the fe*exceptino family of functions and while no big deal still makes
sense to do.

This came up when debugging a race in math/test-fenv-tls [1]

[1]: https://github.com/foss-for-synopsys-dwc-arc-processors/linux/issues/54

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
4 years agosocket: Add time64 alias for sendmsg
Florian Weimer [Wed, 21 Jul 2021 09:42:31 +0000 (11:42 +0200)] 
socket: Add time64 alias for sendmsg

Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agosocket: Add time64 alias for recvmsg
Florian Weimer [Wed, 21 Jul 2021 09:42:31 +0000 (11:42 +0200)] 
socket: Add time64 alias for recvmsg

Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agosocket: Add time64 alias for sendmmsg
Florian Weimer [Wed, 21 Jul 2021 09:42:31 +0000 (11:42 +0200)] 
socket: Add time64 alias for sendmmsg

Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoLinux: Add time64 alias for prctl
Florian Weimer [Wed, 21 Jul 2021 09:42:31 +0000 (11:42 +0200)] 
Linux: Add time64 alias for prctl

Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoio: Add time64 alias for fcntl
Florian Weimer [Wed, 21 Jul 2021 09:42:31 +0000 (11:42 +0200)] 
io: Add time64 alias for fcntl

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agomisc: Add time64 alias for ioctl
Florian Weimer [Wed, 21 Jul 2021 09:42:31 +0000 (11:42 +0200)] 
misc: Add time64 alias for ioctl

Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoRISC-V: Update rv64 ULPs
Darius Rad [Tue, 20 Jul 2021 00:45:59 +0000 (20:45 -0400)] 
RISC-V: Update rv64 ULPs

Generated on a Microsemi Polarfire Icicle Kit running Linux version 5.6.18.
Same ULPs were also produced on QEMU 5.2.0 running Linux 5.10.46-1.

4 years agoresolv: Do not install libnss_dns.a, libnss_dns.so
Florian Weimer [Tue, 20 Jul 2021 10:27:23 +0000 (12:27 +0200)] 
resolv: Do not install libnss_dns.a, libnss_dns.so

Fixes commit e1fcf21474c5b522f ("resolv: Move nss_dns into libc").

4 years agohurd: Add support for spawn_do_closefrom
Samuel Thibault [Mon, 19 Jul 2021 21:45:29 +0000 (21:45 +0000)] 
hurd: Add support for spawn_do_closefrom

4 years agoelf: Fix tst-cpu-features-cpuinfo on some AMD systems (BZ #28090)
Adhemerval Zanella [Thu, 15 Jul 2021 11:52:44 +0000 (08:52 -0300)] 
elf: Fix tst-cpu-features-cpuinfo on some AMD systems (BZ #28090)

The SSBD feature is implemented in 2 different ways on AMD processors:
newer systems (Zen3) provides AMD_SSBD (function 8000_0008, EBX[24]),
while older system provides AMD_VIRT_SSBD (function 8000_0008, EBX[25]).
However for AMD_VIRT_SSBD, kernel shows both 'ssdb' and 'virt_ssdb' on
/proc/cpuinfo; while for AMD_SSBD only 'ssdb' is provided.

This now check is AMD_SSBD is set to check for 'ssbd', otherwise check
if AMD_VIRT_SSDB is set to check for 'virt_ssbd'.

Checked on x86_64-linux-gnu on a Ryzen 9 5900x.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 years agoi386: Add the clone3 wrapper
H.J. Lu [Wed, 12 May 2021 18:02:47 +0000 (11:02 -0700)] 
i386: Add the clone3 wrapper

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

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agonss: Directly load nss_dns, without going through dlsym/dlopen
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
nss: Directly load nss_dns, without going through dlsym/dlopen

This partially fixes static-only NSS support (bug 27959): The dns
module no longer needs dlopen.  Support for disabling dlopen altogher
remains to be added.

This commit introduces module_load_builtin into nss/nss_module.c, which
handles the common parts of loading the built-in nss_files and nss_dns
modules.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move nss_dns into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move nss_dns into libc

No abilist updates are needed because the symbols were GLIBC_PRIVATE.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move res_query functions into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move res_query functions into libc

This switches to public symbols without __ prefixes, due to improved
namespace management in glibc.

The script was used with --no-new-version to move the symbols
__res_nquery, __res_nquerydomain, __res_nsearch, __res_query,
__res_querydomain, __res_search, res_query, res_querydomain,
res_search.  The public symbols res_nquery, res_nquerydomain,
res_nsearch, res_ownok, res_query, res_querydomain, res_search
were added with make update-all-abi.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move res_mkquery, res_nmkquery into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move res_mkquery, res_nmkquery into libc

This switches to public symbols without __ prefixes, due to improved
namespace management in glibc.

The symbols res_mkquery, __res_mkquery, __res_nmkquery were
moved with the script (using --no-new-version).
res_mkquery@@GLIBC_2.34, res_nmkquery@@GLIBC_2.34 were added using
make update-all-abi.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move res_send, res_nsend into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move res_send, res_nsend into libc

Switch to public symbols without __ prefix (due to improved
namespace management).

__res_send, __res_nsend were moved using the script (with
--no-new-version).  res_send@@GLIBC_2.34 and res_nsend@@GLIBC_2.34
were added using make update-all-abi.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move res_hostalias into its own file, along with hostalias
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move res_hostalias into its own file, along with hostalias

These deprecated symbols continue to be exported from libresolv.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move __res_context_hostalias into its own file and into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move __res_context_hostalias into its own file and into libc

And reformat it to GNU style.  Remove the unecessary setbuf call.
Use __fgets_unlocked for PLT avoidance; no locking is required here.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move res_queriesmatch to its own file and into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move res_queriesmatch to its own file and into libc

And reformat it to GNU style.

The treatment of this function matches res_nameinquery, for the
reasons stated there.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move res_nameinquery to its own file and into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move res_nameinquery to its own file and into libc

And reformat to GNU style.

This deprecated function is used in the implementation of the stub
resolver (for now).  Keep the public symbol in libresolv for now
(so that no new symbol version is needed), and add a forwarder to
libresolv.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move ns_samename into its own file, and into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move ns_samename into its own file, and into libc

But only as an internal symbol, __libc_ns_samename.  The libresolv
ABI is preserved.  This is because the function is deprecated, and
it does not make sense to add new symbol versions for deprecated
functions.

Also reformat the implementation to GNU style.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move ns_makecanon into its own file, and into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move ns_makecanon into its own file, and into libc

But only as an internal symbol, __libc_ns_makecanon.  The libresolv
ABI is preserved.  This is because the function is deprecated, and
it does not make sense to add new symbol versions for deprecated
functions.

Also reformat the implementation to GNU style.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move res_isourserver to its own file and reformat to GNU style
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move res_isourserver to its own file and reformat to GNU style

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move __res_get_nsaddr to its own file and into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move __res_get_nsaddr to its own file and into libc

Eliminate the use of the EXT macro from it because it does not
add clarity.  The function was added to res_send.c in 2015, and
the copyright year reflects that.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Rename res_comp.c to res-name-checking.c and move into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Rename res_comp.c to res-name-checking.c and move into libc

This reflects what the remaining functions in the file do.

The __res_dnok, __res_hnok, __res_mailok, __res_ownok were moved
with the script, using --no-new-version, and turned into compat
symbols.  __libc_res_dnok@@GLIBC_PRIVATE and
__libc_res_hnok@@GLIBC_PRIVATE are added for internal use, to avoid
accidentally binding to compatibility symbols.  The new public
symbols res_dnok, res_hnok, res_mailok, res_ownok were added using
make update-all-abi.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move dn_skipname to its own file and into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move dn_skipname to its own file and into libc

And reformat it to GNU style.

dn_skipname is used outside glibc, so do not deprecate it,
and export it as dn_skipname (not __dn_skipname).  Due to internal
users, provide a __libc_dn_skipname alias, and keep __dn_skipname
as a pure compatibility symbol.

__dn_skipname@GLIBC_2.0 was moved using the script, and
dn_skipname@@GLIBC_2.34 was added using make update-all-abi.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move dn_comp to its own file and into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move dn_comp to its own file and into libc

And reformat it to GNU style.

dn_comp is used in various programs, so keep it as a non-deprecated
symbol.  Switch to dn_comp (not __dn_comp) for the ABI name.  There
are no internal users, so interposition is not a problem.

The __dn_comp symbol was moved with scripts/move-symbol-to-libc.py
--no-new-version.  dn_comp@@GLIBC_2.34 was added with
make update-all-abi.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move _getlong, _getshort, __putlong, __putshort to res-putget
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move _getlong, _getshort, __putlong, __putshort to res-putget

And reformat to GNU style.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move dn_expand to its own file and into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move dn_expand to its own file and into libc

And reformat to GNU style.

This switches back to the dn_expand name for the ABI symbol and turns
__dn_expand into a compatibility symbol.  With the improved namespace
management in current glibc, it is no longer necessary to use a
private namespace symbol.  To avoid old code binding to a
GLIBC_PRIVATE symbol by accident, use __libc_dn_expand for the
internal symbol name.

The symbols dn_expand, __dnexpand were moved using
scripts/move-symbol-to-libc.py, followed by an adjustment to make
dn_expand the only GLIBC_2.34 symbol.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move ns_name_compress into its own file and into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move ns_name_compress into its own file and into libc

And reformat to GNU style.

The symbol was moved using scripts/move-symbol-to-libc.py.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move ns_name_pack into its own file and into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move ns_name_pack into its own file and into libc

And reformat to GNU style, and eliminate the labellen function.

The symbol was moved using scripts/move-symbol-to-libc.py.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move ns_name_pton into its own file and into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move ns_name_pton into its own file and into libc

And reformat to GNU style, and eliminate the digits variable.

The symbol was moved using scripts/move-symbol-to-libc.py.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move ns_name_uncompress into its own file and into libc
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move ns_name_uncompress into its own file and into libc

And reformat to GNU style.  Check for negative error returns
(instead of -1).

The symbol was moved using scripts/move-symbol-to-libc.py.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agoresolv: Move ns_name_skip to its own file and into libc (bug 28091)
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Move ns_name_skip to its own file and into libc (bug 28091)

And reformat to GNU style.  Avoid out-of-bounds pointer arithmetic.
This also results in a fix of bug 28091 due to the additional packet
length checks.

The symbol was moved using scripts/move-symbol-to-libc.py.

Reviewed-by: Carlos O'Donell <carlos@systemhalted.org>
4 years agoresolv: Deprecate legacy interfaces in libresolv
Florian Weimer [Mon, 19 Jul 2021 05:55:27 +0000 (07:55 +0200)] 
resolv: Deprecate legacy interfaces in libresolv

Debugging interfaces: p_*, fp_*, and sym_* could conceivably be
used to produce debug out, but these functions have not been
updated to parse more resource records, so they are not very useful
today.  Likewise for ns_sprintrr and ns_sprintrrf.  ns_format_ttl and
ns_parse_ttl are related to these.

Internal implementation details: res_isourserver is probably only
useful in the implementation of a stub resolver, and so is
res_nameinquery.

Unclear semantics and bad performance: ns_samedomain, ns_subdomain,
ns_makecanon, ns_samename do textual converions & copies instead of
checking equivalence of the wire format.

inet_neta cannot handle IPv6 addresses.

res_hostalias has been superseded by getaddrinfo with AI_CANONNAME.
hostalias is not thread-safe.

Some functions have int as size arguments instead of size_t, so they
do not follow current coding practices.  However, dn_expand and
b64_ntop are somewhat widely used (to name just two examples), so
deprecating them seems problematic.

Reviewed-by: Carlos O'Donell <carlos@systemhalted.org>