sysctl.c 68.8 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>
27
#include <linux/printk.h>
Linus Torvalds's avatar
Linus Torvalds committed
28
#include <linux/proc_fs.h>
29
#include <linux/security.h>
Linus Torvalds's avatar
Linus Torvalds committed
30
#include <linux/ctype.h>
31
#include <linux/kmemcheck.h>
32
#include <linux/fs.h>
Linus Torvalds's avatar
Linus Torvalds committed
33 34
#include <linux/init.h>
#include <linux/kernel.h>
35
#include <linux/kobject.h>
36
#include <linux/net.h>
Linus Torvalds's avatar
Linus Torvalds committed
37 38 39
#include <linux/sysrq.h>
#include <linux/highuid.h>
#include <linux/writeback.h>
40
#include <linux/ratelimit.h>
41
#include <linux/compaction.h>
Linus Torvalds's avatar
Linus Torvalds committed
42 43
#include <linux/hugetlb.h>
#include <linux/initrd.h>
44
#include <linux/key.h>
Linus Torvalds's avatar
Linus Torvalds committed
45 46 47
#include <linux/times.h>
#include <linux/limits.h>
#include <linux/dcache.h>
48
#include <linux/dnotify.h>
Linus Torvalds's avatar
Linus Torvalds committed
49
#include <linux/syscalls.h>
Adrian Bunk's avatar
Adrian Bunk committed
50
#include <linux/vmstat.h>
51 52
#include <linux/nfs_fs.h>
#include <linux/acpi.h>
53
#include <linux/reboot.h>
54
#include <linux/ftrace.h>
55
#include <linux/perf_event.h>
56
#include <linux/kprobes.h>
57
#include <linux/pipe_fs_i.h>
58
#include <linux/oom.h>
59
#include <linux/kmod.h>
Linus Torvalds's avatar
Linus Torvalds committed
60 61 62 63

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

64 65
#ifdef CONFIG_X86
#include <asm/nmi.h>
66
#include <asm/stacktrace.h>
67
#include <asm/io.h>
68
#endif
Dave Young's avatar
Dave Young committed
69 70 71
#ifdef CONFIG_BSD_PROCESS_ACCT
#include <linux/acct.h>
#endif
Dave Young's avatar
Dave Young committed
72 73 74
#ifdef CONFIG_RT_MUTEXES
#include <linux/rtmutex.h>
#endif
Dave Young's avatar
Dave Young committed
75 76 77
#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
#include <linux/lockdep.h>
#endif
Dave Young's avatar
Dave Young committed
78 79 80
#ifdef CONFIG_CHR_DEV_SG
#include <scsi/sg.h>
#endif
81

82
#ifdef CONFIG_LOCKUP_DETECTOR
83 84 85
#include <linux/nmi.h>
#endif

86

Linus Torvalds's avatar
Linus Torvalds committed
87 88 89 90 91 92 93
#if defined(CONFIG_SYSCTL)

/* External variables not in a header file. */
extern int sysctl_overcommit_memory;
extern int sysctl_overcommit_ratio;
extern int max_threads;
extern int core_uses_pid;
Alan Cox's avatar
Alan Cox committed
94
extern int suid_dumpable;
Linus Torvalds's avatar
Linus Torvalds committed
95
extern char core_pattern[];
96
extern unsigned int core_pipe_limit;
Linus Torvalds's avatar
Linus Torvalds committed
97 98 99
extern int pid_max;
extern int min_free_kbytes;
extern int pid_max_min, pid_max_max;
Andrew Morton's avatar
Andrew Morton committed
100
extern int sysctl_drop_caches;
101
extern int percpu_pagelist_fraction;
102
extern int compat_log;
Arjan van de Ven's avatar
Arjan van de Ven committed
103
extern int latencytop_enabled;
104
extern int sysctl_nr_open_min, sysctl_nr_open_max;
105 106 107
#ifndef CONFIG_MMU
extern int sysctl_nr_trim_pages;
#endif
108
#ifdef CONFIG_BLOCK
109
extern int blk_iopoll_enabled;
110
#endif
Linus Torvalds's avatar
Linus Torvalds committed
111

112
/* Constants used for minimum and  maximum */
113
#ifdef CONFIG_LOCKUP_DETECTOR
114
static int sixty = 60;
115
static int neg_one = -1;
116 117 118
#endif

static int zero;
119 120
static int __maybe_unused one = 1;
static int __maybe_unused two = 2;
121
static int __maybe_unused three = 3;
122
static unsigned long one_ul = 1;
123
static int one_hundred = 100;
124 125 126
#ifdef CONFIG_PRINTK
static int ten_thousand = 10000;
#endif
127

128 129 130
/* 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
131 132 133
/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
static int maxolduid = 65535;
static int minolduid;
134
static int min_percpu_pagelist_fract = 8;
Linus Torvalds's avatar
Linus Torvalds committed
135 136 137

static int ngroups_max = NGROUPS_MAX;

Dave Young's avatar
Dave Young committed
138 139 140
#ifdef CONFIG_INOTIFY_USER
#include <linux/inotify.h>
#endif
141
#ifdef CONFIG_SPARC
142
#include <asm/system.h>
Linus Torvalds's avatar
Linus Torvalds committed
143 144
#endif

145 146 147 148
#ifdef CONFIG_SPARC64
extern int sysctl_tsb_ratio;
#endif

Linus Torvalds's avatar
Linus Torvalds committed
149 150 151 152 153
#ifdef __hppa__
extern int pwrsw_enabled;
extern int unaligned_enabled;
#endif

154
#ifdef CONFIG_S390
Linus Torvalds's avatar
Linus Torvalds committed
155 156 157 158
#ifdef CONFIG_MATHEMU
extern int sysctl_ieee_emulation_warnings;
#endif
extern int sysctl_userprocess_debug;
159
extern int spin_retry;
Linus Torvalds's avatar
Linus Torvalds committed
160 161
#endif

162 163
#ifdef CONFIG_IA64
extern int no_unaligned_warning;
164
extern int unaligned_dump_stack;
165 166
#endif

167
#ifdef CONFIG_PROC_SYSCTL
168
static int proc_do_cad_pid(struct ctl_table *table, int write,
169
		  void __user *buffer, size_t *lenp, loff_t *ppos);
170
static int proc_taint(struct ctl_table *table, int write,
171
			       void __user *buffer, size_t *lenp, loff_t *ppos);
172
#endif
173

174 175 176 177 178
#ifdef CONFIG_PRINTK
static int proc_dmesg_restrict(struct ctl_table *table, int write,
				void __user *buffer, size_t *lenp, loff_t *ppos);
#endif

179
#ifdef CONFIG_MAGIC_SYSRQ
180 181
/* Note: sysrq code uses it's own private copy */
static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200

static int sysrq_sysctl_handler(ctl_table *table, int write,
				void __user *buffer, size_t *lenp,
				loff_t *ppos)
{
	int error;

	error = proc_dointvec(table, write, buffer, lenp, ppos);
	if (error)
		return error;

	if (write)
		sysrq_toggle_support(__sysrq_enabled);

	return 0;
}

#endif

201
static struct ctl_table root_table[];
202 203
static struct ctl_table_root sysctl_table_root;
static struct ctl_table_header root_table_header = {
Al Viro's avatar
Al Viro committed
204
	{{.count = 1,
205
	.ctl_table = root_table,
Al Viro's avatar
Al Viro committed
206
	.ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),}},
207
	.root = &sysctl_table_root,
208
	.set = &sysctl_table_root.default_set,
209 210 211
};
static struct ctl_table_root sysctl_table_root = {
	.root_list = LIST_HEAD_INIT(sysctl_table_root.root_list),
212
	.default_set.list = LIST_HEAD_INIT(root_table_header.ctl_entry),
213
};
Linus Torvalds's avatar
Linus Torvalds committed
214

215 216 217 218 219 220
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[];
221 222 223
#ifdef CONFIG_EPOLL
extern struct ctl_table epoll_table[];
#endif
Linus Torvalds's avatar
Linus Torvalds committed
224 225 226 227 228 229 230

#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
int sysctl_legacy_va_layout;
#endif

/* The default sysctl tables: */

231
static struct ctl_table root_table[] = {
Linus Torvalds's avatar
Linus Torvalds committed
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
	{
		.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,
	},
257
	{ }
Linus Torvalds's avatar
Linus Torvalds committed
258 259
};

Ingo Molnar's avatar
Ingo Molnar committed
260
#ifdef CONFIG_SCHED_DEBUG
261 262 263 264
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 */
265 266
static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
Ingo Molnar's avatar
Ingo Molnar committed
267 268
#endif

269 270 271 272 273
#ifdef CONFIG_COMPACTION
static int min_extfrag_threshold;
static int max_extfrag_threshold = 1000;
#endif

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