From c561de7c3a2db81377500e8f9d49983f4a1a32d69a9e0522782d85e7d17a35ac Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Wed, 31 Aug 2022 07:58:47 +0000 Subject: [PATCH] Accepting request 1000398 from home:Andreas_Schwab:Factory - nscd-netlink-cache-invalidation.patch: nscd: Fix netlink cache invalidation if epoll is used (boo#1199964, BZ #29415) OBS-URL: https://build.opensuse.org/request/show/1000398 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=626 --- glibc.changes | 6 ++++ glibc.spec | 9 ++++-- nscd-netlink-cache-invalidation.patch | 45 +++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 nscd-netlink-cache-invalidation.patch diff --git a/glibc.changes b/glibc.changes index 47626d7..169fd86 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Aug 24 09:29:02 UTC 2022 - Fabian Vogt + +- nscd-netlink-cache-invalidation.patch: nscd: Fix netlink cache + invalidation if epoll is used (boo#1199964, BZ #29415) + ------------------------------------------------------------------- Mon Aug 15 09:21:34 UTC 2022 - Andreas Schwab diff --git a/glibc.spec b/glibc.spec index 9b70dd7..feb29d0 100644 --- a/glibc.spec +++ b/glibc.spec @@ -279,12 +279,14 @@ Patch306: glibc-fix-double-loopback.diff ### # Patches from upstream ### -# PATCH-FIX-OPENSUSE glibcextract.py: Add compile_c_snippet +# PATCH-FIX-UPSTREAM glibcextract.py: Add compile_c_snippet Patch1000: glibcextract-compile-c-snippet.patch -# PATCH-FIX-OPENSUSE linux: Mimic kernel definition for BLOCK_SIZE +# PATCH-FIX-UPSTREAM linux: Mimic kernel definition for BLOCK_SIZE Patch1001: sys-mount-kernel-definition.patch -# PATCH-FIX-OPENSUSE linux: Fix sys/mount.h usage with kernel headers +# PATCH-FIX-UPSTREAM linux: Fix sys/mount.h usage with kernel headers Patch1002: sys-mount-usage.patch +# PATCH-FIX-UPSTREAM nscd: Fix netlink cache invalidation if epoll is used (BZ #29415) +Patch1003: nscd-netlink-cache-invalidation.patch ### # Patches awaiting upstream approval @@ -512,6 +514,7 @@ library in a cross compilation setting. %patch1000 -p1 %patch1001 -p1 %patch1002 -p1 +%patch1003 -p1 %endif %patch2000 -p1 diff --git a/nscd-netlink-cache-invalidation.patch b/nscd-netlink-cache-invalidation.patch new file mode 100644 index 0000000..1162398 --- /dev/null +++ b/nscd-netlink-cache-invalidation.patch @@ -0,0 +1,45 @@ +From 02ca25fef2785974011e9c5beecc99b900b69fd7 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +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. + +Signed-off-by: Fabian Vogt +--- + 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.37.2 +