From patchwork Tue Oct 25 19:54:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zev Weiss X-Patchwork-Id: 59416 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9402E3857417 for ; Tue, 25 Oct 2022 19:55:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9402E3857417 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666727718; bh=TGhIfUGkzBmtqXVEpitCC+EUA3tub66znO2P6Rt+Umc=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=q2sYzML5pKncVuc5R1D4Ftvb2uO2JYpam1TmE/1BsnXbR6NZ4qOP8B2tx7coTeJ9z 6jfXRsr0IH8b4hOqGQ4xuxViObBmseKH1we71fCadExnZBo4ZDDBpUOb3f9mHxFnHs vsryi+/q1Bf4LqtNzH+zKbxYxTPxxGZpr2J31aIQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from thorn.bewilderbeest.net (thorn.bewilderbeest.net [IPv6:2605:2700:0:5::4713:9cab]) by sourceware.org (Postfix) with ESMTPS id 01F363858019 for ; Tue, 25 Oct 2022 19:54:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 01F363858019 Received: from hatter.bewilderbeest.net (97-113-250-99.tukw.qwest.net [97.113.250.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: zev) by thorn.bewilderbeest.net (Postfix) with ESMTPSA id 7943D32E; Tue, 25 Oct 2022 12:54:52 -0700 (PDT) Date: Tue, 25 Oct 2022 12:54:51 -0700 To: libc-alpha@sourceware.org Subject: nscd time_t size mismatch problem Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Zev Weiss via Libc-alpha From: Zev Weiss Reply-To: Zev Weiss Cc: openbmc@lists.ozlabs.org, Wayne Tung Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Hello glibc devs, We've recently been seeing some misbehavior from nscd in OpenBMC. It manifests as lots of log messages like: disabled inotify-based monitoring for file /passwd': No such file or directory stat failed for file /passwd'; will try again later: No such file or directory disabled inotify-based monitoring for file /group': No such file or directory stat failed for file /group'; will try again later: No such file or directory disabled inotify-based monitoring for file /hosts': No such file or directory stat failed for file /hosts'; will try again later: No such file or directory disabled inotify-based monitoring for file /resolv.conf': No such file or directory stat failed for file /resolv.conf'; will try again later: No such file or directory and so forth. I initially assumed it was a configure-time --sysconfdir mixup, but after digging into it I found that it actually stems from a time_t size mismatch (this is a 32-bit ARM gnueabi target): $ gdb -batch -ex 'pt time_t' -ex 'p sizeof(time_t)' time/time.o type = long $1 = 4 $ gdb -batch -ex 'pt time_t' -ex 'p sizeof(time_t)' nscd/nscd.o type = long long $1 = 8 The confusing log messages are thus just the result of the coincidence that sizeof(long long) - sizeof(long) == strlen("/etc"), which causes the disagreement in the layout of struct traced_file to make it look like the 'fname' member just had its directory prefix chopped off. In the discussion of the bug in the OpenBMC issue tracker [0], Wayne Tung (CCed) came up with the patch below, which does seem to solve the immediate problem, but if I'm understanding things right does so by just reverting nscd to a 32-bit time_t, and so I'd expect probably wouldn't be considered the "right" fix -- however I don't presently know enough about the 32/64-bit time_t transition and ensuing compatibility concerns to know what the right fix really is. Should nscd perhaps be using __time64_t or something instead of time_t? Thanks, Zev Weiss [0] https://github.com/openbmc/openbmc/issues/3881 From 0fda9faf757abd4f5469e6d9207499e97f79a663 Mon Sep 17 00:00:00 2001 From: Wayne Tung Date: Thu, 13 Oct 2022 13:10:21 +0800 Subject: [PATCH] Use 32 bits time_t for ncsd --- Makeconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- diff --git a/Makeconfig b/Makeconfig index 47db08d6ae..f78f7cc74a 100644 --- a/Makeconfig +++ b/Makeconfig @@ -869,7 +869,7 @@ endif +extra-math-flags = $(if $(filter libm,$(in-module)),-fno-math-errno,-fmath-errno) # Use 64 bit time_t support for installed programs -installed-modules = nonlib nscd lddlibc4 ldconfig locale_programs \ +installed-modules = nonlib lddlibc4 ldconfig locale_programs \ iconvprogs libnss_files libnss_compat libnss_db libnss_hesiod \ libutil libpcprofile libSegFault +extra-time-flags = $(if $(filter $(installed-modules),\