sysctl.c 61.6 KB
Newer Older
Linus Torvalds's avatar
Linus Torvalds committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/*
 * sysctl.c: General linux system control interface
 *
 * Begun 24 March 1995, Stephen Tweedie
 * Added /proc support, Dec 1995
 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
 * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
 * Dynamic registration fixes, Stephen Tweedie.
 * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
 * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
 *  Horn.
 * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
 * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
 * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
 *  Wendling.
 * The list_for_each() macro wasn't appropriate for the sysctl loop.
 *  Removed it and replaced it with older style, 03/23/00, Bill Wendling
 */

#include <linux/module.h>
#include <linux/mm.h>
#include <linux/swap.h>
#include <linux/slab.h>
#include <linux/sysctl.h>
Dave Young's avatar
Dave Young committed
26
#include <linux/signal.h>
Linus Torvalds's avatar
Linus Torvalds committed
27
#include <linux/proc_fs.h>
28
#include <linux/security.h>
Linus Torvalds's avatar
Linus Torvalds committed
29
#include <linux/ctype.h>
30
#include <linux/kmemcheck.h>
31
#include <linux/fs.h>
Linus Torvalds's avatar
Linus Torvalds committed
32 33
#include <linux/init.h>
#include <linux/kernel.h>
34
#include <linux/kobject.h>
35
#include <linux/net.h>
Linus Torvalds's avatar
Linus Torvalds committed
36 37 38
#include <linux/sysrq.h>
#include <linux/highuid.h>
#include <linux/writeback.h>
39
#include <linux/ratelimit.h>
Linus Torvalds's avatar
Linus Torvalds committed
40 41
#include <linux/hugetlb.h>
#include <linux/initrd.h>
42
#include <linux/key.h>
Linus Torvalds's avatar
Linus Torvalds committed
43 44 45 46
#include <linux/times.h>
#include <linux/limits.h>
#include <linux/dcache.h>
#include <linux/syscalls.h>
Adrian Bunk's avatar
Adrian Bunk committed
47
#include <linux/vmstat.h>
48 49
#include <linux/nfs_fs.h>
#include <linux/acpi.h>
50
#include <linux/reboot.h>
51
#include <linux/ftrace.h>
52
#include <linux/slow-work.h>
53
#include <linux/perf_event.h>
54
#include <linux/kprobes.h>
Linus Torvalds's avatar
Linus Torvalds committed
55 56 57 58

#include <asm/uaccess.h>
#include <asm/processor.h>

59 60
#ifdef CONFIG_X86
#include <asm/nmi.h>
61
#include <asm/stacktrace.h>
62
#include <asm/io.h>
63 64
#endif

65

Linus Torvalds's avatar
Linus Torvalds committed
66 67 68 69 70
#if defined(CONFIG_SYSCTL)

/* External variables not in a header file. */
extern int sysctl_overcommit_memory;
extern int sysctl_overcommit_ratio;
71
extern int sysctl_panic_on_oom;
72
extern int sysctl_oom_kill_allocating_task;
73
extern int sysctl_oom_dump_tasks;
Linus Torvalds's avatar
Linus Torvalds committed
74 75
extern int max_threads;
extern int core_uses_pid;
Alan Cox's avatar
Alan Cox committed
76
extern int suid_dumpable;
Linus Torvalds's avatar
Linus Torvalds committed
77
extern char core_pattern[];
78
extern unsigned int core_pipe_limit;
Linus Torvalds's avatar
Linus Torvalds committed
79 80 81
extern int pid_max;
extern int min_free_kbytes;
extern int pid_max_min, pid_max_max;
Andrew Morton's avatar
Andrew Morton committed
82
extern int sysctl_drop_caches;
83
extern int percpu_pagelist_fraction;
84
extern int compat_log;
Arjan van de Ven's avatar
Arjan van de Ven committed
85
extern int latencytop_enabled;
86
extern int sysctl_nr_open_min, sysctl_nr_open_max;
87 88 89
#ifndef CONFIG_MMU
extern int sysctl_nr_trim_pages;
#endif
90
#ifdef CONFIG_BLOCK
91
extern int blk_iopoll_enabled;
92
#endif
Linus Torvalds's avatar
Linus Torvalds committed
93

94
/* Constants used for minimum and  maximum */
95
#ifdef CONFIG_DETECT_SOFTLOCKUP
96
static int sixty = 60;
97
static int neg_one = -1;
98 99 100
#endif

static int zero;
101 102
static int __maybe_unused one = 1;
static int __maybe_unused two = 2;
103
static unsigned long one_ul = 1;
104
static int one_hundred = 100;
105 106 107
#ifdef CONFIG_PRINTK
static int ten_thousand = 10000;
#endif
108

109 110 111
/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;

Linus Torvalds's avatar
Linus Torvalds committed
112 113 114
/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
static int maxolduid = 65535;
static int minolduid;
115
static int min_percpu_pagelist_fract = 8;
Linus Torvalds's avatar
Linus Torvalds committed
116 117 118 119 120 121 122

static int ngroups_max = NGROUPS_MAX;

#ifdef CONFIG_CHR_DEV_SG
extern int sg_big_buff;
#endif

123
#ifdef CONFIG_SPARC
124
#include <asm/system.h>
Linus Torvalds's avatar
Linus Torvalds committed
125 126
#endif

127 128 129 130
#ifdef CONFIG_SPARC64
extern int sysctl_tsb_ratio;
#endif

Linus Torvalds's avatar
Linus Torvalds committed
131 132 133 134 135
#ifdef __hppa__
extern int pwrsw_enabled;
extern int unaligned_enabled;
#endif

136
#ifdef CONFIG_S390
Linus Torvalds's avatar
Linus Torvalds committed
137 138 139 140
#ifdef CONFIG_MATHEMU
extern int sysctl_ieee_emulation_warnings;
#endif
extern int sysctl_userprocess_debug;
141
extern int spin_retry;
Linus Torvalds's avatar
Linus Torvalds committed
142 143 144 145 146 147
#endif

#ifdef CONFIG_BSD_PROCESS_ACCT
extern int acct_parm[];
#endif

148 149
#ifdef CONFIG_IA64
extern int no_unaligned_warning;
150
extern int unaligned_dump_stack;
151 152
#endif

153 154
extern struct ratelimit_state printk_ratelimit_state;

Ingo Molnar's avatar
Ingo Molnar committed
155 156 157 158
#ifdef CONFIG_RT_MUTEXES
extern int max_lock_depth;
#endif

159
#ifdef CONFIG_PROC_SYSCTL
160
static int proc_do_cad_pid(struct ctl_table *table, int write,
161
		  void __user *buffer, size_t *lenp, loff_t *ppos);
162
static int proc_taint(struct ctl_table *table, int write,
163
			       void __user *buffer, size_t *lenp, loff_t *ppos);
164
#endif
165

166
static struct ctl_table root_table[];
167 168
static struct ctl_table_root sysctl_table_root;
static struct ctl_table_header root_table_header = {
169
	.count = 1,
170
	.ctl_table = root_table,
171
	.ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),
172
	.root = &sysctl_table_root,
173
	.set = &sysctl_table_root.default_set,
174 175 176
};
static struct ctl_table_root sysctl_table_root = {
	.root_list = LIST_HEAD_INIT(sysctl_table_root.root_list),
177
	.default_set.list = LIST_HEAD_INIT(root_table_header.ctl_entry),
178
};
Linus Torvalds's avatar
Linus Torvalds committed
179

180 181 182 183 184 185
static struct ctl_table kern_table[];
static struct ctl_table vm_table[];
static struct ctl_table fs_table[];
static struct ctl_table debug_table[];
static struct ctl_table dev_table[];
extern struct ctl_table random_table[];
186
#ifdef CONFIG_INOTIFY_USER
187
extern struct ctl_table inotify_table[];
Robert Love's avatar
Robert Love committed
188
#endif
189 190 191
#ifdef CONFIG_EPOLL
extern struct ctl_table epoll_table[];
#endif
Linus Torvalds's avatar
Linus Torvalds committed
192 193 194 195 196

#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
int sysctl_legacy_va_layout;
#endif

Peter Zijlstra's avatar
Peter Zijlstra committed
197 198
extern int prove_locking;
extern int lock_stat;
199

Linus Torvalds's avatar
Linus Torvalds committed
200 201
/* The default sysctl tables: */

202
static struct ctl_table root_table[] = {
Linus Torvalds's avatar
Linus Torvalds committed
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
	{
		.procname	= "kernel",
		.mode		= 0555,
		.child		= kern_table,
	},
	{
		.procname	= "vm",
		.mode		= 0555,
		.child		= vm_table,
	},
	{
		.procname	= "fs",
		.mode		= 0555,
		.child		= fs_table,
	},
	{
		.procname	= "debug",
		.mode		= 0555,
		.child		= debug_table,
	},
	{
		.procname	= "dev",
		.mode		= 0555,
		.child		= dev_table,
	},
228 229 230 231
/*
 * NOTE: do not add new entries to this table unless you have read
 * Documentation/sysctl/ctl_unnumbered.txt
 */
232
	{ }
Linus Torvalds's avatar
Linus Torvalds committed
233 234
};

Ingo Molnar's avatar
Ingo Molnar committed
235
#ifdef CONFIG_SCHED_DEBUG
236 237 238 239
static int min_sched_granularity_ns = 100000;		/* 100 usecs */
static int max_sched_granularity_ns = NSEC_PER_SEC;	/* 1 second */
static int min_wakeup_granularity_ns;			/* 0 usecs */
static int max_wakeup_granularity_ns = NSEC_PER_SEC;	/* 1 second */
240 241
static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
242 243
static int min_sched_shares_ratelimit = 100000; /* 100 usec */
static int max_sched_shares_ratelimit = NSEC_PER_SEC; /* 1 second */
Ingo Molnar's avatar
Ingo Molnar committed
244 245
#endif

246
static struct ctl_table kern_table[] = {
247 248 249 250 251
	{
		.procname	= "sched_child_runs_first",
		.data		= &sysctl_sched_child_runs_first,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
252
		.proc_handler	= proc_dointvec,
253
	},
Ingo Molnar's avatar
Ingo Molnar committed
254 255
#ifdef CONFIG_SCHED_DEBUG
	{
256 257
		.procname	= "sched_min_granularity_ns",
		.data		= &sysctl_sched_min_granularity,
Ingo Molnar's avatar
Ingo Molnar committed
258 259
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
260
		.proc_handler	= sched_proc_update_handler,
261 262
		.extra1		= &min_sched_granularity_ns,
		.extra2		= &max_sched_granularity_ns,
Ingo Molnar's avatar
Ingo Molnar committed
263
	},
264 265 266 267 268
	{
		.procname	= "sched_latency_ns",
		.data		= &sysctl_sched_latency,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
269
		.proc_handler	= sched_proc_update_handler,
270 271 272
		.extra1		= &min_sched_granularity_ns,
		.extra2		= &max_sched_granularity_ns,
	},
Ingo Molnar's avatar
Ingo Molnar committed
273 274 275 276 277
	{
		.procname	= "sched_wakeup_granularity_ns",
		.data		= &sysctl_sched_wakeup_granularity,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
278
		.proc_handler	= sched_proc_update_handler,
Ingo Molnar's avatar
Ingo Molnar committed
279 280 281
		.extra1		= &min_wakeup_granularity_ns,
		.extra2		= &max_wakeup_granularity_ns,
	},
282 283 284 285 286
	{
		.procname	= "sched_shares_ratelimit",
		.data		= &sysctl_sched_shares_ratelimit,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
287
		.proc_handler	= sched_proc_update_handler,
288 289
		.extra1		= &min_sched_shares_ratelimit,
		.extra2		= &max_sched_shares_ratelimit,
290
	},
291 292 293 294 295
	{
		.procname	= "sched_tunable_scaling",
		.data		= &sysctl_sched_tunable_scaling,
		.maxlen		= sizeof(enum sched_tunable_scaling),
		.mode		= 0644,
296
		.proc_handler	= sched_proc_update_handler,
297 298
		.extra1		= &min_sched_tunable_scaling,
		.extra2		= &max_sched_tunable_scaling,
299
	},
300 301 302 303 304
	{
		.procname	= "sched_shares_thresh",
		.data		= &sysctl_sched_shares_thresh,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
305
		.proc_handler	= proc_dointvec_minmax,
306 307
		.extra1		= &zero,
	},
308 309 310 311 312
	{
		.procname	= "sched_migration_cost",
		.data		= &sysctl_sched_migration_cost,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
313
		.proc_handler	= proc_dointvec,
314
	},
315 316 317 318
	{
		.procname	= "sched_nr_migrate",
		.data		= &sysctl_sched_nr_migrate,
		.maxlen		= sizeof(unsigned int),
Peter Zijlstra's avatar
Peter Zijlstra committed
319
		.mode		= 0644,
320
		.proc_handler	= proc_dointvec,
Peter Zijlstra's avatar
Peter Zijlstra committed
321
	},
322 323 324 325 326
	{
		.procname	= "sched_time_avg",
		.data		= &sysctl_sched_time_avg,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
327
		.proc_handler	= proc_dointvec,
328
	},
329 330 331 332 333
	{
		.procname	= "timer_migration",
		.data		= &sysctl_timer_migration,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
334
		.proc_handler	= proc_dointvec_minmax,
335 336
		.extra1		= &zero,
		.extra2		= &one,
Peter Zijlstra's avatar
Peter Zijlstra committed
337
	},
338
#endif
Peter Zijlstra's avatar
Peter Zijlstra committed
339 340 341 342 343
	{
		.procname	= "sched_rt_period_us",
		.data		= &sysctl_sched_rt_period,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
344
		.proc_handler	= sched_rt_handler,
Peter Zijlstra's avatar
Peter Zijlstra committed
345 346 347 348 349 350
	},
	{
		.procname	= "sched_rt_runtime_us",
		.data		= &sysctl_sched_rt_runtime,
		.maxlen		= sizeof(int),
		.mode		= 0644,
351
		.proc_handler	= sched_rt_handler,
Peter Zijlstra's avatar
Peter Zijlstra committed
352
	},
353 354 355 356 357
	{
		.procname	= "sched_compat_yield",
		.data		= &sysctl_sched_compat_yield,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
358
		.proc_handler	= proc_dointvec,
359
	},
Peter Zijlstra's avatar
Peter Zijlstra committed
360 361 362 363 364 365
#ifdef CONFIG_PROVE_LOCKING
	{
		.procname	= "prove_locking",
		.data		= &prove_locking,
		.maxlen		= sizeof(int),
		.mode		= 0644,
366
		.proc_handler	= proc_dointvec,
Peter Zijlstra's avatar
Peter Zijlstra committed
367 368 369 370 371 372 373 374
	},
#endif
#ifdef CONFIG_LOCK_STAT
	{
		.procname	= "lock_stat",
		.data		= &lock_stat,
		.maxlen		= sizeof(int),
		.mode		= 0644,
375
		.proc_handler	= proc_dointvec,
Peter Zijlstra's avatar
Peter Zijlstra committed
376
	},
Ingo Molnar's avatar
Ingo Molnar committed
377
#endif
Linus Torvalds's avatar
Linus Torvalds committed
378 379 380 381 382
	{
		.procname	= "panic",
		.data		= &panic_timeout,
		.maxlen		= sizeof(int),
		.mode		= 0644,
383
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
384 385 386 387 388 389
	},
	{
		.procname	= "core_uses_pid",
		.data		= &core_uses_pid,
		.maxlen		= sizeof(int),
		.mode		= 0644,
390
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
391 392 393 394
	},
	{
		.procname	= "core_pattern",
		.data		= core_pattern,
395
		.maxlen		= CORENAME_MAX_SIZE,
Linus Torvalds's avatar
Linus Torvalds committed
396
		.mode		= 0644,
397
		.proc_handler	= proc_dostring,
Linus Torvalds's avatar
Linus Torvalds committed
398
	},
399 400 401 402 403
	{
		.procname	= "core_pipe_limit",
		.data		= &core_pipe_limit,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
404
		.proc_handler	= proc_dointvec,
405
	},
406
#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds's avatar
Linus Torvalds committed
407 408
	{
		.procname	= "tainted",
Andi Kleen's avatar
Andi Kleen committed
409
		.maxlen 	= sizeof(long),
410
		.mode		= 0644,
411
		.proc_handler	= proc_taint,
Linus Torvalds's avatar
Linus Torvalds committed
412
	},
413
#endif
Arjan van de Ven's avatar
Arjan van de Ven committed
414 415 416 417 418 419
#ifdef CONFIG_LATENCYTOP
	{
		.procname	= "latencytop",
		.data		= &latencytop_enabled,
		.maxlen		= sizeof(int),
		.mode		= 0644,
420
		.proc_handler	= proc_dointvec,
Arjan van de Ven's avatar
Arjan van de Ven committed
421 422
	},
#endif
Linus Torvalds's avatar
Linus Torvalds committed
423 424 425 426 427 428
#ifdef CONFIG_BLK_DEV_INITRD
	{
		.procname	= "real-root-dev",
		.data		= &real_root_dev,
		.maxlen		= sizeof(int),
		.mode		= 0644,
429
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
430 431
	},
#endif
Ingo Molnar's avatar
Ingo Molnar committed
432 433 434 435 436
	{
		.procname	= "print-fatal-signals",
		.data		= &print_fatal_signals,
		.maxlen		= sizeof(int),
		.mode		= 0644,
437
		.proc_handler	= proc_dointvec,
Ingo Molnar's avatar
Ingo Molnar committed
438
	},
439
#ifdef CONFIG_SPARC
Linus Torvalds's avatar
Linus Torvalds committed
440 441 442 443 444
	{
		.procname	= "reboot-cmd",
		.data		= reboot_command,
		.maxlen		= 256,
		.mode		= 0644,
445
		.proc_handler	= proc_dostring,
Linus Torvalds's avatar
Linus Torvalds committed
446 447 448 449 450 451
	},
	{
		.procname	= "stop-a",
		.data		= &stop_a_enabled,
		.maxlen		= sizeof (int),
		.mode		= 0644,
452
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
453 454 455 456 457 458
	},
	{
		.procname	= "scons-poweroff",
		.data		= &scons_pwroff,
		.maxlen		= sizeof (int),
		.mode		= 0644,
459
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
460 461
	},
#endif
462 463 464 465 466 467
#ifdef CONFIG_SPARC64
	{
		.procname	= "tsb-ratio",
		.data		= &sysctl_tsb_ratio,
		.maxlen		= sizeof (int),
		.mode		= 0644,
468
		.proc_handler	= proc_dointvec,
469 470
	},
#endif
Linus Torvalds's avatar
Linus Torvalds committed
471 472 473 474 475 476
#ifdef __hppa__
	{
		.procname	= "soft-power",
		.data		= &pwrsw_enabled,
		.maxlen		= sizeof (int),
	 	.mode		= 0644,
477
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
478 479 480 481 482 483
	},
	{
		.procname	= "unaligned-trap",
		.data		= &unaligned_enabled,
		.maxlen		= sizeof (int),
		.mode		= 0644,
484
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
485 486 487 488 489 490 491
	},
#endif
	{
		.procname	= "ctrl-alt-del",
		.data		= &C_A_D,
		.maxlen		= sizeof(int),
		.mode		= 0644,
492
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
493
	},
494
#ifdef CONFIG_FUNCTION_TRACER
495 496 497 498 499
	{
		.procname	= "ftrace_enabled",
		.data		= &ftrace_enabled,
		.maxlen		= sizeof(int),
		.mode		= 0644,
500
		.proc_handler	= ftrace_enable_sysctl,
501 502
	},
#endif
503 504 505 506 507 508
#ifdef CONFIG_STACK_TRACER
	{
		.procname	= "stack_tracer_enabled",
		.data		= &stack_tracer_enabled,
		.maxlen		= sizeof(int),
		.mode		= 0644,
509
		.proc_handler	= stack_trace_sysctl,
510 511
	},
#endif
512 513
#ifdef CONFIG_TRACING
	{
Peter Zijlstra's avatar
Peter Zijlstra committed
514
		.procname	= "ftrace_dump_on_oops",
515 516 517
		.data		= &ftrace_dump_on_oops,
		.maxlen		= sizeof(int),
		.mode		= 0644,
518
		.proc_handler	= proc_dointvec,
519 520
	},
#endif
521
#ifdef CONFIG_MODULES
Linus Torvalds's avatar
Linus Torvalds committed
522 523 524 525 526
	{
		.procname	= "modprobe",
		.data		= &modprobe_path,
		.maxlen		= KMOD_PATH_LEN,
		.mode		= 0644,
527
		.proc_handler	= proc_dostring,
Linus Torvalds's avatar
Linus Torvalds committed
528
	},
529 530 531 532 533 534
	{
		.procname	= "modules_disabled",
		.data		= &modules_disabled,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		/* only handle a transition from default "0" to "1" */
535
		.proc_handler	= proc_dointvec_minmax,
536 537 538
		.extra1		= &one,
		.extra2		= &one,
	},
Linus Torvalds's avatar
Linus Torvalds committed
539
#endif
Andrew Morton's avatar
Andrew Morton committed
540
#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
Linus Torvalds's avatar
Linus Torvalds committed
541 542
	{
		.procname	= "hotplug",
543 544
		.data		= &uevent_helper,
		.maxlen		= UEVENT_HELPER_PATH_LEN,
Linus Torvalds's avatar
Linus Torvalds committed
545
		.mode		= 0644,
546
		.proc_handler	= proc_dostring,
Linus Torvalds's avatar
Linus Torvalds committed
547 548 549 550 551 552 553 554
	},
#endif
#ifdef CONFIG_CHR_DEV_SG
	{
		.procname	= "sg-big-buff",
		.data		= &sg_big_buff,
		.maxlen		= sizeof (int),
		.mode		= 0444,
555
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
556 557 558 559 560 561 562 563
	},
#endif
#ifdef CONFIG_BSD_PROCESS_ACCT
	{
		.procname	= "acct",
		.data		= &acct_parm,
		.maxlen		= 3*sizeof(int),
		.mode		= 0644,
564
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
565 566 567 568 569
	},
#endif
#ifdef CONFIG_MAGIC_SYSRQ
	{
		.procname	= "sysrq",
570
		.data		= &__sysrq_enabled,
Linus Torvalds's avatar
Linus Torvalds committed
571 572
		.maxlen		= sizeof (int),
		.mode		= 0644,
573
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
574 575
	},
#endif
576
#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds's avatar
Linus Torvalds committed
577 578
	{
		.procname	= "cad_pid",
579
		.data		= NULL,
Linus Torvalds's avatar
Linus Torvalds committed
580 581
		.maxlen		= sizeof (int),
		.mode		= 0600,
582
		.proc_handler	= proc_do_cad_pid,
Linus Torvalds's avatar
Linus Torvalds committed
583
	},
584
#endif
Linus Torvalds's avatar
Linus Torvalds committed
585 586 587 588 589
	{
		.procname	= "threads-max",
		.data		= &max_threads,
		.maxlen		= sizeof(int),
		.mode		= 0644,
590
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
591 592 593 594 595 596 597 598 599 600 601
	},
	{
		.procname	= "random",
		.mode		= 0555,
		.child		= random_table,
	},
	{
		.procname	= "overflowuid",
		.data		= &overflowuid,
		.maxlen		= sizeof(int),
		.mode		= 0644,
602
		.proc_handler	= proc_dointvec_minmax,
Linus Torvalds's avatar
Linus Torvalds committed
603 604 605 606 607 608 609 610
		.extra1		= &minolduid,
		.extra2		= &maxolduid,
	},
	{
		.procname	= "overflowgid",
		.data		= &overflowgid,
		.maxlen		= sizeof(int),
		.mode		= 0644,
611
		.proc_handler	= proc_dointvec_minmax,
Linus Torvalds's avatar
Linus Torvalds committed
612 613 614
		.extra1		= &minolduid,
		.extra2		= &maxolduid,
	},
615
#ifdef CONFIG_S390
Linus Torvalds's avatar
Linus Torvalds committed
616 617 618 619 620 621
#ifdef CONFIG_MATHEMU
	{
		.procname	= "ieee_emulation_warnings",
		.data		= &sysctl_ieee_emulation_warnings,
		.maxlen		= sizeof(int),
		.mode		= 0644,
622
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
623 624 625 626 627 628 629
	},
#endif
	{
		.procname	= "userprocess_debug",
		.data		= &sysctl_userprocess_debug,
		.maxlen		= sizeof(int),
		.mode		= 0644,
630
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
631 632 633 634 635 636 637
	},
#endif
	{
		.procname	= "pid_max",
		.data		= &pid_max,
		.maxlen		= sizeof (int),
		.mode		= 0644,
638
		.proc_handler	= proc_dointvec_minmax,
Linus Torvalds's avatar
Linus Torvalds committed
639 640 641 642 643 644 645 646
		.extra1		= &pid_max_min,
		.extra2		= &pid_max_max,
	},
	{
		.procname	= "panic_on_oops",
		.data		= &panic_on_oops,
		.maxlen		= sizeof(int),
		.mode		= 0644,
647
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
648
	},
649 650 651 652 653 654
#if defined CONFIG_PRINTK
	{
		.procname	= "printk",
		.data		= &console_loglevel,
		.maxlen		= 4*sizeof(int),
		.mode		= 0644,
655
		.proc_handler	= proc_dointvec,
656
	},
Linus Torvalds's avatar
Linus Torvalds committed
657 658
	{
		.procname	= "printk_ratelimit",
Dave Young's avatar
Dave Young committed
659
		.data		= &printk_ratelimit_state.interval,
Linus Torvalds's avatar
Linus Torvalds committed
660 661
		.maxlen		= sizeof(int),
		.mode		= 0644,
662
		.proc_handler	= proc_dointvec_jiffies,
Linus Torvalds's avatar
Linus Torvalds committed
663 664 665
	},
	{
		.procname	= "printk_ratelimit_burst",
Dave Young's avatar
Dave Young committed
666
		.data		= &printk_ratelimit_state.burst,
Linus Torvalds's avatar
Linus Torvalds committed
667 668
		.maxlen		= sizeof(int),
		.mode		= 0644,
669
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
670
	},
671 672 673 674 675
	{
		.procname	= "printk_delay",
		.data		= &printk_delay_msec,
		.maxlen		= sizeof(int),
		.mode		= 0644,
676
		.proc_handler	= proc_dointvec_minmax,
677 678 679
		.extra1		= &zero,
		.extra2		= &ten_thousand,
	},
680
#endif
Linus Torvalds's avatar
Linus Torvalds committed
681 682 683 684 685
	{
		.procname	= "ngroups_max",
		.data		= &ngroups_max,
		.maxlen		= sizeof (int),
		.mode		= 0444,
686
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
687 688 689 690 691 692 693
	},
#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
	{
		.procname       = "unknown_nmi_panic",
		.data           = &unknown_nmi_panic,
		.maxlen         = sizeof (int),
		.mode           = 0644,
694
		.proc_handler   = proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
695
	},
696 697 698 699 700
	{
		.procname       = "nmi_watchdog",
		.data           = &nmi_watchdog_enabled,
		.maxlen         = sizeof (int),
		.mode           = 0644,
701
		.proc_handler   = proc_nmi_enabled,
Linus Torvalds's avatar
Linus Torvalds committed
702 703 704
	},
#endif
#if defined(CONFIG_X86)
705 706 707 708 709
	{
		.procname	= "panic_on_unrecovered_nmi",
		.data		= &panic_on_unrecovered_nmi,
		.maxlen		= sizeof(int),
		.mode		= 0644,
710
		.proc_handler	= proc_dointvec,
711
	},
712 713 714 715 716
	{
		.procname	= "panic_on_io_nmi",
		.data		= &panic_on_io_nmi,
		.maxlen		= sizeof(int),
		.mode		= 0644,
717
		.proc_handler	= proc_dointvec,
718
	},
Linus Torvalds's avatar
Linus Torvalds committed
719 720 721 722 723
	{
		.procname	= "bootloader_type",
		.data		= &bootloader_type,
		.maxlen		= sizeof (int),
		.mode		= 0444,
724
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
725
	},
726 727 728 729 730
	{
		.procname	= "bootloader_version",
		.data		= &bootloader_version,
		.maxlen		= sizeof (int),
		.mode		= 0444,
731
		.proc_handler	= proc_dointvec,
732
	},
733 734 735 736 737
	{
		.procname	= "kstack_depth_to_print",
		.data		= &kstack_depth_to_print,
		.maxlen		= sizeof(int),
		.mode		= 0644,
738
		.proc_handler	= proc_dointvec,
739
	},
740 741 742 743 744
	{
		.procname	= "io_delay_type",
		.data		= &io_delay_type,
		.maxlen		= sizeof(int),
		.mode		= 0644,
745
		.proc_handler	= proc_dointvec,
746
	},
Linus Torvalds's avatar
Linus Torvalds committed
747
#endif
748
#if defined(CONFIG_MMU)
Linus Torvalds's avatar
Linus Torvalds committed
749 750 751 752 753
	{
		.procname	= "randomize_va_space",
		.data		= &randomize_va_space,
		.maxlen		= sizeof(int),
		.mode		= 0644,
754
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
755
	},
756
#endif
757
#if defined(CONFIG_S390) && defined(CONFIG_SMP)
758 759 760 761 762
	{
		.procname	= "spin_retry",
		.data		= &spin_retry,
		.maxlen		= sizeof (int),
		.mode		= 0644,
763
		.proc_handler	= proc_dointvec,
764
	},
765
#endif
Len Brown's avatar
Len Brown committed
766
#if	defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
767 768
	{
		.procname	= "acpi_video_flags",
769
		.data		= &acpi_realmode_flags,
770 771
		.maxlen		= sizeof (unsigned long),
		.mode		= 0644,
772
		.proc_handler	= proc_doulongvec_minmax,
773
	},
774 775 776 777 778 779 780
#endif
#ifdef CONFIG_IA64
	{
		.procname	= "ignore-unaligned-usertrap",
		.data		= &no_unaligned_warning,
		.maxlen		= sizeof (int),
	 	.mode		= 0644,
781
		.proc_handler	= proc_dointvec,
782
	},
783 784 785 786 787
	{
		.procname	= "unaligned-dump-stack",
		.data		= &unaligned_dump_stack,
		.maxlen		= sizeof (int),
		.mode		= 0644,
788
		.proc_handler	= proc_dointvec,
789
	},
790
#endif
791
#ifdef CONFIG_DETECT_SOFTLOCKUP
792 793 794 795 796
	{
		.procname	= "softlockup_panic",
		.data		= &softlockup_panic,
		.maxlen		= sizeof(int),
		.mode		= 0644,
797
		.proc_handler	= proc_dointvec_minmax,
798 799 800
		.extra1		= &zero,
		.extra2		= &one,
	},
801 802 803
	{
		.procname	= "softlockup_thresh",
		.data		= &softlockup_thresh,
804
		.maxlen		= sizeof(int),
805
		.mode		= 0644,
806
		.proc_handler	= proc_dosoftlockup_thresh,
807
		.extra1		= &neg_one,
808 809
		.extra2		= &sixty,
	},
810 811 812 813 814 815 816
#endif
#ifdef CONFIG_DETECT_HUNG_TASK
	{
		.procname	= "hung_task_panic",
		.data		= &sysctl_hung_task_panic,
		.maxlen		= sizeof(int),
		.mode		= 0644,
817
		.proc_handler	= proc_dointvec_minmax,
818 819 820
		.extra1		= &zero,
		.extra2		= &one,
	},
821 822 823
	{
		.procname	= "hung_task_check_count",
		.data		= &sysctl_hung_task_check_count,
Ingo Molnar's avatar
Ingo Molnar committed
824
		.maxlen		= sizeof(unsigned long),
825
		.mode		= 0644,
826
		.proc_handler	= proc_doulongvec_minmax,
827 828 829 830
	},
	{
		.procname	= "hung_task_timeout_secs",
		.data		= &sysctl_hung_task_timeout_secs,
Ingo Molnar's avatar
Ingo Molnar committed
831
		.maxlen		= sizeof(unsigned long),
832
		.mode		= 0644,
833
		.proc_handler	= proc_dohung_task_timeout_secs,
834 835 836 837
	},
	{
		.procname	= "hung_task_warnings",
		.data		= &sysctl_hung_task_warnings,
Ingo Molnar's avatar
Ingo Molnar committed
838
		.maxlen		= sizeof(unsigned long),
839
		.mode		= 0644,
840
		.proc_handler	= proc_doulongvec_minmax,
841
	},
842
#endif
843 844 845 846 847 848
#ifdef CONFIG_COMPAT
	{
		.procname	= "compat-log",
		.data		= &compat_log,
		.maxlen		= sizeof (int),
	 	.mode		= 0644,
849
		.proc_handler	= proc_dointvec,
850
	},
851
#endif
Ingo Molnar's avatar
Ingo Molnar committed
852 853 854 855 856 857
#ifdef CONFIG_RT_MUTEXES
	{
		.procname	= "max_lock_depth",
		.data		= &max_lock_depth,
		.maxlen		= sizeof(int),
		.mode		= 0644,
858
		.proc_handler	= proc_dointvec,
Ingo Molnar's avatar
Ingo Molnar committed
859
	},
Kees Cook's avatar
Kees Cook committed
860
#endif
861 862 863 864 865
	{
		.procname	= "poweroff_cmd",
		.data		= &poweroff_cmd,
		.maxlen		= POWEROFF_CMD_PATH_LEN,
		.mode		= 0644,
866
		.proc_handler	= proc_dostring,
867
	},
868 869 870 871 872 873 874
#ifdef CONFIG_KEYS
	{
		.procname	= "keys",
		.mode		= 0555,
		.child		= key_sysctls,
	},
#endif
875 876 877 878 879 880
#ifdef CONFIG_RCU_TORTURE_TEST
	{
		.procname       = "rcutorture_runnable",
		.data           = &rcutorture_runnable,
		.maxlen         = sizeof(int),
		.mode           = 0644,
881
		.proc_handler	= proc_dointvec,
882 883
	},
#endif
884 885 886 887 888 889 890
#ifdef CONFIG_SLOW_WORK
	{
		.procname	= "slow-work",
		.mode		= 0555,
		.child		= slow_work_sysctls,
	},
#endif
891
#ifdef CONFIG_PERF_EVENTS
892
	{
893 894 895
		.procname	= "perf_event_paranoid",
		.data		= &sysctl_perf_event_paranoid,
		.maxlen		= sizeof(sysctl_perf_event_paranoid),
896
		.mode		= 0644,
897
		.proc_handler	= proc_dointvec,
898
	},
899
	{
900 901 902
		.procname	= "perf_event_mlock_kb",
		.data		= &sysctl_perf_event_mlock,
		.maxlen		= sizeof(sysctl_perf_event_mlock),
903
		.mode		= 0644,
904
		.proc_handler	= proc_dointvec,
905
	},
906
	{
907 908 909
		.procname	= "perf_event_max_sample_rate",
		.data		= &sysctl_perf_event_sample_rate,
		.maxlen		= sizeof(sysctl_perf_event_sample_rate),
910
		.mode		= 0644,
911
		.proc_handler	= proc_dointvec,
912
	},
913
#endif
914 915 916 917 918 919
#ifdef CONFIG_KMEMCHECK
	{
		.procname	= "kmemcheck",
		.data		= &kmemcheck_enabled,
		.maxlen		= sizeof(int),
		.mode		= 0644,
920
		.proc_handler	= proc_dointvec,
921 922
	},
#endif
923
#ifdef CONFIG_BLOCK
924 925 926 927 928
	{
		.procname	= "blk_iopoll",
		.data		= &blk_iopoll_enabled,
		.maxlen		= sizeof(int),
		.mode		= 0644,
929
		.proc_handler	= proc_dointvec,
930
	},
931
#endif
932 933 934 935
/*
 * NOTE: do not add new entries to this table unless you have read
 * Documentation/sysctl/ctl_unnumbered.txt
 */
936
	{ }
Linus Torvalds's avatar
Linus Torvalds committed
937 938
};

939
static struct ctl_table vm_table[] = {
Linus Torvalds's avatar
Linus Torvalds committed
940 941 942 943 944
	{
		.procname	= "overcommit_memory",
		.data		= &sysctl_overcommit_memory,
		.maxlen		= sizeof(sysctl_overcommit_memory),
		.mode		= 0644,
945
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
946
	},
947 948 949 950 951
	{
		.procname	= "panic_on_oom",
		.data		= &sysctl_panic_on_oom,
		.maxlen		= sizeof(sysctl_panic_on_oom),
		.mode		= 0644,
952
		.proc_handler	= proc_dointvec,
953
	},
954 955 956 957 958
	{
		.procname	= "oom_kill_allocating_task",
		.data		= &sysctl_oom_kill_allocating_task,
		.maxlen		= sizeof(sysctl_oom_kill_allocating_task),
		.mode		= 0644,
959
		.proc_handler	= proc_dointvec,
960
	},
961 962 963 964 965
	{
		.procname	= "oom_dump_tasks",
		.data		= &sysctl_oom_dump_tasks,
		.maxlen		= sizeof(sysctl_oom_dump_tasks),
		.mode		= 0644,