aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2006-03-26 04:37:29 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 11:56:57 -0500
commit3158e9411a66fb98d495ac441c242264f31aaf3e (patch)
tree7b3bad47214c09c9dcd7ff27316c6de23f4c7cb0
parent88959ea968709c35e8b979ac9f5a398fa748091a (diff)
[PATCH] consolidate sys32/compat_adjtimex
Create compat_sys_adjtimex and use it an all appropriate places. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Arnd Bergmann <arnd@arndb.de> Acked-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/alpha/kernel/osf_sys.c1
-rw-r--r--arch/ia64/ia32/sys_ia32.c62
-rw-r--r--arch/mips/kernel/linux32.c61
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S2
-rw-r--r--arch/parisc/kernel/sys_parisc32.c29
-rw-r--r--arch/parisc/kernel/syscall_table.S2
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c60
-rw-r--r--arch/s390/kernel/compat_linux.c61
-rw-r--r--arch/s390/kernel/compat_wrapper.S8
-rw-r--r--arch/s390/kernel/syscalls.S2
-rw-r--r--arch/sparc64/kernel/sys_sparc32.c61
-rw-r--r--arch/sparc64/kernel/systbls.S2
-rw-r--r--arch/x86_64/ia32/ia32entry.S2
-rw-r--r--arch/x86_64/ia32/sys_ia32.c64
-rw-r--r--include/linux/compat.h2
-rw-r--r--include/linux/timex.h2
-rw-r--r--kernel/compat.c59
18 files changed, 73 insertions, 409 deletions
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 7fb14f42a125..31afe3d91ac6 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -821,7 +821,6 @@ osf_setsysinfo(unsigned long op, void __user *buffer, unsigned long nbytes,
821 affects all sorts of things, like timeval and itimerval. */ 821 affects all sorts of things, like timeval and itimerval. */
822 822
823extern struct timezone sys_tz; 823extern struct timezone sys_tz;
824extern int do_adjtimex(struct timex *);
825 824
826struct timeval32 825struct timeval32
827{ 826{
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index 1e1a2353aefd..5366b3b23d09 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -25,7 +25,6 @@
25#include <linux/resource.h> 25#include <linux/resource.h>
26#include <linux/times.h> 26#include <linux/times.h>
27#include <linux/utsname.h> 27#include <linux/utsname.h>
28#include <linux/timex.h>
29#include <linux/smp.h> 28#include <linux/smp.h>
30#include <linux/smp_lock.h> 29#include <linux/smp_lock.h>
31#include <linux/sem.h> 30#include <linux/sem.h>
@@ -2591,65 +2590,4 @@ sys32_setresgid(compat_gid_t rgid, compat_gid_t egid,
2591 ssgid = (sgid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)sgid); 2590 ssgid = (sgid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)sgid);
2592 return sys_setresgid(srgid, segid, ssgid); 2591 return sys_setresgid(srgid, segid, ssgid);
2593} 2592}
2594
2595/* Handle adjtimex compatibility. */
2596
2597extern int do_adjtimex(struct timex *);
2598
2599asmlinkage long
2600sys32_adjtimex(struct compat_timex *utp)
2601{
2602 struct timex txc;
2603 int ret;
2604
2605 memset(&txc, 0, sizeof(struct timex));
2606
2607 if(get_user(txc.modes, &utp->modes) ||
2608 __get_user(txc.offset, &utp->offset) ||
2609 __get_user(txc.freq, &utp->freq) ||
2610 __get_user(txc.maxerror, &utp->maxerror) ||
2611 __get_user(txc.esterror, &utp->esterror) ||
2612 __get_user(txc.status, &utp->status) ||
2613 __get_user(txc.constant, &utp->constant) ||
2614 __get_user(txc.precision, &utp->precision) ||
2615 __get_user(txc.tolerance, &utp->tolerance) ||
2616 __get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
2617 __get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
2618 __get_user(txc.tick, &utp->tick) ||
2619 __get_user(txc.ppsfreq, &utp->ppsfreq) ||
2620 __get_user(txc.jitter, &utp->jitter) ||
2621 __get_user(txc.shift, &utp->shift) ||
2622 __get_user(txc.stabil, &utp->stabil) ||
2623 __get_user(txc.jitcnt, &utp->jitcnt) ||
2624 __get_user(txc.calcnt, &utp->calcnt) ||
2625 __get_user(txc.errcnt, &utp->errcnt) ||
2626 __get_user(txc.stbcnt, &utp->stbcnt))
2627 return -EFAULT;
2628
2629 ret = do_adjtimex(&txc);
2630
2631 if(put_user(txc.modes, &utp->modes) ||
2632 __put_user(txc.offset, &utp->offset) ||
2633 __put_user(txc.freq, &utp->freq) ||
2634 __put_user(txc.maxerror, &utp->maxerror) ||
2635 __put_user(txc.esterror, &utp->esterror) ||
2636 __put_user(txc.status, &utp->status) ||
2637 __put_user(txc.constant, &utp->constant) ||
2638 __put_user(txc.precision, &utp->precision) ||
2639 __put_user(txc.tolerance, &utp->tolerance) ||
2640 __put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
2641 __put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
2642 __put_user(txc.tick, &utp->tick) ||
2643 __put_user(txc.ppsfreq, &utp->ppsfreq) ||
2644 __put_user(txc.jitter, &utp->jitter) ||
2645 __put_user(txc.shift, &utp->shift) ||
2646 __put_user(txc.stabil, &utp->stabil) ||
2647 __put_user(txc.jitcnt, &utp->jitcnt) ||
2648 __put_user(txc.calcnt, &utp->calcnt) ||
2649 __put_user(txc.errcnt, &utp->errcnt) ||
2650 __put_user(txc.stbcnt, &utp->stbcnt))
2651 ret = -EFAULT;
2652
2653 return ret;
2654}
2655#endif /* NOTYET */ 2593#endif /* NOTYET */
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index f33e779796f0..3f40c37a9ee6 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -30,7 +30,6 @@
30#include <linux/utime.h> 30#include <linux/utime.h>
31#include <linux/utsname.h> 31#include <linux/utsname.h>
32#include <linux/personality.h> 32#include <linux/personality.h>
33#include <linux/timex.h>
34#include <linux/dnotify.h> 33#include <linux/dnotify.h>
35#include <linux/module.h> 34#include <linux/module.h>
36#include <linux/binfmts.h> 35#include <linux/binfmts.h>
@@ -1157,66 +1156,6 @@ out:
1157 return err; 1156 return err;
1158} 1157}
1159 1158
1160/* Handle adjtimex compatibility. */
1161
1162extern int do_adjtimex(struct timex *);
1163
1164asmlinkage int sys32_adjtimex(struct compat_timex __user *utp)
1165{
1166 struct timex txc;
1167 int ret;
1168
1169 memset(&txc, 0, sizeof(struct timex));
1170
1171 if (get_user(txc.modes, &utp->modes) ||
1172 __get_user(txc.offset, &utp->offset) ||
1173 __get_user(txc.freq, &utp->freq) ||
1174 __get_user(txc.maxerror, &utp->maxerror) ||
1175 __get_user(txc.esterror, &utp->esterror) ||
1176 __get_user(txc.status, &utp->status) ||
1177 __get_user(txc.constant, &utp->constant) ||
1178 __get_user(txc.precision, &utp->precision) ||
1179 __get_user(txc.tolerance, &utp->tolerance) ||
1180 __get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
1181 __get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
1182 __get_user(txc.tick, &utp->tick) ||
1183 __get_user(txc.ppsfreq, &utp->ppsfreq) ||
1184 __get_user(txc.jitter, &utp->jitter) ||
1185 __get_user(txc.shift, &utp->shift) ||
1186 __get_user(txc.stabil, &utp->stabil) ||
1187 __get_user(txc.jitcnt, &utp->jitcnt) ||
1188 __get_user(txc.calcnt, &utp->calcnt) ||
1189 __get_user(txc.errcnt, &utp->errcnt) ||
1190 __get_user(txc.stbcnt, &utp->stbcnt))
1191 return -EFAULT;
1192
1193 ret = do_adjtimex(&txc);
1194
1195 if (put_user(txc.modes, &utp->modes) ||
1196 __put_user(txc.offset, &utp->offset) ||
1197 __put_user(txc.freq, &utp->freq) ||
1198 __put_user(txc.maxerror, &utp->maxerror) ||
1199 __put_user(txc.esterror, &utp->esterror) ||
1200 __put_user(txc.status, &utp->status) ||
1201 __put_user(txc.constant, &utp->constant) ||
1202 __put_user(txc.precision, &utp->precision) ||
1203 __put_user(txc.tolerance, &utp->tolerance) ||
1204 __put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
1205 __put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
1206 __put_user(txc.tick, &utp->tick) ||
1207 __put_user(txc.ppsfreq, &utp->ppsfreq) ||
1208 __put_user(txc.jitter, &utp->jitter) ||
1209 __put_user(txc.shift, &utp->shift) ||
1210 __put_user(txc.stabil, &utp->stabil) ||
1211 __put_user(txc.jitcnt, &utp->jitcnt) ||
1212 __put_user(txc.calcnt, &utp->calcnt) ||
1213 __put_user(txc.errcnt, &utp->errcnt) ||
1214 __put_user(txc.stbcnt, &utp->stbcnt))
1215 ret = -EFAULT;
1216
1217 return ret;
1218}
1219
1220asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, 1159asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset,
1221 s32 count) 1160 s32 count)
1222{ 1161{
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 02c8267e45e7..05a2c0567dae 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -273,7 +273,7 @@ EXPORT(sysn32_call_table)
273 PTR sys_pivot_root 273 PTR sys_pivot_root
274 PTR sys32_sysctl 274 PTR sys32_sysctl
275 PTR sys_prctl 275 PTR sys_prctl
276 PTR sys32_adjtimex 276 PTR compat_sys_adjtimex
277 PTR compat_sys_setrlimit /* 6155 */ 277 PTR compat_sys_setrlimit /* 6155 */
278 PTR sys_chroot 278 PTR sys_chroot
279 PTR sys_sync 279 PTR sys_sync
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 797e0d874889..19c4ca481b02 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -328,7 +328,7 @@ sys_call_table:
328 PTR sys_setdomainname 328 PTR sys_setdomainname
329 PTR sys32_newuname 329 PTR sys32_newuname
330 PTR sys_ni_syscall /* sys_modify_ldt */ 330 PTR sys_ni_syscall /* sys_modify_ldt */
331 PTR sys32_adjtimex 331 PTR compat_sys_adjtimex
332 PTR sys_mprotect /* 4125 */ 332 PTR sys_mprotect /* 4125 */
333 PTR compat_sys_sigprocmask 333 PTR compat_sys_sigprocmask
334 PTR sys_ni_syscall /* was creat_module */ 334 PTR sys_ni_syscall /* was creat_module */
diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c
index ca1d8dbbadf3..d286f68a3d3a 100644
--- a/arch/parisc/kernel/sys_parisc32.c
+++ b/arch/parisc/kernel/sys_parisc32.c
@@ -21,7 +21,6 @@
21#include <linux/times.h> 21#include <linux/times.h>
22#include <linux/utsname.h> 22#include <linux/utsname.h>
23#include <linux/time.h> 23#include <linux/time.h>
24#include <linux/timex.h>
25#include <linux/smp.h> 24#include <linux/smp.h>
26#include <linux/smp_lock.h> 25#include <linux/smp_lock.h>
27#include <linux/sem.h> 26#include <linux/sem.h>
@@ -567,34 +566,6 @@ asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *off
567} 566}
568 567
569 568
570asmlinkage long sys32_adjtimex(struct compat_timex __user *txc_p32)
571{
572 struct timex txc;
573 struct compat_timex t32;
574 int ret;
575 extern int do_adjtimex(struct timex *txc);
576
577 if(copy_from_user(&t32, txc_p32, sizeof(struct compat_timex)))
578 return -EFAULT;
579#undef CP
580#define CP(x) txc.x = t32.x
581 CP(modes); CP(offset); CP(freq); CP(maxerror); CP(esterror);
582 CP(status); CP(constant); CP(precision); CP(tolerance);
583 CP(time.tv_sec); CP(time.tv_usec); CP(tick); CP(ppsfreq); CP(jitter);
584 CP(shift); CP(stabil); CP(jitcnt); CP(calcnt); CP(errcnt);
585 CP(stbcnt);
586 ret = do_adjtimex(&txc);
587#undef CP
588#define CP(x) t32.x = txc.x
589 CP(modes); CP(offset); CP(freq); CP(maxerror); CP(esterror);
590 CP(status); CP(constant); CP(precision); CP(tolerance);
591 CP(time.tv_sec); CP(time.tv_usec); CP(tick); CP(ppsfreq); CP(jitter);
592 CP(shift); CP(stabil); CP(jitcnt); CP(calcnt); CP(errcnt);
593 CP(stbcnt);
594 return copy_to_user(txc_p32, &t32, sizeof(struct compat_timex)) ? -EFAULT : ret;
595}
596
597
598struct sysinfo32 { 569struct sysinfo32 {
599 s32 uptime; 570 s32 uptime;
600 u32 loads[3]; 571 u32 loads[3];
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 71011eadb872..89b6c56ea0a8 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -207,7 +207,7 @@
207 /* struct sockaddr... */ 207 /* struct sockaddr... */
208 ENTRY_SAME(recvfrom) 208 ENTRY_SAME(recvfrom)
209 /* struct timex contains longs */ 209 /* struct timex contains longs */
210 ENTRY_DIFF(adjtimex) 210 ENTRY_COMP(adjtimex)
211 ENTRY_SAME(mprotect) /* 125 */ 211 ENTRY_SAME(mprotect) /* 125 */
212 /* old_sigset_t forced to 32 bits. Beware glibc sigset_t */ 212 /* old_sigset_t forced to 32 bits. Beware glibc sigset_t */
213 ENTRY_COMP(sigprocmask) 213 ENTRY_COMP(sigprocmask)
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index d9867f583c68..ec274e688816 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -24,7 +24,6 @@
24#include <linux/resource.h> 24#include <linux/resource.h>
25#include <linux/times.h> 25#include <linux/times.h>
26#include <linux/utsname.h> 26#include <linux/utsname.h>
27#include <linux/timex.h>
28#include <linux/smp.h> 27#include <linux/smp.h>
29#include <linux/smp_lock.h> 28#include <linux/smp_lock.h>
30#include <linux/sem.h> 29#include <linux/sem.h>
@@ -161,65 +160,6 @@ asmlinkage long compat_sys_sysfs(u32 option, u32 arg1, u32 arg2)
161 return sys_sysfs((int)option, arg1, arg2); 160 return sys_sysfs((int)option, arg1, arg2);
162} 161}
163 162
164/* Handle adjtimex compatibility. */
165extern int do_adjtimex(struct timex *);
166
167asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp)
168{
169 struct timex txc;
170 int ret;
171
172 memset(&txc, 0, sizeof(struct timex));
173
174 if(get_user(txc.modes, &utp->modes) ||
175 __get_user(txc.offset, &utp->offset) ||
176 __get_user(txc.freq, &utp->freq) ||
177 __get_user(txc.maxerror, &utp->maxerror) ||
178 __get_user(txc.esterror, &utp->esterror) ||
179 __get_user(txc.status, &utp->status) ||
180 __get_user(txc.constant, &utp->constant) ||
181 __get_user(txc.precision, &utp->precision) ||
182 __get_user(txc.tolerance, &utp->tolerance) ||
183 __get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
184 __get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
185 __get_user(txc.tick, &utp->tick) ||
186 __get_user(txc.ppsfreq, &utp->ppsfreq) ||
187 __get_user(txc.jitter, &utp->jitter) ||
188 __get_user(txc.shift, &utp->shift) ||
189 __get_user(txc.stabil, &utp->stabil) ||
190 __get_user(txc.jitcnt, &utp->jitcnt) ||
191 __get_user(txc.calcnt, &utp->calcnt) ||
192 __get_user(txc.errcnt, &utp->errcnt) ||
193 __get_user(txc.stbcnt, &utp->stbcnt))
194 return -EFAULT;
195
196 ret = do_adjtimex(&txc);
197
198 if(put_user(txc.modes, &utp->modes) ||
199 __put_user(txc.offset, &utp->offset) ||
200 __put_user(txc.freq, &utp->freq) ||
201 __put_user(txc.maxerror, &utp->maxerror) ||
202 __put_user(txc.esterror, &utp->esterror) ||
203 __put_user(txc.status, &utp->status) ||
204 __put_user(txc.constant, &utp->constant) ||
205 __put_user(txc.precision, &utp->precision) ||
206 __put_user(txc.tolerance, &utp->tolerance) ||
207 __put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
208 __put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
209 __put_user(txc.tick, &utp->tick) ||
210 __put_user(txc.ppsfreq, &utp->ppsfreq) ||
211 __put_user(txc.jitter, &utp->jitter) ||
212 __put_user(txc.shift, &utp->shift) ||
213 __put_user(txc.stabil, &utp->stabil) ||
214 __put_user(txc.jitcnt, &utp->jitcnt) ||
215 __put_user(txc.calcnt, &utp->calcnt) ||
216 __put_user(txc.errcnt, &utp->errcnt) ||
217 __put_user(txc.stbcnt, &utp->stbcnt))
218 ret = -EFAULT;
219
220 return ret;
221}
222
223asmlinkage long compat_sys_pause(void) 163asmlinkage long compat_sys_pause(void)
224{ 164{
225 current->state = TASK_INTERRUPTIBLE; 165 current->state = TASK_INTERRUPTIBLE;
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 9809264f2f4d..5e14de37c17b 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -26,7 +26,6 @@
26#include <linux/resource.h> 26#include <linux/resource.h>
27#include <linux/times.h> 27#include <linux/times.h>
28#include <linux/utsname.h> 28#include <linux/utsname.h>
29#include <linux/timex.h>
30#include <linux/smp.h> 29#include <linux/smp.h>
31#include <linux/smp_lock.h> 30#include <linux/smp_lock.h>
32#include <linux/sem.h> 31#include <linux/sem.h>
@@ -705,66 +704,6 @@ asmlinkage long sys32_sendfile64(int out_fd, int in_fd,
705 return ret; 704 return ret;
706} 705}
707 706
708/* Handle adjtimex compatibility. */
709
710extern int do_adjtimex(struct timex *);
711
712asmlinkage long sys32_adjtimex(struct compat_timex __user *utp)
713{
714 struct timex txc;
715 int ret;
716
717 memset(&txc, 0, sizeof(struct timex));
718
719 if(get_user(txc.modes, &utp->modes) ||
720 __get_user(txc.offset, &utp->offset) ||
721 __get_user(txc.freq, &utp->freq) ||
722 __get_user(txc.maxerror, &utp->maxerror) ||
723 __get_user(txc.esterror, &utp->esterror) ||
724 __get_user(txc.status, &utp->status) ||
725 __get_user(txc.constant, &utp->constant) ||
726 __get_user(txc.precision, &utp->precision) ||
727 __get_user(txc.tolerance, &utp->tolerance) ||
728 __get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
729 __get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
730 __get_user(txc.tick, &utp->tick) ||
731 __get_user(txc.ppsfreq, &utp->ppsfreq) ||
732 __get_user(txc.jitter, &utp->jitter) ||
733 __get_user(txc.shift, &utp->shift) ||
734 __get_user(txc.stabil, &utp->stabil) ||
735 __get_user(txc.jitcnt, &utp->jitcnt) ||
736 __get_user(txc.calcnt, &utp->calcnt) ||
737 __get_user(txc.errcnt, &utp->errcnt) ||
738 __get_user(txc.stbcnt, &utp->stbcnt))
739 return -EFAULT;
740
741 ret = do_adjtimex(&txc);
742
743 if(put_user(txc.modes, &utp->modes) ||
744 __put_user(txc.offset, &utp->offset) ||
745 __put_user(txc.freq, &utp->freq) ||
746 __put_user(txc.maxerror, &utp->maxerror) ||
747 __put_user(txc.esterror, &utp->esterror) ||
748 __put_user(txc.status, &utp->status) ||
749 __put_user(txc.constant, &utp->constant) ||
750 __put_user(txc.precision, &utp->precision) ||
751 __put_user(txc.tolerance, &utp->tolerance) ||
752 __put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
753 __put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
754 __put_user(txc.tick, &utp->tick) ||
755 __put_user(txc.ppsfreq, &utp->ppsfreq) ||
756 __put_user(txc.jitter, &utp->jitter) ||
757 __put_user(txc.shift, &utp->shift) ||
758 __put_user(txc.stabil, &utp->stabil) ||
759 __put_user(txc.jitcnt, &utp->jitcnt) ||
760 __put_user(txc.calcnt, &utp->calcnt) ||
761 __put_user(txc.errcnt, &utp->errcnt) ||
762 __put_user(txc.stbcnt, &utp->stbcnt))
763 ret = -EFAULT;
764
765 return ret;
766}
767
768#ifdef CONFIG_SYSCTL 707#ifdef CONFIG_SYSCTL
769struct __sysctl_args32 { 708struct __sysctl_args32 {
770 u32 name; 709 u32 name;
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 50e80138e7ad..199da68bd7be 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -551,10 +551,10 @@ sys32_newuname_wrapper:
551 llgtr %r2,%r2 # struct new_utsname * 551 llgtr %r2,%r2 # struct new_utsname *
552 jg s390x_newuname # branch to system call 552 jg s390x_newuname # branch to system call
553 553
554 .globl sys32_adjtimex_wrapper 554 .globl compat_sys_adjtimex_wrapper
555sys32_adjtimex_wrapper: 555compat_sys_adjtimex_wrapper:
556 llgtr %r2,%r2 # struct timex_emu31 * 556 llgtr %r2,%r2 # struct compat_timex *
557 jg sys32_adjtimex # branch to system call 557 jg compat_sys_adjtimex # branch to system call
558 558
559 .globl sys32_mprotect_wrapper 559 .globl sys32_mprotect_wrapper
560sys32_mprotect_wrapper: 560sys32_mprotect_wrapper:
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 7c88d85c3597..2f56654da821 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -132,7 +132,7 @@ SYSCALL(sys_clone_glue,sys_clone_glue,sys32_clone_glue) /* 120 */
132SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper) 132SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper)
133SYSCALL(sys_newuname,s390x_newuname,sys32_newuname_wrapper) 133SYSCALL(sys_newuname,s390x_newuname,sys32_newuname_wrapper)
134NI_SYSCALL /* modify_ldt for i386 */ 134NI_SYSCALL /* modify_ldt for i386 */
135SYSCALL(sys_adjtimex,sys_adjtimex,sys32_adjtimex_wrapper) 135SYSCALL(sys_adjtimex,sys_adjtimex,compat_sys_adjtimex_wrapper)
136SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */ 136SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */
137SYSCALL(sys_sigprocmask,sys_sigprocmask,compat_sys_sigprocmask_wrapper) 137SYSCALL(sys_sigprocmask,sys_sigprocmask,compat_sys_sigprocmask_wrapper)
138NI_SYSCALL /* old "create module" */ 138NI_SYSCALL /* old "create module" */
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
index 48f02f201918..2e906bad56fa 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc64/kernel/sys_sparc32.c
@@ -19,7 +19,6 @@
19#include <linux/resource.h> 19#include <linux/resource.h>
20#include <linux/times.h> 20#include <linux/times.h>
21#include <linux/utsname.h> 21#include <linux/utsname.h>
22#include <linux/timex.h>
23#include <linux/smp.h> 22#include <linux/smp.h>
24#include <linux/smp_lock.h> 23#include <linux/smp_lock.h>
25#include <linux/sem.h> 24#include <linux/sem.h>
@@ -945,66 +944,6 @@ asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
945 return ret; 944 return ret;
946} 945}
947 946
948/* Handle adjtimex compatibility. */
949
950extern int do_adjtimex(struct timex *);
951
952asmlinkage long sys32_adjtimex(struct compat_timex __user *utp)
953{
954 struct timex txc;
955 int ret;
956
957 memset(&txc, 0, sizeof(struct timex));
958
959 if (get_user(txc.modes, &utp->modes) ||
960 __get_user(txc.offset, &utp->offset) ||
961 __get_user(txc.freq, &utp->freq) ||
962 __get_user(txc.maxerror, &utp->maxerror) ||
963 __get_user(txc.esterror, &utp->esterror) ||
964 __get_user(txc.status, &utp->status) ||
965 __get_user(txc.constant, &utp->constant) ||
966 __get_user(txc.precision, &utp->precision) ||
967 __get_user(txc.tolerance, &utp->tolerance) ||
968 __get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
969 __get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
970 __get_user(txc.tick, &utp->tick) ||
971 __get_user(txc.ppsfreq, &utp->ppsfreq) ||
972 __get_user(txc.jitter, &utp->jitter) ||
973 __get_user(txc.shift, &utp->shift) ||
974 __get_user(txc.stabil, &utp->stabil) ||
975 __get_user(txc.jitcnt, &utp->jitcnt) ||
976 __get_user(txc.calcnt, &utp->calcnt) ||
977 __get_user(txc.errcnt, &utp->errcnt) ||
978 __get_user(txc.stbcnt, &utp->stbcnt))
979 return -EFAULT;
980
981 ret = do_adjtimex(&txc);
982
983 if (put_user(txc.modes, &utp->modes) ||
984 __put_user(txc.offset, &utp->offset) ||
985 __put_user(txc.freq, &utp->freq) ||
986 __put_user(txc.maxerror, &utp->maxerror) ||
987 __put_user(txc.esterror, &utp->esterror) ||
988 __put_user(txc.status, &utp->status) ||
989 __put_user(txc.constant, &utp->constant) ||
990 __put_user(txc.precision, &utp->precision) ||
991 __put_user(txc.tolerance, &utp->tolerance) ||
992 __put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
993 __put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
994 __put_user(txc.tick, &utp->tick) ||
995 __put_user(txc.ppsfreq, &utp->ppsfreq) ||
996 __put_user(txc.jitter, &utp->jitter) ||
997 __put_user(txc.shift, &utp->shift) ||
998 __put_user(txc.stabil, &utp->stabil) ||
999 __put_user(txc.jitcnt, &utp->jitcnt) ||
1000 __put_user(txc.calcnt, &utp->calcnt) ||
1001 __put_user(txc.errcnt, &utp->errcnt) ||
1002 __put_user(txc.stbcnt, &utp->stbcnt))
1003 ret = -EFAULT;
1004
1005 return ret;
1006}
1007
1008/* This is just a version for 32-bit applications which does 947/* This is just a version for 32-bit applications which does
1009 * not force O_LARGEFILE on. 948 * not force O_LARGEFILE on.
1010 */ 949 */
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index c3adb7ac167d..3b250f2318fd 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -63,7 +63,7 @@ sys_call_table32:
63/*200*/ .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir 63/*200*/ .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir
64 .word sys32_readahead, sys32_socketcall, sys32_syslog, sys32_lookup_dcookie, sys32_fadvise64 64 .word sys32_readahead, sys32_socketcall, sys32_syslog, sys32_lookup_dcookie, sys32_fadvise64
65/*210*/ .word sys32_fadvise64_64, sys32_tgkill, sys32_waitpid, sys_swapoff, sys32_sysinfo 65/*210*/ .word sys32_fadvise64_64, sys32_tgkill, sys32_waitpid, sys_swapoff, sys32_sysinfo
66 .word sys32_ipc, sys32_sigreturn, sys_clone, sys32_ioprio_get, sys32_adjtimex 66 .word sys32_ipc, sys32_sigreturn, sys_clone, sys32_ioprio_get, compat_sys_adjtimex
67/*220*/ .word sys32_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys32_getpgid 67/*220*/ .word sys32_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys32_getpgid
68 .word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys32_setfsuid16, sys32_setfsgid16 68 .word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys32_setfsuid16, sys32_setfsgid16
69/*230*/ .word sys32_select, compat_sys_time, sys_nis_syscall, compat_sys_stime, compat_sys_statfs64 69/*230*/ .word sys32_select, compat_sys_time, sys_nis_syscall, compat_sys_stime, compat_sys_statfs64
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index 00dee176c08e..7549a4389fbf 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -501,7 +501,7 @@ ia32_sys_call_table:
501 .quad sys_setdomainname 501 .quad sys_setdomainname
502 .quad sys_uname 502 .quad sys_uname
503 .quad sys_modify_ldt 503 .quad sys_modify_ldt
504 .quad sys32_adjtimex 504 .quad compat_sys_adjtimex
505 .quad sys32_mprotect /* 125 */ 505 .quad sys32_mprotect /* 125 */
506 .quad compat_sys_sigprocmask 506 .quad compat_sys_sigprocmask
507 .quad quiet_ni_syscall /* create_module */ 507 .quad quiet_ni_syscall /* create_module */
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c
index b13121e451a8..f182b20858e2 100644
--- a/arch/x86_64/ia32/sys_ia32.c
+++ b/arch/x86_64/ia32/sys_ia32.c
@@ -30,7 +30,6 @@
30#include <linux/resource.h> 30#include <linux/resource.h>
31#include <linux/times.h> 31#include <linux/times.h>
32#include <linux/utsname.h> 32#include <linux/utsname.h>
33#include <linux/timex.h>
34#include <linux/smp.h> 33#include <linux/smp.h>
35#include <linux/smp_lock.h> 34#include <linux/smp_lock.h>
36#include <linux/sem.h> 35#include <linux/sem.h>
@@ -767,69 +766,6 @@ sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
767 return ret; 766 return ret;
768} 767}
769 768
770/* Handle adjtimex compatibility. */
771
772extern int do_adjtimex(struct timex *);
773
774asmlinkage long
775sys32_adjtimex(struct compat_timex __user *utp)
776{
777 struct timex txc;
778 int ret;
779
780 memset(&txc, 0, sizeof(struct timex));
781
782 if (!access_ok(VERIFY_READ, utp, sizeof(struct compat_timex)) ||
783 __get_user(txc.modes, &utp->modes) ||
784 __get_user(txc.offset, &utp->offset) ||
785 __get_user(txc.freq, &utp->freq) ||
786 __get_user(txc.maxerror, &utp->maxerror) ||
787 __get_user(txc.esterror, &utp->esterror) ||
788 __get_user(txc.status, &utp->status) ||
789 __get_user(txc.constant, &utp->constant) ||
790 __get_user(txc.precision, &utp->precision) ||
791 __get_user(txc.tolerance, &utp->tolerance) ||
792 __get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
793 __get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
794 __get_user(txc.tick, &utp->tick) ||
795 __get_user(txc.ppsfreq, &utp->ppsfreq) ||
796 __get_user(txc.jitter, &utp->jitter) ||
797 __get_user(txc.shift, &utp->shift) ||
798 __get_user(txc.stabil, &utp->stabil) ||
799 __get_user(txc.jitcnt, &utp->jitcnt) ||
800 __get_user(txc.calcnt, &utp->calcnt) ||
801 __get_user(txc.errcnt, &utp->errcnt) ||
802 __get_user(txc.stbcnt, &utp->stbcnt))
803 return -EFAULT;
804
805 ret = do_adjtimex(&txc);
806
807 if (!access_ok(VERIFY_WRITE, utp, sizeof(struct compat_timex)) ||
808 __put_user(txc.modes, &utp->modes) ||
809 __put_user(txc.offset, &utp->offset) ||
810 __put_user(txc.freq, &utp->freq) ||
811 __put_user(txc.maxerror, &utp->maxerror) ||
812 __put_user(txc.esterror, &utp->esterror) ||
813 __put_user(txc.status, &utp->status) ||
814 __put_user(txc.constant, &utp->constant) ||
815 __put_user(txc.precision, &utp->precision) ||
816 __put_user(txc.tolerance, &utp->tolerance) ||
817 __put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
818 __put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
819 __put_user(txc.tick, &utp->tick) ||
820 __put_user(txc.ppsfreq, &utp->ppsfreq) ||
821 __put_user(txc.jitter, &utp->jitter) ||
822 __put_user(txc.shift, &utp->shift) ||
823 __put_user(txc.stabil, &utp->stabil) ||
824 __put_user(txc.jitcnt, &utp->jitcnt) ||
825 __put_user(txc.calcnt, &utp->calcnt) ||
826 __put_user(txc.errcnt, &utp->errcnt) ||
827 __put_user(txc.stbcnt, &utp->stbcnt))
828 ret = -EFAULT;
829
830 return ret;
831}
832
833asmlinkage long sys32_mmap2(unsigned long addr, unsigned long len, 769asmlinkage long sys32_mmap2(unsigned long addr, unsigned long len,
834 unsigned long prot, unsigned long flags, 770 unsigned long prot, unsigned long flags,
835 unsigned long fd, unsigned long pgoff) 771 unsigned long fd, unsigned long pgoff)
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 859f95700d36..24d659cdbafe 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -207,5 +207,7 @@ static inline int compat_timespec_compare(struct compat_timespec *lhs,
207 return lhs->tv_nsec - rhs->tv_nsec; 207 return lhs->tv_nsec - rhs->tv_nsec;
208} 208}
209 209
210asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
211
210#endif /* CONFIG_COMPAT */ 212#endif /* CONFIG_COMPAT */
211#endif /* _LINUX_COMPAT_H */ 213#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 82dc9ae79d37..03914b7e41b1 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -307,6 +307,8 @@ time_interpolator_reset(void)
307/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ 307/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */
308extern u64 current_tick_length(void); 308extern u64 current_tick_length(void);
309 309
310extern int do_adjtimex(struct timex *);
311
310#endif /* KERNEL */ 312#endif /* KERNEL */
311 313
312#endif /* LINUX_TIMEX_H */ 314#endif /* LINUX_TIMEX_H */
diff --git a/kernel/compat.c b/kernel/compat.c
index 8c9cd88b6785..b9bdd1271f44 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -21,6 +21,7 @@
21#include <linux/syscalls.h> 21#include <linux/syscalls.h>
22#include <linux/unistd.h> 22#include <linux/unistd.h>
23#include <linux/security.h> 23#include <linux/security.h>
24#include <linux/timex.h>
24 25
25#include <asm/uaccess.h> 26#include <asm/uaccess.h>
26 27
@@ -898,3 +899,61 @@ asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, compat
898 return -ERESTARTNOHAND; 899 return -ERESTARTNOHAND;
899} 900}
900#endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */ 901#endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */
902
903asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp)
904{
905 struct timex txc;
906 int ret;
907
908 memset(&txc, 0, sizeof(struct timex));
909
910 if (!access_ok(VERIFY_READ, utp, sizeof(struct compat_timex)) ||
911 __get_user(txc.modes, &utp->modes) ||
912 __get_user(txc.offset, &utp->offset) ||
913 __get_user(txc.freq, &utp->freq) ||
914 __get_user(txc.maxerror, &utp->maxerror) ||
915 __get_user(txc.esterror, &utp->esterror) ||
916 __get_user(txc.status, &utp->status) ||
917 __get_user(txc.constant, &utp->constant) ||
918 __get_user(txc.precision, &utp->precision) ||
919 __get_user(txc.tolerance, &utp->tolerance) ||
920 __get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
921 __get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
922 __get_user(txc.tick, &utp->tick) ||
923 __get_user(txc.ppsfreq, &utp->ppsfreq) ||
924 __get_user(txc.jitter, &utp->jitter) ||
925 __get_user(txc.shift, &utp->shift) ||
926 __get_user(txc.stabil, &utp->stabil) ||
927 __get_user(txc.jitcnt, &utp->jitcnt) ||
928 __get_user(txc.calcnt, &utp->calcnt) ||
929 __get_user(txc.errcnt, &utp->errcnt) ||
930 __get_user(txc.stbcnt, &utp->stbcnt))
931 return -EFAULT;
932
933 ret = do_adjtimex(&txc);
934
935 if (!access_ok(VERIFY_WRITE, utp, sizeof(struct compat_timex)) ||
936 __put_user(txc.modes, &utp->modes) ||
937 __put_user(txc.offset, &utp->offset) ||
938 __put_user(txc.freq, &utp->freq) ||
939 __put_user(txc.maxerror, &utp->maxerror) ||
940 __put_user(txc.esterror, &utp->esterror) ||
941 __put_user(txc.status, &utp->status) ||
942 __put_user(txc.constant, &utp->constant) ||
943 __put_user(txc.precision, &utp->precision) ||
944 __put_user(txc.tolerance, &utp->tolerance) ||
945 __put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
946 __put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
947 __put_user(txc.tick, &utp->tick) ||
948 __put_user(txc.ppsfreq, &utp->ppsfreq) ||
949 __put_user(txc.jitter, &utp->jitter) ||
950 __put_user(txc.shift, &utp->shift) ||
951 __put_user(txc.stabil, &utp->stabil) ||
952 __put_user(txc.jitcnt, &utp->jitcnt) ||
953 __put_user(txc.calcnt, &utp->calcnt) ||
954 __put_user(txc.errcnt, &utp->errcnt) ||
955 __put_user(txc.stbcnt, &utp->stbcnt))
956 ret = -EFAULT;
957
958 return ret;
959}