diff options
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r-- | kernel/sysctl.c | 983 |
1 files changed, 203 insertions, 780 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 0d949c517412..8686b0f5fc12 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -23,11 +23,11 @@ | |||
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/proc_fs.h> | 27 | #include <linux/proc_fs.h> |
27 | #include <linux/security.h> | 28 | #include <linux/security.h> |
28 | #include <linux/ctype.h> | 29 | #include <linux/ctype.h> |
29 | #include <linux/kmemcheck.h> | 30 | #include <linux/kmemcheck.h> |
30 | #include <linux/smp_lock.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> |
@@ -36,6 +36,7 @@ | |||
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/hugetlb.h> | 40 | #include <linux/hugetlb.h> |
40 | #include <linux/initrd.h> | 41 | #include <linux/initrd.h> |
41 | #include <linux/key.h> | 42 | #include <linux/key.h> |
@@ -50,6 +51,7 @@ | |||
50 | #include <linux/ftrace.h> | 51 | #include <linux/ftrace.h> |
51 | #include <linux/slow-work.h> | 52 | #include <linux/slow-work.h> |
52 | #include <linux/perf_event.h> | 53 | #include <linux/perf_event.h> |
54 | #include <linux/kprobes.h> | ||
53 | 55 | ||
54 | #include <asm/uaccess.h> | 56 | #include <asm/uaccess.h> |
55 | #include <asm/processor.h> | 57 | #include <asm/processor.h> |
@@ -59,14 +61,23 @@ | |||
59 | #include <asm/stacktrace.h> | 61 | #include <asm/stacktrace.h> |
60 | #include <asm/io.h> | 62 | #include <asm/io.h> |
61 | #endif | 63 | #endif |
64 | #ifdef CONFIG_BSD_PROCESS_ACCT | ||
65 | #include <linux/acct.h> | ||
66 | #endif | ||
67 | #ifdef CONFIG_RT_MUTEXES | ||
68 | #include <linux/rtmutex.h> | ||
69 | #endif | ||
70 | #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT) | ||
71 | #include <linux/lockdep.h> | ||
72 | #endif | ||
73 | #ifdef CONFIG_CHR_DEV_SG | ||
74 | #include <scsi/sg.h> | ||
75 | #endif | ||
62 | 76 | ||
63 | static int deprecated_sysctl_warning(struct __sysctl_args *args); | ||
64 | 77 | ||
65 | #if defined(CONFIG_SYSCTL) | 78 | #if defined(CONFIG_SYSCTL) |
66 | 79 | ||
67 | /* External variables not in a header file. */ | 80 | /* External variables not in a header file. */ |
68 | extern int C_A_D; | ||
69 | extern int print_fatal_signals; | ||
70 | extern int sysctl_overcommit_memory; | 81 | extern int sysctl_overcommit_memory; |
71 | extern int sysctl_overcommit_ratio; | 82 | extern int sysctl_overcommit_ratio; |
72 | extern int sysctl_panic_on_oom; | 83 | extern int sysctl_panic_on_oom; |
@@ -88,9 +99,6 @@ extern int sysctl_nr_open_min, sysctl_nr_open_max; | |||
88 | #ifndef CONFIG_MMU | 99 | #ifndef CONFIG_MMU |
89 | extern int sysctl_nr_trim_pages; | 100 | extern int sysctl_nr_trim_pages; |
90 | #endif | 101 | #endif |
91 | #ifdef CONFIG_RCU_TORTURE_TEST | ||
92 | extern int rcutorture_runnable; | ||
93 | #endif /* #ifdef CONFIG_RCU_TORTURE_TEST */ | ||
94 | #ifdef CONFIG_BLOCK | 102 | #ifdef CONFIG_BLOCK |
95 | extern int blk_iopoll_enabled; | 103 | extern int blk_iopoll_enabled; |
96 | #endif | 104 | #endif |
@@ -120,14 +128,6 @@ static int min_percpu_pagelist_fract = 8; | |||
120 | 128 | ||
121 | static int ngroups_max = NGROUPS_MAX; | 129 | static int ngroups_max = NGROUPS_MAX; |
122 | 130 | ||
123 | #ifdef CONFIG_MODULES | ||
124 | extern char modprobe_path[]; | ||
125 | extern int modules_disabled; | ||
126 | #endif | ||
127 | #ifdef CONFIG_CHR_DEV_SG | ||
128 | extern int sg_big_buff; | ||
129 | #endif | ||
130 | |||
131 | #ifdef CONFIG_SPARC | 131 | #ifdef CONFIG_SPARC |
132 | #include <asm/system.h> | 132 | #include <asm/system.h> |
133 | #endif | 133 | #endif |
@@ -149,18 +149,12 @@ extern int sysctl_userprocess_debug; | |||
149 | extern int spin_retry; | 149 | extern int spin_retry; |
150 | #endif | 150 | #endif |
151 | 151 | ||
152 | #ifdef CONFIG_BSD_PROCESS_ACCT | ||
153 | extern int acct_parm[]; | ||
154 | #endif | ||
155 | |||
156 | #ifdef CONFIG_IA64 | 152 | #ifdef CONFIG_IA64 |
157 | extern int no_unaligned_warning; | 153 | extern int no_unaligned_warning; |
158 | extern int unaligned_dump_stack; | 154 | extern int unaligned_dump_stack; |
159 | #endif | 155 | #endif |
160 | 156 | ||
161 | #ifdef CONFIG_RT_MUTEXES | 157 | extern struct ratelimit_state printk_ratelimit_state; |
162 | extern int max_lock_depth; | ||
163 | #endif | ||
164 | 158 | ||
165 | #ifdef CONFIG_PROC_SYSCTL | 159 | #ifdef CONFIG_PROC_SYSCTL |
166 | 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, |
@@ -200,38 +194,30 @@ extern struct ctl_table epoll_table[]; | |||
200 | int sysctl_legacy_va_layout; | 194 | int sysctl_legacy_va_layout; |
201 | #endif | 195 | #endif |
202 | 196 | ||
203 | extern int prove_locking; | ||
204 | extern int lock_stat; | ||
205 | |||
206 | /* The default sysctl tables: */ | 197 | /* The default sysctl tables: */ |
207 | 198 | ||
208 | static struct ctl_table root_table[] = { | 199 | static struct ctl_table root_table[] = { |
209 | { | 200 | { |
210 | .ctl_name = CTL_KERN, | ||
211 | .procname = "kernel", | 201 | .procname = "kernel", |
212 | .mode = 0555, | 202 | .mode = 0555, |
213 | .child = kern_table, | 203 | .child = kern_table, |
214 | }, | 204 | }, |
215 | { | 205 | { |
216 | .ctl_name = CTL_VM, | ||
217 | .procname = "vm", | 206 | .procname = "vm", |
218 | .mode = 0555, | 207 | .mode = 0555, |
219 | .child = vm_table, | 208 | .child = vm_table, |
220 | }, | 209 | }, |
221 | { | 210 | { |
222 | .ctl_name = CTL_FS, | ||
223 | .procname = "fs", | 211 | .procname = "fs", |
224 | .mode = 0555, | 212 | .mode = 0555, |
225 | .child = fs_table, | 213 | .child = fs_table, |
226 | }, | 214 | }, |
227 | { | 215 | { |
228 | .ctl_name = CTL_DEBUG, | ||
229 | .procname = "debug", | 216 | .procname = "debug", |
230 | .mode = 0555, | 217 | .mode = 0555, |
231 | .child = debug_table, | 218 | .child = debug_table, |
232 | }, | 219 | }, |
233 | { | 220 | { |
234 | .ctl_name = CTL_DEV, | ||
235 | .procname = "dev", | 221 | .procname = "dev", |
236 | .mode = 0555, | 222 | .mode = 0555, |
237 | .child = dev_table, | 223 | .child = dev_table, |
@@ -240,7 +226,7 @@ static struct ctl_table root_table[] = { | |||
240 | * NOTE: do not add new entries to this table unless you have read | 226 | * NOTE: do not add new entries to this table unless you have read |
241 | * Documentation/sysctl/ctl_unnumbered.txt | 227 | * Documentation/sysctl/ctl_unnumbered.txt |
242 | */ | 228 | */ |
243 | { .ctl_name = 0 } | 229 | { } |
244 | }; | 230 | }; |
245 | 231 | ||
246 | #ifdef CONFIG_SCHED_DEBUG | 232 | #ifdef CONFIG_SCHED_DEBUG |
@@ -248,196 +234,178 @@ static int min_sched_granularity_ns = 100000; /* 100 usecs */ | |||
248 | static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */ | 234 | static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */ |
249 | static int min_wakeup_granularity_ns; /* 0 usecs */ | 235 | static int min_wakeup_granularity_ns; /* 0 usecs */ |
250 | static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */ | 236 | static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */ |
237 | static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE; | ||
238 | static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1; | ||
239 | static int min_sched_shares_ratelimit = 100000; /* 100 usec */ | ||
240 | static int max_sched_shares_ratelimit = NSEC_PER_SEC; /* 1 second */ | ||
251 | #endif | 241 | #endif |
252 | 242 | ||
253 | static struct ctl_table kern_table[] = { | 243 | static struct ctl_table kern_table[] = { |
254 | { | 244 | { |
255 | .ctl_name = CTL_UNNUMBERED, | ||
256 | .procname = "sched_child_runs_first", | 245 | .procname = "sched_child_runs_first", |
257 | .data = &sysctl_sched_child_runs_first, | 246 | .data = &sysctl_sched_child_runs_first, |
258 | .maxlen = sizeof(unsigned int), | 247 | .maxlen = sizeof(unsigned int), |
259 | .mode = 0644, | 248 | .mode = 0644, |
260 | .proc_handler = &proc_dointvec, | 249 | .proc_handler = proc_dointvec, |
261 | }, | 250 | }, |
262 | #ifdef CONFIG_SCHED_DEBUG | 251 | #ifdef CONFIG_SCHED_DEBUG |
263 | { | 252 | { |
264 | .ctl_name = CTL_UNNUMBERED, | ||
265 | .procname = "sched_min_granularity_ns", | 253 | .procname = "sched_min_granularity_ns", |
266 | .data = &sysctl_sched_min_granularity, | 254 | .data = &sysctl_sched_min_granularity, |
267 | .maxlen = sizeof(unsigned int), | 255 | .maxlen = sizeof(unsigned int), |
268 | .mode = 0644, | 256 | .mode = 0644, |
269 | .proc_handler = &sched_nr_latency_handler, | 257 | .proc_handler = sched_proc_update_handler, |
270 | .strategy = &sysctl_intvec, | ||
271 | .extra1 = &min_sched_granularity_ns, | 258 | .extra1 = &min_sched_granularity_ns, |
272 | .extra2 = &max_sched_granularity_ns, | 259 | .extra2 = &max_sched_granularity_ns, |
273 | }, | 260 | }, |
274 | { | 261 | { |
275 | .ctl_name = CTL_UNNUMBERED, | ||
276 | .procname = "sched_latency_ns", | 262 | .procname = "sched_latency_ns", |
277 | .data = &sysctl_sched_latency, | 263 | .data = &sysctl_sched_latency, |
278 | .maxlen = sizeof(unsigned int), | 264 | .maxlen = sizeof(unsigned int), |
279 | .mode = 0644, | 265 | .mode = 0644, |
280 | .proc_handler = &sched_nr_latency_handler, | 266 | .proc_handler = sched_proc_update_handler, |
281 | .strategy = &sysctl_intvec, | ||
282 | .extra1 = &min_sched_granularity_ns, | 267 | .extra1 = &min_sched_granularity_ns, |
283 | .extra2 = &max_sched_granularity_ns, | 268 | .extra2 = &max_sched_granularity_ns, |
284 | }, | 269 | }, |
285 | { | 270 | { |
286 | .ctl_name = CTL_UNNUMBERED, | ||
287 | .procname = "sched_wakeup_granularity_ns", | 271 | .procname = "sched_wakeup_granularity_ns", |
288 | .data = &sysctl_sched_wakeup_granularity, | 272 | .data = &sysctl_sched_wakeup_granularity, |
289 | .maxlen = sizeof(unsigned int), | 273 | .maxlen = sizeof(unsigned int), |
290 | .mode = 0644, | 274 | .mode = 0644, |
291 | .proc_handler = &proc_dointvec_minmax, | 275 | .proc_handler = sched_proc_update_handler, |
292 | .strategy = &sysctl_intvec, | ||
293 | .extra1 = &min_wakeup_granularity_ns, | 276 | .extra1 = &min_wakeup_granularity_ns, |
294 | .extra2 = &max_wakeup_granularity_ns, | 277 | .extra2 = &max_wakeup_granularity_ns, |
295 | }, | 278 | }, |
296 | { | 279 | { |
297 | .ctl_name = CTL_UNNUMBERED, | ||
298 | .procname = "sched_shares_ratelimit", | 280 | .procname = "sched_shares_ratelimit", |
299 | .data = &sysctl_sched_shares_ratelimit, | 281 | .data = &sysctl_sched_shares_ratelimit, |
300 | .maxlen = sizeof(unsigned int), | 282 | .maxlen = sizeof(unsigned int), |
301 | .mode = 0644, | 283 | .mode = 0644, |
302 | .proc_handler = &proc_dointvec, | 284 | .proc_handler = sched_proc_update_handler, |
285 | .extra1 = &min_sched_shares_ratelimit, | ||
286 | .extra2 = &max_sched_shares_ratelimit, | ||
303 | }, | 287 | }, |
304 | { | 288 | { |
305 | .ctl_name = CTL_UNNUMBERED, | 289 | .procname = "sched_tunable_scaling", |
306 | .procname = "sched_shares_thresh", | 290 | .data = &sysctl_sched_tunable_scaling, |
307 | .data = &sysctl_sched_shares_thresh, | 291 | .maxlen = sizeof(enum sched_tunable_scaling), |
308 | .maxlen = sizeof(unsigned int), | ||
309 | .mode = 0644, | 292 | .mode = 0644, |
310 | .proc_handler = &proc_dointvec_minmax, | 293 | .proc_handler = sched_proc_update_handler, |
311 | .strategy = &sysctl_intvec, | 294 | .extra1 = &min_sched_tunable_scaling, |
312 | .extra1 = &zero, | 295 | .extra2 = &max_sched_tunable_scaling, |
313 | }, | 296 | }, |
314 | { | 297 | { |
315 | .ctl_name = CTL_UNNUMBERED, | 298 | .procname = "sched_shares_thresh", |
316 | .procname = "sched_features", | 299 | .data = &sysctl_sched_shares_thresh, |
317 | .data = &sysctl_sched_features, | ||
318 | .maxlen = sizeof(unsigned int), | 300 | .maxlen = sizeof(unsigned int), |
319 | .mode = 0644, | 301 | .mode = 0644, |
320 | .proc_handler = &proc_dointvec, | 302 | .proc_handler = proc_dointvec_minmax, |
303 | .extra1 = &zero, | ||
321 | }, | 304 | }, |
322 | { | 305 | { |
323 | .ctl_name = CTL_UNNUMBERED, | ||
324 | .procname = "sched_migration_cost", | 306 | .procname = "sched_migration_cost", |
325 | .data = &sysctl_sched_migration_cost, | 307 | .data = &sysctl_sched_migration_cost, |
326 | .maxlen = sizeof(unsigned int), | 308 | .maxlen = sizeof(unsigned int), |
327 | .mode = 0644, | 309 | .mode = 0644, |
328 | .proc_handler = &proc_dointvec, | 310 | .proc_handler = proc_dointvec, |
329 | }, | 311 | }, |
330 | { | 312 | { |
331 | .ctl_name = CTL_UNNUMBERED, | ||
332 | .procname = "sched_nr_migrate", | 313 | .procname = "sched_nr_migrate", |
333 | .data = &sysctl_sched_nr_migrate, | 314 | .data = &sysctl_sched_nr_migrate, |
334 | .maxlen = sizeof(unsigned int), | 315 | .maxlen = sizeof(unsigned int), |
335 | .mode = 0644, | 316 | .mode = 0644, |
336 | .proc_handler = &proc_dointvec, | 317 | .proc_handler = proc_dointvec, |
337 | }, | 318 | }, |
338 | { | 319 | { |
339 | .ctl_name = CTL_UNNUMBERED, | ||
340 | .procname = "sched_time_avg", | 320 | .procname = "sched_time_avg", |
341 | .data = &sysctl_sched_time_avg, | 321 | .data = &sysctl_sched_time_avg, |
342 | .maxlen = sizeof(unsigned int), | 322 | .maxlen = sizeof(unsigned int), |
343 | .mode = 0644, | 323 | .mode = 0644, |
344 | .proc_handler = &proc_dointvec, | 324 | .proc_handler = proc_dointvec, |
345 | }, | 325 | }, |
346 | { | 326 | { |
347 | .ctl_name = CTL_UNNUMBERED, | ||
348 | .procname = "timer_migration", | 327 | .procname = "timer_migration", |
349 | .data = &sysctl_timer_migration, | 328 | .data = &sysctl_timer_migration, |
350 | .maxlen = sizeof(unsigned int), | 329 | .maxlen = sizeof(unsigned int), |
351 | .mode = 0644, | 330 | .mode = 0644, |
352 | .proc_handler = &proc_dointvec_minmax, | 331 | .proc_handler = proc_dointvec_minmax, |
353 | .strategy = &sysctl_intvec, | ||
354 | .extra1 = &zero, | 332 | .extra1 = &zero, |
355 | .extra2 = &one, | 333 | .extra2 = &one, |
356 | }, | 334 | }, |
357 | #endif | 335 | #endif |
358 | { | 336 | { |
359 | .ctl_name = CTL_UNNUMBERED, | ||
360 | .procname = "sched_rt_period_us", | 337 | .procname = "sched_rt_period_us", |
361 | .data = &sysctl_sched_rt_period, | 338 | .data = &sysctl_sched_rt_period, |
362 | .maxlen = sizeof(unsigned int), | 339 | .maxlen = sizeof(unsigned int), |
363 | .mode = 0644, | 340 | .mode = 0644, |
364 | .proc_handler = &sched_rt_handler, | 341 | .proc_handler = sched_rt_handler, |
365 | }, | 342 | }, |
366 | { | 343 | { |
367 | .ctl_name = CTL_UNNUMBERED, | ||
368 | .procname = "sched_rt_runtime_us", | 344 | .procname = "sched_rt_runtime_us", |
369 | .data = &sysctl_sched_rt_runtime, | 345 | .data = &sysctl_sched_rt_runtime, |
370 | .maxlen = sizeof(int), | 346 | .maxlen = sizeof(int), |
371 | .mode = 0644, | 347 | .mode = 0644, |
372 | .proc_handler = &sched_rt_handler, | 348 | .proc_handler = sched_rt_handler, |
373 | }, | 349 | }, |
374 | { | 350 | { |
375 | .ctl_name = CTL_UNNUMBERED, | ||
376 | .procname = "sched_compat_yield", | 351 | .procname = "sched_compat_yield", |
377 | .data = &sysctl_sched_compat_yield, | 352 | .data = &sysctl_sched_compat_yield, |
378 | .maxlen = sizeof(unsigned int), | 353 | .maxlen = sizeof(unsigned int), |
379 | .mode = 0644, | 354 | .mode = 0644, |
380 | .proc_handler = &proc_dointvec, | 355 | .proc_handler = proc_dointvec, |
381 | }, | 356 | }, |
382 | #ifdef CONFIG_PROVE_LOCKING | 357 | #ifdef CONFIG_PROVE_LOCKING |
383 | { | 358 | { |
384 | .ctl_name = CTL_UNNUMBERED, | ||
385 | .procname = "prove_locking", | 359 | .procname = "prove_locking", |
386 | .data = &prove_locking, | 360 | .data = &prove_locking, |
387 | .maxlen = sizeof(int), | 361 | .maxlen = sizeof(int), |
388 | .mode = 0644, | 362 | .mode = 0644, |
389 | .proc_handler = &proc_dointvec, | 363 | .proc_handler = proc_dointvec, |
390 | }, | 364 | }, |
391 | #endif | 365 | #endif |
392 | #ifdef CONFIG_LOCK_STAT | 366 | #ifdef CONFIG_LOCK_STAT |
393 | { | 367 | { |
394 | .ctl_name = CTL_UNNUMBERED, | ||
395 | .procname = "lock_stat", | 368 | .procname = "lock_stat", |
396 | .data = &lock_stat, | 369 | .data = &lock_stat, |
397 | .maxlen = sizeof(int), | 370 | .maxlen = sizeof(int), |
398 | .mode = 0644, | 371 | .mode = 0644, |
399 | .proc_handler = &proc_dointvec, | 372 | .proc_handler = proc_dointvec, |
400 | }, | 373 | }, |
401 | #endif | 374 | #endif |
402 | { | 375 | { |
403 | .ctl_name = KERN_PANIC, | ||
404 | .procname = "panic", | 376 | .procname = "panic", |
405 | .data = &panic_timeout, | 377 | .data = &panic_timeout, |
406 | .maxlen = sizeof(int), | 378 | .maxlen = sizeof(int), |
407 | .mode = 0644, | 379 | .mode = 0644, |
408 | .proc_handler = &proc_dointvec, | 380 | .proc_handler = proc_dointvec, |
409 | }, | 381 | }, |
410 | { | 382 | { |
411 | .ctl_name = KERN_CORE_USES_PID, | ||
412 | .procname = "core_uses_pid", | 383 | .procname = "core_uses_pid", |
413 | .data = &core_uses_pid, | 384 | .data = &core_uses_pid, |
414 | .maxlen = sizeof(int), | 385 | .maxlen = sizeof(int), |
415 | .mode = 0644, | 386 | .mode = 0644, |
416 | .proc_handler = &proc_dointvec, | 387 | .proc_handler = proc_dointvec, |
417 | }, | 388 | }, |
418 | { | 389 | { |
419 | .ctl_name = KERN_CORE_PATTERN, | ||
420 | .procname = "core_pattern", | 390 | .procname = "core_pattern", |
421 | .data = core_pattern, | 391 | .data = core_pattern, |
422 | .maxlen = CORENAME_MAX_SIZE, | 392 | .maxlen = CORENAME_MAX_SIZE, |
423 | .mode = 0644, | 393 | .mode = 0644, |
424 | .proc_handler = &proc_dostring, | 394 | .proc_handler = proc_dostring, |
425 | .strategy = &sysctl_string, | ||
426 | }, | 395 | }, |
427 | { | 396 | { |
428 | .ctl_name = CTL_UNNUMBERED, | ||
429 | .procname = "core_pipe_limit", | 397 | .procname = "core_pipe_limit", |
430 | .data = &core_pipe_limit, | 398 | .data = &core_pipe_limit, |
431 | .maxlen = sizeof(unsigned int), | 399 | .maxlen = sizeof(unsigned int), |
432 | .mode = 0644, | 400 | .mode = 0644, |
433 | .proc_handler = &proc_dointvec, | 401 | .proc_handler = proc_dointvec, |
434 | }, | 402 | }, |
435 | #ifdef CONFIG_PROC_SYSCTL | 403 | #ifdef CONFIG_PROC_SYSCTL |
436 | { | 404 | { |
437 | .procname = "tainted", | 405 | .procname = "tainted", |
438 | .maxlen = sizeof(long), | 406 | .maxlen = sizeof(long), |
439 | .mode = 0644, | 407 | .mode = 0644, |
440 | .proc_handler = &proc_taint, | 408 | .proc_handler = proc_taint, |
441 | }, | 409 | }, |
442 | #endif | 410 | #endif |
443 | #ifdef CONFIG_LATENCYTOP | 411 | #ifdef CONFIG_LATENCYTOP |
@@ -446,181 +414,160 @@ static struct ctl_table kern_table[] = { | |||
446 | .data = &latencytop_enabled, | 414 | .data = &latencytop_enabled, |
447 | .maxlen = sizeof(int), | 415 | .maxlen = sizeof(int), |
448 | .mode = 0644, | 416 | .mode = 0644, |
449 | .proc_handler = &proc_dointvec, | 417 | .proc_handler = proc_dointvec, |
450 | }, | 418 | }, |
451 | #endif | 419 | #endif |
452 | #ifdef CONFIG_BLK_DEV_INITRD | 420 | #ifdef CONFIG_BLK_DEV_INITRD |
453 | { | 421 | { |
454 | .ctl_name = KERN_REALROOTDEV, | ||
455 | .procname = "real-root-dev", | 422 | .procname = "real-root-dev", |
456 | .data = &real_root_dev, | 423 | .data = &real_root_dev, |
457 | .maxlen = sizeof(int), | 424 | .maxlen = sizeof(int), |
458 | .mode = 0644, | 425 | .mode = 0644, |
459 | .proc_handler = &proc_dointvec, | 426 | .proc_handler = proc_dointvec, |
460 | }, | 427 | }, |
461 | #endif | 428 | #endif |
462 | { | 429 | { |
463 | .ctl_name = CTL_UNNUMBERED, | ||
464 | .procname = "print-fatal-signals", | 430 | .procname = "print-fatal-signals", |
465 | .data = &print_fatal_signals, | 431 | .data = &print_fatal_signals, |
466 | .maxlen = sizeof(int), | 432 | .maxlen = sizeof(int), |
467 | .mode = 0644, | 433 | .mode = 0644, |
468 | .proc_handler = &proc_dointvec, | 434 | .proc_handler = proc_dointvec, |
469 | }, | 435 | }, |
470 | #ifdef CONFIG_SPARC | 436 | #ifdef CONFIG_SPARC |
471 | { | 437 | { |
472 | .ctl_name = KERN_SPARC_REBOOT, | ||
473 | .procname = "reboot-cmd", | 438 | .procname = "reboot-cmd", |
474 | .data = reboot_command, | 439 | .data = reboot_command, |
475 | .maxlen = 256, | 440 | .maxlen = 256, |
476 | .mode = 0644, | 441 | .mode = 0644, |
477 | .proc_handler = &proc_dostring, | 442 | .proc_handler = proc_dostring, |
478 | .strategy = &sysctl_string, | ||
479 | }, | 443 | }, |
480 | { | 444 | { |
481 | .ctl_name = KERN_SPARC_STOP_A, | ||
482 | .procname = "stop-a", | 445 | .procname = "stop-a", |
483 | .data = &stop_a_enabled, | 446 | .data = &stop_a_enabled, |
484 | .maxlen = sizeof (int), | 447 | .maxlen = sizeof (int), |
485 | .mode = 0644, | 448 | .mode = 0644, |
486 | .proc_handler = &proc_dointvec, | 449 | .proc_handler = proc_dointvec, |
487 | }, | 450 | }, |
488 | { | 451 | { |
489 | .ctl_name = KERN_SPARC_SCONS_PWROFF, | ||
490 | .procname = "scons-poweroff", | 452 | .procname = "scons-poweroff", |
491 | .data = &scons_pwroff, | 453 | .data = &scons_pwroff, |
492 | .maxlen = sizeof (int), | 454 | .maxlen = sizeof (int), |
493 | .mode = 0644, | 455 | .mode = 0644, |
494 | .proc_handler = &proc_dointvec, | 456 | .proc_handler = proc_dointvec, |
495 | }, | 457 | }, |
496 | #endif | 458 | #endif |
497 | #ifdef CONFIG_SPARC64 | 459 | #ifdef CONFIG_SPARC64 |
498 | { | 460 | { |
499 | .ctl_name = CTL_UNNUMBERED, | ||
500 | .procname = "tsb-ratio", | 461 | .procname = "tsb-ratio", |
501 | .data = &sysctl_tsb_ratio, | 462 | .data = &sysctl_tsb_ratio, |
502 | .maxlen = sizeof (int), | 463 | .maxlen = sizeof (int), |
503 | .mode = 0644, | 464 | .mode = 0644, |
504 | .proc_handler = &proc_dointvec, | 465 | .proc_handler = proc_dointvec, |
505 | }, | 466 | }, |
506 | #endif | 467 | #endif |
507 | #ifdef __hppa__ | 468 | #ifdef __hppa__ |
508 | { | 469 | { |
509 | .ctl_name = KERN_HPPA_PWRSW, | ||
510 | .procname = "soft-power", | 470 | .procname = "soft-power", |
511 | .data = &pwrsw_enabled, | 471 | .data = &pwrsw_enabled, |
512 | .maxlen = sizeof (int), | 472 | .maxlen = sizeof (int), |
513 | .mode = 0644, | 473 | .mode = 0644, |
514 | .proc_handler = &proc_dointvec, | 474 | .proc_handler = proc_dointvec, |
515 | }, | 475 | }, |
516 | { | 476 | { |
517 | .ctl_name = KERN_HPPA_UNALIGNED, | ||
518 | .procname = "unaligned-trap", | 477 | .procname = "unaligned-trap", |
519 | .data = &unaligned_enabled, | 478 | .data = &unaligned_enabled, |
520 | .maxlen = sizeof (int), | 479 | .maxlen = sizeof (int), |
521 | .mode = 0644, | 480 | .mode = 0644, |
522 | .proc_handler = &proc_dointvec, | 481 | .proc_handler = proc_dointvec, |
523 | }, | 482 | }, |
524 | #endif | 483 | #endif |
525 | { | 484 | { |
526 | .ctl_name = KERN_CTLALTDEL, | ||
527 | .procname = "ctrl-alt-del", | 485 | .procname = "ctrl-alt-del", |
528 | .data = &C_A_D, | 486 | .data = &C_A_D, |
529 | .maxlen = sizeof(int), | 487 | .maxlen = sizeof(int), |
530 | .mode = 0644, | 488 | .mode = 0644, |
531 | .proc_handler = &proc_dointvec, | 489 | .proc_handler = proc_dointvec, |
532 | }, | 490 | }, |
533 | #ifdef CONFIG_FUNCTION_TRACER | 491 | #ifdef CONFIG_FUNCTION_TRACER |
534 | { | 492 | { |
535 | .ctl_name = CTL_UNNUMBERED, | ||
536 | .procname = "ftrace_enabled", | 493 | .procname = "ftrace_enabled", |
537 | .data = &ftrace_enabled, | 494 | .data = &ftrace_enabled, |
538 | .maxlen = sizeof(int), | 495 | .maxlen = sizeof(int), |
539 | .mode = 0644, | 496 | .mode = 0644, |
540 | .proc_handler = &ftrace_enable_sysctl, | 497 | .proc_handler = ftrace_enable_sysctl, |
541 | }, | 498 | }, |
542 | #endif | 499 | #endif |
543 | #ifdef CONFIG_STACK_TRACER | 500 | #ifdef CONFIG_STACK_TRACER |
544 | { | 501 | { |
545 | .ctl_name = CTL_UNNUMBERED, | ||
546 | .procname = "stack_tracer_enabled", | 502 | .procname = "stack_tracer_enabled", |
547 | .data = &stack_tracer_enabled, | 503 | .data = &stack_tracer_enabled, |
548 | .maxlen = sizeof(int), | 504 | .maxlen = sizeof(int), |
549 | .mode = 0644, | 505 | .mode = 0644, |
550 | .proc_handler = &stack_trace_sysctl, | 506 | .proc_handler = stack_trace_sysctl, |
551 | }, | 507 | }, |
552 | #endif | 508 | #endif |
553 | #ifdef CONFIG_TRACING | 509 | #ifdef CONFIG_TRACING |
554 | { | 510 | { |
555 | .ctl_name = CTL_UNNUMBERED, | ||
556 | .procname = "ftrace_dump_on_oops", | 511 | .procname = "ftrace_dump_on_oops", |
557 | .data = &ftrace_dump_on_oops, | 512 | .data = &ftrace_dump_on_oops, |
558 | .maxlen = sizeof(int), | 513 | .maxlen = sizeof(int), |
559 | .mode = 0644, | 514 | .mode = 0644, |
560 | .proc_handler = &proc_dointvec, | 515 | .proc_handler = proc_dointvec, |
561 | }, | 516 | }, |
562 | #endif | 517 | #endif |
563 | #ifdef CONFIG_MODULES | 518 | #ifdef CONFIG_MODULES |
564 | { | 519 | { |
565 | .ctl_name = KERN_MODPROBE, | ||
566 | .procname = "modprobe", | 520 | .procname = "modprobe", |
567 | .data = &modprobe_path, | 521 | .data = &modprobe_path, |
568 | .maxlen = KMOD_PATH_LEN, | 522 | .maxlen = KMOD_PATH_LEN, |
569 | .mode = 0644, | 523 | .mode = 0644, |
570 | .proc_handler = &proc_dostring, | 524 | .proc_handler = proc_dostring, |
571 | .strategy = &sysctl_string, | ||
572 | }, | 525 | }, |
573 | { | 526 | { |
574 | .ctl_name = CTL_UNNUMBERED, | ||
575 | .procname = "modules_disabled", | 527 | .procname = "modules_disabled", |
576 | .data = &modules_disabled, | 528 | .data = &modules_disabled, |
577 | .maxlen = sizeof(int), | 529 | .maxlen = sizeof(int), |
578 | .mode = 0644, | 530 | .mode = 0644, |
579 | /* only handle a transition from default "0" to "1" */ | 531 | /* only handle a transition from default "0" to "1" */ |
580 | .proc_handler = &proc_dointvec_minmax, | 532 | .proc_handler = proc_dointvec_minmax, |
581 | .extra1 = &one, | 533 | .extra1 = &one, |
582 | .extra2 = &one, | 534 | .extra2 = &one, |
583 | }, | 535 | }, |
584 | #endif | 536 | #endif |
585 | #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) | 537 | #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) |
586 | { | 538 | { |
587 | .ctl_name = KERN_HOTPLUG, | ||
588 | .procname = "hotplug", | 539 | .procname = "hotplug", |
589 | .data = &uevent_helper, | 540 | .data = &uevent_helper, |
590 | .maxlen = UEVENT_HELPER_PATH_LEN, | 541 | .maxlen = UEVENT_HELPER_PATH_LEN, |
591 | .mode = 0644, | 542 | .mode = 0644, |
592 | .proc_handler = &proc_dostring, | 543 | .proc_handler = proc_dostring, |
593 | .strategy = &sysctl_string, | ||
594 | }, | 544 | }, |
595 | #endif | 545 | #endif |
596 | #ifdef CONFIG_CHR_DEV_SG | 546 | #ifdef CONFIG_CHR_DEV_SG |
597 | { | 547 | { |
598 | .ctl_name = KERN_SG_BIG_BUFF, | ||
599 | .procname = "sg-big-buff", | 548 | .procname = "sg-big-buff", |
600 | .data = &sg_big_buff, | 549 | .data = &sg_big_buff, |
601 | .maxlen = sizeof (int), | 550 | .maxlen = sizeof (int), |
602 | .mode = 0444, | 551 | .mode = 0444, |
603 | .proc_handler = &proc_dointvec, | 552 | .proc_handler = proc_dointvec, |
604 | }, | 553 | }, |
605 | #endif | 554 | #endif |
606 | #ifdef CONFIG_BSD_PROCESS_ACCT | 555 | #ifdef CONFIG_BSD_PROCESS_ACCT |
607 | { | 556 | { |
608 | .ctl_name = KERN_ACCT, | ||
609 | .procname = "acct", | 557 | .procname = "acct", |
610 | .data = &acct_parm, | 558 | .data = &acct_parm, |
611 | .maxlen = 3*sizeof(int), | 559 | .maxlen = 3*sizeof(int), |
612 | .mode = 0644, | 560 | .mode = 0644, |
613 | .proc_handler = &proc_dointvec, | 561 | .proc_handler = proc_dointvec, |
614 | }, | 562 | }, |
615 | #endif | 563 | #endif |
616 | #ifdef CONFIG_MAGIC_SYSRQ | 564 | #ifdef CONFIG_MAGIC_SYSRQ |
617 | { | 565 | { |
618 | .ctl_name = KERN_SYSRQ, | ||
619 | .procname = "sysrq", | 566 | .procname = "sysrq", |
620 | .data = &__sysrq_enabled, | 567 | .data = &__sysrq_enabled, |
621 | .maxlen = sizeof (int), | 568 | .maxlen = sizeof (int), |
622 | .mode = 0644, | 569 | .mode = 0644, |
623 | .proc_handler = &proc_dointvec, | 570 | .proc_handler = proc_dointvec, |
624 | }, | 571 | }, |
625 | #endif | 572 | #endif |
626 | #ifdef CONFIG_PROC_SYSCTL | 573 | #ifdef CONFIG_PROC_SYSCTL |
@@ -629,215 +576,188 @@ static struct ctl_table kern_table[] = { | |||
629 | .data = NULL, | 576 | .data = NULL, |
630 | .maxlen = sizeof (int), | 577 | .maxlen = sizeof (int), |
631 | .mode = 0600, | 578 | .mode = 0600, |
632 | .proc_handler = &proc_do_cad_pid, | 579 | .proc_handler = proc_do_cad_pid, |
633 | }, | 580 | }, |
634 | #endif | 581 | #endif |
635 | { | 582 | { |
636 | .ctl_name = KERN_MAX_THREADS, | ||
637 | .procname = "threads-max", | 583 | .procname = "threads-max", |
638 | .data = &max_threads, | 584 | .data = &max_threads, |
639 | .maxlen = sizeof(int), | 585 | .maxlen = sizeof(int), |
640 | .mode = 0644, | 586 | .mode = 0644, |
641 | .proc_handler = &proc_dointvec, | 587 | .proc_handler = proc_dointvec, |
642 | }, | 588 | }, |
643 | { | 589 | { |
644 | .ctl_name = KERN_RANDOM, | ||
645 | .procname = "random", | 590 | .procname = "random", |
646 | .mode = 0555, | 591 | .mode = 0555, |
647 | .child = random_table, | 592 | .child = random_table, |
648 | }, | 593 | }, |
649 | { | 594 | { |
650 | .ctl_name = KERN_OVERFLOWUID, | ||
651 | .procname = "overflowuid", | 595 | .procname = "overflowuid", |
652 | .data = &overflowuid, | 596 | .data = &overflowuid, |
653 | .maxlen = sizeof(int), | 597 | .maxlen = sizeof(int), |
654 | .mode = 0644, | 598 | .mode = 0644, |
655 | .proc_handler = &proc_dointvec_minmax, | 599 | .proc_handler = proc_dointvec_minmax, |
656 | .strategy = &sysctl_intvec, | ||
657 | .extra1 = &minolduid, | 600 | .extra1 = &minolduid, |
658 | .extra2 = &maxolduid, | 601 | .extra2 = &maxolduid, |
659 | }, | 602 | }, |
660 | { | 603 | { |
661 | .ctl_name = KERN_OVERFLOWGID, | ||
662 | .procname = "overflowgid", | 604 | .procname = "overflowgid", |
663 | .data = &overflowgid, | 605 | .data = &overflowgid, |
664 | .maxlen = sizeof(int), | 606 | .maxlen = sizeof(int), |
665 | .mode = 0644, | 607 | .mode = 0644, |
666 | .proc_handler = &proc_dointvec_minmax, | 608 | .proc_handler = proc_dointvec_minmax, |
667 | .strategy = &sysctl_intvec, | ||
668 | .extra1 = &minolduid, | 609 | .extra1 = &minolduid, |
669 | .extra2 = &maxolduid, | 610 | .extra2 = &maxolduid, |
670 | }, | 611 | }, |
671 | #ifdef CONFIG_S390 | 612 | #ifdef CONFIG_S390 |
672 | #ifdef CONFIG_MATHEMU | 613 | #ifdef CONFIG_MATHEMU |
673 | { | 614 | { |
674 | .ctl_name = KERN_IEEE_EMULATION_WARNINGS, | ||
675 | .procname = "ieee_emulation_warnings", | 615 | .procname = "ieee_emulation_warnings", |
676 | .data = &sysctl_ieee_emulation_warnings, | 616 | .data = &sysctl_ieee_emulation_warnings, |
677 | .maxlen = sizeof(int), | 617 | .maxlen = sizeof(int), |
678 | .mode = 0644, | 618 | .mode = 0644, |
679 | .proc_handler = &proc_dointvec, | 619 | .proc_handler = proc_dointvec, |
680 | }, | 620 | }, |
681 | #endif | 621 | #endif |
682 | { | 622 | { |
683 | .ctl_name = KERN_S390_USER_DEBUG_LOGGING, | ||
684 | .procname = "userprocess_debug", | 623 | .procname = "userprocess_debug", |
685 | .data = &sysctl_userprocess_debug, | 624 | .data = &sysctl_userprocess_debug, |
686 | .maxlen = sizeof(int), | 625 | .maxlen = sizeof(int), |
687 | .mode = 0644, | 626 | .mode = 0644, |
688 | .proc_handler = &proc_dointvec, | 627 | .proc_handler = proc_dointvec, |
689 | }, | 628 | }, |
690 | #endif | 629 | #endif |
691 | { | 630 | { |
692 | .ctl_name = KERN_PIDMAX, | ||
693 | .procname = "pid_max", | 631 | .procname = "pid_max", |
694 | .data = &pid_max, | 632 | .data = &pid_max, |
695 | .maxlen = sizeof (int), | 633 | .maxlen = sizeof (int), |
696 | .mode = 0644, | 634 | .mode = 0644, |
697 | .proc_handler = &proc_dointvec_minmax, | 635 | .proc_handler = proc_dointvec_minmax, |
698 | .strategy = sysctl_intvec, | ||
699 | .extra1 = &pid_max_min, | 636 | .extra1 = &pid_max_min, |
700 | .extra2 = &pid_max_max, | 637 | .extra2 = &pid_max_max, |
701 | }, | 638 | }, |
702 | { | 639 | { |
703 | .ctl_name = KERN_PANIC_ON_OOPS, | ||
704 | .procname = "panic_on_oops", | 640 | .procname = "panic_on_oops", |
705 | .data = &panic_on_oops, | 641 | .data = &panic_on_oops, |
706 | .maxlen = sizeof(int), | 642 | .maxlen = sizeof(int), |
707 | .mode = 0644, | 643 | .mode = 0644, |
708 | .proc_handler = &proc_dointvec, | 644 | .proc_handler = proc_dointvec, |
709 | }, | 645 | }, |
710 | #if defined CONFIG_PRINTK | 646 | #if defined CONFIG_PRINTK |
711 | { | 647 | { |
712 | .ctl_name = KERN_PRINTK, | ||
713 | .procname = "printk", | 648 | .procname = "printk", |
714 | .data = &console_loglevel, | 649 | .data = &console_loglevel, |
715 | .maxlen = 4*sizeof(int), | 650 | .maxlen = 4*sizeof(int), |
716 | .mode = 0644, | 651 | .mode = 0644, |
717 | .proc_handler = &proc_dointvec, | 652 | .proc_handler = proc_dointvec, |
718 | }, | 653 | }, |
719 | { | 654 | { |
720 | .ctl_name = KERN_PRINTK_RATELIMIT, | ||
721 | .procname = "printk_ratelimit", | 655 | .procname = "printk_ratelimit", |
722 | .data = &printk_ratelimit_state.interval, | 656 | .data = &printk_ratelimit_state.interval, |
723 | .maxlen = sizeof(int), | 657 | .maxlen = sizeof(int), |
724 | .mode = 0644, | 658 | .mode = 0644, |
725 | .proc_handler = &proc_dointvec_jiffies, | 659 | .proc_handler = proc_dointvec_jiffies, |
726 | .strategy = &sysctl_jiffies, | ||
727 | }, | 660 | }, |
728 | { | 661 | { |
729 | .ctl_name = KERN_PRINTK_RATELIMIT_BURST, | ||
730 | .procname = "printk_ratelimit_burst", | 662 | .procname = "printk_ratelimit_burst", |
731 | .data = &printk_ratelimit_state.burst, | 663 | .data = &printk_ratelimit_state.burst, |
732 | .maxlen = sizeof(int), | 664 | .maxlen = sizeof(int), |
733 | .mode = 0644, | 665 | .mode = 0644, |
734 | .proc_handler = &proc_dointvec, | 666 | .proc_handler = proc_dointvec, |
735 | }, | 667 | }, |
736 | { | 668 | { |
737 | .ctl_name = CTL_UNNUMBERED, | ||
738 | .procname = "printk_delay", | 669 | .procname = "printk_delay", |
739 | .data = &printk_delay_msec, | 670 | .data = &printk_delay_msec, |
740 | .maxlen = sizeof(int), | 671 | .maxlen = sizeof(int), |
741 | .mode = 0644, | 672 | .mode = 0644, |
742 | .proc_handler = &proc_dointvec_minmax, | 673 | .proc_handler = proc_dointvec_minmax, |
743 | .strategy = &sysctl_intvec, | ||
744 | .extra1 = &zero, | 674 | .extra1 = &zero, |
745 | .extra2 = &ten_thousand, | 675 | .extra2 = &ten_thousand, |
746 | }, | 676 | }, |
747 | #endif | 677 | #endif |
748 | { | 678 | { |
749 | .ctl_name = KERN_NGROUPS_MAX, | ||
750 | .procname = "ngroups_max", | 679 | .procname = "ngroups_max", |
751 | .data = &ngroups_max, | 680 | .data = &ngroups_max, |
752 | .maxlen = sizeof (int), | 681 | .maxlen = sizeof (int), |
753 | .mode = 0444, | 682 | .mode = 0444, |
754 | .proc_handler = &proc_dointvec, | 683 | .proc_handler = proc_dointvec, |
755 | }, | 684 | }, |
756 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) | 685 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) |
757 | { | 686 | { |
758 | .ctl_name = KERN_UNKNOWN_NMI_PANIC, | ||
759 | .procname = "unknown_nmi_panic", | 687 | .procname = "unknown_nmi_panic", |
760 | .data = &unknown_nmi_panic, | 688 | .data = &unknown_nmi_panic, |
761 | .maxlen = sizeof (int), | 689 | .maxlen = sizeof (int), |
762 | .mode = 0644, | 690 | .mode = 0644, |
763 | .proc_handler = &proc_dointvec, | 691 | .proc_handler = proc_dointvec, |
764 | }, | 692 | }, |
765 | { | 693 | { |
766 | .procname = "nmi_watchdog", | 694 | .procname = "nmi_watchdog", |
767 | .data = &nmi_watchdog_enabled, | 695 | .data = &nmi_watchdog_enabled, |
768 | .maxlen = sizeof (int), | 696 | .maxlen = sizeof (int), |
769 | .mode = 0644, | 697 | .mode = 0644, |
770 | .proc_handler = &proc_nmi_enabled, | 698 | .proc_handler = proc_nmi_enabled, |
771 | }, | 699 | }, |
772 | #endif | 700 | #endif |
773 | #if defined(CONFIG_X86) | 701 | #if defined(CONFIG_X86) |
774 | { | 702 | { |
775 | .ctl_name = KERN_PANIC_ON_NMI, | ||
776 | .procname = "panic_on_unrecovered_nmi", | 703 | .procname = "panic_on_unrecovered_nmi", |
777 | .data = &panic_on_unrecovered_nmi, | 704 | .data = &panic_on_unrecovered_nmi, |
778 | .maxlen = sizeof(int), | 705 | .maxlen = sizeof(int), |
779 | .mode = 0644, | 706 | .mode = 0644, |
780 | .proc_handler = &proc_dointvec, | 707 | .proc_handler = proc_dointvec, |
781 | }, | 708 | }, |
782 | { | 709 | { |
783 | .ctl_name = CTL_UNNUMBERED, | ||
784 | .procname = "panic_on_io_nmi", | 710 | .procname = "panic_on_io_nmi", |
785 | .data = &panic_on_io_nmi, | 711 | .data = &panic_on_io_nmi, |
786 | .maxlen = sizeof(int), | 712 | .maxlen = sizeof(int), |
787 | .mode = 0644, | 713 | .mode = 0644, |
788 | .proc_handler = &proc_dointvec, | 714 | .proc_handler = proc_dointvec, |
789 | }, | 715 | }, |
790 | { | 716 | { |
791 | .ctl_name = KERN_BOOTLOADER_TYPE, | ||
792 | .procname = "bootloader_type", | 717 | .procname = "bootloader_type", |
793 | .data = &bootloader_type, | 718 | .data = &bootloader_type, |
794 | .maxlen = sizeof (int), | 719 | .maxlen = sizeof (int), |
795 | .mode = 0444, | 720 | .mode = 0444, |
796 | .proc_handler = &proc_dointvec, | 721 | .proc_handler = proc_dointvec, |
797 | }, | 722 | }, |
798 | { | 723 | { |
799 | .ctl_name = CTL_UNNUMBERED, | ||
800 | .procname = "bootloader_version", | 724 | .procname = "bootloader_version", |
801 | .data = &bootloader_version, | 725 | .data = &bootloader_version, |
802 | .maxlen = sizeof (int), | 726 | .maxlen = sizeof (int), |
803 | .mode = 0444, | 727 | .mode = 0444, |
804 | .proc_handler = &proc_dointvec, | 728 | .proc_handler = proc_dointvec, |
805 | }, | 729 | }, |
806 | { | 730 | { |
807 | .ctl_name = CTL_UNNUMBERED, | ||
808 | .procname = "kstack_depth_to_print", | 731 | .procname = "kstack_depth_to_print", |
809 | .data = &kstack_depth_to_print, | 732 | .data = &kstack_depth_to_print, |
810 | .maxlen = sizeof(int), | 733 | .maxlen = sizeof(int), |
811 | .mode = 0644, | 734 | .mode = 0644, |
812 | .proc_handler = &proc_dointvec, | 735 | .proc_handler = proc_dointvec, |
813 | }, | 736 | }, |
814 | { | 737 | { |
815 | .ctl_name = CTL_UNNUMBERED, | ||
816 | .procname = "io_delay_type", | 738 | .procname = "io_delay_type", |
817 | .data = &io_delay_type, | 739 | .data = &io_delay_type, |
818 | .maxlen = sizeof(int), | 740 | .maxlen = sizeof(int), |
819 | .mode = 0644, | 741 | .mode = 0644, |
820 | .proc_handler = &proc_dointvec, | 742 | .proc_handler = proc_dointvec, |
821 | }, | 743 | }, |
822 | #endif | 744 | #endif |
823 | #if defined(CONFIG_MMU) | 745 | #if defined(CONFIG_MMU) |
824 | { | 746 | { |
825 | .ctl_name = KERN_RANDOMIZE, | ||
826 | .procname = "randomize_va_space", | 747 | .procname = "randomize_va_space", |
827 | .data = &randomize_va_space, | 748 | .data = &randomize_va_space, |
828 | .maxlen = sizeof(int), | 749 | .maxlen = sizeof(int), |
829 | .mode = 0644, | 750 | .mode = 0644, |
830 | .proc_handler = &proc_dointvec, | 751 | .proc_handler = proc_dointvec, |
831 | }, | 752 | }, |
832 | #endif | 753 | #endif |
833 | #if defined(CONFIG_S390) && defined(CONFIG_SMP) | 754 | #if defined(CONFIG_S390) && defined(CONFIG_SMP) |
834 | { | 755 | { |
835 | .ctl_name = KERN_SPIN_RETRY, | ||
836 | .procname = "spin_retry", | 756 | .procname = "spin_retry", |
837 | .data = &spin_retry, | 757 | .data = &spin_retry, |
838 | .maxlen = sizeof (int), | 758 | .maxlen = sizeof (int), |
839 | .mode = 0644, | 759 | .mode = 0644, |
840 | .proc_handler = &proc_dointvec, | 760 | .proc_handler = proc_dointvec, |
841 | }, | 761 | }, |
842 | #endif | 762 | #endif |
843 | #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86) | 763 | #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86) |
@@ -846,123 +766,104 @@ static struct ctl_table kern_table[] = { | |||
846 | .data = &acpi_realmode_flags, | 766 | .data = &acpi_realmode_flags, |
847 | .maxlen = sizeof (unsigned long), | 767 | .maxlen = sizeof (unsigned long), |
848 | .mode = 0644, | 768 | .mode = 0644, |
849 | .proc_handler = &proc_doulongvec_minmax, | 769 | .proc_handler = proc_doulongvec_minmax, |
850 | }, | 770 | }, |
851 | #endif | 771 | #endif |
852 | #ifdef CONFIG_IA64 | 772 | #ifdef CONFIG_IA64 |
853 | { | 773 | { |
854 | .ctl_name = KERN_IA64_UNALIGNED, | ||
855 | .procname = "ignore-unaligned-usertrap", | 774 | .procname = "ignore-unaligned-usertrap", |
856 | .data = &no_unaligned_warning, | 775 | .data = &no_unaligned_warning, |
857 | .maxlen = sizeof (int), | 776 | .maxlen = sizeof (int), |
858 | .mode = 0644, | 777 | .mode = 0644, |
859 | .proc_handler = &proc_dointvec, | 778 | .proc_handler = proc_dointvec, |
860 | }, | 779 | }, |
861 | { | 780 | { |
862 | .ctl_name = CTL_UNNUMBERED, | ||
863 | .procname = "unaligned-dump-stack", | 781 | .procname = "unaligned-dump-stack", |
864 | .data = &unaligned_dump_stack, | 782 | .data = &unaligned_dump_stack, |
865 | .maxlen = sizeof (int), | 783 | .maxlen = sizeof (int), |
866 | .mode = 0644, | 784 | .mode = 0644, |
867 | .proc_handler = &proc_dointvec, | 785 | .proc_handler = proc_dointvec, |
868 | }, | 786 | }, |
869 | #endif | 787 | #endif |
870 | #ifdef CONFIG_DETECT_SOFTLOCKUP | 788 | #ifdef CONFIG_DETECT_SOFTLOCKUP |
871 | { | 789 | { |
872 | .ctl_name = CTL_UNNUMBERED, | ||
873 | .procname = "softlockup_panic", | 790 | .procname = "softlockup_panic", |
874 | .data = &softlockup_panic, | 791 | .data = &softlockup_panic, |
875 | .maxlen = sizeof(int), | 792 | .maxlen = sizeof(int), |
876 | .mode = 0644, | 793 | .mode = 0644, |
877 | .proc_handler = &proc_dointvec_minmax, | 794 | .proc_handler = proc_dointvec_minmax, |
878 | .strategy = &sysctl_intvec, | ||
879 | .extra1 = &zero, | 795 | .extra1 = &zero, |
880 | .extra2 = &one, | 796 | .extra2 = &one, |
881 | }, | 797 | }, |
882 | { | 798 | { |
883 | .ctl_name = CTL_UNNUMBERED, | ||
884 | .procname = "softlockup_thresh", | 799 | .procname = "softlockup_thresh", |
885 | .data = &softlockup_thresh, | 800 | .data = &softlockup_thresh, |
886 | .maxlen = sizeof(int), | 801 | .maxlen = sizeof(int), |
887 | .mode = 0644, | 802 | .mode = 0644, |
888 | .proc_handler = &proc_dosoftlockup_thresh, | 803 | .proc_handler = proc_dosoftlockup_thresh, |
889 | .strategy = &sysctl_intvec, | ||
890 | .extra1 = &neg_one, | 804 | .extra1 = &neg_one, |
891 | .extra2 = &sixty, | 805 | .extra2 = &sixty, |
892 | }, | 806 | }, |
893 | #endif | 807 | #endif |
894 | #ifdef CONFIG_DETECT_HUNG_TASK | 808 | #ifdef CONFIG_DETECT_HUNG_TASK |
895 | { | 809 | { |
896 | .ctl_name = CTL_UNNUMBERED, | ||
897 | .procname = "hung_task_panic", | 810 | .procname = "hung_task_panic", |
898 | .data = &sysctl_hung_task_panic, | 811 | .data = &sysctl_hung_task_panic, |
899 | .maxlen = sizeof(int), | 812 | .maxlen = sizeof(int), |
900 | .mode = 0644, | 813 | .mode = 0644, |
901 | .proc_handler = &proc_dointvec_minmax, | 814 | .proc_handler = proc_dointvec_minmax, |
902 | .strategy = &sysctl_intvec, | ||
903 | .extra1 = &zero, | 815 | .extra1 = &zero, |
904 | .extra2 = &one, | 816 | .extra2 = &one, |
905 | }, | 817 | }, |
906 | { | 818 | { |
907 | .ctl_name = CTL_UNNUMBERED, | ||
908 | .procname = "hung_task_check_count", | 819 | .procname = "hung_task_check_count", |
909 | .data = &sysctl_hung_task_check_count, | 820 | .data = &sysctl_hung_task_check_count, |
910 | .maxlen = sizeof(unsigned long), | 821 | .maxlen = sizeof(unsigned long), |
911 | .mode = 0644, | 822 | .mode = 0644, |
912 | .proc_handler = &proc_doulongvec_minmax, | 823 | .proc_handler = proc_doulongvec_minmax, |
913 | .strategy = &sysctl_intvec, | ||
914 | }, | 824 | }, |
915 | { | 825 | { |
916 | .ctl_name = CTL_UNNUMBERED, | ||
917 | .procname = "hung_task_timeout_secs", | 826 | .procname = "hung_task_timeout_secs", |
918 | .data = &sysctl_hung_task_timeout_secs, | 827 | .data = &sysctl_hung_task_timeout_secs, |
919 | .maxlen = sizeof(unsigned long), | 828 | .maxlen = sizeof(unsigned long), |
920 | .mode = 0644, | 829 | .mode = 0644, |
921 | .proc_handler = &proc_dohung_task_timeout_secs, | 830 | .proc_handler = proc_dohung_task_timeout_secs, |
922 | .strategy = &sysctl_intvec, | ||
923 | }, | 831 | }, |
924 | { | 832 | { |
925 | .ctl_name = CTL_UNNUMBERED, | ||
926 | .procname = "hung_task_warnings", | 833 | .procname = "hung_task_warnings", |
927 | .data = &sysctl_hung_task_warnings, | 834 | .data = &sysctl_hung_task_warnings, |
928 | .maxlen = sizeof(unsigned long), | 835 | .maxlen = sizeof(unsigned long), |
929 | .mode = 0644, | 836 | .mode = 0644, |
930 | .proc_handler = &proc_doulongvec_minmax, | 837 | .proc_handler = proc_doulongvec_minmax, |
931 | .strategy = &sysctl_intvec, | ||
932 | }, | 838 | }, |
933 | #endif | 839 | #endif |
934 | #ifdef CONFIG_COMPAT | 840 | #ifdef CONFIG_COMPAT |
935 | { | 841 | { |
936 | .ctl_name = KERN_COMPAT_LOG, | ||
937 | .procname = "compat-log", | 842 | .procname = "compat-log", |
938 | .data = &compat_log, | 843 | .data = &compat_log, |
939 | .maxlen = sizeof (int), | 844 | .maxlen = sizeof (int), |
940 | .mode = 0644, | 845 | .mode = 0644, |
941 | .proc_handler = &proc_dointvec, | 846 | .proc_handler = proc_dointvec, |
942 | }, | 847 | }, |
943 | #endif | 848 | #endif |
944 | #ifdef CONFIG_RT_MUTEXES | 849 | #ifdef CONFIG_RT_MUTEXES |
945 | { | 850 | { |
946 | .ctl_name = KERN_MAX_LOCK_DEPTH, | ||
947 | .procname = "max_lock_depth", | 851 | .procname = "max_lock_depth", |
948 | .data = &max_lock_depth, | 852 | .data = &max_lock_depth, |
949 | .maxlen = sizeof(int), | 853 | .maxlen = sizeof(int), |
950 | .mode = 0644, | 854 | .mode = 0644, |
951 | .proc_handler = &proc_dointvec, | 855 | .proc_handler = proc_dointvec, |
952 | }, | 856 | }, |
953 | #endif | 857 | #endif |
954 | { | 858 | { |
955 | .ctl_name = CTL_UNNUMBERED, | ||
956 | .procname = "poweroff_cmd", | 859 | .procname = "poweroff_cmd", |
957 | .data = &poweroff_cmd, | 860 | .data = &poweroff_cmd, |
958 | .maxlen = POWEROFF_CMD_PATH_LEN, | 861 | .maxlen = POWEROFF_CMD_PATH_LEN, |
959 | .mode = 0644, | 862 | .mode = 0644, |
960 | .proc_handler = &proc_dostring, | 863 | .proc_handler = proc_dostring, |
961 | .strategy = &sysctl_string, | ||
962 | }, | 864 | }, |
963 | #ifdef CONFIG_KEYS | 865 | #ifdef CONFIG_KEYS |
964 | { | 866 | { |
965 | .ctl_name = CTL_UNNUMBERED, | ||
966 | .procname = "keys", | 867 | .procname = "keys", |
967 | .mode = 0555, | 868 | .mode = 0555, |
968 | .child = key_sysctls, | 869 | .child = key_sysctls, |
@@ -970,17 +871,15 @@ static struct ctl_table kern_table[] = { | |||
970 | #endif | 871 | #endif |
971 | #ifdef CONFIG_RCU_TORTURE_TEST | 872 | #ifdef CONFIG_RCU_TORTURE_TEST |
972 | { | 873 | { |
973 | .ctl_name = CTL_UNNUMBERED, | ||
974 | .procname = "rcutorture_runnable", | 874 | .procname = "rcutorture_runnable", |
975 | .data = &rcutorture_runnable, | 875 | .data = &rcutorture_runnable, |
976 | .maxlen = sizeof(int), | 876 | .maxlen = sizeof(int), |
977 | .mode = 0644, | 877 | .mode = 0644, |
978 | .proc_handler = &proc_dointvec, | 878 | .proc_handler = proc_dointvec, |
979 | }, | 879 | }, |
980 | #endif | 880 | #endif |
981 | #ifdef CONFIG_SLOW_WORK | 881 | #ifdef CONFIG_SLOW_WORK |
982 | { | 882 | { |
983 | .ctl_name = CTL_UNNUMBERED, | ||
984 | .procname = "slow-work", | 883 | .procname = "slow-work", |
985 | .mode = 0555, | 884 | .mode = 0555, |
986 | .child = slow_work_sysctls, | 885 | .child = slow_work_sysctls, |
@@ -988,146 +887,127 @@ static struct ctl_table kern_table[] = { | |||
988 | #endif | 887 | #endif |
989 | #ifdef CONFIG_PERF_EVENTS | 888 | #ifdef CONFIG_PERF_EVENTS |
990 | { | 889 | { |
991 | .ctl_name = CTL_UNNUMBERED, | ||
992 | .procname = "perf_event_paranoid", | 890 | .procname = "perf_event_paranoid", |
993 | .data = &sysctl_perf_event_paranoid, | 891 | .data = &sysctl_perf_event_paranoid, |
994 | .maxlen = sizeof(sysctl_perf_event_paranoid), | 892 | .maxlen = sizeof(sysctl_perf_event_paranoid), |
995 | .mode = 0644, | 893 | .mode = 0644, |
996 | .proc_handler = &proc_dointvec, | 894 | .proc_handler = proc_dointvec, |
997 | }, | 895 | }, |
998 | { | 896 | { |
999 | .ctl_name = CTL_UNNUMBERED, | ||
1000 | .procname = "perf_event_mlock_kb", | 897 | .procname = "perf_event_mlock_kb", |
1001 | .data = &sysctl_perf_event_mlock, | 898 | .data = &sysctl_perf_event_mlock, |
1002 | .maxlen = sizeof(sysctl_perf_event_mlock), | 899 | .maxlen = sizeof(sysctl_perf_event_mlock), |
1003 | .mode = 0644, | 900 | .mode = 0644, |
1004 | .proc_handler = &proc_dointvec, | 901 | .proc_handler = proc_dointvec, |
1005 | }, | 902 | }, |
1006 | { | 903 | { |
1007 | .ctl_name = CTL_UNNUMBERED, | ||
1008 | .procname = "perf_event_max_sample_rate", | 904 | .procname = "perf_event_max_sample_rate", |
1009 | .data = &sysctl_perf_event_sample_rate, | 905 | .data = &sysctl_perf_event_sample_rate, |
1010 | .maxlen = sizeof(sysctl_perf_event_sample_rate), | 906 | .maxlen = sizeof(sysctl_perf_event_sample_rate), |
1011 | .mode = 0644, | 907 | .mode = 0644, |
1012 | .proc_handler = &proc_dointvec, | 908 | .proc_handler = proc_dointvec, |
1013 | }, | 909 | }, |
1014 | #endif | 910 | #endif |
1015 | #ifdef CONFIG_KMEMCHECK | 911 | #ifdef CONFIG_KMEMCHECK |
1016 | { | 912 | { |
1017 | .ctl_name = CTL_UNNUMBERED, | ||
1018 | .procname = "kmemcheck", | 913 | .procname = "kmemcheck", |
1019 | .data = &kmemcheck_enabled, | 914 | .data = &kmemcheck_enabled, |
1020 | .maxlen = sizeof(int), | 915 | .maxlen = sizeof(int), |
1021 | .mode = 0644, | 916 | .mode = 0644, |
1022 | .proc_handler = &proc_dointvec, | 917 | .proc_handler = proc_dointvec, |
1023 | }, | 918 | }, |
1024 | #endif | 919 | #endif |
1025 | #ifdef CONFIG_BLOCK | 920 | #ifdef CONFIG_BLOCK |
1026 | { | 921 | { |
1027 | .ctl_name = CTL_UNNUMBERED, | ||
1028 | .procname = "blk_iopoll", | 922 | .procname = "blk_iopoll", |
1029 | .data = &blk_iopoll_enabled, | 923 | .data = &blk_iopoll_enabled, |
1030 | .maxlen = sizeof(int), | 924 | .maxlen = sizeof(int), |
1031 | .mode = 0644, | 925 | .mode = 0644, |
1032 | .proc_handler = &proc_dointvec, | 926 | .proc_handler = proc_dointvec, |
1033 | }, | 927 | }, |
1034 | #endif | 928 | #endif |
1035 | /* | 929 | /* |
1036 | * NOTE: do not add new entries to this table unless you have read | 930 | * NOTE: do not add new entries to this table unless you have read |
1037 | * Documentation/sysctl/ctl_unnumbered.txt | 931 | * Documentation/sysctl/ctl_unnumbered.txt |
1038 | */ | 932 | */ |
1039 | { .ctl_name = 0 } | 933 | { } |
1040 | }; | 934 | }; |
1041 | 935 | ||
1042 | static struct ctl_table vm_table[] = { | 936 | static struct ctl_table vm_table[] = { |
1043 | { | 937 | { |
1044 | .ctl_name = VM_OVERCOMMIT_MEMORY, | ||
1045 | .procname = "overcommit_memory", | 938 | .procname = "overcommit_memory", |
1046 | .data = &sysctl_overcommit_memory, | 939 | .data = &sysctl_overcommit_memory, |
1047 | .maxlen = sizeof(sysctl_overcommit_memory), | 940 | .maxlen = sizeof(sysctl_overcommit_memory), |
1048 | .mode = 0644, | 941 | .mode = 0644, |
1049 | .proc_handler = &proc_dointvec, | 942 | .proc_handler = proc_dointvec, |
1050 | }, | 943 | }, |
1051 | { | 944 | { |
1052 | .ctl_name = VM_PANIC_ON_OOM, | ||
1053 | .procname = "panic_on_oom", | 945 | .procname = "panic_on_oom", |
1054 | .data = &sysctl_panic_on_oom, | 946 | .data = &sysctl_panic_on_oom, |
1055 | .maxlen = sizeof(sysctl_panic_on_oom), | 947 | .maxlen = sizeof(sysctl_panic_on_oom), |
1056 | .mode = 0644, | 948 | .mode = 0644, |
1057 | .proc_handler = &proc_dointvec, | 949 | .proc_handler = proc_dointvec, |
1058 | }, | 950 | }, |
1059 | { | 951 | { |
1060 | .ctl_name = CTL_UNNUMBERED, | ||
1061 | .procname = "oom_kill_allocating_task", | 952 | .procname = "oom_kill_allocating_task", |
1062 | .data = &sysctl_oom_kill_allocating_task, | 953 | .data = &sysctl_oom_kill_allocating_task, |
1063 | .maxlen = sizeof(sysctl_oom_kill_allocating_task), | 954 | .maxlen = sizeof(sysctl_oom_kill_allocating_task), |
1064 | .mode = 0644, | 955 | .mode = 0644, |
1065 | .proc_handler = &proc_dointvec, | 956 | .proc_handler = proc_dointvec, |
1066 | }, | 957 | }, |
1067 | { | 958 | { |
1068 | .ctl_name = CTL_UNNUMBERED, | ||
1069 | .procname = "oom_dump_tasks", | 959 | .procname = "oom_dump_tasks", |
1070 | .data = &sysctl_oom_dump_tasks, | 960 | .data = &sysctl_oom_dump_tasks, |
1071 | .maxlen = sizeof(sysctl_oom_dump_tasks), | 961 | .maxlen = sizeof(sysctl_oom_dump_tasks), |
1072 | .mode = 0644, | 962 | .mode = 0644, |
1073 | .proc_handler = &proc_dointvec, | 963 | .proc_handler = proc_dointvec, |
1074 | }, | 964 | }, |
1075 | { | 965 | { |
1076 | .ctl_name = VM_OVERCOMMIT_RATIO, | ||
1077 | .procname = "overcommit_ratio", | 966 | .procname = "overcommit_ratio", |
1078 | .data = &sysctl_overcommit_ratio, | 967 | .data = &sysctl_overcommit_ratio, |
1079 | .maxlen = sizeof(sysctl_overcommit_ratio), | 968 | .maxlen = sizeof(sysctl_overcommit_ratio), |
1080 | .mode = 0644, | 969 | .mode = 0644, |
1081 | .proc_handler = &proc_dointvec, | 970 | .proc_handler = proc_dointvec, |
1082 | }, | 971 | }, |
1083 | { | 972 | { |
1084 | .ctl_name = VM_PAGE_CLUSTER, | ||
1085 | .procname = "page-cluster", | 973 | .procname = "page-cluster", |
1086 | .data = &page_cluster, | 974 | .data = &page_cluster, |
1087 | .maxlen = sizeof(int), | 975 | .maxlen = sizeof(int), |
1088 | .mode = 0644, | 976 | .mode = 0644, |
1089 | .proc_handler = &proc_dointvec, | 977 | .proc_handler = proc_dointvec, |
1090 | }, | 978 | }, |
1091 | { | 979 | { |
1092 | .ctl_name = VM_DIRTY_BACKGROUND, | ||
1093 | .procname = "dirty_background_ratio", | 980 | .procname = "dirty_background_ratio", |
1094 | .data = &dirty_background_ratio, | 981 | .data = &dirty_background_ratio, |
1095 | .maxlen = sizeof(dirty_background_ratio), | 982 | .maxlen = sizeof(dirty_background_ratio), |
1096 | .mode = 0644, | 983 | .mode = 0644, |
1097 | .proc_handler = &dirty_background_ratio_handler, | 984 | .proc_handler = dirty_background_ratio_handler, |
1098 | .strategy = &sysctl_intvec, | ||
1099 | .extra1 = &zero, | 985 | .extra1 = &zero, |
1100 | .extra2 = &one_hundred, | 986 | .extra2 = &one_hundred, |
1101 | }, | 987 | }, |
1102 | { | 988 | { |
1103 | .ctl_name = CTL_UNNUMBERED, | ||
1104 | .procname = "dirty_background_bytes", | 989 | .procname = "dirty_background_bytes", |
1105 | .data = &dirty_background_bytes, | 990 | .data = &dirty_background_bytes, |
1106 | .maxlen = sizeof(dirty_background_bytes), | 991 | .maxlen = sizeof(dirty_background_bytes), |
1107 | .mode = 0644, | 992 | .mode = 0644, |
1108 | .proc_handler = &dirty_background_bytes_handler, | 993 | .proc_handler = dirty_background_bytes_handler, |
1109 | .strategy = &sysctl_intvec, | ||
1110 | .extra1 = &one_ul, | 994 | .extra1 = &one_ul, |
1111 | }, | 995 | }, |
1112 | { | 996 | { |
1113 | .ctl_name = VM_DIRTY_RATIO, | ||
1114 | .procname = "dirty_ratio", | 997 | .procname = "dirty_ratio", |
1115 | .data = &vm_dirty_ratio, | 998 | .data = &vm_dirty_ratio, |
1116 | .maxlen = sizeof(vm_dirty_ratio), | 999 | .maxlen = sizeof(vm_dirty_ratio), |
1117 | .mode = 0644, | 1000 | .mode = 0644, |
1118 | .proc_handler = &dirty_ratio_handler, | 1001 | .proc_handler = dirty_ratio_handler, |
1119 | .strategy = &sysctl_intvec, | ||
1120 | .extra1 = &zero, | 1002 | .extra1 = &zero, |
1121 | .extra2 = &one_hundred, | 1003 | .extra2 = &one_hundred, |
1122 | }, | 1004 | }, |
1123 | { | 1005 | { |
1124 | .ctl_name = CTL_UNNUMBERED, | ||
1125 | .procname = "dirty_bytes", | 1006 | .procname = "dirty_bytes", |
1126 | .data = &vm_dirty_bytes, | 1007 | .data = &vm_dirty_bytes, |
1127 | .maxlen = sizeof(vm_dirty_bytes), | 1008 | .maxlen = sizeof(vm_dirty_bytes), |
1128 | .mode = 0644, | 1009 | .mode = 0644, |
1129 | .proc_handler = &dirty_bytes_handler, | 1010 | .proc_handler = dirty_bytes_handler, |
1130 | .strategy = &sysctl_intvec, | ||
1131 | .extra1 = &dirty_bytes_min, | 1011 | .extra1 = &dirty_bytes_min, |
1132 | }, | 1012 | }, |
1133 | { | 1013 | { |
@@ -1135,289 +1015,258 @@ static struct ctl_table vm_table[] = { | |||
1135 | .data = &dirty_writeback_interval, | 1015 | .data = &dirty_writeback_interval, |
1136 | .maxlen = sizeof(dirty_writeback_interval), | 1016 | .maxlen = sizeof(dirty_writeback_interval), |
1137 | .mode = 0644, | 1017 | .mode = 0644, |
1138 | .proc_handler = &dirty_writeback_centisecs_handler, | 1018 | .proc_handler = dirty_writeback_centisecs_handler, |
1139 | }, | 1019 | }, |
1140 | { | 1020 | { |
1141 | .procname = "dirty_expire_centisecs", | 1021 | .procname = "dirty_expire_centisecs", |
1142 | .data = &dirty_expire_interval, | 1022 | .data = &dirty_expire_interval, |
1143 | .maxlen = sizeof(dirty_expire_interval), | 1023 | .maxlen = sizeof(dirty_expire_interval), |
1144 | .mode = 0644, | 1024 | .mode = 0644, |
1145 | .proc_handler = &proc_dointvec, | 1025 | .proc_handler = proc_dointvec, |
1146 | }, | 1026 | }, |
1147 | { | 1027 | { |
1148 | .ctl_name = VM_NR_PDFLUSH_THREADS, | ||
1149 | .procname = "nr_pdflush_threads", | 1028 | .procname = "nr_pdflush_threads", |
1150 | .data = &nr_pdflush_threads, | 1029 | .data = &nr_pdflush_threads, |
1151 | .maxlen = sizeof nr_pdflush_threads, | 1030 | .maxlen = sizeof nr_pdflush_threads, |
1152 | .mode = 0444 /* read-only*/, | 1031 | .mode = 0444 /* read-only*/, |
1153 | .proc_handler = &proc_dointvec, | 1032 | .proc_handler = proc_dointvec, |
1154 | }, | 1033 | }, |
1155 | { | 1034 | { |
1156 | .ctl_name = VM_SWAPPINESS, | ||
1157 | .procname = "swappiness", | 1035 | .procname = "swappiness", |
1158 | .data = &vm_swappiness, | 1036 | .data = &vm_swappiness, |
1159 | .maxlen = sizeof(vm_swappiness), | 1037 | .maxlen = sizeof(vm_swappiness), |
1160 | .mode = 0644, | 1038 | .mode = 0644, |
1161 | .proc_handler = &proc_dointvec_minmax, | 1039 | .proc_handler = proc_dointvec_minmax, |
1162 | .strategy = &sysctl_intvec, | ||
1163 | .extra1 = &zero, | 1040 | .extra1 = &zero, |
1164 | .extra2 = &one_hundred, | 1041 | .extra2 = &one_hundred, |
1165 | }, | 1042 | }, |
1166 | #ifdef CONFIG_HUGETLB_PAGE | 1043 | #ifdef CONFIG_HUGETLB_PAGE |
1167 | { | 1044 | { |
1168 | .procname = "nr_hugepages", | 1045 | .procname = "nr_hugepages", |
1169 | .data = NULL, | 1046 | .data = NULL, |
1170 | .maxlen = sizeof(unsigned long), | 1047 | .maxlen = sizeof(unsigned long), |
1171 | .mode = 0644, | 1048 | .mode = 0644, |
1172 | .proc_handler = &hugetlb_sysctl_handler, | 1049 | .proc_handler = hugetlb_sysctl_handler, |
1173 | .extra1 = (void *)&hugetlb_zero, | 1050 | .extra1 = (void *)&hugetlb_zero, |
1174 | .extra2 = (void *)&hugetlb_infinity, | 1051 | .extra2 = (void *)&hugetlb_infinity, |
1175 | }, | 1052 | }, |
1053 | #ifdef CONFIG_NUMA | ||
1054 | { | ||
1055 | .procname = "nr_hugepages_mempolicy", | ||
1056 | .data = NULL, | ||
1057 | .maxlen = sizeof(unsigned long), | ||
1058 | .mode = 0644, | ||
1059 | .proc_handler = &hugetlb_mempolicy_sysctl_handler, | ||
1060 | .extra1 = (void *)&hugetlb_zero, | ||
1061 | .extra2 = (void *)&hugetlb_infinity, | ||
1062 | }, | ||
1063 | #endif | ||
1176 | { | 1064 | { |
1177 | .ctl_name = VM_HUGETLB_GROUP, | ||
1178 | .procname = "hugetlb_shm_group", | 1065 | .procname = "hugetlb_shm_group", |
1179 | .data = &sysctl_hugetlb_shm_group, | 1066 | .data = &sysctl_hugetlb_shm_group, |
1180 | .maxlen = sizeof(gid_t), | 1067 | .maxlen = sizeof(gid_t), |
1181 | .mode = 0644, | 1068 | .mode = 0644, |
1182 | .proc_handler = &proc_dointvec, | 1069 | .proc_handler = proc_dointvec, |
1183 | }, | 1070 | }, |
1184 | { | 1071 | { |
1185 | .ctl_name = CTL_UNNUMBERED, | ||
1186 | .procname = "hugepages_treat_as_movable", | 1072 | .procname = "hugepages_treat_as_movable", |
1187 | .data = &hugepages_treat_as_movable, | 1073 | .data = &hugepages_treat_as_movable, |
1188 | .maxlen = sizeof(int), | 1074 | .maxlen = sizeof(int), |
1189 | .mode = 0644, | 1075 | .mode = 0644, |
1190 | .proc_handler = &hugetlb_treat_movable_handler, | 1076 | .proc_handler = hugetlb_treat_movable_handler, |
1191 | }, | 1077 | }, |
1192 | { | 1078 | { |
1193 | .ctl_name = CTL_UNNUMBERED, | ||
1194 | .procname = "nr_overcommit_hugepages", | 1079 | .procname = "nr_overcommit_hugepages", |
1195 | .data = NULL, | 1080 | .data = NULL, |
1196 | .maxlen = sizeof(unsigned long), | 1081 | .maxlen = sizeof(unsigned long), |
1197 | .mode = 0644, | 1082 | .mode = 0644, |
1198 | .proc_handler = &hugetlb_overcommit_handler, | 1083 | .proc_handler = hugetlb_overcommit_handler, |
1199 | .extra1 = (void *)&hugetlb_zero, | 1084 | .extra1 = (void *)&hugetlb_zero, |
1200 | .extra2 = (void *)&hugetlb_infinity, | 1085 | .extra2 = (void *)&hugetlb_infinity, |
1201 | }, | 1086 | }, |
1202 | #endif | 1087 | #endif |
1203 | { | 1088 | { |
1204 | .ctl_name = VM_LOWMEM_RESERVE_RATIO, | ||
1205 | .procname = "lowmem_reserve_ratio", | 1089 | .procname = "lowmem_reserve_ratio", |
1206 | .data = &sysctl_lowmem_reserve_ratio, | 1090 | .data = &sysctl_lowmem_reserve_ratio, |
1207 | .maxlen = sizeof(sysctl_lowmem_reserve_ratio), | 1091 | .maxlen = sizeof(sysctl_lowmem_reserve_ratio), |
1208 | .mode = 0644, | 1092 | .mode = 0644, |
1209 | .proc_handler = &lowmem_reserve_ratio_sysctl_handler, | 1093 | .proc_handler = lowmem_reserve_ratio_sysctl_handler, |
1210 | .strategy = &sysctl_intvec, | ||
1211 | }, | 1094 | }, |
1212 | { | 1095 | { |
1213 | .ctl_name = VM_DROP_PAGECACHE, | ||
1214 | .procname = "drop_caches", | 1096 | .procname = "drop_caches", |
1215 | .data = &sysctl_drop_caches, | 1097 | .data = &sysctl_drop_caches, |
1216 | .maxlen = sizeof(int), | 1098 | .maxlen = sizeof(int), |
1217 | .mode = 0644, | 1099 | .mode = 0644, |
1218 | .proc_handler = drop_caches_sysctl_handler, | 1100 | .proc_handler = drop_caches_sysctl_handler, |
1219 | .strategy = &sysctl_intvec, | ||
1220 | }, | 1101 | }, |
1221 | { | 1102 | { |
1222 | .ctl_name = VM_MIN_FREE_KBYTES, | ||
1223 | .procname = "min_free_kbytes", | 1103 | .procname = "min_free_kbytes", |
1224 | .data = &min_free_kbytes, | 1104 | .data = &min_free_kbytes, |
1225 | .maxlen = sizeof(min_free_kbytes), | 1105 | .maxlen = sizeof(min_free_kbytes), |
1226 | .mode = 0644, | 1106 | .mode = 0644, |
1227 | .proc_handler = &min_free_kbytes_sysctl_handler, | 1107 | .proc_handler = min_free_kbytes_sysctl_handler, |
1228 | .strategy = &sysctl_intvec, | ||
1229 | .extra1 = &zero, | 1108 | .extra1 = &zero, |
1230 | }, | 1109 | }, |
1231 | { | 1110 | { |
1232 | .ctl_name = VM_PERCPU_PAGELIST_FRACTION, | ||
1233 | .procname = "percpu_pagelist_fraction", | 1111 | .procname = "percpu_pagelist_fraction", |
1234 | .data = &percpu_pagelist_fraction, | 1112 | .data = &percpu_pagelist_fraction, |
1235 | .maxlen = sizeof(percpu_pagelist_fraction), | 1113 | .maxlen = sizeof(percpu_pagelist_fraction), |
1236 | .mode = 0644, | 1114 | .mode = 0644, |
1237 | .proc_handler = &percpu_pagelist_fraction_sysctl_handler, | 1115 | .proc_handler = percpu_pagelist_fraction_sysctl_handler, |
1238 | .strategy = &sysctl_intvec, | ||
1239 | .extra1 = &min_percpu_pagelist_fract, | 1116 | .extra1 = &min_percpu_pagelist_fract, |
1240 | }, | 1117 | }, |
1241 | #ifdef CONFIG_MMU | 1118 | #ifdef CONFIG_MMU |
1242 | { | 1119 | { |
1243 | .ctl_name = VM_MAX_MAP_COUNT, | ||
1244 | .procname = "max_map_count", | 1120 | .procname = "max_map_count", |
1245 | .data = &sysctl_max_map_count, | 1121 | .data = &sysctl_max_map_count, |
1246 | .maxlen = sizeof(sysctl_max_map_count), | 1122 | .maxlen = sizeof(sysctl_max_map_count), |
1247 | .mode = 0644, | 1123 | .mode = 0644, |
1248 | .proc_handler = &proc_dointvec | 1124 | .proc_handler = proc_dointvec_minmax, |
1125 | .extra1 = &zero, | ||
1249 | }, | 1126 | }, |
1250 | #else | 1127 | #else |
1251 | { | 1128 | { |
1252 | .ctl_name = CTL_UNNUMBERED, | ||
1253 | .procname = "nr_trim_pages", | 1129 | .procname = "nr_trim_pages", |
1254 | .data = &sysctl_nr_trim_pages, | 1130 | .data = &sysctl_nr_trim_pages, |
1255 | .maxlen = sizeof(sysctl_nr_trim_pages), | 1131 | .maxlen = sizeof(sysctl_nr_trim_pages), |
1256 | .mode = 0644, | 1132 | .mode = 0644, |
1257 | .proc_handler = &proc_dointvec_minmax, | 1133 | .proc_handler = proc_dointvec_minmax, |
1258 | .strategy = &sysctl_intvec, | ||
1259 | .extra1 = &zero, | 1134 | .extra1 = &zero, |
1260 | }, | 1135 | }, |
1261 | #endif | 1136 | #endif |
1262 | { | 1137 | { |
1263 | .ctl_name = VM_LAPTOP_MODE, | ||
1264 | .procname = "laptop_mode", | 1138 | .procname = "laptop_mode", |
1265 | .data = &laptop_mode, | 1139 | .data = &laptop_mode, |
1266 | .maxlen = sizeof(laptop_mode), | 1140 | .maxlen = sizeof(laptop_mode), |
1267 | .mode = 0644, | 1141 | .mode = 0644, |
1268 | .proc_handler = &proc_dointvec_jiffies, | 1142 | .proc_handler = proc_dointvec_jiffies, |
1269 | .strategy = &sysctl_jiffies, | ||
1270 | }, | 1143 | }, |
1271 | { | 1144 | { |
1272 | .ctl_name = VM_BLOCK_DUMP, | ||
1273 | .procname = "block_dump", | 1145 | .procname = "block_dump", |
1274 | .data = &block_dump, | 1146 | .data = &block_dump, |
1275 | .maxlen = sizeof(block_dump), | 1147 | .maxlen = sizeof(block_dump), |
1276 | .mode = 0644, | 1148 | .mode = 0644, |
1277 | .proc_handler = &proc_dointvec, | 1149 | .proc_handler = proc_dointvec, |
1278 | .strategy = &sysctl_intvec, | ||
1279 | .extra1 = &zero, | 1150 | .extra1 = &zero, |
1280 | }, | 1151 | }, |
1281 | { | 1152 | { |
1282 | .ctl_name = VM_VFS_CACHE_PRESSURE, | ||
1283 | .procname = "vfs_cache_pressure", | 1153 | .procname = "vfs_cache_pressure", |
1284 | .data = &sysctl_vfs_cache_pressure, | 1154 | .data = &sysctl_vfs_cache_pressure, |
1285 | .maxlen = sizeof(sysctl_vfs_cache_pressure), | 1155 | .maxlen = sizeof(sysctl_vfs_cache_pressure), |
1286 | .mode = 0644, | 1156 | .mode = 0644, |
1287 | .proc_handler = &proc_dointvec, | 1157 | .proc_handler = proc_dointvec, |
1288 | .strategy = &sysctl_intvec, | ||
1289 | .extra1 = &zero, | 1158 | .extra1 = &zero, |
1290 | }, | 1159 | }, |
1291 | #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT | 1160 | #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT |
1292 | { | 1161 | { |
1293 | .ctl_name = VM_LEGACY_VA_LAYOUT, | ||
1294 | .procname = "legacy_va_layout", | 1162 | .procname = "legacy_va_layout", |
1295 | .data = &sysctl_legacy_va_layout, | 1163 | .data = &sysctl_legacy_va_layout, |
1296 | .maxlen = sizeof(sysctl_legacy_va_layout), | 1164 | .maxlen = sizeof(sysctl_legacy_va_layout), |
1297 | .mode = 0644, | 1165 | .mode = 0644, |
1298 | .proc_handler = &proc_dointvec, | 1166 | .proc_handler = proc_dointvec, |
1299 | .strategy = &sysctl_intvec, | ||
1300 | .extra1 = &zero, | 1167 | .extra1 = &zero, |
1301 | }, | 1168 | }, |
1302 | #endif | 1169 | #endif |
1303 | #ifdef CONFIG_NUMA | 1170 | #ifdef CONFIG_NUMA |
1304 | { | 1171 | { |
1305 | .ctl_name = VM_ZONE_RECLAIM_MODE, | ||
1306 | .procname = "zone_reclaim_mode", | 1172 | .procname = "zone_reclaim_mode", |
1307 | .data = &zone_reclaim_mode, | 1173 | .data = &zone_reclaim_mode, |
1308 | .maxlen = sizeof(zone_reclaim_mode), | 1174 | .maxlen = sizeof(zone_reclaim_mode), |
1309 | .mode = 0644, | 1175 | .mode = 0644, |
1310 | .proc_handler = &proc_dointvec, | 1176 | .proc_handler = proc_dointvec, |
1311 | .strategy = &sysctl_intvec, | ||
1312 | .extra1 = &zero, | 1177 | .extra1 = &zero, |
1313 | }, | 1178 | }, |
1314 | { | 1179 | { |
1315 | .ctl_name = VM_MIN_UNMAPPED, | ||
1316 | .procname = "min_unmapped_ratio", | 1180 | .procname = "min_unmapped_ratio", |
1317 | .data = &sysctl_min_unmapped_ratio, | 1181 | .data = &sysctl_min_unmapped_ratio, |
1318 | .maxlen = sizeof(sysctl_min_unmapped_ratio), | 1182 | .maxlen = sizeof(sysctl_min_unmapped_ratio), |
1319 | .mode = 0644, | 1183 | .mode = 0644, |
1320 | .proc_handler = &sysctl_min_unmapped_ratio_sysctl_handler, | 1184 | .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler, |
1321 | .strategy = &sysctl_intvec, | ||
1322 | .extra1 = &zero, | 1185 | .extra1 = &zero, |
1323 | .extra2 = &one_hundred, | 1186 | .extra2 = &one_hundred, |
1324 | }, | 1187 | }, |
1325 | { | 1188 | { |
1326 | .ctl_name = VM_MIN_SLAB, | ||
1327 | .procname = "min_slab_ratio", | 1189 | .procname = "min_slab_ratio", |
1328 | .data = &sysctl_min_slab_ratio, | 1190 | .data = &sysctl_min_slab_ratio, |
1329 | .maxlen = sizeof(sysctl_min_slab_ratio), | 1191 | .maxlen = sizeof(sysctl_min_slab_ratio), |
1330 | .mode = 0644, | 1192 | .mode = 0644, |
1331 | .proc_handler = &sysctl_min_slab_ratio_sysctl_handler, | 1193 | .proc_handler = sysctl_min_slab_ratio_sysctl_handler, |
1332 | .strategy = &sysctl_intvec, | ||
1333 | .extra1 = &zero, | 1194 | .extra1 = &zero, |
1334 | .extra2 = &one_hundred, | 1195 | .extra2 = &one_hundred, |
1335 | }, | 1196 | }, |
1336 | #endif | 1197 | #endif |
1337 | #ifdef CONFIG_SMP | 1198 | #ifdef CONFIG_SMP |
1338 | { | 1199 | { |
1339 | .ctl_name = CTL_UNNUMBERED, | ||
1340 | .procname = "stat_interval", | 1200 | .procname = "stat_interval", |
1341 | .data = &sysctl_stat_interval, | 1201 | .data = &sysctl_stat_interval, |
1342 | .maxlen = sizeof(sysctl_stat_interval), | 1202 | .maxlen = sizeof(sysctl_stat_interval), |
1343 | .mode = 0644, | 1203 | .mode = 0644, |
1344 | .proc_handler = &proc_dointvec_jiffies, | 1204 | .proc_handler = proc_dointvec_jiffies, |
1345 | .strategy = &sysctl_jiffies, | ||
1346 | }, | 1205 | }, |
1347 | #endif | 1206 | #endif |
1207 | #ifdef CONFIG_MMU | ||
1348 | { | 1208 | { |
1349 | .ctl_name = CTL_UNNUMBERED, | ||
1350 | .procname = "mmap_min_addr", | 1209 | .procname = "mmap_min_addr", |
1351 | .data = &dac_mmap_min_addr, | 1210 | .data = &dac_mmap_min_addr, |
1352 | .maxlen = sizeof(unsigned long), | 1211 | .maxlen = sizeof(unsigned long), |
1353 | .mode = 0644, | 1212 | .mode = 0644, |
1354 | .proc_handler = &mmap_min_addr_handler, | 1213 | .proc_handler = mmap_min_addr_handler, |
1355 | }, | 1214 | }, |
1215 | #endif | ||
1356 | #ifdef CONFIG_NUMA | 1216 | #ifdef CONFIG_NUMA |
1357 | { | 1217 | { |
1358 | .ctl_name = CTL_UNNUMBERED, | ||
1359 | .procname = "numa_zonelist_order", | 1218 | .procname = "numa_zonelist_order", |
1360 | .data = &numa_zonelist_order, | 1219 | .data = &numa_zonelist_order, |
1361 | .maxlen = NUMA_ZONELIST_ORDER_LEN, | 1220 | .maxlen = NUMA_ZONELIST_ORDER_LEN, |
1362 | .mode = 0644, | 1221 | .mode = 0644, |
1363 | .proc_handler = &numa_zonelist_order_handler, | 1222 | .proc_handler = numa_zonelist_order_handler, |
1364 | .strategy = &sysctl_string, | ||
1365 | }, | 1223 | }, |
1366 | #endif | 1224 | #endif |
1367 | #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \ | 1225 | #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \ |
1368 | (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) | 1226 | (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) |
1369 | { | 1227 | { |
1370 | .ctl_name = VM_VDSO_ENABLED, | ||
1371 | .procname = "vdso_enabled", | 1228 | .procname = "vdso_enabled", |
1372 | .data = &vdso_enabled, | 1229 | .data = &vdso_enabled, |
1373 | .maxlen = sizeof(vdso_enabled), | 1230 | .maxlen = sizeof(vdso_enabled), |
1374 | .mode = 0644, | 1231 | .mode = 0644, |
1375 | .proc_handler = &proc_dointvec, | 1232 | .proc_handler = proc_dointvec, |
1376 | .strategy = &sysctl_intvec, | ||
1377 | .extra1 = &zero, | 1233 | .extra1 = &zero, |
1378 | }, | 1234 | }, |
1379 | #endif | 1235 | #endif |
1380 | #ifdef CONFIG_HIGHMEM | 1236 | #ifdef CONFIG_HIGHMEM |
1381 | { | 1237 | { |
1382 | .ctl_name = CTL_UNNUMBERED, | ||
1383 | .procname = "highmem_is_dirtyable", | 1238 | .procname = "highmem_is_dirtyable", |
1384 | .data = &vm_highmem_is_dirtyable, | 1239 | .data = &vm_highmem_is_dirtyable, |
1385 | .maxlen = sizeof(vm_highmem_is_dirtyable), | 1240 | .maxlen = sizeof(vm_highmem_is_dirtyable), |
1386 | .mode = 0644, | 1241 | .mode = 0644, |
1387 | .proc_handler = &proc_dointvec_minmax, | 1242 | .proc_handler = proc_dointvec_minmax, |
1388 | .strategy = &sysctl_intvec, | ||
1389 | .extra1 = &zero, | 1243 | .extra1 = &zero, |
1390 | .extra2 = &one, | 1244 | .extra2 = &one, |
1391 | }, | 1245 | }, |
1392 | #endif | 1246 | #endif |
1393 | { | 1247 | { |
1394 | .ctl_name = CTL_UNNUMBERED, | ||
1395 | .procname = "scan_unevictable_pages", | 1248 | .procname = "scan_unevictable_pages", |
1396 | .data = &scan_unevictable_pages, | 1249 | .data = &scan_unevictable_pages, |
1397 | .maxlen = sizeof(scan_unevictable_pages), | 1250 | .maxlen = sizeof(scan_unevictable_pages), |
1398 | .mode = 0644, | 1251 | .mode = 0644, |
1399 | .proc_handler = &scan_unevictable_handler, | 1252 | .proc_handler = scan_unevictable_handler, |
1400 | }, | 1253 | }, |
1401 | #ifdef CONFIG_MEMORY_FAILURE | 1254 | #ifdef CONFIG_MEMORY_FAILURE |
1402 | { | 1255 | { |
1403 | .ctl_name = CTL_UNNUMBERED, | ||
1404 | .procname = "memory_failure_early_kill", | 1256 | .procname = "memory_failure_early_kill", |
1405 | .data = &sysctl_memory_failure_early_kill, | 1257 | .data = &sysctl_memory_failure_early_kill, |
1406 | .maxlen = sizeof(sysctl_memory_failure_early_kill), | 1258 | .maxlen = sizeof(sysctl_memory_failure_early_kill), |
1407 | .mode = 0644, | 1259 | .mode = 0644, |
1408 | .proc_handler = &proc_dointvec_minmax, | 1260 | .proc_handler = proc_dointvec_minmax, |
1409 | .strategy = &sysctl_intvec, | ||
1410 | .extra1 = &zero, | 1261 | .extra1 = &zero, |
1411 | .extra2 = &one, | 1262 | .extra2 = &one, |
1412 | }, | 1263 | }, |
1413 | { | 1264 | { |
1414 | .ctl_name = CTL_UNNUMBERED, | ||
1415 | .procname = "memory_failure_recovery", | 1265 | .procname = "memory_failure_recovery", |
1416 | .data = &sysctl_memory_failure_recovery, | 1266 | .data = &sysctl_memory_failure_recovery, |
1417 | .maxlen = sizeof(sysctl_memory_failure_recovery), | 1267 | .maxlen = sizeof(sysctl_memory_failure_recovery), |
1418 | .mode = 0644, | 1268 | .mode = 0644, |
1419 | .proc_handler = &proc_dointvec_minmax, | 1269 | .proc_handler = proc_dointvec_minmax, |
1420 | .strategy = &sysctl_intvec, | ||
1421 | .extra1 = &zero, | 1270 | .extra1 = &zero, |
1422 | .extra2 = &one, | 1271 | .extra2 = &one, |
1423 | }, | 1272 | }, |
@@ -1427,116 +1276,104 @@ static struct ctl_table vm_table[] = { | |||
1427 | * NOTE: do not add new entries to this table unless you have read | 1276 | * NOTE: do not add new entries to this table unless you have read |
1428 | * Documentation/sysctl/ctl_unnumbered.txt | 1277 | * Documentation/sysctl/ctl_unnumbered.txt |
1429 | */ | 1278 | */ |
1430 | { .ctl_name = 0 } | 1279 | { } |
1431 | }; | 1280 | }; |
1432 | 1281 | ||
1433 | #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) | 1282 | #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) |
1434 | static struct ctl_table binfmt_misc_table[] = { | 1283 | static struct ctl_table binfmt_misc_table[] = { |
1435 | { .ctl_name = 0 } | 1284 | { } |
1436 | }; | 1285 | }; |
1437 | #endif | 1286 | #endif |
1438 | 1287 | ||
1439 | static struct ctl_table fs_table[] = { | 1288 | static struct ctl_table fs_table[] = { |
1440 | { | 1289 | { |
1441 | .ctl_name = FS_NRINODE, | ||
1442 | .procname = "inode-nr", | 1290 | .procname = "inode-nr", |
1443 | .data = &inodes_stat, | 1291 | .data = &inodes_stat, |
1444 | .maxlen = 2*sizeof(int), | 1292 | .maxlen = 2*sizeof(int), |
1445 | .mode = 0444, | 1293 | .mode = 0444, |
1446 | .proc_handler = &proc_dointvec, | 1294 | .proc_handler = proc_dointvec, |
1447 | }, | 1295 | }, |
1448 | { | 1296 | { |
1449 | .ctl_name = FS_STATINODE, | ||
1450 | .procname = "inode-state", | 1297 | .procname = "inode-state", |
1451 | .data = &inodes_stat, | 1298 | .data = &inodes_stat, |
1452 | .maxlen = 7*sizeof(int), | 1299 | .maxlen = 7*sizeof(int), |
1453 | .mode = 0444, | 1300 | .mode = 0444, |
1454 | .proc_handler = &proc_dointvec, | 1301 | .proc_handler = proc_dointvec, |
1455 | }, | 1302 | }, |
1456 | { | 1303 | { |
1457 | .procname = "file-nr", | 1304 | .procname = "file-nr", |
1458 | .data = &files_stat, | 1305 | .data = &files_stat, |
1459 | .maxlen = 3*sizeof(int), | 1306 | .maxlen = 3*sizeof(int), |
1460 | .mode = 0444, | 1307 | .mode = 0444, |
1461 | .proc_handler = &proc_nr_files, | 1308 | .proc_handler = proc_nr_files, |
1462 | }, | 1309 | }, |
1463 | { | 1310 | { |
1464 | .ctl_name = FS_MAXFILE, | ||
1465 | .procname = "file-max", | 1311 | .procname = "file-max", |
1466 | .data = &files_stat.max_files, | 1312 | .data = &files_stat.max_files, |
1467 | .maxlen = sizeof(int), | 1313 | .maxlen = sizeof(int), |
1468 | .mode = 0644, | 1314 | .mode = 0644, |
1469 | .proc_handler = &proc_dointvec, | 1315 | .proc_handler = proc_dointvec, |
1470 | }, | 1316 | }, |
1471 | { | 1317 | { |
1472 | .ctl_name = CTL_UNNUMBERED, | ||
1473 | .procname = "nr_open", | 1318 | .procname = "nr_open", |
1474 | .data = &sysctl_nr_open, | 1319 | .data = &sysctl_nr_open, |
1475 | .maxlen = sizeof(int), | 1320 | .maxlen = sizeof(int), |
1476 | .mode = 0644, | 1321 | .mode = 0644, |
1477 | .proc_handler = &proc_dointvec_minmax, | 1322 | .proc_handler = proc_dointvec_minmax, |
1478 | .extra1 = &sysctl_nr_open_min, | 1323 | .extra1 = &sysctl_nr_open_min, |
1479 | .extra2 = &sysctl_nr_open_max, | 1324 | .extra2 = &sysctl_nr_open_max, |
1480 | }, | 1325 | }, |
1481 | { | 1326 | { |
1482 | .ctl_name = FS_DENTRY, | ||
1483 | .procname = "dentry-state", | 1327 | .procname = "dentry-state", |
1484 | .data = &dentry_stat, | 1328 | .data = &dentry_stat, |
1485 | .maxlen = 6*sizeof(int), | 1329 | .maxlen = 6*sizeof(int), |
1486 | .mode = 0444, | 1330 | .mode = 0444, |
1487 | .proc_handler = &proc_dointvec, | 1331 | .proc_handler = proc_dointvec, |
1488 | }, | 1332 | }, |
1489 | { | 1333 | { |
1490 | .ctl_name = FS_OVERFLOWUID, | ||
1491 | .procname = "overflowuid", | 1334 | .procname = "overflowuid", |
1492 | .data = &fs_overflowuid, | 1335 | .data = &fs_overflowuid, |
1493 | .maxlen = sizeof(int), | 1336 | .maxlen = sizeof(int), |
1494 | .mode = 0644, | 1337 | .mode = 0644, |
1495 | .proc_handler = &proc_dointvec_minmax, | 1338 | .proc_handler = proc_dointvec_minmax, |
1496 | .strategy = &sysctl_intvec, | ||
1497 | .extra1 = &minolduid, | 1339 | .extra1 = &minolduid, |
1498 | .extra2 = &maxolduid, | 1340 | .extra2 = &maxolduid, |
1499 | }, | 1341 | }, |
1500 | { | 1342 | { |
1501 | .ctl_name = FS_OVERFLOWGID, | ||
1502 | .procname = "overflowgid", | 1343 | .procname = "overflowgid", |
1503 | .data = &fs_overflowgid, | 1344 | .data = &fs_overflowgid, |
1504 | .maxlen = sizeof(int), | 1345 | .maxlen = sizeof(int), |
1505 | .mode = 0644, | 1346 | .mode = 0644, |
1506 | .proc_handler = &proc_dointvec_minmax, | 1347 | .proc_handler = proc_dointvec_minmax, |
1507 | .strategy = &sysctl_intvec, | ||
1508 | .extra1 = &minolduid, | 1348 | .extra1 = &minolduid, |
1509 | .extra2 = &maxolduid, | 1349 | .extra2 = &maxolduid, |
1510 | }, | 1350 | }, |
1511 | #ifdef CONFIG_FILE_LOCKING | 1351 | #ifdef CONFIG_FILE_LOCKING |
1512 | { | 1352 | { |
1513 | .ctl_name = FS_LEASES, | ||
1514 | .procname = "leases-enable", | 1353 | .procname = "leases-enable", |
1515 | .data = &leases_enable, | 1354 | .data = &leases_enable, |
1516 | .maxlen = sizeof(int), | 1355 | .maxlen = sizeof(int), |
1517 | .mode = 0644, | 1356 | .mode = 0644, |
1518 | .proc_handler = &proc_dointvec, | 1357 | .proc_handler = proc_dointvec, |
1519 | }, | 1358 | }, |
1520 | #endif | 1359 | #endif |
1521 | #ifdef CONFIG_DNOTIFY | 1360 | #ifdef CONFIG_DNOTIFY |
1522 | { | 1361 | { |
1523 | .ctl_name = FS_DIR_NOTIFY, | ||
1524 | .procname = "dir-notify-enable", | 1362 | .procname = "dir-notify-enable", |
1525 | .data = &dir_notify_enable, | 1363 | .data = &dir_notify_enable, |
1526 | .maxlen = sizeof(int), | 1364 | .maxlen = sizeof(int), |
1527 | .mode = 0644, | 1365 | .mode = 0644, |
1528 | .proc_handler = &proc_dointvec, | 1366 | .proc_handler = proc_dointvec, |
1529 | }, | 1367 | }, |
1530 | #endif | 1368 | #endif |
1531 | #ifdef CONFIG_MMU | 1369 | #ifdef CONFIG_MMU |
1532 | #ifdef CONFIG_FILE_LOCKING | 1370 | #ifdef CONFIG_FILE_LOCKING |
1533 | { | 1371 | { |
1534 | .ctl_name = FS_LEASE_TIME, | ||
1535 | .procname = "lease-break-time", | 1372 | .procname = "lease-break-time", |
1536 | .data = &lease_break_time, | 1373 | .data = &lease_break_time, |
1537 | .maxlen = sizeof(int), | 1374 | .maxlen = sizeof(int), |
1538 | .mode = 0644, | 1375 | .mode = 0644, |
1539 | .proc_handler = &proc_dointvec, | 1376 | .proc_handler = proc_dointvec, |
1540 | }, | 1377 | }, |
1541 | #endif | 1378 | #endif |
1542 | #ifdef CONFIG_AIO | 1379 | #ifdef CONFIG_AIO |
@@ -1545,19 +1382,18 @@ static struct ctl_table fs_table[] = { | |||
1545 | .data = &aio_nr, | 1382 | .data = &aio_nr, |
1546 | .maxlen = sizeof(aio_nr), | 1383 | .maxlen = sizeof(aio_nr), |
1547 | .mode = 0444, | 1384 | .mode = 0444, |
1548 | .proc_handler = &proc_doulongvec_minmax, | 1385 | .proc_handler = proc_doulongvec_minmax, |
1549 | }, | 1386 | }, |
1550 | { | 1387 | { |
1551 | .procname = "aio-max-nr", | 1388 | .procname = "aio-max-nr", |
1552 | .data = &aio_max_nr, | 1389 | .data = &aio_max_nr, |
1553 | .maxlen = sizeof(aio_max_nr), | 1390 | .maxlen = sizeof(aio_max_nr), |
1554 | .mode = 0644, | 1391 | .mode = 0644, |
1555 | .proc_handler = &proc_doulongvec_minmax, | 1392 | .proc_handler = proc_doulongvec_minmax, |
1556 | }, | 1393 | }, |
1557 | #endif /* CONFIG_AIO */ | 1394 | #endif /* CONFIG_AIO */ |
1558 | #ifdef CONFIG_INOTIFY_USER | 1395 | #ifdef CONFIG_INOTIFY_USER |
1559 | { | 1396 | { |
1560 | .ctl_name = FS_INOTIFY, | ||
1561 | .procname = "inotify", | 1397 | .procname = "inotify", |
1562 | .mode = 0555, | 1398 | .mode = 0555, |
1563 | .child = inotify_table, | 1399 | .child = inotify_table, |
@@ -1572,19 +1408,16 @@ static struct ctl_table fs_table[] = { | |||
1572 | #endif | 1408 | #endif |
1573 | #endif | 1409 | #endif |
1574 | { | 1410 | { |
1575 | .ctl_name = KERN_SETUID_DUMPABLE, | ||
1576 | .procname = "suid_dumpable", | 1411 | .procname = "suid_dumpable", |
1577 | .data = &suid_dumpable, | 1412 | .data = &suid_dumpable, |
1578 | .maxlen = sizeof(int), | 1413 | .maxlen = sizeof(int), |
1579 | .mode = 0644, | 1414 | .mode = 0644, |
1580 | .proc_handler = &proc_dointvec_minmax, | 1415 | .proc_handler = proc_dointvec_minmax, |
1581 | .strategy = &sysctl_intvec, | ||
1582 | .extra1 = &zero, | 1416 | .extra1 = &zero, |
1583 | .extra2 = &two, | 1417 | .extra2 = &two, |
1584 | }, | 1418 | }, |
1585 | #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) | 1419 | #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) |
1586 | { | 1420 | { |
1587 | .ctl_name = CTL_UNNUMBERED, | ||
1588 | .procname = "binfmt_misc", | 1421 | .procname = "binfmt_misc", |
1589 | .mode = 0555, | 1422 | .mode = 0555, |
1590 | .child = binfmt_misc_table, | 1423 | .child = binfmt_misc_table, |
@@ -1594,13 +1427,12 @@ static struct ctl_table fs_table[] = { | |||
1594 | * NOTE: do not add new entries to this table unless you have read | 1427 | * NOTE: do not add new entries to this table unless you have read |
1595 | * Documentation/sysctl/ctl_unnumbered.txt | 1428 | * Documentation/sysctl/ctl_unnumbered.txt |
1596 | */ | 1429 | */ |
1597 | { .ctl_name = 0 } | 1430 | { } |
1598 | }; | 1431 | }; |
1599 | 1432 | ||
1600 | static struct ctl_table debug_table[] = { | 1433 | static struct ctl_table debug_table[] = { |
1601 | #if defined(CONFIG_X86) || defined(CONFIG_PPC) | 1434 | #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) |
1602 | { | 1435 | { |
1603 | .ctl_name = CTL_UNNUMBERED, | ||
1604 | .procname = "exception-trace", | 1436 | .procname = "exception-trace", |
1605 | .data = &show_unhandled_signals, | 1437 | .data = &show_unhandled_signals, |
1606 | .maxlen = sizeof(int), | 1438 | .maxlen = sizeof(int), |
@@ -1608,11 +1440,22 @@ static struct ctl_table debug_table[] = { | |||
1608 | .proc_handler = proc_dointvec | 1440 | .proc_handler = proc_dointvec |
1609 | }, | 1441 | }, |
1610 | #endif | 1442 | #endif |
1611 | { .ctl_name = 0 } | 1443 | #if defined(CONFIG_OPTPROBES) |
1444 | { | ||
1445 | .procname = "kprobes-optimization", | ||
1446 | .data = &sysctl_kprobes_optimization, | ||
1447 | .maxlen = sizeof(int), | ||
1448 | .mode = 0644, | ||
1449 | .proc_handler = proc_kprobes_optimization_handler, | ||
1450 | .extra1 = &zero, | ||
1451 | .extra2 = &one, | ||
1452 | }, | ||
1453 | #endif | ||
1454 | { } | ||
1612 | }; | 1455 | }; |
1613 | 1456 | ||
1614 | static struct ctl_table dev_table[] = { | 1457 | static struct ctl_table dev_table[] = { |
1615 | { .ctl_name = 0 } | 1458 | { } |
1616 | }; | 1459 | }; |
1617 | 1460 | ||
1618 | static DEFINE_SPINLOCK(sysctl_lock); | 1461 | static DEFINE_SPINLOCK(sysctl_lock); |
@@ -1766,122 +1609,6 @@ void register_sysctl_root(struct ctl_table_root *root) | |||
1766 | spin_unlock(&sysctl_lock); | 1609 | spin_unlock(&sysctl_lock); |
1767 | } | 1610 | } |
1768 | 1611 | ||
1769 | #ifdef CONFIG_SYSCTL_SYSCALL | ||
1770 | /* Perform the actual read/write of a sysctl table entry. */ | ||
1771 | static int do_sysctl_strategy(struct ctl_table_root *root, | ||
1772 | struct ctl_table *table, | ||
1773 | void __user *oldval, size_t __user *oldlenp, | ||
1774 | void __user *newval, size_t newlen) | ||
1775 | { | ||
1776 | int op = 0, rc; | ||
1777 | |||
1778 | if (oldval) | ||
1779 | op |= MAY_READ; | ||
1780 | if (newval) | ||
1781 | op |= MAY_WRITE; | ||
1782 | if (sysctl_perm(root, table, op)) | ||
1783 | return -EPERM; | ||
1784 | |||
1785 | if (table->strategy) { | ||
1786 | rc = table->strategy(table, oldval, oldlenp, newval, newlen); | ||
1787 | if (rc < 0) | ||
1788 | return rc; | ||
1789 | if (rc > 0) | ||
1790 | return 0; | ||
1791 | } | ||
1792 | |||
1793 | /* If there is no strategy routine, or if the strategy returns | ||
1794 | * zero, proceed with automatic r/w */ | ||
1795 | if (table->data && table->maxlen) { | ||
1796 | rc = sysctl_data(table, oldval, oldlenp, newval, newlen); | ||
1797 | if (rc < 0) | ||
1798 | return rc; | ||
1799 | } | ||
1800 | return 0; | ||
1801 | } | ||
1802 | |||
1803 | static int parse_table(int __user *name, int nlen, | ||
1804 | void __user *oldval, size_t __user *oldlenp, | ||
1805 | void __user *newval, size_t newlen, | ||
1806 | struct ctl_table_root *root, | ||
1807 | struct ctl_table *table) | ||
1808 | { | ||
1809 | int n; | ||
1810 | repeat: | ||
1811 | if (!nlen) | ||
1812 | return -ENOTDIR; | ||
1813 | if (get_user(n, name)) | ||
1814 | return -EFAULT; | ||
1815 | for ( ; table->ctl_name || table->procname; table++) { | ||
1816 | if (!table->ctl_name) | ||
1817 | continue; | ||
1818 | if (n == table->ctl_name) { | ||
1819 | int error; | ||
1820 | if (table->child) { | ||
1821 | if (sysctl_perm(root, table, MAY_EXEC)) | ||
1822 | return -EPERM; | ||
1823 | name++; | ||
1824 | nlen--; | ||
1825 | table = table->child; | ||
1826 | goto repeat; | ||
1827 | } | ||
1828 | error = do_sysctl_strategy(root, table, | ||
1829 | oldval, oldlenp, | ||
1830 | newval, newlen); | ||
1831 | return error; | ||
1832 | } | ||
1833 | } | ||
1834 | return -ENOTDIR; | ||
1835 | } | ||
1836 | |||
1837 | int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp, | ||
1838 | void __user *newval, size_t newlen) | ||
1839 | { | ||
1840 | struct ctl_table_header *head; | ||
1841 | int error = -ENOTDIR; | ||
1842 | |||
1843 | if (nlen <= 0 || nlen >= CTL_MAXNAME) | ||
1844 | return -ENOTDIR; | ||
1845 | if (oldval) { | ||
1846 | int old_len; | ||
1847 | if (!oldlenp || get_user(old_len, oldlenp)) | ||
1848 | return -EFAULT; | ||
1849 | } | ||
1850 | |||
1851 | for (head = sysctl_head_next(NULL); head; | ||
1852 | head = sysctl_head_next(head)) { | ||
1853 | error = parse_table(name, nlen, oldval, oldlenp, | ||
1854 | newval, newlen, | ||
1855 | head->root, head->ctl_table); | ||
1856 | if (error != -ENOTDIR) { | ||
1857 | sysctl_head_finish(head); | ||
1858 | break; | ||
1859 | } | ||
1860 | } | ||
1861 | return error; | ||
1862 | } | ||
1863 | |||
1864 | SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args) | ||
1865 | { | ||
1866 | struct __sysctl_args tmp; | ||
1867 | int error; | ||
1868 | |||
1869 | if (copy_from_user(&tmp, args, sizeof(tmp))) | ||
1870 | return -EFAULT; | ||
1871 | |||
1872 | error = deprecated_sysctl_warning(&tmp); | ||
1873 | if (error) | ||
1874 | goto out; | ||
1875 | |||
1876 | lock_kernel(); | ||
1877 | error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp, | ||
1878 | tmp.newval, tmp.newlen); | ||
1879 | unlock_kernel(); | ||
1880 | out: | ||
1881 | return error; | ||
1882 | } | ||
1883 | #endif /* CONFIG_SYSCTL_SYSCALL */ | ||
1884 | |||
1885 | /* | 1612 | /* |
1886 | * sysctl_perm does NOT grant the superuser all rights automatically, because | 1613 | * sysctl_perm does NOT grant the superuser all rights automatically, because |
1887 | * some sysctl variables are readonly even to root. | 1614 | * some sysctl variables are readonly even to root. |
@@ -1917,7 +1644,7 @@ int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op) | |||
1917 | 1644 | ||
1918 | static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table) | 1645 | static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table) |
1919 | { | 1646 | { |
1920 | for (; table->ctl_name || table->procname; table++) { | 1647 | for (; table->procname; table++) { |
1921 | table->parent = parent; | 1648 | table->parent = parent; |
1922 | if (table->child) | 1649 | if (table->child) |
1923 | sysctl_set_parent(table, table->child); | 1650 | sysctl_set_parent(table, table->child); |
@@ -1949,11 +1676,11 @@ static struct ctl_table *is_branch_in(struct ctl_table *branch, | |||
1949 | return NULL; | 1676 | return NULL; |
1950 | 1677 | ||
1951 | /* ... and nothing else */ | 1678 | /* ... and nothing else */ |
1952 | if (branch[1].procname || branch[1].ctl_name) | 1679 | if (branch[1].procname) |
1953 | return NULL; | 1680 | return NULL; |
1954 | 1681 | ||
1955 | /* table should contain subdirectory with the same name */ | 1682 | /* table should contain subdirectory with the same name */ |
1956 | for (p = table; p->procname || p->ctl_name; p++) { | 1683 | for (p = table; p->procname; p++) { |
1957 | if (!p->child) | 1684 | if (!p->child) |
1958 | continue; | 1685 | continue; |
1959 | if (p->procname && strcmp(p->procname, s) == 0) | 1686 | if (p->procname && strcmp(p->procname, s) == 0) |
@@ -1998,9 +1725,6 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q) | |||
1998 | * | 1725 | * |
1999 | * The members of the &struct ctl_table structure are used as follows: | 1726 | * The members of the &struct ctl_table structure are used as follows: |
2000 | * | 1727 | * |
2001 | * ctl_name - This is the numeric sysctl value used by sysctl(2). The number | ||
2002 | * must be unique within that level of sysctl | ||
2003 | * | ||
2004 | * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not | 1728 | * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not |
2005 | * enter a sysctl file | 1729 | * enter a sysctl file |
2006 | * | 1730 | * |
@@ -2015,8 +1739,6 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q) | |||
2015 | * | 1739 | * |
2016 | * proc_handler - the text handler routine (described below) | 1740 | * proc_handler - the text handler routine (described below) |
2017 | * | 1741 | * |
2018 | * strategy - the strategy routine (described below) | ||
2019 | * | ||
2020 | * de - for internal use by the sysctl routines | 1742 | * de - for internal use by the sysctl routines |
2021 | * | 1743 | * |
2022 | * extra1, extra2 - extra pointers usable by the proc handler routines | 1744 | * extra1, extra2 - extra pointers usable by the proc handler routines |
@@ -2029,19 +1751,6 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q) | |||
2029 | * struct enable minimal validation of the values being written to be | 1751 | * struct enable minimal validation of the values being written to be |
2030 | * performed, and the mode field allows minimal authentication. | 1752 | * performed, and the mode field allows minimal authentication. |
2031 | * | 1753 | * |
2032 | * More sophisticated management can be enabled by the provision of a | ||
2033 | * strategy routine with the table entry. This will be called before | ||
2034 | * any automatic read or write of the data is performed. | ||
2035 | * | ||
2036 | * The strategy routine may return | ||
2037 | * | ||
2038 | * < 0 - Error occurred (error is passed to user process) | ||
2039 | * | ||
2040 | * 0 - OK - proceed with automatic read or write. | ||
2041 | * | ||
2042 | * > 0 - OK - read or write has been done by the strategy routine, so | ||
2043 | * return immediately. | ||
2044 | * | ||
2045 | * There must be a proc_handler routine for any terminal nodes | 1754 | * There must be a proc_handler routine for any terminal nodes |
2046 | * mirrored under /proc/sys (non-terminals are handled by a built-in | 1755 | * mirrored under /proc/sys (non-terminals are handled by a built-in |
2047 | * directory handler). Several default handlers are available to | 1756 | * directory handler). Several default handlers are available to |
@@ -2068,13 +1777,13 @@ struct ctl_table_header *__register_sysctl_paths( | |||
2068 | struct ctl_table_set *set; | 1777 | struct ctl_table_set *set; |
2069 | 1778 | ||
2070 | /* Count the path components */ | 1779 | /* Count the path components */ |
2071 | for (npath = 0; path[npath].ctl_name || path[npath].procname; ++npath) | 1780 | for (npath = 0; path[npath].procname; ++npath) |
2072 | ; | 1781 | ; |
2073 | 1782 | ||
2074 | /* | 1783 | /* |
2075 | * For each path component, allocate a 2-element ctl_table array. | 1784 | * For each path component, allocate a 2-element ctl_table array. |
2076 | * The first array element will be filled with the sysctl entry | 1785 | * The first array element will be filled with the sysctl entry |
2077 | * for this, the second will be the sentinel (ctl_name == 0). | 1786 | * for this, the second will be the sentinel (procname == 0). |
2078 | * | 1787 | * |
2079 | * We allocate everything in one go so that we don't have to | 1788 | * We allocate everything in one go so that we don't have to |
2080 | * worry about freeing additional memory in unregister_sysctl_table. | 1789 | * worry about freeing additional memory in unregister_sysctl_table. |
@@ -2091,7 +1800,6 @@ struct ctl_table_header *__register_sysctl_paths( | |||
2091 | for (n = 0; n < npath; ++n, ++path) { | 1800 | for (n = 0; n < npath; ++n, ++path) { |
2092 | /* Copy the procname */ | 1801 | /* Copy the procname */ |
2093 | new->procname = path->procname; | 1802 | new->procname = path->procname; |
2094 | new->ctl_name = path->ctl_name; | ||
2095 | new->mode = 0555; | 1803 | new->mode = 0555; |
2096 | 1804 | ||
2097 | *prevp = new; | 1805 | *prevp = new; |
@@ -2953,286 +2661,6 @@ int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, | |||
2953 | 2661 | ||
2954 | #endif /* CONFIG_PROC_FS */ | 2662 | #endif /* CONFIG_PROC_FS */ |
2955 | 2663 | ||
2956 | |||
2957 | #ifdef CONFIG_SYSCTL_SYSCALL | ||
2958 | /* | ||
2959 | * General sysctl support routines | ||
2960 | */ | ||
2961 | |||
2962 | /* The generic sysctl data routine (used if no strategy routine supplied) */ | ||
2963 | int sysctl_data(struct ctl_table *table, | ||
2964 | void __user *oldval, size_t __user *oldlenp, | ||
2965 | void __user *newval, size_t newlen) | ||
2966 | { | ||
2967 | size_t len; | ||
2968 | |||
2969 | /* Get out of I don't have a variable */ | ||
2970 | if (!table->data || !table->maxlen) | ||
2971 | return -ENOTDIR; | ||
2972 | |||
2973 | if (oldval && oldlenp) { | ||
2974 | if (get_user(len, oldlenp)) | ||
2975 | return -EFAULT; | ||
2976 | if (len) { | ||
2977 | if (len > table->maxlen) | ||
2978 | len = table->maxlen; | ||
2979 | if (copy_to_user(oldval, table->data, len)) | ||
2980 | return -EFAULT; | ||
2981 | if (put_user(len, oldlenp)) | ||
2982 | return -EFAULT; | ||
2983 | } | ||
2984 | } | ||
2985 | |||
2986 | if (newval && newlen) { | ||
2987 | if (newlen > table->maxlen) | ||
2988 | newlen = table->maxlen; | ||
2989 | |||
2990 | if (copy_from_user(table->data, newval, newlen)) | ||
2991 | return -EFAULT; | ||
2992 | } | ||
2993 | return 1; | ||
2994 | } | ||
2995 | |||
2996 | /* The generic string strategy routine: */ | ||
2997 | int sysctl_string(struct ctl_table *table, | ||
2998 | void __user *oldval, size_t __user *oldlenp, | ||
2999 | void __user *newval, size_t newlen) | ||
3000 | { | ||
3001 | if (!table->data || !table->maxlen) | ||
3002 | return -ENOTDIR; | ||
3003 | |||
3004 | if (oldval && oldlenp) { | ||
3005 | size_t bufsize; | ||
3006 | if (get_user(bufsize, oldlenp)) | ||
3007 | return -EFAULT; | ||
3008 | if (bufsize) { | ||
3009 | size_t len = strlen(table->data), copied; | ||
3010 | |||
3011 | /* This shouldn't trigger for a well-formed sysctl */ | ||
3012 | if (len > table->maxlen) | ||
3013 | len = table->maxlen; | ||
3014 | |||
3015 | /* Copy up to a max of bufsize-1 bytes of the string */ | ||
3016 | copied = (len >= bufsize) ? bufsize - 1 : len; | ||
3017 | |||
3018 | if (copy_to_user(oldval, table->data, copied) || | ||
3019 | put_user(0, (char __user *)(oldval + copied))) | ||
3020 | return -EFAULT; | ||
3021 | if (put_user(len, oldlenp)) | ||
3022 | return -EFAULT; | ||
3023 | } | ||
3024 | } | ||
3025 | if (newval && newlen) { | ||
3026 | size_t len = newlen; | ||
3027 | if (len > table->maxlen) | ||
3028 | len = table->maxlen; | ||
3029 | if(copy_from_user(table->data, newval, len)) | ||
3030 | return -EFAULT; | ||
3031 | if (len == table->maxlen) | ||
3032 | len--; | ||
3033 | ((char *) table->data)[len] = 0; | ||
3034 | } | ||
3035 | return 1; | ||
3036 | } | ||
3037 | |||
3038 | /* | ||
3039 | * This function makes sure that all of the integers in the vector | ||
3040 | * are between the minimum and maximum values given in the arrays | ||
3041 | * table->extra1 and table->extra2, respectively. | ||
3042 | */ | ||
3043 | int sysctl_intvec(struct ctl_table *table, | ||
3044 | void __user *oldval, size_t __user *oldlenp, | ||
3045 | void __user *newval, size_t newlen) | ||
3046 | { | ||
3047 | |||
3048 | if (newval && newlen) { | ||
3049 | int __user *vec = (int __user *) newval; | ||
3050 | int *min = (int *) table->extra1; | ||
3051 | int *max = (int *) table->extra2; | ||
3052 | size_t length; | ||
3053 | int i; | ||
3054 | |||
3055 | if (newlen % sizeof(int) != 0) | ||
3056 | return -EINVAL; | ||
3057 | |||
3058 | if (!table->extra1 && !table->extra2) | ||
3059 | return 0; | ||
3060 | |||
3061 | if (newlen > table->maxlen) | ||
3062 | newlen = table->maxlen; | ||
3063 | length = newlen / sizeof(int); | ||
3064 | |||
3065 | for (i = 0; i < length; i++) { | ||
3066 | int value; | ||
3067 | if (get_user(value, vec + i)) | ||
3068 | return -EFAULT; | ||
3069 | if (min && value < min[i]) | ||
3070 | return -EINVAL; | ||
3071 | if (max && value > max[i]) | ||
3072 | return -EINVAL; | ||
3073 | } | ||
3074 | } | ||
3075 | return 0; | ||
3076 | } | ||
3077 | |||
3078 | /* Strategy function to convert jiffies to seconds */ | ||
3079 | int sysctl_jiffies(struct ctl_table *table, | ||
3080 | void __user *oldval, size_t __user *oldlenp, | ||
3081 | void __user *newval, size_t newlen) | ||
3082 | { | ||
3083 | if (oldval && oldlenp) { | ||
3084 | size_t olen; | ||
3085 | |||
3086 | if (get_user(olen, oldlenp)) | ||
3087 | return -EFAULT; | ||
3088 | if (olen) { | ||
3089 | int val; | ||
3090 | |||
3091 | if (olen < sizeof(int)) | ||
3092 | return -EINVAL; | ||
3093 | |||
3094 | val = *(int *)(table->data) / HZ; | ||
3095 | if (put_user(val, (int __user *)oldval)) | ||
3096 | return -EFAULT; | ||
3097 | if (put_user(sizeof(int), oldlenp)) | ||
3098 | return -EFAULT; | ||
3099 | } | ||
3100 | } | ||
3101 | if (newval && newlen) { | ||
3102 | int new; | ||
3103 | if (newlen != sizeof(int)) | ||
3104 | return -EINVAL; | ||
3105 | if (get_user(new, (int __user *)newval)) | ||
3106 | return -EFAULT; | ||
3107 | *(int *)(table->data) = new*HZ; | ||
3108 | } | ||
3109 | return 1; | ||
3110 | } | ||
3111 | |||
3112 | /* Strategy function to convert jiffies to seconds */ | ||
3113 | int sysctl_ms_jiffies(struct ctl_table *table, | ||
3114 | void __user *oldval, size_t __user *oldlenp, | ||
3115 | void __user *newval, size_t newlen) | ||
3116 | { | ||
3117 | if (oldval && oldlenp) { | ||
3118 | size_t olen; | ||
3119 | |||
3120 | if (get_user(olen, oldlenp)) | ||
3121 | return -EFAULT; | ||
3122 | if (olen) { | ||
3123 | int val; | ||
3124 | |||
3125 | if (olen < sizeof(int)) | ||
3126 | return -EINVAL; | ||
3127 | |||
3128 | val = jiffies_to_msecs(*(int *)(table->data)); | ||
3129 | if (put_user(val, (int __user *)oldval)) | ||
3130 | return -EFAULT; | ||
3131 | if (put_user(sizeof(int), oldlenp)) | ||
3132 | return -EFAULT; | ||
3133 | } | ||
3134 | } | ||
3135 | if (newval && newlen) { | ||
3136 | int new; | ||
3137 | if (newlen != sizeof(int)) | ||
3138 | return -EINVAL; | ||
3139 | if (get_user(new, (int __user *)newval)) | ||
3140 | return -EFAULT; | ||
3141 | *(int *)(table->data) = msecs_to_jiffies(new); | ||
3142 | } | ||
3143 | return 1; | ||
3144 | } | ||
3145 | |||
3146 | |||
3147 | |||
3148 | #else /* CONFIG_SYSCTL_SYSCALL */ | ||
3149 | |||
3150 | |||
3151 | SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args) | ||
3152 | { | ||
3153 | struct __sysctl_args tmp; | ||
3154 | int error; | ||
3155 | |||
3156 | if (copy_from_user(&tmp, args, sizeof(tmp))) | ||
3157 | return -EFAULT; | ||
3158 | |||
3159 | error = deprecated_sysctl_warning(&tmp); | ||
3160 | |||
3161 | /* If no error reading the parameters then just -ENOSYS ... */ | ||
3162 | if (!error) | ||
3163 | error = -ENOSYS; | ||
3164 | |||
3165 | return error; | ||
3166 | } | ||
3167 | |||
3168 | int sysctl_data(struct ctl_table *table, | ||
3169 | void __user *oldval, size_t __user *oldlenp, | ||
3170 | void __user *newval, size_t newlen) | ||
3171 | { | ||
3172 | return -ENOSYS; | ||
3173 | } | ||
3174 | |||
3175 | int sysctl_string(struct ctl_table *table, | ||
3176 | void __user *oldval, size_t __user *oldlenp, | ||
3177 | void __user *newval, size_t newlen) | ||
3178 | { | ||
3179 | return -ENOSYS; | ||
3180 | } | ||
3181 | |||
3182 | int sysctl_intvec(struct ctl_table *table, | ||
3183 | void __user *oldval, size_t __user *oldlenp, | ||
3184 | void __user *newval, size_t newlen) | ||
3185 | { | ||
3186 | return -ENOSYS; | ||
3187 | } | ||
3188 | |||
3189 | int sysctl_jiffies(struct ctl_table *table, | ||
3190 | void __user *oldval, size_t __user *oldlenp, | ||
3191 | void __user *newval, size_t newlen) | ||
3192 | { | ||
3193 | return -ENOSYS; | ||
3194 | } | ||
3195 | |||
3196 | int sysctl_ms_jiffies(struct ctl_table *table, | ||
3197 | void __user *oldval, size_t __user *oldlenp, | ||
3198 | void __user *newval, size_t newlen) | ||
3199 | { | ||
3200 | return -ENOSYS; | ||
3201 | } | ||
3202 | |||
3203 | #endif /* CONFIG_SYSCTL_SYSCALL */ | ||
3204 | |||
3205 | static int deprecated_sysctl_warning(struct __sysctl_args *args) | ||
3206 | { | ||
3207 | static int msg_count; | ||
3208 | int name[CTL_MAXNAME]; | ||
3209 | int i; | ||
3210 | |||
3211 | /* Check args->nlen. */ | ||
3212 | if (args->nlen < 0 || args->nlen > CTL_MAXNAME) | ||
3213 | return -ENOTDIR; | ||
3214 | |||
3215 | /* Read in the sysctl name for better debug message logging */ | ||
3216 | for (i = 0; i < args->nlen; i++) | ||
3217 | if (get_user(name[i], args->name + i)) | ||
3218 | return -EFAULT; | ||
3219 | |||
3220 | /* Ignore accesses to kernel.version */ | ||
3221 | if ((args->nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION)) | ||
3222 | return 0; | ||
3223 | |||
3224 | if (msg_count < 5) { | ||
3225 | msg_count++; | ||
3226 | printk(KERN_INFO | ||
3227 | "warning: process `%s' used the deprecated sysctl " | ||
3228 | "system call with ", current->comm); | ||
3229 | for (i = 0; i < args->nlen; i++) | ||
3230 | printk("%d.", name[i]); | ||
3231 | printk("\n"); | ||
3232 | } | ||
3233 | return 0; | ||
3234 | } | ||
3235 | |||
3236 | /* | 2664 | /* |
3237 | * No sense putting this after each symbol definition, twice, | 2665 | * No sense putting this after each symbol definition, twice, |
3238 | * exception granted :-) | 2666 | * exception granted :-) |
@@ -3247,9 +2675,4 @@ EXPORT_SYMBOL(proc_doulongvec_minmax); | |||
3247 | EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax); | 2675 | EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax); |
3248 | EXPORT_SYMBOL(register_sysctl_table); | 2676 | EXPORT_SYMBOL(register_sysctl_table); |
3249 | EXPORT_SYMBOL(register_sysctl_paths); | 2677 | EXPORT_SYMBOL(register_sysctl_paths); |
3250 | EXPORT_SYMBOL(sysctl_intvec); | ||
3251 | EXPORT_SYMBOL(sysctl_jiffies); | ||
3252 | EXPORT_SYMBOL(sysctl_ms_jiffies); | ||
3253 | EXPORT_SYMBOL(sysctl_string); | ||
3254 | EXPORT_SYMBOL(sysctl_data); | ||
3255 | EXPORT_SYMBOL(unregister_sysctl_table); | 2678 | EXPORT_SYMBOL(unregister_sysctl_table); |