Fwd: Fifth draft of the Y2038 design document
Arnd Bergmann
arnd@arndb.de
Thu Mar 2 09:37:00 GMT 2017
On Thu, Mar 2, 2017 at 3:04 AM, Joseph Myers <joseph@codesourcery.com> wrote:
> On Thu, 2 Mar 2017, Zack Weinberg wrote:
>> Yes, lots of ifdefs, but I reiterate that I am not convinced any
>> alternative is even _possible_. To fall back to clock_gettime (the
>> system call) at runtime, when clock_gettime64 (again, the system call)
>> fails with ENOSYS, would require copying arguments. That's not a
>> problem for clock_gettime, but it *is* potentially a problem for
>> ioctl, sendmsg, etc. Witness the sendmsg-socklen_t-vs-size_t patches
>> that had to be scrapped.
>
> I don't expect glibc to copy for sendmsg or ioctl; there, I expect that
> (given new enough kernel headers) _TIME_BITS=64 would result in different
> constants being passed to the syscalls which then might fail in the
> absence of kernel support.
Yes, that is the plan for the kernel side. One rare exception involves
interfaces that are defined in headers copied from the kernel into
applications instead of having them included from /usr/include/linux/.
So far we have found two of them, and we will have to fix the applications.
> I do expect the functions that use times internally but not in their
> interface to be able to be changed to use 64-bit-time interfaces
> unconditionally, and for this to work on an old kernel. (Whether this is
> needed for calls to e.g. __xstat64 if times aren't actually used from the
> resulting structure would depend on what __xstat64 does with too-large
> timestamps; if the kernel saturates them, a change may not strictly be
> needed, but if EOVERFLOW errors occur then a change would be needed. And
> given the desire to support kernels with 32-bit-time syscalls disabled, a
> change to such calls is probably desirable in any case.)
The idea for stat is that:
- The old 'stat/utimes' syscalls get modified to do correct saturation for both
file-system specific limits and 32-bit time_t limits.
- The newly added (as of linux-4.12) statx() syscall gets used as the
replacement for the entire stat family of syscalls with 64-bit time_t.
glibc will probably provide a statx wrapper for applications, and may
may not also provide a new symbol version for stat/fstat/lstat based
on the new structure for all architectures including native 64-bit ones.
Arnd
More information about the Libc-alpha
mailing list