Introduce 64bit accessors and structures required to address y2038 issues in the posix_clock subsystem
Subsystems (6)
cover Introduce 64bit accessors and structures required to address y2038 issues in the posix_clock subsystem
This patch series change the 32-bit time types (timespec/itimerspec) to the 64-bit types (timespec64/itimerspec64), and add new 64bit accessor functions, which are required in order to avoid y2038 issues in the posix_clock subsystem.
In order to avoid spamming people too much, I'm only sending the first few patches of the patch series, and left the other patches for later.
And if you are interested in the whole patch series, see:
https://git.linaro.org/people/baolin.wang/upstream_0627.git
Thoughts and feedback would be appreciated.
Baolin Wang (6):
time: Introduce struct itimerspec64
timekeeping: Introduce current_kernel_time64()
security: Introduce security_settime64()
time: Introduce do_sys_settimeofday64()
time: Introduce timespec64_to_jiffies()/jiffies_to_timespec64()
cputime: Introduce cputime_to_timespec64()/timespec64_to_cputime()
arch/powerpc/include/asm/cputime.h | 6 +++--- arch/s390/include/asm/cputime.h | 8 ++++---- include/asm-generic/cputime_jiffies.h | 10 +++++----- include/asm-generic/cputime_nsecs.h | 6 +++--- include/linux/cputime.h | 16 +++++++++++++++ include/linux/jiffies.h | 22 ++++++++++++++++++--- include/linux/lsm_hooks.h | 5 +++-- include/linux/security.h | 20 ++++++++++++++++--- include/linux/time64.h | 35 +++++++++++++++++++++++++++++++++ include/linux/timekeeping.h | 24 +++++++++++++++++++--- kernel/time/time.c | 28 +++++++++++++++----------- kernel/time/timekeeping.c | 6 +++--- security/commoncap.c | 2 +- security/security.c | 2 +- 14 files changed, 148 insertions(+), 42 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/6 time: Introduce struct itimerspec64
The struct itimerspec is not year 2038 safe on 32bit systems due to the limitation of the struct timespec members. Introduce itimerspec64 which uses struct timespec64 instead and provide conversion functions.
--- include/linux/time64.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
include/linux/time64.h +35 -0
@@ -12,11 +12,18 @@ typedef __s64 time64_t;*/ #if __BITS_PER_LONG ==64 # define timespec64 timespec +#define itimerspec64 itimerspec#else struct timespec64 {time64_t tv_sec;/* seconds */ long tv_nsec;/* nanoseconds */ }; + +struct itimerspec64 { +struct timespec64 it_interval; +struct timespec64 it_value; +}; +#endif /* Parameters used to convert the timespec values: */
@@ -45,6 +52,16 @@ static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)return ts; } +static inline struct itimerspec itimerspec64_to_itimerspec (struct itimerspec64 *its64) +{ +return *its64; +} + +static inline struct itimerspec64 itimerspec_to_itimerspec64 (struct itimerspec *its) +{ +return *its; +} +# define timespec64_equal timespec_equal# define timespec64_compare timespec_compare# define set_normalized_timespec64 set_normalized_timespec
@@ -77,6 +94,24 @@ static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)return ret; } +static inline struct itimerspec itimerspec64_to_itimerspec (struct itimerspec64 *its64) +{ +struct itimerspec ret; + + ret.it_interval =timespec64_to_timespec (its64->it_interval); + ret.it_value =timespec64_to_timespec (its64->it_value); +return ret; +} + +static inline struct itimerspec64 itimerspec_to_itimerspec64 (struct itimerspec *its) +{ +struct itimerspec64 ret; + + ret.it_interval =timespec_to_timespec64 (its->it_interval); + ret.it_value =timespec_to_timespec64 (its->it_value); +return ret; +} +static inline int timespec64_equal (const struct timespec64 *a,const struct timespec64 *b) {
Signature · 1 line
1.7.9.5
PATCH 2/6 timekeeping: Introduce current_kernel_time64()
In reply to Baolin WangThe current_kernel_time() is not year 2038 safe on 32bit systems since it returns a timespec value. Introduce current_kernel_time64() which returns a timespec64 value.
--- include/linux/timekeeping.h | 9 ++++++++- kernel/time/timekeeping.c | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-)
include/linux/timekeeping.h +8 -1
@@ -18,10 +18,17 @@ extern int do_sys_settimeofday(const struct timespec *tv,* Kernel time accessors */ unsigned long get_seconds (void ); -struct timespec current_kernel_time (void ); +struct timespec64 current_kernel_time64 (void );/* does not take xtime_lock */ struct timespec __current_kernel_time (void ); +static inline struct timespec current_kernel_time (void ) +{ +struct timespec64 now =current_kernel_time64 (); + +return timespec64_to_timespec (now); +} +/* * timespec based interfaces */
kernel/time/timekeeping.c +3 -3
@@ -1874,7 +1874,7 @@ struct timespec __current_kernel_time(void)return timespec64_to_timespec (tk_xtime (tk)); } -struct timespec current_kernel_time (void ) +struct timespec64 current_kernel_time64 (void ) {struct timekeeper *tk = &tk_core.timekeeper;struct timespec64 now;
@@ -1886,9 +1886,9 @@ struct timespec current_kernel_time(void) now =tk_xtime (tk); }while (read_seqcount_retry (&tk_core.seq, seq)); -return timespec64_to_timespec (now); +return now; } -EXPORT_SYMBOL (current_kernel_time); +EXPORT_SYMBOL (current_kernel_time64);struct timespec64 get_monotonic_coarse64 (void ) {
Signature · 1 line
1.7.9.5
PATCH 3/6 security: Introduce security_settime64()
In reply to Baolin Wangsecurity_settime() returns a timespec, which is not year 2038 safe on 32bit systems. Thus this patch introduces the security_settime64() function with timespec64 type.
We also convert the cap_settime() helper function to use the 64bit types.
--- include/linux/lsm_hooks.h | 5 +++-- include/linux/security.h | 20 +++++++++++++++++--- security/commoncap.c | 2 +- security/security.c | 2 +- 4 files changed, 22 insertions(+), 7 deletions(-)
include/linux/lsm_hooks.h +3 -2
@@ -1191,7 +1191,8 @@* Return 0 if permission is granted. * @settime: * Check permission to change the system time. -* struct timespec and timezone are defined in include/linux/time.h +* struct timespec64 is defined in include/linux/time64.h and timezone +* is defined in include/linux/time.h * @ts contains new time * @tz contains new timezone * Return 0 if permission is granted.
@@ -1324,7 +1325,7 @@ union security_list_options {int (*quotactl)(int cmds,int type,int id,struct super_block *sb);int (*quota_on)(struct dentry *dentry);int (*syslog)(int type); -int (*settime)(const struct timespec *ts,const struct timezone *tz); +int (*settime)(const struct timespec64 *ts,const struct timezone *tz);int (*vm_enough_memory)(struct mm_struct *mm,long pages);int (*bprm_set_creds)(struct linux_binprm *bprm);
include/linux/security.h +17 -3
@@ -69,7 +69,7 @@ struct timezone;/* These functions are in security/commoncap.c */ extern int cap_capable (const struct cred *cred,struct user_namespace *ns,int cap,int audit); -extern int cap_settime (const struct timespec *ts,const struct timezone *tz); +extern int cap_settime (const struct timespec64 *ts,const struct timezone *tz);extern int cap_ptrace_access_check (struct task_struct *child,unsigned int mode);extern int cap_ptrace_traceme (struct task_struct *parent);extern int cap_capget (struct task_struct *target,kernel_cap_t *effective,kernel_cap_t *inheritable,kernel_cap_t *permitted);
@@ -206,7 +206,13 @@ int security_capable_noaudit(const struct cred *cred, struct user_namespace *ns,int security_quotactl (int cmds,int type,int id,struct super_block *sb);int security_quota_on (struct dentry *dentry);int security_syslog (int type); -int security_settime (const struct timespec *ts,const struct timezone *tz); +int security_settime64 (const struct timespec64 *ts,const struct timezone *tz); +static inline int security_settime (const struct timespec *ts,const struct timezone *tz) +{ +struct timespec64 ts64 =timespec_to_timespec64 (*ts); + +return security_settime64 (&ts64, tz); +}int security_vm_enough_memory_mm (struct mm_struct *mm,long pages);int security_bprm_set_creds (struct linux_binprm *bprm);int security_bprm_check (struct linux_binprm *bprm);
@@ -457,10 +463,18 @@ static inline int security_syslog(int type)return 0 ; } +static inline int security_settime64 (const struct timespec64 *ts, +const struct timezone *tz) +{ +return cap_settime (ts, tz); +} +static inline int security_settime (const struct timespec *ts,const struct timezone *tz) { -return cap_settime (ts, tz); +struct timespec64 ts64 =timespec_to_timespec64 (*ts); + +return cap_settime (&ts64, tz); }static inline int security_vm_enough_memory_mm (struct mm_struct *mm,long pages)
security/commoncap.c +1 -1
@@ -111,7 +111,7 @@ int cap_capable(const struct cred *cred, struct user_namespace *targ_ns,* Determine whether the current process may set the system clock and timezone * information, returning 0 if permission granted, -ve if denied. */ -int cap_settime (const struct timespec *ts,const struct timezone *tz) +int cap_settime (const struct timespec64 *ts,const struct timezone *tz) {if (!capable (CAP_SYS_TIME ))return -EPERM ;
security/security.c +1 -1
@@ -213,7 +213,7 @@ int security_syslog(int type)return call_int_hook (syslog,0 , type); } -int security_settime (const struct timespec *ts,const struct timezone *tz) +int security_settime64 (const struct timespec64 *ts,const struct timezone *tz) {return call_int_hook (settime,0 , ts, tz); }
Signature · 1 line
1.7.9.5
PATCH 4/6 time: Introduce do_sys_settimeofday64()
In reply to Baolin WangThe do_sys_settimeofday() function uses a timespec, which is not year 2038 safe on 32bit systems.
Thus this patch introduces do_sys_settimeofday64(), which allows us to transition users of do_sys_settimeofday() to using 64bit time types.
--- include/linux/timekeeping.h | 15 +++++++++++++-- kernel/time/time.c | 8 ++++---- 2 files changed, 17 insertions(+), 6 deletions(-)
include/linux/timekeeping.h +13 -2
@@ -11,8 +11,19 @@ extern int timekeeping_suspended;*/ extern void do_gettimeofday (struct timeval *tv);extern int do_settimeofday64 (const struct timespec64 *ts); -extern int do_sys_settimeofday (const struct timespec *tv, -const struct timezone *tz); +extern int do_sys_settimeofday64 (const struct timespec64 *tv, +const struct timezone *tz); +static inline int do_sys_settimeofday (const struct timespec *tv, +const struct timezone *tz) +{ +struct timespec64 ts64; + +if (!tv) +return -EINVAL ; + + ts64 =timespec_to_timespec64 (*tv); +return do_sys_settimeofday64 (&ts64, tz); +}/* * Kernel time accessors
kernel/time/time.c +4 -4
@@ -160,15 +160,15 @@ static inline void warp_clock(void)* various programs will get confused when the clock gets warped. */ -int do_sys_settimeofday (const struct timespec *tv,const struct timezone *tz) +int do_sys_settimeofday64 (const struct timespec64 *tv,const struct timezone *tz) {static int firsttime =1 ;int error =0 ; -if (tv && !timespec_valid (tv)) +if (tv && !timespec64_valid (tv))return -EINVAL ; - error =security_settime (tv, tz); + error =security_settime64 (tv, tz);if (error)return error;
@@ -186,7 +186,7 @@ int do_sys_settimeofday(const struct timespec *tv, const struct timezone *tz) } }if (tv) -return do_settimeofday (tv); +return do_settimeofday64 (tv);return 0 ; }
Signature · 1 line
1.7.9.5
PATCH 5/6 time: Introduce timespec64_to_jiffies()/jiffies_to_timespec64()
In reply to Baolin WangThe conversion between struct timespec and jiffies is not year 2038 safe on 32bit systems. Introduce timespec64_to_jiffies() and jiffies_to_timespec64() functions which use struct timespec64 to make it ready for 2038 issue.
--- include/linux/jiffies.h | 22 +++++++++++++++++++--- kernel/time/time.c | 20 +++++++++++++------- 2 files changed, 32 insertions(+), 10 deletions(-)
include/linux/jiffies.h +19 -3
@@ -416,9 +416,25 @@ static inline unsigned long usecs_to_jiffies(const unsigned int u) } } -extern unsigned long timespec_to_jiffies (const struct timespec *value); -extern void jiffies_to_timespec (const unsigned long jiffies, -struct timespec *value); +extern unsigned long timespec64_to_jiffies (const struct timespec64 *value); +extern void jiffies_to_timespec64 (const unsigned long jiffies, +struct timespec64 *value); +static inline unsigned long timespec_to_jiffies (const struct timespec *value) +{ +struct timespec64 ts =timespec_to_timespec64 (*value); + +return timespec64_to_jiffies (&ts); +} + +static inline void jiffies_to_timespec (const unsigned long jiffies, +struct timespec *value) +{ +struct timespec64 ts; + +jiffies_to_timespec64 (jiffies, &ts); + *value =timespec64_to_timespec (ts); +} +extern unsigned long timeval_to_jiffies (const struct timeval *value);extern void jiffies_to_timeval (const unsigned long jiffies,struct timeval *value);
kernel/time/time.c +13 -7
@@ -546,7 +546,7 @@ EXPORT_SYMBOL(__usecs_to_jiffies);* value to a scaled second value. */ static unsigned long -__timespec_to_jiffies (unsigned long sec,long nsec) +__timespec64_to_jiffies (u64 sec,long nsec) { nsec = nsec +TICK_NSEC -1 ;
@@ -554,22 +554,28 @@ __timespec_to_jiffies(unsigned long sec, long nsec) sec =MAX_SEC_IN_JIFFIES ; nsec =0 ; } -return (((u64 )sec *SEC_CONVERSION ) + +return ((sec *SEC_CONVERSION ) + (((u64 )nsec *NSEC_CONVERSION ) >> (NSEC_JIFFIE_SC -SEC_JIFFIE_SC ))) >>SEC_JIFFIE_SC ; } +static unsigned long +__timespec_to_jiffies (unsigned long sec,long nsec) +{ +return __timespec64_to_jiffies ((u64 )sec, nsec); +} +unsigned long -timespec_to_jiffies (const struct timespec *value) +timespec64_to_jiffies (const struct timespec64 *value) { -return __timespec_to_jiffies (value->tv_sec, value->tv_nsec); +return __timespec64_to_jiffies (value->tv_sec, value->tv_nsec); } -EXPORT_SYMBOL (timespec_to_jiffies); +EXPORT_SYMBOL (timespec64_to_jiffies);void -jiffies_to_timespec (const unsigned long jiffies,struct timespec *value) +jiffies_to_timespec64 (const unsigned long jiffies,struct timespec64 *value) {/* * Convert jiffies to nanoseconds and separate with
@@ -580,7 +586,7 @@ jiffies_to_timespec(const unsigned long jiffies, struct timespec *value) NSEC_PER_SEC, &rem); value->tv_nsec = rem; } -EXPORT_SYMBOL (jiffies_to_timespec); +EXPORT_SYMBOL (jiffies_to_timespec64);/* * We could use a similar algorithm to timespec_to_jiffies (with a
Signature · 1 line
1.7.9.5
PATCH 6/6 cputime: Introduce cputime_to_timespec64()/timespec64_to_cputime()
In reply to Baolin WangThe cputime_to_timespec() and timespec_to_cputime() functions are not year 2038 safe on 32bit systems due to that the struct timepsec will overflow in 2038 year. This patch introduces cputime_to_timespec64() and timespec64_to_cputime() functions which use struct timespec64. And converts arch specific implementations in arch/s390 and arch/powerpc.
--- arch/powerpc/include/asm/cputime.h | 6 +++--- arch/s390/include/asm/cputime.h | 8 ++++---- include/asm-generic/cputime_jiffies.h | 10 +++++----- include/asm-generic/cputime_nsecs.h | 6 +++--- include/linux/cputime.h | 16 ++++++++++++++++ 5 files changed, 31 insertions(+), 15 deletions(-)
arch/powerpc/include/asm/cputime.h +3 -3
@@ -154,9 +154,9 @@ static inline cputime_t secs_to_cputime(const unsigned long sec) }/* -* Convert cputime <-> timespec +* Convert cputime <-> timespec64 */ -static inline void cputime_to_timespec (const cputime_t ct,struct timespec *p) +static inline void cputime_to_timespec64 (const cputime_t ct,struct timespec64 *p) {u64 x = (__force u64 ) ct;unsigned int frac;
@@ -168,7 +168,7 @@ static inline void cputime_to_timespec(const cputime_t ct, struct timespec *p) p->tv_nsec = x; } -static inline cputime_t timespec_to_cputime (const struct timespec *p) +static inline cputime_t timespec64_to_cputime (const struct timespec64 *p) {u64 ct;
arch/s390/include/asm/cputime.h +4 -4
@@ -81,16 +81,16 @@ static inline cputime_t secs_to_cputime(const unsigned int s) }/* -* Convert cputime to timespec and back. +* Convert cputime to timespec64 and back. */ -static inline cputime_t timespec_to_cputime (const struct timespec *value) +static inline cputime_t timespec64_to_cputime (const struct timespec64 *value) {unsigned long long ret = value->tv_sec *CPUTIME_PER_SEC ;return (__force cputime_t)(ret +__div (value->tv_nsec *CPUTIME_PER_USEC ,NSEC_PER_USEC )); } -static inline void cputime_to_timespec (const cputime_t cputime, -struct timespec *value) +static inline void cputime_to_timespec64 (const cputime_t cputime, +struct timespec64 *value) {unsigned long long __cputime = (__force unsigned long long ) cputime; value->tv_nsec = (__cputime %CPUTIME_PER_SEC ) *NSEC_PER_USEC /CPUTIME_PER_USEC ;
include/asm-generic/cputime_jiffies.h +5 -5
@@ -44,12 +44,12 @@ typedef u64 __nocast cputime64_t;#define secs_to_cputime (sec) jiffies_to_cputime((sec) * HZ)/* -* Convert cputime to timespec and back. +* Convert cputime to timespec64 and back. */ -#define timespec_to_cputime (__val) \ - jiffies_to_cputime(timespec_to_jiffies(__val)) -#define cputime_to_timespec (__ct,__val) \ - jiffies_to_timespec(cputime_to_jiffies(__ct),__val) +#define timespec64_to_cputime (__val) \ + jiffies_to_cputime(timespec64_to_jiffies(__val)) +#define cputime_to_timespec64 (__ct,__val) \ + jiffies_to_timespec64(cputime_to_jiffies(__ct),__val)/* * Convert cputime to timeval and back.
include/asm-generic/cputime_nsecs.h +3 -3
@@ -71,14 +71,14 @@ typedef u64 __nocast cputime64_t; (__force cputime_t)((__secs) *NSEC_PER_SEC )/* -* Convert cputime <-> timespec (nsec) +* Convert cputime <-> timespec64 (nsec) */ -static inline cputime_t timespec_to_cputime (const struct timespec *val) +static inline cputime_t timespec64_to_cputime (const struct timespec64 *val) {u64 ret = val->tv_sec *NSEC_PER_SEC + val->tv_nsec;return (__force cputime_t ) ret; } -static inline void cputime_to_timespec (const cputime_t ct,struct timespec *val) +static inline void cputime_to_timespec64 (const cputime_t ct,struct timespec64 *val) {u32 rem;
include/linux/cputime.h +16 -0
@@ -13,4 +13,20 @@ usecs_to_cputime((__nsecs) / NSEC_PER_USEC)#endif +static inline cputime_t timespec_to_cputime (const struct timespec *ts) +{ +struct timespec64 ts64 =timespec_to_timespec64 (*ts); + +return timespec64_to_cputime (&ts64); +} + +static inline void cputime_to_timespec (const cputime_t cputime, +struct timespec *value) +{ +struct timespec64 ts64; + +cputime_to_timespec64 (cputime, &ts64); + *value =timespec64_to_timespec (ts64); +} +#endif /* __LINUX_CPUTIME_H */
Signature · 1 line
1.7.9.5
Re: [PATCH 3/6] security: Introduce security_settime64()
In reply to Baolin WangQuoted 1 line · Baolin Wang
security_settime()returns a timespec, which is not year 2038 safe
It returns int, which is year 2038 safe on all systems. Copy and paste is great, right?
include/linux/security.h int security_capable_noaudit(const struct cred *cred, struct user_namespace *ns, · line 215
Quoted 8 lines
include/linux/security.h +7
-1-int security_settime (const struct timespec *ts,const struct timezone *tz); +int security_settime64 (const struct timespec64 *ts,const struct timezone *tz); +static inline int security_settime (const struct timespec *ts,const struct timezone *tz) +{ +struct timespec64 ts64 =timespec_to_timespec64 (*ts); + +return security_settime64 (&ts64, tz); +}
What's the point of this inline? Explanation is missing in changelog.
Also this wants follow up patches which fix the call sites and remove that inline helper again.
security/commoncap.c int cap_capable(const struct cred *cred, struct user_namespace *targ_ns, · line 114
Quoted 2 lines
security/commoncap.c +1
-1-int cap_settime (const struct timespec *ts,const struct timezone *tz) +int cap_settime (const struct timespec64 *ts,const struct timezone *tz)
Changelog is missing that none of the existing hooks is using the ts argument and therefor the patch is not doing any functional changes.
Thanks,
tglx
Re: [PATCH 6/6] cputime: Introduce cputime_to_timespec64()/timespec64_to_cputime()
In reply to Baolin WangQuoted 3 lines · Baolin Wang
The
cputime_to_timespec()andtimespec_to_cputime()functions are not year 2038 safe on 32bit systems due to that the struct timepsec will overflow in 2038 year.
And how is this relevant? cputime is not based on wall clock time at all. So what has 2038 to do with cputime?
We want proper explanations WHY we need such a change.
Thanks,
tglx
Re: [PATCH 3/6] security: Introduce security_settime64()
In reply to Thomas GleixnerQuoted 7 lines · Thomas Gleixner
Quoted 1 line · Baolin Wang
security_settime()returns a timespec, which is not year 2038 safeIt returns int, which is year 2038 safe on all systems. Copy and paste is great, right?
Sorry, will fix that.
Quoted 12 lines
include/linux/security.h int security_capable_noaudit(const struct cred *cred, struct user_namespace *ns, · line 215
Quoted 8 lines
include/linux/security.h +7
-1-int security_settime (const struct timespec *ts,const struct timezone *tz); +int security_settime64 (const struct timespec64 *ts,const struct timezone *tz); +static inline int security_settime (const struct timespec *ts,const struct timezone *tz) +{ +struct timespec64 ts64 =timespec_to_timespec64 (*ts); + +return security_settime64 (&ts64, tz); +}What's the point of this inline? Explanation is missing in changelog.
Quoted 3 lines
Also this wants follow up patches which fix the call sites and remove that inline helper again.
Yes, I'll add this explanation in changelog.
Quoted 6 lines
security/commoncap.c int cap_capable(const struct cred *cred, struct user_namespace *targ_ns, · line 114
Quoted 2 lines
security/commoncap.c +1
-1-int cap_settime (const struct timespec *ts,const struct timezone *tz) +int cap_settime (const struct timespec64 *ts,const struct timezone *tz)Changelog is missing that none of the existing hooks is using the ts argument and therefor the patch is not doing any functional changes.
OK, will add these explanation. Thanks for your comments.
Quoted 3 lines
Thanks,
tglx
Signature · 2 lines
Baolin.wang Best Regards
Re: [PATCH 6/6] cputime: Introduce cputime_to_timespec64()/timespec64_to_cputime()
In reply to Thomas GleixnerQuoted 10 lines · Thomas Gleixner
Quoted 3 lines · Baolin Wang
The
cputime_to_timespec()andtimespec_to_cputime()functions are not year 2038 safe on 32bit systems due to that the struct timepsec will overflow in 2038 year.And how is this relevant? cputime is not based on wall clock time at all. So what has 2038 to do with cputime?
We want proper explanations WHY we need such a change.
When converting the posix-cpu-timers, it call the cputime_to_timespec() function. Thus it need a conversion for this function.
You can see that conversion in patch "posix-cpu-timers: Convert to y2038 safe callbacks" from
https://git.linaro.org/people/baolin.wang/upstream_0627.git.
And I also will explain this in the changelog. Thanks for your comments.
Quoted 6 lines
Thanks,
tglx
Signature · 6 lines
Baolin.wang Best Regards _______________________________________________ Y2038 mailing list [email protected] https://lists.linaro.org/mailman/listinfo/y2038
Re: [PATCH 6/6] cputime: Introduce cputime_to_timespec64()/timespec64_to_cputime()
Quoted 7 lines · Baolin Wang
Quoted 6 lines · Thomas Gleixner
Quoted 3 lines · Baolin Wang
The
cputime_to_timespec()andtimespec_to_cputime()functions are not year 2038 safe on 32bit systems due to that the struct timepsec will overflow in 2038 year.
Quoted 8 lines
Quoted 4 lines
And how is this relevant? cputime is not based on wall clock time at all. So what has 2038 to do with cputime?
We want proper explanations WHY we need such a change.
When converting the posix-cpu-timers, it call the
cputime_to_timespec()function. Thus it need a conversion for this function.
There is no requirement to convert posix-cpu-timers on their own. We need to adopt the posix cpu timers code because it shares syscalls with the other posix timers, but that still does not explain why we need these functions.
Quoted 3 lines
You can see that conversion in patch "posix-cpu-timers: Convert to y2038 safe callbacks" from
https://git.linaro.org/people/baolin.wang/upstream_0627.git.
I do not care about your random git tree. I care about proper changelogs. Your changelogs are just a copied boilerplate full of errors.
Thanks,
tglx
_______________________________________________
Y2038 mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/y2038
Re: [PATCH 6/6] cputime: Introduce cputime_to_timespec64()/timespec64_to_cputime()
Quoted 14 lines · Thomas Gleixner
Quoted 12 lines · Baolin Wang
Quoted 10 lines · Thomas Gleixner
Quoted 3 lines · Baolin Wang
The
cputime_to_timespec()andtimespec_to_cputime()functions are not year 2038 safe on 32bit systems due to that the struct timepsec will overflow in 2038 year.And how is this relevant? cputime is not based on wall clock time at all. So what has 2038 to do with cputime?
We want proper explanations WHY we need such a change.
Quoted 9 lines
Quoted 3 lines
When converting the posix-cpu-timers, it call the
cputime_to_timespec()function. Thus it need a conversion for this function.There is no requirement to convert posix-cpu-timers on their own. We need to adopt the posix cpu timers code because it shares syscalls with the other posix timers, but that still does not explain why we need these functions.
In posix-cpu-timers, it also defined some 'k_clock struct' variables, and we need to convert the callbacks of the 'k_clock struct' which are not year 2038 safe on 32bit systems. Some callbacks which need to convert call the cputime_to_timespec() function, thus we also want to convert the cputime_to_timespec() function to a year 2038 safe function to make all them ready for the year 2038 issue.
Quoted 11 lines
Quoted 3 lines
You can see that conversion in patch "posix-cpu-timers: Convert to y2038 safe callbacks" from
https://git.linaro.org/people/baolin.wang/upstream_0627.git.I do not care about your random git tree. I care about proper changelogs. Your changelogs are just a copied boilerplate full of errors.
Thanks,
tglx
Signature · 6 lines
Baolin.wang Best Regards _______________________________________________ Y2038 mailing list [email protected] https://lists.linaro.org/mailman/listinfo/y2038
Re: [PATCH 6/6] cputime: Introduce cputime_to_timespec64()/timespec64_to_cputime()
Quoted 25 lines · Baolin Wang
Quoted 14 lines · Thomas Gleixner
Quoted 12 lines · Baolin Wang
Quoted 10 lines · Thomas Gleixner
Quoted 3 lines · Baolin Wang
The
cputime_to_timespec()andtimespec_to_cputime()functions are not year 2038 safe on 32bit systems due to that the struct timepsec will overflow in 2038 year.And how is this relevant? cputime is not based on wall clock time at all. So what has 2038 to do with cputime?
We want proper explanations WHY we need such a change.
Quoted 9 lines
Quoted 3 lines
When converting the posix-cpu-timers, it call the
cputime_to_timespec()function. Thus it need a conversion for this function.There is no requirement to convert posix-cpu-timers on their own. We need to adopt the posix cpu timers code because it shares syscalls with the other posix timers, but that still does not explain why we need these functions.
Quoted 6 lines
In posix-cpu-timers, it also defined some '
k_clockstruct' variables, and we need to convert the callbacks of the 'k_clockstruct' which are not year 2038 safe on 32bit systems. Some callbacks which need to convert call thecputime_to_timespec()function, thus we also want to convert thecputime_to_timespec()function to a year 2038 safe function to make all them ready for the year 2038 issue.
You are not getting it at all.
1) We need to change k_clock callbacks due to 2038 issues
2) posix cpu timers implement affected callbacks
3) posix cpu timers themself and cputime are NOT affected by 2038
So we have 2 options to change the code in posix cpu timers:
A) Do the timespec/timespec64 conversion in the posix cpu timer callbacks and leave the cputime functions untouched.
B) Implement cputime/timespec64 functions to avoid #A
If you go for #B, you need to provide a reasonable explanation why it is better than #A. And that explanation has absolutely nothing to do with 2038 safety.
Not everything is a 2038 issue, just because the only tool you have is a timespec64.
Thanks,
tglx
Re: [PATCH 6/6] cputime: Introduce cputime_to_timespec64()/timespec64_to_cputime()
Quoted 43 lines · Thomas Gleixner
Quoted 25 lines · Baolin Wang
Quoted 14 lines · Thomas Gleixner
Quoted 12 lines · Baolin Wang
Quoted 10 lines · Thomas Gleixner
Quoted 3 lines · Baolin Wang
The
cputime_to_timespec()andtimespec_to_cputime()functions are not year 2038 safe on 32bit systems due to that the struct timepsec will overflow in 2038 year.And how is this relevant? cputime is not based on wall clock time at all. So what has 2038 to do with cputime?
We want proper explanations WHY we need such a change.
Quoted 9 lines
Quoted 3 lines
When converting the posix-cpu-timers, it call the
cputime_to_timespec()function. Thus it need a conversion for this function.There is no requirement to convert posix-cpu-timers on their own. We need to adopt the posix cpu timers code because it shares syscalls with the other posix timers, but that still does not explain why we need these functions.
Quoted 6 lines
In posix-cpu-timers, it also defined some '
k_clockstruct' variables, and we need to convert the callbacks of the 'k_clockstruct' which are not year 2038 safe on 32bit systems. Some callbacks which need to convert call thecputime_to_timespec()function, thus we also want to convert thecputime_to_timespec()function to a year 2038 safe function to make all them ready for the year 2038 issue.You are not getting it at all.
1) We need to change
k_clockcallbacks due to 2038 issues2) posix cpu timers implement affected callbacks
3) posix cpu timers themself and cputime are NOT affected by 2038
So we have 2 options to change the code in posix cpu timers:
Quoted 8 lines
A) Do the timespec/timespec64 conversion in the posix cpu timer callbacks and leave the cputime functions untouched.
B) Implement cputime/timespec64 functions to avoid #A
If you go for #B, you need to provide a reasonable explanation why it is better than #A. And that explanation has absolutely nothing to do with 2038 safety.
Very thanks for your explanation, and I'll think about that.
Quoted 10 lines
Not everything is a 2038 issue, just because the only tool you have is a timespec64.
Thanks,
tglx
Signature · 2 lines
Baolin.wang Best Regards