History

Merge tag 'y2038-drivers-for-v5.6-signed' of git://git.kernel.org:/pub/scm/linux/kernel/git/arnd/playground

Pull y2038 updates from Arnd Bergmann: "Core, driver and file system changes These are updates to device drivers and file systems that for some reason or another were not included in the kernel in the previous y2038 series. I've gone through all users of time_t again to make sure the kernel is in a long-term maintainable state, replacing all remaining references to time_t with safe alternatives. Some related parts of the series were picked up into the nfsd, xfs, alsa and v4l2 trees. A final set of patches in linux-mm removes the now unused time_t/timeval/timespec types and helper functions after all five branches are merged for linux-5.6, ensuring that no new users get merged. As a result, linux-5.6, or my backport of the patches to 5.4 [1], should be the first release that can serve as a base for a 32-bit system designed to run beyond year 2038, with a few remaining caveats: - All user space must be compiled with a 64-bit time_t, which will be supported in the coming musl-1.2 and glibc-2.32 releases, along with installed kernel headers from linux-5.6 or higher. - Applications that use the system call interfaces directly need to be ported to use the time64 syscalls added in linux-5.1 in place of the existing system calls. This impacts most users of futex() and seccomp() as well as programming languages that have their own runtime environment not based on libc. - Applications that use a private copy of kernel uapi header files or their contents may need to update to the linux-5.6 version, in particular for sound/asound.h, xfs/xfs_fs.h, linux/input.h, linux/elfcore.h, linux/sockios.h, linux/timex.h and linux/can/bcm.h. - A few remaining interfaces cannot be changed to pass a 64-bit time_t in a compatible way, so they must be configured to use CLOCK_MONOTONIC times or (with a y2106 problem) unsigned 32-bit timestamps. Most importantly this impacts all users of 'struct input_event'. - All y2038 problems that are present on 64-bit machines also apply to 32-bit machines. In particular this affects file systems with on-disk timestamps using signed 32-bit seconds: ext4 with ext3-style small inodes, ext2, xfs (to be fixed soon) and ufs" [1] https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=y2038-endgame * tag 'y2038-drivers-for-v5.6-signed' of git://git.kernel.org:/pub/scm/linux/kernel/git/arnd/playground: (21 commits) Revert "drm/etnaviv: reject timeouts with tv_nsec >= NSEC_PER_SEC" y2038: sh: remove timeval/timespec usage from headers y2038: sparc: remove use of struct timex y2038: rename itimerval to __kernel_old_itimerval y2038: remove obsolete jiffies conversion functions nfs: fscache: use timespec64 in inode auxdata nfs: fix timstamp debug prints nfs: use time64_t internally sunrpc: convert to time64_t for expiry drm/etnaviv: avoid deprecated timespec drm/etnaviv: reject timeouts with tv_nsec >= NSEC_PER_SEC drm/msm: avoid using 'timespec' hfs/hfsplus: use 64-bit inode timestamps hostfs: pass 64-bit timestamps to/from user space packet: clarify timestamp overflow tsacct: add 64-bit btime field acct: stop using get_seconds() um: ubd: use 64-bit time_t where possible xtensa: ISS: avoid struct timeval dlm: use SO_SNDTIMEO_NEW instead of SO_SNDTIMEO_OLD ...

Linus Torvalds committed 6 years ago

Commit 22b17db2 parents a4fe2b4 c4e712149 files · +283 −266Browse files

Showing the changes to include/linux (5 of 49 files). Show all

Unified · Split

5 files
  1. include/linux/jiffies.h +0 −20
  2. include/linux/sunrpc/cache.h +23 −19
  3. include/linux/sunrpc/gss_api.h +2 −2
  4. include/linux/sunrpc/gss_krb5.h +1 −1
  5. include/linux/syscalls.h +4 −5
include/linux/jiffies.h+0−20
@@ -422,26 +422,6 @@ static __always_inline unsigned long usecs_to_jiffies(const unsigned int u) · 421 unmodified lines
422extern unsigned long timespec64_to_jiffies(const struct timespec64 *value);422extern unsigned long timespec64_to_jiffies(const struct timespec64 *value);
423extern void jiffies_to_timespec64(const unsigned long jiffies,423extern void jiffies_to_timespec64(const unsigned long jiffies,
424 struct timespec64 *value);424 struct timespec64 *value);
425static inline unsigned long timespec_to_jiffies(const struct timespec *value)
426{
427 struct timespec64 ts = timespec_to_timespec64(*value);
428
429 return timespec64_to_jiffies(&ts);
430}
431
432static inline void jiffies_to_timespec(const unsigned long jiffies,
433 struct timespec *value)
434{
435 struct timespec64 ts;
436
437 jiffies_to_timespec64(jiffies, &ts);
438 *value = timespec64_to_timespec(ts);
439}
440
441extern unsigned long timeval_to_jiffies(const struct timeval *value);
442extern void jiffies_to_timeval(const unsigned long jiffies,
443 struct timeval *value);
444
445extern clock_t jiffies_to_clock_t(unsigned long x);425extern clock_t jiffies_to_clock_t(unsigned long x);
446static inline clock_t jiffies_delta_to_clock_t(long delta)426static inline clock_t jiffies_delta_to_clock_t(long delta)
447{427{
include/linux/sunrpc/cache.h+23−19
@@ -45,8 +45,8 @@ · 44 unmodified lines
45 */45 */
46struct cache_head {46struct cache_head {
47 struct hlist_node cache_list;47 struct hlist_node cache_list;
48 time_t expiry_time; /* After time time, don't use the data */48 time64_t expiry_time; /* After time time, don't use the data */
49 time_t last_refresh; /* If CACHE_PENDING, this is when upcall was49 time64_t last_refresh; /* If CACHE_PENDING, this is when upcall was
50 * sent, else this is when update was50 * sent, else this is when update was
51 * received, though it is alway set to51 * received, though it is alway set to
52 * be *after* ->flush_time.52 * be *after* ->flush_time.
@@ -95,22 +95,22 @@ struct cache_detail { · 42 unmodified lines
95 /* fields below this comment are for internal use95 /* fields below this comment are for internal use
96 * and should not be touched by cache owners96 * and should not be touched by cache owners
97 */97 */
98 time_t flush_time; /* flush all cache items with98 time64_t flush_time; /* flush all cache items with
99 * last_refresh at or earlier99 * last_refresh at or earlier
100 * than this. last_refresh100 * than this. last_refresh
101 * is never set at or earlier101 * is never set at or earlier
102 * than this.102 * than this.
103 */103 */
104 struct list_head others;104 struct list_head others;
105 time_t nextcheck;105 time64_t nextcheck;
106 int entries;106 int entries;
107 107
108 /* fields for communication over channel */108 /* fields for communication over channel */
109 struct list_head queue;109 struct list_head queue;
110 110
111 atomic_t writers; /* how many time is /channel open */111 atomic_t writers; /* how many time is /channel open */
112 time_t last_close; /* if no writers, when did last close */112 time64_t last_close; /* if no writers, when did last close */
113 time_t last_warn; /* when we last warned about no writers */113 time64_t last_warn; /* when we last warned about no writers */
114 114
115 union {115 union {
116 struct proc_dir_entry *procfs;116 struct proc_dir_entry *procfs;
@@ -147,18 +147,22 @@ struct cache_deferred_req { · 30 unmodified lines
147 * timestamps kept in the cache are expressed in seconds147 * timestamps kept in the cache are expressed in seconds
148 * since boot. This is the best for measuring differences in148 * since boot. This is the best for measuring differences in
149 * real time.149 * real time.
150 * This reimplemnts ktime_get_boottime_seconds() in a slightly
151 * faster but less accurate way. When we end up converting
152 * back to wallclock (CLOCK_REALTIME), that error often
153 * cancels out during the reverse operation.
150 */154 */
151static inline time_t seconds_since_boot(void)155static inline time64_t seconds_since_boot(void)
152{156{
153 struct timespec boot;157 struct timespec64 boot;
154 getboottime(&boot);158 getboottime64(&boot);
155 return get_seconds() - boot.tv_sec;159 return ktime_get_real_seconds() - boot.tv_sec;
156}160}
157 161
158static inline time_t convert_to_wallclock(time_t sinceboot)162static inline time64_t convert_to_wallclock(time64_t sinceboot)
159{163{
160 struct timespec boot;164 struct timespec64 boot;
161 getboottime(&boot);165 getboottime64(&boot);
162 return boot.tv_sec + sinceboot;166 return boot.tv_sec + sinceboot;
163}167}
164 168
@@ -273,7 +277,7 @@ static inline int get_uint(char **bpp, unsigned int *anint) · 108 unmodified lines
273 return 0;277 return 0;
274}278}
275 279
276static inline int get_time(char **bpp, time_t *time)280static inline int get_time(char **bpp, time64_t *time)
277{281{
278 char buf[50];282 char buf[50];
279 long long ll;283 long long ll;
@@ -287,20 +291,20 @@ static inline int get_time(char **bpp, time_t *time) · 7 unmodified lines
287 if (kstrtoll(buf, 0, &ll))291 if (kstrtoll(buf, 0, &ll))
288 return -EINVAL;292 return -EINVAL;
289 293
290 *time = (time_t)ll;294 *time = ll;
291 return 0;295 return 0;
292}296}
293 297
294static inline time_t get_expiry(char **bpp)298static inline time64_t get_expiry(char **bpp)
295{299{
296 time_t rv;300 time64_t rv;
297 struct timespec boot;301 struct timespec64 boot;
298 302
299 if (get_time(bpp, &rv))303 if (get_time(bpp, &rv))
300 return 0;304 return 0;
301 if (rv < 0)305 if (rv < 0)
302 return 0;306 return 0;
303 getboottime(&boot);307 getboottime64(&boot);
304 return rv - boot.tv_sec;308 return rv - boot.tv_sec;
305}309}
306 310
include/linux/sunrpc/gss_api.h+2−2
@@ -48,7 +48,7 @@ int gss_import_sec_context( · 47 unmodified lines
48 size_t bufsize,48 size_t bufsize,
49 struct gss_api_mech *mech,49 struct gss_api_mech *mech,
50 struct gss_ctx **ctx_id,50 struct gss_ctx **ctx_id,
51 time_t *endtime,51 time64_t *endtime,
52 gfp_t gfp_mask);52 gfp_t gfp_mask);
53u32 gss_get_mic(53u32 gss_get_mic(
54 struct gss_ctx *ctx_id,54 struct gss_ctx *ctx_id,
@@ -108,7 +108,7 @@ struct gss_api_ops { · 53 unmodified lines
108 const void *input_token,108 const void *input_token,
109 size_t bufsize,109 size_t bufsize,
110 struct gss_ctx *ctx_id,110 struct gss_ctx *ctx_id,
111 time_t *endtime,111 time64_t *endtime,
112 gfp_t gfp_mask);112 gfp_t gfp_mask);
113 u32 (*gss_get_mic)(113 u32 (*gss_get_mic)(
114 struct gss_ctx *ctx_id,114 struct gss_ctx *ctx_id,
include/linux/sunrpc/gss_krb5.h+1−1
@@ -106,9 +106,9 @@ struct krb5_ctx { · 105 unmodified lines
106 struct crypto_sync_skcipher *initiator_enc_aux;106 struct crypto_sync_skcipher *initiator_enc_aux;
107 u8 Ksess[GSS_KRB5_MAX_KEYLEN]; /* session key */107 u8 Ksess[GSS_KRB5_MAX_KEYLEN]; /* session key */
108 u8 cksum[GSS_KRB5_MAX_KEYLEN];108 u8 cksum[GSS_KRB5_MAX_KEYLEN];
109 s32 endtime;
110 atomic_t seq_send;109 atomic_t seq_send;
111 atomic64_t seq_send64;110 atomic64_t seq_send64;
111 time64_t endtime;
112 struct xdr_netobj mech_used;112 struct xdr_netobj mech_used;
113 u8 initiator_sign[GSS_KRB5_MAX_KEYLEN];113 u8 initiator_sign[GSS_KRB5_MAX_KEYLEN];
114 u8 acceptor_sign[GSS_KRB5_MAX_KEYLEN];114 u8 acceptor_sign[GSS_KRB5_MAX_KEYLEN];
include/linux/syscalls.h+4−5
@@ -16,8 +16,7 @@ struct inode; · 15 unmodified lines
16struct iocb;16struct iocb;
17struct io_event;17struct io_event;
18struct iovec;18struct iovec;
19struct itimerspec;19struct __kernel_old_itimerval;
20struct itimerval;
21struct kexec_segment;20struct kexec_segment;
22struct linux_dirent;21struct linux_dirent;
23struct linux_dirent64;22struct linux_dirent64;
@@ -594,10 +593,10 @@ asmlinkage long sys_nanosleep_time32(struct old_timespec32 __user *rqtp, · 570 unmodified lines
594 struct old_timespec32 __user *rmtp);593 struct old_timespec32 __user *rmtp);
595 594
596/* kernel/itimer.c */595/* kernel/itimer.c */
597asmlinkage long sys_getitimer(int which, struct itimerval __user *value);596asmlinkage long sys_getitimer(int which, struct __kernel_old_itimerval __user *value);
598asmlinkage long sys_setitimer(int which,597asmlinkage long sys_setitimer(int which,
599 struct itimerval __user *value,598 struct __kernel_old_itimerval __user *value,
600 struct itimerval __user *ovalue);599 struct __kernel_old_itimerval __user *ovalue);
601 600
602/* kernel/kexec.c */601/* kernel/kexec.c */
603asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,602asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,