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