From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 07 Feb 2025 15:07:36 +0100 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tgP15-009f9f-1k for lore@lore.pengutronix.de; Fri, 07 Feb 2025 15:07:36 +0100 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1tgP16-0003kz-1G; Fri, 07 Feb 2025 15:07:36 +0100 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tgP0x-0003kU-Fp; Fri, 07 Feb 2025 15:07:27 +0100 Received: from pty.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::c5]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tgP0x-003zCm-0W; Fri, 07 Feb 2025 15:07:27 +0100 Received: from rhi by pty.whiteo.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1tgP0x-001iNz-0C; Fri, 07 Feb 2025 15:07:27 +0100 Date: Fri, 7 Feb 2025 15:07:27 +0100 From: Roland Hieber To: ruggero rossi Message-ID: <20250207140727.nnrbnhis26m2l7po@pengutronix.de> References: <20250131130605.05ea0372@RR-Laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20250131130605.05ea0372@RR-Laptop> Subject: Re: [ptxdist] Bug in BusyBox 1.37.0 - NTPD Module X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Cc: ptxdist@pengutronix.de Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false Hi, On Fri, Jan 31, 2025 at 01:06:05PM +0100, ruggero rossi wrote: > HHello everyone, > > My BSP still uses an older version of Linux and libc with a 32-bit time_t. > > While migrating to ptxdist-2025.01.0, I encountered an unexpected crash in > the ntpd service. Specifically, when the BSP acts as an ntpd server, the > crash occurs on the client side. > > After investigating the issue, I believe I have identified a bug. On my > system, time_t is effectively an int32_t. In the function that converts a > double to the NTP time format, I found the following code: > > double d; > uint32_t intl; > intl = (uint32_t)(time_t)d; > > Here, the integer part of d represents the number of seconds since > 1900-01-01T00:00:00.0, which exceeds 31 bits. > > Casting d to time_t in the server truncates the value to 0x7fffffff, > leading to a crash in the client. > > The solution is to avoid the cast to time_t when sizeof(time_t) == 4. > > I have attached a proposed patch for this issue. If someone with more > authority in the project could report this upstream, that would be > appreciated. I don't see any patches in PTXdist that could interfere, so I think it's an upstream issue. The code in question was refactored in 2023: I think now that you debugged this issue, you now have the most knowledge about it of all of us here … :) So I would suggest that you send the same message to the busybox list: https://www.busybox.net/lists.html Getting the issue solved upstream is the most ideal solution for all users of busybox, and PTXdist will pick it up when a fix is released in busybox. What is with the other 5 patches you sent? Are these somehow related? 0002-meson-dont-build-blkzone-if-blkzoned.h-is-not-available.patch 0003-meson-dont-build-blkpr-if-pr.h-is-not-available.patch 0004-meson-dont-build-lsfd-if-kcmp.h-is-not-available.patch 0005-meson-dont-build-mkfds-if-SIOCGSKNS-is-not-available.patch util-linux.make.patch - Roland -- Roland Hieber, Pengutronix e.K. | rhi@pengutronix.de | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |