aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
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 /kernel
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>
Diffstat (limited to 'kernel')
-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
8 files changed, 65 insertions, 65 deletions
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);