aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sysctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r--kernel/sysctl.c932
1 files changed, 176 insertions, 756 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 0d949c517412..45e4bef0012a 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -27,7 +27,6 @@
27#include <linux/security.h> 27#include <linux/security.h>
28#include <linux/ctype.h> 28#include <linux/ctype.h>
29#include <linux/kmemcheck.h> 29#include <linux/kmemcheck.h>
30#include <linux/smp_lock.h>
31#include <linux/fs.h> 30#include <linux/fs.h>
32#include <linux/init.h> 31#include <linux/init.h>
33#include <linux/kernel.h> 32#include <linux/kernel.h>
@@ -36,6 +35,7 @@
36#include <linux/sysrq.h> 35#include <linux/sysrq.h>
37#include <linux/highuid.h> 36#include <linux/highuid.h>
38#include <linux/writeback.h> 37#include <linux/writeback.h>
38#include <linux/ratelimit.h>
39#include <linux/hugetlb.h> 39#include <linux/hugetlb.h>
40#include <linux/initrd.h> 40#include <linux/initrd.h>
41#include <linux/key.h> 41#include <linux/key.h>
@@ -60,7 +60,6 @@
60#include <asm/io.h> 60#include <asm/io.h>
61#endif 61#endif
62 62
63static int deprecated_sysctl_warning(struct __sysctl_args *args);
64 63
65#if defined(CONFIG_SYSCTL) 64#if defined(CONFIG_SYSCTL)
66 65
@@ -158,6 +157,8 @@ extern int no_unaligned_warning;
158extern int unaligned_dump_stack; 157extern int unaligned_dump_stack;
159#endif 158#endif
160 159
160extern struct ratelimit_state printk_ratelimit_state;
161
161#ifdef CONFIG_RT_MUTEXES 162#ifdef CONFIG_RT_MUTEXES
162extern int max_lock_depth; 163extern int max_lock_depth;
163#endif 164#endif
@@ -207,31 +208,26 @@ extern int lock_stat;
207 208
208static struct ctl_table root_table[] = { 209static struct ctl_table root_table[] = {
209 { 210 {
210 .ctl_name = CTL_KERN,
211 .procname = "kernel", 211 .procname = "kernel",
212 .mode = 0555, 212 .mode = 0555,
213 .child = kern_table, 213 .child = kern_table,
214 }, 214 },
215 { 215 {
216 .ctl_name = CTL_VM,
217 .procname = "vm", 216 .procname = "vm",
218 .mode = 0555, 217 .mode = 0555,
219 .child = vm_table, 218 .child = vm_table,
220 }, 219 },
221 { 220 {
222 .ctl_name = CTL_FS,
223 .procname = "fs", 221 .procname = "fs",
224 .mode = 0555, 222 .mode = 0555,
225 .child = fs_table, 223 .child = fs_table,
226 }, 224 },
227 { 225 {
228 .ctl_name = CTL_DEBUG,
229 .procname = "debug", 226 .procname = "debug",
230 .mode = 0555, 227 .mode = 0555,
231 .child = debug_table, 228 .child = debug_table,
232 }, 229 },
233 { 230 {
234 .ctl_name = CTL_DEV,
235 .procname = "dev", 231 .procname = "dev",
236 .mode = 0555, 232 .mode = 0555,
237 .child = dev_table, 233 .child = dev_table,
@@ -240,7 +236,7 @@ static struct ctl_table root_table[] = {
240 * NOTE: do not add new entries to this table unless you have read 236 * NOTE: do not add new entries to this table unless you have read
241 * Documentation/sysctl/ctl_unnumbered.txt 237 * Documentation/sysctl/ctl_unnumbered.txt
242 */ 238 */
243 { .ctl_name = 0 } 239 { }
244}; 240};
245 241
246#ifdef CONFIG_SCHED_DEBUG 242#ifdef CONFIG_SCHED_DEBUG
@@ -248,196 +244,178 @@ static int min_sched_granularity_ns = 100000; /* 100 usecs */
248static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */ 244static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
249static int min_wakeup_granularity_ns; /* 0 usecs */ 245static int min_wakeup_granularity_ns; /* 0 usecs */
250static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */ 246static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
247static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
248static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
249static int min_sched_shares_ratelimit = 100000; /* 100 usec */
250static int max_sched_shares_ratelimit = NSEC_PER_SEC; /* 1 second */
251#endif 251#endif
252 252
253static struct ctl_table kern_table[] = { 253static struct ctl_table kern_table[] = {
254 { 254 {
255 .ctl_name = CTL_UNNUMBERED,
256 .procname = "sched_child_runs_first", 255 .procname = "sched_child_runs_first",
257 .data = &sysctl_sched_child_runs_first, 256 .data = &sysctl_sched_child_runs_first,
258 .maxlen = sizeof(unsigned int), 257 .maxlen = sizeof(unsigned int),
259 .mode = 0644, 258 .mode = 0644,
260 .proc_handler = &proc_dointvec, 259 .proc_handler = proc_dointvec,
261 }, 260 },
262#ifdef CONFIG_SCHED_DEBUG 261#ifdef CONFIG_SCHED_DEBUG
263 { 262 {
264 .ctl_name = CTL_UNNUMBERED,
265 .procname = "sched_min_granularity_ns", 263 .procname = "sched_min_granularity_ns",
266 .data = &sysctl_sched_min_granularity, 264 .data = &sysctl_sched_min_granularity,
267 .maxlen = sizeof(unsigned int), 265 .maxlen = sizeof(unsigned int),
268 .mode = 0644, 266 .mode = 0644,
269 .proc_handler = &sched_nr_latency_handler, 267 .proc_handler = sched_proc_update_handler,
270 .strategy = &sysctl_intvec,
271 .extra1 = &min_sched_granularity_ns, 268 .extra1 = &min_sched_granularity_ns,
272 .extra2 = &max_sched_granularity_ns, 269 .extra2 = &max_sched_granularity_ns,
273 }, 270 },
274 { 271 {
275 .ctl_name = CTL_UNNUMBERED,
276 .procname = "sched_latency_ns", 272 .procname = "sched_latency_ns",
277 .data = &sysctl_sched_latency, 273 .data = &sysctl_sched_latency,
278 .maxlen = sizeof(unsigned int), 274 .maxlen = sizeof(unsigned int),
279 .mode = 0644, 275 .mode = 0644,
280 .proc_handler = &sched_nr_latency_handler, 276 .proc_handler = sched_proc_update_handler,
281 .strategy = &sysctl_intvec,
282 .extra1 = &min_sched_granularity_ns, 277 .extra1 = &min_sched_granularity_ns,
283 .extra2 = &max_sched_granularity_ns, 278 .extra2 = &max_sched_granularity_ns,
284 }, 279 },
285 { 280 {
286 .ctl_name = CTL_UNNUMBERED,
287 .procname = "sched_wakeup_granularity_ns", 281 .procname = "sched_wakeup_granularity_ns",
288 .data = &sysctl_sched_wakeup_granularity, 282 .data = &sysctl_sched_wakeup_granularity,
289 .maxlen = sizeof(unsigned int), 283 .maxlen = sizeof(unsigned int),
290 .mode = 0644, 284 .mode = 0644,
291 .proc_handler = &proc_dointvec_minmax, 285 .proc_handler = sched_proc_update_handler,
292 .strategy = &sysctl_intvec,
293 .extra1 = &min_wakeup_granularity_ns, 286 .extra1 = &min_wakeup_granularity_ns,
294 .extra2 = &max_wakeup_granularity_ns, 287 .extra2 = &max_wakeup_granularity_ns,
295 }, 288 },
296 { 289 {
297 .ctl_name = CTL_UNNUMBERED,
298 .procname = "sched_shares_ratelimit", 290 .procname = "sched_shares_ratelimit",
299 .data = &sysctl_sched_shares_ratelimit, 291 .data = &sysctl_sched_shares_ratelimit,
300 .maxlen = sizeof(unsigned int), 292 .maxlen = sizeof(unsigned int),
301 .mode = 0644, 293 .mode = 0644,
302 .proc_handler = &proc_dointvec, 294 .proc_handler = sched_proc_update_handler,
295 .extra1 = &min_sched_shares_ratelimit,
296 .extra2 = &max_sched_shares_ratelimit,
303 }, 297 },
304 { 298 {
305 .ctl_name = CTL_UNNUMBERED, 299 .procname = "sched_tunable_scaling",
306 .procname = "sched_shares_thresh", 300 .data = &sysctl_sched_tunable_scaling,
307 .data = &sysctl_sched_shares_thresh, 301 .maxlen = sizeof(enum sched_tunable_scaling),
308 .maxlen = sizeof(unsigned int),
309 .mode = 0644, 302 .mode = 0644,
310 .proc_handler = &proc_dointvec_minmax, 303 .proc_handler = sched_proc_update_handler,
311 .strategy = &sysctl_intvec, 304 .extra1 = &min_sched_tunable_scaling,
312 .extra1 = &zero, 305 .extra2 = &max_sched_tunable_scaling,
313 }, 306 },
314 { 307 {
315 .ctl_name = CTL_UNNUMBERED, 308 .procname = "sched_shares_thresh",
316 .procname = "sched_features", 309 .data = &sysctl_sched_shares_thresh,
317 .data = &sysctl_sched_features,
318 .maxlen = sizeof(unsigned int), 310 .maxlen = sizeof(unsigned int),
319 .mode = 0644, 311 .mode = 0644,
320 .proc_handler = &proc_dointvec, 312 .proc_handler = proc_dointvec_minmax,
313 .extra1 = &zero,
321 }, 314 },
322 { 315 {
323 .ctl_name = CTL_UNNUMBERED,
324 .procname = "sched_migration_cost", 316 .procname = "sched_migration_cost",
325 .data = &sysctl_sched_migration_cost, 317 .data = &sysctl_sched_migration_cost,
326 .maxlen = sizeof(unsigned int), 318 .maxlen = sizeof(unsigned int),
327 .mode = 0644, 319 .mode = 0644,
328 .proc_handler = &proc_dointvec, 320 .proc_handler = proc_dointvec,
329 }, 321 },
330 { 322 {
331 .ctl_name = CTL_UNNUMBERED,
332 .procname = "sched_nr_migrate", 323 .procname = "sched_nr_migrate",
333 .data = &sysctl_sched_nr_migrate, 324 .data = &sysctl_sched_nr_migrate,
334 .maxlen = sizeof(unsigned int), 325 .maxlen = sizeof(unsigned int),
335 .mode = 0644, 326 .mode = 0644,
336 .proc_handler = &proc_dointvec, 327 .proc_handler = proc_dointvec,
337 }, 328 },
338 { 329 {
339 .ctl_name = CTL_UNNUMBERED,
340 .procname = "sched_time_avg", 330 .procname = "sched_time_avg",
341 .data = &sysctl_sched_time_avg, 331 .data = &sysctl_sched_time_avg,
342 .maxlen = sizeof(unsigned int), 332 .maxlen = sizeof(unsigned int),
343 .mode = 0644, 333 .mode = 0644,
344 .proc_handler = &proc_dointvec, 334 .proc_handler = proc_dointvec,
345 }, 335 },
346 { 336 {
347 .ctl_name = CTL_UNNUMBERED,
348 .procname = "timer_migration", 337 .procname = "timer_migration",
349 .data = &sysctl_timer_migration, 338 .data = &sysctl_timer_migration,
350 .maxlen = sizeof(unsigned int), 339 .maxlen = sizeof(unsigned int),
351 .mode = 0644, 340 .mode = 0644,
352 .proc_handler = &proc_dointvec_minmax, 341 .proc_handler = proc_dointvec_minmax,
353 .strategy = &sysctl_intvec,
354 .extra1 = &zero, 342 .extra1 = &zero,
355 .extra2 = &one, 343 .extra2 = &one,
356 }, 344 },
357#endif 345#endif
358 { 346 {
359 .ctl_name = CTL_UNNUMBERED,
360 .procname = "sched_rt_period_us", 347 .procname = "sched_rt_period_us",
361 .data = &sysctl_sched_rt_period, 348 .data = &sysctl_sched_rt_period,
362 .maxlen = sizeof(unsigned int), 349 .maxlen = sizeof(unsigned int),
363 .mode = 0644, 350 .mode = 0644,
364 .proc_handler = &sched_rt_handler, 351 .proc_handler = sched_rt_handler,
365 }, 352 },
366 { 353 {
367 .ctl_name = CTL_UNNUMBERED,
368 .procname = "sched_rt_runtime_us", 354 .procname = "sched_rt_runtime_us",
369 .data = &sysctl_sched_rt_runtime, 355 .data = &sysctl_sched_rt_runtime,
370 .maxlen = sizeof(int), 356 .maxlen = sizeof(int),
371 .mode = 0644, 357 .mode = 0644,
372 .proc_handler = &sched_rt_handler, 358 .proc_handler = sched_rt_handler,
373 }, 359 },
374 { 360 {
375 .ctl_name = CTL_UNNUMBERED,
376 .procname = "sched_compat_yield", 361 .procname = "sched_compat_yield",
377 .data = &sysctl_sched_compat_yield, 362 .data = &sysctl_sched_compat_yield,
378 .maxlen = sizeof(unsigned int), 363 .maxlen = sizeof(unsigned int),
379 .mode = 0644, 364 .mode = 0644,
380 .proc_handler = &proc_dointvec, 365 .proc_handler = proc_dointvec,
381 }, 366 },
382#ifdef CONFIG_PROVE_LOCKING 367#ifdef CONFIG_PROVE_LOCKING
383 { 368 {
384 .ctl_name = CTL_UNNUMBERED,
385 .procname = "prove_locking", 369 .procname = "prove_locking",
386 .data = &prove_locking, 370 .data = &prove_locking,
387 .maxlen = sizeof(int), 371 .maxlen = sizeof(int),
388 .mode = 0644, 372 .mode = 0644,
389 .proc_handler = &proc_dointvec, 373 .proc_handler = proc_dointvec,
390 }, 374 },
391#endif 375#endif
392#ifdef CONFIG_LOCK_STAT 376#ifdef CONFIG_LOCK_STAT
393 { 377 {
394 .ctl_name = CTL_UNNUMBERED,
395 .procname = "lock_stat", 378 .procname = "lock_stat",
396 .data = &lock_stat, 379 .data = &lock_stat,
397 .maxlen = sizeof(int), 380 .maxlen = sizeof(int),
398 .mode = 0644, 381 .mode = 0644,
399 .proc_handler = &proc_dointvec, 382 .proc_handler = proc_dointvec,
400 }, 383 },
401#endif 384#endif
402 { 385 {
403 .ctl_name = KERN_PANIC,
404 .procname = "panic", 386 .procname = "panic",
405 .data = &panic_timeout, 387 .data = &panic_timeout,
406 .maxlen = sizeof(int), 388 .maxlen = sizeof(int),
407 .mode = 0644, 389 .mode = 0644,
408 .proc_handler = &proc_dointvec, 390 .proc_handler = proc_dointvec,
409 }, 391 },
410 { 392 {
411 .ctl_name = KERN_CORE_USES_PID,
412 .procname = "core_uses_pid", 393 .procname = "core_uses_pid",
413 .data = &core_uses_pid, 394 .data = &core_uses_pid,
414 .maxlen = sizeof(int), 395 .maxlen = sizeof(int),
415 .mode = 0644, 396 .mode = 0644,
416 .proc_handler = &proc_dointvec, 397 .proc_handler = proc_dointvec,
417 }, 398 },
418 { 399 {
419 .ctl_name = KERN_CORE_PATTERN,
420 .procname = "core_pattern", 400 .procname = "core_pattern",
421 .data = core_pattern, 401 .data = core_pattern,
422 .maxlen = CORENAME_MAX_SIZE, 402 .maxlen = CORENAME_MAX_SIZE,
423 .mode = 0644, 403 .mode = 0644,
424 .proc_handler = &proc_dostring, 404 .proc_handler = proc_dostring,
425 .strategy = &sysctl_string,
426 }, 405 },
427 { 406 {
428 .ctl_name = CTL_UNNUMBERED,
429 .procname = "core_pipe_limit", 407 .procname = "core_pipe_limit",
430 .data = &core_pipe_limit, 408 .data = &core_pipe_limit,
431 .maxlen = sizeof(unsigned int), 409 .maxlen = sizeof(unsigned int),
432 .mode = 0644, 410 .mode = 0644,
433 .proc_handler = &proc_dointvec, 411 .proc_handler = proc_dointvec,
434 }, 412 },
435#ifdef CONFIG_PROC_SYSCTL 413#ifdef CONFIG_PROC_SYSCTL
436 { 414 {
437 .procname = "tainted", 415 .procname = "tainted",
438 .maxlen = sizeof(long), 416 .maxlen = sizeof(long),
439 .mode = 0644, 417 .mode = 0644,
440 .proc_handler = &proc_taint, 418 .proc_handler = proc_taint,
441 }, 419 },
442#endif 420#endif
443#ifdef CONFIG_LATENCYTOP 421#ifdef CONFIG_LATENCYTOP
@@ -446,181 +424,160 @@ static struct ctl_table kern_table[] = {
446 .data = &latencytop_enabled, 424 .data = &latencytop_enabled,
447 .maxlen = sizeof(int), 425 .maxlen = sizeof(int),
448 .mode = 0644, 426 .mode = 0644,
449 .proc_handler = &proc_dointvec, 427 .proc_handler = proc_dointvec,
450 }, 428 },
451#endif 429#endif
452#ifdef CONFIG_BLK_DEV_INITRD 430#ifdef CONFIG_BLK_DEV_INITRD
453 { 431 {
454 .ctl_name = KERN_REALROOTDEV,
455 .procname = "real-root-dev", 432 .procname = "real-root-dev",
456 .data = &real_root_dev, 433 .data = &real_root_dev,
457 .maxlen = sizeof(int), 434 .maxlen = sizeof(int),
458 .mode = 0644, 435 .mode = 0644,
459 .proc_handler = &proc_dointvec, 436 .proc_handler = proc_dointvec,
460 }, 437 },
461#endif 438#endif
462 { 439 {
463 .ctl_name = CTL_UNNUMBERED,
464 .procname = "print-fatal-signals", 440 .procname = "print-fatal-signals",
465 .data = &print_fatal_signals, 441 .data = &print_fatal_signals,
466 .maxlen = sizeof(int), 442 .maxlen = sizeof(int),
467 .mode = 0644, 443 .mode = 0644,
468 .proc_handler = &proc_dointvec, 444 .proc_handler = proc_dointvec,
469 }, 445 },
470#ifdef CONFIG_SPARC 446#ifdef CONFIG_SPARC
471 { 447 {
472 .ctl_name = KERN_SPARC_REBOOT,
473 .procname = "reboot-cmd", 448 .procname = "reboot-cmd",
474 .data = reboot_command, 449 .data = reboot_command,
475 .maxlen = 256, 450 .maxlen = 256,
476 .mode = 0644, 451 .mode = 0644,
477 .proc_handler = &proc_dostring, 452 .proc_handler = proc_dostring,
478 .strategy = &sysctl_string,
479 }, 453 },
480 { 454 {
481 .ctl_name = KERN_SPARC_STOP_A,
482 .procname = "stop-a", 455 .procname = "stop-a",
483 .data = &stop_a_enabled, 456 .data = &stop_a_enabled,
484 .maxlen = sizeof (int), 457 .maxlen = sizeof (int),
485 .mode = 0644, 458 .mode = 0644,
486 .proc_handler = &proc_dointvec, 459 .proc_handler = proc_dointvec,
487 }, 460 },
488 { 461 {
489 .ctl_name = KERN_SPARC_SCONS_PWROFF,
490 .procname = "scons-poweroff", 462 .procname = "scons-poweroff",
491 .data = &scons_pwroff, 463 .data = &scons_pwroff,
492 .maxlen = sizeof (int), 464 .maxlen = sizeof (int),
493 .mode = 0644, 465 .mode = 0644,
494 .proc_handler = &proc_dointvec, 466 .proc_handler = proc_dointvec,
495 }, 467 },
496#endif 468#endif
497#ifdef CONFIG_SPARC64 469#ifdef CONFIG_SPARC64
498 { 470 {
499 .ctl_name = CTL_UNNUMBERED,
500 .procname = "tsb-ratio", 471 .procname = "tsb-ratio",
501 .data = &sysctl_tsb_ratio, 472 .data = &sysctl_tsb_ratio,
502 .maxlen = sizeof (int), 473 .maxlen = sizeof (int),
503 .mode = 0644, 474 .mode = 0644,
504 .proc_handler = &proc_dointvec, 475 .proc_handler = proc_dointvec,
505 }, 476 },
506#endif 477#endif
507#ifdef __hppa__ 478#ifdef __hppa__
508 { 479 {
509 .ctl_name = KERN_HPPA_PWRSW,
510 .procname = "soft-power", 480 .procname = "soft-power",
511 .data = &pwrsw_enabled, 481 .data = &pwrsw_enabled,
512 .maxlen = sizeof (int), 482 .maxlen = sizeof (int),
513 .mode = 0644, 483 .mode = 0644,
514 .proc_handler = &proc_dointvec, 484 .proc_handler = proc_dointvec,
515 }, 485 },
516 { 486 {
517 .ctl_name = KERN_HPPA_UNALIGNED,
518 .procname = "unaligned-trap", 487 .procname = "unaligned-trap",
519 .data = &unaligned_enabled, 488 .data = &unaligned_enabled,
520 .maxlen = sizeof (int), 489 .maxlen = sizeof (int),
521 .mode = 0644, 490 .mode = 0644,
522 .proc_handler = &proc_dointvec, 491 .proc_handler = proc_dointvec,
523 }, 492 },
524#endif 493#endif
525 { 494 {
526 .ctl_name = KERN_CTLALTDEL,
527 .procname = "ctrl-alt-del", 495 .procname = "ctrl-alt-del",
528 .data = &C_A_D, 496 .data = &C_A_D,
529 .maxlen = sizeof(int), 497 .maxlen = sizeof(int),
530 .mode = 0644, 498 .mode = 0644,
531 .proc_handler = &proc_dointvec, 499 .proc_handler = proc_dointvec,
532 }, 500 },
533#ifdef CONFIG_FUNCTION_TRACER 501#ifdef CONFIG_FUNCTION_TRACER
534 { 502 {
535 .ctl_name = CTL_UNNUMBERED,
536 .procname = "ftrace_enabled", 503 .procname = "ftrace_enabled",
537 .data = &ftrace_enabled, 504 .data = &ftrace_enabled,
538 .maxlen = sizeof(int), 505 .maxlen = sizeof(int),
539 .mode = 0644, 506 .mode = 0644,
540 .proc_handler = &ftrace_enable_sysctl, 507 .proc_handler = ftrace_enable_sysctl,
541 }, 508 },
542#endif 509#endif
543#ifdef CONFIG_STACK_TRACER 510#ifdef CONFIG_STACK_TRACER
544 { 511 {
545 .ctl_name = CTL_UNNUMBERED,
546 .procname = "stack_tracer_enabled", 512 .procname = "stack_tracer_enabled",
547 .data = &stack_tracer_enabled, 513 .data = &stack_tracer_enabled,
548 .maxlen = sizeof(int), 514 .maxlen = sizeof(int),
549 .mode = 0644, 515 .mode = 0644,
550 .proc_handler = &stack_trace_sysctl, 516 .proc_handler = stack_trace_sysctl,
551 }, 517 },
552#endif 518#endif
553#ifdef CONFIG_TRACING 519#ifdef CONFIG_TRACING
554 { 520 {
555 .ctl_name = CTL_UNNUMBERED,
556 .procname = "ftrace_dump_on_oops", 521 .procname = "ftrace_dump_on_oops",
557 .data = &ftrace_dump_on_oops, 522 .data = &ftrace_dump_on_oops,
558 .maxlen = sizeof(int), 523 .maxlen = sizeof(int),
559 .mode = 0644, 524 .mode = 0644,
560 .proc_handler = &proc_dointvec, 525 .proc_handler = proc_dointvec,
561 }, 526 },
562#endif 527#endif
563#ifdef CONFIG_MODULES 528#ifdef CONFIG_MODULES
564 { 529 {
565 .ctl_name = KERN_MODPROBE,
566 .procname = "modprobe", 530 .procname = "modprobe",
567 .data = &modprobe_path, 531 .data = &modprobe_path,
568 .maxlen = KMOD_PATH_LEN, 532 .maxlen = KMOD_PATH_LEN,
569 .mode = 0644, 533 .mode = 0644,
570 .proc_handler = &proc_dostring, 534 .proc_handler = proc_dostring,
571 .strategy = &sysctl_string,
572 }, 535 },
573 { 536 {
574 .ctl_name = CTL_UNNUMBERED,
575 .procname = "modules_disabled", 537 .procname = "modules_disabled",
576 .data = &modules_disabled, 538 .data = &modules_disabled,
577 .maxlen = sizeof(int), 539 .maxlen = sizeof(int),
578 .mode = 0644, 540 .mode = 0644,
579 /* only handle a transition from default "0" to "1" */ 541 /* only handle a transition from default "0" to "1" */
580 .proc_handler = &proc_dointvec_minmax, 542 .proc_handler = proc_dointvec_minmax,
581 .extra1 = &one, 543 .extra1 = &one,
582 .extra2 = &one, 544 .extra2 = &one,
583 }, 545 },
584#endif 546#endif
585#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) 547#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
586 { 548 {
587 .ctl_name = KERN_HOTPLUG,
588 .procname = "hotplug", 549 .procname = "hotplug",
589 .data = &uevent_helper, 550 .data = &uevent_helper,
590 .maxlen = UEVENT_HELPER_PATH_LEN, 551 .maxlen = UEVENT_HELPER_PATH_LEN,
591 .mode = 0644, 552 .mode = 0644,
592 .proc_handler = &proc_dostring, 553 .proc_handler = proc_dostring,
593 .strategy = &sysctl_string,
594 }, 554 },
595#endif 555#endif
596#ifdef CONFIG_CHR_DEV_SG 556#ifdef CONFIG_CHR_DEV_SG
597 { 557 {
598 .ctl_name = KERN_SG_BIG_BUFF,
599 .procname = "sg-big-buff", 558 .procname = "sg-big-buff",
600 .data = &sg_big_buff, 559 .data = &sg_big_buff,
601 .maxlen = sizeof (int), 560 .maxlen = sizeof (int),
602 .mode = 0444, 561 .mode = 0444,
603 .proc_handler = &proc_dointvec, 562 .proc_handler = proc_dointvec,
604 }, 563 },
605#endif 564#endif
606#ifdef CONFIG_BSD_PROCESS_ACCT 565#ifdef CONFIG_BSD_PROCESS_ACCT
607 { 566 {
608 .ctl_name = KERN_ACCT,
609 .procname = "acct", 567 .procname = "acct",
610 .data = &acct_parm, 568 .data = &acct_parm,
611 .maxlen = 3*sizeof(int), 569 .maxlen = 3*sizeof(int),
612 .mode = 0644, 570 .mode = 0644,
613 .proc_handler = &proc_dointvec, 571 .proc_handler = proc_dointvec,
614 }, 572 },
615#endif 573#endif
616#ifdef CONFIG_MAGIC_SYSRQ 574#ifdef CONFIG_MAGIC_SYSRQ
617 { 575 {
618 .ctl_name = KERN_SYSRQ,
619 .procname = "sysrq", 576 .procname = "sysrq",
620 .data = &__sysrq_enabled, 577 .data = &__sysrq_enabled,
621 .maxlen = sizeof (int), 578 .maxlen = sizeof (int),
622 .mode = 0644, 579 .mode = 0644,
623 .proc_handler = &proc_dointvec, 580 .proc_handler = proc_dointvec,
624 }, 581 },
625#endif 582#endif
626#ifdef CONFIG_PROC_SYSCTL 583#ifdef CONFIG_PROC_SYSCTL
@@ -629,215 +586,188 @@ static struct ctl_table kern_table[] = {
629 .data = NULL, 586 .data = NULL,
630 .maxlen = sizeof (int), 587 .maxlen = sizeof (int),
631 .mode = 0600, 588 .mode = 0600,
632 .proc_handler = &proc_do_cad_pid, 589 .proc_handler = proc_do_cad_pid,
633 }, 590 },
634#endif 591#endif
635 { 592 {
636 .ctl_name = KERN_MAX_THREADS,
637 .procname = "threads-max", 593 .procname = "threads-max",
638 .data = &max_threads, 594 .data = &max_threads,
639 .maxlen = sizeof(int), 595 .maxlen = sizeof(int),
640 .mode = 0644, 596 .mode = 0644,
641 .proc_handler = &proc_dointvec, 597 .proc_handler = proc_dointvec,
642 }, 598 },
643 { 599 {
644 .ctl_name = KERN_RANDOM,
645 .procname = "random", 600 .procname = "random",
646 .mode = 0555, 601 .mode = 0555,
647 .child = random_table, 602 .child = random_table,
648 }, 603 },
649 { 604 {
650 .ctl_name = KERN_OVERFLOWUID,
651 .procname = "overflowuid", 605 .procname = "overflowuid",
652 .data = &overflowuid, 606 .data = &overflowuid,
653 .maxlen = sizeof(int), 607 .maxlen = sizeof(int),
654 .mode = 0644, 608 .mode = 0644,
655 .proc_handler = &proc_dointvec_minmax, 609 .proc_handler = proc_dointvec_minmax,
656 .strategy = &sysctl_intvec,
657 .extra1 = &minolduid, 610 .extra1 = &minolduid,
658 .extra2 = &maxolduid, 611 .extra2 = &maxolduid,
659 }, 612 },
660 { 613 {
661 .ctl_name = KERN_OVERFLOWGID,
662 .procname = "overflowgid", 614 .procname = "overflowgid",
663 .data = &overflowgid, 615 .data = &overflowgid,
664 .maxlen = sizeof(int), 616 .maxlen = sizeof(int),
665 .mode = 0644, 617 .mode = 0644,
666 .proc_handler = &proc_dointvec_minmax, 618 .proc_handler = proc_dointvec_minmax,
667 .strategy = &sysctl_intvec,
668 .extra1 = &minolduid, 619 .extra1 = &minolduid,
669 .extra2 = &maxolduid, 620 .extra2 = &maxolduid,
670 }, 621 },
671#ifdef CONFIG_S390 622#ifdef CONFIG_S390
672#ifdef CONFIG_MATHEMU 623#ifdef CONFIG_MATHEMU
673 { 624 {
674 .ctl_name = KERN_IEEE_EMULATION_WARNINGS,
675 .procname = "ieee_emulation_warnings", 625 .procname = "ieee_emulation_warnings",
676 .data = &sysctl_ieee_emulation_warnings, 626 .data = &sysctl_ieee_emulation_warnings,
677 .maxlen = sizeof(int), 627 .maxlen = sizeof(int),
678 .mode = 0644, 628 .mode = 0644,
679 .proc_handler = &proc_dointvec, 629 .proc_handler = proc_dointvec,
680 }, 630 },
681#endif 631#endif
682 { 632 {
683 .ctl_name = KERN_S390_USER_DEBUG_LOGGING,
684 .procname = "userprocess_debug", 633 .procname = "userprocess_debug",
685 .data = &sysctl_userprocess_debug, 634 .data = &sysctl_userprocess_debug,
686 .maxlen = sizeof(int), 635 .maxlen = sizeof(int),
687 .mode = 0644, 636 .mode = 0644,
688 .proc_handler = &proc_dointvec, 637 .proc_handler = proc_dointvec,
689 }, 638 },
690#endif 639#endif
691 { 640 {
692 .ctl_name = KERN_PIDMAX,
693 .procname = "pid_max", 641 .procname = "pid_max",
694 .data = &pid_max, 642 .data = &pid_max,
695 .maxlen = sizeof (int), 643 .maxlen = sizeof (int),
696 .mode = 0644, 644 .mode = 0644,
697 .proc_handler = &proc_dointvec_minmax, 645 .proc_handler = proc_dointvec_minmax,
698 .strategy = sysctl_intvec,
699 .extra1 = &pid_max_min, 646 .extra1 = &pid_max_min,
700 .extra2 = &pid_max_max, 647 .extra2 = &pid_max_max,
701 }, 648 },
702 { 649 {
703 .ctl_name = KERN_PANIC_ON_OOPS,
704 .procname = "panic_on_oops", 650 .procname = "panic_on_oops",
705 .data = &panic_on_oops, 651 .data = &panic_on_oops,
706 .maxlen = sizeof(int), 652 .maxlen = sizeof(int),
707 .mode = 0644, 653 .mode = 0644,
708 .proc_handler = &proc_dointvec, 654 .proc_handler = proc_dointvec,
709 }, 655 },
710#if defined CONFIG_PRINTK 656#if defined CONFIG_PRINTK
711 { 657 {
712 .ctl_name = KERN_PRINTK,
713 .procname = "printk", 658 .procname = "printk",
714 .data = &console_loglevel, 659 .data = &console_loglevel,
715 .maxlen = 4*sizeof(int), 660 .maxlen = 4*sizeof(int),
716 .mode = 0644, 661 .mode = 0644,
717 .proc_handler = &proc_dointvec, 662 .proc_handler = proc_dointvec,
718 }, 663 },
719 { 664 {
720 .ctl_name = KERN_PRINTK_RATELIMIT,
721 .procname = "printk_ratelimit", 665 .procname = "printk_ratelimit",
722 .data = &printk_ratelimit_state.interval, 666 .data = &printk_ratelimit_state.interval,
723 .maxlen = sizeof(int), 667 .maxlen = sizeof(int),
724 .mode = 0644, 668 .mode = 0644,
725 .proc_handler = &proc_dointvec_jiffies, 669 .proc_handler = proc_dointvec_jiffies,
726 .strategy = &sysctl_jiffies,
727 }, 670 },
728 { 671 {
729 .ctl_name = KERN_PRINTK_RATELIMIT_BURST,
730 .procname = "printk_ratelimit_burst", 672 .procname = "printk_ratelimit_burst",
731 .data = &printk_ratelimit_state.burst, 673 .data = &printk_ratelimit_state.burst,
732 .maxlen = sizeof(int), 674 .maxlen = sizeof(int),
733 .mode = 0644, 675 .mode = 0644,
734 .proc_handler = &proc_dointvec, 676 .proc_handler = proc_dointvec,
735 }, 677 },
736 { 678 {
737 .ctl_name = CTL_UNNUMBERED,
738 .procname = "printk_delay", 679 .procname = "printk_delay",
739 .data = &printk_delay_msec, 680 .data = &printk_delay_msec,
740 .maxlen = sizeof(int), 681 .maxlen = sizeof(int),
741 .mode = 0644, 682 .mode = 0644,
742 .proc_handler = &proc_dointvec_minmax, 683 .proc_handler = proc_dointvec_minmax,
743 .strategy = &sysctl_intvec,
744 .extra1 = &zero, 684 .extra1 = &zero,
745 .extra2 = &ten_thousand, 685 .extra2 = &ten_thousand,
746 }, 686 },
747#endif 687#endif
748 { 688 {
749 .ctl_name = KERN_NGROUPS_MAX,
750 .procname = "ngroups_max", 689 .procname = "ngroups_max",
751 .data = &ngroups_max, 690 .data = &ngroups_max,
752 .maxlen = sizeof (int), 691 .maxlen = sizeof (int),
753 .mode = 0444, 692 .mode = 0444,
754 .proc_handler = &proc_dointvec, 693 .proc_handler = proc_dointvec,
755 }, 694 },
756#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) 695#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
757 { 696 {
758 .ctl_name = KERN_UNKNOWN_NMI_PANIC,
759 .procname = "unknown_nmi_panic", 697 .procname = "unknown_nmi_panic",
760 .data = &unknown_nmi_panic, 698 .data = &unknown_nmi_panic,
761 .maxlen = sizeof (int), 699 .maxlen = sizeof (int),
762 .mode = 0644, 700 .mode = 0644,
763 .proc_handler = &proc_dointvec, 701 .proc_handler = proc_dointvec,
764 }, 702 },
765 { 703 {
766 .procname = "nmi_watchdog", 704 .procname = "nmi_watchdog",
767 .data = &nmi_watchdog_enabled, 705 .data = &nmi_watchdog_enabled,
768 .maxlen = sizeof (int), 706 .maxlen = sizeof (int),
769 .mode = 0644, 707 .mode = 0644,
770 .proc_handler = &proc_nmi_enabled, 708 .proc_handler = proc_nmi_enabled,
771 }, 709 },
772#endif 710#endif
773#if defined(CONFIG_X86) 711#if defined(CONFIG_X86)
774 { 712 {
775 .ctl_name = KERN_PANIC_ON_NMI,
776 .procname = "panic_on_unrecovered_nmi", 713 .procname = "panic_on_unrecovered_nmi",
777 .data = &panic_on_unrecovered_nmi, 714 .data = &panic_on_unrecovered_nmi,
778 .maxlen = sizeof(int), 715 .maxlen = sizeof(int),
779 .mode = 0644, 716 .mode = 0644,
780 .proc_handler = &proc_dointvec, 717 .proc_handler = proc_dointvec,
781 }, 718 },
782 { 719 {
783 .ctl_name = CTL_UNNUMBERED,
784 .procname = "panic_on_io_nmi", 720 .procname = "panic_on_io_nmi",
785 .data = &panic_on_io_nmi, 721 .data = &panic_on_io_nmi,
786 .maxlen = sizeof(int), 722 .maxlen = sizeof(int),
787 .mode = 0644, 723 .mode = 0644,
788 .proc_handler = &proc_dointvec, 724 .proc_handler = proc_dointvec,
789 }, 725 },
790 { 726 {
791 .ctl_name = KERN_BOOTLOADER_TYPE,
792 .procname = "bootloader_type", 727 .procname = "bootloader_type",
793 .data = &bootloader_type, 728 .data = &bootloader_type,
794 .maxlen = sizeof (int), 729 .maxlen = sizeof (int),
795 .mode = 0444, 730 .mode = 0444,
796 .proc_handler = &proc_dointvec, 731 .proc_handler = proc_dointvec,
797 }, 732 },
798 { 733 {
799 .ctl_name = CTL_UNNUMBERED,
800 .procname = "bootloader_version", 734 .procname = "bootloader_version",
801 .data = &bootloader_version, 735 .data = &bootloader_version,
802 .maxlen = sizeof (int), 736 .maxlen = sizeof (int),
803 .mode = 0444, 737 .mode = 0444,
804 .proc_handler = &proc_dointvec, 738 .proc_handler = proc_dointvec,
805 }, 739 },
806 { 740 {
807 .ctl_name = CTL_UNNUMBERED,
808 .procname = "kstack_depth_to_print", 741 .procname = "kstack_depth_to_print",
809 .data = &kstack_depth_to_print, 742 .data = &kstack_depth_to_print,
810 .maxlen = sizeof(int), 743 .maxlen = sizeof(int),
811 .mode = 0644, 744 .mode = 0644,
812 .proc_handler = &proc_dointvec, 745 .proc_handler = proc_dointvec,
813 }, 746 },
814 { 747 {
815 .ctl_name = CTL_UNNUMBERED,
816 .procname = "io_delay_type", 748 .procname = "io_delay_type",
817 .data = &io_delay_type, 749 .data = &io_delay_type,
818 .maxlen = sizeof(int), 750 .maxlen = sizeof(int),
819 .mode = 0644, 751 .mode = 0644,
820 .proc_handler = &proc_dointvec, 752 .proc_handler = proc_dointvec,
821 }, 753 },
822#endif 754#endif
823#if defined(CONFIG_MMU) 755#if defined(CONFIG_MMU)
824 { 756 {
825 .ctl_name = KERN_RANDOMIZE,
826 .procname = "randomize_va_space", 757 .procname = "randomize_va_space",
827 .data = &randomize_va_space, 758 .data = &randomize_va_space,
828 .maxlen = sizeof(int), 759 .maxlen = sizeof(int),
829 .mode = 0644, 760 .mode = 0644,
830 .proc_handler = &proc_dointvec, 761 .proc_handler = proc_dointvec,
831 }, 762 },
832#endif 763#endif
833#if defined(CONFIG_S390) && defined(CONFIG_SMP) 764#if defined(CONFIG_S390) && defined(CONFIG_SMP)
834 { 765 {
835 .ctl_name = KERN_SPIN_RETRY,
836 .procname = "spin_retry", 766 .procname = "spin_retry",
837 .data = &spin_retry, 767 .data = &spin_retry,
838 .maxlen = sizeof (int), 768 .maxlen = sizeof (int),
839 .mode = 0644, 769 .mode = 0644,
840 .proc_handler = &proc_dointvec, 770 .proc_handler = proc_dointvec,
841 }, 771 },
842#endif 772#endif
843#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86) 773#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
@@ -846,123 +776,104 @@ static struct ctl_table kern_table[] = {
846 .data = &acpi_realmode_flags, 776 .data = &acpi_realmode_flags,
847 .maxlen = sizeof (unsigned long), 777 .maxlen = sizeof (unsigned long),
848 .mode = 0644, 778 .mode = 0644,
849 .proc_handler = &proc_doulongvec_minmax, 779 .proc_handler = proc_doulongvec_minmax,
850 }, 780 },
851#endif 781#endif
852#ifdef CONFIG_IA64 782#ifdef CONFIG_IA64
853 { 783 {
854 .ctl_name = KERN_IA64_UNALIGNED,
855 .procname = "ignore-unaligned-usertrap", 784 .procname = "ignore-unaligned-usertrap",
856 .data = &no_unaligned_warning, 785 .data = &no_unaligned_warning,
857 .maxlen = sizeof (int), 786 .maxlen = sizeof (int),
858 .mode = 0644, 787 .mode = 0644,
859 .proc_handler = &proc_dointvec, 788 .proc_handler = proc_dointvec,
860 }, 789 },
861 { 790 {
862 .ctl_name = CTL_UNNUMBERED,
863 .procname = "unaligned-dump-stack", 791 .procname = "unaligned-dump-stack",
864 .data = &unaligned_dump_stack, 792 .data = &unaligned_dump_stack,
865 .maxlen = sizeof (int), 793 .maxlen = sizeof (int),
866 .mode = 0644, 794 .mode = 0644,
867 .proc_handler = &proc_dointvec, 795 .proc_handler = proc_dointvec,
868 }, 796 },
869#endif 797#endif
870#ifdef CONFIG_DETECT_SOFTLOCKUP 798#ifdef CONFIG_DETECT_SOFTLOCKUP
871 { 799 {
872 .ctl_name = CTL_UNNUMBERED,
873 .procname = "softlockup_panic", 800 .procname = "softlockup_panic",
874 .data = &softlockup_panic, 801 .data = &softlockup_panic,
875 .maxlen = sizeof(int), 802 .maxlen = sizeof(int),
876 .mode = 0644, 803 .mode = 0644,
877 .proc_handler = &proc_dointvec_minmax, 804 .proc_handler = proc_dointvec_minmax,
878 .strategy = &sysctl_intvec,
879 .extra1 = &zero, 805 .extra1 = &zero,
880 .extra2 = &one, 806 .extra2 = &one,
881 }, 807 },
882 { 808 {
883 .ctl_name = CTL_UNNUMBERED,
884 .procname = "softlockup_thresh", 809 .procname = "softlockup_thresh",
885 .data = &softlockup_thresh, 810 .data = &softlockup_thresh,
886 .maxlen = sizeof(int), 811 .maxlen = sizeof(int),
887 .mode = 0644, 812 .mode = 0644,
888 .proc_handler = &proc_dosoftlockup_thresh, 813 .proc_handler = proc_dosoftlockup_thresh,
889 .strategy = &sysctl_intvec,
890 .extra1 = &neg_one, 814 .extra1 = &neg_one,
891 .extra2 = &sixty, 815 .extra2 = &sixty,
892 }, 816 },
893#endif 817#endif
894#ifdef CONFIG_DETECT_HUNG_TASK 818#ifdef CONFIG_DETECT_HUNG_TASK
895 { 819 {
896 .ctl_name = CTL_UNNUMBERED,
897 .procname = "hung_task_panic", 820 .procname = "hung_task_panic",
898 .data = &sysctl_hung_task_panic, 821 .data = &sysctl_hung_task_panic,
899 .maxlen = sizeof(int), 822 .maxlen = sizeof(int),
900 .mode = 0644, 823 .mode = 0644,
901 .proc_handler = &proc_dointvec_minmax, 824 .proc_handler = proc_dointvec_minmax,
902 .strategy = &sysctl_intvec,
903 .extra1 = &zero, 825 .extra1 = &zero,
904 .extra2 = &one, 826 .extra2 = &one,
905 }, 827 },
906 { 828 {
907 .ctl_name = CTL_UNNUMBERED,
908 .procname = "hung_task_check_count", 829 .procname = "hung_task_check_count",
909 .data = &sysctl_hung_task_check_count, 830 .data = &sysctl_hung_task_check_count,
910 .maxlen = sizeof(unsigned long), 831 .maxlen = sizeof(unsigned long),
911 .mode = 0644, 832 .mode = 0644,
912 .proc_handler = &proc_doulongvec_minmax, 833 .proc_handler = proc_doulongvec_minmax,
913 .strategy = &sysctl_intvec,
914 }, 834 },
915 { 835 {
916 .ctl_name = CTL_UNNUMBERED,
917 .procname = "hung_task_timeout_secs", 836 .procname = "hung_task_timeout_secs",
918 .data = &sysctl_hung_task_timeout_secs, 837 .data = &sysctl_hung_task_timeout_secs,
919 .maxlen = sizeof(unsigned long), 838 .maxlen = sizeof(unsigned long),
920 .mode = 0644, 839 .mode = 0644,
921 .proc_handler = &proc_dohung_task_timeout_secs, 840 .proc_handler = proc_dohung_task_timeout_secs,
922 .strategy = &sysctl_intvec,
923 }, 841 },
924 { 842 {
925 .ctl_name = CTL_UNNUMBERED,
926 .procname = "hung_task_warnings", 843 .procname = "hung_task_warnings",
927 .data = &sysctl_hung_task_warnings, 844 .data = &sysctl_hung_task_warnings,
928 .maxlen = sizeof(unsigned long), 845 .maxlen = sizeof(unsigned long),
929 .mode = 0644, 846 .mode = 0644,
930 .proc_handler = &proc_doulongvec_minmax, 847 .proc_handler = proc_doulongvec_minmax,
931 .strategy = &sysctl_intvec,
932 }, 848 },
933#endif 849#endif
934#ifdef CONFIG_COMPAT 850#ifdef CONFIG_COMPAT
935 { 851 {
936 .ctl_name = KERN_COMPAT_LOG,
937 .procname = "compat-log", 852 .procname = "compat-log",
938 .data = &compat_log, 853 .data = &compat_log,
939 .maxlen = sizeof (int), 854 .maxlen = sizeof (int),
940 .mode = 0644, 855 .mode = 0644,
941 .proc_handler = &proc_dointvec, 856 .proc_handler = proc_dointvec,
942 }, 857 },
943#endif 858#endif
944#ifdef CONFIG_RT_MUTEXES 859#ifdef CONFIG_RT_MUTEXES
945 { 860 {
946 .ctl_name = KERN_MAX_LOCK_DEPTH,
947 .procname = "max_lock_depth", 861 .procname = "max_lock_depth",
948 .data = &max_lock_depth, 862 .data = &max_lock_depth,
949 .maxlen = sizeof(int), 863 .maxlen = sizeof(int),
950 .mode = 0644, 864 .mode = 0644,
951 .proc_handler = &proc_dointvec, 865 .proc_handler = proc_dointvec,
952 }, 866 },
953#endif 867#endif
954 { 868 {
955 .ctl_name = CTL_UNNUMBERED,
956 .procname = "poweroff_cmd", 869 .procname = "poweroff_cmd",
957 .data = &poweroff_cmd, 870 .data = &poweroff_cmd,
958 .maxlen = POWEROFF_CMD_PATH_LEN, 871 .maxlen = POWEROFF_CMD_PATH_LEN,
959 .mode = 0644, 872 .mode = 0644,
960 .proc_handler = &proc_dostring, 873 .proc_handler = proc_dostring,
961 .strategy = &sysctl_string,
962 }, 874 },
963#ifdef CONFIG_KEYS 875#ifdef CONFIG_KEYS
964 { 876 {
965 .ctl_name = CTL_UNNUMBERED,
966 .procname = "keys", 877 .procname = "keys",
967 .mode = 0555, 878 .mode = 0555,
968 .child = key_sysctls, 879 .child = key_sysctls,
@@ -970,17 +881,15 @@ static struct ctl_table kern_table[] = {
970#endif 881#endif
971#ifdef CONFIG_RCU_TORTURE_TEST 882#ifdef CONFIG_RCU_TORTURE_TEST
972 { 883 {
973 .ctl_name = CTL_UNNUMBERED,
974 .procname = "rcutorture_runnable", 884 .procname = "rcutorture_runnable",
975 .data = &rcutorture_runnable, 885 .data = &rcutorture_runnable,
976 .maxlen = sizeof(int), 886 .maxlen = sizeof(int),
977 .mode = 0644, 887 .mode = 0644,
978 .proc_handler = &proc_dointvec, 888 .proc_handler = proc_dointvec,
979 }, 889 },
980#endif 890#endif
981#ifdef CONFIG_SLOW_WORK 891#ifdef CONFIG_SLOW_WORK
982 { 892 {
983 .ctl_name = CTL_UNNUMBERED,
984 .procname = "slow-work", 893 .procname = "slow-work",
985 .mode = 0555, 894 .mode = 0555,
986 .child = slow_work_sysctls, 895 .child = slow_work_sysctls,
@@ -988,146 +897,127 @@ static struct ctl_table kern_table[] = {
988#endif 897#endif
989#ifdef CONFIG_PERF_EVENTS 898#ifdef CONFIG_PERF_EVENTS
990 { 899 {
991 .ctl_name = CTL_UNNUMBERED,
992 .procname = "perf_event_paranoid", 900 .procname = "perf_event_paranoid",
993 .data = &sysctl_perf_event_paranoid, 901 .data = &sysctl_perf_event_paranoid,
994 .maxlen = sizeof(sysctl_perf_event_paranoid), 902 .maxlen = sizeof(sysctl_perf_event_paranoid),
995 .mode = 0644, 903 .mode = 0644,
996 .proc_handler = &proc_dointvec, 904 .proc_handler = proc_dointvec,
997 }, 905 },
998 { 906 {
999 .ctl_name = CTL_UNNUMBERED,
1000 .procname = "perf_event_mlock_kb", 907 .procname = "perf_event_mlock_kb",
1001 .data = &sysctl_perf_event_mlock, 908 .data = &sysctl_perf_event_mlock,
1002 .maxlen = sizeof(sysctl_perf_event_mlock), 909 .maxlen = sizeof(sysctl_perf_event_mlock),
1003 .mode = 0644, 910 .mode = 0644,
1004 .proc_handler = &proc_dointvec, 911 .proc_handler = proc_dointvec,
1005 }, 912 },
1006 { 913 {
1007 .ctl_name = CTL_UNNUMBERED,
1008 .procname = "perf_event_max_sample_rate", 914 .procname = "perf_event_max_sample_rate",
1009 .data = &sysctl_perf_event_sample_rate, 915 .data = &sysctl_perf_event_sample_rate,
1010 .maxlen = sizeof(sysctl_perf_event_sample_rate), 916 .maxlen = sizeof(sysctl_perf_event_sample_rate),
1011 .mode = 0644, 917 .mode = 0644,
1012 .proc_handler = &proc_dointvec, 918 .proc_handler = proc_dointvec,
1013 }, 919 },
1014#endif 920#endif
1015#ifdef CONFIG_KMEMCHECK 921#ifdef CONFIG_KMEMCHECK
1016 { 922 {
1017 .ctl_name = CTL_UNNUMBERED,
1018 .procname = "kmemcheck", 923 .procname = "kmemcheck",
1019 .data = &kmemcheck_enabled, 924 .data = &kmemcheck_enabled,
1020 .maxlen = sizeof(int), 925 .maxlen = sizeof(int),
1021 .mode = 0644, 926 .mode = 0644,
1022 .proc_handler = &proc_dointvec, 927 .proc_handler = proc_dointvec,
1023 }, 928 },
1024#endif 929#endif
1025#ifdef CONFIG_BLOCK 930#ifdef CONFIG_BLOCK
1026 { 931 {
1027 .ctl_name = CTL_UNNUMBERED,
1028 .procname = "blk_iopoll", 932 .procname = "blk_iopoll",
1029 .data = &blk_iopoll_enabled, 933 .data = &blk_iopoll_enabled,
1030 .maxlen = sizeof(int), 934 .maxlen = sizeof(int),
1031 .mode = 0644, 935 .mode = 0644,
1032 .proc_handler = &proc_dointvec, 936 .proc_handler = proc_dointvec,
1033 }, 937 },
1034#endif 938#endif
1035/* 939/*
1036 * NOTE: do not add new entries to this table unless you have read 940 * NOTE: do not add new entries to this table unless you have read
1037 * Documentation/sysctl/ctl_unnumbered.txt 941 * Documentation/sysctl/ctl_unnumbered.txt
1038 */ 942 */
1039 { .ctl_name = 0 } 943 { }
1040}; 944};
1041 945
1042static struct ctl_table vm_table[] = { 946static struct ctl_table vm_table[] = {
1043 { 947 {
1044 .ctl_name = VM_OVERCOMMIT_MEMORY,
1045 .procname = "overcommit_memory", 948 .procname = "overcommit_memory",
1046 .data = &sysctl_overcommit_memory, 949 .data = &sysctl_overcommit_memory,
1047 .maxlen = sizeof(sysctl_overcommit_memory), 950 .maxlen = sizeof(sysctl_overcommit_memory),
1048 .mode = 0644, 951 .mode = 0644,
1049 .proc_handler = &proc_dointvec, 952 .proc_handler = proc_dointvec,
1050 }, 953 },
1051 { 954 {
1052 .ctl_name = VM_PANIC_ON_OOM,
1053 .procname = "panic_on_oom", 955 .procname = "panic_on_oom",
1054 .data = &sysctl_panic_on_oom, 956 .data = &sysctl_panic_on_oom,
1055 .maxlen = sizeof(sysctl_panic_on_oom), 957 .maxlen = sizeof(sysctl_panic_on_oom),
1056 .mode = 0644, 958 .mode = 0644,
1057 .proc_handler = &proc_dointvec, 959 .proc_handler = proc_dointvec,
1058 }, 960 },
1059 { 961 {
1060 .ctl_name = CTL_UNNUMBERED,
1061 .procname = "oom_kill_allocating_task", 962 .procname = "oom_kill_allocating_task",
1062 .data = &sysctl_oom_kill_allocating_task, 963 .data = &sysctl_oom_kill_allocating_task,
1063 .maxlen = sizeof(sysctl_oom_kill_allocating_task), 964 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1064 .mode = 0644, 965 .mode = 0644,
1065 .proc_handler = &proc_dointvec, 966 .proc_handler = proc_dointvec,
1066 }, 967 },
1067 { 968 {
1068 .ctl_name = CTL_UNNUMBERED,
1069 .procname = "oom_dump_tasks", 969 .procname = "oom_dump_tasks",
1070 .data = &sysctl_oom_dump_tasks, 970 .data = &sysctl_oom_dump_tasks,
1071 .maxlen = sizeof(sysctl_oom_dump_tasks), 971 .maxlen = sizeof(sysctl_oom_dump_tasks),
1072 .mode = 0644, 972 .mode = 0644,
1073 .proc_handler = &proc_dointvec, 973 .proc_handler = proc_dointvec,
1074 }, 974 },
1075 { 975 {
1076 .ctl_name = VM_OVERCOMMIT_RATIO,
1077 .procname = "overcommit_ratio", 976 .procname = "overcommit_ratio",
1078 .data = &sysctl_overcommit_ratio, 977 .data = &sysctl_overcommit_ratio,
1079 .maxlen = sizeof(sysctl_overcommit_ratio), 978 .maxlen = sizeof(sysctl_overcommit_ratio),
1080 .mode = 0644, 979 .mode = 0644,
1081 .proc_handler = &proc_dointvec, 980 .proc_handler = proc_dointvec,
1082 }, 981 },
1083 { 982 {
1084 .ctl_name = VM_PAGE_CLUSTER,
1085 .procname = "page-cluster", 983 .procname = "page-cluster",
1086 .data = &page_cluster, 984 .data = &page_cluster,
1087 .maxlen = sizeof(int), 985 .maxlen = sizeof(int),
1088 .mode = 0644, 986 .mode = 0644,
1089 .proc_handler = &proc_dointvec, 987 .proc_handler = proc_dointvec,
1090 }, 988 },
1091 { 989 {
1092 .ctl_name = VM_DIRTY_BACKGROUND,
1093 .procname = "dirty_background_ratio", 990 .procname = "dirty_background_ratio",
1094 .data = &dirty_background_ratio, 991 .data = &dirty_background_ratio,
1095 .maxlen = sizeof(dirty_background_ratio), 992 .maxlen = sizeof(dirty_background_ratio),
1096 .mode = 0644, 993 .mode = 0644,
1097 .proc_handler = &dirty_background_ratio_handler, 994 .proc_handler = dirty_background_ratio_handler,
1098 .strategy = &sysctl_intvec,
1099 .extra1 = &zero, 995 .extra1 = &zero,
1100 .extra2 = &one_hundred, 996 .extra2 = &one_hundred,
1101 }, 997 },
1102 { 998 {
1103 .ctl_name = CTL_UNNUMBERED,
1104 .procname = "dirty_background_bytes", 999 .procname = "dirty_background_bytes",
1105 .data = &dirty_background_bytes, 1000 .data = &dirty_background_bytes,
1106 .maxlen = sizeof(dirty_background_bytes), 1001 .maxlen = sizeof(dirty_background_bytes),
1107 .mode = 0644, 1002 .mode = 0644,
1108 .proc_handler = &dirty_background_bytes_handler, 1003 .proc_handler = dirty_background_bytes_handler,
1109 .strategy = &sysctl_intvec,
1110 .extra1 = &one_ul, 1004 .extra1 = &one_ul,
1111 }, 1005 },
1112 { 1006 {
1113 .ctl_name = VM_DIRTY_RATIO,
1114 .procname = "dirty_ratio", 1007 .procname = "dirty_ratio",
1115 .data = &vm_dirty_ratio, 1008 .data = &vm_dirty_ratio,
1116 .maxlen = sizeof(vm_dirty_ratio), 1009 .maxlen = sizeof(vm_dirty_ratio),
1117 .mode = 0644, 1010 .mode = 0644,
1118 .proc_handler = &dirty_ratio_handler, 1011 .proc_handler = dirty_ratio_handler,
1119 .strategy = &sysctl_intvec,
1120 .extra1 = &zero, 1012 .extra1 = &zero,
1121 .extra2 = &one_hundred, 1013 .extra2 = &one_hundred,
1122 }, 1014 },
1123 { 1015 {
1124 .ctl_name = CTL_UNNUMBERED,
1125 .procname = "dirty_bytes", 1016 .procname = "dirty_bytes",
1126 .data = &vm_dirty_bytes, 1017 .data = &vm_dirty_bytes,
1127 .maxlen = sizeof(vm_dirty_bytes), 1018 .maxlen = sizeof(vm_dirty_bytes),
1128 .mode = 0644, 1019 .mode = 0644,
1129 .proc_handler = &dirty_bytes_handler, 1020 .proc_handler = dirty_bytes_handler,
1130 .strategy = &sysctl_intvec,
1131 .extra1 = &dirty_bytes_min, 1021 .extra1 = &dirty_bytes_min,
1132 }, 1022 },
1133 { 1023 {
@@ -1135,289 +1025,256 @@ static struct ctl_table vm_table[] = {
1135 .data = &dirty_writeback_interval, 1025 .data = &dirty_writeback_interval,
1136 .maxlen = sizeof(dirty_writeback_interval), 1026 .maxlen = sizeof(dirty_writeback_interval),
1137 .mode = 0644, 1027 .mode = 0644,
1138 .proc_handler = &dirty_writeback_centisecs_handler, 1028 .proc_handler = dirty_writeback_centisecs_handler,
1139 }, 1029 },
1140 { 1030 {
1141 .procname = "dirty_expire_centisecs", 1031 .procname = "dirty_expire_centisecs",
1142 .data = &dirty_expire_interval, 1032 .data = &dirty_expire_interval,
1143 .maxlen = sizeof(dirty_expire_interval), 1033 .maxlen = sizeof(dirty_expire_interval),
1144 .mode = 0644, 1034 .mode = 0644,
1145 .proc_handler = &proc_dointvec, 1035 .proc_handler = proc_dointvec,
1146 }, 1036 },
1147 { 1037 {
1148 .ctl_name = VM_NR_PDFLUSH_THREADS,
1149 .procname = "nr_pdflush_threads", 1038 .procname = "nr_pdflush_threads",
1150 .data = &nr_pdflush_threads, 1039 .data = &nr_pdflush_threads,
1151 .maxlen = sizeof nr_pdflush_threads, 1040 .maxlen = sizeof nr_pdflush_threads,
1152 .mode = 0444 /* read-only*/, 1041 .mode = 0444 /* read-only*/,
1153 .proc_handler = &proc_dointvec, 1042 .proc_handler = proc_dointvec,
1154 }, 1043 },
1155 { 1044 {
1156 .ctl_name = VM_SWAPPINESS,
1157 .procname = "swappiness", 1045 .procname = "swappiness",
1158 .data = &vm_swappiness, 1046 .data = &vm_swappiness,
1159 .maxlen = sizeof(vm_swappiness), 1047 .maxlen = sizeof(vm_swappiness),
1160 .mode = 0644, 1048 .mode = 0644,
1161 .proc_handler = &proc_dointvec_minmax, 1049 .proc_handler = proc_dointvec_minmax,
1162 .strategy = &sysctl_intvec,
1163 .extra1 = &zero, 1050 .extra1 = &zero,
1164 .extra2 = &one_hundred, 1051 .extra2 = &one_hundred,
1165 }, 1052 },
1166#ifdef CONFIG_HUGETLB_PAGE 1053#ifdef CONFIG_HUGETLB_PAGE
1167 { 1054 {
1168 .procname = "nr_hugepages", 1055 .procname = "nr_hugepages",
1169 .data = NULL, 1056 .data = NULL,
1170 .maxlen = sizeof(unsigned long), 1057 .maxlen = sizeof(unsigned long),
1171 .mode = 0644, 1058 .mode = 0644,
1172 .proc_handler = &hugetlb_sysctl_handler, 1059 .proc_handler = hugetlb_sysctl_handler,
1173 .extra1 = (void *)&hugetlb_zero, 1060 .extra1 = (void *)&hugetlb_zero,
1174 .extra2 = (void *)&hugetlb_infinity, 1061 .extra2 = (void *)&hugetlb_infinity,
1175 }, 1062 },
1063#ifdef CONFIG_NUMA
1064 {
1065 .procname = "nr_hugepages_mempolicy",
1066 .data = NULL,
1067 .maxlen = sizeof(unsigned long),
1068 .mode = 0644,
1069 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1070 .extra1 = (void *)&hugetlb_zero,
1071 .extra2 = (void *)&hugetlb_infinity,
1072 },
1073#endif
1176 { 1074 {
1177 .ctl_name = VM_HUGETLB_GROUP,
1178 .procname = "hugetlb_shm_group", 1075 .procname = "hugetlb_shm_group",
1179 .data = &sysctl_hugetlb_shm_group, 1076 .data = &sysctl_hugetlb_shm_group,
1180 .maxlen = sizeof(gid_t), 1077 .maxlen = sizeof(gid_t),
1181 .mode = 0644, 1078 .mode = 0644,
1182 .proc_handler = &proc_dointvec, 1079 .proc_handler = proc_dointvec,
1183 }, 1080 },
1184 { 1081 {
1185 .ctl_name = CTL_UNNUMBERED,
1186 .procname = "hugepages_treat_as_movable", 1082 .procname = "hugepages_treat_as_movable",
1187 .data = &hugepages_treat_as_movable, 1083 .data = &hugepages_treat_as_movable,
1188 .maxlen = sizeof(int), 1084 .maxlen = sizeof(int),
1189 .mode = 0644, 1085 .mode = 0644,
1190 .proc_handler = &hugetlb_treat_movable_handler, 1086 .proc_handler = hugetlb_treat_movable_handler,
1191 }, 1087 },
1192 { 1088 {
1193 .ctl_name = CTL_UNNUMBERED,
1194 .procname = "nr_overcommit_hugepages", 1089 .procname = "nr_overcommit_hugepages",
1195 .data = NULL, 1090 .data = NULL,
1196 .maxlen = sizeof(unsigned long), 1091 .maxlen = sizeof(unsigned long),
1197 .mode = 0644, 1092 .mode = 0644,
1198 .proc_handler = &hugetlb_overcommit_handler, 1093 .proc_handler = hugetlb_overcommit_handler,
1199 .extra1 = (void *)&hugetlb_zero, 1094 .extra1 = (void *)&hugetlb_zero,
1200 .extra2 = (void *)&hugetlb_infinity, 1095 .extra2 = (void *)&hugetlb_infinity,
1201 }, 1096 },
1202#endif 1097#endif
1203 { 1098 {
1204 .ctl_name = VM_LOWMEM_RESERVE_RATIO,
1205 .procname = "lowmem_reserve_ratio", 1099 .procname = "lowmem_reserve_ratio",
1206 .data = &sysctl_lowmem_reserve_ratio, 1100 .data = &sysctl_lowmem_reserve_ratio,
1207 .maxlen = sizeof(sysctl_lowmem_reserve_ratio), 1101 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1208 .mode = 0644, 1102 .mode = 0644,
1209 .proc_handler = &lowmem_reserve_ratio_sysctl_handler, 1103 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
1210 .strategy = &sysctl_intvec,
1211 }, 1104 },
1212 { 1105 {
1213 .ctl_name = VM_DROP_PAGECACHE,
1214 .procname = "drop_caches", 1106 .procname = "drop_caches",
1215 .data = &sysctl_drop_caches, 1107 .data = &sysctl_drop_caches,
1216 .maxlen = sizeof(int), 1108 .maxlen = sizeof(int),
1217 .mode = 0644, 1109 .mode = 0644,
1218 .proc_handler = drop_caches_sysctl_handler, 1110 .proc_handler = drop_caches_sysctl_handler,
1219 .strategy = &sysctl_intvec,
1220 }, 1111 },
1221 { 1112 {
1222 .ctl_name = VM_MIN_FREE_KBYTES,
1223 .procname = "min_free_kbytes", 1113 .procname = "min_free_kbytes",
1224 .data = &min_free_kbytes, 1114 .data = &min_free_kbytes,
1225 .maxlen = sizeof(min_free_kbytes), 1115 .maxlen = sizeof(min_free_kbytes),
1226 .mode = 0644, 1116 .mode = 0644,
1227 .proc_handler = &min_free_kbytes_sysctl_handler, 1117 .proc_handler = min_free_kbytes_sysctl_handler,
1228 .strategy = &sysctl_intvec,
1229 .extra1 = &zero, 1118 .extra1 = &zero,
1230 }, 1119 },
1231 { 1120 {
1232 .ctl_name = VM_PERCPU_PAGELIST_FRACTION,
1233 .procname = "percpu_pagelist_fraction", 1121 .procname = "percpu_pagelist_fraction",
1234 .data = &percpu_pagelist_fraction, 1122 .data = &percpu_pagelist_fraction,
1235 .maxlen = sizeof(percpu_pagelist_fraction), 1123 .maxlen = sizeof(percpu_pagelist_fraction),
1236 .mode = 0644, 1124 .mode = 0644,
1237 .proc_handler = &percpu_pagelist_fraction_sysctl_handler, 1125 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
1238 .strategy = &sysctl_intvec,
1239 .extra1 = &min_percpu_pagelist_fract, 1126 .extra1 = &min_percpu_pagelist_fract,
1240 }, 1127 },
1241#ifdef CONFIG_MMU 1128#ifdef CONFIG_MMU
1242 { 1129 {
1243 .ctl_name = VM_MAX_MAP_COUNT,
1244 .procname = "max_map_count", 1130 .procname = "max_map_count",
1245 .data = &sysctl_max_map_count, 1131 .data = &sysctl_max_map_count,
1246 .maxlen = sizeof(sysctl_max_map_count), 1132 .maxlen = sizeof(sysctl_max_map_count),
1247 .mode = 0644, 1133 .mode = 0644,
1248 .proc_handler = &proc_dointvec 1134 .proc_handler = proc_dointvec,
1135 .extra1 = &zero,
1249 }, 1136 },
1250#else 1137#else
1251 { 1138 {
1252 .ctl_name = CTL_UNNUMBERED,
1253 .procname = "nr_trim_pages", 1139 .procname = "nr_trim_pages",
1254 .data = &sysctl_nr_trim_pages, 1140 .data = &sysctl_nr_trim_pages,
1255 .maxlen = sizeof(sysctl_nr_trim_pages), 1141 .maxlen = sizeof(sysctl_nr_trim_pages),
1256 .mode = 0644, 1142 .mode = 0644,
1257 .proc_handler = &proc_dointvec_minmax, 1143 .proc_handler = proc_dointvec_minmax,
1258 .strategy = &sysctl_intvec,
1259 .extra1 = &zero, 1144 .extra1 = &zero,
1260 }, 1145 },
1261#endif 1146#endif
1262 { 1147 {
1263 .ctl_name = VM_LAPTOP_MODE,
1264 .procname = "laptop_mode", 1148 .procname = "laptop_mode",
1265 .data = &laptop_mode, 1149 .data = &laptop_mode,
1266 .maxlen = sizeof(laptop_mode), 1150 .maxlen = sizeof(laptop_mode),
1267 .mode = 0644, 1151 .mode = 0644,
1268 .proc_handler = &proc_dointvec_jiffies, 1152 .proc_handler = proc_dointvec_jiffies,
1269 .strategy = &sysctl_jiffies,
1270 }, 1153 },
1271 { 1154 {
1272 .ctl_name = VM_BLOCK_DUMP,
1273 .procname = "block_dump", 1155 .procname = "block_dump",
1274 .data = &block_dump, 1156 .data = &block_dump,
1275 .maxlen = sizeof(block_dump), 1157 .maxlen = sizeof(block_dump),
1276 .mode = 0644, 1158 .mode = 0644,
1277 .proc_handler = &proc_dointvec, 1159 .proc_handler = proc_dointvec,
1278 .strategy = &sysctl_intvec,
1279 .extra1 = &zero, 1160 .extra1 = &zero,
1280 }, 1161 },
1281 { 1162 {
1282 .ctl_name = VM_VFS_CACHE_PRESSURE,
1283 .procname = "vfs_cache_pressure", 1163 .procname = "vfs_cache_pressure",
1284 .data = &sysctl_vfs_cache_pressure, 1164 .data = &sysctl_vfs_cache_pressure,
1285 .maxlen = sizeof(sysctl_vfs_cache_pressure), 1165 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1286 .mode = 0644, 1166 .mode = 0644,
1287 .proc_handler = &proc_dointvec, 1167 .proc_handler = proc_dointvec,
1288 .strategy = &sysctl_intvec,
1289 .extra1 = &zero, 1168 .extra1 = &zero,
1290 }, 1169 },
1291#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT 1170#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1292 { 1171 {
1293 .ctl_name = VM_LEGACY_VA_LAYOUT,
1294 .procname = "legacy_va_layout", 1172 .procname = "legacy_va_layout",
1295 .data = &sysctl_legacy_va_layout, 1173 .data = &sysctl_legacy_va_layout,
1296 .maxlen = sizeof(sysctl_legacy_va_layout), 1174 .maxlen = sizeof(sysctl_legacy_va_layout),
1297 .mode = 0644, 1175 .mode = 0644,
1298 .proc_handler = &proc_dointvec, 1176 .proc_handler = proc_dointvec,
1299 .strategy = &sysctl_intvec,
1300 .extra1 = &zero, 1177 .extra1 = &zero,
1301 }, 1178 },
1302#endif 1179#endif
1303#ifdef CONFIG_NUMA 1180#ifdef CONFIG_NUMA
1304 { 1181 {
1305 .ctl_name = VM_ZONE_RECLAIM_MODE,
1306 .procname = "zone_reclaim_mode", 1182 .procname = "zone_reclaim_mode",
1307 .data = &zone_reclaim_mode, 1183 .data = &zone_reclaim_mode,
1308 .maxlen = sizeof(zone_reclaim_mode), 1184 .maxlen = sizeof(zone_reclaim_mode),
1309 .mode = 0644, 1185 .mode = 0644,
1310 .proc_handler = &proc_dointvec, 1186 .proc_handler = proc_dointvec,
1311 .strategy = &sysctl_intvec,
1312 .extra1 = &zero, 1187 .extra1 = &zero,
1313 }, 1188 },
1314 { 1189 {
1315 .ctl_name = VM_MIN_UNMAPPED,
1316 .procname = "min_unmapped_ratio", 1190 .procname = "min_unmapped_ratio",
1317 .data = &sysctl_min_unmapped_ratio, 1191 .data = &sysctl_min_unmapped_ratio,
1318 .maxlen = sizeof(sysctl_min_unmapped_ratio), 1192 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1319 .mode = 0644, 1193 .mode = 0644,
1320 .proc_handler = &sysctl_min_unmapped_ratio_sysctl_handler, 1194 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
1321 .strategy = &sysctl_intvec,
1322 .extra1 = &zero, 1195 .extra1 = &zero,
1323 .extra2 = &one_hundred, 1196 .extra2 = &one_hundred,
1324 }, 1197 },
1325 { 1198 {
1326 .ctl_name = VM_MIN_SLAB,
1327 .procname = "min_slab_ratio", 1199 .procname = "min_slab_ratio",
1328 .data = &sysctl_min_slab_ratio, 1200 .data = &sysctl_min_slab_ratio,
1329 .maxlen = sizeof(sysctl_min_slab_ratio), 1201 .maxlen = sizeof(sysctl_min_slab_ratio),
1330 .mode = 0644, 1202 .mode = 0644,
1331 .proc_handler = &sysctl_min_slab_ratio_sysctl_handler, 1203 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
1332 .strategy = &sysctl_intvec,
1333 .extra1 = &zero, 1204 .extra1 = &zero,
1334 .extra2 = &one_hundred, 1205 .extra2 = &one_hundred,
1335 }, 1206 },
1336#endif 1207#endif
1337#ifdef CONFIG_SMP 1208#ifdef CONFIG_SMP
1338 { 1209 {
1339 .ctl_name = CTL_UNNUMBERED,
1340 .procname = "stat_interval", 1210 .procname = "stat_interval",
1341 .data = &sysctl_stat_interval, 1211 .data = &sysctl_stat_interval,
1342 .maxlen = sizeof(sysctl_stat_interval), 1212 .maxlen = sizeof(sysctl_stat_interval),
1343 .mode = 0644, 1213 .mode = 0644,
1344 .proc_handler = &proc_dointvec_jiffies, 1214 .proc_handler = proc_dointvec_jiffies,
1345 .strategy = &sysctl_jiffies,
1346 }, 1215 },
1347#endif 1216#endif
1348 { 1217 {
1349 .ctl_name = CTL_UNNUMBERED,
1350 .procname = "mmap_min_addr", 1218 .procname = "mmap_min_addr",
1351 .data = &dac_mmap_min_addr, 1219 .data = &dac_mmap_min_addr,
1352 .maxlen = sizeof(unsigned long), 1220 .maxlen = sizeof(unsigned long),
1353 .mode = 0644, 1221 .mode = 0644,
1354 .proc_handler = &mmap_min_addr_handler, 1222 .proc_handler = mmap_min_addr_handler,
1355 }, 1223 },
1356#ifdef CONFIG_NUMA 1224#ifdef CONFIG_NUMA
1357 { 1225 {
1358 .ctl_name = CTL_UNNUMBERED,
1359 .procname = "numa_zonelist_order", 1226 .procname = "numa_zonelist_order",
1360 .data = &numa_zonelist_order, 1227 .data = &numa_zonelist_order,
1361 .maxlen = NUMA_ZONELIST_ORDER_LEN, 1228 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1362 .mode = 0644, 1229 .mode = 0644,
1363 .proc_handler = &numa_zonelist_order_handler, 1230 .proc_handler = numa_zonelist_order_handler,
1364 .strategy = &sysctl_string,
1365 }, 1231 },
1366#endif 1232#endif
1367#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \ 1233#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1368 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) 1234 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1369 { 1235 {
1370 .ctl_name = VM_VDSO_ENABLED,
1371 .procname = "vdso_enabled", 1236 .procname = "vdso_enabled",
1372 .data = &vdso_enabled, 1237 .data = &vdso_enabled,
1373 .maxlen = sizeof(vdso_enabled), 1238 .maxlen = sizeof(vdso_enabled),
1374 .mode = 0644, 1239 .mode = 0644,
1375 .proc_handler = &proc_dointvec, 1240 .proc_handler = proc_dointvec,
1376 .strategy = &sysctl_intvec,
1377 .extra1 = &zero, 1241 .extra1 = &zero,
1378 }, 1242 },
1379#endif 1243#endif
1380#ifdef CONFIG_HIGHMEM 1244#ifdef CONFIG_HIGHMEM
1381 { 1245 {
1382 .ctl_name = CTL_UNNUMBERED,
1383 .procname = "highmem_is_dirtyable", 1246 .procname = "highmem_is_dirtyable",
1384 .data = &vm_highmem_is_dirtyable, 1247 .data = &vm_highmem_is_dirtyable,
1385 .maxlen = sizeof(vm_highmem_is_dirtyable), 1248 .maxlen = sizeof(vm_highmem_is_dirtyable),
1386 .mode = 0644, 1249 .mode = 0644,
1387 .proc_handler = &proc_dointvec_minmax, 1250 .proc_handler = proc_dointvec_minmax,
1388 .strategy = &sysctl_intvec,
1389 .extra1 = &zero, 1251 .extra1 = &zero,
1390 .extra2 = &one, 1252 .extra2 = &one,
1391 }, 1253 },
1392#endif 1254#endif
1393 { 1255 {
1394 .ctl_name = CTL_UNNUMBERED,
1395 .procname = "scan_unevictable_pages", 1256 .procname = "scan_unevictable_pages",
1396 .data = &scan_unevictable_pages, 1257 .data = &scan_unevictable_pages,
1397 .maxlen = sizeof(scan_unevictable_pages), 1258 .maxlen = sizeof(scan_unevictable_pages),
1398 .mode = 0644, 1259 .mode = 0644,
1399 .proc_handler = &scan_unevictable_handler, 1260 .proc_handler = scan_unevictable_handler,
1400 }, 1261 },
1401#ifdef CONFIG_MEMORY_FAILURE 1262#ifdef CONFIG_MEMORY_FAILURE
1402 { 1263 {
1403 .ctl_name = CTL_UNNUMBERED,
1404 .procname = "memory_failure_early_kill", 1264 .procname = "memory_failure_early_kill",
1405 .data = &sysctl_memory_failure_early_kill, 1265 .data = &sysctl_memory_failure_early_kill,
1406 .maxlen = sizeof(sysctl_memory_failure_early_kill), 1266 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1407 .mode = 0644, 1267 .mode = 0644,
1408 .proc_handler = &proc_dointvec_minmax, 1268 .proc_handler = proc_dointvec_minmax,
1409 .strategy = &sysctl_intvec,
1410 .extra1 = &zero, 1269 .extra1 = &zero,
1411 .extra2 = &one, 1270 .extra2 = &one,
1412 }, 1271 },
1413 { 1272 {
1414 .ctl_name = CTL_UNNUMBERED,
1415 .procname = "memory_failure_recovery", 1273 .procname = "memory_failure_recovery",
1416 .data = &sysctl_memory_failure_recovery, 1274 .data = &sysctl_memory_failure_recovery,
1417 .maxlen = sizeof(sysctl_memory_failure_recovery), 1275 .maxlen = sizeof(sysctl_memory_failure_recovery),
1418 .mode = 0644, 1276 .mode = 0644,
1419 .proc_handler = &proc_dointvec_minmax, 1277 .proc_handler = proc_dointvec_minmax,
1420 .strategy = &sysctl_intvec,
1421 .extra1 = &zero, 1278 .extra1 = &zero,
1422 .extra2 = &one, 1279 .extra2 = &one,
1423 }, 1280 },
@@ -1427,116 +1284,104 @@ static struct ctl_table vm_table[] = {
1427 * NOTE: do not add new entries to this table unless you have read 1284 * NOTE: do not add new entries to this table unless you have read
1428 * Documentation/sysctl/ctl_unnumbered.txt 1285 * Documentation/sysctl/ctl_unnumbered.txt
1429 */ 1286 */
1430 { .ctl_name = 0 } 1287 { }
1431}; 1288};
1432 1289
1433#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) 1290#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1434static struct ctl_table binfmt_misc_table[] = { 1291static struct ctl_table binfmt_misc_table[] = {
1435 { .ctl_name = 0 } 1292 { }
1436}; 1293};
1437#endif 1294#endif
1438 1295
1439static struct ctl_table fs_table[] = { 1296static struct ctl_table fs_table[] = {
1440 { 1297 {
1441 .ctl_name = FS_NRINODE,
1442 .procname = "inode-nr", 1298 .procname = "inode-nr",
1443 .data = &inodes_stat, 1299 .data = &inodes_stat,
1444 .maxlen = 2*sizeof(int), 1300 .maxlen = 2*sizeof(int),
1445 .mode = 0444, 1301 .mode = 0444,
1446 .proc_handler = &proc_dointvec, 1302 .proc_handler = proc_dointvec,
1447 }, 1303 },
1448 { 1304 {
1449 .ctl_name = FS_STATINODE,
1450 .procname = "inode-state", 1305 .procname = "inode-state",
1451 .data = &inodes_stat, 1306 .data = &inodes_stat,
1452 .maxlen = 7*sizeof(int), 1307 .maxlen = 7*sizeof(int),
1453 .mode = 0444, 1308 .mode = 0444,
1454 .proc_handler = &proc_dointvec, 1309 .proc_handler = proc_dointvec,
1455 }, 1310 },
1456 { 1311 {
1457 .procname = "file-nr", 1312 .procname = "file-nr",
1458 .data = &files_stat, 1313 .data = &files_stat,
1459 .maxlen = 3*sizeof(int), 1314 .maxlen = 3*sizeof(int),
1460 .mode = 0444, 1315 .mode = 0444,
1461 .proc_handler = &proc_nr_files, 1316 .proc_handler = proc_nr_files,
1462 }, 1317 },
1463 { 1318 {
1464 .ctl_name = FS_MAXFILE,
1465 .procname = "file-max", 1319 .procname = "file-max",
1466 .data = &files_stat.max_files, 1320 .data = &files_stat.max_files,
1467 .maxlen = sizeof(int), 1321 .maxlen = sizeof(int),
1468 .mode = 0644, 1322 .mode = 0644,
1469 .proc_handler = &proc_dointvec, 1323 .proc_handler = proc_dointvec,
1470 }, 1324 },
1471 { 1325 {
1472 .ctl_name = CTL_UNNUMBERED,
1473 .procname = "nr_open", 1326 .procname = "nr_open",
1474 .data = &sysctl_nr_open, 1327 .data = &sysctl_nr_open,
1475 .maxlen = sizeof(int), 1328 .maxlen = sizeof(int),
1476 .mode = 0644, 1329 .mode = 0644,
1477 .proc_handler = &proc_dointvec_minmax, 1330 .proc_handler = proc_dointvec_minmax,
1478 .extra1 = &sysctl_nr_open_min, 1331 .extra1 = &sysctl_nr_open_min,
1479 .extra2 = &sysctl_nr_open_max, 1332 .extra2 = &sysctl_nr_open_max,
1480 }, 1333 },
1481 { 1334 {
1482 .ctl_name = FS_DENTRY,
1483 .procname = "dentry-state", 1335 .procname = "dentry-state",
1484 .data = &dentry_stat, 1336 .data = &dentry_stat,
1485 .maxlen = 6*sizeof(int), 1337 .maxlen = 6*sizeof(int),
1486 .mode = 0444, 1338 .mode = 0444,
1487 .proc_handler = &proc_dointvec, 1339 .proc_handler = proc_dointvec,
1488 }, 1340 },
1489 { 1341 {
1490 .ctl_name = FS_OVERFLOWUID,
1491 .procname = "overflowuid", 1342 .procname = "overflowuid",
1492 .data = &fs_overflowuid, 1343 .data = &fs_overflowuid,
1493 .maxlen = sizeof(int), 1344 .maxlen = sizeof(int),
1494 .mode = 0644, 1345 .mode = 0644,
1495 .proc_handler = &proc_dointvec_minmax, 1346 .proc_handler = proc_dointvec_minmax,
1496 .strategy = &sysctl_intvec,
1497 .extra1 = &minolduid, 1347 .extra1 = &minolduid,
1498 .extra2 = &maxolduid, 1348 .extra2 = &maxolduid,
1499 }, 1349 },
1500 { 1350 {
1501 .ctl_name = FS_OVERFLOWGID,
1502 .procname = "overflowgid", 1351 .procname = "overflowgid",
1503 .data = &fs_overflowgid, 1352 .data = &fs_overflowgid,
1504 .maxlen = sizeof(int), 1353 .maxlen = sizeof(int),
1505 .mode = 0644, 1354 .mode = 0644,
1506 .proc_handler = &proc_dointvec_minmax, 1355 .proc_handler = proc_dointvec_minmax,
1507 .strategy = &sysctl_intvec,
1508 .extra1 = &minolduid, 1356 .extra1 = &minolduid,
1509 .extra2 = &maxolduid, 1357 .extra2 = &maxolduid,
1510 }, 1358 },
1511#ifdef CONFIG_FILE_LOCKING 1359#ifdef CONFIG_FILE_LOCKING
1512 { 1360 {
1513 .ctl_name = FS_LEASES,
1514 .procname = "leases-enable", 1361 .procname = "leases-enable",
1515 .data = &leases_enable, 1362 .data = &leases_enable,
1516 .maxlen = sizeof(int), 1363 .maxlen = sizeof(int),
1517 .mode = 0644, 1364 .mode = 0644,
1518 .proc_handler = &proc_dointvec, 1365 .proc_handler = proc_dointvec,
1519 }, 1366 },
1520#endif 1367#endif
1521#ifdef CONFIG_DNOTIFY 1368#ifdef CONFIG_DNOTIFY
1522 { 1369 {
1523 .ctl_name = FS_DIR_NOTIFY,
1524 .procname = "dir-notify-enable", 1370 .procname = "dir-notify-enable",
1525 .data = &dir_notify_enable, 1371 .data = &dir_notify_enable,
1526 .maxlen = sizeof(int), 1372 .maxlen = sizeof(int),
1527 .mode = 0644, 1373 .mode = 0644,
1528 .proc_handler = &proc_dointvec, 1374 .proc_handler = proc_dointvec,
1529 }, 1375 },
1530#endif 1376#endif
1531#ifdef CONFIG_MMU 1377#ifdef CONFIG_MMU
1532#ifdef CONFIG_FILE_LOCKING 1378#ifdef CONFIG_FILE_LOCKING
1533 { 1379 {
1534 .ctl_name = FS_LEASE_TIME,
1535 .procname = "lease-break-time", 1380 .procname = "lease-break-time",
1536 .data = &lease_break_time, 1381 .data = &lease_break_time,
1537 .maxlen = sizeof(int), 1382 .maxlen = sizeof(int),
1538 .mode = 0644, 1383 .mode = 0644,
1539 .proc_handler = &proc_dointvec, 1384 .proc_handler = proc_dointvec,
1540 }, 1385 },
1541#endif 1386#endif
1542#ifdef CONFIG_AIO 1387#ifdef CONFIG_AIO
@@ -1545,19 +1390,18 @@ static struct ctl_table fs_table[] = {
1545 .data = &aio_nr, 1390 .data = &aio_nr,
1546 .maxlen = sizeof(aio_nr), 1391 .maxlen = sizeof(aio_nr),
1547 .mode = 0444, 1392 .mode = 0444,
1548 .proc_handler = &proc_doulongvec_minmax, 1393 .proc_handler = proc_doulongvec_minmax,
1549 }, 1394 },
1550 { 1395 {
1551 .procname = "aio-max-nr", 1396 .procname = "aio-max-nr",
1552 .data = &aio_max_nr, 1397 .data = &aio_max_nr,
1553 .maxlen = sizeof(aio_max_nr), 1398 .maxlen = sizeof(aio_max_nr),
1554 .mode = 0644, 1399 .mode = 0644,
1555 .proc_handler = &proc_doulongvec_minmax, 1400 .proc_handler = proc_doulongvec_minmax,
1556 }, 1401 },
1557#endif /* CONFIG_AIO */ 1402#endif /* CONFIG_AIO */
1558#ifdef CONFIG_INOTIFY_USER 1403#ifdef CONFIG_INOTIFY_USER
1559 { 1404 {
1560 .ctl_name = FS_INOTIFY,
1561 .procname = "inotify", 1405 .procname = "inotify",
1562 .mode = 0555, 1406 .mode = 0555,
1563 .child = inotify_table, 1407 .child = inotify_table,
@@ -1572,19 +1416,16 @@ static struct ctl_table fs_table[] = {
1572#endif 1416#endif
1573#endif 1417#endif
1574 { 1418 {
1575 .ctl_name = KERN_SETUID_DUMPABLE,
1576 .procname = "suid_dumpable", 1419 .procname = "suid_dumpable",
1577 .data = &suid_dumpable, 1420 .data = &suid_dumpable,
1578 .maxlen = sizeof(int), 1421 .maxlen = sizeof(int),
1579 .mode = 0644, 1422 .mode = 0644,
1580 .proc_handler = &proc_dointvec_minmax, 1423 .proc_handler = proc_dointvec_minmax,
1581 .strategy = &sysctl_intvec,
1582 .extra1 = &zero, 1424 .extra1 = &zero,
1583 .extra2 = &two, 1425 .extra2 = &two,
1584 }, 1426 },
1585#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) 1427#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1586 { 1428 {
1587 .ctl_name = CTL_UNNUMBERED,
1588 .procname = "binfmt_misc", 1429 .procname = "binfmt_misc",
1589 .mode = 0555, 1430 .mode = 0555,
1590 .child = binfmt_misc_table, 1431 .child = binfmt_misc_table,
@@ -1594,13 +1435,12 @@ static struct ctl_table fs_table[] = {
1594 * NOTE: do not add new entries to this table unless you have read 1435 * NOTE: do not add new entries to this table unless you have read
1595 * Documentation/sysctl/ctl_unnumbered.txt 1436 * Documentation/sysctl/ctl_unnumbered.txt
1596 */ 1437 */
1597 { .ctl_name = 0 } 1438 { }
1598}; 1439};
1599 1440
1600static struct ctl_table debug_table[] = { 1441static struct ctl_table debug_table[] = {
1601#if defined(CONFIG_X86) || defined(CONFIG_PPC) 1442#if defined(CONFIG_X86) || defined(CONFIG_PPC)
1602 { 1443 {
1603 .ctl_name = CTL_UNNUMBERED,
1604 .procname = "exception-trace", 1444 .procname = "exception-trace",
1605 .data = &show_unhandled_signals, 1445 .data = &show_unhandled_signals,
1606 .maxlen = sizeof(int), 1446 .maxlen = sizeof(int),
@@ -1608,11 +1448,11 @@ static struct ctl_table debug_table[] = {
1608 .proc_handler = proc_dointvec 1448 .proc_handler = proc_dointvec
1609 }, 1449 },
1610#endif 1450#endif
1611 { .ctl_name = 0 } 1451 { }
1612}; 1452};
1613 1453
1614static struct ctl_table dev_table[] = { 1454static struct ctl_table dev_table[] = {
1615 { .ctl_name = 0 } 1455 { }
1616}; 1456};
1617 1457
1618static DEFINE_SPINLOCK(sysctl_lock); 1458static DEFINE_SPINLOCK(sysctl_lock);
@@ -1766,122 +1606,6 @@ void register_sysctl_root(struct ctl_table_root *root)
1766 spin_unlock(&sysctl_lock); 1606 spin_unlock(&sysctl_lock);
1767} 1607}
1768 1608
1769#ifdef CONFIG_SYSCTL_SYSCALL
1770/* Perform the actual read/write of a sysctl table entry. */
1771static 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
1803static 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;
1810repeat:
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
1837int 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
1864SYSCALL_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();
1880out:
1881 return error;
1882}
1883#endif /* CONFIG_SYSCTL_SYSCALL */
1884
1885/* 1609/*
1886 * sysctl_perm does NOT grant the superuser all rights automatically, because 1610 * sysctl_perm does NOT grant the superuser all rights automatically, because
1887 * some sysctl variables are readonly even to root. 1611 * some sysctl variables are readonly even to root.
@@ -1917,7 +1641,7 @@ int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
1917 1641
1918static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table) 1642static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1919{ 1643{
1920 for (; table->ctl_name || table->procname; table++) { 1644 for (; table->procname; table++) {
1921 table->parent = parent; 1645 table->parent = parent;
1922 if (table->child) 1646 if (table->child)
1923 sysctl_set_parent(table, table->child); 1647 sysctl_set_parent(table, table->child);
@@ -1949,11 +1673,11 @@ static struct ctl_table *is_branch_in(struct ctl_table *branch,
1949 return NULL; 1673 return NULL;
1950 1674
1951 /* ... and nothing else */ 1675 /* ... and nothing else */
1952 if (branch[1].procname || branch[1].ctl_name) 1676 if (branch[1].procname)
1953 return NULL; 1677 return NULL;
1954 1678
1955 /* table should contain subdirectory with the same name */ 1679 /* table should contain subdirectory with the same name */
1956 for (p = table; p->procname || p->ctl_name; p++) { 1680 for (p = table; p->procname; p++) {
1957 if (!p->child) 1681 if (!p->child)
1958 continue; 1682 continue;
1959 if (p->procname && strcmp(p->procname, s) == 0) 1683 if (p->procname && strcmp(p->procname, s) == 0)
@@ -1998,9 +1722,6 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
1998 * 1722 *
1999 * The members of the &struct ctl_table structure are used as follows: 1723 * The members of the &struct ctl_table structure are used as follows:
2000 * 1724 *
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 1725 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
2005 * enter a sysctl file 1726 * enter a sysctl file
2006 * 1727 *
@@ -2015,8 +1736,6 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
2015 * 1736 *
2016 * proc_handler - the text handler routine (described below) 1737 * proc_handler - the text handler routine (described below)
2017 * 1738 *
2018 * strategy - the strategy routine (described below)
2019 *
2020 * de - for internal use by the sysctl routines 1739 * de - for internal use by the sysctl routines
2021 * 1740 *
2022 * extra1, extra2 - extra pointers usable by the proc handler routines 1741 * extra1, extra2 - extra pointers usable by the proc handler routines
@@ -2029,19 +1748,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 1748 * struct enable minimal validation of the values being written to be
2030 * performed, and the mode field allows minimal authentication. 1749 * performed, and the mode field allows minimal authentication.
2031 * 1750 *
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 1751 * There must be a proc_handler routine for any terminal nodes
2046 * mirrored under /proc/sys (non-terminals are handled by a built-in 1752 * mirrored under /proc/sys (non-terminals are handled by a built-in
2047 * directory handler). Several default handlers are available to 1753 * directory handler). Several default handlers are available to
@@ -2068,13 +1774,13 @@ struct ctl_table_header *__register_sysctl_paths(
2068 struct ctl_table_set *set; 1774 struct ctl_table_set *set;
2069 1775
2070 /* Count the path components */ 1776 /* Count the path components */
2071 for (npath = 0; path[npath].ctl_name || path[npath].procname; ++npath) 1777 for (npath = 0; path[npath].procname; ++npath)
2072 ; 1778 ;
2073 1779
2074 /* 1780 /*
2075 * For each path component, allocate a 2-element ctl_table array. 1781 * For each path component, allocate a 2-element ctl_table array.
2076 * The first array element will be filled with the sysctl entry 1782 * The first array element will be filled with the sysctl entry
2077 * for this, the second will be the sentinel (ctl_name == 0). 1783 * for this, the second will be the sentinel (procname == 0).
2078 * 1784 *
2079 * We allocate everything in one go so that we don't have to 1785 * We allocate everything in one go so that we don't have to
2080 * worry about freeing additional memory in unregister_sysctl_table. 1786 * worry about freeing additional memory in unregister_sysctl_table.
@@ -2091,7 +1797,6 @@ struct ctl_table_header *__register_sysctl_paths(
2091 for (n = 0; n < npath; ++n, ++path) { 1797 for (n = 0; n < npath; ++n, ++path) {
2092 /* Copy the procname */ 1798 /* Copy the procname */
2093 new->procname = path->procname; 1799 new->procname = path->procname;
2094 new->ctl_name = path->ctl_name;
2095 new->mode = 0555; 1800 new->mode = 0555;
2096 1801
2097 *prevp = new; 1802 *prevp = new;
@@ -2953,286 +2658,6 @@ int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2953 2658
2954#endif /* CONFIG_PROC_FS */ 2659#endif /* CONFIG_PROC_FS */
2955 2660
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) */
2963int 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: */
2997int 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 */
3043int 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 */
3079int 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 */
3113int 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
3151SYSCALL_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
3168int 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
3175int 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
3182int 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
3189int 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
3196int 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
3205static 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/* 2661/*
3237 * No sense putting this after each symbol definition, twice, 2662 * No sense putting this after each symbol definition, twice,
3238 * exception granted :-) 2663 * exception granted :-)
@@ -3247,9 +2672,4 @@ EXPORT_SYMBOL(proc_doulongvec_minmax);
3247EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax); 2672EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
3248EXPORT_SYMBOL(register_sysctl_table); 2673EXPORT_SYMBOL(register_sysctl_table);
3249EXPORT_SYMBOL(register_sysctl_paths); 2674EXPORT_SYMBOL(register_sysctl_paths);
3250EXPORT_SYMBOL(sysctl_intvec);
3251EXPORT_SYMBOL(sysctl_jiffies);
3252EXPORT_SYMBOL(sysctl_ms_jiffies);
3253EXPORT_SYMBOL(sysctl_string);
3254EXPORT_SYMBOL(sysctl_data);
3255EXPORT_SYMBOL(unregister_sysctl_table); 2675EXPORT_SYMBOL(unregister_sysctl_table);