backport patches from upstream

(cherry picked from commit e6532c26154a7a6b382fb0478488b7722a4aa592)
This commit is contained in:
zhang-hao-jon 2023-04-11 22:00:22 +08:00 committed by openeuler-sync-bot
parent ce1136537e
commit f5607f879f
4 changed files with 178 additions and 1 deletions

View File

@ -0,0 +1,48 @@
From 02ca25fef2785974011e9c5beecc99b900b69fd7 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.de>
Date: Wed, 27 Jul 2022 11:44:07 +0200
Subject: [PATCH] nscd: Fix netlink cache invalidation if epoll is used [BZ
#29415]
Processes cache network interface information such as whether IPv4 or IPv6
are enabled. This is only checked again if the "netlink timestamp" provided
by nscd changed, which is triggered by netlink socket activity.
However, in the epoll handler for the netlink socket, it was missed to
assign the new timestamp to the nscd database. The handler for plain poll
did that properly, copy that over.
This bug caused that e.g. processes which started before network
configuration got unusuable addresses from getaddrinfo, like IPv6 only even
though only IPv4 is available:
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1041
It's a bit hard to reproduce, so I verified this by checking the timestamp
on calls to __check_pf manually. Without this patch it's stuck at 1, now
it's increasing on network changes as expected.
Conflict: NA
Reference:https://sourceware.org/git/?p=glibc.git;a=commit;h=02ca25fef2785974011e9c5beecc99b900b69fd7
Signed-off-by: Fabian Vogt <fvogt@suse.de>
---
nscd/connections.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/nscd/connections.c b/nscd/connections.c
index 61d1674eb4..531d2e83df 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -2284,7 +2284,8 @@ main_loop_epoll (int efd)
sizeof (buf))) != -1)
;
- __bump_nl_timestamp ();
+ dbs[hstdb].head->extra_data[NSCD_HST_IDX_CONF_TIMESTAMP]
+ = __bump_nl_timestamp ();
}
# endif
else
--
2.27.0

View File

@ -0,0 +1,58 @@
From 32b599ac8c21c4c332cc3900a792a1395bca79c7 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Tue, 30 Aug 2022 10:02:49 +0200
Subject: [PATCH] nss_dns: In gaih_getanswer_slice, skip strange aliases (bug
12154)
If the name is not a host name, skip adding it to the result, instead
of reporting query failure. This fixes bug 12154 for getaddrinfo.
This commit still keeps the old parsing code, and only adjusts when
a host name is copied.
Conflict: NA
Reference: https://sourceware.org/git/?p=glibc.git;a=commit;h=32b599ac8c21c4c332cc3900a792a1395bca79c7
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
---
resolv/nss_dns/dns-host.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index b887e77e9c..bea505d697 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -970,12 +970,12 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
n = -1;
}
- if (__glibc_unlikely (n < 0 || __libc_res_hnok (buffer) == 0))
+ if (__glibc_unlikely (n < 0))
{
++had_error;
continue;
}
- if (*firstp && canon == NULL)
+ if (*firstp && canon == NULL && __libc_res_hnok (buffer))
{
h_name = buffer;
buffer += h_namelen;
@@ -1021,14 +1021,14 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
n = __libc_dn_expand (answer->buf, end_of_message, cp,
tbuf, sizeof tbuf);
- if (__glibc_unlikely (n < 0 || __libc_res_hnok (tbuf) == 0))
+ if (__glibc_unlikely (n < 0))
{
++had_error;
continue;
}
cp += n;
- if (*firstp)
+ if (*firstp && __libc_res_hnok (tbuf))
{
/* Reclaim buffer space. */
if (h_name + h_namelen == buffer)
--
2.23.0

View File

@ -0,0 +1,63 @@
From 6128e82ebe973163d2dd614d31753c88c0c4d645 Mon Sep 17 00:00:00 2001
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Date: Wed, 21 Sep 2022 10:51:07 -0300
Subject: [PATCH] sunrpc: Suppress GCC -Os warning on user2netname
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
GCC with -Os warns that sprint might overflow:
netname.c: In function user2netname:
netname.c:51:28: error: %s directive writing up to 255 bytes into a
region of size between 239 and 249 [-Werror=format-overflow=]
51 | sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
| ^~ ~~~~~~~
netname.c:51:3: note: sprintf output between 8 and 273 bytes into a
destination of size 256
51 | sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
However the code does test prior the sprintf call that dfltdom plus
the required extra space for OPSYS, uid, and extra character will not
overflow and return 0 instead.
Checked on x86_64-linux-gnu and i686-linux-gnu.
Conflict: NA
Reference: https://sourceware.org/git/?p=glibc.git;a=patch;h=6128e82ebe973163d2dd614d31753c88c0c4d645
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
---
sunrpc/netname.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index bf7f0b81c4..c1d1c43e50 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -20,6 +20,7 @@
#include <string.h>
#include <rpc/rpc.h>
#include <shlib-compat.h>
+#include <libc-diag.h>
#include "nsswitch.h"
@@ -48,7 +49,12 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
if ((strlen (dfltdom) + OPSYS_LEN + 3 + MAXIPRINT) > (size_t) MAXNETNAMELEN)
return 0;
+ /* GCC with -Os warns that sprint might overflow while handling dfltdom,
+ however the above test does check if an overflow would happen. */
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wformat-overflow");
sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
+ DIAG_POP_NEEDS_COMMENT;
i = strlen (netname);
if (netname[i - 1] == '.')
netname[i - 1] = '\0';
--
2.23.0

View File

@ -66,7 +66,7 @@
############################################################################## ##############################################################################
Name: glibc Name: glibc
Version: 2.34 Version: 2.34
Release: 115 Release: 116
Summary: The GNU libc libraries Summary: The GNU libc libraries
License: %{all_license} License: %{all_license}
URL: http://www.gnu.org/software/glibc/ URL: http://www.gnu.org/software/glibc/
@ -252,6 +252,9 @@ Patch164: backport-stdlib-Undo-post-review-change-to-16adc58e73f3-BZ-27.patch
patch165: backport-gmon-improve-mcount-overflow-handling-BZ-27576.patch patch165: backport-gmon-improve-mcount-overflow-handling-BZ-27576.patch
Patch166: backport-gmon-fix-memory-corruption-issues-BZ-30101.patch Patch166: backport-gmon-fix-memory-corruption-issues-BZ-30101.patch
Patch167: backport-posix-Fix-system-blocks-SIGCHLD-erroneously-BZ-30163.patch Patch167: backport-posix-Fix-system-blocks-SIGCHLD-erroneously-BZ-30163.patch
Patch168: backport-nscd-Fix-netlink-cache-invalidation-if-epoll-is-used.patch
Patch169: backport-nss_dns-In-gaih_getanswer_slice-skip-strange-aliases-bug-12154.patch
Patch170: backport-sunrpc-Suppress-GCC-Os-warning-on-user2netname.patch
Patch9000: turn-default-value-of-x86_rep_stosb_threshold_form_2K_to_1M.patch Patch9000: turn-default-value-of-x86_rep_stosb_threshold_form_2K_to_1M.patch
Patch9001: delete-no-hard-link-to-avoid-all_language-package-to.patch Patch9001: delete-no-hard-link-to-avoid-all_language-package-to.patch
@ -1458,6 +1461,11 @@ fi
%endif %endif
%changelog %changelog
* Tue Apr 11 2023 zhanghao <zhanghao383@huawei.com> - 2.34-116
- nscd: Fix netlink cache invalidation if epoll is used [BZ #29415]
- nss_dns: In gaih_getanswer_slice, skip strange aliases (bug 12154)
- sunrpc: Suppress GCC -Os warning on user2netname
* Mon Mar 27 2023 shixuantong <shixuantong1@huawei.com> - 2.34-115 * Mon Mar 27 2023 shixuantong <shixuantong1@huawei.com> - 2.34-115
- Avoid use of atoi in some places in libc - Avoid use of atoi in some places in libc
- stdlib: Undo post review change to 16adc58e73f3 - stdlib: Undo post review change to 16adc58e73f3