diff options
| author | Steve French <sfrench@us.ibm.com> | 2006-01-12 17:47:08 -0500 |
|---|---|---|
| committer | Steve French <sfrench@us.ibm.com> | 2006-01-12 17:47:08 -0500 |
| commit | 94bc2be31a01a3055ec94176e595dfe208e92d3b (patch) | |
| tree | ebfbe81c6718a6390bfa1b99c6d228237d818576 /kernel/sysctl.c | |
| parent | c32a0b689cb9cc160cfcd19735bbf50bb70c6ef4 (diff) | |
| parent | 58cba4650a7a414eabd2b40cc9d8e45fcdf192d9 (diff) | |
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'kernel/sysctl.c')
| -rw-r--r-- | kernel/sysctl.c | 62 |
1 files changed, 44 insertions, 18 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index e5102ea6e104..62d4d9566876 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
| @@ -25,12 +25,14 @@ | |||
| 25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
| 26 | #include <linux/sysctl.h> | 26 | #include <linux/sysctl.h> |
| 27 | #include <linux/proc_fs.h> | 27 | #include <linux/proc_fs.h> |
| 28 | #include <linux/capability.h> | ||
| 28 | #include <linux/ctype.h> | 29 | #include <linux/ctype.h> |
| 29 | #include <linux/utsname.h> | 30 | #include <linux/utsname.h> |
| 30 | #include <linux/capability.h> | 31 | #include <linux/capability.h> |
| 31 | #include <linux/smp_lock.h> | 32 | #include <linux/smp_lock.h> |
| 32 | #include <linux/init.h> | 33 | #include <linux/init.h> |
| 33 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
| 35 | #include <linux/kobject.h> | ||
| 34 | #include <linux/net.h> | 36 | #include <linux/net.h> |
| 35 | #include <linux/sysrq.h> | 37 | #include <linux/sysrq.h> |
| 36 | #include <linux/highuid.h> | 38 | #include <linux/highuid.h> |
| @@ -67,6 +69,8 @@ extern int min_free_kbytes; | |||
| 67 | extern int printk_ratelimit_jiffies; | 69 | extern int printk_ratelimit_jiffies; |
| 68 | extern int printk_ratelimit_burst; | 70 | extern int printk_ratelimit_burst; |
| 69 | extern int pid_max_min, pid_max_max; | 71 | extern int pid_max_min, pid_max_max; |
| 72 | extern int sysctl_drop_caches; | ||
| 73 | extern int percpu_pagelist_fraction; | ||
| 70 | 74 | ||
| 71 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) | 75 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) |
| 72 | int unknown_nmi_panic; | 76 | int unknown_nmi_panic; |
| @@ -77,15 +81,13 @@ extern int proc_unknown_nmi_panic(ctl_table *, int, struct file *, | |||
| 77 | /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ | 81 | /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ |
| 78 | static int maxolduid = 65535; | 82 | static int maxolduid = 65535; |
| 79 | static int minolduid; | 83 | static int minolduid; |
| 84 | static int min_percpu_pagelist_fract = 8; | ||
| 80 | 85 | ||
| 81 | static int ngroups_max = NGROUPS_MAX; | 86 | static int ngroups_max = NGROUPS_MAX; |
| 82 | 87 | ||
| 83 | #ifdef CONFIG_KMOD | 88 | #ifdef CONFIG_KMOD |
| 84 | extern char modprobe_path[]; | 89 | extern char modprobe_path[]; |
| 85 | #endif | 90 | #endif |
| 86 | #ifdef CONFIG_HOTPLUG | ||
| 87 | extern char hotplug_path[]; | ||
| 88 | #endif | ||
| 89 | #ifdef CONFIG_CHR_DEV_SG | 91 | #ifdef CONFIG_CHR_DEV_SG |
| 90 | extern int sg_big_buff; | 92 | extern int sg_big_buff; |
| 91 | #endif | 93 | #endif |
| @@ -110,7 +112,7 @@ extern int pwrsw_enabled; | |||
| 110 | extern int unaligned_enabled; | 112 | extern int unaligned_enabled; |
| 111 | #endif | 113 | #endif |
| 112 | 114 | ||
| 113 | #ifdef CONFIG_ARCH_S390 | 115 | #ifdef CONFIG_S390 |
| 114 | #ifdef CONFIG_MATHEMU | 116 | #ifdef CONFIG_MATHEMU |
| 115 | extern int sysctl_ieee_emulation_warnings; | 117 | extern int sysctl_ieee_emulation_warnings; |
| 116 | #endif | 118 | #endif |
| @@ -397,8 +399,8 @@ static ctl_table kern_table[] = { | |||
| 397 | { | 399 | { |
| 398 | .ctl_name = KERN_HOTPLUG, | 400 | .ctl_name = KERN_HOTPLUG, |
| 399 | .procname = "hotplug", | 401 | .procname = "hotplug", |
| 400 | .data = &hotplug_path, | 402 | .data = &uevent_helper, |
| 401 | .maxlen = HOTPLUG_PATH_LEN, | 403 | .maxlen = UEVENT_HELPER_PATH_LEN, |
| 402 | .mode = 0644, | 404 | .mode = 0644, |
| 403 | .proc_handler = &proc_dostring, | 405 | .proc_handler = &proc_dostring, |
| 404 | .strategy = &sysctl_string, | 406 | .strategy = &sysctl_string, |
| @@ -544,7 +546,7 @@ static ctl_table kern_table[] = { | |||
| 544 | .extra1 = &minolduid, | 546 | .extra1 = &minolduid, |
| 545 | .extra2 = &maxolduid, | 547 | .extra2 = &maxolduid, |
| 546 | }, | 548 | }, |
| 547 | #ifdef CONFIG_ARCH_S390 | 549 | #ifdef CONFIG_S390 |
| 548 | #ifdef CONFIG_MATHEMU | 550 | #ifdef CONFIG_MATHEMU |
| 549 | { | 551 | { |
| 550 | .ctl_name = KERN_IEEE_EMULATION_WARNINGS, | 552 | .ctl_name = KERN_IEEE_EMULATION_WARNINGS, |
| @@ -646,7 +648,7 @@ static ctl_table kern_table[] = { | |||
| 646 | .mode = 0644, | 648 | .mode = 0644, |
| 647 | .proc_handler = &proc_dointvec, | 649 | .proc_handler = &proc_dointvec, |
| 648 | }, | 650 | }, |
| 649 | #if defined(CONFIG_ARCH_S390) | 651 | #if defined(CONFIG_S390) |
| 650 | { | 652 | { |
| 651 | .ctl_name = KERN_SPIN_RETRY, | 653 | .ctl_name = KERN_SPIN_RETRY, |
| 652 | .procname = "spin_retry", | 654 | .procname = "spin_retry", |
| @@ -777,6 +779,15 @@ static ctl_table vm_table[] = { | |||
| 777 | .strategy = &sysctl_intvec, | 779 | .strategy = &sysctl_intvec, |
| 778 | }, | 780 | }, |
| 779 | { | 781 | { |
| 782 | .ctl_name = VM_DROP_PAGECACHE, | ||
| 783 | .procname = "drop_caches", | ||
| 784 | .data = &sysctl_drop_caches, | ||
| 785 | .maxlen = sizeof(int), | ||
| 786 | .mode = 0644, | ||
| 787 | .proc_handler = drop_caches_sysctl_handler, | ||
| 788 | .strategy = &sysctl_intvec, | ||
| 789 | }, | ||
| 790 | { | ||
| 780 | .ctl_name = VM_MIN_FREE_KBYTES, | 791 | .ctl_name = VM_MIN_FREE_KBYTES, |
| 781 | .procname = "min_free_kbytes", | 792 | .procname = "min_free_kbytes", |
| 782 | .data = &min_free_kbytes, | 793 | .data = &min_free_kbytes, |
| @@ -786,6 +797,16 @@ static ctl_table vm_table[] = { | |||
| 786 | .strategy = &sysctl_intvec, | 797 | .strategy = &sysctl_intvec, |
| 787 | .extra1 = &zero, | 798 | .extra1 = &zero, |
| 788 | }, | 799 | }, |
| 800 | { | ||
| 801 | .ctl_name = VM_PERCPU_PAGELIST_FRACTION, | ||
| 802 | .procname = "percpu_pagelist_fraction", | ||
| 803 | .data = &percpu_pagelist_fraction, | ||
| 804 | .maxlen = sizeof(percpu_pagelist_fraction), | ||
| 805 | .mode = 0644, | ||
| 806 | .proc_handler = &percpu_pagelist_fraction_sysctl_handler, | ||
| 807 | .strategy = &sysctl_intvec, | ||
| 808 | .extra1 = &min_percpu_pagelist_fract, | ||
| 809 | }, | ||
| 789 | #ifdef CONFIG_MMU | 810 | #ifdef CONFIG_MMU |
| 790 | { | 811 | { |
| 791 | .ctl_name = VM_MAX_MAP_COUNT, | 812 | .ctl_name = VM_MAX_MAP_COUNT, |
| @@ -2192,27 +2213,32 @@ int sysctl_string(ctl_table *table, int __user *name, int nlen, | |||
| 2192 | void __user *oldval, size_t __user *oldlenp, | 2213 | void __user *oldval, size_t __user *oldlenp, |
| 2193 | void __user *newval, size_t newlen, void **context) | 2214 | void __user *newval, size_t newlen, void **context) |
| 2194 | { | 2215 | { |
| 2195 | size_t l, len; | ||
| 2196 | |||
| 2197 | if (!table->data || !table->maxlen) | 2216 | if (!table->data || !table->maxlen) |
| 2198 | return -ENOTDIR; | 2217 | return -ENOTDIR; |
| 2199 | 2218 | ||
| 2200 | if (oldval && oldlenp) { | 2219 | if (oldval && oldlenp) { |
| 2201 | if (get_user(len, oldlenp)) | 2220 | size_t bufsize; |
| 2221 | if (get_user(bufsize, oldlenp)) | ||
| 2202 | return -EFAULT; | 2222 | return -EFAULT; |
| 2203 | if (len) { | 2223 | if (bufsize) { |
| 2204 | l = strlen(table->data)+1; | 2224 | size_t len = strlen(table->data), copied; |
| 2205 | if (len > l) len = l; | 2225 | |
| 2206 | if (len >= table->maxlen) | 2226 | /* This shouldn't trigger for a well-formed sysctl */ |
| 2227 | if (len > table->maxlen) | ||
| 2207 | len = table->maxlen; | 2228 | len = table->maxlen; |
| 2208 | if(copy_to_user(oldval, table->data, len)) | 2229 | |
| 2230 | /* Copy up to a max of bufsize-1 bytes of the string */ | ||
| 2231 | copied = (len >= bufsize) ? bufsize - 1 : len; | ||
| 2232 | |||
| 2233 | if (copy_to_user(oldval, table->data, copied) || | ||
| 2234 | put_user(0, (char __user *)(oldval + copied))) | ||
| 2209 | return -EFAULT; | 2235 | return -EFAULT; |
| 2210 | if(put_user(len, oldlenp)) | 2236 | if (put_user(len, oldlenp)) |
| 2211 | return -EFAULT; | 2237 | return -EFAULT; |
| 2212 | } | 2238 | } |
| 2213 | } | 2239 | } |
| 2214 | if (newval && newlen) { | 2240 | if (newval && newlen) { |
| 2215 | len = newlen; | 2241 | size_t len = newlen; |
| 2216 | if (len > table->maxlen) | 2242 | if (len > table->maxlen) |
| 2217 | len = table->maxlen; | 2243 | len = table->maxlen; |
| 2218 | if(copy_from_user(table->data, newval, len)) | 2244 | if(copy_from_user(table->data, newval, len)) |
