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

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

69 70
#ifdef CONFIG_X86
#include <asm/nmi.h>
71
#include <asm/stacktrace.h>
72
#include <asm/io.h>
73
#endif
74 75 76
#ifdef CONFIG_SPARC
#include <asm/setup.h>
#endif
Dave Young's avatar
Dave Young committed
77 78 79
#ifdef CONFIG_BSD_PROCESS_ACCT
#include <linux/acct.h>
#endif
Dave Young's avatar
Dave Young committed
80 81 82
#ifdef CONFIG_RT_MUTEXES
#include <linux/rtmutex.h>
#endif
Dave Young's avatar
Dave Young committed
83 84 85
#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
#include <linux/lockdep.h>
#endif
Dave Young's avatar
Dave Young committed
86 87 88
#ifdef CONFIG_CHR_DEV_SG
#include <scsi/sg.h>
#endif
89

90
#ifdef CONFIG_LOCKUP_DETECTOR
91 92 93
#include <linux/nmi.h>
#endif

94

Linus Torvalds's avatar
Linus Torvalds committed
95 96 97 98 99 100
#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;
Alan Cox's avatar
Alan Cox committed
101
extern int suid_dumpable;
102 103
#ifdef CONFIG_COREDUMP
extern int core_uses_pid;
Linus Torvalds's avatar
Linus Torvalds committed
104
extern char core_pattern[];
105
extern unsigned int core_pipe_limit;
106
#endif
Linus Torvalds's avatar
Linus Torvalds committed
107 108 109
extern int pid_max;
extern int min_free_kbytes;
extern int pid_max_min, pid_max_max;
Andrew Morton's avatar
Andrew Morton committed
110
extern int sysctl_drop_caches;
111
extern int percpu_pagelist_fraction;
112
extern int compat_log;
Arjan van de Ven's avatar
Arjan van de Ven committed
113
extern int latencytop_enabled;
114
extern int sysctl_nr_open_min, sysctl_nr_open_max;
115 116 117
#ifndef CONFIG_MMU
extern int sysctl_nr_trim_pages;
#endif
118
#ifdef CONFIG_BLOCK
119
extern int blk_iopoll_enabled;
120
#endif
Linus Torvalds's avatar
Linus Torvalds committed
121

122
/* Constants used for minimum and  maximum */
123
#ifdef CONFIG_LOCKUP_DETECTOR
124
static int sixty = 60;
125
static int neg_one = -1;
126 127 128
#endif

static int zero;
129 130
static int __maybe_unused one = 1;
static int __maybe_unused two = 2;
131
static int __maybe_unused three = 3;
132
static unsigned long one_ul = 1;
133
static int one_hundred = 100;
134 135 136
#ifdef CONFIG_PRINTK
static int ten_thousand = 10000;
#endif
137

138 139 140
/* 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
141 142 143
/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
static int maxolduid = 65535;
static int minolduid;
144
static int min_percpu_pagelist_fract = 8;
Linus Torvalds's avatar
Linus Torvalds committed
145 146

static int ngroups_max = NGROUPS_MAX;
147
static const int cap_last_cap = CAP_LAST_CAP;
Linus Torvalds's avatar
Linus Torvalds committed
148

Dave Young's avatar
Dave Young committed
149 150 151
#ifdef CONFIG_INOTIFY_USER
#include <linux/inotify.h>
#endif
152
#ifdef CONFIG_SPARC
Linus Torvalds's avatar
Linus Torvalds committed
153 154
#endif

155 156 157 158
#ifdef CONFIG_SPARC64
extern int sysctl_tsb_ratio;
#endif

Linus Torvalds's avatar
Linus Torvalds committed
159 160 161 162 163
#ifdef __hppa__
extern int pwrsw_enabled;
extern int unaligned_enabled;
#endif

164 165
#ifdef CONFIG_IA64
extern int no_unaligned_warning;
166
extern int unaligned_dump_stack;
167 168
#endif

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

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

181 182
static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
		void __user *buffer, size_t *lenp, loff_t *ppos);
183
#ifdef CONFIG_COREDUMP
184 185
static int proc_dostring_coredump(struct ctl_table *table, int write,
		void __user *buffer, size_t *lenp, loff_t *ppos);
186
#endif
187

188
#ifdef CONFIG_MAGIC_SYSRQ
189 190
/* Note: sysrq code uses it's own private copy */
static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209

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

210 211 212 213 214 215
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[];
216 217 218
#ifdef CONFIG_EPOLL
extern struct ctl_table epoll_table[];
#endif
Linus Torvalds's avatar
Linus Torvalds committed
219 220 221 222 223 224 225

#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
int sysctl_legacy_va_layout;
#endif

/* The default sysctl tables: */

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

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

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

271
static struct ctl_table kern_table[] = {
272 273 274 275 276
	{
		.procname	= "sched_child_runs_first",
		.data		= &sysctl_sched_child_runs_first,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
277
		.proc_handler	= proc_dointvec,
278
	},
Ingo Molnar's avatar
Ingo Molnar committed
279 280
#ifdef CONFIG_SCHED_DEBUG
	{
281 282
		.procname	= "sched_min_granularity_ns",
		.data		= &sysctl_sched_min_granularity,
Ingo Molnar's avatar
Ingo Molnar committed
283 284
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
285
		.proc_handler	= sched_proc_update_handler,
286 287
		.extra1		= &min_sched_granularity_ns,
		.extra2		= &max_sched_granularity_ns,
Ingo Molnar's avatar
Ingo Molnar committed
288
	},
289 290 291 292 293
	{
		.procname	= "sched_latency_ns",
		.data		= &sysctl_sched_latency,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
294
		.proc_handler	= sched_proc_update_handler,
295 296 297
		.extra1		= &min_sched_granularity_ns,
		.extra2		= &max_sched_granularity_ns,
	},
Ingo Molnar's avatar
Ingo Molnar committed
298 299 300 301 302
	{
		.procname	= "sched_wakeup_granularity_ns",
		.data		= &sysctl_sched_wakeup_granularity,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
303
		.proc_handler	= sched_proc_update_handler,
Ingo Molnar's avatar
Ingo Molnar committed
304 305 306
		.extra1		= &min_wakeup_granularity_ns,
		.extra2		= &max_wakeup_granularity_ns,
	},
307
#ifdef CONFIG_SMP
308 309 310 311 312
	{
		.procname	= "sched_tunable_scaling",
		.data		= &sysctl_sched_tunable_scaling,
		.maxlen		= sizeof(enum sched_tunable_scaling),
		.mode		= 0644,
313
		.proc_handler	= sched_proc_update_handler,
314 315
		.extra1		= &min_sched_tunable_scaling,
		.extra2		= &max_sched_tunable_scaling,
316
	},
317
	{
318
		.procname	= "sched_migration_cost_ns",
319 320 321
		.data		= &sysctl_sched_migration_cost,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
322
		.proc_handler	= proc_dointvec,
323
	},
324 325 326 327
	{
		.procname	= "sched_nr_migrate",
		.data		= &sysctl_sched_nr_migrate,
		.maxlen		= sizeof(unsigned int),
Peter Zijlstra's avatar
Peter Zijlstra committed
328
		.mode		= 0644,
329
		.proc_handler	= proc_dointvec,
Peter Zijlstra's avatar
Peter Zijlstra committed
330
	},
331
	{
332
		.procname	= "sched_time_avg_ms",
333 334 335
		.data		= &sysctl_sched_time_avg,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
336
		.proc_handler	= proc_dointvec,
337
	},
338
	{
339
		.procname	= "sched_shares_window_ns",
340 341 342 343 344
		.data		= &sysctl_sched_shares_window,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
345 346 347 348 349
	{
		.procname	= "timer_migration",
		.data		= &sysctl_timer_migration,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
350
		.proc_handler	= proc_dointvec_minmax,
351 352
		.extra1		= &zero,
		.extra2		= &one,
Peter Zijlstra's avatar
Peter Zijlstra committed
353
	},
354 355
#endif /* CONFIG_SMP */
#ifdef CONFIG_NUMA_BALANCING
356 357 358 359 360 361 362
	{
		.procname	= "numa_balancing_scan_delay_ms",
		.data		= &sysctl_numa_balancing_scan_delay,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
363 364 365 366 367 368 369
	{
		.procname	= "numa_balancing_scan_period_min_ms",
		.data		= &sysctl_numa_balancing_scan_period_min,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
370 371 372 373 374 375 376
	{
		.procname	= "numa_balancing_scan_period_reset",
		.data		= &sysctl_numa_balancing_scan_period_reset,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
377 378 379 380 381 382 383
	{
		.procname	= "numa_balancing_scan_period_max_ms",
		.data		= &sysctl_numa_balancing_scan_period_max,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
384 385 386 387 388 389 390
	{
		.procname	= "numa_balancing_scan_size_mb",
		.data		= &sysctl_numa_balancing_scan_size,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
391 392
#endif /* CONFIG_NUMA_BALANCING */
#endif /* CONFIG_SCHED_DEBUG */
Peter Zijlstra's avatar
Peter Zijlstra committed
393 394 395 396 397
	{
		.procname	= "sched_rt_period_us",
		.data		= &sysctl_sched_rt_period,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
398
		.proc_handler	= sched_rt_handler,
Peter Zijlstra's avatar
Peter Zijlstra committed
399 400 401 402 403 404
	},
	{
		.procname	= "sched_rt_runtime_us",
		.data		= &sysctl_sched_rt_runtime,
		.maxlen		= sizeof(int),
		.mode		= 0644,
405
		.proc_handler	= sched_rt_handler,
Peter Zijlstra's avatar
Peter Zijlstra committed
406
	},
407 408 409 410 411 412
#ifdef CONFIG_SCHED_AUTOGROUP
	{
		.procname	= "sched_autogroup_enabled",
		.data		= &sysctl_sched_autogroup_enabled,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
413
		.proc_handler	= proc_dointvec_minmax,
414 415 416 417
		.extra1		= &zero,
		.extra2		= &one,
	},
#endif
418 419 420 421 422 423 424 425 426 427
#ifdef CONFIG_CFS_BANDWIDTH
	{
		.procname	= "sched_cfs_bandwidth_slice_us",
		.data		= &sysctl_sched_cfs_bandwidth_slice,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &one,
	},
#endif
Peter Zijlstra's avatar
Peter Zijlstra committed
428 429 430 431 432 433
#ifdef CONFIG_PROVE_LOCKING
	{
		.procname	= "prove_locking",
		.data		= &prove_locking,
		.maxlen		= sizeof(int),
		.mode		= 0644,
434
		.proc_handler	= proc_dointvec,
Peter Zijlstra's avatar
Peter Zijlstra committed
435 436 437 438 439 440 441 442
	},
#endif
#ifdef CONFIG_LOCK_STAT
	{
		.procname	= "lock_stat",
		.data		= &lock_stat,
		.maxlen		= sizeof(int),
		.mode		= 0644,
443
		.proc_handler	= proc_dointvec,
Peter Zijlstra's avatar
Peter Zijlstra committed
444
	},
Ingo Molnar's avatar
Ingo Molnar committed
445
#endif
Linus Torvalds's avatar
Linus Torvalds committed
446 447 448 449 450
	{
		.procname	= "panic",
		.data		= &panic_timeout,
		.maxlen		= sizeof(int),
		.mode		= 0644,
451
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
452
	},
453
#ifdef CONFIG_COREDUMP
Linus Torvalds's avatar
Linus Torvalds committed
454 455 456 457 458
	{
		.procname	= "core_uses_pid",
		.data		= &core_uses_pid,
		.maxlen		= sizeof(int),
		.mode		= 0644,
459
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
460 461 462 463
	},
	{
		.procname	= "core_pattern",
		.data		= core_pattern,
464
		.maxlen		= CORENAME_MAX_SIZE,
Linus Torvalds's avatar
Linus Torvalds committed
465
		.mode		= 0644,
466
		.proc_handler	= proc_dostring_coredump,
Linus Torvalds's avatar
Linus Torvalds committed
467
	},
468 469 470 471 472
	{
		.procname	= "core_pipe_limit",
		.data		= &core_pipe_limit,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
473
		.proc_handler	= proc_dointvec,
474
	},
475
#endif
476
#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds's avatar
Linus Torvalds committed
477 478
	{
		.procname	= "tainted",
Andi Kleen's avatar
Andi Kleen committed
479
		.maxlen 	= sizeof(long),
480
		.mode		= 0644,
481
		.proc_handler	= proc_taint,
Linus Torvalds's avatar
Linus Torvalds committed
482
	},
483
#endif
Arjan van de Ven's avatar
Arjan van de Ven committed
484 485 486 487 488 489
#ifdef CONFIG_LATENCYTOP
	{
		.procname	= "latencytop",
		.data		= &latencytop_enabled,
		.maxlen		= sizeof(int),
		.mode		= 0644,
490
		.proc_handler	= proc_dointvec,
Arjan van de Ven's avatar
Arjan van de Ven committed
491 492
	},
#endif
Linus Torvalds's avatar
Linus Torvalds committed
493 494 495 496 497 498
#ifdef CONFIG_BLK_DEV_INITRD
	{
		.procname	= "real-root-dev",
		.data		= &real_root_dev,
		.maxlen		= sizeof(int),
		.mode		= 0644,
499
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
500 501
	},
#endif
Ingo Molnar's avatar
Ingo Molnar committed
502 503 504 505 506
	{
		.procname	= "print-fatal-signals",
		.data		= &print_fatal_signals,
		.maxlen		= sizeof(int),
		.mode		= 0644,
507
		.proc_handler	= proc_dointvec,
Ingo Molnar's avatar
Ingo Molnar committed
508
	},
509
#ifdef CONFIG_SPARC
Linus Torvalds's avatar
Linus Torvalds committed
510 511 512 513 514
	{
		.procname	= "reboot-cmd",
		.data		= reboot_command,
		.maxlen		= 256,
		.mode		= 0644,
515
		.proc_handler	= proc_dostring,
Linus Torvalds's avatar
Linus Torvalds committed
516 517 518 519 520 521
	},
	{
		.procname	= "stop-a",
		.data		= &stop_a_enabled,
		.maxlen		= sizeof (int),
		.mode		= 0644,
522
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
523 524 525 526 527 528
	},
	{
		.procname	= "scons-poweroff",
		.data		= &scons_pwroff,
		.maxlen		= sizeof (int),
		.mode		= 0644,
529
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
530 531
	},
#endif
532 533 534 535 536 537
#ifdef CONFIG_SPARC64
	{
		.procname	= "tsb-ratio",
		.data		= &sysctl_tsb_ratio,
		.maxlen		= sizeof (int),
		.mode		= 0644,
538
		.proc_handler	= proc_dointvec,
539 540
	},
#endif
Linus Torvalds's avatar
Linus Torvalds committed
541 542 543 544 545 546
#ifdef __hppa__
	{
		.procname	= "soft-power",
		.data		= &pwrsw_enabled,
		.maxlen		= sizeof (int),
	 	.mode		= 0644,
547
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
548 549 550 551 552 553
	},
	{
		.procname	= "unaligned-trap",
		.data		= &unaligned_enabled,
		.maxlen		= sizeof (int),
		.mode		= 0644,
554
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
555 556 557 558 559 560 561
	},
#endif
	{
		.procname	= "ctrl-alt-del",
		.data		= &C_A_D,
		.maxlen		= sizeof(int),
		.mode		= 0644,
562
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
563
	},
564
#ifdef CONFIG_FUNCTION_TRACER
565 566 567 568 569
	{
		.procname	= "ftrace_enabled",
		.data		= &ftrace_enabled,
		.maxlen		= sizeof(int),
		.mode		= 0644,
570
		.proc_handler	= ftrace_enable_sysctl,
571 572
	},
#endif
573 574 575 576 577 578
#ifdef CONFIG_STACK_TRACER
	{
		.procname	= "stack_tracer_enabled",
		.data		= &stack_tracer_enabled,
		.maxlen		= sizeof(int),
		.mode		= 0644,
579
		.proc_handler	= stack_trace_sysctl,
580 581
	},
#endif
582 583
#ifdef CONFIG_TRACING
	{
Peter Zijlstra's avatar
Peter Zijlstra committed
584
		.procname	= "ftrace_dump_on_oops",
585 586 587
		.data		= &ftrace_dump_on_oops,
		.maxlen		= sizeof(int),
		.mode		= 0644,
588
		.proc_handler	= proc_dointvec,
589 590
	},
#endif
591
#ifdef CONFIG_MODULES
Linus Torvalds's avatar
Linus Torvalds committed
592 593 594 595 596
	{
		.procname	= "modprobe",
		.data		= &modprobe_path,
		.maxlen		= KMOD_PATH_LEN,
		.mode		= 0644,
597
		.proc_handler	= proc_dostring,
Linus Torvalds's avatar
Linus Torvalds committed
598
	},
599 600 601 602 603 604
	{
		.procname	= "modules_disabled",
		.data		= &modules_disabled,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		/* only handle a transition from default "0" to "1" */
605
		.proc_handler	= proc_dointvec_minmax,
606 607 608
		.extra1		= &one,
		.extra2		= &one,
	},
Linus Torvalds's avatar
Linus Torvalds committed
609
#endif
610

Linus Torvalds's avatar
Linus Torvalds committed
611 612
	{
		.procname	= "hotplug",
613 614
		.data		= &uevent_helper,
		.maxlen		= UEVENT_HELPER_PATH_LEN,
Linus Torvalds's avatar
Linus Torvalds committed
615
		.mode		= 0644,
616
		.proc_handler	= proc_dostring,
Linus Torvalds's avatar
Linus Torvalds committed
617
	},
618

Linus Torvalds's avatar
Linus Torvalds committed
619 620 621 622 623 624
#ifdef CONFIG_CHR_DEV_SG
	{
		.procname	= "sg-big-buff",
		.data		= &sg_big_buff,
		.maxlen		= sizeof (int),
		.mode		= 0444,
625
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
626 627 628 629 630 631 632 633
	},
#endif
#ifdef CONFIG_BSD_PROCESS_ACCT
	{
		.procname	= "acct",
		.data		= &acct_parm,
		.maxlen		= 3*sizeof(int),
		.mode		= 0644,
634
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
635 636 637 638 639
	},
#endif
#ifdef CONFIG_MAGIC_SYSRQ
	{
		.procname	= "sysrq",
640
		.data		= &__sysrq_enabled,
Linus Torvalds's avatar
Linus Torvalds committed
641 642
		.maxlen		= sizeof (int),
		.mode		= 0644,
643
		.proc_handler	= sysrq_sysctl_handler,
Linus Torvalds's avatar
Linus Torvalds committed
644 645
	},
#endif
646
#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds's avatar
Linus Torvalds committed
647 648
	{
		.procname	= "cad_pid",
649
		.data		= NULL,
Linus Torvalds's avatar
Linus Torvalds committed
650 651
		.maxlen		= sizeof (int),
		.mode		= 0600,
652
		.proc_handler	= proc_do_cad_pid,
Linus Torvalds's avatar
Linus Torvalds committed
653
	},
654
#endif
Linus Torvalds's avatar
Linus Torvalds committed
655 656 657 658 659
	{
		.procname	= "threads-max",
		.data		= &max_threads,
		.maxlen		= sizeof(int),
		.mode		= 0644,
660
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
661 662 663 664 665 666
	},
	{
		.procname	= "random",
		.mode		= 0555,
		.child		= random_table,
	},
667 668 669 670 671
	{
		.procname	= "usermodehelper",
		.mode		= 0555,
		.child		= usermodehelper_table,
	},
Linus Torvalds's avatar
Linus Torvalds committed
672 673 674 675 676
	{
		.procname	= "overflowuid",
		.data		= &overflowuid,
		.maxlen		= sizeof(int),
		.mode		= 0644,
677
		.proc_handler	= proc_dointvec_minmax,
Linus Torvalds's avatar
Linus Torvalds committed
678 679 680 681 682 683 684 685
		.extra1		= &minolduid,
		.extra2		= &maxolduid,
	},
	{
		.procname	= "overflowgid",
		.data		= &overflowgid,
		.maxlen		= sizeof(int),
		.mode		= 0644,
686
		.proc_handler	= proc_dointvec_minmax,
Linus Torvalds's avatar
Linus Torvalds committed
687 688 689
		.extra1		= &minolduid,
		.extra2		= &maxolduid,
	},
690
#ifdef CONFIG_S390
Linus Torvalds's avatar
Linus Torvalds committed
691 692 693 694 695 696
#ifdef CONFIG_MATHEMU
	{
		.procname	= "ieee_emulation_warnings",
		.data		= &sysctl_ieee_emulation_warnings,
		.maxlen		= sizeof(int),
		.mode		= 0644,
697
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
698 699 700 701
	},
#endif
	{
		.procname	= "userprocess_debug",
702
		.data		= &show_unhandled_signals,
Linus Torvalds's avatar
Linus Torvalds committed
703 704
		.maxlen		= sizeof(int),
		.mode		= 0644,
705
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
706 707 708 709 710 711 712
	},
#endif
	{
		.procname	= "pid_max",
		.data		= &pid_max,
		.maxlen		= sizeof (int),
		.mode		= 0644,
713
		.proc_handler	= proc_dointvec_minmax,
Linus Torvalds's avatar
Linus Torvalds committed
714 715 716 717 718 719 720 721
		.extra1		= &pid_max_min,
		.extra2		= &pid_max_max,
	},
	{
		.procname	= "panic_on_oops",
		.data		= &panic_on_oops,
		.maxlen		= sizeof(int),
		.mode		= 0644,
722
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
723
	},
724 725 726 727 728 729
#if defined CONFIG_PRINTK
	{
		.procname	= "printk",
		.data		= &console_loglevel,
		.maxlen		= 4*sizeof(int),
		.mode		= 0644,
730
		.proc_handler	= proc_dointvec,
731
	},
Linus Torvalds's avatar
Linus Torvalds committed
732 733
	{
		.procname	= "printk_ratelimit",
Dave Young's avatar
Dave Young committed
734
		.data		= &printk_ratelimit_state.interval,
Linus Torvalds's avatar
Linus Torvalds committed
735 736
		.maxlen		= sizeof(int),
		.mode		= 0644,
737
		.proc_handler	= proc_dointvec_jiffies,
Linus Torvalds's avatar
Linus Torvalds committed
738 739 740
	},
	{
		.procname	= "printk_ratelimit_burst",
Dave Young's avatar
Dave Young committed
741
		.data		= &printk_ratelimit_state.burst,
Linus Torvalds's avatar
Linus Torvalds committed
742 743
		.maxlen		= sizeof(int),
		.mode		= 0644,
744
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
745
	},
746 747 748 749 750
	{
		.procname	= "printk_delay",
		.data		= &printk_delay_msec,
		.maxlen		= sizeof(int),
		.mode		= 0644,
751
		.proc_handler	= proc_dointvec_minmax,
752 753 754
		.extra1		= &zero,
		.extra2		= &ten_thousand,
	},
755 756 757 758 759
	{
		.procname	= "dmesg_restrict",
		.data		= &dmesg_restrict,
		.maxlen		= sizeof(int),
		.mode		= 0644,
760
		.proc_handler	= proc_dointvec_minmax_sysadmin,
761 762 763
		.extra1		= &zero,
		.extra2		= &one,
	},
764 765 766 767 768
	{
		.procname	= "kptr_restrict",
		.data		= &kptr_restrict,
		.maxlen		= sizeof(int),
		.mode		= 0644,
769
		.proc_handler	= proc_dointvec_minmax_sysadmin,
770 771 772
		.extra1		= &zero,
		.extra2		= &two,
	},
773
#endif
Linus Torvalds's avatar
Linus Torvalds committed
774 775 776 777 778
	{
		.procname	= "ngroups_max",
		.data		= &ngroups_max,
		.maxlen		= sizeof (int),
		.mode		= 0444,
779
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
780
	},
781 782 783 784 785 786 787
	{
		.procname	= "cap_last_cap",
		.data		= (void *)&cap_last_cap,
		.maxlen		= sizeof(int),
		.mode		= 0444,
		.proc_handler	= proc_dointvec,
	},
788
#if defined(CONFIG_LOCKUP_DETECTOR)
789
	{
790 791
		.procname       = "watchdog",
		.data           = &watchdog_enabled,
792 793
		.maxlen         = sizeof (int),
		.mode           = 0644,
794 795 796
		.proc_handler   = proc_dowatchdog,
		.extra1		= &zero,
		.extra2		= &one,
797 798 799
	},
	{
		.procname	= "watchdog_thresh",
800
		.data		= &watchdog_thresh,
801 802
		.maxlen		= sizeof(int),
		.mode		= 0644,
803
		.proc_handler	= proc_dowatchdog,
804 805
		.extra1		= &neg_one,
		.extra2		= &sixty,
806
	},
807 808 809 810 811 812 813 814 815
	{
		.procname	= "softlockup_panic",
		.data		= &softlockup_panic,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &zero,
		.extra2		= &one,
	},
816 817 818 819 820
	{
		.procname       = "nmi_watchdog",
		.data           = &watchdog_enabled,
		.maxlen         = sizeof (int),
		.mode           = 0644,
821 822 823
		.proc_handler   = proc_dowatchdog,
		.extra1		= &zero,
		.extra2		= &one,
824 825 826 827 828 829 830 831 832 833
	},
#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,
	},
834
#endif
Linus Torvalds's avatar
Linus Torvalds committed
835
#if defined(CONFIG_X86)
836 837 838 839 840
	{
		.procname	= "panic_on_unrecovered_nmi",
		.data		= &panic_on_unrecovered_nmi,
		.maxlen		= sizeof(int),
		.mode		= 0644,
841
		.proc_handler	= proc_dointvec,
842
	},
843 844 845 846 847
	{
		.procname	= "panic_on_io_nmi",
		.data		= &panic_on_io_nmi,
		.maxlen		= sizeof(int),
		.mode		= 0644,
848
		.proc_handler	= proc_dointvec,
849
	},
850 851 852 853 854 855 856 857 858
#ifdef CONFIG_DEBUG_STACKOVERFLOW
	{
		.procname	= "panic_on_stackoverflow",
		.data		= &sysctl_panic_on_stackoverflow,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
#endif
Linus Torvalds's avatar
Linus Torvalds committed
859 860 861 862 863
	{
		.procname	= "bootloader_type",
		.data		= &bootloader_type,
		.maxlen		= sizeof (int),
		.mode		= 0444,
864
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
865
	},
866 867 868 869 870
	{
		.procname	= "bootloader_version",
		.data		= &bootloader_version,
		.maxlen		= sizeof (int),
		.mode		= 0444,
871
		.proc_handler	= proc_dointvec,
872
	},
873 874 875 876 877
	{
		.procname	= "kstack_depth_to_print",
		.data		= &kstack_depth_to_print,
		.maxlen		= sizeof(int),
		.mode		= 0644,
878
		.proc_handler	= proc_dointvec,
879
	},
880 881 882 883 884
	{
		.procname	= "io_delay_type",
		.data		= &io_delay_type,
		.maxlen		= sizeof(int),
		.mode		= 0644,
885
		.proc_handler	= proc_dointvec,
886
	},
Linus Torvalds's avatar
Linus Torvalds committed
887
#endif
888
#if defined(CONFIG_MMU)
Linus Torvalds's avatar
Linus Torvalds committed
889 890 891 892 893
	{
		.procname	= "randomize_va_space",
		.data		= &randomize_va_space,
		.maxlen		= sizeof(int),
		.mode		= 0644,
894
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
895
	},
896
#endif
897
#if defined(CONFIG_S390) && defined(CONFIG_SMP)
898 899 900 901 902
	{
		.procname	= "spin_retry",
		.data		= &spin_retry,
		.maxlen		= sizeof (int),
		.mode		= 0644,
903
		.proc_handler	= proc_dointvec,
904
	},
905
#endif
Len Brown's avatar
Len Brown committed
906
#if	defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
907 908
	{
		.procname	= "acpi_video_flags",
909
		.data		= &acpi_realmode_flags,
910 911
		.maxlen		= sizeof (unsigned long),
		.mode		= 0644,
912
		.proc_handler	= proc_doulongvec_minmax,
913
	},
914 915 916 917 918 919 920
#endif
#ifdef CONFIG_IA64
	{
		.procname	= "ignore-unaligned-usertrap",
		.data		= &no_unaligned_warning,
		.maxlen		= sizeof (int),
	 	.mode		= 0644,
921
		.proc_handler	= proc_dointvec,
922
	},
923 924 925 926 927
	{
		.procname	= "unaligned-dump-stack",
		.data		= &unaligned_dump_stack,
		.maxlen		= sizeof (int),
		.mode		= 0644,
928
		.proc_handler	= proc_dointvec,
929
	},
930
#endif
931 932 933 934 935 936
#ifdef CONFIG_DETECT_HUNG_TASK
	{
		.procname	= "hung_task_panic",
		.data		= &sysctl_hung_task_panic,
		.maxlen		= sizeof(int),
		.mode		= 0644,
937
		.proc_handler	= proc_dointvec_minmax,
938 939 940
		.extra1		= &zero,
		.extra2		= &one,
	},
941 942 943
	{
		.procname	= "hung_task_check_count",
		.data		= &sysctl_hung_task_check_count,
Ingo Molnar's avatar
Ingo Molnar committed
944
		.maxlen		= sizeof(unsigned long),
945
		.mode		= 0644,
946
		.proc_handler	= proc_doulongvec_minmax,
947 948 949 950
	},
	{
		.procname	= "hung_task_timeout_secs",
		.data		= &sysctl_hung_task_timeout_secs,
Ingo Molnar's avatar
Ingo Molnar committed
951
		.maxlen		= sizeof(unsigned long),
952
		.mode		= 0644,
953
		.proc_handler	= proc_dohung_task_timeout_secs,
954 955 956 957
	},
	{
		.procname	= "hung_task_warnings",
		.data		= &sysctl_hung_task_warnings,
Ingo Molnar's avatar
Ingo Molnar committed
958
		.maxlen		= sizeof(unsigned long),
959
		.mode		= 0644,
960
		.proc_handler	= proc_doulongvec_minmax,
961
	},
962
#endif
963 964 965 966 967 968
#ifdef CONFIG_COMPAT
	{
		.procname	= "compat-log",
		.data		= &compat_log,
		.maxlen		= sizeof (int),
	 	.mode		= 0644,
969
		.proc_handler	= proc_dointvec,
970
	},
971
#endif
Ingo Molnar's avatar
Ingo Molnar committed
972 973 974 975 976 977
#ifdef CONFIG_RT_MUTEXES
	{
		.procname	= "max_lock_depth",
		.data		= &max_lock_depth,
		.maxlen		= sizeof(int),
		.mode		= 0644,
978
		.proc_handler	= proc_dointvec,
Ingo Molnar's avatar
Ingo Molnar committed
979
	},
Kees Cook's avatar
Kees Cook committed
980
#endif
981 982 983 984 985
	{
		.procname	= "poweroff_cmd",
		.data		= &poweroff_cmd,
		.maxlen		= POWEROFF_CMD_PATH_LEN,
		.mode		= 0644,
986
		.proc_handler	= proc_dostring,
987
	},
988 989 990 991 992 993