aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/isa.c17
-rw-r--r--arch/arm/mach-bcmring/arch.c8
-rw-r--r--arch/frv/kernel/pm.c114
-rw-r--r--arch/frv/kernel/sysctl.c7
-rw-r--r--arch/ia64/ia32/ia32_entry.S2
-rw-r--r--arch/ia64/ia32/sys_ia32.c55
-rw-r--r--arch/ia64/kernel/crash.c11
-rw-r--r--arch/ia64/kernel/perfmon.c14
-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/mips/lasat/sysctl.c121
-rw-r--r--arch/parisc/kernel/sys_parisc32.c71
-rw-r--r--arch/parisc/kernel/syscall_table.S2
-rw-r--r--arch/powerpc/kernel/idle.c4
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c52
-rw-r--r--arch/s390/appldata/appldata_base.c4
-rw-r--r--arch/s390/kernel/compat_linux.c53
-rw-r--r--arch/s390/kernel/compat_linux.h2
-rw-r--r--arch/s390/kernel/compat_wrapper.S6
-rw-r--r--arch/s390/kernel/debug.c13
-rw-r--r--arch/s390/mm/cmm.c11
-rw-r--r--arch/sh/kernel/traps_64.c13
-rw-r--r--arch/sparc/kernel/sys_sparc32.c57
-rw-r--r--arch/sparc/kernel/systbls_64.S2
-rw-r--r--arch/x86/ia32/ia32entry.S2
-rw-r--r--arch/x86/ia32/sys_ia32.c56
-rw-r--r--arch/x86/include/asm/sys_ia32.h5
-rw-r--r--arch/x86/kernel/vsyscall_64.c2
-rw-r--r--arch/x86/vdso/vdso32-setup.c1
30 files changed, 60 insertions, 710 deletions
diff --git a/arch/arm/kernel/isa.c b/arch/arm/kernel/isa.c
index 8ac9b8424007..346485910732 100644
--- a/arch/arm/kernel/isa.c
+++ b/arch/arm/kernel/isa.c
@@ -22,47 +22,42 @@ static unsigned int isa_membase, isa_portbase, isa_portshift;
22 22
23static ctl_table ctl_isa_vars[4] = { 23static ctl_table ctl_isa_vars[4] = {
24 { 24 {
25 .ctl_name = BUS_ISA_MEM_BASE,
26 .procname = "membase", 25 .procname = "membase",
27 .data = &isa_membase, 26 .data = &isa_membase,
28 .maxlen = sizeof(isa_membase), 27 .maxlen = sizeof(isa_membase),
29 .mode = 0444, 28 .mode = 0444,
30 .proc_handler = &proc_dointvec, 29 .proc_handler = proc_dointvec,
31 }, { 30 }, {
32 .ctl_name = BUS_ISA_PORT_BASE,
33 .procname = "portbase", 31 .procname = "portbase",
34 .data = &isa_portbase, 32 .data = &isa_portbase,
35 .maxlen = sizeof(isa_portbase), 33 .maxlen = sizeof(isa_portbase),
36 .mode = 0444, 34 .mode = 0444,
37 .proc_handler = &proc_dointvec, 35 .proc_handler = proc_dointvec,
38 }, { 36 }, {
39 .ctl_name = BUS_ISA_PORT_SHIFT,
40 .procname = "portshift", 37 .procname = "portshift",
41 .data = &isa_portshift, 38 .data = &isa_portshift,
42 .maxlen = sizeof(isa_portshift), 39 .maxlen = sizeof(isa_portshift),
43 .mode = 0444, 40 .mode = 0444,
44 .proc_handler = &proc_dointvec, 41 .proc_handler = proc_dointvec,
45 }, {0} 42 }, {}
46}; 43};
47 44
48static struct ctl_table_header *isa_sysctl_header; 45static struct ctl_table_header *isa_sysctl_header;
49 46
50static ctl_table ctl_isa[2] = { 47static ctl_table ctl_isa[2] = {
51 { 48 {
52 .ctl_name = CTL_BUS_ISA,
53 .procname = "isa", 49 .procname = "isa",
54 .mode = 0555, 50 .mode = 0555,
55 .child = ctl_isa_vars, 51 .child = ctl_isa_vars,
56 }, {0} 52 }, {}
57}; 53};
58 54
59static ctl_table ctl_bus[2] = { 55static ctl_table ctl_bus[2] = {
60 { 56 {
61 .ctl_name = CTL_BUS,
62 .procname = "bus", 57 .procname = "bus",
63 .mode = 0555, 58 .mode = 0555,
64 .child = ctl_isa, 59 .child = ctl_isa,
65 }, {0} 60 }, {}
66}; 61};
67 62
68void __init 63void __init
diff --git a/arch/arm/mach-bcmring/arch.c b/arch/arm/mach-bcmring/arch.c
index 0da693b0f7e1..fbe6fa02c882 100644
--- a/arch/arm/mach-bcmring/arch.c
+++ b/arch/arm/mach-bcmring/arch.c
@@ -47,10 +47,6 @@ HW_DECLARE_SPINLOCK(gpio)
47 EXPORT_SYMBOL(bcmring_gpio_reg_lock); 47 EXPORT_SYMBOL(bcmring_gpio_reg_lock);
48#endif 48#endif
49 49
50/* FIXME: temporary solution */
51#define BCM_SYSCTL_REBOOT_WARM 1
52#define CTL_BCM_REBOOT 112
53
54/* sysctl */ 50/* sysctl */
55int bcmring_arch_warm_reboot; /* do a warm reboot on hard reset */ 51int bcmring_arch_warm_reboot; /* do a warm reboot on hard reset */
56 52
@@ -58,18 +54,16 @@ static struct ctl_table_header *bcmring_sysctl_header;
58 54
59static struct ctl_table bcmring_sysctl_warm_reboot[] = { 55static struct ctl_table bcmring_sysctl_warm_reboot[] = {
60 { 56 {
61 .ctl_name = BCM_SYSCTL_REBOOT_WARM,
62 .procname = "warm", 57 .procname = "warm",
63 .data = &bcmring_arch_warm_reboot, 58 .data = &bcmring_arch_warm_reboot,
64 .maxlen = sizeof(int), 59 .maxlen = sizeof(int),
65 .mode = 0644, 60 .mode = 0644,
66 .proc_handler = &proc_dointvec}, 61 .proc_handler = proc_dointvec},
67 {} 62 {}
68}; 63};
69 64
70static struct ctl_table bcmring_sysctl_reboot[] = { 65static struct ctl_table bcmring_sysctl_reboot[] = {
71 { 66 {
72 .ctl_name = CTL_BCM_REBOOT,
73 .procname = "reboot", 67 .procname = "reboot",
74 .mode = 0555, 68 .mode = 0555,
75 .child = bcmring_sysctl_warm_reboot}, 69 .child = bcmring_sysctl_warm_reboot},
diff --git a/arch/frv/kernel/pm.c b/arch/frv/kernel/pm.c
index 0d4d3e3a4cfc..5fa3889d858b 100644
--- a/arch/frv/kernel/pm.c
+++ b/arch/frv/kernel/pm.c
@@ -211,37 +211,6 @@ static int cmode_procctl(ctl_table *ctl, int write,
211 return try_set_cmode(new_cmode)?:*lenp; 211 return try_set_cmode(new_cmode)?:*lenp;
212} 212}
213 213
214static int cmode_sysctl(ctl_table *table,
215 void __user *oldval, size_t __user *oldlenp,
216 void __user *newval, size_t newlen)
217{
218 if (oldval && oldlenp) {
219 size_t oldlen;
220
221 if (get_user(oldlen, oldlenp))
222 return -EFAULT;
223
224 if (oldlen != sizeof(int))
225 return -EINVAL;
226
227 if (put_user(clock_cmode_current, (unsigned __user *)oldval) ||
228 put_user(sizeof(int), oldlenp))
229 return -EFAULT;
230 }
231 if (newval && newlen) {
232 int new_cmode;
233
234 if (newlen != sizeof(int))
235 return -EINVAL;
236
237 if (get_user(new_cmode, (int __user *)newval))
238 return -EFAULT;
239
240 return try_set_cmode(new_cmode)?:1;
241 }
242 return 1;
243}
244
245static int try_set_p0(int new_p0) 214static int try_set_p0(int new_p0)
246{ 215{
247 unsigned long flags, clkc; 216 unsigned long flags, clkc;
@@ -314,37 +283,6 @@ static int p0_procctl(ctl_table *ctl, int write,
314 return try_set_p0(new_p0)?:*lenp; 283 return try_set_p0(new_p0)?:*lenp;
315} 284}
316 285
317static int p0_sysctl(ctl_table *table,
318 void __user *oldval, size_t __user *oldlenp,
319 void __user *newval, size_t newlen)
320{
321 if (oldval && oldlenp) {
322 size_t oldlen;
323
324 if (get_user(oldlen, oldlenp))
325 return -EFAULT;
326
327 if (oldlen != sizeof(int))
328 return -EINVAL;
329
330 if (put_user(clock_p0_current, (unsigned __user *)oldval) ||
331 put_user(sizeof(int), oldlenp))
332 return -EFAULT;
333 }
334 if (newval && newlen) {
335 int new_p0;
336
337 if (newlen != sizeof(int))
338 return -EINVAL;
339
340 if (get_user(new_p0, (int __user *)newval))
341 return -EFAULT;
342
343 return try_set_p0(new_p0)?:1;
344 }
345 return 1;
346}
347
348static int cm_procctl(ctl_table *ctl, int write, 286static int cm_procctl(ctl_table *ctl, int write,
349 void __user *buffer, size_t *lenp, loff_t *fpos) 287 void __user *buffer, size_t *lenp, loff_t *fpos)
350{ 288{
@@ -358,87 +296,47 @@ static int cm_procctl(ctl_table *ctl, int write,
358 return try_set_cm(new_cm)?:*lenp; 296 return try_set_cm(new_cm)?:*lenp;
359} 297}
360 298
361static int cm_sysctl(ctl_table *table,
362 void __user *oldval, size_t __user *oldlenp,
363 void __user *newval, size_t newlen)
364{
365 if (oldval && oldlenp) {
366 size_t oldlen;
367
368 if (get_user(oldlen, oldlenp))
369 return -EFAULT;
370
371 if (oldlen != sizeof(int))
372 return -EINVAL;
373
374 if (put_user(clock_cm_current, (unsigned __user *)oldval) ||
375 put_user(sizeof(int), oldlenp))
376 return -EFAULT;
377 }
378 if (newval && newlen) {
379 int new_cm;
380
381 if (newlen != sizeof(int))
382 return -EINVAL;
383
384 if (get_user(new_cm, (int __user *)newval))
385 return -EFAULT;
386
387 return try_set_cm(new_cm)?:1;
388 }
389 return 1;
390}
391
392
393static struct ctl_table pm_table[] = 299static struct ctl_table pm_table[] =
394{ 300{
395 { 301 {
396 .ctl_name = CTL_PM_SUSPEND,
397 .procname = "suspend", 302 .procname = "suspend",
398 .data = NULL, 303 .data = NULL,
399 .maxlen = 0, 304 .maxlen = 0,
400 .mode = 0200, 305 .mode = 0200,
401 .proc_handler = &sysctl_pm_do_suspend, 306 .proc_handler = sysctl_pm_do_suspend,
402 }, 307 },
403 { 308 {
404 .ctl_name = CTL_PM_CMODE,
405 .procname = "cmode", 309 .procname = "cmode",
406 .data = &clock_cmode_current, 310 .data = &clock_cmode_current,
407 .maxlen = sizeof(int), 311 .maxlen = sizeof(int),
408 .mode = 0644, 312 .mode = 0644,
409 .proc_handler = &cmode_procctl, 313 .proc_handler = cmode_procctl,
410 .strategy = &cmode_sysctl,
411 }, 314 },
412 { 315 {
413 .ctl_name = CTL_PM_P0,
414 .procname = "p0", 316 .procname = "p0",
415 .data = &clock_p0_current, 317 .data = &clock_p0_current,
416 .maxlen = sizeof(int), 318 .maxlen = sizeof(int),
417 .mode = 0644, 319 .mode = 0644,
418 .proc_handler = &p0_procctl, 320 .proc_handler = p0_procctl,
419 .strategy = &p0_sysctl,
420 }, 321 },
421 { 322 {
422 .ctl_name = CTL_PM_CM,
423 .procname = "cm", 323 .procname = "cm",
424 .data = &clock_cm_current, 324 .data = &clock_cm_current,
425 .maxlen = sizeof(int), 325 .maxlen = sizeof(int),
426 .mode = 0644, 326 .mode = 0644,
427 .proc_handler = &cm_procctl, 327 .proc_handler = cm_procctl,
428 .strategy = &cm_sysctl,
429 }, 328 },
430 { .ctl_name = 0} 329 { }
431}; 330};
432 331
433static struct ctl_table pm_dir_table[] = 332static struct ctl_table pm_dir_table[] =
434{ 333{
435 { 334 {
436 .ctl_name = CTL_PM,
437 .procname = "pm", 335 .procname = "pm",
438 .mode = 0555, 336 .mode = 0555,
439 .child = pm_table, 337 .child = pm_table,
440 }, 338 },
441 { .ctl_name = 0} 339 { }
442}; 340};
443 341
444/* 342/*
diff --git a/arch/frv/kernel/sysctl.c b/arch/frv/kernel/sysctl.c
index 3e9d7e03fb95..035516cb7a97 100644
--- a/arch/frv/kernel/sysctl.c
+++ b/arch/frv/kernel/sysctl.c
@@ -176,21 +176,19 @@ static int procctl_frv_pin_cxnr(ctl_table *table, int write, struct file *filp,
176static struct ctl_table frv_table[] = 176static struct ctl_table frv_table[] =
177{ 177{
178 { 178 {
179 .ctl_name = 1,
180 .procname = "cache-mode", 179 .procname = "cache-mode",
181 .data = NULL, 180 .data = NULL,
182 .maxlen = 0, 181 .maxlen = 0,
183 .mode = 0644, 182 .mode = 0644,
184 .proc_handler = &procctl_frv_cachemode, 183 .proc_handler = procctl_frv_cachemode,
185 }, 184 },
186#ifdef CONFIG_MMU 185#ifdef CONFIG_MMU
187 { 186 {
188 .ctl_name = 2,
189 .procname = "pin-cxnr", 187 .procname = "pin-cxnr",
190 .data = NULL, 188 .data = NULL,
191 .maxlen = 0, 189 .maxlen = 0,
192 .mode = 0644, 190 .mode = 0644,
193 .proc_handler = &procctl_frv_pin_cxnr 191 .proc_handler = procctl_frv_pin_cxnr
194 }, 192 },
195#endif 193#endif
196 {} 194 {}
@@ -203,7 +201,6 @@ static struct ctl_table frv_table[] =
203static struct ctl_table frv_dir_table[] = 201static struct ctl_table frv_dir_table[] =
204{ 202{
205 { 203 {
206 .ctl_name = CTL_FRV,
207 .procname = "frv", 204 .procname = "frv",
208 .mode = 0555, 205 .mode = 0555,
209 .child = frv_table 206 .child = frv_table
diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S
index af9405cd70e5..10c37510f4b4 100644
--- a/arch/ia64/ia32/ia32_entry.S
+++ b/arch/ia64/ia32/ia32_entry.S
@@ -327,7 +327,7 @@ ia32_syscall_table:
327 data8 compat_sys_writev 327 data8 compat_sys_writev
328 data8 sys_getsid 328 data8 sys_getsid
329 data8 sys_fdatasync 329 data8 sys_fdatasync
330 data8 sys32_sysctl 330 data8 compat_sys_sysctl
331 data8 sys_mlock /* 150 */ 331 data8 sys_mlock /* 150 */
332 data8 sys_munlock 332 data8 sys_munlock
333 data8 sys_mlockall 333 data8 sys_mlockall
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index 625ed8f76fce..429ec968c9ee 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -1628,61 +1628,6 @@ sys32_msync (unsigned int start, unsigned int len, int flags)
1628 return sys_msync(addr, len + (start - addr), flags); 1628 return sys_msync(addr, len + (start - addr), flags);
1629} 1629}
1630 1630
1631struct sysctl32 {
1632 unsigned int name;
1633 int nlen;
1634 unsigned int oldval;
1635 unsigned int oldlenp;
1636 unsigned int newval;
1637 unsigned int newlen;
1638 unsigned int __unused[4];
1639};
1640
1641#ifdef CONFIG_SYSCTL_SYSCALL
1642asmlinkage long
1643sys32_sysctl (struct sysctl32 __user *args)
1644{
1645 struct sysctl32 a32;
1646 mm_segment_t old_fs = get_fs ();
1647 void __user *oldvalp, *newvalp;
1648 size_t oldlen;
1649 int __user *namep;
1650 long ret;
1651
1652 if (copy_from_user(&a32, args, sizeof(a32)))
1653 return -EFAULT;
1654
1655 /*
1656 * We need to pre-validate these because we have to disable address checking
1657 * before calling do_sysctl() because of OLDLEN but we can't run the risk of the
1658 * user specifying bad addresses here. Well, since we're dealing with 32 bit
1659 * addresses, we KNOW that access_ok() will always succeed, so this is an
1660 * expensive NOP, but so what...
1661 */
1662 namep = (int __user *) compat_ptr(a32.name);
1663 oldvalp = compat_ptr(a32.oldval);
1664 newvalp = compat_ptr(a32.newval);
1665
1666 if ((oldvalp && get_user(oldlen, (int __user *) compat_ptr(a32.oldlenp)))
1667 || !access_ok(VERIFY_WRITE, namep, 0)
1668 || !access_ok(VERIFY_WRITE, oldvalp, 0)
1669 || !access_ok(VERIFY_WRITE, newvalp, 0))
1670 return -EFAULT;
1671
1672 set_fs(KERNEL_DS);
1673 lock_kernel();
1674 ret = do_sysctl(namep, a32.nlen, oldvalp, (size_t __user *) &oldlen,
1675 newvalp, (size_t) a32.newlen);
1676 unlock_kernel();
1677 set_fs(old_fs);
1678
1679 if (oldvalp && put_user (oldlen, (int __user *) compat_ptr(a32.oldlenp)))
1680 return -EFAULT;
1681
1682 return ret;
1683}
1684#endif
1685
1686asmlinkage long 1631asmlinkage long
1687sys32_newuname (struct new_utsname __user *name) 1632sys32_newuname (struct new_utsname __user *name)
1688{ 1633{
diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c
index 6631a9dfafdc..b942f4032d7a 100644
--- a/arch/ia64/kernel/crash.c
+++ b/arch/ia64/kernel/crash.c
@@ -239,32 +239,29 @@ kdump_init_notifier(struct notifier_block *self, unsigned long val, void *data)
239#ifdef CONFIG_SYSCTL 239#ifdef CONFIG_SYSCTL
240static ctl_table kdump_ctl_table[] = { 240static ctl_table kdump_ctl_table[] = {
241 { 241 {
242 .ctl_name = CTL_UNNUMBERED,
243 .procname = "kdump_on_init", 242 .procname = "kdump_on_init",
244 .data = &kdump_on_init, 243 .data = &kdump_on_init,
245 .maxlen = sizeof(int), 244 .maxlen = sizeof(int),
246 .mode = 0644, 245 .mode = 0644,
247 .proc_handler = &proc_dointvec, 246 .proc_handler = proc_dointvec,
248 }, 247 },
249 { 248 {
250 .ctl_name = CTL_UNNUMBERED,
251 .procname = "kdump_on_fatal_mca", 249 .procname = "kdump_on_fatal_mca",
252 .data = &kdump_on_fatal_mca, 250 .data = &kdump_on_fatal_mca,
253 .maxlen = sizeof(int), 251 .maxlen = sizeof(int),
254 .mode = 0644, 252 .mode = 0644,
255 .proc_handler = &proc_dointvec, 253 .proc_handler = proc_dointvec,
256 }, 254 },
257 { .ctl_name = 0 } 255 { }
258}; 256};
259 257
260static ctl_table sys_table[] = { 258static ctl_table sys_table[] = {
261 { 259 {
262 .ctl_name = CTL_KERN,
263 .procname = "kernel", 260 .procname = "kernel",
264 .mode = 0555, 261 .mode = 0555,
265 .child = kdump_ctl_table, 262 .child = kdump_ctl_table,
266 }, 263 },
267 { .ctl_name = 0 } 264 { }
268}; 265};
269#endif 266#endif
270 267
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index f1782705b1f7..402698b6689f 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -522,42 +522,37 @@ EXPORT_SYMBOL(pfm_sysctl);
522 522
523static ctl_table pfm_ctl_table[]={ 523static ctl_table pfm_ctl_table[]={
524 { 524 {
525 .ctl_name = CTL_UNNUMBERED,
526 .procname = "debug", 525 .procname = "debug",
527 .data = &pfm_sysctl.debug, 526 .data = &pfm_sysctl.debug,
528 .maxlen = sizeof(int), 527 .maxlen = sizeof(int),
529 .mode = 0666, 528 .mode = 0666,
530 .proc_handler = &proc_dointvec, 529 .proc_handler = proc_dointvec,
531 }, 530 },
532 { 531 {
533 .ctl_name = CTL_UNNUMBERED,
534 .procname = "debug_ovfl", 532 .procname = "debug_ovfl",
535 .data = &pfm_sysctl.debug_ovfl, 533 .data = &pfm_sysctl.debug_ovfl,
536 .maxlen = sizeof(int), 534 .maxlen = sizeof(int),
537 .mode = 0666, 535 .mode = 0666,
538 .proc_handler = &proc_dointvec, 536 .proc_handler = proc_dointvec,
539 }, 537 },
540 { 538 {
541 .ctl_name = CTL_UNNUMBERED,
542 .procname = "fastctxsw", 539 .procname = "fastctxsw",
543 .data = &pfm_sysctl.fastctxsw, 540 .data = &pfm_sysctl.fastctxsw,
544 .maxlen = sizeof(int), 541 .maxlen = sizeof(int),
545 .mode = 0600, 542 .mode = 0600,
546 .proc_handler = &proc_dointvec, 543 .proc_handler = proc_dointvec,
547 }, 544 },
548 { 545 {
549 .ctl_name = CTL_UNNUMBERED,
550 .procname = "expert_mode", 546 .procname = "expert_mode",
551 .data = &pfm_sysctl.expert_mode, 547 .data = &pfm_sysctl.expert_mode,
552 .maxlen = sizeof(int), 548 .maxlen = sizeof(int),
553 .mode = 0600, 549 .mode = 0600,
554 .proc_handler = &proc_dointvec, 550 .proc_handler = proc_dointvec,
555 }, 551 },
556 {} 552 {}
557}; 553};
558static ctl_table pfm_sysctl_dir[] = { 554static ctl_table pfm_sysctl_dir[] = {
559 { 555 {
560 .ctl_name = CTL_UNNUMBERED,
561 .procname = "perfmon", 556 .procname = "perfmon",
562 .mode = 0555, 557 .mode = 0555,
563 .child = pfm_ctl_table, 558 .child = pfm_ctl_table,
@@ -566,7 +561,6 @@ static ctl_table pfm_sysctl_dir[] = {
566}; 561};
567static ctl_table pfm_sysctl_root[] = { 562static ctl_table pfm_sysctl_root[] = {
568 { 563 {
569 .ctl_name = CTL_KERN,
570 .procname = "kernel", 564 .procname = "kernel",
571 .mode = 0555, 565 .mode = 0555,
572 .child = pfm_sysctl_dir, 566 .child = pfm_sysctl_dir,
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index b77fefaff9da..1a2793efdc4e 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -265,67 +265,6 @@ SYSCALL_DEFINE5(n32_msgrcv, int, msqid, u32, msgp, size_t, msgsz,
265} 265}
266#endif 266#endif
267 267
268struct sysctl_args32
269{
270 compat_caddr_t name;
271 int nlen;
272 compat_caddr_t oldval;
273 compat_caddr_t oldlenp;
274 compat_caddr_t newval;
275 compat_size_t newlen;
276 unsigned int __unused[4];
277};
278
279#ifdef CONFIG_SYSCTL_SYSCALL
280
281SYSCALL_DEFINE1(32_sysctl, struct sysctl_args32 __user *, args)
282{
283 struct sysctl_args32 tmp;
284 int error;
285 size_t oldlen;
286 size_t __user *oldlenp = NULL;
287 unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7;
288
289 if (copy_from_user(&tmp, args, sizeof(tmp)))
290 return -EFAULT;
291
292 if (tmp.oldval && tmp.oldlenp) {
293 /* Duh, this is ugly and might not work if sysctl_args
294 is in read-only memory, but do_sysctl does indirectly
295 a lot of uaccess in both directions and we'd have to
296 basically copy the whole sysctl.c here, and
297 glibc's __sysctl uses rw memory for the structure
298 anyway. */
299 if (get_user(oldlen, (u32 __user *)A(tmp.oldlenp)) ||
300 put_user(oldlen, (size_t __user *)addr))
301 return -EFAULT;
302 oldlenp = (size_t __user *)addr;
303 }
304
305 lock_kernel();
306 error = do_sysctl((int __user *)A(tmp.name), tmp.nlen, (void __user *)A(tmp.oldval),
307 oldlenp, (void __user *)A(tmp.newval), tmp.newlen);
308 unlock_kernel();
309 if (oldlenp) {
310 if (!error) {
311 if (get_user(oldlen, (size_t __user *)addr) ||
312 put_user(oldlen, (u32 __user *)A(tmp.oldlenp)))
313 error = -EFAULT;
314 }
315 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
316 }
317 return error;
318}
319
320#else
321
322SYSCALL_DEFINE1(32_sysctl, struct sysctl_args32 __user *, args)
323{
324 return -ENOSYS;
325}
326
327#endif /* CONFIG_SYSCTL_SYSCALL */
328
329SYSCALL_DEFINE1(32_newuname, struct new_utsname __user *, name) 268SYSCALL_DEFINE1(32_newuname, struct new_utsname __user *, name)
330{ 269{
331 int ret = 0; 270 int ret = 0;
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 6ebc07976694..8a0be0bdebad 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -272,7 +272,7 @@ EXPORT(sysn32_call_table)
272 PTR sys_munlockall 272 PTR sys_munlockall
273 PTR sys_vhangup /* 6150 */ 273 PTR sys_vhangup /* 6150 */
274 PTR sys_pivot_root 274 PTR sys_pivot_root
275 PTR sys_32_sysctl 275 PTR compat_sys_sysctl
276 PTR sys_prctl 276 PTR sys_prctl
277 PTR compat_sys_adjtimex 277 PTR compat_sys_adjtimex
278 PTR compat_sys_setrlimit /* 6155 */ 278 PTR compat_sys_setrlimit /* 6155 */
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 14dde4ca932e..41dbdb7d67e5 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -356,7 +356,7 @@ sys_call_table:
356 PTR sys_ni_syscall /* 4150 */ 356 PTR sys_ni_syscall /* 4150 */
357 PTR sys_getsid 357 PTR sys_getsid
358 PTR sys_fdatasync 358 PTR sys_fdatasync
359 PTR sys_32_sysctl 359 PTR compat_sys_sysctl
360 PTR sys_mlock 360 PTR sys_mlock
361 PTR sys_munlock /* 4155 */ 361 PTR sys_munlock /* 4155 */
362 PTR sys_mlockall 362 PTR sys_mlockall
diff --git a/arch/mips/lasat/sysctl.c b/arch/mips/lasat/sysctl.c
index b3deed8db619..14b9a28a4aec 100644
--- a/arch/mips/lasat/sysctl.c
+++ b/arch/mips/lasat/sysctl.c
@@ -37,23 +37,6 @@
37#include "ds1603.h" 37#include "ds1603.h"
38#endif 38#endif
39 39
40/* Strategy function to write EEPROM after changing string entry */
41int sysctl_lasatstring(ctl_table *table,
42 void *oldval, size_t *oldlenp,
43 void *newval, size_t newlen)
44{
45 int r;
46
47 r = sysctl_string(table, oldval, oldlenp, newval, newlen);
48 if (r < 0)
49 return r;
50
51 if (newval && newlen)
52 lasat_write_eeprom_info();
53
54 return 0;
55}
56
57 40
58/* And the same for proc */ 41/* And the same for proc */
59int proc_dolasatstring(ctl_table *table, int write, 42int proc_dolasatstring(ctl_table *table, int write,
@@ -113,46 +96,6 @@ int proc_dolasatrtc(ctl_table *table, int write,
113} 96}
114#endif 97#endif
115 98
116/* Sysctl for setting the IP addresses */
117int sysctl_lasat_intvec(ctl_table *table,
118 void *oldval, size_t *oldlenp,
119 void *newval, size_t newlen)
120{
121 int r;
122
123 r = sysctl_intvec(table, oldval, oldlenp, newval, newlen);
124 if (r < 0)
125 return r;
126
127 if (newval && newlen)
128 lasat_write_eeprom_info();
129
130 return 0;
131}
132
133#ifdef CONFIG_DS1603
134/* Same for RTC */
135int sysctl_lasat_rtc(ctl_table *table,
136 void *oldval, size_t *oldlenp,
137 void *newval, size_t newlen)
138{
139 struct timespec ts;
140 int r;
141
142 read_persistent_clock(&ts);
143 rtctmp = ts.tv_sec;
144 if (rtctmp < 0)
145 rtctmp = 0;
146 r = sysctl_intvec(table, oldval, oldlenp, newval, newlen);
147 if (r < 0)
148 return r;
149 if (newval && newlen)
150 rtc_mips_set_mmss(rtctmp);
151
152 return r;
153}
154#endif
155
156#ifdef CONFIG_INET 99#ifdef CONFIG_INET
157int proc_lasat_ip(ctl_table *table, int write, 100int proc_lasat_ip(ctl_table *table, int write,
158 void *buffer, size_t *lenp, loff_t *ppos) 101 void *buffer, size_t *lenp, loff_t *ppos)
@@ -214,23 +157,6 @@ int proc_lasat_ip(ctl_table *table, int write,
214} 157}
215#endif 158#endif
216 159
217static int sysctl_lasat_prid(ctl_table *table,
218 void *oldval, size_t *oldlenp,
219 void *newval, size_t newlen)
220{
221 int r;
222
223 r = sysctl_intvec(table, oldval, oldlenp, newval, newlen);
224 if (r < 0)
225 return r;
226 if (newval && newlen) {
227 lasat_board_info.li_eeprom_info.prid = *(int *)newval;
228 lasat_write_eeprom_info();
229 lasat_init_board_info();
230 }
231 return 0;
232}
233
234int proc_lasat_prid(ctl_table *table, int write, 160int proc_lasat_prid(ctl_table *table, int write,
235 void *buffer, size_t *lenp, loff_t *ppos) 161 void *buffer, size_t *lenp, loff_t *ppos)
236{ 162{
@@ -252,115 +178,92 @@ extern int lasat_boot_to_service;
252 178
253static ctl_table lasat_table[] = { 179static ctl_table lasat_table[] = {
254 { 180 {
255 .ctl_name = CTL_UNNUMBERED,
256 .procname = "cpu-hz", 181 .procname = "cpu-hz",
257 .data = &lasat_board_info.li_cpu_hz, 182 .data = &lasat_board_info.li_cpu_hz,
258 .maxlen = sizeof(int), 183 .maxlen = sizeof(int),
259 .mode = 0444, 184 .mode = 0444,
260 .proc_handler = &proc_dointvec, 185 .proc_handler = proc_dointvec,
261 .strategy = &sysctl_intvec
262 }, 186 },
263 { 187 {
264 .ctl_name = CTL_UNNUMBERED,
265 .procname = "bus-hz", 188 .procname = "bus-hz",
266 .data = &lasat_board_info.li_bus_hz, 189 .data = &lasat_board_info.li_bus_hz,
267 .maxlen = sizeof(int), 190 .maxlen = sizeof(int),
268 .mode = 0444, 191 .mode = 0444,
269 .proc_handler = &proc_dointvec, 192 .proc_handler = proc_dointvec,
270 .strategy = &sysctl_intvec
271 }, 193 },
272 { 194 {
273 .ctl_name = CTL_UNNUMBERED,
274 .procname = "bmid", 195 .procname = "bmid",
275 .data = &lasat_board_info.li_bmid, 196 .data = &lasat_board_info.li_bmid,
276 .maxlen = sizeof(int), 197 .maxlen = sizeof(int),
277 .mode = 0444, 198 .mode = 0444,
278 .proc_handler = &proc_dointvec, 199 .proc_handler = proc_dointvec,
279 .strategy = &sysctl_intvec
280 }, 200 },
281 { 201 {
282 .ctl_name = CTL_UNNUMBERED,
283 .procname = "prid", 202 .procname = "prid",
284 .data = &lasat_board_info.li_prid, 203 .data = &lasat_board_info.li_prid,
285 .maxlen = sizeof(int), 204 .maxlen = sizeof(int),
286 .mode = 0644, 205 .mode = 0644,
287 .proc_handler = &proc_lasat_prid, 206 .proc_handler = proc_lasat_prid,
288 .strategy = &sysctl_lasat_prid 207. },
289 },
290#ifdef CONFIG_INET 208#ifdef CONFIG_INET
291 { 209 {
292 .ctl_name = CTL_UNNUMBERED,
293 .procname = "ipaddr", 210 .procname = "ipaddr",
294 .data = &lasat_board_info.li_eeprom_info.ipaddr, 211 .data = &lasat_board_info.li_eeprom_info.ipaddr,
295 .maxlen = sizeof(int), 212 .maxlen = sizeof(int),
296 .mode = 0644, 213 .mode = 0644,
297 .proc_handler = &proc_lasat_ip, 214 .proc_handler = proc_lasat_ip,
298 .strategy = &sysctl_lasat_intvec
299 }, 215 },
300 { 216 {
301 .ctl_name = CTL_UNNUMBERED,
302 .procname = "netmask", 217 .procname = "netmask",
303 .data = &lasat_board_info.li_eeprom_info.netmask, 218 .data = &lasat_board_info.li_eeprom_info.netmask,
304 .maxlen = sizeof(int), 219 .maxlen = sizeof(int),
305 .mode = 0644, 220 .mode = 0644,
306 .proc_handler = &proc_lasat_ip, 221 .proc_handler = proc_lasat_ip,
307 .strategy = &sysctl_lasat_intvec
308 }, 222 },
309#endif 223#endif
310 { 224 {
311 .ctl_name = CTL_UNNUMBERED,
312 .procname = "passwd_hash", 225 .procname = "passwd_hash",
313 .data = &lasat_board_info.li_eeprom_info.passwd_hash, 226 .data = &lasat_board_info.li_eeprom_info.passwd_hash,
314 .maxlen = 227 .maxlen =
315 sizeof(lasat_board_info.li_eeprom_info.passwd_hash), 228 sizeof(lasat_board_info.li_eeprom_info.passwd_hash),
316 .mode = 0600, 229 .mode = 0600,
317 .proc_handler = &proc_dolasatstring, 230 .proc_handler = proc_dolasatstring,
318 .strategy = &sysctl_lasatstring
319 }, 231 },
320 { 232 {
321 .ctl_name = CTL_UNNUMBERED,
322 .procname = "boot-service", 233 .procname = "boot-service",
323 .data = &lasat_boot_to_service, 234 .data = &lasat_boot_to_service,
324 .maxlen = sizeof(int), 235 .maxlen = sizeof(int),
325 .mode = 0644, 236 .mode = 0644,
326 .proc_handler = &proc_dointvec, 237 .proc_handler = proc_dointvec,
327 .strategy = &sysctl_intvec
328 }, 238 },
329#ifdef CONFIG_DS1603 239#ifdef CONFIG_DS1603
330 { 240 {
331 .ctl_name = CTL_UNNUMBERED,
332 .procname = "rtc", 241 .procname = "rtc",
333 .data = &rtctmp, 242 .data = &rtctmp,
334 .maxlen = sizeof(int), 243 .maxlen = sizeof(int),
335 .mode = 0644, 244 .mode = 0644,
336 .proc_handler = &proc_dolasatrtc, 245 .proc_handler = proc_dolasatrtc,
337 .strategy = &sysctl_lasat_rtc
338 }, 246 },
339#endif 247#endif
340 { 248 {
341 .ctl_name = CTL_UNNUMBERED,
342 .procname = "namestr", 249 .procname = "namestr",
343 .data = &lasat_board_info.li_namestr, 250 .data = &lasat_board_info.li_namestr,
344 .maxlen = sizeof(lasat_board_info.li_namestr), 251 .maxlen = sizeof(lasat_board_info.li_namestr),
345 .mode = 0444, 252 .mode = 0444,
346 .proc_handler = &proc_dostring, 253 .proc_handler = proc_dostring,
347 .strategy = &sysctl_string
348 }, 254 },
349 { 255 {
350 .ctl_name = CTL_UNNUMBERED,
351 .procname = "typestr", 256 .procname = "typestr",
352 .data = &lasat_board_info.li_typestr, 257 .data = &lasat_board_info.li_typestr,
353 .maxlen = sizeof(lasat_board_info.li_typestr), 258 .maxlen = sizeof(lasat_board_info.li_typestr),
354 .mode = 0444, 259 .mode = 0444,
355 .proc_handler = &proc_dostring, 260 .proc_handler = proc_dostring,
356 .strategy = &sysctl_string
357 }, 261 },
358 {} 262 {}
359}; 263};
360 264
361static ctl_table lasat_root_table[] = { 265static ctl_table lasat_root_table[] = {
362 { 266 {
363 .ctl_name = CTL_UNNUMBERED,
364 .procname = "lasat", 267 .procname = "lasat",
365 .mode = 0555, 268 .mode = 0555,
366 .child = lasat_table 269 .child = lasat_table
diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c
index 561388b17c91..76d23ec8dfaa 100644
--- a/arch/parisc/kernel/sys_parisc32.c
+++ b/arch/parisc/kernel/sys_parisc32.c
@@ -90,77 +90,6 @@ asmlinkage long sys32_unimplemented(int r26, int r25, int r24, int r23,
90 return -ENOSYS; 90 return -ENOSYS;
91} 91}
92 92
93#ifdef CONFIG_SYSCTL
94
95struct __sysctl_args32 {
96 u32 name;
97 int nlen;
98 u32 oldval;
99 u32 oldlenp;
100 u32 newval;
101 u32 newlen;
102 u32 __unused[4];
103};
104
105asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
106{
107#ifndef CONFIG_SYSCTL_SYSCALL
108 return -ENOSYS;
109#else
110 struct __sysctl_args32 tmp;
111 int error;
112 unsigned int oldlen32;
113 size_t oldlen, __user *oldlenp = NULL;
114 unsigned long addr = (((long __force)&args->__unused[0]) + 7) & ~7;
115
116 DBG(("sysctl32(%p)\n", args));
117
118 if (copy_from_user(&tmp, args, sizeof(tmp)))
119 return -EFAULT;
120
121 if (tmp.oldval && tmp.oldlenp) {
122 /* Duh, this is ugly and might not work if sysctl_args
123 is in read-only memory, but do_sysctl does indirectly
124 a lot of uaccess in both directions and we'd have to
125 basically copy the whole sysctl.c here, and
126 glibc's __sysctl uses rw memory for the structure
127 anyway. */
128 /* a possibly better hack than this, which will avoid the
129 * problem if the struct is read only, is to push the
130 * 'oldlen' value out to the user's stack instead. -PB
131 */
132 if (get_user(oldlen32, (u32 *)(u64)tmp.oldlenp))
133 return -EFAULT;
134 oldlen = oldlen32;
135 if (put_user(oldlen, (size_t *)addr))
136 return -EFAULT;
137 oldlenp = (size_t *)addr;
138 }
139
140 lock_kernel();
141 error = do_sysctl((int __user *)(u64)tmp.name, tmp.nlen,
142 (void __user *)(u64)tmp.oldval, oldlenp,
143 (void __user *)(u64)tmp.newval, tmp.newlen);
144 unlock_kernel();
145 if (oldlenp) {
146 if (!error) {
147 if (get_user(oldlen, (size_t *)addr)) {
148 error = -EFAULT;
149 } else {
150 oldlen32 = oldlen;
151 if (put_user(oldlen32, (u32 *)(u64)tmp.oldlenp))
152 error = -EFAULT;
153 }
154 }
155 if (copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)))
156 error = -EFAULT;
157 }
158 return error;
159#endif
160}
161
162#endif /* CONFIG_SYSCTL */
163
164asmlinkage long sys32_sched_rr_get_interval(pid_t pid, 93asmlinkage long sys32_sched_rr_get_interval(pid_t pid,
165 struct compat_timespec __user *interval) 94 struct compat_timespec __user *interval)
166{ 95{
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 843f423dec67..01c4fcf8f481 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -234,7 +234,7 @@
234 ENTRY_SAME(getsid) 234 ENTRY_SAME(getsid)
235 ENTRY_SAME(fdatasync) 235 ENTRY_SAME(fdatasync)
236 /* struct __sysctl_args is a mess */ 236 /* struct __sysctl_args is a mess */
237 ENTRY_DIFF(sysctl) 237 ENTRY_COMP(sysctl)
238 ENTRY_SAME(mlock) /* 150 */ 238 ENTRY_SAME(mlock) /* 150 */
239 ENTRY_SAME(munlock) 239 ENTRY_SAME(munlock)
240 ENTRY_SAME(mlockall) 240 ENTRY_SAME(mlockall)
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index 88d9c1d5e5fb..049dda60e475 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -110,18 +110,16 @@ int powersave_nap;
110 */ 110 */
111static ctl_table powersave_nap_ctl_table[]={ 111static ctl_table powersave_nap_ctl_table[]={
112 { 112 {
113 .ctl_name = KERN_PPC_POWERSAVE_NAP,
114 .procname = "powersave-nap", 113 .procname = "powersave-nap",
115 .data = &powersave_nap, 114 .data = &powersave_nap,
116 .maxlen = sizeof(int), 115 .maxlen = sizeof(int),
117 .mode = 0644, 116 .mode = 0644,
118 .proc_handler = &proc_dointvec, 117 .proc_handler = proc_dointvec,
119 }, 118 },
120 {} 119 {}
121}; 120};
122static ctl_table powersave_nap_sysctl_root[] = { 121static ctl_table powersave_nap_sysctl_root[] = {
123 { 122 {
124 .ctl_name = CTL_KERN,
125 .procname = "kernel", 123 .procname = "kernel",
126 .mode = 0555, 124 .mode = 0555,
127 .child = powersave_nap_ctl_table, 125 .child = powersave_nap_ctl_table,
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index b97c2d67f4ac..c5a4732bcc48 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -520,58 +520,6 @@ asmlinkage long compat_sys_umask(u32 mask)
520 return sys_umask((int)mask); 520 return sys_umask((int)mask);
521} 521}
522 522
523#ifdef CONFIG_SYSCTL_SYSCALL
524struct __sysctl_args32 {
525 u32 name;
526 int nlen;
527 u32 oldval;
528 u32 oldlenp;
529 u32 newval;
530 u32 newlen;
531 u32 __unused[4];
532};
533
534asmlinkage long compat_sys_sysctl(struct __sysctl_args32 __user *args)
535{
536 struct __sysctl_args32 tmp;
537 int error;
538 size_t oldlen;
539 size_t __user *oldlenp = NULL;
540 unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7;
541
542 if (copy_from_user(&tmp, args, sizeof(tmp)))
543 return -EFAULT;
544
545 if (tmp.oldval && tmp.oldlenp) {
546 /* Duh, this is ugly and might not work if sysctl_args
547 is in read-only memory, but do_sysctl does indirectly
548 a lot of uaccess in both directions and we'd have to
549 basically copy the whole sysctl.c here, and
550 glibc's __sysctl uses rw memory for the structure
551 anyway. */
552 oldlenp = (size_t __user *)addr;
553 if (get_user(oldlen, (compat_size_t __user *)compat_ptr(tmp.oldlenp)) ||
554 put_user(oldlen, oldlenp))
555 return -EFAULT;
556 }
557
558 lock_kernel();
559 error = do_sysctl(compat_ptr(tmp.name), tmp.nlen,
560 compat_ptr(tmp.oldval), oldlenp,
561 compat_ptr(tmp.newval), tmp.newlen);
562 unlock_kernel();
563 if (oldlenp) {
564 if (!error) {
565 if (get_user(oldlen, oldlenp) ||
566 put_user(oldlen, (compat_size_t __user *)compat_ptr(tmp.oldlenp)))
567 error = -EFAULT;
568 }
569 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
570 }
571 return error;
572}
573#endif
574
575unsigned long compat_sys_mmap2(unsigned long addr, size_t len, 523unsigned long compat_sys_mmap2(unsigned long addr, size_t len,
576 unsigned long prot, unsigned long flags, 524 unsigned long prot, unsigned long flags,
577 unsigned long fd, unsigned long pgoff) 525 unsigned long fd, unsigned long pgoff)
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index b55fd7ed1c31..495589950dc7 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -61,12 +61,12 @@ static struct ctl_table appldata_table[] = {
61 { 61 {
62 .procname = "timer", 62 .procname = "timer",
63 .mode = S_IRUGO | S_IWUSR, 63 .mode = S_IRUGO | S_IWUSR,
64 .proc_handler = &appldata_timer_handler, 64 .proc_handler = appldata_timer_handler,
65 }, 65 },
66 { 66 {
67 .procname = "interval", 67 .procname = "interval",
68 .mode = S_IRUGO | S_IWUSR, 68 .mode = S_IRUGO | S_IWUSR,
69 .proc_handler = &appldata_interval_handler, 69 .proc_handler = appldata_interval_handler,
70 }, 70 },
71 { }, 71 { },
72}; 72};
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 0debcec23a39..fda1a8123f9b 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -527,59 +527,6 @@ asmlinkage long sys32_sendfile64(int out_fd, int in_fd,
527 return ret; 527 return ret;
528} 528}
529 529
530#ifdef CONFIG_SYSCTL_SYSCALL
531struct __sysctl_args32 {
532 u32 name;
533 int nlen;
534 u32 oldval;
535 u32 oldlenp;
536 u32 newval;
537 u32 newlen;
538 u32 __unused[4];
539};
540
541asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
542{
543 struct __sysctl_args32 tmp;
544 int error;
545 size_t oldlen;
546 size_t __user *oldlenp = NULL;
547 unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7;
548
549 if (copy_from_user(&tmp, args, sizeof(tmp)))
550 return -EFAULT;
551
552 if (tmp.oldval && tmp.oldlenp) {
553 /* Duh, this is ugly and might not work if sysctl_args
554 is in read-only memory, but do_sysctl does indirectly
555 a lot of uaccess in both directions and we'd have to
556 basically copy the whole sysctl.c here, and
557 glibc's __sysctl uses rw memory for the structure
558 anyway. */
559 if (get_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)) ||
560 put_user(oldlen, (size_t __user *)addr))
561 return -EFAULT;
562 oldlenp = (size_t __user *)addr;
563 }
564
565 lock_kernel();
566 error = do_sysctl(compat_ptr(tmp.name), tmp.nlen, compat_ptr(tmp.oldval),
567 oldlenp, compat_ptr(tmp.newval), tmp.newlen);
568 unlock_kernel();
569 if (oldlenp) {
570 if (!error) {
571 if (get_user(oldlen, (size_t __user *)addr) ||
572 put_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)))
573 error = -EFAULT;
574 }
575 if (copy_to_user(args->__unused, tmp.__unused,
576 sizeof(tmp.__unused)))
577 error = -EFAULT;
578 }
579 return error;
580}
581#endif
582
583struct stat64_emu31 { 530struct stat64_emu31 {
584 unsigned long long st_dev; 531 unsigned long long st_dev;
585 unsigned int __pad1; 532 unsigned int __pad1;
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index c07f9ca05ade..45e9092b3aad 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -162,7 +162,6 @@ struct ucontext32 {
162 compat_sigset_t uc_sigmask; /* mask last for extensibility */ 162 compat_sigset_t uc_sigmask; /* mask last for extensibility */
163}; 163};
164 164
165struct __sysctl_args32;
166struct stat64_emu31; 165struct stat64_emu31;
167struct mmap_arg_struct_emu31; 166struct mmap_arg_struct_emu31;
168struct fadvise64_64_args; 167struct fadvise64_64_args;
@@ -212,7 +211,6 @@ long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset,
212 size_t count); 211 size_t count);
213long sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, 212long sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset,
214 s32 count); 213 s32 count);
215long sys32_sysctl(struct __sysctl_args32 __user *args);
216long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf); 214long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf);
217long sys32_lstat64(char __user * filename, 215long sys32_lstat64(char __user * filename,
218 struct stat64_emu31 __user * statbuf); 216 struct stat64_emu31 __user * statbuf);
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index cbd9901dc0f8..30de2d0e52bb 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -689,8 +689,6 @@ sys32_fdatasync_wrapper:
689 llgfr %r2,%r2 # unsigned int 689 llgfr %r2,%r2 # unsigned int
690 jg sys_fdatasync # branch to system call 690 jg sys_fdatasync # branch to system call
691 691
692#sys32_sysctl_wrapper # tbd
693
694 .globl sys32_mlock_wrapper 692 .globl sys32_mlock_wrapper
695sys32_mlock_wrapper: 693sys32_mlock_wrapper:
696 llgfr %r2,%r2 # unsigned long 694 llgfr %r2,%r2 # unsigned long
@@ -1087,8 +1085,8 @@ sys32_stime_wrapper:
1087 1085
1088 .globl sys32_sysctl_wrapper 1086 .globl sys32_sysctl_wrapper
1089sys32_sysctl_wrapper: 1087sys32_sysctl_wrapper:
1090 llgtr %r2,%r2 # struct __sysctl_args32 * 1088 llgtr %r2,%r2 # struct compat_sysctl_args *
1091 jg sys32_sysctl 1089 jg compat_sys_sysctl
1092 1090
1093 .globl sys32_fstat64_wrapper 1091 .globl sys32_fstat64_wrapper
1094sys32_fstat64_wrapper: 1092sys32_fstat64_wrapper:
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index 20f282c911c2..071c81f179ef 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -893,35 +893,30 @@ s390dbf_procactive(ctl_table *table, int write,
893 893
894static struct ctl_table s390dbf_table[] = { 894static struct ctl_table s390dbf_table[] = {
895 { 895 {
896 .ctl_name = CTL_S390DBF_STOPPABLE,
897 .procname = "debug_stoppable", 896 .procname = "debug_stoppable",
898 .data = &debug_stoppable, 897 .data = &debug_stoppable,
899 .maxlen = sizeof(int), 898 .maxlen = sizeof(int),
900 .mode = S_IRUGO | S_IWUSR, 899 .mode = S_IRUGO | S_IWUSR,
901 .proc_handler = &proc_dointvec, 900 .proc_handler = proc_dointvec,
902 .strategy = &sysctl_intvec,
903 }, 901 },
904 { 902 {
905 .ctl_name = CTL_S390DBF_ACTIVE,
906 .procname = "debug_active", 903 .procname = "debug_active",
907 .data = &debug_active, 904 .data = &debug_active,
908 .maxlen = sizeof(int), 905 .maxlen = sizeof(int),
909 .mode = S_IRUGO | S_IWUSR, 906 .mode = S_IRUGO | S_IWUSR,
910 .proc_handler = &s390dbf_procactive, 907 .proc_handler = s390dbf_procactive,
911 .strategy = &sysctl_intvec,
912 }, 908 },
913 { .ctl_name = 0 } 909 { }
914}; 910};
915 911
916static struct ctl_table s390dbf_dir_table[] = { 912static struct ctl_table s390dbf_dir_table[] = {
917 { 913 {
918 .ctl_name = CTL_S390DBF,
919 .procname = "s390dbf", 914 .procname = "s390dbf",
920 .maxlen = 0, 915 .maxlen = 0,
921 .mode = S_IRUGO | S_IXUGO, 916 .mode = S_IRUGO | S_IXUGO,
922 .child = s390dbf_table, 917 .child = s390dbf_table,
923 }, 918 },
924 { .ctl_name = 0 } 919 { }
925}; 920};
926 921
927static struct ctl_table_header *s390dbf_sysctl_header; 922static struct ctl_table_header *s390dbf_sysctl_header;
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index b201135cc18c..ff58779bf7e9 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -343,30 +343,29 @@ static struct ctl_table cmm_table[] = {
343 { 343 {
344 .procname = "cmm_pages", 344 .procname = "cmm_pages",
345 .mode = 0644, 345 .mode = 0644,
346 .proc_handler = &cmm_pages_handler, 346 .proc_handler = cmm_pages_handler,
347 }, 347 },
348 { 348 {
349 .procname = "cmm_timed_pages", 349 .procname = "cmm_timed_pages",
350 .mode = 0644, 350 .mode = 0644,
351 .proc_handler = &cmm_pages_handler, 351 .proc_handler = cmm_pages_handler,
352 }, 352 },
353 { 353 {
354 .procname = "cmm_timeout", 354 .procname = "cmm_timeout",
355 .mode = 0644, 355 .mode = 0644,
356 .proc_handler = &cmm_timeout_handler, 356 .proc_handler = cmm_timeout_handler,
357 }, 357 },
358 { .ctl_name = 0 } 358 { }
359}; 359};
360 360
361static struct ctl_table cmm_dir_table[] = { 361static struct ctl_table cmm_dir_table[] = {
362 { 362 {
363 .ctl_name = CTL_VM,
364 .procname = "vm", 363 .procname = "vm",
365 .maxlen = 0, 364 .maxlen = 0,
366 .mode = 0555, 365 .mode = 0555,
367 .child = cmm_table, 366 .child = cmm_table,
368 }, 367 },
369 { .ctl_name = 0 } 368 { }
370}; 369};
371#endif 370#endif
372 371
diff --git a/arch/sh/kernel/traps_64.c b/arch/sh/kernel/traps_64.c
index 267e5ebbb475..75c0cbe2eda0 100644
--- a/arch/sh/kernel/traps_64.c
+++ b/arch/sh/kernel/traps_64.c
@@ -877,44 +877,39 @@ static int misaligned_fixup(struct pt_regs *regs)
877 877
878static ctl_table unaligned_table[] = { 878static ctl_table unaligned_table[] = {
879 { 879 {
880 .ctl_name = CTL_UNNUMBERED,
881 .procname = "kernel_reports", 880 .procname = "kernel_reports",
882 .data = &kernel_mode_unaligned_fixup_count, 881 .data = &kernel_mode_unaligned_fixup_count,
883 .maxlen = sizeof(int), 882 .maxlen = sizeof(int),
884 .mode = 0644, 883 .mode = 0644,
885 .proc_handler = &proc_dointvec 884 .proc_handler = proc_dointvec
886 }, 885 },
887 { 886 {
888 .ctl_name = CTL_UNNUMBERED,
889 .procname = "user_reports", 887 .procname = "user_reports",
890 .data = &user_mode_unaligned_fixup_count, 888 .data = &user_mode_unaligned_fixup_count,
891 .maxlen = sizeof(int), 889 .maxlen = sizeof(int),
892 .mode = 0644, 890 .mode = 0644,
893 .proc_handler = &proc_dointvec 891 .proc_handler = proc_dointvec
894 }, 892 },
895 { 893 {
896 .ctl_name = CTL_UNNUMBERED,
897 .procname = "user_enable", 894 .procname = "user_enable",
898 .data = &user_mode_unaligned_fixup_enable, 895 .data = &user_mode_unaligned_fixup_enable,
899 .maxlen = sizeof(int), 896 .maxlen = sizeof(int),
900 .mode = 0644, 897 .mode = 0644,
901 .proc_handler = &proc_dointvec}, 898 .proc_handler = proc_dointvec},
902 {} 899 {}
903}; 900};
904 901
905static ctl_table unaligned_root[] = { 902static ctl_table unaligned_root[] = {
906 { 903 {
907 .ctl_name = CTL_UNNUMBERED,
908 .procname = "unaligned_fixup", 904 .procname = "unaligned_fixup",
909 .mode = 0555, 905 .mode = 0555,
910 unaligned_table 906 .child = unaligned_table
911 }, 907 },
912 {} 908 {}
913}; 909};
914 910
915static ctl_table sh64_root[] = { 911static ctl_table sh64_root[] = {
916 { 912 {
917 .ctl_name = CTL_UNNUMBERED,
918 .procname = "sh64", 913 .procname = "sh64",
919 .mode = 0555, 914 .mode = 0555,
920 .child = unaligned_root 915 .child = unaligned_root
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index 04e28b2671c8..f862372074bc 100644
--- a/arch/sparc/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
@@ -591,63 +591,6 @@ out:
591 return ret; 591 return ret;
592} 592}
593 593
594struct __sysctl_args32 {
595 u32 name;
596 int nlen;
597 u32 oldval;
598 u32 oldlenp;
599 u32 newval;
600 u32 newlen;
601 u32 __unused[4];
602};
603
604asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
605{
606#ifndef CONFIG_SYSCTL_SYSCALL
607 return -ENOSYS;
608#else
609 struct __sysctl_args32 tmp;
610 int error;
611 size_t oldlen, __user *oldlenp = NULL;
612 unsigned long addr = (((unsigned long)&args->__unused[0]) + 7UL) & ~7UL;
613
614 if (copy_from_user(&tmp, args, sizeof(tmp)))
615 return -EFAULT;
616
617 if (tmp.oldval && tmp.oldlenp) {
618 /* Duh, this is ugly and might not work if sysctl_args
619 is in read-only memory, but do_sysctl does indirectly
620 a lot of uaccess in both directions and we'd have to
621 basically copy the whole sysctl.c here, and
622 glibc's __sysctl uses rw memory for the structure
623 anyway. */
624 if (get_user(oldlen, (u32 __user *)(unsigned long)tmp.oldlenp) ||
625 put_user(oldlen, (size_t __user *)addr))
626 return -EFAULT;
627 oldlenp = (size_t __user *)addr;
628 }
629
630 lock_kernel();
631 error = do_sysctl((int __user *)(unsigned long) tmp.name,
632 tmp.nlen,
633 (void __user *)(unsigned long) tmp.oldval,
634 oldlenp,
635 (void __user *)(unsigned long) tmp.newval,
636 tmp.newlen);
637 unlock_kernel();
638 if (oldlenp) {
639 if (!error) {
640 if (get_user(oldlen, (size_t __user *)addr) ||
641 put_user(oldlen, (u32 __user *)(unsigned long) tmp.oldlenp))
642 error = -EFAULT;
643 }
644 if (copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)))
645 error = -EFAULT;
646 }
647 return error;
648#endif
649}
650
651long sys32_lookup_dcookie(unsigned long cookie_high, 594long sys32_lookup_dcookie(unsigned long cookie_high,
652 unsigned long cookie_low, 595 unsigned long cookie_low,
653 char __user *buf, size_t len) 596 char __user *buf, size_t len)
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index 009825f6e73c..034b10e0d4b0 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -68,7 +68,7 @@ sys_call_table32:
68 .word compat_sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys32_mlockall 68 .word compat_sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys32_mlockall
69/*240*/ .word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys32_sched_setscheduler, sys32_sched_getscheduler 69/*240*/ .word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys32_sched_setscheduler, sys32_sched_getscheduler
70 .word sys_sched_yield, sys32_sched_get_priority_max, sys32_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep 70 .word sys_sched_yield, sys32_sched_get_priority_max, sys32_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep
71/*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl 71/*250*/ .word sys32_mremap, compat_sys_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl
72 .word sys32_sync_file_range, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep 72 .word sys32_sync_file_range, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep
73/*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun 73/*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun
74 .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy 74 .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 581b0568fe19..5d2584839be4 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -653,7 +653,7 @@ ia32_sys_call_table:
653 .quad compat_sys_writev 653 .quad compat_sys_writev
654 .quad sys_getsid 654 .quad sys_getsid
655 .quad sys_fdatasync 655 .quad sys_fdatasync
656 .quad sys32_sysctl /* sysctl */ 656 .quad compat_sys_sysctl /* sysctl */
657 .quad sys_mlock /* 150 */ 657 .quad sys_mlock /* 150 */
658 .quad sys_munlock 658 .quad sys_munlock
659 .quad sys_mlockall 659 .quad sys_mlockall
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index 9f5527198825..df82c0e48ded 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -434,62 +434,6 @@ asmlinkage long sys32_rt_sigqueueinfo(int pid, int sig,
434 return ret; 434 return ret;
435} 435}
436 436
437#ifdef CONFIG_SYSCTL_SYSCALL
438struct sysctl_ia32 {
439 unsigned int name;
440 int nlen;
441 unsigned int oldval;
442 unsigned int oldlenp;
443 unsigned int newval;
444 unsigned int newlen;
445 unsigned int __unused[4];
446};
447
448
449asmlinkage long sys32_sysctl(struct sysctl_ia32 __user *args32)
450{
451 struct sysctl_ia32 a32;
452 mm_segment_t old_fs = get_fs();
453 void __user *oldvalp, *newvalp;
454 size_t oldlen;
455 int __user *namep;
456 long ret;
457
458 if (copy_from_user(&a32, args32, sizeof(a32)))
459 return -EFAULT;
460
461 /*
462 * We need to pre-validate these because we have to disable
463 * address checking before calling do_sysctl() because of
464 * OLDLEN but we can't run the risk of the user specifying bad
465 * addresses here. Well, since we're dealing with 32 bit
466 * addresses, we KNOW that access_ok() will always succeed, so
467 * this is an expensive NOP, but so what...
468 */
469 namep = compat_ptr(a32.name);
470 oldvalp = compat_ptr(a32.oldval);
471 newvalp = compat_ptr(a32.newval);
472
473 if ((oldvalp && get_user(oldlen, (int __user *)compat_ptr(a32.oldlenp)))
474 || !access_ok(VERIFY_WRITE, namep, 0)
475 || !access_ok(VERIFY_WRITE, oldvalp, 0)
476 || !access_ok(VERIFY_WRITE, newvalp, 0))
477 return -EFAULT;
478
479 set_fs(KERNEL_DS);
480 lock_kernel();
481 ret = do_sysctl(namep, a32.nlen, oldvalp, (size_t __user *)&oldlen,
482 newvalp, (size_t) a32.newlen);
483 unlock_kernel();
484 set_fs(old_fs);
485
486 if (oldvalp && put_user(oldlen, (int __user *)compat_ptr(a32.oldlenp)))
487 return -EFAULT;
488
489 return ret;
490}
491#endif
492
493/* warning: next two assume little endian */ 437/* warning: next two assume little endian */
494asmlinkage long sys32_pread(unsigned int fd, char __user *ubuf, u32 count, 438asmlinkage long sys32_pread(unsigned int fd, char __user *ubuf, u32 count,
495 u32 poslo, u32 poshi) 439 u32 poslo, u32 poshi)
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h
index 72a6dcd1299b..9af9decb38c3 100644
--- a/arch/x86/include/asm/sys_ia32.h
+++ b/arch/x86/include/asm/sys_ia32.h
@@ -51,11 +51,6 @@ asmlinkage long sys32_sched_rr_get_interval(compat_pid_t,
51asmlinkage long sys32_rt_sigpending(compat_sigset_t __user *, compat_size_t); 51asmlinkage long sys32_rt_sigpending(compat_sigset_t __user *, compat_size_t);
52asmlinkage long sys32_rt_sigqueueinfo(int, int, compat_siginfo_t __user *); 52asmlinkage long sys32_rt_sigqueueinfo(int, int, compat_siginfo_t __user *);
53 53
54#ifdef CONFIG_SYSCTL_SYSCALL
55struct sysctl_ia32;
56asmlinkage long sys32_sysctl(struct sysctl_ia32 __user *);
57#endif
58
59asmlinkage long sys32_pread(unsigned int, char __user *, u32, u32, u32); 54asmlinkage long sys32_pread(unsigned int, char __user *, u32, u32, u32);
60asmlinkage long sys32_pwrite(unsigned int, char __user *, u32, u32, u32); 55asmlinkage long sys32_pwrite(unsigned int, char __user *, u32, u32, u32);
61 56
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 8cb4974ff599..e02d92d12bcd 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -237,7 +237,7 @@ static ctl_table kernel_table2[] = {
237}; 237};
238 238
239static ctl_table kernel_root_table2[] = { 239static ctl_table kernel_root_table2[] = {
240 { .ctl_name = CTL_KERN, .procname = "kernel", .mode = 0555, 240 { .procname = "kernel", .mode = 0555,
241 .child = kernel_table2 }, 241 .child = kernel_table2 },
242 {} 242 {}
243}; 243};
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 58bc00f68b12..02b442e92007 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -393,7 +393,6 @@ static ctl_table abi_table2[] = {
393 393
394static ctl_table abi_root_table2[] = { 394static ctl_table abi_root_table2[] = {
395 { 395 {
396 .ctl_name = CTL_ABI,
397 .procname = "abi", 396 .procname = "abi",
398 .mode = 0555, 397 .mode = 0555,
399 .child = abi_table2 398 .child = abi_table2