From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id DDFFD385354D; Tue, 6 Sep 2022 16:34:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDFFD385354D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1662482073; bh=f1c760kNYHtZuLAm8RHJYEv/I5GbOd8fuFg3/+e0AkE=; h=From:To:Subject:Date:From; b=Kul0w9Ent/ZtCQSjjiQtY9qaNxFyd3TlQ6Q8uOpU92qNfI7XdJ3FtYf1C9IM/6ODo t4J5cFgfV/eyKAQp6ltROTOAE1GYTLhe/MmdLcPpxcJ90RRikRyyXjR4jBnq0dBL4q iwK5KA/mG6Uq3h6bZRI1+BPSy8WMLXZu59QWNpkE= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc/release/2.36/master] nscd: Fix netlink cache invalidation if epoll is used [BZ #29415] X-Act-Checkin: glibc X-Git-Author: Fabian Vogt X-Git-Refname: refs/heads/release/2.36/master X-Git-Oldrev: b46412fb17e8bfc6c9e1f144bbcf833320c80f8a X-Git-Newrev: c399271c10bd00714504e8d4dfbec8aebf996dd4 Message-Id: <20220906163433.DDFFD385354D@sourceware.org> Date: Tue, 6 Sep 2022 16:34:33 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c399271c10bd00714504e8d4dfbec8aebf996dd4 commit c399271c10bd00714504e8d4dfbec8aebf996dd4 Author: Fabian Vogt Date: Wed Jul 27 11:44:07 2022 +0200 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 (cherry picked from commit 02ca25fef2785974011e9c5beecc99b900b69fd7) Diff: --- NEWS | 1 + nscd/connections.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 10a7613f09..9360596fcc 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,7 @@ Security related changes: The following bugs are resolved with this release: [28846] CMSG_NXTHDR may trigger -Wstrict-overflow warning + [29415] nscd: Fix netlink cache invalidation if epoll is used [29446] _dlopen now ignores dl_caller argument in static mode [29485] Linux: Terminate subprocess on late failure in tst-pidfd [29490] alpha: New __brk_call implementation is broken 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