aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2006-09-27 04:51:04 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-27 11:26:19 -0400
commitb89a81712f486e4f7a606987413e387605fdeaf4 (patch)
tree98702b89a50e927c38f2e31cf824c10d2585722f
parent571817849c76aabf34d534c905b5e604f2e824c5 (diff)
[PATCH] sysctl: Allow /proc/sys without sys_sysctl
Since sys_sysctl is deprecated start allow it to be compiled out. This should catch any remaining user space code that cares, and paves the way for further sysctl cleanups. [akpm@osdl.org: If sys_sysctl() is not compiled-in, emit a warning] Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/ia64/ia32/sys_ia32.c2
-rw-r--r--arch/mips/kernel/linux32.c4
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c2
-rw-r--r--arch/s390/kernel/compat_linux.c2
-rw-r--r--arch/sparc64/kernel/sys_sparc32.c2
-rw-r--r--arch/x86_64/ia32/sys_ia32.c2
-rw-r--r--fs/Kconfig19
-rw-r--r--init/Kconfig31
-rw-r--r--kernel/sysctl.c113
9 files changed, 81 insertions, 96 deletions
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index 6aa3c51619ca..bddbd22706ed 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -1942,7 +1942,7 @@ struct sysctl32 {
1942 unsigned int __unused[4]; 1942 unsigned int __unused[4];
1943}; 1943};
1944 1944
1945#ifdef CONFIG_SYSCTL 1945#ifdef CONFIG_SYSCTL_SYSCALL
1946asmlinkage long 1946asmlinkage long
1947sys32_sysctl (struct sysctl32 __user *args) 1947sys32_sysctl (struct sysctl32 __user *args)
1948{ 1948{
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index dc500e20cf14..43b1162d714f 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -991,7 +991,7 @@ struct sysctl_args32
991 unsigned int __unused[4]; 991 unsigned int __unused[4];
992}; 992};
993 993
994#ifdef CONFIG_SYSCTL 994#ifdef CONFIG_SYSCTL_SYSCALL
995 995
996asmlinkage long sys32_sysctl(struct sysctl_args32 __user *args) 996asmlinkage long sys32_sysctl(struct sysctl_args32 __user *args)
997{ 997{
@@ -1032,7 +1032,7 @@ asmlinkage long sys32_sysctl(struct sysctl_args32 __user *args)
1032 return error; 1032 return error;
1033} 1033}
1034 1034
1035#endif /* CONFIG_SYSCTL */ 1035#endif /* CONFIG_SYSCTL_SYSCALL */
1036 1036
1037asmlinkage long sys32_newuname(struct new_utsname __user * name) 1037asmlinkage long sys32_newuname(struct new_utsname __user * name)
1038{ 1038{
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 2e292863e982..5e391fc25340 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -740,7 +740,7 @@ asmlinkage long compat_sys_umask(u32 mask)
740 return sys_umask((int)mask); 740 return sys_umask((int)mask);
741} 741}
742 742
743#ifdef CONFIG_SYSCTL 743#ifdef CONFIG_SYSCTL_SYSCALL
744struct __sysctl_args32 { 744struct __sysctl_args32 {
745 u32 name; 745 u32 name;
746 int nlen; 746 int nlen;
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 785c9f70ac98..91b2884fa5c4 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -708,7 +708,7 @@ asmlinkage long sys32_sendfile64(int out_fd, int in_fd,
708 return ret; 708 return ret;
709} 709}
710 710
711#ifdef CONFIG_SYSCTL 711#ifdef CONFIG_SYSCTL_SYSCALL
712struct __sysctl_args32 { 712struct __sysctl_args32 {
713 u32 name; 713 u32 name;
714 int nlen; 714 int nlen;
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
index c88ae23ce812..69444f266e2d 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc64/kernel/sys_sparc32.c
@@ -1016,7 +1016,7 @@ struct __sysctl_args32 {
1016 1016
1017asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) 1017asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
1018{ 1018{
1019#ifndef CONFIG_SYSCTL 1019#ifndef CONFIG_SYSCTL_SYSCALL
1020 return -ENOSYS; 1020 return -ENOSYS;
1021#else 1021#else
1022 struct __sysctl_args32 tmp; 1022 struct __sysctl_args32 tmp;
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c
index b0e82c7947dc..f280d3665f4b 100644
--- a/arch/x86_64/ia32/sys_ia32.c
+++ b/arch/x86_64/ia32/sys_ia32.c
@@ -648,7 +648,7 @@ sys32_pause(void)
648} 648}
649 649
650 650
651#ifdef CONFIG_SYSCTL 651#ifdef CONFIG_SYSCTL_SYSCALL
652struct sysctl_ia32 { 652struct sysctl_ia32 {
653 unsigned int name; 653 unsigned int name;
654 int nlen; 654 int nlen;
diff --git a/fs/Kconfig b/fs/Kconfig
index a27002668bd3..d311198bba43 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -826,6 +826,25 @@ config PROC_VMCORE
826 help 826 help
827 Exports the dump image of crashed kernel in ELF format. 827 Exports the dump image of crashed kernel in ELF format.
828 828
829config PROC_SYSCTL
830 bool "Sysctl support (/proc/sys)" if EMBEDDED
831 depends on PROC_FS
832 select SYSCTL
833 default y
834 ---help---
835 The sysctl interface provides a means of dynamically changing
836 certain kernel parameters and variables on the fly without requiring
837 a recompile of the kernel or reboot of the system. The primary
838 interface is through /proc/sys. If you say Y here a tree of
839 modifiable sysctl entries will be generated beneath the
840 /proc/sys directory. They are explained in the files
841 in <file:Documentation/sysctl/>. Note that enabling this
842 option will enlarge the kernel by at least 8 KB.
843
844 As it is generally a good thing, you should say Y here unless
845 building a kernel for install/rescue disks or your system is very
846 limited in memory.
847
829config SYSFS 848config SYSFS
830 bool "sysfs file system support" if EMBEDDED 849 bool "sysfs file system support" if EMBEDDED
831 default y 850 default y
diff --git a/init/Kconfig b/init/Kconfig
index 9a7656f0b5ec..4381006dd666 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -273,21 +273,24 @@ config UID16
273 This enables the legacy 16-bit UID syscall wrappers. 273 This enables the legacy 16-bit UID syscall wrappers.
274 274
275config SYSCTL 275config SYSCTL
276 bool "Sysctl support" if EMBEDDED 276 bool
277 default y 277
278config SYSCTL_SYSCALL
279 bool "Sysctl syscall support"
280 default n
281 select SYSCTL
278 ---help--- 282 ---help---
279 The sysctl interface provides a means of dynamically changing 283 Enable the deprecated sysctl system call. sys_sysctl uses
280 certain kernel parameters and variables on the fly without requiring 284 binary paths that have been found to be a major pain to maintain
281 a recompile of the kernel or reboot of the system. The primary 285 and use. The interface in /proc/sys is now the primary and what
282 interface consists of a system call, but if you say Y to "/proc 286 everyone uses.
283 file system support", a tree of modifiable sysctl entries will be 287
284 generated beneath the /proc/sys directory. They are explained in the 288 Nothing has been using the binary sysctl interface for some time
285 files in <file:Documentation/sysctl/>. Note that enabling this 289 time now so nothing should break if you disable sysctl syscall
286 option will enlarge the kernel by at least 8 KB. 290 support, and you kernel will get marginally smaller.
287 291
288 As it is generally a good thing, you should say Y here unless 292 Unless you have an application that uses the sys_syscall interface
289 building a kernel for install/rescue disks or your system is very 293 you should probably say N here.
290 limited in memory.
291 294
292config KALLSYMS 295config KALLSYMS
293 bool "Load all symbols for debugging/kksymoops" if EMBEDDED 296 bool "Load all symbols for debugging/kksymoops" if EMBEDDED
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index bcb3a181dbb2..8bfa7d117c54 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -137,8 +137,11 @@ extern int no_unaligned_warning;
137extern int max_lock_depth; 137extern int max_lock_depth;
138#endif 138#endif
139 139
140static int parse_table(int __user *, int, void __user *, size_t __user *, void __user *, size_t, 140#ifdef CONFIG_SYSCTL_SYSCALL
141 ctl_table *, void **); 141static int parse_table(int __user *, int, void __user *, size_t __user *,
142 void __user *, size_t, ctl_table *, void **);
143#endif
144
142static int proc_doutsstring(ctl_table *table, int write, struct file *filp, 145static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
143 void __user *buffer, size_t *lenp, loff_t *ppos); 146 void __user *buffer, size_t *lenp, loff_t *ppos);
144 147
@@ -165,7 +168,7 @@ int sysctl_legacy_va_layout;
165 168
166/* /proc declarations: */ 169/* /proc declarations: */
167 170
168#ifdef CONFIG_PROC_FS 171#ifdef CONFIG_PROC_SYSCTL
169 172
170static ssize_t proc_readsys(struct file *, char __user *, size_t, loff_t *); 173static ssize_t proc_readsys(struct file *, char __user *, size_t, loff_t *);
171static ssize_t proc_writesys(struct file *, const char __user *, size_t, loff_t *); 174static ssize_t proc_writesys(struct file *, const char __user *, size_t, loff_t *);
@@ -1166,12 +1169,13 @@ static void start_unregistering(struct ctl_table_header *p)
1166 1169
1167void __init sysctl_init(void) 1170void __init sysctl_init(void)
1168{ 1171{
1169#ifdef CONFIG_PROC_FS 1172#ifdef CONFIG_PROC_SYSCTL
1170 register_proc_table(root_table, proc_sys_root, &root_table_header); 1173 register_proc_table(root_table, proc_sys_root, &root_table_header);
1171 init_irq_proc(); 1174 init_irq_proc();
1172#endif 1175#endif
1173} 1176}
1174 1177
1178#ifdef CONFIG_SYSCTL_SYSCALL
1175int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp, 1179int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
1176 void __user *newval, size_t newlen) 1180 void __user *newval, size_t newlen)
1177{ 1181{
@@ -1225,6 +1229,7 @@ asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
1225 unlock_kernel(); 1229 unlock_kernel();
1226 return error; 1230 return error;
1227} 1231}
1232#endif /* CONFIG_SYSCTL_SYSCALL */
1228 1233
1229/* 1234/*
1230 * ctl_perm does NOT grant the superuser all rights automatically, because 1235 * ctl_perm does NOT grant the superuser all rights automatically, because
@@ -1251,6 +1256,7 @@ static inline int ctl_perm(ctl_table *table, int op)
1251 return test_perm(table->mode, op); 1256 return test_perm(table->mode, op);
1252} 1257}
1253 1258
1259#ifdef CONFIG_SYSCTL_SYSCALL
1254static int parse_table(int __user *name, int nlen, 1260static int parse_table(int __user *name, int nlen,
1255 void __user *oldval, size_t __user *oldlenp, 1261 void __user *oldval, size_t __user *oldlenp,
1256 void __user *newval, size_t newlen, 1262 void __user *newval, size_t newlen,
@@ -1340,6 +1346,7 @@ int do_sysctl_strategy (ctl_table *table,
1340 } 1346 }
1341 return 0; 1347 return 0;
1342} 1348}
1349#endif /* CONFIG_SYSCTL_SYSCALL */
1343 1350
1344/** 1351/**
1345 * register_sysctl_table - register a sysctl hierarchy 1352 * register_sysctl_table - register a sysctl hierarchy
@@ -1427,7 +1434,7 @@ struct ctl_table_header *register_sysctl_table(ctl_table * table,
1427 else 1434 else
1428 list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry); 1435 list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
1429 spin_unlock(&sysctl_lock); 1436 spin_unlock(&sysctl_lock);
1430#ifdef CONFIG_PROC_FS 1437#ifdef CONFIG_PROC_SYSCTL
1431 register_proc_table(table, proc_sys_root, tmp); 1438 register_proc_table(table, proc_sys_root, tmp);
1432#endif 1439#endif
1433 return tmp; 1440 return tmp;
@@ -1445,18 +1452,31 @@ void unregister_sysctl_table(struct ctl_table_header * header)
1445 might_sleep(); 1452 might_sleep();
1446 spin_lock(&sysctl_lock); 1453 spin_lock(&sysctl_lock);
1447 start_unregistering(header); 1454 start_unregistering(header);
1448#ifdef CONFIG_PROC_FS 1455#ifdef CONFIG_PROC_SYSCTL
1449 unregister_proc_table(header->ctl_table, proc_sys_root); 1456 unregister_proc_table(header->ctl_table, proc_sys_root);
1450#endif 1457#endif
1451 spin_unlock(&sysctl_lock); 1458 spin_unlock(&sysctl_lock);
1452 kfree(header); 1459 kfree(header);
1453} 1460}
1454 1461
1462#else /* !CONFIG_SYSCTL */
1463struct ctl_table_header * register_sysctl_table(ctl_table * table,
1464 int insert_at_head)
1465{
1466 return NULL;
1467}
1468
1469void unregister_sysctl_table(struct ctl_table_header * table)
1470{
1471}
1472
1473#endif /* CONFIG_SYSCTL */
1474
1455/* 1475/*
1456 * /proc/sys support 1476 * /proc/sys support
1457 */ 1477 */
1458 1478
1459#ifdef CONFIG_PROC_FS 1479#ifdef CONFIG_PROC_SYSCTL
1460 1480
1461/* Scan the sysctl entries in table and add them all into /proc */ 1481/* Scan the sysctl entries in table and add them all into /proc */
1462static void register_proc_table(ctl_table * table, struct proc_dir_entry *root, void *set) 1482static void register_proc_table(ctl_table * table, struct proc_dir_entry *root, void *set)
@@ -2318,6 +2338,7 @@ int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
2318#endif /* CONFIG_PROC_FS */ 2338#endif /* CONFIG_PROC_FS */
2319 2339
2320 2340
2341#ifdef CONFIG_SYSCTL_SYSCALL
2321/* 2342/*
2322 * General sysctl support routines 2343 * General sysctl support routines
2323 */ 2344 */
@@ -2460,11 +2481,19 @@ int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
2460 return 1; 2481 return 1;
2461} 2482}
2462 2483
2463#else /* CONFIG_SYSCTL */ 2484#else /* CONFIG_SYSCTL_SYSCALL */
2464 2485
2465 2486
2466asmlinkage long sys_sysctl(struct __sysctl_args __user *args) 2487asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
2467{ 2488{
2489 static int msg_count;
2490
2491 if (msg_count < 5) {
2492 msg_count++;
2493 printk(KERN_INFO
2494 "warning: process `%s' used the removed sysctl "
2495 "system call\n", current->comm);
2496 }
2468 return -ENOSYS; 2497 return -ENOSYS;
2469} 2498}
2470 2499
@@ -2496,73 +2525,7 @@ int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
2496 return -ENOSYS; 2525 return -ENOSYS;
2497} 2526}
2498 2527
2499int proc_dostring(ctl_table *table, int write, struct file *filp, 2528#endif /* CONFIG_SYSCTL_SYSCALL */
2500 void __user *buffer, size_t *lenp, loff_t *ppos)
2501{
2502 return -ENOSYS;
2503}
2504
2505int proc_dointvec(ctl_table *table, int write, struct file *filp,
2506 void __user *buffer, size_t *lenp, loff_t *ppos)
2507{
2508 return -ENOSYS;
2509}
2510
2511int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
2512 void __user *buffer, size_t *lenp, loff_t *ppos)
2513{
2514 return -ENOSYS;
2515}
2516
2517int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
2518 void __user *buffer, size_t *lenp, loff_t *ppos)
2519{
2520 return -ENOSYS;
2521}
2522
2523int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
2524 void __user *buffer, size_t *lenp, loff_t *ppos)
2525{
2526 return -ENOSYS;
2527}
2528
2529int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
2530 void __user *buffer, size_t *lenp, loff_t *ppos)
2531{
2532 return -ENOSYS;
2533}
2534
2535int proc_dointvec_ms_jiffies(ctl_table *table, int write, struct file *filp,
2536 void __user *buffer, size_t *lenp, loff_t *ppos)
2537{
2538 return -ENOSYS;
2539}
2540
2541int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
2542 void __user *buffer, size_t *lenp, loff_t *ppos)
2543{
2544 return -ENOSYS;
2545}
2546
2547int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
2548 struct file *filp,
2549 void __user *buffer,
2550 size_t *lenp, loff_t *ppos)
2551{
2552 return -ENOSYS;
2553}
2554
2555struct ctl_table_header * register_sysctl_table(ctl_table * table,
2556 int insert_at_head)
2557{
2558 return NULL;
2559}
2560
2561void unregister_sysctl_table(struct ctl_table_header * table)
2562{
2563}
2564
2565#endif /* CONFIG_SYSCTL */
2566 2529
2567/* 2530/*
2568 * No sense putting this after each symbol definition, twice, 2531 * No sense putting this after each symbol definition, twice,