Thread (1 message) 1 message, 1 author, 2025-10-07

Re: [PATCH 1/7] tools/nolibc: remove __nolibc_enosys() fallback from time64-related functions

From: "Arnd Bergmann" <arnd@arndb.de>
Date: 2025-10-07 10:03:59
Also in: linux-arch, linux-arm-kernel, linux-kselftest, lkml

On Mon, Oct 6, 2025, at 22:14, Thomas Weißschuh wrote:
On 2025-10-01 09:43:37+0200, Arnd Bergmann wrote:
quoted
On Thu, Aug 21, 2025, at 17:40, Thomas Weißschuh wrote:
 - the old types are often too short, both for the y2038
   overflow and for the file system types.
So far this was not something we actively tried to support,
especially with the restriction mentioned below.
quoted
I suspect the problem is that the kernel's uapi/linux/time.h
still defines the old types as the default, and nolibc
historically just picks it up from there.
So far we have tried to keep nolibc compatible with the kernel UAPI when
included in any order. This forced us to use 'struct timespec' from
uapi/linux/time.h. With the upcoming implementation of signals in nolibc
this guideline is relaxed a bit, so we should be able to use our own
always-64-bit 'struct timespec'.
You can probably either "#define timespec __kernel_timespec" or
"#define __kernel_timespec timespec" before including
linux/time_types.h.

Note that there is no time64 variant of "struct timeval", so
any syscall that needs this has to be implemented in userspace
as a wrapper around the timespec based one, e.g. gettimeofday()
needs to call clock_gettime() on all 32-bit systems.
quoted
We should also consider drop the
legacy type definitions from uapi/linux/time.h and
require each libc to define their own.
Can we even just drop them? Or should they also get some backwards
compat guards?
This is the big question, and we kind of left this one open
to be decided later when we finished the actual binary interface.

I think simply dropping the old definition is one of several
options we have, because that does not change the ABI in an
incompatible way and just requires the few user space sources
that use this to either require old kernel headers or make
simple source-level changes that they should have done for
portability anyway.

I see multiple decisions we have to make in that option space
once we decide to do anything:

- do we change the headers for both 32-bit and 64-bit userspace
  for consistency, or only for 32-bit userspace to limit
  the impact to those users that care about 32-bit?

- do we remove only the type definitions (timespec, timeval,
  itimerspec, itimerval, timex) or also the syscall macros
  for the time32 syscalls using them?

- What method (if any) would be used to choose between the
  time32 definitions, the time64 definitions or none of them
  when including the kernel headers?

      Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help