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