Re: [PATCH 1/7] x86/vdso: Respect COMPAT_32BIT_TIME
From: Thomas Weißschuh
Date: Mon Apr 13 2026 - 12:28:51 EST
On Mon, Apr 13, 2026 at 05:59:52PM +0200, Arnd Bergmann wrote:
> On Fri, Apr 10, 2026, at 09:24, Thomas Weißschuh wrote:
(...)
> > Recap/Proposal:
(...)
> > * Always provide settimeofday(). If CONFIG_COMPAT_32BIT_TIME is *not*
> > set, reject passing any 'tv' argument where it may not be y2038 safe.
>
> This sounds wrong to me now: the case I'm worried about is a 32-bit
> system calling settimeofday() based on the value of an RTC or NTP.
> The idea of CONFIG_COMPAT_32BIT_TIME=n is to catch this by causing
> an intentional ENOSYS error even for valid times, so it doesn't
> suddenly start breaking in 2038.
This is what I meant with "where it *may*" be not y2038 safe.
Even if the value fits, the call would be rejected.
My wording was crappy indeed, though.
In code:
if (tv && !IS_ENABLED(CONFIG_COMPAT_32BIT_TIME) && sizeof(tv->tv_sec) < 8) {
pr_warn_once(...);
return -EINVAL;
}
Or maybe drop the EINVAL but still emit a warning. That warning would be
useful for gettimeofday(), too.
Thomas