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
422422 extern unsigned long timespec64_to_jiffies(const struct timespec64 *value);
423423 extern void jiffies_to_timespec64(const unsigned long jiffies,
424424 struct timespec64 *value);
425−static 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−
432−static 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−
441−extern unsigned long timeval_to_jiffies(const struct timeval *value);
442−extern void jiffies_to_timeval(const unsigned long jiffies,
443− struct timeval *value);
444−
445425 extern clock_t jiffies_to_clock_t(unsigned long x);
446426 static inline clock_t jiffies_delta_to_clock_t(long delta)
447427 {
include/linux/sunrpc/cache.h+23−19
@@ -45,8 +45,8 @@ · 44 unmodified lines
4545 */
4646 struct cache_head {
4747 struct hlist_node cache_list;
48− time_t expiry_time; /* After time time, don't use the data */
49− time_t last_refresh; /* If CACHE_PENDING, this is when upcall was
48+ time64_t expiry_time; /* After time time, don't use the data */
49+ time64_t last_refresh; /* If CACHE_PENDING, this is when upcall was
5050 * sent, else this is when update was
5151 * received, though it is alway set to
5252 * be *after* ->flush_time.
@@ -95,22 +95,22 @@ struct cache_detail { · 42 unmodified lines
9595 /* fields below this comment are for internal use
9696 * and should not be touched by cache owners
9797 */
98− time_t flush_time; /* flush all cache items with
98+ time64_t flush_time; /* flush all cache items with
9999 * last_refresh at or earlier
100100 * than this. last_refresh
101101 * is never set at or earlier
102102 * than this.
103103 */
104104 struct list_head others;
105− time_t nextcheck;
105+ time64_t nextcheck;
106106 int entries;
107107
108108 /* fields for communication over channel */
109109 struct list_head queue;
110110
111111 atomic_t writers; /* how many time is /channel open */
112− time_t last_close; /* if no writers, when did last close */
113− time_t last_warn; /* when we last warned about no writers */
112+ time64_t last_close; /* if no writers, when did last close */
113+ time64_t last_warn; /* when we last warned about no writers */
114114
115115 union {
116116 struct proc_dir_entry *procfs;
@@ -147,18 +147,22 @@ struct cache_deferred_req { · 30 unmodified lines
147147 * timestamps kept in the cache are expressed in seconds
148148 * since boot. This is the best for measuring differences in
149149 * 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.
150154 */
151−static inline time_t seconds_since_boot(void)
155+static inline time64_t seconds_since_boot(void)
152156 {
153− struct timespec boot;
154− getboottime(&boot);
155− return get_seconds() - boot.tv_sec;
157+ struct timespec64 boot;
158+ getboottime64(&boot);
159+ return ktime_get_real_seconds() - boot.tv_sec;
156160 }
157161
158−static inline time_t convert_to_wallclock(time_t sinceboot)
162+static inline time64_t convert_to_wallclock(time64_t sinceboot)
159163 {
160− struct timespec boot;
161− getboottime(&boot);
164+ struct timespec64 boot;
165+ getboottime64(&boot);
162166 return boot.tv_sec + sinceboot;
163167 }
164168
@@ -273,7 +277,7 @@ static inline int get_uint(char **bpp, unsigned int *anint) · 108 unmodified lines
273277 return 0;
274278 }
275279
276−static inline int get_time(char **bpp, time_t *time)
280+static inline int get_time(char **bpp, time64_t *time)
277281 {
278282 char buf[50];
279283 long long ll;
@@ -287,20 +291,20 @@ static inline int get_time(char **bpp, time_t *time) · 7 unmodified lines
287291 if (kstrtoll(buf, 0, &ll))
288292 return -EINVAL;
289293
290− *time = (time_t)ll;
294+ *time = ll;
291295 return 0;
292296 }
293297
294−static inline time_t get_expiry(char **bpp)
298+static inline time64_t get_expiry(char **bpp)
295299 {
296− time_t rv;
297− struct timespec boot;
300+ time64_t rv;
301+ struct timespec64 boot;
298302
299303 if (get_time(bpp, &rv))
300304 return 0;
301305 if (rv < 0)
302306 return 0;
303− getboottime(&boot);
307+ getboottime64(&boot);
304308 return rv - boot.tv_sec;
305309 }
306310
include/linux/sunrpc/gss_api.h+2−2
@@ -48,7 +48,7 @@ int gss_import_sec_context( · 47 unmodified lines
4848 size_t bufsize,
4949 struct gss_api_mech *mech,
5050 struct gss_ctx **ctx_id,
51− time_t *endtime,
51+ time64_t *endtime,
5252 gfp_t gfp_mask);
5353 u32 gss_get_mic(
5454 struct gss_ctx *ctx_id,
@@ -108,7 +108,7 @@ struct gss_api_ops { · 53 unmodified lines
108108 const void *input_token,
109109 size_t bufsize,
110110 struct gss_ctx *ctx_id,
111− time_t *endtime,
111+ time64_t *endtime,
112112 gfp_t gfp_mask);
113113 u32 (*gss_get_mic)(
114114 struct gss_ctx *ctx_id,
include/linux/sunrpc/gss_krb5.h+1−1
@@ -106,9 +106,9 @@ struct krb5_ctx { · 105 unmodified lines
106106 struct crypto_sync_skcipher *initiator_enc_aux;
107107 u8 Ksess[GSS_KRB5_MAX_KEYLEN]; /* session key */
108108 u8 cksum[GSS_KRB5_MAX_KEYLEN];
109− s32 endtime;
110109 atomic_t seq_send;
111110 atomic64_t seq_send64;
111+ time64_t endtime;
112112 struct xdr_netobj mech_used;
113113 u8 initiator_sign[GSS_KRB5_MAX_KEYLEN];
114114 u8 acceptor_sign[GSS_KRB5_MAX_KEYLEN];
include/linux/syscalls.h+4−5
@@ -16,8 +16,7 @@ struct inode; · 15 unmodified lines
1616 struct iocb;
1717 struct io_event;
1818 struct iovec;
19−struct itimerspec;
20−struct itimerval;
19+struct __kernel_old_itimerval;
2120 struct kexec_segment;
2221 struct linux_dirent;
2322 struct linux_dirent64;
@@ -594,10 +593,10 @@ asmlinkage long sys_nanosleep_time32(struct old_timespec32 __user *rqtp, · 570 unmodified lines
594593 struct old_timespec32 __user *rmtp);
595594
596595 /* kernel/itimer.c */
597−asmlinkage long sys_getitimer(int which, struct itimerval __user *value);
596+asmlinkage long sys_getitimer(int which, struct __kernel_old_itimerval __user *value);
598597 asmlinkage long sys_setitimer(int which,
599− struct itimerval __user *value,
600− struct itimerval __user *ovalue);
598+ struct __kernel_old_itimerval __user *value,
599+ struct __kernel_old_itimerval __user *ovalue);
601600
602601 /* kernel/kexec.c */
603602 asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,