sysctl.c 74.7 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
/*
 * 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>
22
#include <linux/aio.h>
Linus Torvalds's avatar
Linus Torvalds committed
23 24 25 26
#include <linux/mm.h>
#include <linux/swap.h>
#include <linux/slab.h>
#include <linux/sysctl.h>
27
#include <linux/bitmap.h>
28
#include <linux/signal.h>
29
#include <linux/printk.h>
Linus Torvalds's avatar
Linus Torvalds committed
30
#include <linux/proc_fs.h>
31
#include <linux/security.h>
Linus Torvalds's avatar
Linus Torvalds committed
32
#include <linux/ctype.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>
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/sched/coredump.h>
66
#include <linux/kexec.h>
67
#include <linux/bpf.h>
68
#include <linux/mount.h>
69
#include <linux/pipe_fs_i.h>
Linus Torvalds's avatar
Linus Torvalds committed
70

71
#include <linux/uaccess.h>
Linus Torvalds's avatar
Linus Torvalds committed
72 73
#include <asm/processor.h>

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

95
#ifdef CONFIG_LOCKUP_DETECTOR
96 97 98
#include <linux/nmi.h>
#endif

Linus Torvalds's avatar
Linus Torvalds committed
99 100 101
#if defined(CONFIG_SYSCTL)

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

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

122 123
static int __maybe_unused neg_one = -1;

124
static int zero;
125 126
static int __maybe_unused one = 1;
static int __maybe_unused two = 2;
127
static int __maybe_unused four = 4;
128
static unsigned long one_ul = 1;
129
static int one_hundred = 100;
130
static int one_thousand = 1000;
131 132 133
#ifdef CONFIG_PRINTK
static int ten_thousand = 10000;
#endif
134 135 136
#ifdef CONFIG_PERF_EVENTS
static int six_hundred_forty_kb = 640 * 1024;
#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 144 145
/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
static int maxolduid = 65535;
static int minolduid;

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

148 149 150 151 152
/*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */
#ifdef CONFIG_DETECT_HUNG_TASK
static unsigned long hung_task_timeout_max = (LONG_MAX/HZ);
#endif

153 154 155
#ifdef CONFIG_INOTIFY_USER
#include <linux/inotify.h>
#endif
156
#ifdef CONFIG_SPARC
Linus Torvalds's avatar
Linus Torvalds committed
157 158 159 160
#endif

#ifdef __hppa__
extern int pwrsw_enabled;
161 162 163
#endif

#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
Linus Torvalds's avatar
Linus Torvalds committed
164 165 166
extern int unaligned_enabled;
#endif

167
#ifdef CONFIG_IA64
168
extern int unaligned_dump_stack;
169 170
#endif

171 172 173 174
#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
extern int no_unaligned_warning;
#endif

175
#ifdef CONFIG_PROC_SYSCTL
176

177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
/**
 * enum sysctl_writes_mode - supported sysctl write modes
 *
 * @SYSCTL_WRITES_LEGACY: each write syscall must fully contain the sysctl value
 * 	to be written, and multiple writes on the same sysctl file descriptor
 * 	will rewrite the sysctl value, regardless of file position. No warning
 * 	is issued when the initial position is not 0.
 * @SYSCTL_WRITES_WARN: same as above but warn when the initial file position is
 * 	not 0.
 * @SYSCTL_WRITES_STRICT: writes to numeric sysctl entries must always be at
 * 	file position 0 and the value must be fully contained in the buffer
 * 	sent to the write syscall. If dealing with strings respect the file
 * 	position, but restrict this to the max length of the buffer, anything
 * 	passed the max lenght will be ignored. Multiple writes will append
 * 	to the buffer.
 *
 * These write modes control how current file position affects the behavior of
 * updating sysctl values through the proc interface on each write.
 */
enum sysctl_writes_mode {
	SYSCTL_WRITES_LEGACY		= -1,
	SYSCTL_WRITES_WARN		= 0,
	SYSCTL_WRITES_STRICT		= 1,
};
201

202
static enum sysctl_writes_mode sysctl_writes_strict = SYSCTL_WRITES_STRICT;
203

204
static int proc_do_cad_pid(struct ctl_table *table, int write,
205
		  void __user *buffer, size_t *lenp, loff_t *ppos);
206
static int proc_taint(struct ctl_table *table, int write,
207
			       void __user *buffer, size_t *lenp, loff_t *ppos);
208
#endif
209

210
#ifdef CONFIG_PRINTK
211
static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
212 213 214
				void __user *buffer, size_t *lenp, loff_t *ppos);
#endif

215 216
static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
		void __user *buffer, size_t *lenp, loff_t *ppos);
217
#ifdef CONFIG_COREDUMP
218 219
static int proc_dostring_coredump(struct ctl_table *table, int write,
		void __user *buffer, size_t *lenp, loff_t *ppos);
220
#endif
221 222
static int proc_dopipe_max_size(struct ctl_table *table, int write,
		void __user *buffer, size_t *lenp, loff_t *ppos);
223

224
#ifdef CONFIG_MAGIC_SYSRQ
225
/* Note: sysrq code uses it's own private copy */
226
static int __sysrq_enabled = CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE;
227

228
static int sysrq_sysctl_handler(struct ctl_table *table, int write,
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
				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

246 247 248 249 250 251
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[];
252 253 254
#ifdef CONFIG_EPOLL
extern struct ctl_table epoll_table[];
#endif
Linus Torvalds's avatar
Linus Torvalds committed
255

256 257 258 259
#ifdef CONFIG_FW_LOADER_USER_HELPER
extern struct ctl_table firmware_config_table[];
#endif

Linus Torvalds's avatar
Linus Torvalds committed
260 261 262 263 264 265
#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
int sysctl_legacy_va_layout;
#endif

/* The default sysctl tables: */

266
static struct ctl_table sysctl_base_table[] = {
Linus Torvalds's avatar
Linus Torvalds committed
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
	{
		.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,
	},
292
	{ }
Linus Torvalds's avatar
Linus Torvalds committed
293 294
};

295
#ifdef CONFIG_SCHED_DEBUG
296 297 298 299
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 */
300
#ifdef CONFIG_SMP
301 302
static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
303 304
#endif /* CONFIG_SMP */
#endif /* CONFIG_SCHED_DEBUG */
305

306 307 308 309 310
#ifdef CONFIG_COMPACTION
static int min_extfrag_threshold;
static int max_extfrag_threshold = 1000;
#endif

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

975 976 977 978 979 980 981 982
#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,
	},
983
#endif
Linus Torvalds's avatar
Linus Torvalds committed
984
#if defined(CONFIG_X86)
985 986 987 988 989
	{
		.procname	= "panic_on_unrecovered_nmi",
		.data		= &panic_on_unrecovered_nmi,
		.maxlen		= sizeof(int),
		.mode		= 0644,
990
		.proc_handler	= proc_dointvec,
991
	},
992 993 994 995 996
	{
		.procname	= "panic_on_io_nmi",
		.data		= &panic_on_io_nmi,
		.maxlen		= sizeof(int),
		.mode		= 0644,
997
		.proc_handler	= proc_dointvec,
998
	},
999 1000 1001 1002 1003 1004 1005 1006 1007
#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
1008 1009 1010 1011 1012
	{
		.procname	= "bootloader_type",
		.data		= &bootloader_type,
		.maxlen		= sizeof (int),
		.mode		= 0444,
1013
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
1014
	},
1015 1016 1017 1018 1019
	{
		.procname	= "bootloader_version",
		.data		= &bootloader_version,
		.maxlen		= sizeof (int),
		.mode		= 0444,
1020
		.proc_handler	= proc_dointvec,
1021
	},
1022 1023 1024 1025 1026
	{
		.procname	= "io_delay_type",
		.data		= &io_delay_type,
		.maxlen		= sizeof(int),
		.mode		= 0644,
1027
		.proc_handler	= proc_dointvec,
1028
	},
Linus Torvalds's avatar
Linus Torvalds committed
1029
#endif
1030
#if defined(CONFIG_MMU)
Linus Torvalds's avatar
Linus Torvalds committed
1031 1032 1033 1034 1035
	{
		.procname	= "randomize_va_space",
		.data		= &randomize_va_space,
		.maxlen		= sizeof(int),
		.mode		= 0644,
1036
		.proc_handler	= proc_dointvec,
Linus Torvalds's avatar
Linus Torvalds committed
1037
	},
1038
#endif
1039
#if defined(CONFIG_S390) && defined(CONFIG_SMP)
1040 1041 1042 1043 1044
	{
		.procname	= "spin_retry",
		.data		= &spin_retry,
		.maxlen		= sizeof (int),
		.mode		= 0644,
1045
		.proc_handler	= proc_dointvec,
1046
	},
1047
#endif
1048
#if	defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
1049 1050
	{
		.procname	= "acpi_video_flags",
1051
		.data		= &acpi_realmode_flags,
1052 1053
		.maxlen		= sizeof (unsigned long),
		.mode		= 0644,
1054
		.proc_handler	= proc_doulongvec_minmax,
1055
	},
1056
#endif
1057
#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
1058 1059 1060 1061 1062
	{
		.procname	= "ignore-unaligned-usertrap",
		.data		= &no_unaligned_warning,
		.maxlen		= sizeof (int),
	 	.mode		= 0644,
1063
		.proc_handler	= proc_dointvec,
1064
	},
1065 1066
#endif
#ifdef CONFIG_IA64
1067 1068 1069 1070 1071
	{
		.procname	= "unaligned-dump-stack",
		.data		= &unaligned_dump_stack,
		.maxlen		= sizeof (int),
		.mode		= 0644,
1072
		.proc_handler	= proc_dointvec,
1073
	},
1074
#endif
1075 1076 1077 1078 1079 1080
#ifdef CONFIG_DETECT_HUNG_TASK
	{
		.procname	= "hung_task_panic",
		.data		= &sysctl_hung_task_panic,
		.maxlen		= sizeof(int),
		.mode		= 0644,
1081
		.proc_handler	= proc_dointvec_minmax,
1082 1083 1084
		.extra1		= &zero,
		.extra2		= &one,
	},
1085 1086 1087
	{
		.procname	= "hung_task_check_count",
		.data		= &sysctl_hung_task_check_count,
1088
		.maxlen		= sizeof(int),
1089
		.mode		= 0644,
1090 1091
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &zero,
1092 1093 1094 1095
	},
	{
		.procname	= "hung_task_timeout_secs",
		.data		= &sysctl_hung_task_timeout_secs,
Ingo Molnar's avatar
Ingo Molnar committed
1096
		.maxlen		= sizeof(unsigned long),
1097
		.mode		= 0644,
1098
		.proc_handler	= proc_dohung_task_timeout_secs,
1099
		.extra2		= &hung_task_timeout_max,
1100 1101 1102 1103
	},
	{
		.procname	= "hung_task_warnings",
		.data		= &sysctl_hung_task_warnings,
1104
		.maxlen		= sizeof(int),
1105
		.mode		= 0644,
1106 1107
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &neg_one,
1108
	},
1109
#endif
1110 1111 1112 1113 1114 1115
#ifdef CONFIG_RT_MUTEXES
	{
		.procname	= "max_lock_depth",
		.data		= &max_lock_depth,
		.maxlen		= sizeof(int),
		.mode		= 0644,
1116
		.proc_handler	= proc_dointvec,
1117
	},
Kees Cook's avatar
Kees Cook committed
1118
#endif
1119 1120 1121 1122 1123
	{
		.procname	= "poweroff_cmd",
		.data		= &poweroff_cmd,
		.maxlen		= POWEROFF_CMD_PATH_LEN,
		.mode		= 0644,
1124
		.proc_handler	= proc_dostring,
1125
	},
1126 1127 1128 1129 1130 1131 1132
#ifdef CONFIG_KEYS
	{
		.procname	= "keys",
		.mode		= 0555,
		.child		= key_sysctls,
	},
#endif
1133
#ifdef CONFIG_PERF_EVENTS
1134 1135 1136 1137 1138 1139
	/*
	 * 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!
	 */
1140
	{
1141 1142 1143
		.procname	= "perf_event_paranoid",
		.data		= &sysctl_perf_event_paranoid,
		.maxlen		= sizeof(sysctl_perf_event_paranoid),
1144
		.mode		= 0644,
1145
		.proc_handler	= proc_dointvec,
1146
	},
1147
	{
1148 1149 1150
		.procname	= "perf_event_mlock_kb",
		.data		= &sysctl_perf_event_mlock,
		.maxlen		= sizeof(sysctl_perf_event_mlock),
1151
		.mode		= 0644,
1152
		.proc_handler	= proc_dointvec,
1153
	},
1154
	{
1155 1156 1157
		.procname	= "perf_event_max_sample_rate",
		.data		= &sysctl_perf_event_sample_rate,
		.maxlen		= sizeof(sysctl_perf_event_sample_rate),
1158
		.mode		= 0644,
1159
		.proc_handler	= perf_proc_update_handler,
1160
		.extra1		= &one,
1161
	},
1162 1163 1164 1165 1166 1167 1168 1169 1170
	{
		.procname	= "perf_cpu_time_max_percent",
		.data		= &sysctl_perf_cpu_time_max_percent,
		.maxlen		= sizeof(sysctl_perf_cpu_time_max_percent),
		.mode		= 0644,
		.proc_handler	= perf_cpu_time_max_percent_handler,
		.extra1		= &zero,
		.extra2		= &one_hundred,
	},
1171 1172
	{
		.procname	= "perf_event_max_stack",
1173
		.data		= &sysctl_perf_event_max_stack,
1174 1175 1176 1177 1178 1179
		.maxlen		= sizeof(sysctl_perf_event_max_stack),
		.mode		= 0644,
		.proc_handler	= perf_event_max_stack_handler,
		.extra1		= &zero,
		.extra2		= &six_hundred_forty_kb,
	},
1180 1181 1182 1183 1184 1185 1186 1187 1188
	{
		.procname	= "perf_event_max_contexts_per_stack",
		.data		= &sysctl_perf_event_max_contexts_per_stack,
		.maxlen		= sizeof(sysctl_perf_event_max_contexts_per_stack),
		.mode		= 0644,
		.proc_handler	= perf_event_max_stack_handler,
		.extra1		= &zero,
		.extra2		= &one_thousand,
	},
1189
#endif
1190 1191 1192 1193 1194 1195 1196 1197 1198
	{
		.procname	= "panic_on_warn",
		.data		= &panic_on_warn,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &zero,
		.extra2		= &one,
	},
1199 1200 1201 1202 1203 1204 1205
#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
	{
		.procname	= "timer_migration",
		.data		= &sysctl_timer_migration,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
		.proc_handler	= timer_migration_handler,
1206 1207
		.extra1		= &zero,
		.extra2		= &one,
1208
	},
1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220
#endif
#ifdef CONFIG_BPF_SYSCALL
	{
		.procname	= "unprivileged_bpf_disabled",
		.data		= &sysctl_unprivileged_bpf_disabled,
		.maxlen		= sizeof(sysctl_unprivileged_bpf_disabled),
		.mode		= 0644,
		/* only handle a transition from default "0" to "1" */
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &one,
		.extra2		= &one,
	},
1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231
#endif
#if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU)
	{
		.procname	= "panic_on_rcu_stall",
		.data		= &sysctl_panic_on_rcu_stall,
		.maxlen		= sizeof(sysctl_panic_on_rcu_stall),
		.mode		= 0644,
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &zero,
		.extra2		= &one,
	},
1232
#endif
1233
	{ }
Linus Torvalds's avatar
Linus Torvalds committed
1234 1235
};

1236
static struct ctl_table vm_table[] = {
Linus Torvalds's avatar
Linus Torvalds committed
1237 1238 1239 1240 1241
	{
		.procname	= "overcommit_memory",
		.data		= &sysctl_overcommit_memory,
		.maxlen		= sizeof(sysctl_overcommit_memory),
		.mode		= 0644,
1242 1243 1244
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &zero,
		.extra2		= &two,
Linus Torvalds's avatar
Linus Torvalds committed
1245
	},
1246 1247 1248 1249 1250
	{
		.procname	= "panic_on_oom",
		.data		= &sysctl_panic_on_oom,
		.maxlen		= sizeof(sysctl_panic_on_oom),
		.mode		= 0644,
1251 1252 1253
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &zero,
		.extra2		= &two,
1254
	},
1255 1256 1257 1258 1259
	{
		.procname	= "oom_kill_allocating_task",
		.data		= &sysctl_oom_kill_allocating_task,
		.maxlen		= sizeof(sysctl_oom_kill_allocating_task),
		.mode		= 0644,
1260
		.proc_handler	= proc_dointvec,
1261
	},
1262 1263 1264 1265 1266
	{
		.procname	= "oom_dump_tasks",
		.data		= &sysctl_oom_dump_tasks,
		.maxlen		= sizeof(sysctl_oom_dump_tasks),
		.mode		= 0644,
1267
		.proc_handler	= proc_dointvec,
1268
	},
Linus Torvalds's avatar
Linus Torvalds committed
1269 1270 1271 1272 1273
	{
		.procname	= "overcommit_ratio",
		.data		= &sysctl_overcommit_ratio,
		.maxlen		= sizeof(sysctl_overcommit_ratio),
		.mode		= 0644,
1274 1275 1276 1277 1278 1279 1280 1281
		.proc_handler	= overcommit_ratio_handler,
	},
	{
		.procname	= "overcommit_kbytes",
		.data		= &sysctl_overcommit_kbytes,
		.maxlen		= sizeof(sysctl_overcommit_kbytes),
		.mode		= 0644,
		.proc_handler	= overcommit_kbytes_handler,
Linus Torvalds's avatar
Linus Torvalds committed
1282 1283 1284 1285 1286 1287
	},
	{
		.procname	= "page-cluster", 
		.data		= &page_cluster,
		.maxlen		= sizeof(int),
		.mode		= 0644,
1288 1289
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &zero,
Linus Torvalds's avatar
Linus Torvalds committed
1290 1291 1292 1293 1294 1295
	},
	{
		.procname	= "dirty_background_ratio",
		.data		= &dirty_background_ratio,
		.maxlen		= sizeof(dirty_background_ratio),
		.mode		= 0644,
1296
		.proc_handler	= dirty_background_ratio_handler,
Linus Torvalds's avatar
Linus Torvalds committed
1297 1298 1299
		.extra1		= &zero,
		.extra2		= &one_hundred,
	},
1300 1301 1302 1303 1304
	{
		.procname	= "dirty_background_bytes",
		.data		= &dirty_background_bytes,
		.maxlen		= sizeof(dirty_background_bytes),
		.mode		= 0644,
1305
		.proc_handler	= dirty_background_bytes_handler,
1306
		.extra1		= &one_ul,
1307
	},
Linus Torvalds's avatar
Linus Torvalds committed
1308 1309 1310 1311 1312
	{
		.procname	= "dirty_ratio",
		.data		= &vm_dirty_ratio,
		.maxlen		= sizeof(vm_dirty_ratio),
		.mode		= 0644,
1313
		.proc_handler	= dirty_ratio_handler,
Linus Torvalds's avatar
Linus Torvalds committed
1314 1315 1316
		.extra1		= &zero,
		.extra2		= &one_hundred,
	},
1317 1318 1319 1320 1321
	{
		.procname	= "dirty_bytes",
		.data		= &vm_dirty_bytes,
		.maxlen		= sizeof(vm_dirty_bytes),
		.mode		= 0644,
1322
		.proc_handler	= dirty_bytes_handler,
1323
		.extra1		= &dirty_bytes_min,
1324
	},
Linus Torvalds's avatar
Linus Torvalds committed
1325 1326
	{
		.procname	= "dirty_writeback_centisecs",
1327 1328
		.data		= &dirty_writeback_interval,
		.maxlen		= sizeof(dirty_writeback_interval),
Linus Torvalds's avatar
Linus Torvalds committed
1329
		.mode		= 0644,
1330
		.proc_handler	= dirty_writeback_centisecs_handler,
Linus Torvalds's avatar
Linus Torvalds committed
1331 1332 1333