[RFC PATCH 0/4] Running on CONFIG_COMPAT_32BIT_TIME=n kernels

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Wed Nov 11 12:08:54 GMT 2026



On 10/11/26 11:51, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> I discussed this topic with Florian a few weeks ago in Prague, as current
> glibc does not support kernels built without COMPAT_32BIT_TIME, which
> is an important configuration for running 32-bit userspace on embedded
> systems that need to support running beyond 2038 and may have limited
> opportunities for software updates until then: By turning off all time32
> syscalls in the kernel, we can turn a large set of future bugs into
> immediate failures that are hopefully easier to debug.
> 
> I had a look at the current glibc implementation and found that this
> almost works already: architectures with __TIMESIZE==64 redirect
> internal syscall invocations to the time64 versions, and the others
> do this for most syscalls when __ASSUME_TIME64_SYSCALLS is set.
> 
> The missing bit is mainly system calls that have an optional timespec
> argument and are called with a NULL pointer in its place. I tried
> to find all instances of those and change the logic so we always use
> the time64 version for __ASSUME_TIME64_SYSCALLS builds as well,
> i.e. --enable-kernel=5.1 or higher. Since this makes __TIMESIZE==64
> and __TIMESIZE==32 builds more similar, I managed to end up with
> a net code size reduction. __TIMESIZE==64 builds should not behave
> in any other way from before, for both __WORDSIZE=64 and
> __WORDSIZE=32. __TIMESIZE==32 builds for pre-5.1 kernels are equally
> unchanged, while __ASSUME_TIME64_SYSCALLS will now work with or
> without CONFIG_COMPAT_32BIT_TIME.
> 
> The series has not seen any testing so far and is only an RFC to
> see if my approach can find consensus. If this is acceptable,
> I'd properly test it to see that this actually works with
> CONFIG_COMPAT_32BIT_TIME=n on a full system.

I think we should close the missing spots where __ASSUME_TIME64_SYSCALLS
is not always using 64 bit time_t syscall. We already do this for newer
ABI like risc32, but since COMPAT_32BIT_TIME=n is not enforced we haven't
closed this for old ABIs.

The patches have some issue though, I replied with my findings. I also
fixed all them [1] and checked on a x86_64 kernel built with
CONFIG_COMPAT_32BIT_TIME=n and i686 shows no regression when built with
--enable-kernel=5.1.

I will probably check armhf as well (although on an aarch64 kernel and
maybe on qemu as well).

[1] https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/azanella/arnd-time64

> 
>      Arnd
> 
> Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> Cc: "Carlos O'Donell" <carlos@redhat.com>
> Cc: Florian Weimer <fweimer@redhat.com>
> Cc: Lukasz Majewski <lukma@nabladev.com>
> Cc: libc-alpha@sourceware.org
> 
> Arnd Bergmann (4):
>   nptl: use futex_time64 for lll_futex_syscall() if possible
>   support: test futex_time64 syscall instead of time32 one
>   linux: consistently use time64 syscalls if available
>   linux: remove time64 redirects for __TIMESIZE=64 architectures
> 
>  support/support_mutex_pi_monotonic.c          | 11 ++++++---
>  sysdeps/nptl/futex-internal.h                 |  6 +----
>  sysdeps/nptl/lowlevellock-futex.h             | 15 ++++++++----
>  sysdeps/unix/sysv/linux/arc/sysdep.h          | 19 ---------------
>  sysdeps/unix/sysv/linux/i386/tst-bz21269.c    |  4 ++++
>  sysdeps/unix/sysv/linux/kernel-features.h     |  4 ++--
>  sysdeps/unix/sysv/linux/loongarch/sysdep.h    | 12 ----------
>  sysdeps/unix/sysv/linux/not-cancel.h          |  4 ++++
>  sysdeps/unix/sysv/linux/or1k/sysdep.h         | 17 --------------
>  sysdeps/unix/sysv/linux/pause.c               |  2 ++
>  sysdeps/unix/sysv/linux/poll.c                | 12 ++++++++++
>  sysdeps/unix/sysv/linux/riscv/sysdep.h        | 23 -------------------
>  sysdeps/unix/sysv/linux/tst-clone3-internal.c |  6 ++---
>  sysdeps/unix/sysv/linux/tst-clone3.c          |  6 ++---
>  14 files changed, 50 insertions(+), 91 deletions(-)
> 



More information about the Libc-alpha mailing list