[PATCH 00/12] getaddrinfo facelift and fixes

Siddhesh Poyarekar siddhesh@sourceware.org
Tue Mar 8 10:07:05 GMT 2022


The gaih_inet implementation, which forms the core of getaddrinfo, is
quite complex in its implementation, making it hard to follow or debug.
Particularly, allocations for gaih_addrtuples to store intermediate
results are particularly hard to track because of the way in which it is
written.

This patchset is an attempt at cleaning up the implementation to make it
much easier to follow.  In the process, it also fixes a couple of bugs,
one that was the trigger for this cleanup and another that was
discovered during the cleanup.

Testing:

The leak reproducer in BZ #28852 could not be converted into a testsuite
test since mtrace isn't able to track the leak, so I separately verified
that it is fixed.  There is a new test for #28931 which tests a variety
of combinations with SUCCESS=merge and SUCCESS=continue.  Further, I
have built and done some smoke testing on Fedora with and without nscd
to ensure that there are no regressions resulting from this patchset.

Finally, I did a scratch build for Fedora and verified that there are no
new regressions on i686, x86_64, s390x, ppc64le and aarch64.

Siddhesh Poyarekar (12):
  Simplify allocations and fix merge and continue actions [BZ #28931]
  gaih_inet: Simplify canon name resolution
  getaddrinfo: Fix leak with AI_ALL [BZ #28852]
  gaih_inet: Simplify service resolution
  gaih_inet: make numeric lookup a separate routine
  gaih_inet: Split simple gethostbyname into its own function
  gaih_inet: Split nscd lookup code into its own function.
  gaih_inet: separate nss lookup loop into its own function
  gaih_inet: make gethosts into a function
  gaih_inet: split loopback lookup into its own function
  gaih_inet: Split result generation into its own function
  gethosts: Return EAI_MEMORY on allocation failure

 nss/Makefile                |    1 +
 nss/tst-nss-gai-actions.c   |  242 ++++++
 sysdeps/posix/getaddrinfo.c | 1518 ++++++++++++++++++-----------------
 3 files changed, 1046 insertions(+), 715 deletions(-)
 create mode 100644 nss/tst-nss-gai-actions.c

-- 
2.35.1



More information about the Libc-alpha mailing list