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

Arnd Bergmann arnd@kernel.org
Tue Nov 10 14:51:42 GMT 2026


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.

     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(-)

-- 
2.53.0



More information about the Libc-alpha mailing list