From da346ff8a8d0d305f35684f2196580aec15d9a69 Mon Sep 17 00:00:00 2001 From: Arjun Shankar Date: Tue, 9 Jan 2024 19:51:08 +0100 Subject: [PATCH] getaddrinfo: Return correct error EAI_MEMORY when out-of-memory (RHEL-19444) Resolves: RHEL-19444 --- glibc-RHEL-19444.patch | 29 +++++++++++++++++++++++++++++ glibc.spec | 6 +++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 glibc-RHEL-19444.patch diff --git a/glibc-RHEL-19444.patch b/glibc-RHEL-19444.patch new file mode 100644 index 0000000..2c03560 --- /dev/null +++ b/glibc-RHEL-19444.patch @@ -0,0 +1,29 @@ +commit 5eabdb6a6ac1599d23dd5966a37417215950245f +Author: Andreas Schwab +Date: Wed Dec 6 14:48:22 2023 +0100 + + getaddrinfo: translate ENOMEM to EAI_MEMORY (bug 31163) + + When __resolv_context_get returns NULL due to out of memory, translate it + to a return value of EAI_MEMORY. + +diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c +index 321a6679d46494a3..8fe879c5420337a4 100644 +--- a/sysdeps/posix/getaddrinfo.c ++++ b/sysdeps/posix/getaddrinfo.c +@@ -615,7 +615,14 @@ get_nss_addresses (const char *name, const struct addrinfo *req, + function variant. */ + res_ctx = __resolv_context_get (); + if (res_ctx == NULL) +- no_more = 1; ++ { ++ if (errno == ENOMEM) ++ { ++ result = -EAI_MEMORY; ++ goto out; ++ } ++ no_more = 1; ++ } + + while (!no_more) + { diff --git a/glibc.spec b/glibc.spec index 64c4a9f..bf6d66d 100644 --- a/glibc.spec +++ b/glibc.spec @@ -155,7 +155,7 @@ end \ Summary: The GNU libc libraries Name: glibc Version: %{glibcversion} -Release: 98%{?dist} +Release: 99%{?dist} # In general, GPLv2+ is used by programs, LGPLv2+ is used for # libraries. @@ -806,6 +806,7 @@ Patch569: glibc-RHEL-16643-3.patch Patch570: glibc-RHEL-16643-4.patch Patch571: glibc-RHEL-16643-5.patch Patch572: glibc-RHEL-16643-6.patch +Patch573: glibc-RHEL-19444.patch ############################################################################## # Continued list of core "glibc" package information: @@ -2964,6 +2965,9 @@ update_gconv_modules_cache () %endif %changelog +* Tue Jan 09 2024 Arjun Shankar - 2.34-99 +- getaddrinfo: Return correct error EAI_MEMORY when out-of-memory (RHEL-19444) + * Mon Jan 8 2024 Arjun Shankar - 2.34-98 - getaddrinfo: Fix occasionally empty result due to nscd cache order (RHEL-16643)