Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

y2038: globally rename compat_time to old_time32

Christoph Hellwig suggested a slightly different path for handling
backwards compatibility with the 32-bit time_t based system calls:

Rather than simply reusing the compat_sys_* entry points on 32-bit
architectures unchanged, we get rid of those entry points and the
compat_time types by renaming them to something that makes more sense
on 32-bit architectures (which don't have a compat mode otherwise),
and then share the entry points under the new name with the 64-bit
architectures that use them for implementing the compatibility.

The following types and interfaces are renamed here, and moved
from linux/compat_time.h to linux/time32.h:

old new
--- ---
compat_time_t old_time32_t
struct compat_timeval struct old_timeval32
struct compat_timespec struct old_timespec32
struct compat_itimerspec struct old_itimerspec32
ns_to_compat_timeval() ns_to_old_timeval32()
get_compat_itimerspec64() get_old_itimerspec32()
put_compat_itimerspec64() put_old_itimerspec32()
compat_get_timespec64() get_old_timespec32()
compat_put_timespec64() put_old_timespec32()

As we already have aliases in place, this patch addresses only the
instances that are relevant to the system call interface in particular,
not those that occur in device drivers and other modules. Those
will get handled separately, while providing the 64-bit version
of the respective interfaces.

I'm not renaming the timex, rusage and itimerval structures, as we are
still debating what the new interface will look like, and whether we
will need a replacement at all.

This also doesn't change the names of the syscall entry points, which can
be done more easily when we actually switch over the 32-bit architectures
to use them, at that point we need to change COMPAT_SYSCALL_DEFINEx to
SYSCALL_DEFINEx with a new name, e.g. with a _time32 suffix.

Suggested-by: Christoph Hellwig <hch@infradead.org>
Link: https://lore.kernel.org/lkml/20180705222110.GA5698@infradead.org/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+237 -245
+3 -3
arch/arm64/include/asm/compat.h
··· 86 86 compat_off_t st_size; 87 87 compat_off_t st_blksize; 88 88 compat_off_t st_blocks; 89 - compat_time_t st_atime; 89 + old_time32_t st_atime; 90 90 compat_ulong_t st_atime_nsec; 91 - compat_time_t st_mtime; 91 + old_time32_t st_mtime; 92 92 compat_ulong_t st_mtime_nsec; 93 - compat_time_t st_ctime; 93 + old_time32_t st_ctime; 94 94 compat_ulong_t st_ctime_nsec; 95 95 compat_ulong_t __unused4[2]; 96 96 };
+1 -1
arch/arm64/include/asm/stat.h
··· 20 20 21 21 #ifdef CONFIG_COMPAT 22 22 23 - #include <linux/compat_time.h> 23 + #include <linux/time.h> 24 24 #include <asm/compat.h> 25 25 26 26 /*
+3 -3
arch/mips/include/asm/compat.h
··· 59 59 s32 st_pad2[2]; 60 60 compat_off_t st_size; 61 61 s32 st_pad3; 62 - compat_time_t st_atime; 62 + old_time32_t st_atime; 63 63 s32 st_atime_nsec; 64 - compat_time_t st_mtime; 64 + old_time32_t st_mtime; 65 65 s32 st_mtime_nsec; 66 - compat_time_t st_ctime; 66 + old_time32_t st_ctime; 67 67 s32 st_ctime_nsec; 68 68 s32 st_blksize; 69 69 s32 st_blocks;
+7 -7
arch/mips/kernel/binfmt_elfn32.c
··· 54 54 pid_t pr_ppid; 55 55 pid_t pr_pgrp; 56 56 pid_t pr_sid; 57 - struct compat_timeval pr_utime; /* User time */ 58 - struct compat_timeval pr_stime; /* System time */ 59 - struct compat_timeval pr_cutime;/* Cumulative user time */ 60 - struct compat_timeval pr_cstime;/* Cumulative system time */ 57 + struct old_timeval32 pr_utime; /* User time */ 58 + struct old_timeval32 pr_stime; /* System time */ 59 + struct old_timeval32 pr_cutime;/* Cumulative user time */ 60 + struct old_timeval32 pr_cstime;/* Cumulative system time */ 61 61 elf_gregset_t pr_reg; /* GP registers */ 62 62 int pr_fpvalid; /* True if math co-processor being used. */ 63 63 }; ··· 81 81 #define elf_caddr_t u32 82 82 #define init_elf_binfmt init_elfn32_binfmt 83 83 84 - #define jiffies_to_timeval jiffies_to_compat_timeval 84 + #define jiffies_to_timeval jiffies_to_old_timeval32 85 85 static __inline__ void 86 - jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) 86 + jiffies_to_old_timeval32(unsigned long jiffies, struct old_timeval32 *value) 87 87 { 88 88 /* 89 89 * Convert jiffies to nanoseconds and separate with ··· 101 101 #define TASK_SIZE TASK_SIZE32 102 102 103 103 #undef ns_to_timeval 104 - #define ns_to_timeval ns_to_compat_timeval 104 + #define ns_to_timeval ns_to_old_timeval32 105 105 106 106 #include "../../../fs/binfmt_elf.c"
+7 -7
arch/mips/kernel/binfmt_elfo32.c
··· 59 59 pid_t pr_ppid; 60 60 pid_t pr_pgrp; 61 61 pid_t pr_sid; 62 - struct compat_timeval pr_utime; /* User time */ 63 - struct compat_timeval pr_stime; /* System time */ 64 - struct compat_timeval pr_cutime;/* Cumulative user time */ 65 - struct compat_timeval pr_cstime;/* Cumulative system time */ 62 + struct old_timeval32 pr_utime; /* User time */ 63 + struct old_timeval32 pr_stime; /* System time */ 64 + struct old_timeval32 pr_cutime;/* Cumulative user time */ 65 + struct old_timeval32 pr_cstime;/* Cumulative system time */ 66 66 elf_gregset_t pr_reg; /* GP registers */ 67 67 int pr_fpvalid; /* True if math co-processor being used. */ 68 68 }; ··· 86 86 #define elf_caddr_t u32 87 87 #define init_elf_binfmt init_elf32_binfmt 88 88 89 - #define jiffies_to_timeval jiffies_to_compat_timeval 89 + #define jiffies_to_timeval jiffies_to_old_timeval32 90 90 static inline void 91 - jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) 91 + jiffies_to_old_timeval32(unsigned long jiffies, struct old_timeval32 *value) 92 92 { 93 93 /* 94 94 * Convert jiffies to nanoseconds and separate with ··· 104 104 #define TASK_SIZE TASK_SIZE32 105 105 106 106 #undef ns_to_timeval 107 - #define ns_to_timeval ns_to_compat_timeval 107 + #define ns_to_timeval ns_to_old_timeval32 108 108 109 109 #include "../../../fs/binfmt_elf.c"
+3 -3
arch/parisc/include/asm/compat.h
··· 48 48 u16 st_reserved2; /* old st_gid */ 49 49 compat_dev_t st_rdev; 50 50 compat_off_t st_size; 51 - compat_time_t st_atime; 51 + old_time32_t st_atime; 52 52 u32 st_atime_nsec; 53 - compat_time_t st_mtime; 53 + old_time32_t st_mtime; 54 54 u32 st_mtime_nsec; 55 - compat_time_t st_ctime; 55 + old_time32_t st_ctime; 56 56 u32 st_ctime_nsec; 57 57 s32 st_blksize; 58 58 s32 st_blocks;
+3 -3
arch/powerpc/include/asm/compat.h
··· 55 55 compat_off_t st_size; 56 56 compat_off_t st_blksize; 57 57 compat_off_t st_blocks; 58 - compat_time_t st_atime; 58 + old_time32_t st_atime; 59 59 u32 st_atime_nsec; 60 - compat_time_t st_mtime; 60 + old_time32_t st_mtime; 61 61 u32 st_mtime_nsec; 62 - compat_time_t st_ctime; 62 + old_time32_t st_ctime; 63 63 u32 st_ctime_nsec; 64 64 u32 __unused4[2]; 65 65 };
+4 -4
arch/powerpc/kernel/asm-offsets.c
··· 387 387 OFFSET(CFG_SYSCALL_MAP64, vdso_data, syscall_map_64); 388 388 OFFSET(TVAL64_TV_SEC, timeval, tv_sec); 389 389 OFFSET(TVAL64_TV_USEC, timeval, tv_usec); 390 - OFFSET(TVAL32_TV_SEC, compat_timeval, tv_sec); 391 - OFFSET(TVAL32_TV_USEC, compat_timeval, tv_usec); 390 + OFFSET(TVAL32_TV_SEC, old_timeval32, tv_sec); 391 + OFFSET(TVAL32_TV_USEC, old_timeval32, tv_usec); 392 392 OFFSET(TSPC64_TV_SEC, timespec, tv_sec); 393 393 OFFSET(TSPC64_TV_NSEC, timespec, tv_nsec); 394 - OFFSET(TSPC32_TV_SEC, compat_timespec, tv_sec); 395 - OFFSET(TSPC32_TV_NSEC, compat_timespec, tv_nsec); 394 + OFFSET(TSPC32_TV_SEC, old_timespec32, tv_sec); 395 + OFFSET(TSPC32_TV_NSEC, old_timespec32, tv_nsec); 396 396 #else 397 397 OFFSET(TVAL32_TV_SEC, timeval, tv_sec); 398 398 OFFSET(TVAL32_TV_USEC, timeval, tv_usec);
+1 -1
arch/powerpc/oprofile/backtrace.c
··· 7 7 * 2 of the License, or (at your option) any later version. 8 8 **/ 9 9 10 - #include <linux/compat_time.h> 10 + #include <linux/time.h> 11 11 #include <linux/oprofile.h> 12 12 #include <linux/sched.h> 13 13 #include <asm/processor.h>
+3 -3
arch/sparc/include/asm/compat.h
··· 47 47 __compat_gid_t st_gid; 48 48 compat_dev_t st_rdev; 49 49 compat_off_t st_size; 50 - compat_time_t st_atime; 50 + old_time32_t st_atime; 51 51 compat_ulong_t st_atime_nsec; 52 - compat_time_t st_mtime; 52 + old_time32_t st_mtime; 53 53 compat_ulong_t st_mtime_nsec; 54 - compat_time_t st_ctime; 54 + old_time32_t st_ctime; 55 55 compat_ulong_t st_ctime_nsec; 56 56 compat_off_t st_blksize; 57 57 compat_off_t st_blocks;
+4 -4
fs/aio.c
··· 2135 2135 compat_long_t, min_nr, 2136 2136 compat_long_t, nr, 2137 2137 struct io_event __user *, events, 2138 - struct compat_timespec __user *, timeout) 2138 + struct old_timespec32 __user *, timeout) 2139 2139 { 2140 2140 struct timespec64 t; 2141 2141 int ret; 2142 2142 2143 - if (timeout && compat_get_timespec64(&t, timeout)) 2143 + if (timeout && get_old_timespec32(&t, timeout)) 2144 2144 return -EFAULT; 2145 2145 2146 2146 ret = do_io_getevents(ctx_id, min_nr, nr, events, timeout ? &t : NULL); ··· 2160 2160 compat_long_t, min_nr, 2161 2161 compat_long_t, nr, 2162 2162 struct io_event __user *, events, 2163 - struct compat_timespec __user *, timeout, 2163 + struct old_timespec32 __user *, timeout, 2164 2164 const struct __compat_aio_sigset __user *, usig) 2165 2165 { 2166 2166 struct __compat_aio_sigset ksig = { NULL, }; ··· 2168 2168 struct timespec64 t; 2169 2169 int ret; 2170 2170 2171 - if (timeout && compat_get_timespec64(&t, timeout)) 2171 + if (timeout && get_old_timespec32(&t, timeout)) 2172 2172 return -EFAULT; 2173 2173 2174 2174 if (usig && copy_from_user(&ksig, usig, sizeof(ksig)))
+1 -1
fs/compat_binfmt_elf.c
··· 52 52 #define elf_prpsinfo compat_elf_prpsinfo 53 53 54 54 #undef ns_to_timeval 55 - #define ns_to_timeval ns_to_compat_timeval 55 + #define ns_to_timeval ns_to_old_timeval32 56 56 57 57 /* 58 58 * To use this file, asm/elf.h must define compat_elf_check_arch.
+10 -10
fs/select.c
··· 1120 1120 ts.tv_sec = ts.tv_nsec = 0; 1121 1121 1122 1122 if (timeval) { 1123 - struct compat_timeval rtv; 1123 + struct old_timeval32 rtv; 1124 1124 1125 1125 rtv.tv_sec = ts.tv_sec; 1126 1126 rtv.tv_usec = ts.tv_nsec / NSEC_PER_USEC; ··· 1128 1128 if (!copy_to_user(p, &rtv, sizeof(rtv))) 1129 1129 return ret; 1130 1130 } else { 1131 - if (!compat_put_timespec64(&ts, p)) 1131 + if (!put_old_timespec32(&ts, p)) 1132 1132 return ret; 1133 1133 } 1134 1134 /* ··· 1257 1257 1258 1258 static int do_compat_select(int n, compat_ulong_t __user *inp, 1259 1259 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 1260 - struct compat_timeval __user *tvp) 1260 + struct old_timeval32 __user *tvp) 1261 1261 { 1262 1262 struct timespec64 end_time, *to = NULL; 1263 - struct compat_timeval tv; 1263 + struct old_timeval32 tv; 1264 1264 int ret; 1265 1265 1266 1266 if (tvp) { ··· 1282 1282 1283 1283 COMPAT_SYSCALL_DEFINE5(select, int, n, compat_ulong_t __user *, inp, 1284 1284 compat_ulong_t __user *, outp, compat_ulong_t __user *, exp, 1285 - struct compat_timeval __user *, tvp) 1285 + struct old_timeval32 __user *, tvp) 1286 1286 { 1287 1287 return do_compat_select(n, inp, outp, exp, tvp); 1288 1288 } ··· 1307 1307 1308 1308 static long do_compat_pselect(int n, compat_ulong_t __user *inp, 1309 1309 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 1310 - struct compat_timespec __user *tsp, compat_sigset_t __user *sigmask, 1310 + struct old_timespec32 __user *tsp, compat_sigset_t __user *sigmask, 1311 1311 compat_size_t sigsetsize) 1312 1312 { 1313 1313 sigset_t ksigmask, sigsaved; ··· 1315 1315 int ret; 1316 1316 1317 1317 if (tsp) { 1318 - if (compat_get_timespec64(&ts, tsp)) 1318 + if (get_old_timespec32(&ts, tsp)) 1319 1319 return -EFAULT; 1320 1320 1321 1321 to = &end_time; ··· 1355 1355 1356 1356 COMPAT_SYSCALL_DEFINE6(pselect6, int, n, compat_ulong_t __user *, inp, 1357 1357 compat_ulong_t __user *, outp, compat_ulong_t __user *, exp, 1358 - struct compat_timespec __user *, tsp, void __user *, sig) 1358 + struct old_timespec32 __user *, tsp, void __user *, sig) 1359 1359 { 1360 1360 compat_size_t sigsetsize = 0; 1361 1361 compat_uptr_t up = 0; ··· 1373 1373 } 1374 1374 1375 1375 COMPAT_SYSCALL_DEFINE5(ppoll, struct pollfd __user *, ufds, 1376 - unsigned int, nfds, struct compat_timespec __user *, tsp, 1376 + unsigned int, nfds, struct old_timespec32 __user *, tsp, 1377 1377 const compat_sigset_t __user *, sigmask, compat_size_t, sigsetsize) 1378 1378 { 1379 1379 sigset_t ksigmask, sigsaved; ··· 1381 1381 int ret; 1382 1382 1383 1383 if (tsp) { 1384 - if (compat_get_timespec64(&ts, tsp)) 1384 + if (get_old_timespec32(&ts, tsp)) 1385 1385 return -EFAULT; 1386 1386 1387 1387 to = &end_time;
+6 -6
fs/timerfd.c
··· 561 561 562 562 #ifdef CONFIG_COMPAT_32BIT_TIME 563 563 COMPAT_SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, 564 - const struct compat_itimerspec __user *, utmr, 565 - struct compat_itimerspec __user *, otmr) 564 + const struct old_itimerspec32 __user *, utmr, 565 + struct old_itimerspec32 __user *, otmr) 566 566 { 567 567 struct itimerspec64 new, old; 568 568 int ret; 569 569 570 - if (get_compat_itimerspec64(&new, utmr)) 570 + if (get_old_itimerspec32(&new, utmr)) 571 571 return -EFAULT; 572 572 ret = do_timerfd_settime(ufd, flags, &new, &old); 573 573 if (ret) 574 574 return ret; 575 - if (otmr && put_compat_itimerspec64(&old, otmr)) 575 + if (otmr && put_old_itimerspec32(&old, otmr)) 576 576 return -EFAULT; 577 577 return ret; 578 578 } 579 579 580 580 COMPAT_SYSCALL_DEFINE2(timerfd_gettime, int, ufd, 581 - struct compat_itimerspec __user *, otmr) 581 + struct old_itimerspec32 __user *, otmr) 582 582 { 583 583 struct itimerspec64 kotmr; 584 584 int ret = do_timerfd_gettime(ufd, &kotmr); 585 585 if (ret) 586 586 return ret; 587 - return put_compat_itimerspec64(&kotmr, otmr) ? -EFAULT : 0; 587 + return put_old_itimerspec32(&kotmr, otmr) ? -EFAULT : 0; 588 588 } 589 589 #endif
+6 -6
fs/utimes.c
··· 245 245 return do_utimes(AT_FDCWD, filename, t ? tv : NULL, 0); 246 246 } 247 247 248 - COMPAT_SYSCALL_DEFINE4(utimensat, unsigned int, dfd, const char __user *, filename, struct compat_timespec __user *, t, int, flags) 248 + COMPAT_SYSCALL_DEFINE4(utimensat, unsigned int, dfd, const char __user *, filename, struct old_timespec32 __user *, t, int, flags) 249 249 { 250 250 struct timespec64 tv[2]; 251 251 252 252 if (t) { 253 - if (compat_get_timespec64(&tv[0], &t[0]) || 254 - compat_get_timespec64(&tv[1], &t[1])) 253 + if (get_old_timespec32(&tv[0], &t[0]) || 254 + get_old_timespec32(&tv[1], &t[1])) 255 255 return -EFAULT; 256 256 257 257 if (tv[0].tv_nsec == UTIME_OMIT && tv[1].tv_nsec == UTIME_OMIT) ··· 261 261 } 262 262 263 263 static long do_compat_futimesat(unsigned int dfd, const char __user *filename, 264 - struct compat_timeval __user *t) 264 + struct old_timeval32 __user *t) 265 265 { 266 266 struct timespec64 tv[2]; 267 267 ··· 282 282 283 283 COMPAT_SYSCALL_DEFINE3(futimesat, unsigned int, dfd, 284 284 const char __user *, filename, 285 - struct compat_timeval __user *, t) 285 + struct old_timeval32 __user *, t) 286 286 { 287 287 return do_compat_futimesat(dfd, filename, t); 288 288 } 289 289 290 - COMPAT_SYSCALL_DEFINE2(utimes, const char __user *, filename, struct compat_timeval __user *, t) 290 + COMPAT_SYSCALL_DEFINE2(utimes, const char __user *, filename, struct old_timeval32 __user *, t) 291 291 { 292 292 return do_compat_futimesat(AT_FDCWD, filename, t); 293 293 }
+48 -48
include/linux/compat.h
··· 7 7 */ 8 8 9 9 #include <linux/types.h> 10 - #include <linux/compat_time.h> 10 + #include <linux/time.h> 11 11 12 12 #include <linux/stat.h> 13 13 #include <linux/param.h> /* for HZ */ ··· 116 116 struct rusage; 117 117 118 118 struct compat_utimbuf { 119 - compat_time_t actime; 120 - compat_time_t modtime; 119 + old_time32_t actime; 120 + old_time32_t modtime; 121 121 }; 122 122 123 123 struct compat_itimerval { 124 - struct compat_timeval it_interval; 125 - struct compat_timeval it_value; 124 + struct old_timeval32 it_interval; 125 + struct old_timeval32 it_value; 126 126 }; 127 127 128 128 struct itimerval; ··· 146 146 compat_long_t constant; 147 147 compat_long_t precision; 148 148 compat_long_t tolerance; 149 - struct compat_timeval time; 149 + struct old_timeval32 time; 150 150 compat_long_t tick; 151 151 compat_long_t ppsfreq; 152 152 compat_long_t jitter; ··· 307 307 }; 308 308 309 309 struct compat_rusage { 310 - struct compat_timeval ru_utime; 311 - struct compat_timeval ru_stime; 310 + struct old_timeval32 ru_utime; 311 + struct old_timeval32 ru_stime; 312 312 compat_long_t ru_maxrss; 313 313 compat_long_t ru_ixrss; 314 314 compat_long_t ru_idrss; ··· 457 457 int get_compat_sigevent(struct sigevent *event, 458 458 const struct compat_sigevent __user *u_event); 459 459 460 - static inline int compat_timeval_compare(struct compat_timeval *lhs, 461 - struct compat_timeval *rhs) 460 + static inline int old_timeval32_compare(struct old_timeval32 *lhs, 461 + struct old_timeval32 *rhs) 462 462 { 463 463 if (lhs->tv_sec < rhs->tv_sec) 464 464 return -1; ··· 467 467 return lhs->tv_usec - rhs->tv_usec; 468 468 } 469 469 470 - static inline int compat_timespec_compare(struct compat_timespec *lhs, 471 - struct compat_timespec *rhs) 470 + static inline int old_timespec32_compare(struct old_timespec32 *lhs, 471 + struct old_timespec32 *rhs) 472 472 { 473 473 if (lhs->tv_sec < rhs->tv_sec) 474 474 return -1; ··· 552 552 compat_long_t min_nr, 553 553 compat_long_t nr, 554 554 struct io_event __user *events, 555 - struct compat_timespec __user *timeout); 555 + struct old_timespec32 __user *timeout); 556 556 asmlinkage long compat_sys_io_pgetevents(compat_aio_context_t ctx_id, 557 557 compat_long_t min_nr, 558 558 compat_long_t nr, 559 559 struct io_event __user *events, 560 - struct compat_timespec __user *timeout, 560 + struct old_timespec32 __user *timeout, 561 561 const struct __compat_aio_sigset __user *usig); 562 562 563 563 /* fs/cookies.c */ ··· 642 642 asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp, 643 643 compat_ulong_t __user *outp, 644 644 compat_ulong_t __user *exp, 645 - struct compat_timespec __user *tsp, 645 + struct old_timespec32 __user *tsp, 646 646 void __user *sig); 647 647 asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds, 648 648 unsigned int nfds, 649 - struct compat_timespec __user *tsp, 649 + struct old_timespec32 __user *tsp, 650 650 const compat_sigset_t __user *sigmask, 651 651 compat_size_t sigsetsize); 652 652 ··· 671 671 672 672 /* fs/timerfd.c */ 673 673 asmlinkage long compat_sys_timerfd_gettime(int ufd, 674 - struct compat_itimerspec __user *otmr); 674 + struct old_itimerspec32 __user *otmr); 675 675 asmlinkage long compat_sys_timerfd_settime(int ufd, int flags, 676 - const struct compat_itimerspec __user *utmr, 677 - struct compat_itimerspec __user *otmr); 676 + const struct old_itimerspec32 __user *utmr, 677 + struct old_itimerspec32 __user *otmr); 678 678 679 679 /* fs/utimes.c */ 680 680 asmlinkage long compat_sys_utimensat(unsigned int dfd, 681 681 const char __user *filename, 682 - struct compat_timespec __user *t, 682 + struct old_timespec32 __user *t, 683 683 int flags); 684 684 685 685 /* kernel/exit.c */ ··· 691 691 692 692 /* kernel/futex.c */ 693 693 asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val, 694 - struct compat_timespec __user *utime, u32 __user *uaddr2, 694 + struct old_timespec32 __user *utime, u32 __user *uaddr2, 695 695 u32 val3); 696 696 asmlinkage long 697 697 compat_sys_set_robust_list(struct compat_robust_list_head __user *head, ··· 701 701 compat_size_t __user *len_ptr); 702 702 703 703 /* kernel/hrtimer.c */ 704 - asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp, 705 - struct compat_timespec __user *rmtp); 704 + asmlinkage long compat_sys_nanosleep(struct old_timespec32 __user *rqtp, 705 + struct old_timespec32 __user *rmtp); 706 706 707 707 /* kernel/itimer.c */ 708 708 asmlinkage long compat_sys_getitimer(int which, ··· 722 722 struct compat_sigevent __user *timer_event_spec, 723 723 timer_t __user *created_timer_id); 724 724 asmlinkage long compat_sys_timer_gettime(timer_t timer_id, 725 - struct compat_itimerspec __user *setting); 725 + struct old_itimerspec32 __user *setting); 726 726 asmlinkage long compat_sys_timer_settime(timer_t timer_id, int flags, 727 - struct compat_itimerspec __user *new, 728 - struct compat_itimerspec __user *old); 727 + struct old_itimerspec32 __user *new, 728 + struct old_itimerspec32 __user *old); 729 729 asmlinkage long compat_sys_clock_settime(clockid_t which_clock, 730 - struct compat_timespec __user *tp); 730 + struct old_timespec32 __user *tp); 731 731 asmlinkage long compat_sys_clock_gettime(clockid_t which_clock, 732 - struct compat_timespec __user *tp); 732 + struct old_timespec32 __user *tp); 733 733 asmlinkage long compat_sys_clock_getres(clockid_t which_clock, 734 - struct compat_timespec __user *tp); 734 + struct old_timespec32 __user *tp); 735 735 asmlinkage long compat_sys_clock_nanosleep(clockid_t which_clock, int flags, 736 - struct compat_timespec __user *rqtp, 737 - struct compat_timespec __user *rmtp); 736 + struct old_timespec32 __user *rqtp, 737 + struct old_timespec32 __user *rmtp); 738 738 739 739 /* kernel/ptrace.c */ 740 740 asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, ··· 748 748 unsigned int len, 749 749 compat_ulong_t __user *user_mask_ptr); 750 750 asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, 751 - struct compat_timespec __user *interval); 751 + struct old_timespec32 __user *interval); 752 752 753 753 /* kernel/signal.c */ 754 754 asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, ··· 768 768 compat_size_t sigsetsize); 769 769 asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese, 770 770 struct compat_siginfo __user *uinfo, 771 - struct compat_timespec __user *uts, compat_size_t sigsetsize); 771 + struct old_timespec32 __user *uts, compat_size_t sigsetsize); 772 772 asmlinkage long compat_sys_rt_sigqueueinfo(compat_pid_t pid, int sig, 773 773 struct compat_siginfo __user *uinfo); 774 774 /* No generic prototype for rt_sigreturn */ ··· 782 782 asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru); 783 783 784 784 /* kernel/time.c */ 785 - asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv, 785 + asmlinkage long compat_sys_gettimeofday(struct old_timeval32 __user *tv, 786 786 struct timezone __user *tz); 787 - asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, 787 + asmlinkage long compat_sys_settimeofday(struct old_timeval32 __user *tv, 788 788 struct timezone __user *tz); 789 789 asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); 790 790 ··· 798 798 asmlinkage long compat_sys_mq_timedsend(mqd_t mqdes, 799 799 const char __user *u_msg_ptr, 800 800 compat_size_t msg_len, unsigned int msg_prio, 801 - const struct compat_timespec __user *u_abs_timeout); 801 + const struct old_timespec32 __user *u_abs_timeout); 802 802 asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes, 803 803 char __user *u_msg_ptr, 804 804 compat_size_t msg_len, unsigned int __user *u_msg_prio, 805 - const struct compat_timespec __user *u_abs_timeout); 805 + const struct old_timespec32 __user *u_abs_timeout); 806 806 asmlinkage long compat_sys_mq_notify(mqd_t mqdes, 807 807 const struct compat_sigevent __user *u_notification); 808 808 asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes, ··· 819 819 /* ipc/sem.c */ 820 820 asmlinkage long compat_sys_semctl(int semid, int semnum, int cmd, int arg); 821 821 asmlinkage long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, 822 - unsigned nsems, const struct compat_timespec __user *timeout); 822 + unsigned nsems, const struct old_timespec32 __user *timeout); 823 823 824 824 /* ipc/shm.c */ 825 825 asmlinkage long compat_sys_shmctl(int first, int second, void __user *uptr); ··· 876 876 struct compat_siginfo __user *uinfo); 877 877 asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, 878 878 unsigned vlen, unsigned int flags, 879 - struct compat_timespec __user *timeout); 879 + struct old_timespec32 __user *timeout); 880 880 asmlinkage long compat_sys_wait4(compat_pid_t pid, 881 881 compat_uint_t __user *stat_addr, int options, 882 882 struct compat_rusage __user *ru); ··· 928 928 asmlinkage long compat_sys_open(const char __user *filename, int flags, 929 929 umode_t mode); 930 930 asmlinkage long compat_sys_utimes(const char __user *filename, 931 - struct compat_timeval __user *t); 931 + struct old_timeval32 __user *t); 932 932 933 933 /* __ARCH_WANT_SYSCALL_NO_FLAGS */ 934 934 asmlinkage long compat_sys_signalfd(int ufd, ··· 942 942 struct compat_stat __user *statbuf); 943 943 944 944 /* __ARCH_WANT_SYSCALL_DEPRECATED */ 945 - asmlinkage long compat_sys_time(compat_time_t __user *tloc); 945 + asmlinkage long compat_sys_time(old_time32_t __user *tloc); 946 946 asmlinkage long compat_sys_utime(const char __user *filename, 947 947 struct compat_utimbuf __user *t); 948 948 asmlinkage long compat_sys_futimesat(unsigned int dfd, 949 949 const char __user *filename, 950 - struct compat_timeval __user *t); 950 + struct old_timeval32 __user *t); 951 951 asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, 952 952 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 953 - struct compat_timeval __user *tvp); 953 + struct old_timeval32 __user *tvp); 954 954 asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u32); 955 955 asmlinkage long compat_sys_recv(int fd, void __user *buf, compat_size_t len, 956 956 unsigned flags); ··· 983 983 #endif 984 984 985 985 /* obsolete: kernel/time/time.c */ 986 - asmlinkage long compat_sys_stime(compat_time_t __user *tptr); 986 + asmlinkage long compat_sys_stime(old_time32_t __user *tptr); 987 987 988 988 /* obsolete: net/socket.c */ 989 989 asmlinkage long compat_sys_socketcall(int call, u32 __user *args); ··· 1002 1002 #endif 1003 1003 1004 1004 /** 1005 - * ns_to_compat_timeval - Compat version of ns_to_timeval 1005 + * ns_to_old_timeval32 - Compat version of ns_to_timeval 1006 1006 * @nsec: the nanoseconds value to be converted 1007 1007 * 1008 - * Returns the compat_timeval representation of the nsec parameter. 1008 + * Returns the old_timeval32 representation of the nsec parameter. 1009 1009 */ 1010 - static inline struct compat_timeval ns_to_compat_timeval(s64 nsec) 1010 + static inline struct old_timeval32 ns_to_old_timeval32(s64 nsec) 1011 1011 { 1012 1012 struct timeval tv; 1013 - struct compat_timeval ctv; 1013 + struct old_timeval32 ctv; 1014 1014 1015 1015 tv = ns_to_timeval(nsec); 1016 1016 ctv.tv_sec = tv.tv_sec;
-32
include/linux/compat_time.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _LINUX_COMPAT_TIME_H 3 - #define _LINUX_COMPAT_TIME_H 4 - 5 - #include <linux/types.h> 6 - #include <linux/time64.h> 7 - 8 - typedef s32 compat_time_t; 9 - 10 - struct compat_timespec { 11 - compat_time_t tv_sec; 12 - s32 tv_nsec; 13 - }; 14 - 15 - struct compat_timeval { 16 - compat_time_t tv_sec; 17 - s32 tv_usec; 18 - }; 19 - 20 - struct compat_itimerspec { 21 - struct compat_timespec it_interval; 22 - struct compat_timespec it_value; 23 - }; 24 - 25 - extern int compat_get_timespec64(struct timespec64 *, const void __user *); 26 - extern int compat_put_timespec64(const struct timespec64 *, void __user *); 27 - extern int get_compat_itimerspec64(struct itimerspec64 *its, 28 - const struct compat_itimerspec __user *uits); 29 - extern int put_compat_itimerspec64(const struct itimerspec64 *its, 30 - struct compat_itimerspec __user *uits); 31 - 32 - #endif /* _LINUX_COMPAT_TIME_H */
+4 -4
include/linux/elfcore-compat.h
··· 27 27 compat_pid_t pr_ppid; 28 28 compat_pid_t pr_pgrp; 29 29 compat_pid_t pr_sid; 30 - struct compat_timeval pr_utime; 31 - struct compat_timeval pr_stime; 32 - struct compat_timeval pr_cutime; 33 - struct compat_timeval pr_cstime; 30 + struct old_timeval32 pr_utime; 31 + struct old_timeval32 pr_stime; 32 + struct old_timeval32 pr_cutime; 33 + struct old_timeval32 pr_cstime; 34 34 compat_elf_gregset_t pr_reg; 35 35 #ifdef CONFIG_BINFMT_ELF_FDPIC 36 36 compat_ulong_t pr_exec_fdpic_loadmap;
+2 -2
include/linux/restart_block.h
··· 10 10 #include <linux/time64.h> 11 11 12 12 struct timespec; 13 - struct compat_timespec; 13 + struct old_timespec32; 14 14 struct pollfd; 15 15 16 16 enum timespec_type { ··· 40 40 enum timespec_type type; 41 41 union { 42 42 struct __kernel_timespec __user *rmtp; 43 - struct compat_timespec __user *compat_rmtp; 43 + struct old_timespec32 __user *compat_rmtp; 44 44 }; 45 45 u64 expires; 46 46 } nanosleep;
+1 -1
include/linux/syscalls.h
··· 60 60 struct utimbuf; 61 61 struct mq_attr; 62 62 struct compat_stat; 63 - struct compat_timeval; 63 + struct old_timeval32; 64 64 struct robust_list_head; 65 65 struct getcpu_cache; 66 66 struct old_linux_dirent;
+36 -12
include/linux/time32.h
··· 13 13 14 14 #define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) 15 15 16 + typedef s32 old_time32_t; 17 + 18 + struct old_timespec32 { 19 + old_time32_t tv_sec; 20 + s32 tv_nsec; 21 + }; 22 + 23 + struct old_timeval32 { 24 + old_time32_t tv_sec; 25 + s32 tv_usec; 26 + }; 27 + 28 + struct old_itimerspec32 { 29 + struct old_timespec32 it_interval; 30 + struct old_timespec32 it_value; 31 + }; 32 + 33 + extern int get_old_timespec32(struct timespec64 *, const void __user *); 34 + extern int put_old_timespec32(const struct timespec64 *, void __user *); 35 + extern int get_old_itimerspec32(struct itimerspec64 *its, 36 + const struct old_itimerspec32 __user *uits); 37 + extern int put_old_itimerspec32(const struct itimerspec64 *its, 38 + struct old_itimerspec32 __user *uits); 39 + 40 + 16 41 #if __BITS_PER_LONG == 64 17 42 18 43 /* timespec64 is defined as timespec here */ ··· 208 183 extern struct __kernel_old_timeval ns_to_kernel_old_timeval(s64 nsec); 209 184 210 185 /* 211 - * New aliases for compat time functions. These will be used to replace 212 - * the compat code so it can be shared between 32-bit and 64-bit builds 213 - * both of which provide compatibility with old 32-bit tasks. 186 + * Old names for the 32-bit time_t interfaces, these will be removed 187 + * when everything uses the new names. 214 188 */ 215 - #define old_time32_t compat_time_t 216 - #define old_timeval32 compat_timeval 217 - #define old_timespec32 compat_timespec 218 - #define old_itimerspec32 compat_itimerspec 219 - #define ns_to_old_timeval32 ns_to_compat_timeval 220 - #define get_old_itimerspec32 get_compat_itimerspec64 221 - #define put_old_itimerspec32 put_compat_itimerspec64 222 - #define get_old_timespec32 compat_get_timespec64 223 - #define put_old_timespec32 compat_put_timespec64 189 + #define compat_time_t old_time32_t 190 + #define compat_timeval old_timeval32 191 + #define compat_timespec old_timespec32 192 + #define compat_itimerspec old_itimerspec32 193 + #define ns_to_compat_timeval ns_to_old_timeval32 194 + #define get_compat_itimerspec64 get_old_itimerspec32 195 + #define put_compat_itimerspec64 put_old_itimerspec32 196 + #define compat_get_timespec64 get_old_timespec32 197 + #define compat_put_timespec64 put_old_timespec32 224 198 225 199 #endif
+4 -4
ipc/mqueue.c
··· 1461 1461 #endif 1462 1462 1463 1463 #ifdef CONFIG_COMPAT_32BIT_TIME 1464 - static int compat_prepare_timeout(const struct compat_timespec __user *p, 1464 + static int compat_prepare_timeout(const struct old_timespec32 __user *p, 1465 1465 struct timespec64 *ts) 1466 1466 { 1467 - if (compat_get_timespec64(ts, p)) 1467 + if (get_old_timespec32(ts, p)) 1468 1468 return -EFAULT; 1469 1469 if (!timespec64_valid(ts)) 1470 1470 return -EINVAL; ··· 1474 1474 COMPAT_SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, 1475 1475 const char __user *, u_msg_ptr, 1476 1476 compat_size_t, msg_len, unsigned int, msg_prio, 1477 - const struct compat_timespec __user *, u_abs_timeout) 1477 + const struct old_timespec32 __user *, u_abs_timeout) 1478 1478 { 1479 1479 struct timespec64 ts, *p = NULL; 1480 1480 if (u_abs_timeout) { ··· 1489 1489 COMPAT_SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, 1490 1490 char __user *, u_msg_ptr, 1491 1491 compat_size_t, msg_len, unsigned int __user *, u_msg_prio, 1492 - const struct compat_timespec __user *, u_abs_timeout) 1492 + const struct old_timespec32 __user *, u_abs_timeout) 1493 1493 { 1494 1494 struct timespec64 ts, *p = NULL; 1495 1495 if (u_abs_timeout) {
+3 -3
ipc/msg.c
··· 622 622 struct compat_ipc_perm msg_perm; 623 623 compat_uptr_t msg_first; 624 624 compat_uptr_t msg_last; 625 - compat_time_t msg_stime; 626 - compat_time_t msg_rtime; 627 - compat_time_t msg_ctime; 625 + old_time32_t msg_stime; 626 + old_time32_t msg_rtime; 627 + old_time32_t msg_ctime; 628 628 compat_ulong_t msg_lcbytes; 629 629 compat_ulong_t msg_lqbytes; 630 630 unsigned short msg_cbytes;
+5 -5
ipc/sem.c
··· 1698 1698 1699 1699 struct compat_semid_ds { 1700 1700 struct compat_ipc_perm sem_perm; 1701 - compat_time_t sem_otime; 1702 - compat_time_t sem_ctime; 1701 + old_time32_t sem_otime; 1702 + old_time32_t sem_ctime; 1703 1703 compat_uptr_t sem_base; 1704 1704 compat_uptr_t sem_pending; 1705 1705 compat_uptr_t sem_pending_last; ··· 2214 2214 #ifdef CONFIG_COMPAT_32BIT_TIME 2215 2215 long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems, 2216 2216 unsigned int nsops, 2217 - const struct compat_timespec __user *timeout) 2217 + const struct old_timespec32 __user *timeout) 2218 2218 { 2219 2219 if (timeout) { 2220 2220 struct timespec64 ts; 2221 - if (compat_get_timespec64(&ts, timeout)) 2221 + if (get_old_timespec32(&ts, timeout)) 2222 2222 return -EFAULT; 2223 2223 return do_semtimedop(semid, tsems, nsops, &ts); 2224 2224 } ··· 2227 2227 2228 2228 COMPAT_SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsems, 2229 2229 unsigned int, nsops, 2230 - const struct compat_timespec __user *, timeout) 2230 + const struct old_timespec32 __user *, timeout) 2231 2231 { 2232 2232 return compat_ksys_semtimedop(semid, tsems, nsops, timeout); 2233 2233 }
+3 -3
ipc/shm.c
··· 1201 1201 struct compat_shmid_ds { 1202 1202 struct compat_ipc_perm shm_perm; 1203 1203 int shm_segsz; 1204 - compat_time_t shm_atime; 1205 - compat_time_t shm_dtime; 1206 - compat_time_t shm_ctime; 1204 + old_time32_t shm_atime; 1205 + old_time32_t shm_dtime; 1206 + old_time32_t shm_ctime; 1207 1207 compat_ipc_pid_t shm_cpid; 1208 1208 compat_ipc_pid_t shm_lpid; 1209 1209 unsigned short shm_nattch;
+1 -1
ipc/syscall.c
··· 35 35 (const struct __kernel_timespec __user *)fifth); 36 36 else if (IS_ENABLED(CONFIG_COMPAT_32BIT_TIME)) 37 37 return compat_ksys_semtimedop(first, ptr, second, 38 - (const struct compat_timespec __user *)fifth); 38 + (const struct old_timespec32 __user *)fifth); 39 39 else 40 40 return -ENOSYS; 41 41
+1 -1
ipc/util.h
··· 266 266 /* for CONFIG_ARCH_WANT_OLD_COMPAT_IPC */ 267 267 long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems, 268 268 unsigned int nsops, 269 - const struct compat_timespec __user *timeout); 269 + const struct old_timespec32 __user *timeout); 270 270 #ifdef CONFIG_COMPAT 271 271 long compat_ksys_semctl(int semid, int semnum, int cmd, int arg); 272 272 long compat_ksys_msgctl(int msqid, int cmd, void __user *uptr);
+4 -4
kernel/compat.c
··· 93 93 return 0; 94 94 } 95 95 96 - static int __compat_get_timeval(struct timeval *tv, const struct compat_timeval __user *ctv) 96 + static int __compat_get_timeval(struct timeval *tv, const struct old_timeval32 __user *ctv) 97 97 { 98 98 return (!access_ok(VERIFY_READ, ctv, sizeof(*ctv)) || 99 99 __get_user(tv->tv_sec, &ctv->tv_sec) || 100 100 __get_user(tv->tv_usec, &ctv->tv_usec)) ? -EFAULT : 0; 101 101 } 102 102 103 - static int __compat_put_timeval(const struct timeval *tv, struct compat_timeval __user *ctv) 103 + static int __compat_put_timeval(const struct timeval *tv, struct old_timeval32 __user *ctv) 104 104 { 105 105 return (!access_ok(VERIFY_WRITE, ctv, sizeof(*ctv)) || 106 106 __put_user(tv->tv_sec, &ctv->tv_sec) || 107 107 __put_user(tv->tv_usec, &ctv->tv_usec)) ? -EFAULT : 0; 108 108 } 109 109 110 - static int __compat_get_timespec(struct timespec *ts, const struct compat_timespec __user *cts) 110 + static int __compat_get_timespec(struct timespec *ts, const struct old_timespec32 __user *cts) 111 111 { 112 112 return (!access_ok(VERIFY_READ, cts, sizeof(*cts)) || 113 113 __get_user(ts->tv_sec, &cts->tv_sec) || 114 114 __get_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0; 115 115 } 116 116 117 - static int __compat_put_timespec(const struct timespec *ts, struct compat_timespec __user *cts) 117 + static int __compat_put_timespec(const struct timespec *ts, struct old_timespec32 __user *cts) 118 118 { 119 119 return (!access_ok(VERIFY_WRITE, cts, sizeof(*cts)) || 120 120 __put_user(ts->tv_sec, &cts->tv_sec) ||
+1 -1
kernel/futex_compat.c
··· 173 173 } 174 174 175 175 COMPAT_SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val, 176 - struct compat_timespec __user *, utime, u32 __user *, uaddr2, 176 + struct old_timespec32 __user *, utime, u32 __user *, uaddr2, 177 177 u32, val3) 178 178 { 179 179 struct timespec ts;
+2 -2
kernel/sched/core.c
··· 5257 5257 #ifdef CONFIG_COMPAT 5258 5258 COMPAT_SYSCALL_DEFINE2(sched_rr_get_interval, 5259 5259 compat_pid_t, pid, 5260 - struct compat_timespec __user *, interval) 5260 + struct old_timespec32 __user *, interval) 5261 5261 { 5262 5262 struct timespec64 t; 5263 5263 int retval = sched_rr_get_interval(pid, &t); 5264 5264 5265 5265 if (retval == 0) 5266 - retval = compat_put_timespec64(&t, interval); 5266 + retval = put_old_timespec32(&t, interval); 5267 5267 return retval; 5268 5268 } 5269 5269 #endif
+1 -1
kernel/signal.c
··· 3173 3173 #ifdef CONFIG_COMPAT 3174 3174 COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese, 3175 3175 struct compat_siginfo __user *, uinfo, 3176 - struct compat_timespec __user *, uts, compat_size_t, sigsetsize) 3176 + struct old_timespec32 __user *, uts, compat_size_t, sigsetsize) 3177 3177 { 3178 3178 sigset_t s; 3179 3179 struct timespec t;
+4 -4
kernel/time/hrtimer.c
··· 1660 1660 switch(restart->nanosleep.type) { 1661 1661 #ifdef CONFIG_COMPAT_32BIT_TIME 1662 1662 case TT_COMPAT: 1663 - if (compat_put_timespec64(ts, restart->nanosleep.compat_rmtp)) 1663 + if (put_old_timespec32(ts, restart->nanosleep.compat_rmtp)) 1664 1664 return -EFAULT; 1665 1665 break; 1666 1666 #endif ··· 1780 1780 1781 1781 #ifdef CONFIG_COMPAT_32BIT_TIME 1782 1782 1783 - COMPAT_SYSCALL_DEFINE2(nanosleep, struct compat_timespec __user *, rqtp, 1784 - struct compat_timespec __user *, rmtp) 1783 + COMPAT_SYSCALL_DEFINE2(nanosleep, struct old_timespec32 __user *, rqtp, 1784 + struct old_timespec32 __user *, rmtp) 1785 1785 { 1786 1786 struct timespec64 tu; 1787 1787 1788 - if (compat_get_timespec64(&tu, rqtp)) 1788 + if (get_old_timespec32(&tu, rqtp)) 1789 1789 return -EFAULT; 1790 1790 1791 1791 if (!timespec64_valid(&tu))
+9 -9
kernel/time/posix-stubs.c
··· 162 162 163 163 #ifdef CONFIG_COMPAT_32BIT_TIME 164 164 COMPAT_SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock, 165 - struct compat_timespec __user *, tp) 165 + struct old_timespec32 __user *, tp) 166 166 { 167 167 struct timespec64 new_tp; 168 168 169 169 if (which_clock != CLOCK_REALTIME) 170 170 return -EINVAL; 171 - if (compat_get_timespec64(&new_tp, tp)) 171 + if (get_old_timespec32(&new_tp, tp)) 172 172 return -EFAULT; 173 173 174 174 return do_sys_settimeofday64(&new_tp, NULL); 175 175 } 176 176 177 177 COMPAT_SYSCALL_DEFINE2(clock_gettime, clockid_t, which_clock, 178 - struct compat_timespec __user *, tp) 178 + struct old_timespec32 __user *, tp) 179 179 { 180 180 int ret; 181 181 struct timespec64 kernel_tp; ··· 184 184 if (ret) 185 185 return ret; 186 186 187 - if (compat_put_timespec64(&kernel_tp, tp)) 187 + if (put_old_timespec32(&kernel_tp, tp)) 188 188 return -EFAULT; 189 189 return 0; 190 190 } 191 191 192 192 COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock, 193 - struct compat_timespec __user *, tp) 193 + struct old_timespec32 __user *, tp) 194 194 { 195 195 struct timespec64 rtn_tp = { 196 196 .tv_sec = 0, ··· 201 201 case CLOCK_REALTIME: 202 202 case CLOCK_MONOTONIC: 203 203 case CLOCK_BOOTTIME: 204 - if (compat_put_timespec64(&rtn_tp, tp)) 204 + if (put_old_timespec32(&rtn_tp, tp)) 205 205 return -EFAULT; 206 206 return 0; 207 207 default: ··· 210 210 } 211 211 212 212 COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags, 213 - struct compat_timespec __user *, rqtp, 214 - struct compat_timespec __user *, rmtp) 213 + struct old_timespec32 __user *, rqtp, 214 + struct old_timespec32 __user *, rmtp) 215 215 { 216 216 struct timespec64 t; 217 217 ··· 224 224 return -EINVAL; 225 225 } 226 226 227 - if (compat_get_timespec64(&t, rqtp)) 227 + if (get_old_timespec32(&t, rqtp)) 228 228 return -EFAULT; 229 229 if (!timespec64_valid(&t)) 230 230 return -EINVAL;
+15 -15
kernel/time/posix-timers.c
··· 755 755 #ifdef CONFIG_COMPAT_32BIT_TIME 756 756 757 757 COMPAT_SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id, 758 - struct compat_itimerspec __user *, setting) 758 + struct old_itimerspec32 __user *, setting) 759 759 { 760 760 struct itimerspec64 cur_setting; 761 761 762 762 int ret = do_timer_gettime(timer_id, &cur_setting); 763 763 if (!ret) { 764 - if (put_compat_itimerspec64(&cur_setting, setting)) 764 + if (put_old_itimerspec32(&cur_setting, setting)) 765 765 ret = -EFAULT; 766 766 } 767 767 return ret; ··· 928 928 929 929 #ifdef CONFIG_COMPAT_32BIT_TIME 930 930 COMPAT_SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, 931 - struct compat_itimerspec __user *, new, 932 - struct compat_itimerspec __user *, old) 931 + struct old_itimerspec32 __user *, new, 932 + struct old_itimerspec32 __user *, old) 933 933 { 934 934 struct itimerspec64 new_spec, old_spec; 935 935 struct itimerspec64 *rtn = old ? &old_spec : NULL; ··· 937 937 938 938 if (!new) 939 939 return -EINVAL; 940 - if (get_compat_itimerspec64(&new_spec, new)) 940 + if (get_old_itimerspec32(&new_spec, new)) 941 941 return -EFAULT; 942 942 943 943 error = do_timer_settime(timer_id, flags, &new_spec, rtn); 944 944 if (!error && old) { 945 - if (put_compat_itimerspec64(&old_spec, old)) 945 + if (put_old_itimerspec32(&old_spec, old)) 946 946 error = -EFAULT; 947 947 } 948 948 return error; ··· 1115 1115 #ifdef CONFIG_COMPAT_32BIT_TIME 1116 1116 1117 1117 COMPAT_SYSCALL_DEFINE2(clock_settime, clockid_t, which_clock, 1118 - struct compat_timespec __user *, tp) 1118 + struct old_timespec32 __user *, tp) 1119 1119 { 1120 1120 const struct k_clock *kc = clockid_to_kclock(which_clock); 1121 1121 struct timespec64 ts; ··· 1123 1123 if (!kc || !kc->clock_set) 1124 1124 return -EINVAL; 1125 1125 1126 - if (compat_get_timespec64(&ts, tp)) 1126 + if (get_old_timespec32(&ts, tp)) 1127 1127 return -EFAULT; 1128 1128 1129 1129 return kc->clock_set(which_clock, &ts); 1130 1130 } 1131 1131 1132 1132 COMPAT_SYSCALL_DEFINE2(clock_gettime, clockid_t, which_clock, 1133 - struct compat_timespec __user *, tp) 1133 + struct old_timespec32 __user *, tp) 1134 1134 { 1135 1135 const struct k_clock *kc = clockid_to_kclock(which_clock); 1136 1136 struct timespec64 ts; ··· 1141 1141 1142 1142 err = kc->clock_get(which_clock, &ts); 1143 1143 1144 - if (!err && compat_put_timespec64(&ts, tp)) 1144 + if (!err && put_old_timespec32(&ts, tp)) 1145 1145 err = -EFAULT; 1146 1146 1147 1147 return err; ··· 1180 1180 #ifdef CONFIG_COMPAT_32BIT_TIME 1181 1181 1182 1182 COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock, 1183 - struct compat_timespec __user *, tp) 1183 + struct old_timespec32 __user *, tp) 1184 1184 { 1185 1185 const struct k_clock *kc = clockid_to_kclock(which_clock); 1186 1186 struct timespec64 ts; ··· 1190 1190 return -EINVAL; 1191 1191 1192 1192 err = kc->clock_getres(which_clock, &ts); 1193 - if (!err && tp && compat_put_timespec64(&ts, tp)) 1193 + if (!err && tp && put_old_timespec32(&ts, tp)) 1194 1194 return -EFAULT; 1195 1195 1196 1196 return err; ··· 1237 1237 #ifdef CONFIG_COMPAT_32BIT_TIME 1238 1238 1239 1239 COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags, 1240 - struct compat_timespec __user *, rqtp, 1241 - struct compat_timespec __user *, rmtp) 1240 + struct old_timespec32 __user *, rqtp, 1241 + struct old_timespec32 __user *, rmtp) 1242 1242 { 1243 1243 const struct k_clock *kc = clockid_to_kclock(which_clock); 1244 1244 struct timespec64 t; ··· 1248 1248 if (!kc->nsleep) 1249 1249 return -EOPNOTSUPP; 1250 1250 1251 - if (compat_get_timespec64(&t, rqtp)) 1251 + if (get_old_timespec32(&t, rqtp)) 1252 1252 return -EFAULT; 1253 1253 1254 1254 if (!timespec64_valid(&t))
+29 -29
kernel/time/time.c
··· 104 104 #ifdef CONFIG_COMPAT 105 105 #ifdef __ARCH_WANT_COMPAT_SYS_TIME 106 106 107 - /* compat_time_t is a 32 bit "long" and needs to get converted. */ 108 - COMPAT_SYSCALL_DEFINE1(time, compat_time_t __user *, tloc) 107 + /* old_time32_t is a 32 bit "long" and needs to get converted. */ 108 + COMPAT_SYSCALL_DEFINE1(time, old_time32_t __user *, tloc) 109 109 { 110 - compat_time_t i; 110 + old_time32_t i; 111 111 112 - i = (compat_time_t)ktime_get_real_seconds(); 112 + i = (old_time32_t)ktime_get_real_seconds(); 113 113 114 114 if (tloc) { 115 115 if (put_user(i,tloc)) ··· 119 119 return i; 120 120 } 121 121 122 - COMPAT_SYSCALL_DEFINE1(stime, compat_time_t __user *, tptr) 122 + COMPAT_SYSCALL_DEFINE1(stime, old_time32_t __user *, tptr) 123 123 { 124 124 struct timespec64 tv; 125 125 int err; ··· 225 225 } 226 226 227 227 #ifdef CONFIG_COMPAT 228 - COMPAT_SYSCALL_DEFINE2(gettimeofday, struct compat_timeval __user *, tv, 228 + COMPAT_SYSCALL_DEFINE2(gettimeofday, struct old_timeval32 __user *, tv, 229 229 struct timezone __user *, tz) 230 230 { 231 231 if (tv) { ··· 244 244 return 0; 245 245 } 246 246 247 - COMPAT_SYSCALL_DEFINE2(settimeofday, struct compat_timeval __user *, tv, 247 + COMPAT_SYSCALL_DEFINE2(settimeofday, struct old_timeval32 __user *, tv, 248 248 struct timezone __user *, tz) 249 249 { 250 250 struct timespec64 new_ts; ··· 863 863 } 864 864 EXPORT_SYMBOL_GPL(put_timespec64); 865 865 866 - int __compat_get_timespec64(struct timespec64 *ts64, 867 - const struct compat_timespec __user *cts) 866 + int __get_old_timespec32(struct timespec64 *ts64, 867 + const struct old_timespec32 __user *cts) 868 868 { 869 - struct compat_timespec ts; 869 + struct old_timespec32 ts; 870 870 int ret; 871 871 872 872 ret = copy_from_user(&ts, cts, sizeof(ts)); ··· 879 879 return 0; 880 880 } 881 881 882 - int __compat_put_timespec64(const struct timespec64 *ts64, 883 - struct compat_timespec __user *cts) 882 + int __put_old_timespec32(const struct timespec64 *ts64, 883 + struct old_timespec32 __user *cts) 884 884 { 885 - struct compat_timespec ts = { 885 + struct old_timespec32 ts = { 886 886 .tv_sec = ts64->tv_sec, 887 887 .tv_nsec = ts64->tv_nsec 888 888 }; 889 889 return copy_to_user(cts, &ts, sizeof(ts)) ? -EFAULT : 0; 890 890 } 891 891 892 - int compat_get_timespec64(struct timespec64 *ts, const void __user *uts) 892 + int get_old_timespec32(struct timespec64 *ts, const void __user *uts) 893 893 { 894 894 if (COMPAT_USE_64BIT_TIME) 895 895 return copy_from_user(ts, uts, sizeof(*ts)) ? -EFAULT : 0; 896 896 else 897 - return __compat_get_timespec64(ts, uts); 897 + return __get_old_timespec32(ts, uts); 898 898 } 899 - EXPORT_SYMBOL_GPL(compat_get_timespec64); 899 + EXPORT_SYMBOL_GPL(get_old_timespec32); 900 900 901 - int compat_put_timespec64(const struct timespec64 *ts, void __user *uts) 901 + int put_old_timespec32(const struct timespec64 *ts, void __user *uts) 902 902 { 903 903 if (COMPAT_USE_64BIT_TIME) 904 904 return copy_to_user(uts, ts, sizeof(*ts)) ? -EFAULT : 0; 905 905 else 906 - return __compat_put_timespec64(ts, uts); 906 + return __put_old_timespec32(ts, uts); 907 907 } 908 - EXPORT_SYMBOL_GPL(compat_put_timespec64); 908 + EXPORT_SYMBOL_GPL(put_old_timespec32); 909 909 910 910 int get_itimerspec64(struct itimerspec64 *it, 911 911 const struct __kernel_itimerspec __user *uit) ··· 937 937 } 938 938 EXPORT_SYMBOL_GPL(put_itimerspec64); 939 939 940 - int get_compat_itimerspec64(struct itimerspec64 *its, 941 - const struct compat_itimerspec __user *uits) 940 + int get_old_itimerspec32(struct itimerspec64 *its, 941 + const struct old_itimerspec32 __user *uits) 942 942 { 943 943 944 - if (__compat_get_timespec64(&its->it_interval, &uits->it_interval) || 945 - __compat_get_timespec64(&its->it_value, &uits->it_value)) 944 + if (__get_old_timespec32(&its->it_interval, &uits->it_interval) || 945 + __get_old_timespec32(&its->it_value, &uits->it_value)) 946 946 return -EFAULT; 947 947 return 0; 948 948 } 949 - EXPORT_SYMBOL_GPL(get_compat_itimerspec64); 949 + EXPORT_SYMBOL_GPL(get_old_itimerspec32); 950 950 951 - int put_compat_itimerspec64(const struct itimerspec64 *its, 952 - struct compat_itimerspec __user *uits) 951 + int put_old_itimerspec32(const struct itimerspec64 *its, 952 + struct old_itimerspec32 __user *uits) 953 953 { 954 - if (__compat_put_timespec64(&its->it_interval, &uits->it_interval) || 955 - __compat_put_timespec64(&its->it_value, &uits->it_value)) 954 + if (__put_old_timespec32(&its->it_interval, &uits->it_interval) || 955 + __put_old_timespec32(&its->it_value, &uits->it_value)) 956 956 return -EFAULT; 957 957 return 0; 958 958 } 959 - EXPORT_SYMBOL_GPL(put_compat_itimerspec64); 959 + EXPORT_SYMBOL_GPL(put_old_itimerspec32);
+2 -2
net/compat.c
··· 812 812 813 813 static int __compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, 814 814 unsigned int vlen, unsigned int flags, 815 - struct compat_timespec __user *timeout) 815 + struct old_timespec32 __user *timeout) 816 816 { 817 817 int datagrams; 818 818 struct timespec ktspec; ··· 834 834 835 835 COMPAT_SYSCALL_DEFINE5(recvmmsg, int, fd, struct compat_mmsghdr __user *, mmsg, 836 836 unsigned int, vlen, unsigned int, flags, 837 - struct compat_timespec __user *, timeout) 837 + struct old_timespec32 __user *, timeout) 838 838 { 839 839 return __compat_sys_recvmmsg(fd, mmsg, vlen, flags, timeout); 840 840 }