From: Peter Korsgaard <peter@korsgaard.com>
To: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>,
Buildroot List <buildroot@buildroot.org>
Subject: Re: [Buildroot] [PATCH] Config.in: introduce BR2_TIME_BITS_64 option for Y2038 compatibility
Date: Thu, 13 Oct 2022 10:27:47 +0200 [thread overview]
Message-ID: <87h708nn5o.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <20221012215008.2918444-1-thomas.petazzoni@bootlin.com> (Thomas Petazzoni's message of "Wed, 12 Oct 2022 23:50:08 +0200")
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:
> Y2038 is now almost only 15 years away, and embedded systems built
> today are potentially going to still be operational in 15 years, and
> even though they are supposed to receive updates by then, we all know
> how things go, and potentially some of these embedded systems will not
> receive any update.
Thanks for picking this up! This has been on my todo list for a while as well!.
> In 2038, the signed 32-bit representation of time_t used on 32-bit
> architectures will overflow, causing all time-related functions to go
> back in time in a surprising way.
> The Linux kernel has already been modified to support a 64-bit
> representation of time_t on 32-bit architectures, but from a C library
> perspective, the situation varies:
> - glibc uses this 64-bit time_t representation on 32-bit systems
> since glibc 2.34, but only if -D_TIME_BITS=64 is
> specified. Therefore, this commit adds an option to add this flag
> globally to the build, when glibc is the C library and the
> architecture is not 64-bit.
> - musl uses unconditionally a 64-bit time_t representation on 32-bit
> systems since musl 1.2.0. So there is nothing to do here since
> Buildroot has been using a musl >= 1.2.0, used since Buildroot
> 2020.05. No Buildroot option is needed here.
> - uClibc-ng does not support a 64-bit time_t representation on 32-bit
> systems, so systems using uClibc-ng will not be Y2038 compliant, at
> least for now. No Buildroot option is needed here.
> It should be noted that being Y2038-compliant will only work if all
> application/library code is correct. For example if an
> application/library stores a timestamp in an "int" instead of using
> the proper time_t type, then the mechanisms described above will not
> fix this, and the application/library will continue to be broken in
> terms of Y2038 support.
> Possible discussions points about this patch:
> - Should we have an option at all, or should we unconditionally pass
> -D_TIME_BITS=64, like we have been doing for _FILE_OFFSET_BITS=64
> for quite some time. The reasoning for having an option is that
> the mechanism is itself opt-in in glibc, and generally relatively
> new, so it seemed logical for now to make it optional as well in
> Buildroot.
I was hoping we could just do it unconditionally, given that musl does
it already.
Failing that, I would think we could at least make it default y.
> - Should we show something (a Config.in comment?) in the musl and
> uClibc-ng case to let the user know that the code is Y2038
> compliant (musl) or not Y2038 compliant (uClibc-ng). Or should this
> discussion be part of the Buildroot documentation?
Having a notice about this in the documentation certainly cannot
harm. I'm not sure it makes sense to have it in Config.in.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2022-10-13 8:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-12 21:50 [Buildroot] [PATCH] Config.in: introduce BR2_TIME_BITS_64 option for Y2038 compatibility Thomas Petazzoni via buildroot
2022-10-12 23:49 ` Robert Hancock via buildroot
2022-10-13 14:39 ` Thomas Petazzoni via buildroot
2023-02-06 20:25 ` Romain Naour
2023-02-06 22:06 ` Romain Naour
2022-10-13 8:27 ` Peter Korsgaard [this message]
2023-10-01 19:15 ` Thomas Petazzoni via buildroot
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=87h708nn5o.fsf@dell.be.48ers.dk \
--to=peter@korsgaard.com \
--cc=buildroot@buildroot.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=yann.morin.1998@free.fr \
/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