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: <https://git.busybox.net/busybox/commit/?id=85acf71d2579ebe4eec05c6f31901ad> 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. | [email protected] | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
