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