Re: [PATCH 1/7] x86/vdso: Respect COMPAT_32BIT_TIME

Arnd Bergmann
2026-04-13T16:58:30Z

On Mon, Apr 13, 2026, at 18:13, Thomas Weißschuh wrote:
> 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:
>
>> > * 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.

Ok, that's fine then.

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

We discussed this during the original y2038 work and decided
at the time to not have those warnings for syscalls. We could
bring that back, but I think I would want one level of abstraction
there and control this using a global Kconfig switch for all
syscalls as well as ioctl commands that could use such a check.

Arnd