sysctl.c 57.9 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/fs.h>
Linus Torvalds's avatar
Linus Torvalds committed
34 35
#include <linux/init.h>
#include <linux/kernel.h>
36
#include <linux/kobject.h>
37
#include <linux/net.h>
Linus Torvalds's avatar
Linus Torvalds committed
38 39 40
#include <linux/sysrq.h>
#include <linux/highuid.h>
#include <linux/writeback.h>
41
#include <linux/ratelimit.h>
42
#include <linux/compaction.h>
Linus Torvalds's avatar
Linus Torvalds committed
43 44
#include <linux/hugetlb.h>
#include <linux/initrd.h>
45
#include <linux/key.h>
Linus Torvalds's avatar
Linus Torvalds committed
46 47 48
#include <linux/times.h>
#include <linux/limits.h>
#include <linux/dcache.h>
49
#include <linux/dnotify.h>
Linus Torvalds's avatar
Linus Torvalds committed
50
#include <linux/syscalls.h>
Adrian Bunk's avatar
Adrian Bunk committed
51
#include <linux/vmstat.h>
52 53
#include <linux/nfs_fs.h>
#include <linux/acpi.h>
54
#include <linux/reboot.h>
55
#include <linux/ftrace.h>
56
#include <linux/perf_event.h>
57
#include <linux/kprobes.h>
58
#include <linux/pipe_fs_i.h>
59
#include <linux/oom.h>
60
#include <linux/kmod.h>
61
#include <linux/capability.h>
Al Viro's avatar
Al Viro committed
62
#include <linux/binfmts.h>
Linus Torvalds's avatar
Linus Torvalds committed
63 64 65 66

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

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

88
#ifdef CONFIG_LOCKUP_DETECTOR
89 90 91
#include <linux/nmi.h>
#endif

92

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

118
/* Constants used for minimum and  maximum */
119
#ifdef CONFIG_LOCKUP_DETECTOR
120
static int sixty = 60;
121
static int neg_one = -1;
122 123 124
#endif

static int zero;
125 126
static int __maybe_unused one = 1;
static int __maybe_unused two = 2;
127
static int __maybe_unused three = 3;
128
static unsigned long one_ul = 1;
129
static int one_hundred = 100;
130 131 132
#ifdef CONFIG_PRINTK
static int ten_thousand = 10000;
#endif
133

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

static int ngroups_max = NGROUPS_MAX;
143
static const int cap_last_cap = CAP_LAST_CAP;
Linus Torvalds's avatar
Linus Torvalds committed
144

Dave Young's avatar
Dave Young committed
145 146 147
#ifdef CONFIG_INOTIFY_USER
#include <linux/inotify.h>
#endif
148
#ifdef CONFIG_SPARC
Linus Torvalds's avatar
Linus Torvalds committed
149 150
#endif

151 152 153 154
#ifdef CONFIG_SPARC64
extern int sysctl_tsb_ratio;
#endif

Linus Torvalds's avatar
Linus Torvalds committed
155 156 157 158 159
#ifdef __hppa__
extern int pwrsw_enabled;
extern int unaligned_enabled;
#endif

160 161
#ifdef CONFIG_IA64
extern int no_unaligned_warning;
162
extern int unaligned_dump_stack;
163 164
#endif

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

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

177 178 179 180 181
static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
		void __user *buffer, size_t *lenp, loff_t *ppos);
static int proc_dostring_coredump(struct ctl_table *table, int write,
		void __user *buffer, size_t *lenp, loff_t *ppos);

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

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

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

#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
int sysctl_legacy_va_layout;
#endif

/* The default sysctl tables: */

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

Ingo Molnar's avatar
Ingo Molnar committed
249
#ifdef CONFIG_SCHED_DEBUG
250 251 252 253
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 */
254 255
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
256 257
#endif

258 259 260 261 262
#ifdef CONFIG_COMPACTION
static int min_extfrag_threshold;
static int max_extfrag_threshold = 1000;
#endif

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