mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Roland Hieber <rhi@pengutronix.de>
To: ruggero rossi <rugrossi@googlemail.com>
Cc: ptxdist@pengutronix.de
Subject: Re: [ptxdist] Bug in BusyBox 1.37.0 - NTPD Module
Date: Fri, 7 Feb 2025 15:07:27 +0100	[thread overview]
Message-ID: <20250207140727.nnrbnhis26m2l7po@pengutronix.de> (raw)
In-Reply-To: <20250131130605.05ea0372@RR-Laptop>

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.          | 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 |



  reply	other threads:[~2025-02-07 14:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-31 12:06 ruggero rossi
2025-02-07 14:07 ` Roland Hieber [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-01-31 10:15 ruggero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250207140727.nnrbnhis26m2l7po@pengutronix.de \
    --to=rhi@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    --cc=rugrossi@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox