sysctl.c 68.4 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>
40
#include <linux/compaction.h>
Linus Torvalds's avatar
Linus Torvalds committed
41 42
#include <linux/hugetlb.h>
#include <linux/initrd.h>
43
#include <linux/key.h>
Linus Torvalds's avatar
Linus Torvalds committed
44 45 46
#include <linux/times.h>
#include <linux/limits.h>
#include <linux/dcache.h>
47
#include <linux/dnotify.h>
Linus Torvalds's avatar
Linus Torvalds committed
48
#include <linux/syscalls.h>
Adrian Bunk's avatar
Adrian Bunk committed
49
#include <linux/vmstat.h>
50 51
#include <linux/nfs_fs.h>
#include <linux/acpi.h>
52
#include <linux/reboot.h>
53
#include <linux/ftrace.h>
54
#include <linux/slow-work.h>
55
#include <linux/perf_event.h>
56
#include <linux/kprobes.h>
57
#include <linux/pipe_fs_i.h>
Linus Torvalds's avatar
Linus Torvalds committed
58 59 60 61

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

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

80

Linus Torvalds's avatar
Linus Torvalds committed
81 82 83 84 85
#if defined(CONFIG_SYSCTL)

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

109
/* Constants used for minimum and  maximum */
110
#ifdef CONFIG_DETECT_SOFTLOCKUP
111
static int sixty = 60;
112
static int neg_one = -1;
113 114 115
#endif

static int zero;
116 117
static int __maybe_unused one = 1;
static int __maybe_unused two = 2;
118
static unsigned long one_ul = 1;
119
static int one_hundred = 100;
120 121 122
#ifdef CONFIG_PRINTK
static int ten_thousand = 10000;
#endif
123

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

static int ngroups_max = NGROUPS_MAX;

134
#ifdef CONFIG_SPARC
135
#include <asm/system.h>
Linus Torvalds's avatar
Linus Torvalds committed
136 137
#endif

138 139 140 141
#ifdef CONFIG_SPARC64
extern int sysctl_tsb_ratio;
#endif

Linus Torvalds's avatar
Linus Torvalds committed
142 143 144 145 146
#ifdef __hppa__
extern int pwrsw_enabled;
extern int unaligned_enabled;
#endif

147
#ifdef CONFIG_S390
Linus Torvalds's avatar
Linus Torvalds committed
148 149 150 151
#ifdef CONFIG_MATHEMU
extern int sysctl_ieee_emulation_warnings;
#endif
extern int sysctl_userprocess_debug;
152
extern int spin_retry;
Linus Torvalds's avatar
Linus Torvalds committed
153 154
#endif

155 156
#ifdef CONFIG_IA64
extern int no_unaligned_warning;
157
extern int unaligned_dump_stack;
158 159
#endif

160 161
extern struct ratelimit_state printk_ratelimit_state;

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

169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
#ifdef CONFIG_MAGIC_SYSRQ
static int __sysrq_enabled; /* Note: sysrq code ises it's own private copy */

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

190
static struct ctl_table root_table[];
191 192
static struct ctl_table_root sysctl_table_root;
static struct ctl_table_header root_table_header = {
193
	.count = 1,
194
	.ctl_table = root_table,
195
	.ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),
196
	.root = &sysctl_table_root,
197
	.set = &sysctl_table_root.default_set,
198 199 200
};
static struct ctl_table_root sysctl_table_root = {
	.root_list = LIST_HEAD_INIT(sysctl_table_root.root_list),
201
	.default_set.list = LIST_HEAD_INIT(root_table_header.ctl_entry),
202
};
Linus Torvalds's avatar
Linus Torvalds committed
203

204 205 206 207 208 209
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[];
210
#ifdef CONFIG_INOTIFY_USER
211
extern struct ctl_table inotify_table[];
Robert Love's avatar
Robert Love committed
212
#endif
213 214 215
#ifdef CONFIG_EPOLL
extern struct ctl_table epoll_table[];
#endif
Linus Torvalds's avatar
Linus Torvalds committed
216 217 218 219 220 221 222

#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
int sysctl_legacy_va_layout;
#endif

/* The default sysctl tables: */

223
static struct ctl_table root_table[] = {
Linus Torvalds's avatar
Linus Torvalds committed
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
	{
		.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,
	},
249 250 251 252
/*
 * NOTE: do not add new entries to this table unless you have read
 * Documentation/sysctl/ctl_unnumbered.txt
 */
253
	{ }
Linus Torvalds's avatar
Linus Torvalds committed
254 255
};

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

267 268 269 270 271
#ifdef CONFIG_COMPACTION
static int min_extfrag_threshold;
static int max_extfrag_threshold = 1000;
#endif

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