mbox series

[v3,0/5] y2038: Linux: Provide __clock_settime function supporting 64 bit time

Message ID 20190507131848.30980-1-lukma@denx.de
Headers show
Series y2038: Linux: Provide __clock_settime function supporting 64 bit time | expand

Message

Lukasz Majewski May 7, 2019, 1:18 p.m. UTC
This patch set introduces the conversion of __clock_settime to explicit
64 bit struct __timespec64 arguments. As a result this function is now
Y2038 safe.

To achieve the above goal - new, internal to glibc,
struct __timespec64 has been also introduced as well as
helper functions to handle time conversions on 32 bit systems.

The code from this patch set uses new clock_settime64 syscall (explicit
64 bits) from Linux kernel (5.1+).

In glibc new __ASSUME_TIME64_SYSCALLS define has been introduced to
indicate if above syscall is provided by the kernel.

This work is (loosely) based on a previous development/patches:
https://libc-alpha.sourceware.narkive.com/zniMOWui/rfc-patch-00-52-make-glibc-y2038-proof#post68

Github branch (including the y2038 conversion example):
https://github.com/lmajewski/y2038_glibc/commits/Y2038-2.29-glibc-__clock-internal-struct-timespec-v3

Those patches have been applied on top of master branch:
SHA1: 32e902a94e24fc5a00168d0df3301098704c61fb

Shall be used with provided meta-y2038 for development and testing:
https://github.com/lmajewski/meta-y2038

I've used guidelines from:
https://www.gnu.org/software/libc/manual/html_mono/libc.html
"D.2.1 64-bit time symbol handling in the GNU C Library"
to convert *clock_settime*.

and most notably from:
https://sourceware.org/glibc/wiki/Y2038ProofnessDesign#clock_gettime.28.29

Feedback and comments are more than welcome.


Lukasz Majewski (5):
  y2038: Introduce __ASSUME_TIME64_SYSCALLS define
  y2038: Introduce internal for glibc struct __timespec64
  y2038: Provide conversion helpers for struct __timespec64
  y2038: linux: Provide __clock_settime64 implementation
  y2038: Support for Y2038 safe time on 32 bit systems

 include/features.h                               |  19 ++++
 include/time.h                                   | 121 +++++++++++++++++++++++
 manual/creature.texi                             |  28 ++++++
 sysdeps/unix/sysv/linux/clock_settime.c          |  53 +++++++++-
 sysdeps/unix/sysv/linux/kernel-features.h        |  38 +++++++
 sysdeps/unix/sysv/linux/x86_64/kernel-features.h |   9 ++
 time/Versions                                    |   3 +
 time/bits/types/struct_timespec.h                |  15 ++-
 time/bits/types/time_t.h                         |   4 +
 time/time.h                                      |   9 ++
 10 files changed, 294 insertions(+), 5 deletions(-)

Comments

Lukasz Majewski May 7, 2019, 1:18 p.m. UTC | #1
This patch set introduces the conversion of __clock_settime to explicit
64 bit struct __timespec64 arguments. As a result this function is now
Y2038 safe.

To achieve the above goal - new, internal to glibc,
struct __timespec64 has been also introduced as well as
helper functions to handle time conversions on 32 bit systems.

The code from this patch set uses new clock_settime64 syscall (explicit
64 bits) from Linux kernel (5.1+).

In glibc new __ASSUME_TIME64_SYSCALLS define has been introduced to
indicate if above syscall is provided by the kernel.

This work is (loosely) based on a previous development/patches:
https://libc-alpha.sourceware.narkive.com/zniMOWui/rfc-patch-00-52-make-glibc-y2038-proof#post68

Github branch (including the y2038 conversion example):
https://github.com/lmajewski/y2038_glibc/commits/Y2038-2.29-glibc-__clock-internal-struct-timespec-v3

Those patches have been applied on top of master branch:
SHA1: 32e902a94e24fc5a00168d0df3301098704c61fb

Shall be used with provided meta-y2038 for development and testing:
https://github.com/lmajewski/meta-y2038

I've used guidelines from:
https://www.gnu.org/software/libc/manual/html_mono/libc.html
"D.2.1 64-bit time symbol handling in the GNU C Library"
to convert *clock_settime*.

and most notably from:
https://sourceware.org/glibc/wiki/Y2038ProofnessDesign#clock_gettime.28.29

Feedback and comments are more than welcome.


Lukasz Majewski (5):
  y2038: Introduce __ASSUME_TIME64_SYSCALLS define
  y2038: Introduce internal for glibc struct __timespec64
  y2038: Provide conversion helpers for struct __timespec64
  y2038: linux: Provide __clock_settime64 implementation
  y2038: Support for Y2038 safe time on 32 bit systems

 include/features.h                               |  19 ++++
 include/time.h                                   | 121 +++++++++++++++++++++++
 manual/creature.texi                             |  28 ++++++
 sysdeps/unix/sysv/linux/clock_settime.c          |  53 +++++++++-
 sysdeps/unix/sysv/linux/kernel-features.h        |  38 +++++++
 sysdeps/unix/sysv/linux/x86_64/kernel-features.h |   9 ++
 time/Versions                                    |   3 +
 time/bits/types/struct_timespec.h                |  15 ++-
 time/bits/types/time_t.h                         |   4 +
 time/time.h                                      |   9 ++
 10 files changed, 294 insertions(+), 5 deletions(-)