sysctl.c 61 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>
65
#include <linux/kexec.h>
Linus Torvalds's avatar
Linus Torvalds committed
66 67 68 69

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

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

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

95

Linus Torvalds's avatar
Linus Torvalds committed
96 97 98 99
#if defined(CONFIG_SYSCTL)

/* External variables not in a header file. */
extern int max_threads;
Alan Cox's avatar
Alan Cox committed
100
extern int suid_dumpable;
101 102
#ifdef CONFIG_COREDUMP
extern int core_uses_pid;
Linus Torvalds's avatar
Linus Torvalds committed
103
extern char core_pattern[];
104
extern unsigned int core_pipe_limit;
105
#endif
Linus Torvalds's avatar
Linus Torvalds committed
106 107
extern int pid_max;
extern int pid_max_min, pid_max_max;
108
extern int percpu_pagelist_fraction;
109
extern int compat_log;
Arjan van de Ven's avatar
Arjan van de Ven committed
110
extern int latencytop_enabled;
111
extern int sysctl_nr_open_min, sysctl_nr_open_max;
112 113 114
#ifndef CONFIG_MMU
extern int sysctl_nr_trim_pages;
#endif
Linus Torvalds's avatar
Linus Torvalds committed
115

116
/* Constants used for minimum and  maximum */
117
#ifdef CONFIG_LOCKUP_DETECTOR
118 119 120
static int sixty = 60;
#endif

121 122
static int __maybe_unused neg_one = -1;

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

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

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

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

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

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

#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
Linus Torvalds's avatar
Linus Torvalds committed
159 160 161
extern int unaligned_enabled;
#endif

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

166 167 168 169
#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
extern int no_unaligned_warning;
#endif

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

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

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

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

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

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

#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
int sysctl_legacy_va_layout;
#endif

/* The default sysctl tables: */

227
static struct ctl_table sysctl_base_table[] = {
Linus Torvalds's avatar
Linus Torvalds committed
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
	{
		.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,
	},
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
#ifdef CONFIG_SMP
262 263
static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
264 265
#endif /* CONFIG_SMP */
#endif /* CONFIG_SCHED_DEBUG */
Ingo Molnar's avatar
Ingo Molnar committed
266

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

Linus Torvalds's avatar
Linus Torvalds committed
642 643
	{
		.procname	= "hotplug",
644 645
		.data		= &uevent_helper,
		.maxlen		= UEVENT_HELPER_PATH_LEN,
Linus Torvalds's avatar
Linus Torvalds committed
646
		.mode		= 0644,
647
		.proc_handler	= proc_dostring,
Linus Torvalds's avatar
Linus Torvalds committed
648
	},
649

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