[PATCH v2 0/5] Running on CONFIG_COMPAT_32BIT_TIME=n kernels

Arnd Bergmann arnd@kernel.org
Mon Nov 16 12:08:52 GMT 2026


From: Arnd Bergmann <arnd@arndb.de>

This is an updated series from my RFC version [1], to make it possible
to run on Linux kernels with CONFIG_COMPAT_32BIT_TIME disabled.

Current glibc does not support kernels configured this way, 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.

Adhemerval and I had both incorporated feedback for the RFC version,
but I ended up just using his changes in the end to make sure
I get the right coding style. Adhemerval also tested this successfully
on i386 with CONFIG_COMPAT_32BIT_TIME=n, but it still needs testing
on arm.

Thanks for the feedback and fixes!

Changes since the RFC/v1:
 - fix support_mutex_pi_monotonic() on architectures without
   __NR_futex_time64 [Adhemerval]
 - fix nptl on architectures without __NR_futex [Adhemerval]
 - don't rely on __ASSUME_TIME64_SYSCALLS in files where this
   is not defined [Adhemerval]
 - Add documentation patch [Adhemerval]
 - fix one more instance of direct __NR_futex usage [Adhemerval]
 - Typos [Andreas, Adhemerval]
 - Coding style [Paul, Adhemerval]

     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

Link: https://sourceware.org/pipermail/libc-alpha/2026-November/181986.html

Adhemerval Zanella (1):
  manual: Document --enable-kernel=5.1 for CONFIG_COMPAT_32BIT_TIME=n

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

 INSTALL                                       |  5 ++++
 NEWS                                          |  6 ++++-
 manual/install.texi                           |  5 ++++
 nptl/pthread_mutex_lock.c                     |  5 ----
 nptl/pthread_mutex_timedlock.c                |  5 ----
 nptl/pthread_mutex_trylock.c                  | 14 ++++-------
 nptl/pthread_mutex_unlock.c                   |  5 ----
 support/support_mutex_pi_monotonic.c          | 10 +++++---
 sysdeps/nptl/futex-internal.h                 |  8 ++-----
 sysdeps/nptl/lowlevellock-futex.h             | 22 ++++++++++++------
 sysdeps/unix/sysv/linux/arc/sysdep.h          | 19 ---------------
 sysdeps/unix/sysv/linux/i386/tst-bz21269.c    |  6 +++++
 sysdeps/unix/sysv/linux/loongarch/sysdep.h    | 12 ----------
 sysdeps/unix/sysv/linux/not-cancel.h          |  4 ++++
 sysdeps/unix/sysv/linux/or1k/sysdep.h         | 20 ++--------------
 sysdeps/unix/sysv/linux/pause.c               |  2 ++
 sysdeps/unix/sysv/linux/poll.c                | 13 +++++++++++
 sysdeps/unix/sysv/linux/riscv/sysdep.h        | 23 -------------------
 sysdeps/unix/sysv/linux/tst-clone3-internal.c |  7 +++---
 sysdeps/unix/sysv/linux/tst-clone3.c          |  7 +++---
 20 files changed, 78 insertions(+), 120 deletions(-)

-- 
2.53.0



More information about the Libc-alpha mailing list