Commit 563b04671017ea00ba563ebeebdc36bce79b1b60

Authored by J. R. Okajima
Committed by David S. Miller
1 parent dd7496f217

proc_dointvec: write a single value

The commit 00b7c3395aec3df43de5bd02a3c5a099ca51169f
"sysctl: refactor integer handling proc code"
modified the behaviour of writing to /proc.
Before the commit, write("1\n") to /proc/sys/kernel/printk succeeded. But
now it returns EINVAL.

This commit supports writing a single value to a multi-valued entry.

Signed-off-by: J. R. Okajima <hooanon05@yahoo.co.jp>
Reviewed-and-tested-by: WANG Cong <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 3 additions and 1 deletions Inline Diff

1 /* 1 /*
2 * sysctl.c: General linux system control interface 2 * sysctl.c: General linux system control interface
3 * 3 *
4 * Begun 24 March 1995, Stephen Tweedie 4 * Begun 24 March 1995, Stephen Tweedie
5 * Added /proc support, Dec 1995 5 * Added /proc support, Dec 1995
6 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas. 6 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
7 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver. 7 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
8 * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver. 8 * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
9 * Dynamic registration fixes, Stephen Tweedie. 9 * Dynamic registration fixes, Stephen Tweedie.
10 * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn. 10 * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
11 * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris 11 * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
12 * Horn. 12 * Horn.
13 * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer. 13 * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
14 * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer. 14 * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
15 * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill 15 * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
16 * Wendling. 16 * Wendling.
17 * The list_for_each() macro wasn't appropriate for the sysctl loop. 17 * The list_for_each() macro wasn't appropriate for the sysctl loop.
18 * Removed it and replaced it with older style, 03/23/00, Bill Wendling 18 * Removed it and replaced it with older style, 03/23/00, Bill Wendling
19 */ 19 */
20 20
21 #include <linux/module.h> 21 #include <linux/module.h>
22 #include <linux/mm.h> 22 #include <linux/mm.h>
23 #include <linux/swap.h> 23 #include <linux/swap.h>
24 #include <linux/slab.h> 24 #include <linux/slab.h>
25 #include <linux/sysctl.h> 25 #include <linux/sysctl.h>
26 #include <linux/signal.h> 26 #include <linux/signal.h>
27 #include <linux/proc_fs.h> 27 #include <linux/proc_fs.h>
28 #include <linux/security.h> 28 #include <linux/security.h>
29 #include <linux/ctype.h> 29 #include <linux/ctype.h>
30 #include <linux/kmemcheck.h> 30 #include <linux/kmemcheck.h>
31 #include <linux/fs.h> 31 #include <linux/fs.h>
32 #include <linux/init.h> 32 #include <linux/init.h>
33 #include <linux/kernel.h> 33 #include <linux/kernel.h>
34 #include <linux/kobject.h> 34 #include <linux/kobject.h>
35 #include <linux/net.h> 35 #include <linux/net.h>
36 #include <linux/sysrq.h> 36 #include <linux/sysrq.h>
37 #include <linux/highuid.h> 37 #include <linux/highuid.h>
38 #include <linux/writeback.h> 38 #include <linux/writeback.h>
39 #include <linux/ratelimit.h> 39 #include <linux/ratelimit.h>
40 #include <linux/hugetlb.h> 40 #include <linux/hugetlb.h>
41 #include <linux/initrd.h> 41 #include <linux/initrd.h>
42 #include <linux/key.h> 42 #include <linux/key.h>
43 #include <linux/times.h> 43 #include <linux/times.h>
44 #include <linux/limits.h> 44 #include <linux/limits.h>
45 #include <linux/dcache.h> 45 #include <linux/dcache.h>
46 #include <linux/syscalls.h> 46 #include <linux/syscalls.h>
47 #include <linux/vmstat.h> 47 #include <linux/vmstat.h>
48 #include <linux/nfs_fs.h> 48 #include <linux/nfs_fs.h>
49 #include <linux/acpi.h> 49 #include <linux/acpi.h>
50 #include <linux/reboot.h> 50 #include <linux/reboot.h>
51 #include <linux/ftrace.h> 51 #include <linux/ftrace.h>
52 #include <linux/slow-work.h> 52 #include <linux/slow-work.h>
53 #include <linux/perf_event.h> 53 #include <linux/perf_event.h>
54 #include <linux/kprobes.h> 54 #include <linux/kprobes.h>
55 55
56 #include <asm/uaccess.h> 56 #include <asm/uaccess.h>
57 #include <asm/processor.h> 57 #include <asm/processor.h>
58 58
59 #ifdef CONFIG_X86 59 #ifdef CONFIG_X86
60 #include <asm/nmi.h> 60 #include <asm/nmi.h>
61 #include <asm/stacktrace.h> 61 #include <asm/stacktrace.h>
62 #include <asm/io.h> 62 #include <asm/io.h>
63 #endif 63 #endif
64 #ifdef CONFIG_BSD_PROCESS_ACCT 64 #ifdef CONFIG_BSD_PROCESS_ACCT
65 #include <linux/acct.h> 65 #include <linux/acct.h>
66 #endif 66 #endif
67 #ifdef CONFIG_RT_MUTEXES 67 #ifdef CONFIG_RT_MUTEXES
68 #include <linux/rtmutex.h> 68 #include <linux/rtmutex.h>
69 #endif 69 #endif
70 #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT) 70 #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
71 #include <linux/lockdep.h> 71 #include <linux/lockdep.h>
72 #endif 72 #endif
73 #ifdef CONFIG_CHR_DEV_SG 73 #ifdef CONFIG_CHR_DEV_SG
74 #include <scsi/sg.h> 74 #include <scsi/sg.h>
75 #endif 75 #endif
76 76
77 77
78 #if defined(CONFIG_SYSCTL) 78 #if defined(CONFIG_SYSCTL)
79 79
80 /* External variables not in a header file. */ 80 /* External variables not in a header file. */
81 extern int sysctl_overcommit_memory; 81 extern int sysctl_overcommit_memory;
82 extern int sysctl_overcommit_ratio; 82 extern int sysctl_overcommit_ratio;
83 extern int sysctl_panic_on_oom; 83 extern int sysctl_panic_on_oom;
84 extern int sysctl_oom_kill_allocating_task; 84 extern int sysctl_oom_kill_allocating_task;
85 extern int sysctl_oom_dump_tasks; 85 extern int sysctl_oom_dump_tasks;
86 extern int max_threads; 86 extern int max_threads;
87 extern int core_uses_pid; 87 extern int core_uses_pid;
88 extern int suid_dumpable; 88 extern int suid_dumpable;
89 extern char core_pattern[]; 89 extern char core_pattern[];
90 extern unsigned int core_pipe_limit; 90 extern unsigned int core_pipe_limit;
91 extern int pid_max; 91 extern int pid_max;
92 extern int min_free_kbytes; 92 extern int min_free_kbytes;
93 extern int pid_max_min, pid_max_max; 93 extern int pid_max_min, pid_max_max;
94 extern int sysctl_drop_caches; 94 extern int sysctl_drop_caches;
95 extern int percpu_pagelist_fraction; 95 extern int percpu_pagelist_fraction;
96 extern int compat_log; 96 extern int compat_log;
97 extern int latencytop_enabled; 97 extern int latencytop_enabled;
98 extern int sysctl_nr_open_min, sysctl_nr_open_max; 98 extern int sysctl_nr_open_min, sysctl_nr_open_max;
99 #ifndef CONFIG_MMU 99 #ifndef CONFIG_MMU
100 extern int sysctl_nr_trim_pages; 100 extern int sysctl_nr_trim_pages;
101 #endif 101 #endif
102 #ifdef CONFIG_BLOCK 102 #ifdef CONFIG_BLOCK
103 extern int blk_iopoll_enabled; 103 extern int blk_iopoll_enabled;
104 #endif 104 #endif
105 105
106 /* Constants used for minimum and maximum */ 106 /* Constants used for minimum and maximum */
107 #ifdef CONFIG_DETECT_SOFTLOCKUP 107 #ifdef CONFIG_DETECT_SOFTLOCKUP
108 static int sixty = 60; 108 static int sixty = 60;
109 static int neg_one = -1; 109 static int neg_one = -1;
110 #endif 110 #endif
111 111
112 static int zero; 112 static int zero;
113 static int __maybe_unused one = 1; 113 static int __maybe_unused one = 1;
114 static int __maybe_unused two = 2; 114 static int __maybe_unused two = 2;
115 static unsigned long one_ul = 1; 115 static unsigned long one_ul = 1;
116 static int one_hundred = 100; 116 static int one_hundred = 100;
117 #ifdef CONFIG_PRINTK 117 #ifdef CONFIG_PRINTK
118 static int ten_thousand = 10000; 118 static int ten_thousand = 10000;
119 #endif 119 #endif
120 120
121 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */ 121 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
122 static unsigned long dirty_bytes_min = 2 * PAGE_SIZE; 122 static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
123 123
124 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ 124 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
125 static int maxolduid = 65535; 125 static int maxolduid = 65535;
126 static int minolduid; 126 static int minolduid;
127 static int min_percpu_pagelist_fract = 8; 127 static int min_percpu_pagelist_fract = 8;
128 128
129 static int ngroups_max = NGROUPS_MAX; 129 static int ngroups_max = NGROUPS_MAX;
130 130
131 #ifdef CONFIG_SPARC 131 #ifdef CONFIG_SPARC
132 #include <asm/system.h> 132 #include <asm/system.h>
133 #endif 133 #endif
134 134
135 #ifdef CONFIG_SPARC64 135 #ifdef CONFIG_SPARC64
136 extern int sysctl_tsb_ratio; 136 extern int sysctl_tsb_ratio;
137 #endif 137 #endif
138 138
139 #ifdef __hppa__ 139 #ifdef __hppa__
140 extern int pwrsw_enabled; 140 extern int pwrsw_enabled;
141 extern int unaligned_enabled; 141 extern int unaligned_enabled;
142 #endif 142 #endif
143 143
144 #ifdef CONFIG_S390 144 #ifdef CONFIG_S390
145 #ifdef CONFIG_MATHEMU 145 #ifdef CONFIG_MATHEMU
146 extern int sysctl_ieee_emulation_warnings; 146 extern int sysctl_ieee_emulation_warnings;
147 #endif 147 #endif
148 extern int sysctl_userprocess_debug; 148 extern int sysctl_userprocess_debug;
149 extern int spin_retry; 149 extern int spin_retry;
150 #endif 150 #endif
151 151
152 #ifdef CONFIG_IA64 152 #ifdef CONFIG_IA64
153 extern int no_unaligned_warning; 153 extern int no_unaligned_warning;
154 extern int unaligned_dump_stack; 154 extern int unaligned_dump_stack;
155 #endif 155 #endif
156 156
157 extern struct ratelimit_state printk_ratelimit_state; 157 extern struct ratelimit_state printk_ratelimit_state;
158 158
159 #ifdef CONFIG_PROC_SYSCTL 159 #ifdef CONFIG_PROC_SYSCTL
160 static int proc_do_cad_pid(struct ctl_table *table, int write, 160 static int proc_do_cad_pid(struct ctl_table *table, int write,
161 void __user *buffer, size_t *lenp, loff_t *ppos); 161 void __user *buffer, size_t *lenp, loff_t *ppos);
162 static int proc_taint(struct ctl_table *table, int write, 162 static int proc_taint(struct ctl_table *table, int write,
163 void __user *buffer, size_t *lenp, loff_t *ppos); 163 void __user *buffer, size_t *lenp, loff_t *ppos);
164 #endif 164 #endif
165 165
166 #ifdef CONFIG_MAGIC_SYSRQ 166 #ifdef CONFIG_MAGIC_SYSRQ
167 static int __sysrq_enabled; /* Note: sysrq code ises it's own private copy */ 167 static int __sysrq_enabled; /* Note: sysrq code ises it's own private copy */
168 168
169 static int sysrq_sysctl_handler(ctl_table *table, int write, 169 static int sysrq_sysctl_handler(ctl_table *table, int write,
170 void __user *buffer, size_t *lenp, 170 void __user *buffer, size_t *lenp,
171 loff_t *ppos) 171 loff_t *ppos)
172 { 172 {
173 int error; 173 int error;
174 174
175 error = proc_dointvec(table, write, buffer, lenp, ppos); 175 error = proc_dointvec(table, write, buffer, lenp, ppos);
176 if (error) 176 if (error)
177 return error; 177 return error;
178 178
179 if (write) 179 if (write)
180 sysrq_toggle_support(__sysrq_enabled); 180 sysrq_toggle_support(__sysrq_enabled);
181 181
182 return 0; 182 return 0;
183 } 183 }
184 184
185 #endif 185 #endif
186 186
187 static struct ctl_table root_table[]; 187 static struct ctl_table root_table[];
188 static struct ctl_table_root sysctl_table_root; 188 static struct ctl_table_root sysctl_table_root;
189 static struct ctl_table_header root_table_header = { 189 static struct ctl_table_header root_table_header = {
190 .count = 1, 190 .count = 1,
191 .ctl_table = root_table, 191 .ctl_table = root_table,
192 .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list), 192 .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),
193 .root = &sysctl_table_root, 193 .root = &sysctl_table_root,
194 .set = &sysctl_table_root.default_set, 194 .set = &sysctl_table_root.default_set,
195 }; 195 };
196 static struct ctl_table_root sysctl_table_root = { 196 static struct ctl_table_root sysctl_table_root = {
197 .root_list = LIST_HEAD_INIT(sysctl_table_root.root_list), 197 .root_list = LIST_HEAD_INIT(sysctl_table_root.root_list),
198 .default_set.list = LIST_HEAD_INIT(root_table_header.ctl_entry), 198 .default_set.list = LIST_HEAD_INIT(root_table_header.ctl_entry),
199 }; 199 };
200 200
201 static struct ctl_table kern_table[]; 201 static struct ctl_table kern_table[];
202 static struct ctl_table vm_table[]; 202 static struct ctl_table vm_table[];
203 static struct ctl_table fs_table[]; 203 static struct ctl_table fs_table[];
204 static struct ctl_table debug_table[]; 204 static struct ctl_table debug_table[];
205 static struct ctl_table dev_table[]; 205 static struct ctl_table dev_table[];
206 extern struct ctl_table random_table[]; 206 extern struct ctl_table random_table[];
207 #ifdef CONFIG_INOTIFY_USER 207 #ifdef CONFIG_INOTIFY_USER
208 extern struct ctl_table inotify_table[]; 208 extern struct ctl_table inotify_table[];
209 #endif 209 #endif
210 #ifdef CONFIG_EPOLL 210 #ifdef CONFIG_EPOLL
211 extern struct ctl_table epoll_table[]; 211 extern struct ctl_table epoll_table[];
212 #endif 212 #endif
213 213
214 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT 214 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
215 int sysctl_legacy_va_layout; 215 int sysctl_legacy_va_layout;
216 #endif 216 #endif
217 217
218 /* The default sysctl tables: */ 218 /* The default sysctl tables: */
219 219
220 static struct ctl_table root_table[] = { 220 static struct ctl_table root_table[] = {
221 { 221 {
222 .procname = "kernel", 222 .procname = "kernel",
223 .mode = 0555, 223 .mode = 0555,
224 .child = kern_table, 224 .child = kern_table,
225 }, 225 },
226 { 226 {
227 .procname = "vm", 227 .procname = "vm",
228 .mode = 0555, 228 .mode = 0555,
229 .child = vm_table, 229 .child = vm_table,
230 }, 230 },
231 { 231 {
232 .procname = "fs", 232 .procname = "fs",
233 .mode = 0555, 233 .mode = 0555,
234 .child = fs_table, 234 .child = fs_table,
235 }, 235 },
236 { 236 {
237 .procname = "debug", 237 .procname = "debug",
238 .mode = 0555, 238 .mode = 0555,
239 .child = debug_table, 239 .child = debug_table,
240 }, 240 },
241 { 241 {
242 .procname = "dev", 242 .procname = "dev",
243 .mode = 0555, 243 .mode = 0555,
244 .child = dev_table, 244 .child = dev_table,
245 }, 245 },
246 /* 246 /*
247 * NOTE: do not add new entries to this table unless you have read 247 * NOTE: do not add new entries to this table unless you have read
248 * Documentation/sysctl/ctl_unnumbered.txt 248 * Documentation/sysctl/ctl_unnumbered.txt
249 */ 249 */
250 { } 250 { }
251 }; 251 };
252 252
253 #ifdef CONFIG_SCHED_DEBUG 253 #ifdef CONFIG_SCHED_DEBUG
254 static int min_sched_granularity_ns = 100000; /* 100 usecs */ 254 static int min_sched_granularity_ns = 100000; /* 100 usecs */
255 static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */ 255 static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
256 static int min_wakeup_granularity_ns; /* 0 usecs */ 256 static int min_wakeup_granularity_ns; /* 0 usecs */
257 static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */ 257 static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
258 static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE; 258 static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
259 static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1; 259 static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
260 static int min_sched_shares_ratelimit = 100000; /* 100 usec */ 260 static int min_sched_shares_ratelimit = 100000; /* 100 usec */
261 static int max_sched_shares_ratelimit = NSEC_PER_SEC; /* 1 second */ 261 static int max_sched_shares_ratelimit = NSEC_PER_SEC; /* 1 second */
262 #endif 262 #endif
263 263
264 static struct ctl_table kern_table[] = { 264 static struct ctl_table kern_table[] = {
265 { 265 {
266 .procname = "sched_child_runs_first", 266 .procname = "sched_child_runs_first",
267 .data = &sysctl_sched_child_runs_first, 267 .data = &sysctl_sched_child_runs_first,
268 .maxlen = sizeof(unsigned int), 268 .maxlen = sizeof(unsigned int),
269 .mode = 0644, 269 .mode = 0644,
270 .proc_handler = proc_dointvec, 270 .proc_handler = proc_dointvec,
271 }, 271 },
272 #ifdef CONFIG_SCHED_DEBUG 272 #ifdef CONFIG_SCHED_DEBUG
273 { 273 {
274 .procname = "sched_min_granularity_ns", 274 .procname = "sched_min_granularity_ns",
275 .data = &sysctl_sched_min_granularity, 275 .data = &sysctl_sched_min_granularity,
276 .maxlen = sizeof(unsigned int), 276 .maxlen = sizeof(unsigned int),
277 .mode = 0644, 277 .mode = 0644,
278 .proc_handler = sched_proc_update_handler, 278 .proc_handler = sched_proc_update_handler,
279 .extra1 = &min_sched_granularity_ns, 279 .extra1 = &min_sched_granularity_ns,
280 .extra2 = &max_sched_granularity_ns, 280 .extra2 = &max_sched_granularity_ns,
281 }, 281 },
282 { 282 {
283 .procname = "sched_latency_ns", 283 .procname = "sched_latency_ns",
284 .data = &sysctl_sched_latency, 284 .data = &sysctl_sched_latency,
285 .maxlen = sizeof(unsigned int), 285 .maxlen = sizeof(unsigned int),
286 .mode = 0644, 286 .mode = 0644,
287 .proc_handler = sched_proc_update_handler, 287 .proc_handler = sched_proc_update_handler,
288 .extra1 = &min_sched_granularity_ns, 288 .extra1 = &min_sched_granularity_ns,
289 .extra2 = &max_sched_granularity_ns, 289 .extra2 = &max_sched_granularity_ns,
290 }, 290 },
291 { 291 {
292 .procname = "sched_wakeup_granularity_ns", 292 .procname = "sched_wakeup_granularity_ns",
293 .data = &sysctl_sched_wakeup_granularity, 293 .data = &sysctl_sched_wakeup_granularity,
294 .maxlen = sizeof(unsigned int), 294 .maxlen = sizeof(unsigned int),
295 .mode = 0644, 295 .mode = 0644,
296 .proc_handler = sched_proc_update_handler, 296 .proc_handler = sched_proc_update_handler,
297 .extra1 = &min_wakeup_granularity_ns, 297 .extra1 = &min_wakeup_granularity_ns,
298 .extra2 = &max_wakeup_granularity_ns, 298 .extra2 = &max_wakeup_granularity_ns,
299 }, 299 },
300 { 300 {
301 .procname = "sched_shares_ratelimit", 301 .procname = "sched_shares_ratelimit",
302 .data = &sysctl_sched_shares_ratelimit, 302 .data = &sysctl_sched_shares_ratelimit,
303 .maxlen = sizeof(unsigned int), 303 .maxlen = sizeof(unsigned int),
304 .mode = 0644, 304 .mode = 0644,
305 .proc_handler = sched_proc_update_handler, 305 .proc_handler = sched_proc_update_handler,
306 .extra1 = &min_sched_shares_ratelimit, 306 .extra1 = &min_sched_shares_ratelimit,
307 .extra2 = &max_sched_shares_ratelimit, 307 .extra2 = &max_sched_shares_ratelimit,
308 }, 308 },
309 { 309 {
310 .procname = "sched_tunable_scaling", 310 .procname = "sched_tunable_scaling",
311 .data = &sysctl_sched_tunable_scaling, 311 .data = &sysctl_sched_tunable_scaling,
312 .maxlen = sizeof(enum sched_tunable_scaling), 312 .maxlen = sizeof(enum sched_tunable_scaling),
313 .mode = 0644, 313 .mode = 0644,
314 .proc_handler = sched_proc_update_handler, 314 .proc_handler = sched_proc_update_handler,
315 .extra1 = &min_sched_tunable_scaling, 315 .extra1 = &min_sched_tunable_scaling,
316 .extra2 = &max_sched_tunable_scaling, 316 .extra2 = &max_sched_tunable_scaling,
317 }, 317 },
318 { 318 {
319 .procname = "sched_shares_thresh", 319 .procname = "sched_shares_thresh",
320 .data = &sysctl_sched_shares_thresh, 320 .data = &sysctl_sched_shares_thresh,
321 .maxlen = sizeof(unsigned int), 321 .maxlen = sizeof(unsigned int),
322 .mode = 0644, 322 .mode = 0644,
323 .proc_handler = proc_dointvec_minmax, 323 .proc_handler = proc_dointvec_minmax,
324 .extra1 = &zero, 324 .extra1 = &zero,
325 }, 325 },
326 { 326 {
327 .procname = "sched_migration_cost", 327 .procname = "sched_migration_cost",
328 .data = &sysctl_sched_migration_cost, 328 .data = &sysctl_sched_migration_cost,
329 .maxlen = sizeof(unsigned int), 329 .maxlen = sizeof(unsigned int),
330 .mode = 0644, 330 .mode = 0644,
331 .proc_handler = proc_dointvec, 331 .proc_handler = proc_dointvec,
332 }, 332 },
333 { 333 {
334 .procname = "sched_nr_migrate", 334 .procname = "sched_nr_migrate",
335 .data = &sysctl_sched_nr_migrate, 335 .data = &sysctl_sched_nr_migrate,
336 .maxlen = sizeof(unsigned int), 336 .maxlen = sizeof(unsigned int),
337 .mode = 0644, 337 .mode = 0644,
338 .proc_handler = proc_dointvec, 338 .proc_handler = proc_dointvec,
339 }, 339 },
340 { 340 {
341 .procname = "sched_time_avg", 341 .procname = "sched_time_avg",
342 .data = &sysctl_sched_time_avg, 342 .data = &sysctl_sched_time_avg,
343 .maxlen = sizeof(unsigned int), 343 .maxlen = sizeof(unsigned int),
344 .mode = 0644, 344 .mode = 0644,
345 .proc_handler = proc_dointvec, 345 .proc_handler = proc_dointvec,
346 }, 346 },
347 { 347 {
348 .procname = "timer_migration", 348 .procname = "timer_migration",
349 .data = &sysctl_timer_migration, 349 .data = &sysctl_timer_migration,
350 .maxlen = sizeof(unsigned int), 350 .maxlen = sizeof(unsigned int),
351 .mode = 0644, 351 .mode = 0644,
352 .proc_handler = proc_dointvec_minmax, 352 .proc_handler = proc_dointvec_minmax,
353 .extra1 = &zero, 353 .extra1 = &zero,
354 .extra2 = &one, 354 .extra2 = &one,
355 }, 355 },
356 #endif 356 #endif
357 { 357 {
358 .procname = "sched_rt_period_us", 358 .procname = "sched_rt_period_us",
359 .data = &sysctl_sched_rt_period, 359 .data = &sysctl_sched_rt_period,
360 .maxlen = sizeof(unsigned int), 360 .maxlen = sizeof(unsigned int),
361 .mode = 0644, 361 .mode = 0644,
362 .proc_handler = sched_rt_handler, 362 .proc_handler = sched_rt_handler,
363 }, 363 },
364 { 364 {
365 .procname = "sched_rt_runtime_us", 365 .procname = "sched_rt_runtime_us",
366 .data = &sysctl_sched_rt_runtime, 366 .data = &sysctl_sched_rt_runtime,
367 .maxlen = sizeof(int), 367 .maxlen = sizeof(int),
368 .mode = 0644, 368 .mode = 0644,
369 .proc_handler = sched_rt_handler, 369 .proc_handler = sched_rt_handler,
370 }, 370 },
371 { 371 {
372 .procname = "sched_compat_yield", 372 .procname = "sched_compat_yield",
373 .data = &sysctl_sched_compat_yield, 373 .data = &sysctl_sched_compat_yield,
374 .maxlen = sizeof(unsigned int), 374 .maxlen = sizeof(unsigned int),
375 .mode = 0644, 375 .mode = 0644,
376 .proc_handler = proc_dointvec, 376 .proc_handler = proc_dointvec,
377 }, 377 },
378 #ifdef CONFIG_PROVE_LOCKING 378 #ifdef CONFIG_PROVE_LOCKING
379 { 379 {
380 .procname = "prove_locking", 380 .procname = "prove_locking",
381 .data = &prove_locking, 381 .data = &prove_locking,
382 .maxlen = sizeof(int), 382 .maxlen = sizeof(int),
383 .mode = 0644, 383 .mode = 0644,
384 .proc_handler = proc_dointvec, 384 .proc_handler = proc_dointvec,
385 }, 385 },
386 #endif 386 #endif
387 #ifdef CONFIG_LOCK_STAT 387 #ifdef CONFIG_LOCK_STAT
388 { 388 {
389 .procname = "lock_stat", 389 .procname = "lock_stat",
390 .data = &lock_stat, 390 .data = &lock_stat,
391 .maxlen = sizeof(int), 391 .maxlen = sizeof(int),
392 .mode = 0644, 392 .mode = 0644,
393 .proc_handler = proc_dointvec, 393 .proc_handler = proc_dointvec,
394 }, 394 },
395 #endif 395 #endif
396 { 396 {
397 .procname = "panic", 397 .procname = "panic",
398 .data = &panic_timeout, 398 .data = &panic_timeout,
399 .maxlen = sizeof(int), 399 .maxlen = sizeof(int),
400 .mode = 0644, 400 .mode = 0644,
401 .proc_handler = proc_dointvec, 401 .proc_handler = proc_dointvec,
402 }, 402 },
403 { 403 {
404 .procname = "core_uses_pid", 404 .procname = "core_uses_pid",
405 .data = &core_uses_pid, 405 .data = &core_uses_pid,
406 .maxlen = sizeof(int), 406 .maxlen = sizeof(int),
407 .mode = 0644, 407 .mode = 0644,
408 .proc_handler = proc_dointvec, 408 .proc_handler = proc_dointvec,
409 }, 409 },
410 { 410 {
411 .procname = "core_pattern", 411 .procname = "core_pattern",
412 .data = core_pattern, 412 .data = core_pattern,
413 .maxlen = CORENAME_MAX_SIZE, 413 .maxlen = CORENAME_MAX_SIZE,
414 .mode = 0644, 414 .mode = 0644,
415 .proc_handler = proc_dostring, 415 .proc_handler = proc_dostring,
416 }, 416 },
417 { 417 {
418 .procname = "core_pipe_limit", 418 .procname = "core_pipe_limit",
419 .data = &core_pipe_limit, 419 .data = &core_pipe_limit,
420 .maxlen = sizeof(unsigned int), 420 .maxlen = sizeof(unsigned int),
421 .mode = 0644, 421 .mode = 0644,
422 .proc_handler = proc_dointvec, 422 .proc_handler = proc_dointvec,
423 }, 423 },
424 #ifdef CONFIG_PROC_SYSCTL 424 #ifdef CONFIG_PROC_SYSCTL
425 { 425 {
426 .procname = "tainted", 426 .procname = "tainted",
427 .maxlen = sizeof(long), 427 .maxlen = sizeof(long),
428 .mode = 0644, 428 .mode = 0644,
429 .proc_handler = proc_taint, 429 .proc_handler = proc_taint,
430 }, 430 },
431 #endif 431 #endif
432 #ifdef CONFIG_LATENCYTOP 432 #ifdef CONFIG_LATENCYTOP
433 { 433 {
434 .procname = "latencytop", 434 .procname = "latencytop",
435 .data = &latencytop_enabled, 435 .data = &latencytop_enabled,
436 .maxlen = sizeof(int), 436 .maxlen = sizeof(int),
437 .mode = 0644, 437 .mode = 0644,
438 .proc_handler = proc_dointvec, 438 .proc_handler = proc_dointvec,
439 }, 439 },
440 #endif 440 #endif
441 #ifdef CONFIG_BLK_DEV_INITRD 441 #ifdef CONFIG_BLK_DEV_INITRD
442 { 442 {
443 .procname = "real-root-dev", 443 .procname = "real-root-dev",
444 .data = &real_root_dev, 444 .data = &real_root_dev,
445 .maxlen = sizeof(int), 445 .maxlen = sizeof(int),
446 .mode = 0644, 446 .mode = 0644,
447 .proc_handler = proc_dointvec, 447 .proc_handler = proc_dointvec,
448 }, 448 },
449 #endif 449 #endif
450 { 450 {
451 .procname = "print-fatal-signals", 451 .procname = "print-fatal-signals",
452 .data = &print_fatal_signals, 452 .data = &print_fatal_signals,
453 .maxlen = sizeof(int), 453 .maxlen = sizeof(int),
454 .mode = 0644, 454 .mode = 0644,
455 .proc_handler = proc_dointvec, 455 .proc_handler = proc_dointvec,
456 }, 456 },
457 #ifdef CONFIG_SPARC 457 #ifdef CONFIG_SPARC
458 { 458 {
459 .procname = "reboot-cmd", 459 .procname = "reboot-cmd",
460 .data = reboot_command, 460 .data = reboot_command,
461 .maxlen = 256, 461 .maxlen = 256,
462 .mode = 0644, 462 .mode = 0644,
463 .proc_handler = proc_dostring, 463 .proc_handler = proc_dostring,
464 }, 464 },
465 { 465 {
466 .procname = "stop-a", 466 .procname = "stop-a",
467 .data = &stop_a_enabled, 467 .data = &stop_a_enabled,
468 .maxlen = sizeof (int), 468 .maxlen = sizeof (int),
469 .mode = 0644, 469 .mode = 0644,
470 .proc_handler = proc_dointvec, 470 .proc_handler = proc_dointvec,
471 }, 471 },
472 { 472 {
473 .procname = "scons-poweroff", 473 .procname = "scons-poweroff",
474 .data = &scons_pwroff, 474 .data = &scons_pwroff,
475 .maxlen = sizeof (int), 475 .maxlen = sizeof (int),
476 .mode = 0644, 476 .mode = 0644,
477 .proc_handler = proc_dointvec, 477 .proc_handler = proc_dointvec,
478 }, 478 },
479 #endif 479 #endif
480 #ifdef CONFIG_SPARC64 480 #ifdef CONFIG_SPARC64
481 { 481 {
482 .procname = "tsb-ratio", 482 .procname = "tsb-ratio",
483 .data = &sysctl_tsb_ratio, 483 .data = &sysctl_tsb_ratio,
484 .maxlen = sizeof (int), 484 .maxlen = sizeof (int),
485 .mode = 0644, 485 .mode = 0644,
486 .proc_handler = proc_dointvec, 486 .proc_handler = proc_dointvec,
487 }, 487 },
488 #endif 488 #endif
489 #ifdef __hppa__ 489 #ifdef __hppa__
490 { 490 {
491 .procname = "soft-power", 491 .procname = "soft-power",
492 .data = &pwrsw_enabled, 492 .data = &pwrsw_enabled,
493 .maxlen = sizeof (int), 493 .maxlen = sizeof (int),
494 .mode = 0644, 494 .mode = 0644,
495 .proc_handler = proc_dointvec, 495 .proc_handler = proc_dointvec,
496 }, 496 },
497 { 497 {
498 .procname = "unaligned-trap", 498 .procname = "unaligned-trap",
499 .data = &unaligned_enabled, 499 .data = &unaligned_enabled,
500 .maxlen = sizeof (int), 500 .maxlen = sizeof (int),
501 .mode = 0644, 501 .mode = 0644,
502 .proc_handler = proc_dointvec, 502 .proc_handler = proc_dointvec,
503 }, 503 },
504 #endif 504 #endif
505 { 505 {
506 .procname = "ctrl-alt-del", 506 .procname = "ctrl-alt-del",
507 .data = &C_A_D, 507 .data = &C_A_D,
508 .maxlen = sizeof(int), 508 .maxlen = sizeof(int),
509 .mode = 0644, 509 .mode = 0644,
510 .proc_handler = proc_dointvec, 510 .proc_handler = proc_dointvec,
511 }, 511 },
512 #ifdef CONFIG_FUNCTION_TRACER 512 #ifdef CONFIG_FUNCTION_TRACER
513 { 513 {
514 .procname = "ftrace_enabled", 514 .procname = "ftrace_enabled",
515 .data = &ftrace_enabled, 515 .data = &ftrace_enabled,
516 .maxlen = sizeof(int), 516 .maxlen = sizeof(int),
517 .mode = 0644, 517 .mode = 0644,
518 .proc_handler = ftrace_enable_sysctl, 518 .proc_handler = ftrace_enable_sysctl,
519 }, 519 },
520 #endif 520 #endif
521 #ifdef CONFIG_STACK_TRACER 521 #ifdef CONFIG_STACK_TRACER
522 { 522 {
523 .procname = "stack_tracer_enabled", 523 .procname = "stack_tracer_enabled",
524 .data = &stack_tracer_enabled, 524 .data = &stack_tracer_enabled,
525 .maxlen = sizeof(int), 525 .maxlen = sizeof(int),
526 .mode = 0644, 526 .mode = 0644,
527 .proc_handler = stack_trace_sysctl, 527 .proc_handler = stack_trace_sysctl,
528 }, 528 },
529 #endif 529 #endif
530 #ifdef CONFIG_TRACING 530 #ifdef CONFIG_TRACING
531 { 531 {
532 .procname = "ftrace_dump_on_oops", 532 .procname = "ftrace_dump_on_oops",
533 .data = &ftrace_dump_on_oops, 533 .data = &ftrace_dump_on_oops,
534 .maxlen = sizeof(int), 534 .maxlen = sizeof(int),
535 .mode = 0644, 535 .mode = 0644,
536 .proc_handler = proc_dointvec, 536 .proc_handler = proc_dointvec,
537 }, 537 },
538 #endif 538 #endif
539 #ifdef CONFIG_MODULES 539 #ifdef CONFIG_MODULES
540 { 540 {
541 .procname = "modprobe", 541 .procname = "modprobe",
542 .data = &modprobe_path, 542 .data = &modprobe_path,
543 .maxlen = KMOD_PATH_LEN, 543 .maxlen = KMOD_PATH_LEN,
544 .mode = 0644, 544 .mode = 0644,
545 .proc_handler = proc_dostring, 545 .proc_handler = proc_dostring,
546 }, 546 },
547 { 547 {
548 .procname = "modules_disabled", 548 .procname = "modules_disabled",
549 .data = &modules_disabled, 549 .data = &modules_disabled,
550 .maxlen = sizeof(int), 550 .maxlen = sizeof(int),
551 .mode = 0644, 551 .mode = 0644,
552 /* only handle a transition from default "0" to "1" */ 552 /* only handle a transition from default "0" to "1" */
553 .proc_handler = proc_dointvec_minmax, 553 .proc_handler = proc_dointvec_minmax,
554 .extra1 = &one, 554 .extra1 = &one,
555 .extra2 = &one, 555 .extra2 = &one,
556 }, 556 },
557 #endif 557 #endif
558 #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) 558 #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
559 { 559 {
560 .procname = "hotplug", 560 .procname = "hotplug",
561 .data = &uevent_helper, 561 .data = &uevent_helper,
562 .maxlen = UEVENT_HELPER_PATH_LEN, 562 .maxlen = UEVENT_HELPER_PATH_LEN,
563 .mode = 0644, 563 .mode = 0644,
564 .proc_handler = proc_dostring, 564 .proc_handler = proc_dostring,
565 }, 565 },
566 #endif 566 #endif
567 #ifdef CONFIG_CHR_DEV_SG 567 #ifdef CONFIG_CHR_DEV_SG
568 { 568 {
569 .procname = "sg-big-buff", 569 .procname = "sg-big-buff",
570 .data = &sg_big_buff, 570 .data = &sg_big_buff,
571 .maxlen = sizeof (int), 571 .maxlen = sizeof (int),
572 .mode = 0444, 572 .mode = 0444,
573 .proc_handler = proc_dointvec, 573 .proc_handler = proc_dointvec,
574 }, 574 },
575 #endif 575 #endif
576 #ifdef CONFIG_BSD_PROCESS_ACCT 576 #ifdef CONFIG_BSD_PROCESS_ACCT
577 { 577 {
578 .procname = "acct", 578 .procname = "acct",
579 .data = &acct_parm, 579 .data = &acct_parm,
580 .maxlen = 3*sizeof(int), 580 .maxlen = 3*sizeof(int),
581 .mode = 0644, 581 .mode = 0644,
582 .proc_handler = proc_dointvec, 582 .proc_handler = proc_dointvec,
583 }, 583 },
584 #endif 584 #endif
585 #ifdef CONFIG_MAGIC_SYSRQ 585 #ifdef CONFIG_MAGIC_SYSRQ
586 { 586 {
587 .procname = "sysrq", 587 .procname = "sysrq",
588 .data = &__sysrq_enabled, 588 .data = &__sysrq_enabled,
589 .maxlen = sizeof (int), 589 .maxlen = sizeof (int),
590 .mode = 0644, 590 .mode = 0644,
591 .proc_handler = sysrq_sysctl_handler, 591 .proc_handler = sysrq_sysctl_handler,
592 }, 592 },
593 #endif 593 #endif
594 #ifdef CONFIG_PROC_SYSCTL 594 #ifdef CONFIG_PROC_SYSCTL
595 { 595 {
596 .procname = "cad_pid", 596 .procname = "cad_pid",
597 .data = NULL, 597 .data = NULL,
598 .maxlen = sizeof (int), 598 .maxlen = sizeof (int),
599 .mode = 0600, 599 .mode = 0600,
600 .proc_handler = proc_do_cad_pid, 600 .proc_handler = proc_do_cad_pid,
601 }, 601 },
602 #endif 602 #endif
603 { 603 {
604 .procname = "threads-max", 604 .procname = "threads-max",
605 .data = &max_threads, 605 .data = &max_threads,
606 .maxlen = sizeof(int), 606 .maxlen = sizeof(int),
607 .mode = 0644, 607 .mode = 0644,
608 .proc_handler = proc_dointvec, 608 .proc_handler = proc_dointvec,
609 }, 609 },
610 { 610 {
611 .procname = "random", 611 .procname = "random",
612 .mode = 0555, 612 .mode = 0555,
613 .child = random_table, 613 .child = random_table,
614 }, 614 },
615 { 615 {
616 .procname = "overflowuid", 616 .procname = "overflowuid",
617 .data = &overflowuid, 617 .data = &overflowuid,
618 .maxlen = sizeof(int), 618 .maxlen = sizeof(int),
619 .mode = 0644, 619 .mode = 0644,
620 .proc_handler = proc_dointvec_minmax, 620 .proc_handler = proc_dointvec_minmax,
621 .extra1 = &minolduid, 621 .extra1 = &minolduid,
622 .extra2 = &maxolduid, 622 .extra2 = &maxolduid,
623 }, 623 },
624 { 624 {
625 .procname = "overflowgid", 625 .procname = "overflowgid",
626 .data = &overflowgid, 626 .data = &overflowgid,
627 .maxlen = sizeof(int), 627 .maxlen = sizeof(int),
628 .mode = 0644, 628 .mode = 0644,
629 .proc_handler = proc_dointvec_minmax, 629 .proc_handler = proc_dointvec_minmax,
630 .extra1 = &minolduid, 630 .extra1 = &minolduid,
631 .extra2 = &maxolduid, 631 .extra2 = &maxolduid,
632 }, 632 },
633 #ifdef CONFIG_S390 633 #ifdef CONFIG_S390
634 #ifdef CONFIG_MATHEMU 634 #ifdef CONFIG_MATHEMU
635 { 635 {
636 .procname = "ieee_emulation_warnings", 636 .procname = "ieee_emulation_warnings",
637 .data = &sysctl_ieee_emulation_warnings, 637 .data = &sysctl_ieee_emulation_warnings,
638 .maxlen = sizeof(int), 638 .maxlen = sizeof(int),
639 .mode = 0644, 639 .mode = 0644,
640 .proc_handler = proc_dointvec, 640 .proc_handler = proc_dointvec,
641 }, 641 },
642 #endif 642 #endif
643 { 643 {
644 .procname = "userprocess_debug", 644 .procname = "userprocess_debug",
645 .data = &show_unhandled_signals, 645 .data = &show_unhandled_signals,
646 .maxlen = sizeof(int), 646 .maxlen = sizeof(int),
647 .mode = 0644, 647 .mode = 0644,
648 .proc_handler = proc_dointvec, 648 .proc_handler = proc_dointvec,
649 }, 649 },
650 #endif 650 #endif
651 { 651 {
652 .procname = "pid_max", 652 .procname = "pid_max",
653 .data = &pid_max, 653 .data = &pid_max,
654 .maxlen = sizeof (int), 654 .maxlen = sizeof (int),
655 .mode = 0644, 655 .mode = 0644,
656 .proc_handler = proc_dointvec_minmax, 656 .proc_handler = proc_dointvec_minmax,
657 .extra1 = &pid_max_min, 657 .extra1 = &pid_max_min,
658 .extra2 = &pid_max_max, 658 .extra2 = &pid_max_max,
659 }, 659 },
660 { 660 {
661 .procname = "panic_on_oops", 661 .procname = "panic_on_oops",
662 .data = &panic_on_oops, 662 .data = &panic_on_oops,
663 .maxlen = sizeof(int), 663 .maxlen = sizeof(int),
664 .mode = 0644, 664 .mode = 0644,
665 .proc_handler = proc_dointvec, 665 .proc_handler = proc_dointvec,
666 }, 666 },
667 #if defined CONFIG_PRINTK 667 #if defined CONFIG_PRINTK
668 { 668 {
669 .procname = "printk", 669 .procname = "printk",
670 .data = &console_loglevel, 670 .data = &console_loglevel,
671 .maxlen = 4*sizeof(int), 671 .maxlen = 4*sizeof(int),
672 .mode = 0644, 672 .mode = 0644,
673 .proc_handler = proc_dointvec, 673 .proc_handler = proc_dointvec,
674 }, 674 },
675 { 675 {
676 .procname = "printk_ratelimit", 676 .procname = "printk_ratelimit",
677 .data = &printk_ratelimit_state.interval, 677 .data = &printk_ratelimit_state.interval,
678 .maxlen = sizeof(int), 678 .maxlen = sizeof(int),
679 .mode = 0644, 679 .mode = 0644,
680 .proc_handler = proc_dointvec_jiffies, 680 .proc_handler = proc_dointvec_jiffies,
681 }, 681 },
682 { 682 {
683 .procname = "printk_ratelimit_burst", 683 .procname = "printk_ratelimit_burst",
684 .data = &printk_ratelimit_state.burst, 684 .data = &printk_ratelimit_state.burst,
685 .maxlen = sizeof(int), 685 .maxlen = sizeof(int),
686 .mode = 0644, 686 .mode = 0644,
687 .proc_handler = proc_dointvec, 687 .proc_handler = proc_dointvec,
688 }, 688 },
689 { 689 {
690 .procname = "printk_delay", 690 .procname = "printk_delay",
691 .data = &printk_delay_msec, 691 .data = &printk_delay_msec,
692 .maxlen = sizeof(int), 692 .maxlen = sizeof(int),
693 .mode = 0644, 693 .mode = 0644,
694 .proc_handler = proc_dointvec_minmax, 694 .proc_handler = proc_dointvec_minmax,
695 .extra1 = &zero, 695 .extra1 = &zero,
696 .extra2 = &ten_thousand, 696 .extra2 = &ten_thousand,
697 }, 697 },
698 #endif 698 #endif
699 { 699 {
700 .procname = "ngroups_max", 700 .procname = "ngroups_max",
701 .data = &ngroups_max, 701 .data = &ngroups_max,
702 .maxlen = sizeof (int), 702 .maxlen = sizeof (int),
703 .mode = 0444, 703 .mode = 0444,
704 .proc_handler = proc_dointvec, 704 .proc_handler = proc_dointvec,
705 }, 705 },
706 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) 706 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
707 { 707 {
708 .procname = "unknown_nmi_panic", 708 .procname = "unknown_nmi_panic",
709 .data = &unknown_nmi_panic, 709 .data = &unknown_nmi_panic,
710 .maxlen = sizeof (int), 710 .maxlen = sizeof (int),
711 .mode = 0644, 711 .mode = 0644,
712 .proc_handler = proc_dointvec, 712 .proc_handler = proc_dointvec,
713 }, 713 },
714 { 714 {
715 .procname = "nmi_watchdog", 715 .procname = "nmi_watchdog",
716 .data = &nmi_watchdog_enabled, 716 .data = &nmi_watchdog_enabled,
717 .maxlen = sizeof (int), 717 .maxlen = sizeof (int),
718 .mode = 0644, 718 .mode = 0644,
719 .proc_handler = proc_nmi_enabled, 719 .proc_handler = proc_nmi_enabled,
720 }, 720 },
721 #endif 721 #endif
722 #if defined(CONFIG_X86) 722 #if defined(CONFIG_X86)
723 { 723 {
724 .procname = "panic_on_unrecovered_nmi", 724 .procname = "panic_on_unrecovered_nmi",
725 .data = &panic_on_unrecovered_nmi, 725 .data = &panic_on_unrecovered_nmi,
726 .maxlen = sizeof(int), 726 .maxlen = sizeof(int),
727 .mode = 0644, 727 .mode = 0644,
728 .proc_handler = proc_dointvec, 728 .proc_handler = proc_dointvec,
729 }, 729 },
730 { 730 {
731 .procname = "panic_on_io_nmi", 731 .procname = "panic_on_io_nmi",
732 .data = &panic_on_io_nmi, 732 .data = &panic_on_io_nmi,
733 .maxlen = sizeof(int), 733 .maxlen = sizeof(int),
734 .mode = 0644, 734 .mode = 0644,
735 .proc_handler = proc_dointvec, 735 .proc_handler = proc_dointvec,
736 }, 736 },
737 { 737 {
738 .procname = "bootloader_type", 738 .procname = "bootloader_type",
739 .data = &bootloader_type, 739 .data = &bootloader_type,
740 .maxlen = sizeof (int), 740 .maxlen = sizeof (int),
741 .mode = 0444, 741 .mode = 0444,
742 .proc_handler = proc_dointvec, 742 .proc_handler = proc_dointvec,
743 }, 743 },
744 { 744 {
745 .procname = "bootloader_version", 745 .procname = "bootloader_version",
746 .data = &bootloader_version, 746 .data = &bootloader_version,
747 .maxlen = sizeof (int), 747 .maxlen = sizeof (int),
748 .mode = 0444, 748 .mode = 0444,
749 .proc_handler = proc_dointvec, 749 .proc_handler = proc_dointvec,
750 }, 750 },
751 { 751 {
752 .procname = "kstack_depth_to_print", 752 .procname = "kstack_depth_to_print",
753 .data = &kstack_depth_to_print, 753 .data = &kstack_depth_to_print,
754 .maxlen = sizeof(int), 754 .maxlen = sizeof(int),
755 .mode = 0644, 755 .mode = 0644,
756 .proc_handler = proc_dointvec, 756 .proc_handler = proc_dointvec,
757 }, 757 },
758 { 758 {
759 .procname = "io_delay_type", 759 .procname = "io_delay_type",
760 .data = &io_delay_type, 760 .data = &io_delay_type,
761 .maxlen = sizeof(int), 761 .maxlen = sizeof(int),
762 .mode = 0644, 762 .mode = 0644,
763 .proc_handler = proc_dointvec, 763 .proc_handler = proc_dointvec,
764 }, 764 },
765 #endif 765 #endif
766 #if defined(CONFIG_MMU) 766 #if defined(CONFIG_MMU)
767 { 767 {
768 .procname = "randomize_va_space", 768 .procname = "randomize_va_space",
769 .data = &randomize_va_space, 769 .data = &randomize_va_space,
770 .maxlen = sizeof(int), 770 .maxlen = sizeof(int),
771 .mode = 0644, 771 .mode = 0644,
772 .proc_handler = proc_dointvec, 772 .proc_handler = proc_dointvec,
773 }, 773 },
774 #endif 774 #endif
775 #if defined(CONFIG_S390) && defined(CONFIG_SMP) 775 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
776 { 776 {
777 .procname = "spin_retry", 777 .procname = "spin_retry",
778 .data = &spin_retry, 778 .data = &spin_retry,
779 .maxlen = sizeof (int), 779 .maxlen = sizeof (int),
780 .mode = 0644, 780 .mode = 0644,
781 .proc_handler = proc_dointvec, 781 .proc_handler = proc_dointvec,
782 }, 782 },
783 #endif 783 #endif
784 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86) 784 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
785 { 785 {
786 .procname = "acpi_video_flags", 786 .procname = "acpi_video_flags",
787 .data = &acpi_realmode_flags, 787 .data = &acpi_realmode_flags,
788 .maxlen = sizeof (unsigned long), 788 .maxlen = sizeof (unsigned long),
789 .mode = 0644, 789 .mode = 0644,
790 .proc_handler = proc_doulongvec_minmax, 790 .proc_handler = proc_doulongvec_minmax,
791 }, 791 },
792 #endif 792 #endif
793 #ifdef CONFIG_IA64 793 #ifdef CONFIG_IA64
794 { 794 {
795 .procname = "ignore-unaligned-usertrap", 795 .procname = "ignore-unaligned-usertrap",
796 .data = &no_unaligned_warning, 796 .data = &no_unaligned_warning,
797 .maxlen = sizeof (int), 797 .maxlen = sizeof (int),
798 .mode = 0644, 798 .mode = 0644,
799 .proc_handler = proc_dointvec, 799 .proc_handler = proc_dointvec,
800 }, 800 },
801 { 801 {
802 .procname = "unaligned-dump-stack", 802 .procname = "unaligned-dump-stack",
803 .data = &unaligned_dump_stack, 803 .data = &unaligned_dump_stack,
804 .maxlen = sizeof (int), 804 .maxlen = sizeof (int),
805 .mode = 0644, 805 .mode = 0644,
806 .proc_handler = proc_dointvec, 806 .proc_handler = proc_dointvec,
807 }, 807 },
808 #endif 808 #endif
809 #ifdef CONFIG_DETECT_SOFTLOCKUP 809 #ifdef CONFIG_DETECT_SOFTLOCKUP
810 { 810 {
811 .procname = "softlockup_panic", 811 .procname = "softlockup_panic",
812 .data = &softlockup_panic, 812 .data = &softlockup_panic,
813 .maxlen = sizeof(int), 813 .maxlen = sizeof(int),
814 .mode = 0644, 814 .mode = 0644,
815 .proc_handler = proc_dointvec_minmax, 815 .proc_handler = proc_dointvec_minmax,
816 .extra1 = &zero, 816 .extra1 = &zero,
817 .extra2 = &one, 817 .extra2 = &one,
818 }, 818 },
819 { 819 {
820 .procname = "softlockup_thresh", 820 .procname = "softlockup_thresh",
821 .data = &softlockup_thresh, 821 .data = &softlockup_thresh,
822 .maxlen = sizeof(int), 822 .maxlen = sizeof(int),
823 .mode = 0644, 823 .mode = 0644,
824 .proc_handler = proc_dosoftlockup_thresh, 824 .proc_handler = proc_dosoftlockup_thresh,
825 .extra1 = &neg_one, 825 .extra1 = &neg_one,
826 .extra2 = &sixty, 826 .extra2 = &sixty,
827 }, 827 },
828 #endif 828 #endif
829 #ifdef CONFIG_DETECT_HUNG_TASK 829 #ifdef CONFIG_DETECT_HUNG_TASK
830 { 830 {
831 .procname = "hung_task_panic", 831 .procname = "hung_task_panic",
832 .data = &sysctl_hung_task_panic, 832 .data = &sysctl_hung_task_panic,
833 .maxlen = sizeof(int), 833 .maxlen = sizeof(int),
834 .mode = 0644, 834 .mode = 0644,
835 .proc_handler = proc_dointvec_minmax, 835 .proc_handler = proc_dointvec_minmax,
836 .extra1 = &zero, 836 .extra1 = &zero,
837 .extra2 = &one, 837 .extra2 = &one,
838 }, 838 },
839 { 839 {
840 .procname = "hung_task_check_count", 840 .procname = "hung_task_check_count",
841 .data = &sysctl_hung_task_check_count, 841 .data = &sysctl_hung_task_check_count,
842 .maxlen = sizeof(unsigned long), 842 .maxlen = sizeof(unsigned long),
843 .mode = 0644, 843 .mode = 0644,
844 .proc_handler = proc_doulongvec_minmax, 844 .proc_handler = proc_doulongvec_minmax,
845 }, 845 },
846 { 846 {
847 .procname = "hung_task_timeout_secs", 847 .procname = "hung_task_timeout_secs",
848 .data = &sysctl_hung_task_timeout_secs, 848 .data = &sysctl_hung_task_timeout_secs,
849 .maxlen = sizeof(unsigned long), 849 .maxlen = sizeof(unsigned long),
850 .mode = 0644, 850 .mode = 0644,
851 .proc_handler = proc_dohung_task_timeout_secs, 851 .proc_handler = proc_dohung_task_timeout_secs,
852 }, 852 },
853 { 853 {
854 .procname = "hung_task_warnings", 854 .procname = "hung_task_warnings",
855 .data = &sysctl_hung_task_warnings, 855 .data = &sysctl_hung_task_warnings,
856 .maxlen = sizeof(unsigned long), 856 .maxlen = sizeof(unsigned long),
857 .mode = 0644, 857 .mode = 0644,
858 .proc_handler = proc_doulongvec_minmax, 858 .proc_handler = proc_doulongvec_minmax,
859 }, 859 },
860 #endif 860 #endif
861 #ifdef CONFIG_COMPAT 861 #ifdef CONFIG_COMPAT
862 { 862 {
863 .procname = "compat-log", 863 .procname = "compat-log",
864 .data = &compat_log, 864 .data = &compat_log,
865 .maxlen = sizeof (int), 865 .maxlen = sizeof (int),
866 .mode = 0644, 866 .mode = 0644,
867 .proc_handler = proc_dointvec, 867 .proc_handler = proc_dointvec,
868 }, 868 },
869 #endif 869 #endif
870 #ifdef CONFIG_RT_MUTEXES 870 #ifdef CONFIG_RT_MUTEXES
871 { 871 {
872 .procname = "max_lock_depth", 872 .procname = "max_lock_depth",
873 .data = &max_lock_depth, 873 .data = &max_lock_depth,
874 .maxlen = sizeof(int), 874 .maxlen = sizeof(int),
875 .mode = 0644, 875 .mode = 0644,
876 .proc_handler = proc_dointvec, 876 .proc_handler = proc_dointvec,
877 }, 877 },
878 #endif 878 #endif
879 { 879 {
880 .procname = "poweroff_cmd", 880 .procname = "poweroff_cmd",
881 .data = &poweroff_cmd, 881 .data = &poweroff_cmd,
882 .maxlen = POWEROFF_CMD_PATH_LEN, 882 .maxlen = POWEROFF_CMD_PATH_LEN,
883 .mode = 0644, 883 .mode = 0644,
884 .proc_handler = proc_dostring, 884 .proc_handler = proc_dostring,
885 }, 885 },
886 #ifdef CONFIG_KEYS 886 #ifdef CONFIG_KEYS
887 { 887 {
888 .procname = "keys", 888 .procname = "keys",
889 .mode = 0555, 889 .mode = 0555,
890 .child = key_sysctls, 890 .child = key_sysctls,
891 }, 891 },
892 #endif 892 #endif
893 #ifdef CONFIG_RCU_TORTURE_TEST 893 #ifdef CONFIG_RCU_TORTURE_TEST
894 { 894 {
895 .procname = "rcutorture_runnable", 895 .procname = "rcutorture_runnable",
896 .data = &rcutorture_runnable, 896 .data = &rcutorture_runnable,
897 .maxlen = sizeof(int), 897 .maxlen = sizeof(int),
898 .mode = 0644, 898 .mode = 0644,
899 .proc_handler = proc_dointvec, 899 .proc_handler = proc_dointvec,
900 }, 900 },
901 #endif 901 #endif
902 #ifdef CONFIG_SLOW_WORK 902 #ifdef CONFIG_SLOW_WORK
903 { 903 {
904 .procname = "slow-work", 904 .procname = "slow-work",
905 .mode = 0555, 905 .mode = 0555,
906 .child = slow_work_sysctls, 906 .child = slow_work_sysctls,
907 }, 907 },
908 #endif 908 #endif
909 #ifdef CONFIG_PERF_EVENTS 909 #ifdef CONFIG_PERF_EVENTS
910 { 910 {
911 .procname = "perf_event_paranoid", 911 .procname = "perf_event_paranoid",
912 .data = &sysctl_perf_event_paranoid, 912 .data = &sysctl_perf_event_paranoid,
913 .maxlen = sizeof(sysctl_perf_event_paranoid), 913 .maxlen = sizeof(sysctl_perf_event_paranoid),
914 .mode = 0644, 914 .mode = 0644,
915 .proc_handler = proc_dointvec, 915 .proc_handler = proc_dointvec,
916 }, 916 },
917 { 917 {
918 .procname = "perf_event_mlock_kb", 918 .procname = "perf_event_mlock_kb",
919 .data = &sysctl_perf_event_mlock, 919 .data = &sysctl_perf_event_mlock,
920 .maxlen = sizeof(sysctl_perf_event_mlock), 920 .maxlen = sizeof(sysctl_perf_event_mlock),
921 .mode = 0644, 921 .mode = 0644,
922 .proc_handler = proc_dointvec, 922 .proc_handler = proc_dointvec,
923 }, 923 },
924 { 924 {
925 .procname = "perf_event_max_sample_rate", 925 .procname = "perf_event_max_sample_rate",
926 .data = &sysctl_perf_event_sample_rate, 926 .data = &sysctl_perf_event_sample_rate,
927 .maxlen = sizeof(sysctl_perf_event_sample_rate), 927 .maxlen = sizeof(sysctl_perf_event_sample_rate),
928 .mode = 0644, 928 .mode = 0644,
929 .proc_handler = proc_dointvec, 929 .proc_handler = proc_dointvec,
930 }, 930 },
931 #endif 931 #endif
932 #ifdef CONFIG_KMEMCHECK 932 #ifdef CONFIG_KMEMCHECK
933 { 933 {
934 .procname = "kmemcheck", 934 .procname = "kmemcheck",
935 .data = &kmemcheck_enabled, 935 .data = &kmemcheck_enabled,
936 .maxlen = sizeof(int), 936 .maxlen = sizeof(int),
937 .mode = 0644, 937 .mode = 0644,
938 .proc_handler = proc_dointvec, 938 .proc_handler = proc_dointvec,
939 }, 939 },
940 #endif 940 #endif
941 #ifdef CONFIG_BLOCK 941 #ifdef CONFIG_BLOCK
942 { 942 {
943 .procname = "blk_iopoll", 943 .procname = "blk_iopoll",
944 .data = &blk_iopoll_enabled, 944 .data = &blk_iopoll_enabled,
945 .maxlen = sizeof(int), 945 .maxlen = sizeof(int),
946 .mode = 0644, 946 .mode = 0644,
947 .proc_handler = proc_dointvec, 947 .proc_handler = proc_dointvec,
948 }, 948 },
949 #endif 949 #endif
950 /* 950 /*
951 * NOTE: do not add new entries to this table unless you have read 951 * NOTE: do not add new entries to this table unless you have read
952 * Documentation/sysctl/ctl_unnumbered.txt 952 * Documentation/sysctl/ctl_unnumbered.txt
953 */ 953 */
954 { } 954 { }
955 }; 955 };
956 956
957 static struct ctl_table vm_table[] = { 957 static struct ctl_table vm_table[] = {
958 { 958 {
959 .procname = "overcommit_memory", 959 .procname = "overcommit_memory",
960 .data = &sysctl_overcommit_memory, 960 .data = &sysctl_overcommit_memory,
961 .maxlen = sizeof(sysctl_overcommit_memory), 961 .maxlen = sizeof(sysctl_overcommit_memory),
962 .mode = 0644, 962 .mode = 0644,
963 .proc_handler = proc_dointvec, 963 .proc_handler = proc_dointvec,
964 }, 964 },
965 { 965 {
966 .procname = "panic_on_oom", 966 .procname = "panic_on_oom",
967 .data = &sysctl_panic_on_oom, 967 .data = &sysctl_panic_on_oom,
968 .maxlen = sizeof(sysctl_panic_on_oom), 968 .maxlen = sizeof(sysctl_panic_on_oom),
969 .mode = 0644, 969 .mode = 0644,
970 .proc_handler = proc_dointvec, 970 .proc_handler = proc_dointvec,
971 }, 971 },
972 { 972 {
973 .procname = "oom_kill_allocating_task", 973 .procname = "oom_kill_allocating_task",
974 .data = &sysctl_oom_kill_allocating_task, 974 .data = &sysctl_oom_kill_allocating_task,
975 .maxlen = sizeof(sysctl_oom_kill_allocating_task), 975 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
976 .mode = 0644, 976 .mode = 0644,
977 .proc_handler = proc_dointvec, 977 .proc_handler = proc_dointvec,
978 }, 978 },
979 { 979 {
980 .procname = "oom_dump_tasks", 980 .procname = "oom_dump_tasks",
981 .data = &sysctl_oom_dump_tasks, 981 .data = &sysctl_oom_dump_tasks,
982 .maxlen = sizeof(sysctl_oom_dump_tasks), 982 .maxlen = sizeof(sysctl_oom_dump_tasks),
983 .mode = 0644, 983 .mode = 0644,
984 .proc_handler = proc_dointvec, 984 .proc_handler = proc_dointvec,
985 }, 985 },
986 { 986 {
987 .procname = "overcommit_ratio", 987 .procname = "overcommit_ratio",
988 .data = &sysctl_overcommit_ratio, 988 .data = &sysctl_overcommit_ratio,
989 .maxlen = sizeof(sysctl_overcommit_ratio), 989 .maxlen = sizeof(sysctl_overcommit_ratio),
990 .mode = 0644, 990 .mode = 0644,
991 .proc_handler = proc_dointvec, 991 .proc_handler = proc_dointvec,
992 }, 992 },
993 { 993 {
994 .procname = "page-cluster", 994 .procname = "page-cluster",
995 .data = &page_cluster, 995 .data = &page_cluster,
996 .maxlen = sizeof(int), 996 .maxlen = sizeof(int),
997 .mode = 0644, 997 .mode = 0644,
998 .proc_handler = proc_dointvec, 998 .proc_handler = proc_dointvec,
999 }, 999 },
1000 { 1000 {
1001 .procname = "dirty_background_ratio", 1001 .procname = "dirty_background_ratio",
1002 .data = &dirty_background_ratio, 1002 .data = &dirty_background_ratio,
1003 .maxlen = sizeof(dirty_background_ratio), 1003 .maxlen = sizeof(dirty_background_ratio),
1004 .mode = 0644, 1004 .mode = 0644,
1005 .proc_handler = dirty_background_ratio_handler, 1005 .proc_handler = dirty_background_ratio_handler,
1006 .extra1 = &zero, 1006 .extra1 = &zero,
1007 .extra2 = &one_hundred, 1007 .extra2 = &one_hundred,
1008 }, 1008 },
1009 { 1009 {
1010 .procname = "dirty_background_bytes", 1010 .procname = "dirty_background_bytes",
1011 .data = &dirty_background_bytes, 1011 .data = &dirty_background_bytes,
1012 .maxlen = sizeof(dirty_background_bytes), 1012 .maxlen = sizeof(dirty_background_bytes),
1013 .mode = 0644, 1013 .mode = 0644,
1014 .proc_handler = dirty_background_bytes_handler, 1014 .proc_handler = dirty_background_bytes_handler,
1015 .extra1 = &one_ul, 1015 .extra1 = &one_ul,
1016 }, 1016 },
1017 { 1017 {
1018 .procname = "dirty_ratio", 1018 .procname = "dirty_ratio",
1019 .data = &vm_dirty_ratio, 1019 .data = &vm_dirty_ratio,
1020 .maxlen = sizeof(vm_dirty_ratio), 1020 .maxlen = sizeof(vm_dirty_ratio),
1021 .mode = 0644, 1021 .mode = 0644,
1022 .proc_handler = dirty_ratio_handler, 1022 .proc_handler = dirty_ratio_handler,
1023 .extra1 = &zero, 1023 .extra1 = &zero,
1024 .extra2 = &one_hundred, 1024 .extra2 = &one_hundred,
1025 }, 1025 },
1026 { 1026 {
1027 .procname = "dirty_bytes", 1027 .procname = "dirty_bytes",
1028 .data = &vm_dirty_bytes, 1028 .data = &vm_dirty_bytes,
1029 .maxlen = sizeof(vm_dirty_bytes), 1029 .maxlen = sizeof(vm_dirty_bytes),
1030 .mode = 0644, 1030 .mode = 0644,
1031 .proc_handler = dirty_bytes_handler, 1031 .proc_handler = dirty_bytes_handler,
1032 .extra1 = &dirty_bytes_min, 1032 .extra1 = &dirty_bytes_min,
1033 }, 1033 },
1034 { 1034 {
1035 .procname = "dirty_writeback_centisecs", 1035 .procname = "dirty_writeback_centisecs",
1036 .data = &dirty_writeback_interval, 1036 .data = &dirty_writeback_interval,
1037 .maxlen = sizeof(dirty_writeback_interval), 1037 .maxlen = sizeof(dirty_writeback_interval),
1038 .mode = 0644, 1038 .mode = 0644,
1039 .proc_handler = dirty_writeback_centisecs_handler, 1039 .proc_handler = dirty_writeback_centisecs_handler,
1040 }, 1040 },
1041 { 1041 {
1042 .procname = "dirty_expire_centisecs", 1042 .procname = "dirty_expire_centisecs",
1043 .data = &dirty_expire_interval, 1043 .data = &dirty_expire_interval,
1044 .maxlen = sizeof(dirty_expire_interval), 1044 .maxlen = sizeof(dirty_expire_interval),
1045 .mode = 0644, 1045 .mode = 0644,
1046 .proc_handler = proc_dointvec, 1046 .proc_handler = proc_dointvec,
1047 }, 1047 },
1048 { 1048 {
1049 .procname = "nr_pdflush_threads", 1049 .procname = "nr_pdflush_threads",
1050 .data = &nr_pdflush_threads, 1050 .data = &nr_pdflush_threads,
1051 .maxlen = sizeof nr_pdflush_threads, 1051 .maxlen = sizeof nr_pdflush_threads,
1052 .mode = 0444 /* read-only*/, 1052 .mode = 0444 /* read-only*/,
1053 .proc_handler = proc_dointvec, 1053 .proc_handler = proc_dointvec,
1054 }, 1054 },
1055 { 1055 {
1056 .procname = "swappiness", 1056 .procname = "swappiness",
1057 .data = &vm_swappiness, 1057 .data = &vm_swappiness,
1058 .maxlen = sizeof(vm_swappiness), 1058 .maxlen = sizeof(vm_swappiness),
1059 .mode = 0644, 1059 .mode = 0644,
1060 .proc_handler = proc_dointvec_minmax, 1060 .proc_handler = proc_dointvec_minmax,
1061 .extra1 = &zero, 1061 .extra1 = &zero,
1062 .extra2 = &one_hundred, 1062 .extra2 = &one_hundred,
1063 }, 1063 },
1064 #ifdef CONFIG_HUGETLB_PAGE 1064 #ifdef CONFIG_HUGETLB_PAGE
1065 { 1065 {
1066 .procname = "nr_hugepages", 1066 .procname = "nr_hugepages",
1067 .data = NULL, 1067 .data = NULL,
1068 .maxlen = sizeof(unsigned long), 1068 .maxlen = sizeof(unsigned long),
1069 .mode = 0644, 1069 .mode = 0644,
1070 .proc_handler = hugetlb_sysctl_handler, 1070 .proc_handler = hugetlb_sysctl_handler,
1071 .extra1 = (void *)&hugetlb_zero, 1071 .extra1 = (void *)&hugetlb_zero,
1072 .extra2 = (void *)&hugetlb_infinity, 1072 .extra2 = (void *)&hugetlb_infinity,
1073 }, 1073 },
1074 #ifdef CONFIG_NUMA 1074 #ifdef CONFIG_NUMA
1075 { 1075 {
1076 .procname = "nr_hugepages_mempolicy", 1076 .procname = "nr_hugepages_mempolicy",
1077 .data = NULL, 1077 .data = NULL,
1078 .maxlen = sizeof(unsigned long), 1078 .maxlen = sizeof(unsigned long),
1079 .mode = 0644, 1079 .mode = 0644,
1080 .proc_handler = &hugetlb_mempolicy_sysctl_handler, 1080 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1081 .extra1 = (void *)&hugetlb_zero, 1081 .extra1 = (void *)&hugetlb_zero,
1082 .extra2 = (void *)&hugetlb_infinity, 1082 .extra2 = (void *)&hugetlb_infinity,
1083 }, 1083 },
1084 #endif 1084 #endif
1085 { 1085 {
1086 .procname = "hugetlb_shm_group", 1086 .procname = "hugetlb_shm_group",
1087 .data = &sysctl_hugetlb_shm_group, 1087 .data = &sysctl_hugetlb_shm_group,
1088 .maxlen = sizeof(gid_t), 1088 .maxlen = sizeof(gid_t),
1089 .mode = 0644, 1089 .mode = 0644,
1090 .proc_handler = proc_dointvec, 1090 .proc_handler = proc_dointvec,
1091 }, 1091 },
1092 { 1092 {
1093 .procname = "hugepages_treat_as_movable", 1093 .procname = "hugepages_treat_as_movable",
1094 .data = &hugepages_treat_as_movable, 1094 .data = &hugepages_treat_as_movable,
1095 .maxlen = sizeof(int), 1095 .maxlen = sizeof(int),
1096 .mode = 0644, 1096 .mode = 0644,
1097 .proc_handler = hugetlb_treat_movable_handler, 1097 .proc_handler = hugetlb_treat_movable_handler,
1098 }, 1098 },
1099 { 1099 {
1100 .procname = "nr_overcommit_hugepages", 1100 .procname = "nr_overcommit_hugepages",
1101 .data = NULL, 1101 .data = NULL,
1102 .maxlen = sizeof(unsigned long), 1102 .maxlen = sizeof(unsigned long),
1103 .mode = 0644, 1103 .mode = 0644,
1104 .proc_handler = hugetlb_overcommit_handler, 1104 .proc_handler = hugetlb_overcommit_handler,
1105 .extra1 = (void *)&hugetlb_zero, 1105 .extra1 = (void *)&hugetlb_zero,
1106 .extra2 = (void *)&hugetlb_infinity, 1106 .extra2 = (void *)&hugetlb_infinity,
1107 }, 1107 },
1108 #endif 1108 #endif
1109 { 1109 {
1110 .procname = "lowmem_reserve_ratio", 1110 .procname = "lowmem_reserve_ratio",
1111 .data = &sysctl_lowmem_reserve_ratio, 1111 .data = &sysctl_lowmem_reserve_ratio,
1112 .maxlen = sizeof(sysctl_lowmem_reserve_ratio), 1112 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1113 .mode = 0644, 1113 .mode = 0644,
1114 .proc_handler = lowmem_reserve_ratio_sysctl_handler, 1114 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
1115 }, 1115 },
1116 { 1116 {
1117 .procname = "drop_caches", 1117 .procname = "drop_caches",
1118 .data = &sysctl_drop_caches, 1118 .data = &sysctl_drop_caches,
1119 .maxlen = sizeof(int), 1119 .maxlen = sizeof(int),
1120 .mode = 0644, 1120 .mode = 0644,
1121 .proc_handler = drop_caches_sysctl_handler, 1121 .proc_handler = drop_caches_sysctl_handler,
1122 }, 1122 },
1123 { 1123 {
1124 .procname = "min_free_kbytes", 1124 .procname = "min_free_kbytes",
1125 .data = &min_free_kbytes, 1125 .data = &min_free_kbytes,
1126 .maxlen = sizeof(min_free_kbytes), 1126 .maxlen = sizeof(min_free_kbytes),
1127 .mode = 0644, 1127 .mode = 0644,
1128 .proc_handler = min_free_kbytes_sysctl_handler, 1128 .proc_handler = min_free_kbytes_sysctl_handler,
1129 .extra1 = &zero, 1129 .extra1 = &zero,
1130 }, 1130 },
1131 { 1131 {
1132 .procname = "percpu_pagelist_fraction", 1132 .procname = "percpu_pagelist_fraction",
1133 .data = &percpu_pagelist_fraction, 1133 .data = &percpu_pagelist_fraction,
1134 .maxlen = sizeof(percpu_pagelist_fraction), 1134 .maxlen = sizeof(percpu_pagelist_fraction),
1135 .mode = 0644, 1135 .mode = 0644,
1136 .proc_handler = percpu_pagelist_fraction_sysctl_handler, 1136 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
1137 .extra1 = &min_percpu_pagelist_fract, 1137 .extra1 = &min_percpu_pagelist_fract,
1138 }, 1138 },
1139 #ifdef CONFIG_MMU 1139 #ifdef CONFIG_MMU
1140 { 1140 {
1141 .procname = "max_map_count", 1141 .procname = "max_map_count",
1142 .data = &sysctl_max_map_count, 1142 .data = &sysctl_max_map_count,
1143 .maxlen = sizeof(sysctl_max_map_count), 1143 .maxlen = sizeof(sysctl_max_map_count),
1144 .mode = 0644, 1144 .mode = 0644,
1145 .proc_handler = proc_dointvec_minmax, 1145 .proc_handler = proc_dointvec_minmax,
1146 .extra1 = &zero, 1146 .extra1 = &zero,
1147 }, 1147 },
1148 #else 1148 #else
1149 { 1149 {
1150 .procname = "nr_trim_pages", 1150 .procname = "nr_trim_pages",
1151 .data = &sysctl_nr_trim_pages, 1151 .data = &sysctl_nr_trim_pages,
1152 .maxlen = sizeof(sysctl_nr_trim_pages), 1152 .maxlen = sizeof(sysctl_nr_trim_pages),
1153 .mode = 0644, 1153 .mode = 0644,
1154 .proc_handler = proc_dointvec_minmax, 1154 .proc_handler = proc_dointvec_minmax,
1155 .extra1 = &zero, 1155 .extra1 = &zero,
1156 }, 1156 },
1157 #endif 1157 #endif
1158 { 1158 {
1159 .procname = "laptop_mode", 1159 .procname = "laptop_mode",
1160 .data = &laptop_mode, 1160 .data = &laptop_mode,
1161 .maxlen = sizeof(laptop_mode), 1161 .maxlen = sizeof(laptop_mode),
1162 .mode = 0644, 1162 .mode = 0644,
1163 .proc_handler = proc_dointvec_jiffies, 1163 .proc_handler = proc_dointvec_jiffies,
1164 }, 1164 },
1165 { 1165 {
1166 .procname = "block_dump", 1166 .procname = "block_dump",
1167 .data = &block_dump, 1167 .data = &block_dump,
1168 .maxlen = sizeof(block_dump), 1168 .maxlen = sizeof(block_dump),
1169 .mode = 0644, 1169 .mode = 0644,
1170 .proc_handler = proc_dointvec, 1170 .proc_handler = proc_dointvec,
1171 .extra1 = &zero, 1171 .extra1 = &zero,
1172 }, 1172 },
1173 { 1173 {
1174 .procname = "vfs_cache_pressure", 1174 .procname = "vfs_cache_pressure",
1175 .data = &sysctl_vfs_cache_pressure, 1175 .data = &sysctl_vfs_cache_pressure,
1176 .maxlen = sizeof(sysctl_vfs_cache_pressure), 1176 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1177 .mode = 0644, 1177 .mode = 0644,
1178 .proc_handler = proc_dointvec, 1178 .proc_handler = proc_dointvec,
1179 .extra1 = &zero, 1179 .extra1 = &zero,
1180 }, 1180 },
1181 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT 1181 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1182 { 1182 {
1183 .procname = "legacy_va_layout", 1183 .procname = "legacy_va_layout",
1184 .data = &sysctl_legacy_va_layout, 1184 .data = &sysctl_legacy_va_layout,
1185 .maxlen = sizeof(sysctl_legacy_va_layout), 1185 .maxlen = sizeof(sysctl_legacy_va_layout),
1186 .mode = 0644, 1186 .mode = 0644,
1187 .proc_handler = proc_dointvec, 1187 .proc_handler = proc_dointvec,
1188 .extra1 = &zero, 1188 .extra1 = &zero,
1189 }, 1189 },
1190 #endif 1190 #endif
1191 #ifdef CONFIG_NUMA 1191 #ifdef CONFIG_NUMA
1192 { 1192 {
1193 .procname = "zone_reclaim_mode", 1193 .procname = "zone_reclaim_mode",
1194 .data = &zone_reclaim_mode, 1194 .data = &zone_reclaim_mode,
1195 .maxlen = sizeof(zone_reclaim_mode), 1195 .maxlen = sizeof(zone_reclaim_mode),
1196 .mode = 0644, 1196 .mode = 0644,
1197 .proc_handler = proc_dointvec, 1197 .proc_handler = proc_dointvec,
1198 .extra1 = &zero, 1198 .extra1 = &zero,
1199 }, 1199 },
1200 { 1200 {
1201 .procname = "min_unmapped_ratio", 1201 .procname = "min_unmapped_ratio",
1202 .data = &sysctl_min_unmapped_ratio, 1202 .data = &sysctl_min_unmapped_ratio,
1203 .maxlen = sizeof(sysctl_min_unmapped_ratio), 1203 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1204 .mode = 0644, 1204 .mode = 0644,
1205 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler, 1205 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
1206 .extra1 = &zero, 1206 .extra1 = &zero,
1207 .extra2 = &one_hundred, 1207 .extra2 = &one_hundred,
1208 }, 1208 },
1209 { 1209 {
1210 .procname = "min_slab_ratio", 1210 .procname = "min_slab_ratio",
1211 .data = &sysctl_min_slab_ratio, 1211 .data = &sysctl_min_slab_ratio,
1212 .maxlen = sizeof(sysctl_min_slab_ratio), 1212 .maxlen = sizeof(sysctl_min_slab_ratio),
1213 .mode = 0644, 1213 .mode = 0644,
1214 .proc_handler = sysctl_min_slab_ratio_sysctl_handler, 1214 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
1215 .extra1 = &zero, 1215 .extra1 = &zero,
1216 .extra2 = &one_hundred, 1216 .extra2 = &one_hundred,
1217 }, 1217 },
1218 #endif 1218 #endif
1219 #ifdef CONFIG_SMP 1219 #ifdef CONFIG_SMP
1220 { 1220 {
1221 .procname = "stat_interval", 1221 .procname = "stat_interval",
1222 .data = &sysctl_stat_interval, 1222 .data = &sysctl_stat_interval,
1223 .maxlen = sizeof(sysctl_stat_interval), 1223 .maxlen = sizeof(sysctl_stat_interval),
1224 .mode = 0644, 1224 .mode = 0644,
1225 .proc_handler = proc_dointvec_jiffies, 1225 .proc_handler = proc_dointvec_jiffies,
1226 }, 1226 },
1227 #endif 1227 #endif
1228 #ifdef CONFIG_MMU 1228 #ifdef CONFIG_MMU
1229 { 1229 {
1230 .procname = "mmap_min_addr", 1230 .procname = "mmap_min_addr",
1231 .data = &dac_mmap_min_addr, 1231 .data = &dac_mmap_min_addr,
1232 .maxlen = sizeof(unsigned long), 1232 .maxlen = sizeof(unsigned long),
1233 .mode = 0644, 1233 .mode = 0644,
1234 .proc_handler = mmap_min_addr_handler, 1234 .proc_handler = mmap_min_addr_handler,
1235 }, 1235 },
1236 #endif 1236 #endif
1237 #ifdef CONFIG_NUMA 1237 #ifdef CONFIG_NUMA
1238 { 1238 {
1239 .procname = "numa_zonelist_order", 1239 .procname = "numa_zonelist_order",
1240 .data = &numa_zonelist_order, 1240 .data = &numa_zonelist_order,
1241 .maxlen = NUMA_ZONELIST_ORDER_LEN, 1241 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1242 .mode = 0644, 1242 .mode = 0644,
1243 .proc_handler = numa_zonelist_order_handler, 1243 .proc_handler = numa_zonelist_order_handler,
1244 }, 1244 },
1245 #endif 1245 #endif
1246 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \ 1246 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1247 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) 1247 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1248 { 1248 {
1249 .procname = "vdso_enabled", 1249 .procname = "vdso_enabled",
1250 .data = &vdso_enabled, 1250 .data = &vdso_enabled,
1251 .maxlen = sizeof(vdso_enabled), 1251 .maxlen = sizeof(vdso_enabled),
1252 .mode = 0644, 1252 .mode = 0644,
1253 .proc_handler = proc_dointvec, 1253 .proc_handler = proc_dointvec,
1254 .extra1 = &zero, 1254 .extra1 = &zero,
1255 }, 1255 },
1256 #endif 1256 #endif
1257 #ifdef CONFIG_HIGHMEM 1257 #ifdef CONFIG_HIGHMEM
1258 { 1258 {
1259 .procname = "highmem_is_dirtyable", 1259 .procname = "highmem_is_dirtyable",
1260 .data = &vm_highmem_is_dirtyable, 1260 .data = &vm_highmem_is_dirtyable,
1261 .maxlen = sizeof(vm_highmem_is_dirtyable), 1261 .maxlen = sizeof(vm_highmem_is_dirtyable),
1262 .mode = 0644, 1262 .mode = 0644,
1263 .proc_handler = proc_dointvec_minmax, 1263 .proc_handler = proc_dointvec_minmax,
1264 .extra1 = &zero, 1264 .extra1 = &zero,
1265 .extra2 = &one, 1265 .extra2 = &one,
1266 }, 1266 },
1267 #endif 1267 #endif
1268 { 1268 {
1269 .procname = "scan_unevictable_pages", 1269 .procname = "scan_unevictable_pages",
1270 .data = &scan_unevictable_pages, 1270 .data = &scan_unevictable_pages,
1271 .maxlen = sizeof(scan_unevictable_pages), 1271 .maxlen = sizeof(scan_unevictable_pages),
1272 .mode = 0644, 1272 .mode = 0644,
1273 .proc_handler = scan_unevictable_handler, 1273 .proc_handler = scan_unevictable_handler,
1274 }, 1274 },
1275 #ifdef CONFIG_MEMORY_FAILURE 1275 #ifdef CONFIG_MEMORY_FAILURE
1276 { 1276 {
1277 .procname = "memory_failure_early_kill", 1277 .procname = "memory_failure_early_kill",
1278 .data = &sysctl_memory_failure_early_kill, 1278 .data = &sysctl_memory_failure_early_kill,
1279 .maxlen = sizeof(sysctl_memory_failure_early_kill), 1279 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1280 .mode = 0644, 1280 .mode = 0644,
1281 .proc_handler = proc_dointvec_minmax, 1281 .proc_handler = proc_dointvec_minmax,
1282 .extra1 = &zero, 1282 .extra1 = &zero,
1283 .extra2 = &one, 1283 .extra2 = &one,
1284 }, 1284 },
1285 { 1285 {
1286 .procname = "memory_failure_recovery", 1286 .procname = "memory_failure_recovery",
1287 .data = &sysctl_memory_failure_recovery, 1287 .data = &sysctl_memory_failure_recovery,
1288 .maxlen = sizeof(sysctl_memory_failure_recovery), 1288 .maxlen = sizeof(sysctl_memory_failure_recovery),
1289 .mode = 0644, 1289 .mode = 0644,
1290 .proc_handler = proc_dointvec_minmax, 1290 .proc_handler = proc_dointvec_minmax,
1291 .extra1 = &zero, 1291 .extra1 = &zero,
1292 .extra2 = &one, 1292 .extra2 = &one,
1293 }, 1293 },
1294 #endif 1294 #endif
1295 1295
1296 /* 1296 /*
1297 * NOTE: do not add new entries to this table unless you have read 1297 * NOTE: do not add new entries to this table unless you have read
1298 * Documentation/sysctl/ctl_unnumbered.txt 1298 * Documentation/sysctl/ctl_unnumbered.txt
1299 */ 1299 */
1300 { } 1300 { }
1301 }; 1301 };
1302 1302
1303 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) 1303 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1304 static struct ctl_table binfmt_misc_table[] = { 1304 static struct ctl_table binfmt_misc_table[] = {
1305 { } 1305 { }
1306 }; 1306 };
1307 #endif 1307 #endif
1308 1308
1309 static struct ctl_table fs_table[] = { 1309 static struct ctl_table fs_table[] = {
1310 { 1310 {
1311 .procname = "inode-nr", 1311 .procname = "inode-nr",
1312 .data = &inodes_stat, 1312 .data = &inodes_stat,
1313 .maxlen = 2*sizeof(int), 1313 .maxlen = 2*sizeof(int),
1314 .mode = 0444, 1314 .mode = 0444,
1315 .proc_handler = proc_dointvec, 1315 .proc_handler = proc_dointvec,
1316 }, 1316 },
1317 { 1317 {
1318 .procname = "inode-state", 1318 .procname = "inode-state",
1319 .data = &inodes_stat, 1319 .data = &inodes_stat,
1320 .maxlen = 7*sizeof(int), 1320 .maxlen = 7*sizeof(int),
1321 .mode = 0444, 1321 .mode = 0444,
1322 .proc_handler = proc_dointvec, 1322 .proc_handler = proc_dointvec,
1323 }, 1323 },
1324 { 1324 {
1325 .procname = "file-nr", 1325 .procname = "file-nr",
1326 .data = &files_stat, 1326 .data = &files_stat,
1327 .maxlen = 3*sizeof(int), 1327 .maxlen = 3*sizeof(int),
1328 .mode = 0444, 1328 .mode = 0444,
1329 .proc_handler = proc_nr_files, 1329 .proc_handler = proc_nr_files,
1330 }, 1330 },
1331 { 1331 {
1332 .procname = "file-max", 1332 .procname = "file-max",
1333 .data = &files_stat.max_files, 1333 .data = &files_stat.max_files,
1334 .maxlen = sizeof(int), 1334 .maxlen = sizeof(int),
1335 .mode = 0644, 1335 .mode = 0644,
1336 .proc_handler = proc_dointvec, 1336 .proc_handler = proc_dointvec,
1337 }, 1337 },
1338 { 1338 {
1339 .procname = "nr_open", 1339 .procname = "nr_open",
1340 .data = &sysctl_nr_open, 1340 .data = &sysctl_nr_open,
1341 .maxlen = sizeof(int), 1341 .maxlen = sizeof(int),
1342 .mode = 0644, 1342 .mode = 0644,
1343 .proc_handler = proc_dointvec_minmax, 1343 .proc_handler = proc_dointvec_minmax,
1344 .extra1 = &sysctl_nr_open_min, 1344 .extra1 = &sysctl_nr_open_min,
1345 .extra2 = &sysctl_nr_open_max, 1345 .extra2 = &sysctl_nr_open_max,
1346 }, 1346 },
1347 { 1347 {
1348 .procname = "dentry-state", 1348 .procname = "dentry-state",
1349 .data = &dentry_stat, 1349 .data = &dentry_stat,
1350 .maxlen = 6*sizeof(int), 1350 .maxlen = 6*sizeof(int),
1351 .mode = 0444, 1351 .mode = 0444,
1352 .proc_handler = proc_dointvec, 1352 .proc_handler = proc_dointvec,
1353 }, 1353 },
1354 { 1354 {
1355 .procname = "overflowuid", 1355 .procname = "overflowuid",
1356 .data = &fs_overflowuid, 1356 .data = &fs_overflowuid,
1357 .maxlen = sizeof(int), 1357 .maxlen = sizeof(int),
1358 .mode = 0644, 1358 .mode = 0644,
1359 .proc_handler = proc_dointvec_minmax, 1359 .proc_handler = proc_dointvec_minmax,
1360 .extra1 = &minolduid, 1360 .extra1 = &minolduid,
1361 .extra2 = &maxolduid, 1361 .extra2 = &maxolduid,
1362 }, 1362 },
1363 { 1363 {
1364 .procname = "overflowgid", 1364 .procname = "overflowgid",
1365 .data = &fs_overflowgid, 1365 .data = &fs_overflowgid,
1366 .maxlen = sizeof(int), 1366 .maxlen = sizeof(int),
1367 .mode = 0644, 1367 .mode = 0644,
1368 .proc_handler = proc_dointvec_minmax, 1368 .proc_handler = proc_dointvec_minmax,
1369 .extra1 = &minolduid, 1369 .extra1 = &minolduid,
1370 .extra2 = &maxolduid, 1370 .extra2 = &maxolduid,
1371 }, 1371 },
1372 #ifdef CONFIG_FILE_LOCKING 1372 #ifdef CONFIG_FILE_LOCKING
1373 { 1373 {
1374 .procname = "leases-enable", 1374 .procname = "leases-enable",
1375 .data = &leases_enable, 1375 .data = &leases_enable,
1376 .maxlen = sizeof(int), 1376 .maxlen = sizeof(int),
1377 .mode = 0644, 1377 .mode = 0644,
1378 .proc_handler = proc_dointvec, 1378 .proc_handler = proc_dointvec,
1379 }, 1379 },
1380 #endif 1380 #endif
1381 #ifdef CONFIG_DNOTIFY 1381 #ifdef CONFIG_DNOTIFY
1382 { 1382 {
1383 .procname = "dir-notify-enable", 1383 .procname = "dir-notify-enable",
1384 .data = &dir_notify_enable, 1384 .data = &dir_notify_enable,
1385 .maxlen = sizeof(int), 1385 .maxlen = sizeof(int),
1386 .mode = 0644, 1386 .mode = 0644,
1387 .proc_handler = proc_dointvec, 1387 .proc_handler = proc_dointvec,
1388 }, 1388 },
1389 #endif 1389 #endif
1390 #ifdef CONFIG_MMU 1390 #ifdef CONFIG_MMU
1391 #ifdef CONFIG_FILE_LOCKING 1391 #ifdef CONFIG_FILE_LOCKING
1392 { 1392 {
1393 .procname = "lease-break-time", 1393 .procname = "lease-break-time",
1394 .data = &lease_break_time, 1394 .data = &lease_break_time,
1395 .maxlen = sizeof(int), 1395 .maxlen = sizeof(int),
1396 .mode = 0644, 1396 .mode = 0644,
1397 .proc_handler = proc_dointvec, 1397 .proc_handler = proc_dointvec,
1398 }, 1398 },
1399 #endif 1399 #endif
1400 #ifdef CONFIG_AIO 1400 #ifdef CONFIG_AIO
1401 { 1401 {
1402 .procname = "aio-nr", 1402 .procname = "aio-nr",
1403 .data = &aio_nr, 1403 .data = &aio_nr,
1404 .maxlen = sizeof(aio_nr), 1404 .maxlen = sizeof(aio_nr),
1405 .mode = 0444, 1405 .mode = 0444,
1406 .proc_handler = proc_doulongvec_minmax, 1406 .proc_handler = proc_doulongvec_minmax,
1407 }, 1407 },
1408 { 1408 {
1409 .procname = "aio-max-nr", 1409 .procname = "aio-max-nr",
1410 .data = &aio_max_nr, 1410 .data = &aio_max_nr,
1411 .maxlen = sizeof(aio_max_nr), 1411 .maxlen = sizeof(aio_max_nr),
1412 .mode = 0644, 1412 .mode = 0644,
1413 .proc_handler = proc_doulongvec_minmax, 1413 .proc_handler = proc_doulongvec_minmax,
1414 }, 1414 },
1415 #endif /* CONFIG_AIO */ 1415 #endif /* CONFIG_AIO */
1416 #ifdef CONFIG_INOTIFY_USER 1416 #ifdef CONFIG_INOTIFY_USER
1417 { 1417 {
1418 .procname = "inotify", 1418 .procname = "inotify",
1419 .mode = 0555, 1419 .mode = 0555,
1420 .child = inotify_table, 1420 .child = inotify_table,
1421 }, 1421 },
1422 #endif 1422 #endif
1423 #ifdef CONFIG_EPOLL 1423 #ifdef CONFIG_EPOLL
1424 { 1424 {
1425 .procname = "epoll", 1425 .procname = "epoll",
1426 .mode = 0555, 1426 .mode = 0555,
1427 .child = epoll_table, 1427 .child = epoll_table,
1428 }, 1428 },
1429 #endif 1429 #endif
1430 #endif 1430 #endif
1431 { 1431 {
1432 .procname = "suid_dumpable", 1432 .procname = "suid_dumpable",
1433 .data = &suid_dumpable, 1433 .data = &suid_dumpable,
1434 .maxlen = sizeof(int), 1434 .maxlen = sizeof(int),
1435 .mode = 0644, 1435 .mode = 0644,
1436 .proc_handler = proc_dointvec_minmax, 1436 .proc_handler = proc_dointvec_minmax,
1437 .extra1 = &zero, 1437 .extra1 = &zero,
1438 .extra2 = &two, 1438 .extra2 = &two,
1439 }, 1439 },
1440 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) 1440 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1441 { 1441 {
1442 .procname = "binfmt_misc", 1442 .procname = "binfmt_misc",
1443 .mode = 0555, 1443 .mode = 0555,
1444 .child = binfmt_misc_table, 1444 .child = binfmt_misc_table,
1445 }, 1445 },
1446 #endif 1446 #endif
1447 /* 1447 /*
1448 * NOTE: do not add new entries to this table unless you have read 1448 * NOTE: do not add new entries to this table unless you have read
1449 * Documentation/sysctl/ctl_unnumbered.txt 1449 * Documentation/sysctl/ctl_unnumbered.txt
1450 */ 1450 */
1451 { } 1451 { }
1452 }; 1452 };
1453 1453
1454 static struct ctl_table debug_table[] = { 1454 static struct ctl_table debug_table[] = {
1455 #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \ 1455 #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
1456 defined(CONFIG_S390) 1456 defined(CONFIG_S390)
1457 { 1457 {
1458 .procname = "exception-trace", 1458 .procname = "exception-trace",
1459 .data = &show_unhandled_signals, 1459 .data = &show_unhandled_signals,
1460 .maxlen = sizeof(int), 1460 .maxlen = sizeof(int),
1461 .mode = 0644, 1461 .mode = 0644,
1462 .proc_handler = proc_dointvec 1462 .proc_handler = proc_dointvec
1463 }, 1463 },
1464 #endif 1464 #endif
1465 #if defined(CONFIG_OPTPROBES) 1465 #if defined(CONFIG_OPTPROBES)
1466 { 1466 {
1467 .procname = "kprobes-optimization", 1467 .procname = "kprobes-optimization",
1468 .data = &sysctl_kprobes_optimization, 1468 .data = &sysctl_kprobes_optimization,
1469 .maxlen = sizeof(int), 1469 .maxlen = sizeof(int),
1470 .mode = 0644, 1470 .mode = 0644,
1471 .proc_handler = proc_kprobes_optimization_handler, 1471 .proc_handler = proc_kprobes_optimization_handler,
1472 .extra1 = &zero, 1472 .extra1 = &zero,
1473 .extra2 = &one, 1473 .extra2 = &one,
1474 }, 1474 },
1475 #endif 1475 #endif
1476 { } 1476 { }
1477 }; 1477 };
1478 1478
1479 static struct ctl_table dev_table[] = { 1479 static struct ctl_table dev_table[] = {
1480 { } 1480 { }
1481 }; 1481 };
1482 1482
1483 static DEFINE_SPINLOCK(sysctl_lock); 1483 static DEFINE_SPINLOCK(sysctl_lock);
1484 1484
1485 /* called under sysctl_lock */ 1485 /* called under sysctl_lock */
1486 static int use_table(struct ctl_table_header *p) 1486 static int use_table(struct ctl_table_header *p)
1487 { 1487 {
1488 if (unlikely(p->unregistering)) 1488 if (unlikely(p->unregistering))
1489 return 0; 1489 return 0;
1490 p->used++; 1490 p->used++;
1491 return 1; 1491 return 1;
1492 } 1492 }
1493 1493
1494 /* called under sysctl_lock */ 1494 /* called under sysctl_lock */
1495 static void unuse_table(struct ctl_table_header *p) 1495 static void unuse_table(struct ctl_table_header *p)
1496 { 1496 {
1497 if (!--p->used) 1497 if (!--p->used)
1498 if (unlikely(p->unregistering)) 1498 if (unlikely(p->unregistering))
1499 complete(p->unregistering); 1499 complete(p->unregistering);
1500 } 1500 }
1501 1501
1502 /* called under sysctl_lock, will reacquire if has to wait */ 1502 /* called under sysctl_lock, will reacquire if has to wait */
1503 static void start_unregistering(struct ctl_table_header *p) 1503 static void start_unregistering(struct ctl_table_header *p)
1504 { 1504 {
1505 /* 1505 /*
1506 * if p->used is 0, nobody will ever touch that entry again; 1506 * if p->used is 0, nobody will ever touch that entry again;
1507 * we'll eliminate all paths to it before dropping sysctl_lock 1507 * we'll eliminate all paths to it before dropping sysctl_lock
1508 */ 1508 */
1509 if (unlikely(p->used)) { 1509 if (unlikely(p->used)) {
1510 struct completion wait; 1510 struct completion wait;
1511 init_completion(&wait); 1511 init_completion(&wait);
1512 p->unregistering = &wait; 1512 p->unregistering = &wait;
1513 spin_unlock(&sysctl_lock); 1513 spin_unlock(&sysctl_lock);
1514 wait_for_completion(&wait); 1514 wait_for_completion(&wait);
1515 spin_lock(&sysctl_lock); 1515 spin_lock(&sysctl_lock);
1516 } else { 1516 } else {
1517 /* anything non-NULL; we'll never dereference it */ 1517 /* anything non-NULL; we'll never dereference it */
1518 p->unregistering = ERR_PTR(-EINVAL); 1518 p->unregistering = ERR_PTR(-EINVAL);
1519 } 1519 }
1520 /* 1520 /*
1521 * do not remove from the list until nobody holds it; walking the 1521 * do not remove from the list until nobody holds it; walking the
1522 * list in do_sysctl() relies on that. 1522 * list in do_sysctl() relies on that.
1523 */ 1523 */
1524 list_del_init(&p->ctl_entry); 1524 list_del_init(&p->ctl_entry);
1525 } 1525 }
1526 1526
1527 void sysctl_head_get(struct ctl_table_header *head) 1527 void sysctl_head_get(struct ctl_table_header *head)
1528 { 1528 {
1529 spin_lock(&sysctl_lock); 1529 spin_lock(&sysctl_lock);
1530 head->count++; 1530 head->count++;
1531 spin_unlock(&sysctl_lock); 1531 spin_unlock(&sysctl_lock);
1532 } 1532 }
1533 1533
1534 void sysctl_head_put(struct ctl_table_header *head) 1534 void sysctl_head_put(struct ctl_table_header *head)
1535 { 1535 {
1536 spin_lock(&sysctl_lock); 1536 spin_lock(&sysctl_lock);
1537 if (!--head->count) 1537 if (!--head->count)
1538 kfree(head); 1538 kfree(head);
1539 spin_unlock(&sysctl_lock); 1539 spin_unlock(&sysctl_lock);
1540 } 1540 }
1541 1541
1542 struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head) 1542 struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head)
1543 { 1543 {
1544 if (!head) 1544 if (!head)
1545 BUG(); 1545 BUG();
1546 spin_lock(&sysctl_lock); 1546 spin_lock(&sysctl_lock);
1547 if (!use_table(head)) 1547 if (!use_table(head))
1548 head = ERR_PTR(-ENOENT); 1548 head = ERR_PTR(-ENOENT);
1549 spin_unlock(&sysctl_lock); 1549 spin_unlock(&sysctl_lock);
1550 return head; 1550 return head;
1551 } 1551 }
1552 1552
1553 void sysctl_head_finish(struct ctl_table_header *head) 1553 void sysctl_head_finish(struct ctl_table_header *head)
1554 { 1554 {
1555 if (!head) 1555 if (!head)
1556 return; 1556 return;
1557 spin_lock(&sysctl_lock); 1557 spin_lock(&sysctl_lock);
1558 unuse_table(head); 1558 unuse_table(head);
1559 spin_unlock(&sysctl_lock); 1559 spin_unlock(&sysctl_lock);
1560 } 1560 }
1561 1561
1562 static struct ctl_table_set * 1562 static struct ctl_table_set *
1563 lookup_header_set(struct ctl_table_root *root, struct nsproxy *namespaces) 1563 lookup_header_set(struct ctl_table_root *root, struct nsproxy *namespaces)
1564 { 1564 {
1565 struct ctl_table_set *set = &root->default_set; 1565 struct ctl_table_set *set = &root->default_set;
1566 if (root->lookup) 1566 if (root->lookup)
1567 set = root->lookup(root, namespaces); 1567 set = root->lookup(root, namespaces);
1568 return set; 1568 return set;
1569 } 1569 }
1570 1570
1571 static struct list_head * 1571 static struct list_head *
1572 lookup_header_list(struct ctl_table_root *root, struct nsproxy *namespaces) 1572 lookup_header_list(struct ctl_table_root *root, struct nsproxy *namespaces)
1573 { 1573 {
1574 struct ctl_table_set *set = lookup_header_set(root, namespaces); 1574 struct ctl_table_set *set = lookup_header_set(root, namespaces);
1575 return &set->list; 1575 return &set->list;
1576 } 1576 }
1577 1577
1578 struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces, 1578 struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
1579 struct ctl_table_header *prev) 1579 struct ctl_table_header *prev)
1580 { 1580 {
1581 struct ctl_table_root *root; 1581 struct ctl_table_root *root;
1582 struct list_head *header_list; 1582 struct list_head *header_list;
1583 struct ctl_table_header *head; 1583 struct ctl_table_header *head;
1584 struct list_head *tmp; 1584 struct list_head *tmp;
1585 1585
1586 spin_lock(&sysctl_lock); 1586 spin_lock(&sysctl_lock);
1587 if (prev) { 1587 if (prev) {
1588 head = prev; 1588 head = prev;
1589 tmp = &prev->ctl_entry; 1589 tmp = &prev->ctl_entry;
1590 unuse_table(prev); 1590 unuse_table(prev);
1591 goto next; 1591 goto next;
1592 } 1592 }
1593 tmp = &root_table_header.ctl_entry; 1593 tmp = &root_table_header.ctl_entry;
1594 for (;;) { 1594 for (;;) {
1595 head = list_entry(tmp, struct ctl_table_header, ctl_entry); 1595 head = list_entry(tmp, struct ctl_table_header, ctl_entry);
1596 1596
1597 if (!use_table(head)) 1597 if (!use_table(head))
1598 goto next; 1598 goto next;
1599 spin_unlock(&sysctl_lock); 1599 spin_unlock(&sysctl_lock);
1600 return head; 1600 return head;
1601 next: 1601 next:
1602 root = head->root; 1602 root = head->root;
1603 tmp = tmp->next; 1603 tmp = tmp->next;
1604 header_list = lookup_header_list(root, namespaces); 1604 header_list = lookup_header_list(root, namespaces);
1605 if (tmp != header_list) 1605 if (tmp != header_list)
1606 continue; 1606 continue;
1607 1607
1608 do { 1608 do {
1609 root = list_entry(root->root_list.next, 1609 root = list_entry(root->root_list.next,
1610 struct ctl_table_root, root_list); 1610 struct ctl_table_root, root_list);
1611 if (root == &sysctl_table_root) 1611 if (root == &sysctl_table_root)
1612 goto out; 1612 goto out;
1613 header_list = lookup_header_list(root, namespaces); 1613 header_list = lookup_header_list(root, namespaces);
1614 } while (list_empty(header_list)); 1614 } while (list_empty(header_list));
1615 tmp = header_list->next; 1615 tmp = header_list->next;
1616 } 1616 }
1617 out: 1617 out:
1618 spin_unlock(&sysctl_lock); 1618 spin_unlock(&sysctl_lock);
1619 return NULL; 1619 return NULL;
1620 } 1620 }
1621 1621
1622 struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev) 1622 struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
1623 { 1623 {
1624 return __sysctl_head_next(current->nsproxy, prev); 1624 return __sysctl_head_next(current->nsproxy, prev);
1625 } 1625 }
1626 1626
1627 void register_sysctl_root(struct ctl_table_root *root) 1627 void register_sysctl_root(struct ctl_table_root *root)
1628 { 1628 {
1629 spin_lock(&sysctl_lock); 1629 spin_lock(&sysctl_lock);
1630 list_add_tail(&root->root_list, &sysctl_table_root.root_list); 1630 list_add_tail(&root->root_list, &sysctl_table_root.root_list);
1631 spin_unlock(&sysctl_lock); 1631 spin_unlock(&sysctl_lock);
1632 } 1632 }
1633 1633
1634 /* 1634 /*
1635 * sysctl_perm does NOT grant the superuser all rights automatically, because 1635 * sysctl_perm does NOT grant the superuser all rights automatically, because
1636 * some sysctl variables are readonly even to root. 1636 * some sysctl variables are readonly even to root.
1637 */ 1637 */
1638 1638
1639 static int test_perm(int mode, int op) 1639 static int test_perm(int mode, int op)
1640 { 1640 {
1641 if (!current_euid()) 1641 if (!current_euid())
1642 mode >>= 6; 1642 mode >>= 6;
1643 else if (in_egroup_p(0)) 1643 else if (in_egroup_p(0))
1644 mode >>= 3; 1644 mode >>= 3;
1645 if ((op & ~mode & (MAY_READ|MAY_WRITE|MAY_EXEC)) == 0) 1645 if ((op & ~mode & (MAY_READ|MAY_WRITE|MAY_EXEC)) == 0)
1646 return 0; 1646 return 0;
1647 return -EACCES; 1647 return -EACCES;
1648 } 1648 }
1649 1649
1650 int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op) 1650 int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
1651 { 1651 {
1652 int error; 1652 int error;
1653 int mode; 1653 int mode;
1654 1654
1655 error = security_sysctl(table, op & (MAY_READ | MAY_WRITE | MAY_EXEC)); 1655 error = security_sysctl(table, op & (MAY_READ | MAY_WRITE | MAY_EXEC));
1656 if (error) 1656 if (error)
1657 return error; 1657 return error;
1658 1658
1659 if (root->permissions) 1659 if (root->permissions)
1660 mode = root->permissions(root, current->nsproxy, table); 1660 mode = root->permissions(root, current->nsproxy, table);
1661 else 1661 else
1662 mode = table->mode; 1662 mode = table->mode;
1663 1663
1664 return test_perm(mode, op); 1664 return test_perm(mode, op);
1665 } 1665 }
1666 1666
1667 static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table) 1667 static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1668 { 1668 {
1669 for (; table->procname; table++) { 1669 for (; table->procname; table++) {
1670 table->parent = parent; 1670 table->parent = parent;
1671 if (table->child) 1671 if (table->child)
1672 sysctl_set_parent(table, table->child); 1672 sysctl_set_parent(table, table->child);
1673 } 1673 }
1674 } 1674 }
1675 1675
1676 static __init int sysctl_init(void) 1676 static __init int sysctl_init(void)
1677 { 1677 {
1678 sysctl_set_parent(NULL, root_table); 1678 sysctl_set_parent(NULL, root_table);
1679 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK 1679 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1680 { 1680 {
1681 int err; 1681 int err;
1682 err = sysctl_check_table(current->nsproxy, root_table); 1682 err = sysctl_check_table(current->nsproxy, root_table);
1683 } 1683 }
1684 #endif 1684 #endif
1685 return 0; 1685 return 0;
1686 } 1686 }
1687 1687
1688 core_initcall(sysctl_init); 1688 core_initcall(sysctl_init);
1689 1689
1690 static struct ctl_table *is_branch_in(struct ctl_table *branch, 1690 static struct ctl_table *is_branch_in(struct ctl_table *branch,
1691 struct ctl_table *table) 1691 struct ctl_table *table)
1692 { 1692 {
1693 struct ctl_table *p; 1693 struct ctl_table *p;
1694 const char *s = branch->procname; 1694 const char *s = branch->procname;
1695 1695
1696 /* branch should have named subdirectory as its first element */ 1696 /* branch should have named subdirectory as its first element */
1697 if (!s || !branch->child) 1697 if (!s || !branch->child)
1698 return NULL; 1698 return NULL;
1699 1699
1700 /* ... and nothing else */ 1700 /* ... and nothing else */
1701 if (branch[1].procname) 1701 if (branch[1].procname)
1702 return NULL; 1702 return NULL;
1703 1703
1704 /* table should contain subdirectory with the same name */ 1704 /* table should contain subdirectory with the same name */
1705 for (p = table; p->procname; p++) { 1705 for (p = table; p->procname; p++) {
1706 if (!p->child) 1706 if (!p->child)
1707 continue; 1707 continue;
1708 if (p->procname && strcmp(p->procname, s) == 0) 1708 if (p->procname && strcmp(p->procname, s) == 0)
1709 return p; 1709 return p;
1710 } 1710 }
1711 return NULL; 1711 return NULL;
1712 } 1712 }
1713 1713
1714 /* see if attaching q to p would be an improvement */ 1714 /* see if attaching q to p would be an improvement */
1715 static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q) 1715 static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
1716 { 1716 {
1717 struct ctl_table *to = p->ctl_table, *by = q->ctl_table; 1717 struct ctl_table *to = p->ctl_table, *by = q->ctl_table;
1718 struct ctl_table *next; 1718 struct ctl_table *next;
1719 int is_better = 0; 1719 int is_better = 0;
1720 int not_in_parent = !p->attached_by; 1720 int not_in_parent = !p->attached_by;
1721 1721
1722 while ((next = is_branch_in(by, to)) != NULL) { 1722 while ((next = is_branch_in(by, to)) != NULL) {
1723 if (by == q->attached_by) 1723 if (by == q->attached_by)
1724 is_better = 1; 1724 is_better = 1;
1725 if (to == p->attached_by) 1725 if (to == p->attached_by)
1726 not_in_parent = 1; 1726 not_in_parent = 1;
1727 by = by->child; 1727 by = by->child;
1728 to = next->child; 1728 to = next->child;
1729 } 1729 }
1730 1730
1731 if (is_better && not_in_parent) { 1731 if (is_better && not_in_parent) {
1732 q->attached_by = by; 1732 q->attached_by = by;
1733 q->attached_to = to; 1733 q->attached_to = to;
1734 q->parent = p; 1734 q->parent = p;
1735 } 1735 }
1736 } 1736 }
1737 1737
1738 /** 1738 /**
1739 * __register_sysctl_paths - register a sysctl hierarchy 1739 * __register_sysctl_paths - register a sysctl hierarchy
1740 * @root: List of sysctl headers to register on 1740 * @root: List of sysctl headers to register on
1741 * @namespaces: Data to compute which lists of sysctl entries are visible 1741 * @namespaces: Data to compute which lists of sysctl entries are visible
1742 * @path: The path to the directory the sysctl table is in. 1742 * @path: The path to the directory the sysctl table is in.
1743 * @table: the top-level table structure 1743 * @table: the top-level table structure
1744 * 1744 *
1745 * Register a sysctl table hierarchy. @table should be a filled in ctl_table 1745 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1746 * array. A completely 0 filled entry terminates the table. 1746 * array. A completely 0 filled entry terminates the table.
1747 * 1747 *
1748 * The members of the &struct ctl_table structure are used as follows: 1748 * The members of the &struct ctl_table structure are used as follows:
1749 * 1749 *
1750 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not 1750 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1751 * enter a sysctl file 1751 * enter a sysctl file
1752 * 1752 *
1753 * data - a pointer to data for use by proc_handler 1753 * data - a pointer to data for use by proc_handler
1754 * 1754 *
1755 * maxlen - the maximum size in bytes of the data 1755 * maxlen - the maximum size in bytes of the data
1756 * 1756 *
1757 * mode - the file permissions for the /proc/sys file, and for sysctl(2) 1757 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1758 * 1758 *
1759 * child - a pointer to the child sysctl table if this entry is a directory, or 1759 * child - a pointer to the child sysctl table if this entry is a directory, or
1760 * %NULL. 1760 * %NULL.
1761 * 1761 *
1762 * proc_handler - the text handler routine (described below) 1762 * proc_handler - the text handler routine (described below)
1763 * 1763 *
1764 * de - for internal use by the sysctl routines 1764 * de - for internal use by the sysctl routines
1765 * 1765 *
1766 * extra1, extra2 - extra pointers usable by the proc handler routines 1766 * extra1, extra2 - extra pointers usable by the proc handler routines
1767 * 1767 *
1768 * Leaf nodes in the sysctl tree will be represented by a single file 1768 * Leaf nodes in the sysctl tree will be represented by a single file
1769 * under /proc; non-leaf nodes will be represented by directories. 1769 * under /proc; non-leaf nodes will be represented by directories.
1770 * 1770 *
1771 * sysctl(2) can automatically manage read and write requests through 1771 * sysctl(2) can automatically manage read and write requests through
1772 * the sysctl table. The data and maxlen fields of the ctl_table 1772 * the sysctl table. The data and maxlen fields of the ctl_table
1773 * struct enable minimal validation of the values being written to be 1773 * struct enable minimal validation of the values being written to be
1774 * performed, and the mode field allows minimal authentication. 1774 * performed, and the mode field allows minimal authentication.
1775 * 1775 *
1776 * There must be a proc_handler routine for any terminal nodes 1776 * There must be a proc_handler routine for any terminal nodes
1777 * mirrored under /proc/sys (non-terminals are handled by a built-in 1777 * mirrored under /proc/sys (non-terminals are handled by a built-in
1778 * directory handler). Several default handlers are available to 1778 * directory handler). Several default handlers are available to
1779 * cover common cases - 1779 * cover common cases -
1780 * 1780 *
1781 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(), 1781 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1782 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(), 1782 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1783 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax() 1783 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1784 * 1784 *
1785 * It is the handler's job to read the input buffer from user memory 1785 * It is the handler's job to read the input buffer from user memory
1786 * and process it. The handler should return 0 on success. 1786 * and process it. The handler should return 0 on success.
1787 * 1787 *
1788 * This routine returns %NULL on a failure to register, and a pointer 1788 * This routine returns %NULL on a failure to register, and a pointer
1789 * to the table header on success. 1789 * to the table header on success.
1790 */ 1790 */
1791 struct ctl_table_header *__register_sysctl_paths( 1791 struct ctl_table_header *__register_sysctl_paths(
1792 struct ctl_table_root *root, 1792 struct ctl_table_root *root,
1793 struct nsproxy *namespaces, 1793 struct nsproxy *namespaces,
1794 const struct ctl_path *path, struct ctl_table *table) 1794 const struct ctl_path *path, struct ctl_table *table)
1795 { 1795 {
1796 struct ctl_table_header *header; 1796 struct ctl_table_header *header;
1797 struct ctl_table *new, **prevp; 1797 struct ctl_table *new, **prevp;
1798 unsigned int n, npath; 1798 unsigned int n, npath;
1799 struct ctl_table_set *set; 1799 struct ctl_table_set *set;
1800 1800
1801 /* Count the path components */ 1801 /* Count the path components */
1802 for (npath = 0; path[npath].procname; ++npath) 1802 for (npath = 0; path[npath].procname; ++npath)
1803 ; 1803 ;
1804 1804
1805 /* 1805 /*
1806 * For each path component, allocate a 2-element ctl_table array. 1806 * For each path component, allocate a 2-element ctl_table array.
1807 * The first array element will be filled with the sysctl entry 1807 * The first array element will be filled with the sysctl entry
1808 * for this, the second will be the sentinel (procname == 0). 1808 * for this, the second will be the sentinel (procname == 0).
1809 * 1809 *
1810 * We allocate everything in one go so that we don't have to 1810 * We allocate everything in one go so that we don't have to
1811 * worry about freeing additional memory in unregister_sysctl_table. 1811 * worry about freeing additional memory in unregister_sysctl_table.
1812 */ 1812 */
1813 header = kzalloc(sizeof(struct ctl_table_header) + 1813 header = kzalloc(sizeof(struct ctl_table_header) +
1814 (2 * npath * sizeof(struct ctl_table)), GFP_KERNEL); 1814 (2 * npath * sizeof(struct ctl_table)), GFP_KERNEL);
1815 if (!header) 1815 if (!header)
1816 return NULL; 1816 return NULL;
1817 1817
1818 new = (struct ctl_table *) (header + 1); 1818 new = (struct ctl_table *) (header + 1);
1819 1819
1820 /* Now connect the dots */ 1820 /* Now connect the dots */
1821 prevp = &header->ctl_table; 1821 prevp = &header->ctl_table;
1822 for (n = 0; n < npath; ++n, ++path) { 1822 for (n = 0; n < npath; ++n, ++path) {
1823 /* Copy the procname */ 1823 /* Copy the procname */
1824 new->procname = path->procname; 1824 new->procname = path->procname;
1825 new->mode = 0555; 1825 new->mode = 0555;
1826 1826
1827 *prevp = new; 1827 *prevp = new;
1828 prevp = &new->child; 1828 prevp = &new->child;
1829 1829
1830 new += 2; 1830 new += 2;
1831 } 1831 }
1832 *prevp = table; 1832 *prevp = table;
1833 header->ctl_table_arg = table; 1833 header->ctl_table_arg = table;
1834 1834
1835 INIT_LIST_HEAD(&header->ctl_entry); 1835 INIT_LIST_HEAD(&header->ctl_entry);
1836 header->used = 0; 1836 header->used = 0;
1837 header->unregistering = NULL; 1837 header->unregistering = NULL;
1838 header->root = root; 1838 header->root = root;
1839 sysctl_set_parent(NULL, header->ctl_table); 1839 sysctl_set_parent(NULL, header->ctl_table);
1840 header->count = 1; 1840 header->count = 1;
1841 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK 1841 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1842 if (sysctl_check_table(namespaces, header->ctl_table)) { 1842 if (sysctl_check_table(namespaces, header->ctl_table)) {
1843 kfree(header); 1843 kfree(header);
1844 return NULL; 1844 return NULL;
1845 } 1845 }
1846 #endif 1846 #endif
1847 spin_lock(&sysctl_lock); 1847 spin_lock(&sysctl_lock);
1848 header->set = lookup_header_set(root, namespaces); 1848 header->set = lookup_header_set(root, namespaces);
1849 header->attached_by = header->ctl_table; 1849 header->attached_by = header->ctl_table;
1850 header->attached_to = root_table; 1850 header->attached_to = root_table;
1851 header->parent = &root_table_header; 1851 header->parent = &root_table_header;
1852 for (set = header->set; set; set = set->parent) { 1852 for (set = header->set; set; set = set->parent) {
1853 struct ctl_table_header *p; 1853 struct ctl_table_header *p;
1854 list_for_each_entry(p, &set->list, ctl_entry) { 1854 list_for_each_entry(p, &set->list, ctl_entry) {
1855 if (p->unregistering) 1855 if (p->unregistering)
1856 continue; 1856 continue;
1857 try_attach(p, header); 1857 try_attach(p, header);
1858 } 1858 }
1859 } 1859 }
1860 header->parent->count++; 1860 header->parent->count++;
1861 list_add_tail(&header->ctl_entry, &header->set->list); 1861 list_add_tail(&header->ctl_entry, &header->set->list);
1862 spin_unlock(&sysctl_lock); 1862 spin_unlock(&sysctl_lock);
1863 1863
1864 return header; 1864 return header;
1865 } 1865 }
1866 1866
1867 /** 1867 /**
1868 * register_sysctl_table_path - register a sysctl table hierarchy 1868 * register_sysctl_table_path - register a sysctl table hierarchy
1869 * @path: The path to the directory the sysctl table is in. 1869 * @path: The path to the directory the sysctl table is in.
1870 * @table: the top-level table structure 1870 * @table: the top-level table structure
1871 * 1871 *
1872 * Register a sysctl table hierarchy. @table should be a filled in ctl_table 1872 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1873 * array. A completely 0 filled entry terminates the table. 1873 * array. A completely 0 filled entry terminates the table.
1874 * 1874 *
1875 * See __register_sysctl_paths for more details. 1875 * See __register_sysctl_paths for more details.
1876 */ 1876 */
1877 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, 1877 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1878 struct ctl_table *table) 1878 struct ctl_table *table)
1879 { 1879 {
1880 return __register_sysctl_paths(&sysctl_table_root, current->nsproxy, 1880 return __register_sysctl_paths(&sysctl_table_root, current->nsproxy,
1881 path, table); 1881 path, table);
1882 } 1882 }
1883 1883
1884 /** 1884 /**
1885 * register_sysctl_table - register a sysctl table hierarchy 1885 * register_sysctl_table - register a sysctl table hierarchy
1886 * @table: the top-level table structure 1886 * @table: the top-level table structure
1887 * 1887 *
1888 * Register a sysctl table hierarchy. @table should be a filled in ctl_table 1888 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1889 * array. A completely 0 filled entry terminates the table. 1889 * array. A completely 0 filled entry terminates the table.
1890 * 1890 *
1891 * See register_sysctl_paths for more details. 1891 * See register_sysctl_paths for more details.
1892 */ 1892 */
1893 struct ctl_table_header *register_sysctl_table(struct ctl_table *table) 1893 struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
1894 { 1894 {
1895 static const struct ctl_path null_path[] = { {} }; 1895 static const struct ctl_path null_path[] = { {} };
1896 1896
1897 return register_sysctl_paths(null_path, table); 1897 return register_sysctl_paths(null_path, table);
1898 } 1898 }
1899 1899
1900 /** 1900 /**
1901 * unregister_sysctl_table - unregister a sysctl table hierarchy 1901 * unregister_sysctl_table - unregister a sysctl table hierarchy
1902 * @header: the header returned from register_sysctl_table 1902 * @header: the header returned from register_sysctl_table
1903 * 1903 *
1904 * Unregisters the sysctl table and all children. proc entries may not 1904 * Unregisters the sysctl table and all children. proc entries may not
1905 * actually be removed until they are no longer used by anyone. 1905 * actually be removed until they are no longer used by anyone.
1906 */ 1906 */
1907 void unregister_sysctl_table(struct ctl_table_header * header) 1907 void unregister_sysctl_table(struct ctl_table_header * header)
1908 { 1908 {
1909 might_sleep(); 1909 might_sleep();
1910 1910
1911 if (header == NULL) 1911 if (header == NULL)
1912 return; 1912 return;
1913 1913
1914 spin_lock(&sysctl_lock); 1914 spin_lock(&sysctl_lock);
1915 start_unregistering(header); 1915 start_unregistering(header);
1916 if (!--header->parent->count) { 1916 if (!--header->parent->count) {
1917 WARN_ON(1); 1917 WARN_ON(1);
1918 kfree(header->parent); 1918 kfree(header->parent);
1919 } 1919 }
1920 if (!--header->count) 1920 if (!--header->count)
1921 kfree(header); 1921 kfree(header);
1922 spin_unlock(&sysctl_lock); 1922 spin_unlock(&sysctl_lock);
1923 } 1923 }
1924 1924
1925 int sysctl_is_seen(struct ctl_table_header *p) 1925 int sysctl_is_seen(struct ctl_table_header *p)
1926 { 1926 {
1927 struct ctl_table_set *set = p->set; 1927 struct ctl_table_set *set = p->set;
1928 int res; 1928 int res;
1929 spin_lock(&sysctl_lock); 1929 spin_lock(&sysctl_lock);
1930 if (p->unregistering) 1930 if (p->unregistering)
1931 res = 0; 1931 res = 0;
1932 else if (!set->is_seen) 1932 else if (!set->is_seen)
1933 res = 1; 1933 res = 1;
1934 else 1934 else
1935 res = set->is_seen(set); 1935 res = set->is_seen(set);
1936 spin_unlock(&sysctl_lock); 1936 spin_unlock(&sysctl_lock);
1937 return res; 1937 return res;
1938 } 1938 }
1939 1939
1940 void setup_sysctl_set(struct ctl_table_set *p, 1940 void setup_sysctl_set(struct ctl_table_set *p,
1941 struct ctl_table_set *parent, 1941 struct ctl_table_set *parent,
1942 int (*is_seen)(struct ctl_table_set *)) 1942 int (*is_seen)(struct ctl_table_set *))
1943 { 1943 {
1944 INIT_LIST_HEAD(&p->list); 1944 INIT_LIST_HEAD(&p->list);
1945 p->parent = parent ? parent : &sysctl_table_root.default_set; 1945 p->parent = parent ? parent : &sysctl_table_root.default_set;
1946 p->is_seen = is_seen; 1946 p->is_seen = is_seen;
1947 } 1947 }
1948 1948
1949 #else /* !CONFIG_SYSCTL */ 1949 #else /* !CONFIG_SYSCTL */
1950 struct ctl_table_header *register_sysctl_table(struct ctl_table * table) 1950 struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
1951 { 1951 {
1952 return NULL; 1952 return NULL;
1953 } 1953 }
1954 1954
1955 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, 1955 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1956 struct ctl_table *table) 1956 struct ctl_table *table)
1957 { 1957 {
1958 return NULL; 1958 return NULL;
1959 } 1959 }
1960 1960
1961 void unregister_sysctl_table(struct ctl_table_header * table) 1961 void unregister_sysctl_table(struct ctl_table_header * table)
1962 { 1962 {
1963 } 1963 }
1964 1964
1965 void setup_sysctl_set(struct ctl_table_set *p, 1965 void setup_sysctl_set(struct ctl_table_set *p,
1966 struct ctl_table_set *parent, 1966 struct ctl_table_set *parent,
1967 int (*is_seen)(struct ctl_table_set *)) 1967 int (*is_seen)(struct ctl_table_set *))
1968 { 1968 {
1969 } 1969 }
1970 1970
1971 void sysctl_head_put(struct ctl_table_header *head) 1971 void sysctl_head_put(struct ctl_table_header *head)
1972 { 1972 {
1973 } 1973 }
1974 1974
1975 #endif /* CONFIG_SYSCTL */ 1975 #endif /* CONFIG_SYSCTL */
1976 1976
1977 /* 1977 /*
1978 * /proc/sys support 1978 * /proc/sys support
1979 */ 1979 */
1980 1980
1981 #ifdef CONFIG_PROC_SYSCTL 1981 #ifdef CONFIG_PROC_SYSCTL
1982 1982
1983 static int _proc_do_string(void* data, int maxlen, int write, 1983 static int _proc_do_string(void* data, int maxlen, int write,
1984 void __user *buffer, 1984 void __user *buffer,
1985 size_t *lenp, loff_t *ppos) 1985 size_t *lenp, loff_t *ppos)
1986 { 1986 {
1987 size_t len; 1987 size_t len;
1988 char __user *p; 1988 char __user *p;
1989 char c; 1989 char c;
1990 1990
1991 if (!data || !maxlen || !*lenp) { 1991 if (!data || !maxlen || !*lenp) {
1992 *lenp = 0; 1992 *lenp = 0;
1993 return 0; 1993 return 0;
1994 } 1994 }
1995 1995
1996 if (write) { 1996 if (write) {
1997 len = 0; 1997 len = 0;
1998 p = buffer; 1998 p = buffer;
1999 while (len < *lenp) { 1999 while (len < *lenp) {
2000 if (get_user(c, p++)) 2000 if (get_user(c, p++))
2001 return -EFAULT; 2001 return -EFAULT;
2002 if (c == 0 || c == '\n') 2002 if (c == 0 || c == '\n')
2003 break; 2003 break;
2004 len++; 2004 len++;
2005 } 2005 }
2006 if (len >= maxlen) 2006 if (len >= maxlen)
2007 len = maxlen-1; 2007 len = maxlen-1;
2008 if(copy_from_user(data, buffer, len)) 2008 if(copy_from_user(data, buffer, len))
2009 return -EFAULT; 2009 return -EFAULT;
2010 ((char *) data)[len] = 0; 2010 ((char *) data)[len] = 0;
2011 *ppos += *lenp; 2011 *ppos += *lenp;
2012 } else { 2012 } else {
2013 len = strlen(data); 2013 len = strlen(data);
2014 if (len > maxlen) 2014 if (len > maxlen)
2015 len = maxlen; 2015 len = maxlen;
2016 2016
2017 if (*ppos > len) { 2017 if (*ppos > len) {
2018 *lenp = 0; 2018 *lenp = 0;
2019 return 0; 2019 return 0;
2020 } 2020 }
2021 2021
2022 data += *ppos; 2022 data += *ppos;
2023 len -= *ppos; 2023 len -= *ppos;
2024 2024
2025 if (len > *lenp) 2025 if (len > *lenp)
2026 len = *lenp; 2026 len = *lenp;
2027 if (len) 2027 if (len)
2028 if(copy_to_user(buffer, data, len)) 2028 if(copy_to_user(buffer, data, len))
2029 return -EFAULT; 2029 return -EFAULT;
2030 if (len < *lenp) { 2030 if (len < *lenp) {
2031 if(put_user('\n', ((char __user *) buffer) + len)) 2031 if(put_user('\n', ((char __user *) buffer) + len))
2032 return -EFAULT; 2032 return -EFAULT;
2033 len++; 2033 len++;
2034 } 2034 }
2035 *lenp = len; 2035 *lenp = len;
2036 *ppos += len; 2036 *ppos += len;
2037 } 2037 }
2038 return 0; 2038 return 0;
2039 } 2039 }
2040 2040
2041 /** 2041 /**
2042 * proc_dostring - read a string sysctl 2042 * proc_dostring - read a string sysctl
2043 * @table: the sysctl table 2043 * @table: the sysctl table
2044 * @write: %TRUE if this is a write to the sysctl file 2044 * @write: %TRUE if this is a write to the sysctl file
2045 * @buffer: the user buffer 2045 * @buffer: the user buffer
2046 * @lenp: the size of the user buffer 2046 * @lenp: the size of the user buffer
2047 * @ppos: file position 2047 * @ppos: file position
2048 * 2048 *
2049 * Reads/writes a string from/to the user buffer. If the kernel 2049 * Reads/writes a string from/to the user buffer. If the kernel
2050 * buffer provided is not large enough to hold the string, the 2050 * buffer provided is not large enough to hold the string, the
2051 * string is truncated. The copied string is %NULL-terminated. 2051 * string is truncated. The copied string is %NULL-terminated.
2052 * If the string is being read by the user process, it is copied 2052 * If the string is being read by the user process, it is copied
2053 * and a newline '\n' is added. It is truncated if the buffer is 2053 * and a newline '\n' is added. It is truncated if the buffer is
2054 * not large enough. 2054 * not large enough.
2055 * 2055 *
2056 * Returns 0 on success. 2056 * Returns 0 on success.
2057 */ 2057 */
2058 int proc_dostring(struct ctl_table *table, int write, 2058 int proc_dostring(struct ctl_table *table, int write,
2059 void __user *buffer, size_t *lenp, loff_t *ppos) 2059 void __user *buffer, size_t *lenp, loff_t *ppos)
2060 { 2060 {
2061 return _proc_do_string(table->data, table->maxlen, write, 2061 return _proc_do_string(table->data, table->maxlen, write,
2062 buffer, lenp, ppos); 2062 buffer, lenp, ppos);
2063 } 2063 }
2064 2064
2065 static size_t proc_skip_spaces(char **buf) 2065 static size_t proc_skip_spaces(char **buf)
2066 { 2066 {
2067 size_t ret; 2067 size_t ret;
2068 char *tmp = skip_spaces(*buf); 2068 char *tmp = skip_spaces(*buf);
2069 ret = tmp - *buf; 2069 ret = tmp - *buf;
2070 *buf = tmp; 2070 *buf = tmp;
2071 return ret; 2071 return ret;
2072 } 2072 }
2073 2073
2074 static void proc_skip_char(char **buf, size_t *size, const char v) 2074 static void proc_skip_char(char **buf, size_t *size, const char v)
2075 { 2075 {
2076 while (*size) { 2076 while (*size) {
2077 if (**buf != v) 2077 if (**buf != v)
2078 break; 2078 break;
2079 (*size)--; 2079 (*size)--;
2080 (*buf)++; 2080 (*buf)++;
2081 } 2081 }
2082 } 2082 }
2083 2083
2084 #define TMPBUFLEN 22 2084 #define TMPBUFLEN 22
2085 /** 2085 /**
2086 * proc_get_long - reads an ASCII formated integer from a user buffer 2086 * proc_get_long - reads an ASCII formated integer from a user buffer
2087 * 2087 *
2088 * @buf - a kernel buffer 2088 * @buf - a kernel buffer
2089 * @size - size of the kernel buffer 2089 * @size - size of the kernel buffer
2090 * @val - this is where the number will be stored 2090 * @val - this is where the number will be stored
2091 * @neg - set to %TRUE if number is negative 2091 * @neg - set to %TRUE if number is negative
2092 * @perm_tr - a vector which contains the allowed trailers 2092 * @perm_tr - a vector which contains the allowed trailers
2093 * @perm_tr_len - size of the perm_tr vector 2093 * @perm_tr_len - size of the perm_tr vector
2094 * @tr - pointer to store the trailer character 2094 * @tr - pointer to store the trailer character
2095 * 2095 *
2096 * In case of success 0 is returned and buf and size are updated with 2096 * In case of success 0 is returned and buf and size are updated with
2097 * the amount of bytes read. If tr is non NULL and a trailing 2097 * the amount of bytes read. If tr is non NULL and a trailing
2098 * character exist (size is non zero after returning from this 2098 * character exist (size is non zero after returning from this
2099 * function) tr is updated with the trailing character. 2099 * function) tr is updated with the trailing character.
2100 */ 2100 */
2101 static int proc_get_long(char **buf, size_t *size, 2101 static int proc_get_long(char **buf, size_t *size,
2102 unsigned long *val, bool *neg, 2102 unsigned long *val, bool *neg,
2103 const char *perm_tr, unsigned perm_tr_len, char *tr) 2103 const char *perm_tr, unsigned perm_tr_len, char *tr)
2104 { 2104 {
2105 int len; 2105 int len;
2106 char *p, tmp[TMPBUFLEN]; 2106 char *p, tmp[TMPBUFLEN];
2107 2107
2108 if (!*size) 2108 if (!*size)
2109 return -EINVAL; 2109 return -EINVAL;
2110 2110
2111 len = *size; 2111 len = *size;
2112 if (len > TMPBUFLEN - 1) 2112 if (len > TMPBUFLEN - 1)
2113 len = TMPBUFLEN - 1; 2113 len = TMPBUFLEN - 1;
2114 2114
2115 memcpy(tmp, *buf, len); 2115 memcpy(tmp, *buf, len);
2116 2116
2117 tmp[len] = 0; 2117 tmp[len] = 0;
2118 p = tmp; 2118 p = tmp;
2119 if (*p == '-' && *size > 1) { 2119 if (*p == '-' && *size > 1) {
2120 *neg = true; 2120 *neg = true;
2121 p++; 2121 p++;
2122 } else 2122 } else
2123 *neg = false; 2123 *neg = false;
2124 if (!isdigit(*p)) 2124 if (!isdigit(*p))
2125 return -EINVAL; 2125 return -EINVAL;
2126 2126
2127 *val = simple_strtoul(p, &p, 0); 2127 *val = simple_strtoul(p, &p, 0);
2128 2128
2129 len = p - tmp; 2129 len = p - tmp;
2130 2130
2131 /* We don't know if the next char is whitespace thus we may accept 2131 /* We don't know if the next char is whitespace thus we may accept
2132 * invalid integers (e.g. 1234...a) or two integers instead of one 2132 * invalid integers (e.g. 1234...a) or two integers instead of one
2133 * (e.g. 123...1). So lets not allow such large numbers. */ 2133 * (e.g. 123...1). So lets not allow such large numbers. */
2134 if (len == TMPBUFLEN - 1) 2134 if (len == TMPBUFLEN - 1)
2135 return -EINVAL; 2135 return -EINVAL;
2136 2136
2137 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len)) 2137 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
2138 return -EINVAL; 2138 return -EINVAL;
2139 2139
2140 if (tr && (len < *size)) 2140 if (tr && (len < *size))
2141 *tr = *p; 2141 *tr = *p;
2142 2142
2143 *buf += len; 2143 *buf += len;
2144 *size -= len; 2144 *size -= len;
2145 2145
2146 return 0; 2146 return 0;
2147 } 2147 }
2148 2148
2149 /** 2149 /**
2150 * proc_put_long - coverts an integer to a decimal ASCII formated string 2150 * proc_put_long - coverts an integer to a decimal ASCII formated string
2151 * 2151 *
2152 * @buf - the user buffer 2152 * @buf - the user buffer
2153 * @size - the size of the user buffer 2153 * @size - the size of the user buffer
2154 * @val - the integer to be converted 2154 * @val - the integer to be converted
2155 * @neg - sign of the number, %TRUE for negative 2155 * @neg - sign of the number, %TRUE for negative
2156 * 2156 *
2157 * In case of success 0 is returned and buf and size are updated with 2157 * In case of success 0 is returned and buf and size are updated with
2158 * the amount of bytes read. 2158 * the amount of bytes read.
2159 */ 2159 */
2160 static int proc_put_long(void __user **buf, size_t *size, unsigned long val, 2160 static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
2161 bool neg) 2161 bool neg)
2162 { 2162 {
2163 int len; 2163 int len;
2164 char tmp[TMPBUFLEN], *p = tmp; 2164 char tmp[TMPBUFLEN], *p = tmp;
2165 2165
2166 sprintf(p, "%s%lu", neg ? "-" : "", val); 2166 sprintf(p, "%s%lu", neg ? "-" : "", val);
2167 len = strlen(tmp); 2167 len = strlen(tmp);
2168 if (len > *size) 2168 if (len > *size)
2169 len = *size; 2169 len = *size;
2170 if (copy_to_user(*buf, tmp, len)) 2170 if (copy_to_user(*buf, tmp, len))
2171 return -EFAULT; 2171 return -EFAULT;
2172 *size -= len; 2172 *size -= len;
2173 *buf += len; 2173 *buf += len;
2174 return 0; 2174 return 0;
2175 } 2175 }
2176 #undef TMPBUFLEN 2176 #undef TMPBUFLEN
2177 2177
2178 static int proc_put_char(void __user **buf, size_t *size, char c) 2178 static int proc_put_char(void __user **buf, size_t *size, char c)
2179 { 2179 {
2180 if (*size) { 2180 if (*size) {
2181 char __user **buffer = (char __user **)buf; 2181 char __user **buffer = (char __user **)buf;
2182 if (put_user(c, *buffer)) 2182 if (put_user(c, *buffer))
2183 return -EFAULT; 2183 return -EFAULT;
2184 (*size)--, (*buffer)++; 2184 (*size)--, (*buffer)++;
2185 *buf = *buffer; 2185 *buf = *buffer;
2186 } 2186 }
2187 return 0; 2187 return 0;
2188 } 2188 }
2189 2189
2190 static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp, 2190 static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
2191 int *valp, 2191 int *valp,
2192 int write, void *data) 2192 int write, void *data)
2193 { 2193 {
2194 if (write) { 2194 if (write) {
2195 *valp = *negp ? -*lvalp : *lvalp; 2195 *valp = *negp ? -*lvalp : *lvalp;
2196 } else { 2196 } else {
2197 int val = *valp; 2197 int val = *valp;
2198 if (val < 0) { 2198 if (val < 0) {
2199 *negp = true; 2199 *negp = true;
2200 *lvalp = (unsigned long)-val; 2200 *lvalp = (unsigned long)-val;
2201 } else { 2201 } else {
2202 *negp = false; 2202 *negp = false;
2203 *lvalp = (unsigned long)val; 2203 *lvalp = (unsigned long)val;
2204 } 2204 }
2205 } 2205 }
2206 return 0; 2206 return 0;
2207 } 2207 }
2208 2208
2209 static const char proc_wspace_sep[] = { ' ', '\t', '\n' }; 2209 static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
2210 2210
2211 static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, 2211 static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2212 int write, void __user *buffer, 2212 int write, void __user *buffer,
2213 size_t *lenp, loff_t *ppos, 2213 size_t *lenp, loff_t *ppos,
2214 int (*conv)(bool *negp, unsigned long *lvalp, int *valp, 2214 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2215 int write, void *data), 2215 int write, void *data),
2216 void *data) 2216 void *data)
2217 { 2217 {
2218 int *i, vleft, first = 1, err = 0; 2218 int *i, vleft, first = 1, err = 0;
2219 unsigned long page = 0; 2219 unsigned long page = 0;
2220 size_t left; 2220 size_t left;
2221 char *kbuf; 2221 char *kbuf;
2222 2222
2223 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) { 2223 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
2224 *lenp = 0; 2224 *lenp = 0;
2225 return 0; 2225 return 0;
2226 } 2226 }
2227 2227
2228 i = (int *) tbl_data; 2228 i = (int *) tbl_data;
2229 vleft = table->maxlen / sizeof(*i); 2229 vleft = table->maxlen / sizeof(*i);
2230 left = *lenp; 2230 left = *lenp;
2231 2231
2232 if (!conv) 2232 if (!conv)
2233 conv = do_proc_dointvec_conv; 2233 conv = do_proc_dointvec_conv;
2234 2234
2235 if (write) { 2235 if (write) {
2236 if (left > PAGE_SIZE - 1) 2236 if (left > PAGE_SIZE - 1)
2237 left = PAGE_SIZE - 1; 2237 left = PAGE_SIZE - 1;
2238 page = __get_free_page(GFP_TEMPORARY); 2238 page = __get_free_page(GFP_TEMPORARY);
2239 kbuf = (char *) page; 2239 kbuf = (char *) page;
2240 if (!kbuf) 2240 if (!kbuf)
2241 return -ENOMEM; 2241 return -ENOMEM;
2242 if (copy_from_user(kbuf, buffer, left)) { 2242 if (copy_from_user(kbuf, buffer, left)) {
2243 err = -EFAULT; 2243 err = -EFAULT;
2244 goto free; 2244 goto free;
2245 } 2245 }
2246 kbuf[left] = 0; 2246 kbuf[left] = 0;
2247 } 2247 }
2248 2248
2249 for (; left && vleft--; i++, first=0) { 2249 for (; left && vleft--; i++, first=0) {
2250 unsigned long lval; 2250 unsigned long lval;
2251 bool neg; 2251 bool neg;
2252 2252
2253 if (write) { 2253 if (write) {
2254 left -= proc_skip_spaces(&kbuf); 2254 left -= proc_skip_spaces(&kbuf);
2255 2255
2256 if (!left)
2257 break;
2256 err = proc_get_long(&kbuf, &left, &lval, &neg, 2258 err = proc_get_long(&kbuf, &left, &lval, &neg,
2257 proc_wspace_sep, 2259 proc_wspace_sep,
2258 sizeof(proc_wspace_sep), NULL); 2260 sizeof(proc_wspace_sep), NULL);
2259 if (err) 2261 if (err)
2260 break; 2262 break;
2261 if (conv(&neg, &lval, i, 1, data)) { 2263 if (conv(&neg, &lval, i, 1, data)) {
2262 err = -EINVAL; 2264 err = -EINVAL;
2263 break; 2265 break;
2264 } 2266 }
2265 } else { 2267 } else {
2266 if (conv(&neg, &lval, i, 0, data)) { 2268 if (conv(&neg, &lval, i, 0, data)) {
2267 err = -EINVAL; 2269 err = -EINVAL;
2268 break; 2270 break;
2269 } 2271 }
2270 if (!first) 2272 if (!first)
2271 err = proc_put_char(&buffer, &left, '\t'); 2273 err = proc_put_char(&buffer, &left, '\t');
2272 if (err) 2274 if (err)
2273 break; 2275 break;
2274 err = proc_put_long(&buffer, &left, lval, neg); 2276 err = proc_put_long(&buffer, &left, lval, neg);
2275 if (err) 2277 if (err)
2276 break; 2278 break;
2277 } 2279 }
2278 } 2280 }
2279 2281
2280 if (!write && !first && left && !err) 2282 if (!write && !first && left && !err)
2281 err = proc_put_char(&buffer, &left, '\n'); 2283 err = proc_put_char(&buffer, &left, '\n');
2282 if (write && !err) 2284 if (write && !err && left)
2283 left -= proc_skip_spaces(&kbuf); 2285 left -= proc_skip_spaces(&kbuf);
2284 free: 2286 free:
2285 if (write) { 2287 if (write) {
2286 free_page(page); 2288 free_page(page);
2287 if (first) 2289 if (first)
2288 return err ? : -EINVAL; 2290 return err ? : -EINVAL;
2289 } 2291 }
2290 *lenp -= left; 2292 *lenp -= left;
2291 *ppos += *lenp; 2293 *ppos += *lenp;
2292 return err; 2294 return err;
2293 } 2295 }
2294 2296
2295 static int do_proc_dointvec(struct ctl_table *table, int write, 2297 static int do_proc_dointvec(struct ctl_table *table, int write,
2296 void __user *buffer, size_t *lenp, loff_t *ppos, 2298 void __user *buffer, size_t *lenp, loff_t *ppos,
2297 int (*conv)(bool *negp, unsigned long *lvalp, int *valp, 2299 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2298 int write, void *data), 2300 int write, void *data),
2299 void *data) 2301 void *data)
2300 { 2302 {
2301 return __do_proc_dointvec(table->data, table, write, 2303 return __do_proc_dointvec(table->data, table, write,
2302 buffer, lenp, ppos, conv, data); 2304 buffer, lenp, ppos, conv, data);
2303 } 2305 }
2304 2306
2305 /** 2307 /**
2306 * proc_dointvec - read a vector of integers 2308 * proc_dointvec - read a vector of integers
2307 * @table: the sysctl table 2309 * @table: the sysctl table
2308 * @write: %TRUE if this is a write to the sysctl file 2310 * @write: %TRUE if this is a write to the sysctl file
2309 * @buffer: the user buffer 2311 * @buffer: the user buffer
2310 * @lenp: the size of the user buffer 2312 * @lenp: the size of the user buffer
2311 * @ppos: file position 2313 * @ppos: file position
2312 * 2314 *
2313 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer 2315 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2314 * values from/to the user buffer, treated as an ASCII string. 2316 * values from/to the user buffer, treated as an ASCII string.
2315 * 2317 *
2316 * Returns 0 on success. 2318 * Returns 0 on success.
2317 */ 2319 */
2318 int proc_dointvec(struct ctl_table *table, int write, 2320 int proc_dointvec(struct ctl_table *table, int write,
2319 void __user *buffer, size_t *lenp, loff_t *ppos) 2321 void __user *buffer, size_t *lenp, loff_t *ppos)
2320 { 2322 {
2321 return do_proc_dointvec(table,write,buffer,lenp,ppos, 2323 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2322 NULL,NULL); 2324 NULL,NULL);
2323 } 2325 }
2324 2326
2325 /* 2327 /*
2326 * Taint values can only be increased 2328 * Taint values can only be increased
2327 * This means we can safely use a temporary. 2329 * This means we can safely use a temporary.
2328 */ 2330 */
2329 static int proc_taint(struct ctl_table *table, int write, 2331 static int proc_taint(struct ctl_table *table, int write,
2330 void __user *buffer, size_t *lenp, loff_t *ppos) 2332 void __user *buffer, size_t *lenp, loff_t *ppos)
2331 { 2333 {
2332 struct ctl_table t; 2334 struct ctl_table t;
2333 unsigned long tmptaint = get_taint(); 2335 unsigned long tmptaint = get_taint();
2334 int err; 2336 int err;
2335 2337
2336 if (write && !capable(CAP_SYS_ADMIN)) 2338 if (write && !capable(CAP_SYS_ADMIN))
2337 return -EPERM; 2339 return -EPERM;
2338 2340
2339 t = *table; 2341 t = *table;
2340 t.data = &tmptaint; 2342 t.data = &tmptaint;
2341 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos); 2343 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
2342 if (err < 0) 2344 if (err < 0)
2343 return err; 2345 return err;
2344 2346
2345 if (write) { 2347 if (write) {
2346 /* 2348 /*
2347 * Poor man's atomic or. Not worth adding a primitive 2349 * Poor man's atomic or. Not worth adding a primitive
2348 * to everyone's atomic.h for this 2350 * to everyone's atomic.h for this
2349 */ 2351 */
2350 int i; 2352 int i;
2351 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) { 2353 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
2352 if ((tmptaint >> i) & 1) 2354 if ((tmptaint >> i) & 1)
2353 add_taint(i); 2355 add_taint(i);
2354 } 2356 }
2355 } 2357 }
2356 2358
2357 return err; 2359 return err;
2358 } 2360 }
2359 2361
2360 struct do_proc_dointvec_minmax_conv_param { 2362 struct do_proc_dointvec_minmax_conv_param {
2361 int *min; 2363 int *min;
2362 int *max; 2364 int *max;
2363 }; 2365 };
2364 2366
2365 static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp, 2367 static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
2366 int *valp, 2368 int *valp,
2367 int write, void *data) 2369 int write, void *data)
2368 { 2370 {
2369 struct do_proc_dointvec_minmax_conv_param *param = data; 2371 struct do_proc_dointvec_minmax_conv_param *param = data;
2370 if (write) { 2372 if (write) {
2371 int val = *negp ? -*lvalp : *lvalp; 2373 int val = *negp ? -*lvalp : *lvalp;
2372 if ((param->min && *param->min > val) || 2374 if ((param->min && *param->min > val) ||
2373 (param->max && *param->max < val)) 2375 (param->max && *param->max < val))
2374 return -EINVAL; 2376 return -EINVAL;
2375 *valp = val; 2377 *valp = val;
2376 } else { 2378 } else {
2377 int val = *valp; 2379 int val = *valp;
2378 if (val < 0) { 2380 if (val < 0) {
2379 *negp = true; 2381 *negp = true;
2380 *lvalp = (unsigned long)-val; 2382 *lvalp = (unsigned long)-val;
2381 } else { 2383 } else {
2382 *negp = false; 2384 *negp = false;
2383 *lvalp = (unsigned long)val; 2385 *lvalp = (unsigned long)val;
2384 } 2386 }
2385 } 2387 }
2386 return 0; 2388 return 0;
2387 } 2389 }
2388 2390
2389 /** 2391 /**
2390 * proc_dointvec_minmax - read a vector of integers with min/max values 2392 * proc_dointvec_minmax - read a vector of integers with min/max values
2391 * @table: the sysctl table 2393 * @table: the sysctl table
2392 * @write: %TRUE if this is a write to the sysctl file 2394 * @write: %TRUE if this is a write to the sysctl file
2393 * @buffer: the user buffer 2395 * @buffer: the user buffer
2394 * @lenp: the size of the user buffer 2396 * @lenp: the size of the user buffer
2395 * @ppos: file position 2397 * @ppos: file position
2396 * 2398 *
2397 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer 2399 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2398 * values from/to the user buffer, treated as an ASCII string. 2400 * values from/to the user buffer, treated as an ASCII string.
2399 * 2401 *
2400 * This routine will ensure the values are within the range specified by 2402 * This routine will ensure the values are within the range specified by
2401 * table->extra1 (min) and table->extra2 (max). 2403 * table->extra1 (min) and table->extra2 (max).
2402 * 2404 *
2403 * Returns 0 on success. 2405 * Returns 0 on success.
2404 */ 2406 */
2405 int proc_dointvec_minmax(struct ctl_table *table, int write, 2407 int proc_dointvec_minmax(struct ctl_table *table, int write,
2406 void __user *buffer, size_t *lenp, loff_t *ppos) 2408 void __user *buffer, size_t *lenp, loff_t *ppos)
2407 { 2409 {
2408 struct do_proc_dointvec_minmax_conv_param param = { 2410 struct do_proc_dointvec_minmax_conv_param param = {
2409 .min = (int *) table->extra1, 2411 .min = (int *) table->extra1,
2410 .max = (int *) table->extra2, 2412 .max = (int *) table->extra2,
2411 }; 2413 };
2412 return do_proc_dointvec(table, write, buffer, lenp, ppos, 2414 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2413 do_proc_dointvec_minmax_conv, &param); 2415 do_proc_dointvec_minmax_conv, &param);
2414 } 2416 }
2415 2417
2416 static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write, 2418 static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2417 void __user *buffer, 2419 void __user *buffer,
2418 size_t *lenp, loff_t *ppos, 2420 size_t *lenp, loff_t *ppos,
2419 unsigned long convmul, 2421 unsigned long convmul,
2420 unsigned long convdiv) 2422 unsigned long convdiv)
2421 { 2423 {
2422 unsigned long *i, *min, *max; 2424 unsigned long *i, *min, *max;
2423 int vleft, first = 1, err = 0; 2425 int vleft, first = 1, err = 0;
2424 unsigned long page = 0; 2426 unsigned long page = 0;
2425 size_t left; 2427 size_t left;
2426 char *kbuf; 2428 char *kbuf;
2427 2429
2428 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) { 2430 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
2429 *lenp = 0; 2431 *lenp = 0;
2430 return 0; 2432 return 0;
2431 } 2433 }
2432 2434
2433 i = (unsigned long *) data; 2435 i = (unsigned long *) data;
2434 min = (unsigned long *) table->extra1; 2436 min = (unsigned long *) table->extra1;
2435 max = (unsigned long *) table->extra2; 2437 max = (unsigned long *) table->extra2;
2436 vleft = table->maxlen / sizeof(unsigned long); 2438 vleft = table->maxlen / sizeof(unsigned long);
2437 left = *lenp; 2439 left = *lenp;
2438 2440
2439 if (write) { 2441 if (write) {
2440 if (left > PAGE_SIZE - 1) 2442 if (left > PAGE_SIZE - 1)
2441 left = PAGE_SIZE - 1; 2443 left = PAGE_SIZE - 1;
2442 page = __get_free_page(GFP_TEMPORARY); 2444 page = __get_free_page(GFP_TEMPORARY);
2443 kbuf = (char *) page; 2445 kbuf = (char *) page;
2444 if (!kbuf) 2446 if (!kbuf)
2445 return -ENOMEM; 2447 return -ENOMEM;
2446 if (copy_from_user(kbuf, buffer, left)) { 2448 if (copy_from_user(kbuf, buffer, left)) {
2447 err = -EFAULT; 2449 err = -EFAULT;
2448 goto free; 2450 goto free;
2449 } 2451 }
2450 kbuf[left] = 0; 2452 kbuf[left] = 0;
2451 } 2453 }
2452 2454
2453 for (; left && vleft--; i++, min++, max++, first=0) { 2455 for (; left && vleft--; i++, min++, max++, first=0) {
2454 unsigned long val; 2456 unsigned long val;
2455 2457
2456 if (write) { 2458 if (write) {
2457 bool neg; 2459 bool neg;
2458 2460
2459 left -= proc_skip_spaces(&kbuf); 2461 left -= proc_skip_spaces(&kbuf);
2460 2462
2461 err = proc_get_long(&kbuf, &left, &val, &neg, 2463 err = proc_get_long(&kbuf, &left, &val, &neg,
2462 proc_wspace_sep, 2464 proc_wspace_sep,
2463 sizeof(proc_wspace_sep), NULL); 2465 sizeof(proc_wspace_sep), NULL);
2464 if (err) 2466 if (err)
2465 break; 2467 break;
2466 if (neg) 2468 if (neg)
2467 continue; 2469 continue;
2468 if ((min && val < *min) || (max && val > *max)) 2470 if ((min && val < *min) || (max && val > *max))
2469 continue; 2471 continue;
2470 *i = val; 2472 *i = val;
2471 } else { 2473 } else {
2472 val = convdiv * (*i) / convmul; 2474 val = convdiv * (*i) / convmul;
2473 if (!first) 2475 if (!first)
2474 err = proc_put_char(&buffer, &left, '\t'); 2476 err = proc_put_char(&buffer, &left, '\t');
2475 err = proc_put_long(&buffer, &left, val, false); 2477 err = proc_put_long(&buffer, &left, val, false);
2476 if (err) 2478 if (err)
2477 break; 2479 break;
2478 } 2480 }
2479 } 2481 }
2480 2482
2481 if (!write && !first && left && !err) 2483 if (!write && !first && left && !err)
2482 err = proc_put_char(&buffer, &left, '\n'); 2484 err = proc_put_char(&buffer, &left, '\n');
2483 if (write && !err) 2485 if (write && !err)
2484 left -= proc_skip_spaces(&kbuf); 2486 left -= proc_skip_spaces(&kbuf);
2485 free: 2487 free:
2486 if (write) { 2488 if (write) {
2487 free_page(page); 2489 free_page(page);
2488 if (first) 2490 if (first)
2489 return err ? : -EINVAL; 2491 return err ? : -EINVAL;
2490 } 2492 }
2491 *lenp -= left; 2493 *lenp -= left;
2492 *ppos += *lenp; 2494 *ppos += *lenp;
2493 return err; 2495 return err;
2494 } 2496 }
2495 2497
2496 static int do_proc_doulongvec_minmax(struct ctl_table *table, int write, 2498 static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2497 void __user *buffer, 2499 void __user *buffer,
2498 size_t *lenp, loff_t *ppos, 2500 size_t *lenp, loff_t *ppos,
2499 unsigned long convmul, 2501 unsigned long convmul,
2500 unsigned long convdiv) 2502 unsigned long convdiv)
2501 { 2503 {
2502 return __do_proc_doulongvec_minmax(table->data, table, write, 2504 return __do_proc_doulongvec_minmax(table->data, table, write,
2503 buffer, lenp, ppos, convmul, convdiv); 2505 buffer, lenp, ppos, convmul, convdiv);
2504 } 2506 }
2505 2507
2506 /** 2508 /**
2507 * proc_doulongvec_minmax - read a vector of long integers with min/max values 2509 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2508 * @table: the sysctl table 2510 * @table: the sysctl table
2509 * @write: %TRUE if this is a write to the sysctl file 2511 * @write: %TRUE if this is a write to the sysctl file
2510 * @buffer: the user buffer 2512 * @buffer: the user buffer
2511 * @lenp: the size of the user buffer 2513 * @lenp: the size of the user buffer
2512 * @ppos: file position 2514 * @ppos: file position
2513 * 2515 *
2514 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long 2516 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2515 * values from/to the user buffer, treated as an ASCII string. 2517 * values from/to the user buffer, treated as an ASCII string.
2516 * 2518 *
2517 * This routine will ensure the values are within the range specified by 2519 * This routine will ensure the values are within the range specified by
2518 * table->extra1 (min) and table->extra2 (max). 2520 * table->extra1 (min) and table->extra2 (max).
2519 * 2521 *
2520 * Returns 0 on success. 2522 * Returns 0 on success.
2521 */ 2523 */
2522 int proc_doulongvec_minmax(struct ctl_table *table, int write, 2524 int proc_doulongvec_minmax(struct ctl_table *table, int write,
2523 void __user *buffer, size_t *lenp, loff_t *ppos) 2525 void __user *buffer, size_t *lenp, loff_t *ppos)
2524 { 2526 {
2525 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l); 2527 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
2526 } 2528 }
2527 2529
2528 /** 2530 /**
2529 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values 2531 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2530 * @table: the sysctl table 2532 * @table: the sysctl table
2531 * @write: %TRUE if this is a write to the sysctl file 2533 * @write: %TRUE if this is a write to the sysctl file
2532 * @buffer: the user buffer 2534 * @buffer: the user buffer
2533 * @lenp: the size of the user buffer 2535 * @lenp: the size of the user buffer
2534 * @ppos: file position 2536 * @ppos: file position
2535 * 2537 *
2536 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long 2538 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2537 * values from/to the user buffer, treated as an ASCII string. The values 2539 * values from/to the user buffer, treated as an ASCII string. The values
2538 * are treated as milliseconds, and converted to jiffies when they are stored. 2540 * are treated as milliseconds, and converted to jiffies when they are stored.
2539 * 2541 *
2540 * This routine will ensure the values are within the range specified by 2542 * This routine will ensure the values are within the range specified by
2541 * table->extra1 (min) and table->extra2 (max). 2543 * table->extra1 (min) and table->extra2 (max).
2542 * 2544 *
2543 * Returns 0 on success. 2545 * Returns 0 on success.
2544 */ 2546 */
2545 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, 2547 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2546 void __user *buffer, 2548 void __user *buffer,
2547 size_t *lenp, loff_t *ppos) 2549 size_t *lenp, loff_t *ppos)
2548 { 2550 {
2549 return do_proc_doulongvec_minmax(table, write, buffer, 2551 return do_proc_doulongvec_minmax(table, write, buffer,
2550 lenp, ppos, HZ, 1000l); 2552 lenp, ppos, HZ, 1000l);
2551 } 2553 }
2552 2554
2553 2555
2554 static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp, 2556 static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
2555 int *valp, 2557 int *valp,
2556 int write, void *data) 2558 int write, void *data)
2557 { 2559 {
2558 if (write) { 2560 if (write) {
2559 if (*lvalp > LONG_MAX / HZ) 2561 if (*lvalp > LONG_MAX / HZ)
2560 return 1; 2562 return 1;
2561 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ); 2563 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2562 } else { 2564 } else {
2563 int val = *valp; 2565 int val = *valp;
2564 unsigned long lval; 2566 unsigned long lval;
2565 if (val < 0) { 2567 if (val < 0) {
2566 *negp = true; 2568 *negp = true;
2567 lval = (unsigned long)-val; 2569 lval = (unsigned long)-val;
2568 } else { 2570 } else {
2569 *negp = false; 2571 *negp = false;
2570 lval = (unsigned long)val; 2572 lval = (unsigned long)val;
2571 } 2573 }
2572 *lvalp = lval / HZ; 2574 *lvalp = lval / HZ;
2573 } 2575 }
2574 return 0; 2576 return 0;
2575 } 2577 }
2576 2578
2577 static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp, 2579 static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
2578 int *valp, 2580 int *valp,
2579 int write, void *data) 2581 int write, void *data)
2580 { 2582 {
2581 if (write) { 2583 if (write) {
2582 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ) 2584 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2583 return 1; 2585 return 1;
2584 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp); 2586 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2585 } else { 2587 } else {
2586 int val = *valp; 2588 int val = *valp;
2587 unsigned long lval; 2589 unsigned long lval;
2588 if (val < 0) { 2590 if (val < 0) {
2589 *negp = true; 2591 *negp = true;
2590 lval = (unsigned long)-val; 2592 lval = (unsigned long)-val;
2591 } else { 2593 } else {
2592 *negp = false; 2594 *negp = false;
2593 lval = (unsigned long)val; 2595 lval = (unsigned long)val;
2594 } 2596 }
2595 *lvalp = jiffies_to_clock_t(lval); 2597 *lvalp = jiffies_to_clock_t(lval);
2596 } 2598 }
2597 return 0; 2599 return 0;
2598 } 2600 }
2599 2601
2600 static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp, 2602 static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
2601 int *valp, 2603 int *valp,
2602 int write, void *data) 2604 int write, void *data)
2603 { 2605 {
2604 if (write) { 2606 if (write) {
2605 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp); 2607 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2606 } else { 2608 } else {
2607 int val = *valp; 2609 int val = *valp;
2608 unsigned long lval; 2610 unsigned long lval;
2609 if (val < 0) { 2611 if (val < 0) {
2610 *negp = true; 2612 *negp = true;
2611 lval = (unsigned long)-val; 2613 lval = (unsigned long)-val;
2612 } else { 2614 } else {
2613 *negp = false; 2615 *negp = false;
2614 lval = (unsigned long)val; 2616 lval = (unsigned long)val;
2615 } 2617 }
2616 *lvalp = jiffies_to_msecs(lval); 2618 *lvalp = jiffies_to_msecs(lval);
2617 } 2619 }
2618 return 0; 2620 return 0;
2619 } 2621 }
2620 2622
2621 /** 2623 /**
2622 * proc_dointvec_jiffies - read a vector of integers as seconds 2624 * proc_dointvec_jiffies - read a vector of integers as seconds
2623 * @table: the sysctl table 2625 * @table: the sysctl table
2624 * @write: %TRUE if this is a write to the sysctl file 2626 * @write: %TRUE if this is a write to the sysctl file
2625 * @buffer: the user buffer 2627 * @buffer: the user buffer
2626 * @lenp: the size of the user buffer 2628 * @lenp: the size of the user buffer
2627 * @ppos: file position 2629 * @ppos: file position
2628 * 2630 *
2629 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer 2631 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2630 * values from/to the user buffer, treated as an ASCII string. 2632 * values from/to the user buffer, treated as an ASCII string.
2631 * The values read are assumed to be in seconds, and are converted into 2633 * The values read are assumed to be in seconds, and are converted into
2632 * jiffies. 2634 * jiffies.
2633 * 2635 *
2634 * Returns 0 on success. 2636 * Returns 0 on success.
2635 */ 2637 */
2636 int proc_dointvec_jiffies(struct ctl_table *table, int write, 2638 int proc_dointvec_jiffies(struct ctl_table *table, int write,
2637 void __user *buffer, size_t *lenp, loff_t *ppos) 2639 void __user *buffer, size_t *lenp, loff_t *ppos)
2638 { 2640 {
2639 return do_proc_dointvec(table,write,buffer,lenp,ppos, 2641 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2640 do_proc_dointvec_jiffies_conv,NULL); 2642 do_proc_dointvec_jiffies_conv,NULL);
2641 } 2643 }
2642 2644
2643 /** 2645 /**
2644 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds 2646 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2645 * @table: the sysctl table 2647 * @table: the sysctl table
2646 * @write: %TRUE if this is a write to the sysctl file 2648 * @write: %TRUE if this is a write to the sysctl file
2647 * @buffer: the user buffer 2649 * @buffer: the user buffer
2648 * @lenp: the size of the user buffer 2650 * @lenp: the size of the user buffer
2649 * @ppos: pointer to the file position 2651 * @ppos: pointer to the file position
2650 * 2652 *
2651 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer 2653 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2652 * values from/to the user buffer, treated as an ASCII string. 2654 * values from/to the user buffer, treated as an ASCII string.
2653 * The values read are assumed to be in 1/USER_HZ seconds, and 2655 * The values read are assumed to be in 1/USER_HZ seconds, and
2654 * are converted into jiffies. 2656 * are converted into jiffies.
2655 * 2657 *
2656 * Returns 0 on success. 2658 * Returns 0 on success.
2657 */ 2659 */
2658 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, 2660 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2659 void __user *buffer, size_t *lenp, loff_t *ppos) 2661 void __user *buffer, size_t *lenp, loff_t *ppos)
2660 { 2662 {
2661 return do_proc_dointvec(table,write,buffer,lenp,ppos, 2663 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2662 do_proc_dointvec_userhz_jiffies_conv,NULL); 2664 do_proc_dointvec_userhz_jiffies_conv,NULL);
2663 } 2665 }
2664 2666
2665 /** 2667 /**
2666 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds 2668 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2667 * @table: the sysctl table 2669 * @table: the sysctl table
2668 * @write: %TRUE if this is a write to the sysctl file 2670 * @write: %TRUE if this is a write to the sysctl file
2669 * @buffer: the user buffer 2671 * @buffer: the user buffer
2670 * @lenp: the size of the user buffer 2672 * @lenp: the size of the user buffer
2671 * @ppos: file position 2673 * @ppos: file position
2672 * @ppos: the current position in the file 2674 * @ppos: the current position in the file
2673 * 2675 *
2674 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer 2676 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2675 * values from/to the user buffer, treated as an ASCII string. 2677 * values from/to the user buffer, treated as an ASCII string.
2676 * The values read are assumed to be in 1/1000 seconds, and 2678 * The values read are assumed to be in 1/1000 seconds, and
2677 * are converted into jiffies. 2679 * are converted into jiffies.
2678 * 2680 *
2679 * Returns 0 on success. 2681 * Returns 0 on success.
2680 */ 2682 */
2681 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, 2683 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
2682 void __user *buffer, size_t *lenp, loff_t *ppos) 2684 void __user *buffer, size_t *lenp, loff_t *ppos)
2683 { 2685 {
2684 return do_proc_dointvec(table, write, buffer, lenp, ppos, 2686 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2685 do_proc_dointvec_ms_jiffies_conv, NULL); 2687 do_proc_dointvec_ms_jiffies_conv, NULL);
2686 } 2688 }
2687 2689
2688 static int proc_do_cad_pid(struct ctl_table *table, int write, 2690 static int proc_do_cad_pid(struct ctl_table *table, int write,
2689 void __user *buffer, size_t *lenp, loff_t *ppos) 2691 void __user *buffer, size_t *lenp, loff_t *ppos)
2690 { 2692 {
2691 struct pid *new_pid; 2693 struct pid *new_pid;
2692 pid_t tmp; 2694 pid_t tmp;
2693 int r; 2695 int r;
2694 2696
2695 tmp = pid_vnr(cad_pid); 2697 tmp = pid_vnr(cad_pid);
2696 2698
2697 r = __do_proc_dointvec(&tmp, table, write, buffer, 2699 r = __do_proc_dointvec(&tmp, table, write, buffer,
2698 lenp, ppos, NULL, NULL); 2700 lenp, ppos, NULL, NULL);
2699 if (r || !write) 2701 if (r || !write)
2700 return r; 2702 return r;
2701 2703
2702 new_pid = find_get_pid(tmp); 2704 new_pid = find_get_pid(tmp);
2703 if (!new_pid) 2705 if (!new_pid)
2704 return -ESRCH; 2706 return -ESRCH;
2705 2707
2706 put_pid(xchg(&cad_pid, new_pid)); 2708 put_pid(xchg(&cad_pid, new_pid));
2707 return 0; 2709 return 0;
2708 } 2710 }
2709 2711
2710 /** 2712 /**
2711 * proc_do_large_bitmap - read/write from/to a large bitmap 2713 * proc_do_large_bitmap - read/write from/to a large bitmap
2712 * @table: the sysctl table 2714 * @table: the sysctl table
2713 * @write: %TRUE if this is a write to the sysctl file 2715 * @write: %TRUE if this is a write to the sysctl file
2714 * @buffer: the user buffer 2716 * @buffer: the user buffer
2715 * @lenp: the size of the user buffer 2717 * @lenp: the size of the user buffer
2716 * @ppos: file position 2718 * @ppos: file position
2717 * 2719 *
2718 * The bitmap is stored at table->data and the bitmap length (in bits) 2720 * The bitmap is stored at table->data and the bitmap length (in bits)
2719 * in table->maxlen. 2721 * in table->maxlen.
2720 * 2722 *
2721 * We use a range comma separated format (e.g. 1,3-4,10-10) so that 2723 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2722 * large bitmaps may be represented in a compact manner. Writing into 2724 * large bitmaps may be represented in a compact manner. Writing into
2723 * the file will clear the bitmap then update it with the given input. 2725 * the file will clear the bitmap then update it with the given input.
2724 * 2726 *
2725 * Returns 0 on success. 2727 * Returns 0 on success.
2726 */ 2728 */
2727 int proc_do_large_bitmap(struct ctl_table *table, int write, 2729 int proc_do_large_bitmap(struct ctl_table *table, int write,
2728 void __user *buffer, size_t *lenp, loff_t *ppos) 2730 void __user *buffer, size_t *lenp, loff_t *ppos)
2729 { 2731 {
2730 int err = 0; 2732 int err = 0;
2731 bool first = 1; 2733 bool first = 1;
2732 size_t left = *lenp; 2734 size_t left = *lenp;
2733 unsigned long bitmap_len = table->maxlen; 2735 unsigned long bitmap_len = table->maxlen;
2734 unsigned long *bitmap = (unsigned long *) table->data; 2736 unsigned long *bitmap = (unsigned long *) table->data;
2735 unsigned long *tmp_bitmap = NULL; 2737 unsigned long *tmp_bitmap = NULL;
2736 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c; 2738 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2737 2739
2738 if (!bitmap_len || !left || (*ppos && !write)) { 2740 if (!bitmap_len || !left || (*ppos && !write)) {
2739 *lenp = 0; 2741 *lenp = 0;
2740 return 0; 2742 return 0;
2741 } 2743 }
2742 2744
2743 if (write) { 2745 if (write) {
2744 unsigned long page = 0; 2746 unsigned long page = 0;
2745 char *kbuf; 2747 char *kbuf;
2746 2748
2747 if (left > PAGE_SIZE - 1) 2749 if (left > PAGE_SIZE - 1)
2748 left = PAGE_SIZE - 1; 2750 left = PAGE_SIZE - 1;
2749 2751
2750 page = __get_free_page(GFP_TEMPORARY); 2752 page = __get_free_page(GFP_TEMPORARY);
2751 kbuf = (char *) page; 2753 kbuf = (char *) page;
2752 if (!kbuf) 2754 if (!kbuf)
2753 return -ENOMEM; 2755 return -ENOMEM;
2754 if (copy_from_user(kbuf, buffer, left)) { 2756 if (copy_from_user(kbuf, buffer, left)) {
2755 free_page(page); 2757 free_page(page);
2756 return -EFAULT; 2758 return -EFAULT;
2757 } 2759 }
2758 kbuf[left] = 0; 2760 kbuf[left] = 0;
2759 2761
2760 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long), 2762 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2761 GFP_KERNEL); 2763 GFP_KERNEL);
2762 if (!tmp_bitmap) { 2764 if (!tmp_bitmap) {
2763 free_page(page); 2765 free_page(page);
2764 return -ENOMEM; 2766 return -ENOMEM;
2765 } 2767 }
2766 proc_skip_char(&kbuf, &left, '\n'); 2768 proc_skip_char(&kbuf, &left, '\n');
2767 while (!err && left) { 2769 while (!err && left) {
2768 unsigned long val_a, val_b; 2770 unsigned long val_a, val_b;
2769 bool neg; 2771 bool neg;
2770 2772
2771 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a, 2773 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2772 sizeof(tr_a), &c); 2774 sizeof(tr_a), &c);
2773 if (err) 2775 if (err)
2774 break; 2776 break;
2775 if (val_a >= bitmap_len || neg) { 2777 if (val_a >= bitmap_len || neg) {
2776 err = -EINVAL; 2778 err = -EINVAL;
2777 break; 2779 break;
2778 } 2780 }
2779 2781
2780 val_b = val_a; 2782 val_b = val_a;
2781 if (left) { 2783 if (left) {
2782 kbuf++; 2784 kbuf++;
2783 left--; 2785 left--;
2784 } 2786 }
2785 2787
2786 if (c == '-') { 2788 if (c == '-') {
2787 err = proc_get_long(&kbuf, &left, &val_b, 2789 err = proc_get_long(&kbuf, &left, &val_b,
2788 &neg, tr_b, sizeof(tr_b), 2790 &neg, tr_b, sizeof(tr_b),
2789 &c); 2791 &c);
2790 if (err) 2792 if (err)
2791 break; 2793 break;
2792 if (val_b >= bitmap_len || neg || 2794 if (val_b >= bitmap_len || neg ||
2793 val_a > val_b) { 2795 val_a > val_b) {
2794 err = -EINVAL; 2796 err = -EINVAL;
2795 break; 2797 break;
2796 } 2798 }
2797 if (left) { 2799 if (left) {
2798 kbuf++; 2800 kbuf++;
2799 left--; 2801 left--;
2800 } 2802 }
2801 } 2803 }
2802 2804
2803 while (val_a <= val_b) 2805 while (val_a <= val_b)
2804 set_bit(val_a++, tmp_bitmap); 2806 set_bit(val_a++, tmp_bitmap);
2805 2807
2806 first = 0; 2808 first = 0;
2807 proc_skip_char(&kbuf, &left, '\n'); 2809 proc_skip_char(&kbuf, &left, '\n');
2808 } 2810 }
2809 free_page(page); 2811 free_page(page);
2810 } else { 2812 } else {
2811 unsigned long bit_a, bit_b = 0; 2813 unsigned long bit_a, bit_b = 0;
2812 2814
2813 while (left) { 2815 while (left) {
2814 bit_a = find_next_bit(bitmap, bitmap_len, bit_b); 2816 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2815 if (bit_a >= bitmap_len) 2817 if (bit_a >= bitmap_len)
2816 break; 2818 break;
2817 bit_b = find_next_zero_bit(bitmap, bitmap_len, 2819 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2818 bit_a + 1) - 1; 2820 bit_a + 1) - 1;
2819 2821
2820 if (!first) { 2822 if (!first) {
2821 err = proc_put_char(&buffer, &left, ','); 2823 err = proc_put_char(&buffer, &left, ',');
2822 if (err) 2824 if (err)
2823 break; 2825 break;
2824 } 2826 }
2825 err = proc_put_long(&buffer, &left, bit_a, false); 2827 err = proc_put_long(&buffer, &left, bit_a, false);
2826 if (err) 2828 if (err)
2827 break; 2829 break;
2828 if (bit_a != bit_b) { 2830 if (bit_a != bit_b) {
2829 err = proc_put_char(&buffer, &left, '-'); 2831 err = proc_put_char(&buffer, &left, '-');
2830 if (err) 2832 if (err)
2831 break; 2833 break;
2832 err = proc_put_long(&buffer, &left, bit_b, false); 2834 err = proc_put_long(&buffer, &left, bit_b, false);
2833 if (err) 2835 if (err)
2834 break; 2836 break;
2835 } 2837 }
2836 2838
2837 first = 0; bit_b++; 2839 first = 0; bit_b++;
2838 } 2840 }
2839 if (!err) 2841 if (!err)
2840 err = proc_put_char(&buffer, &left, '\n'); 2842 err = proc_put_char(&buffer, &left, '\n');
2841 } 2843 }
2842 2844
2843 if (!err) { 2845 if (!err) {
2844 if (write) { 2846 if (write) {
2845 if (*ppos) 2847 if (*ppos)
2846 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len); 2848 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2847 else 2849 else
2848 memcpy(bitmap, tmp_bitmap, 2850 memcpy(bitmap, tmp_bitmap,
2849 BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long)); 2851 BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long));
2850 } 2852 }
2851 kfree(tmp_bitmap); 2853 kfree(tmp_bitmap);
2852 *lenp -= left; 2854 *lenp -= left;
2853 *ppos += *lenp; 2855 *ppos += *lenp;
2854 return 0; 2856 return 0;
2855 } else { 2857 } else {
2856 kfree(tmp_bitmap); 2858 kfree(tmp_bitmap);
2857 return err; 2859 return err;
2858 } 2860 }
2859 } 2861 }
2860 2862
2861 #else /* CONFIG_PROC_FS */ 2863 #else /* CONFIG_PROC_FS */
2862 2864
2863 int proc_dostring(struct ctl_table *table, int write, 2865 int proc_dostring(struct ctl_table *table, int write,
2864 void __user *buffer, size_t *lenp, loff_t *ppos) 2866 void __user *buffer, size_t *lenp, loff_t *ppos)
2865 { 2867 {
2866 return -ENOSYS; 2868 return -ENOSYS;
2867 } 2869 }
2868 2870
2869 int proc_dointvec(struct ctl_table *table, int write, 2871 int proc_dointvec(struct ctl_table *table, int write,
2870 void __user *buffer, size_t *lenp, loff_t *ppos) 2872 void __user *buffer, size_t *lenp, loff_t *ppos)
2871 { 2873 {
2872 return -ENOSYS; 2874 return -ENOSYS;
2873 } 2875 }
2874 2876
2875 int proc_dointvec_minmax(struct ctl_table *table, int write, 2877 int proc_dointvec_minmax(struct ctl_table *table, int write,
2876 void __user *buffer, size_t *lenp, loff_t *ppos) 2878 void __user *buffer, size_t *lenp, loff_t *ppos)
2877 { 2879 {
2878 return -ENOSYS; 2880 return -ENOSYS;
2879 } 2881 }
2880 2882
2881 int proc_dointvec_jiffies(struct ctl_table *table, int write, 2883 int proc_dointvec_jiffies(struct ctl_table *table, int write,
2882 void __user *buffer, size_t *lenp, loff_t *ppos) 2884 void __user *buffer, size_t *lenp, loff_t *ppos)
2883 { 2885 {
2884 return -ENOSYS; 2886 return -ENOSYS;
2885 } 2887 }
2886 2888
2887 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, 2889 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2888 void __user *buffer, size_t *lenp, loff_t *ppos) 2890 void __user *buffer, size_t *lenp, loff_t *ppos)
2889 { 2891 {
2890 return -ENOSYS; 2892 return -ENOSYS;
2891 } 2893 }
2892 2894
2893 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, 2895 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
2894 void __user *buffer, size_t *lenp, loff_t *ppos) 2896 void __user *buffer, size_t *lenp, loff_t *ppos)
2895 { 2897 {
2896 return -ENOSYS; 2898 return -ENOSYS;
2897 } 2899 }
2898 2900
2899 int proc_doulongvec_minmax(struct ctl_table *table, int write, 2901 int proc_doulongvec_minmax(struct ctl_table *table, int write,
2900 void __user *buffer, size_t *lenp, loff_t *ppos) 2902 void __user *buffer, size_t *lenp, loff_t *ppos)
2901 { 2903 {
2902 return -ENOSYS; 2904 return -ENOSYS;
2903 } 2905 }
2904 2906
2905 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, 2907 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2906 void __user *buffer, 2908 void __user *buffer,
2907 size_t *lenp, loff_t *ppos) 2909 size_t *lenp, loff_t *ppos)
2908 { 2910 {
2909 return -ENOSYS; 2911 return -ENOSYS;
2910 } 2912 }
2911 2913
2912 2914
2913 #endif /* CONFIG_PROC_FS */ 2915 #endif /* CONFIG_PROC_FS */
2914 2916
2915 /* 2917 /*
2916 * No sense putting this after each symbol definition, twice, 2918 * No sense putting this after each symbol definition, twice,
2917 * exception granted :-) 2919 * exception granted :-)
2918 */ 2920 */
2919 EXPORT_SYMBOL(proc_dointvec); 2921 EXPORT_SYMBOL(proc_dointvec);
2920 EXPORT_SYMBOL(proc_dointvec_jiffies); 2922 EXPORT_SYMBOL(proc_dointvec_jiffies);
2921 EXPORT_SYMBOL(proc_dointvec_minmax); 2923 EXPORT_SYMBOL(proc_dointvec_minmax);
2922 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies); 2924 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2923 EXPORT_SYMBOL(proc_dointvec_ms_jiffies); 2925 EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2924 EXPORT_SYMBOL(proc_dostring); 2926 EXPORT_SYMBOL(proc_dostring);
2925 EXPORT_SYMBOL(proc_doulongvec_minmax); 2927 EXPORT_SYMBOL(proc_doulongvec_minmax);
2926 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax); 2928 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
2927 EXPORT_SYMBOL(register_sysctl_table); 2929 EXPORT_SYMBOL(register_sysctl_table);
2928 EXPORT_SYMBOL(register_sysctl_paths); 2930 EXPORT_SYMBOL(register_sysctl_paths);
2929 EXPORT_SYMBOL(unregister_sysctl_table); 2931 EXPORT_SYMBOL(unregister_sysctl_table);
2930 2932