blob: 03f18cc15697a9138d79b146040fe786fe60f68d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * sysctl.c: General linux system control interface
3 *
4 * Begun 24 March 1995, Stephen Tweedie
5 * Added /proc support, Dec 1995
6 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
7 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
8 * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
9 * Dynamic registration fixes, Stephen Tweedie.
10 * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
11 * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
12 * Horn.
13 * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
14 * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
15 * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
16 * Wendling.
17 * The list_for_each() macro wasn't appropriate for the sysctl loop.
18 * Removed it and replaced it with older style, 03/23/00, Bill Wendling
19 */
20
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <linux/module.h>
Christoph Hellwige2e40f22015-02-22 08:58:50 -080022#include <linux/aio.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include <linux/mm.h>
24#include <linux/swap.h>
25#include <linux/slab.h>
26#include <linux/sysctl.h>
Akinobu Mita5a04cca2012-03-28 14:42:50 -070027#include <linux/bitmap.h>
Dave Youngd33ed522010-03-10 15:23:59 -080028#include <linux/signal.h>
Dan Rosenberg455cd5a2011-01-12 16:59:41 -080029#include <linux/printk.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#include <linux/proc_fs.h>
Andrew Morgan72c2d582007-10-18 03:05:59 -070031#include <linux/security.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#include <linux/ctype.h>
Vegard Nossumdfec0722008-04-04 00:51:41 +020033#include <linux/kmemcheck.h>
Steven Rostedtfd4b6162012-07-30 14:42:48 -070034#include <linux/kmemleak.h>
Adrian Bunk62239ac2007-07-17 04:03:45 -070035#include <linux/fs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070036#include <linux/init.h>
37#include <linux/kernel.h>
Kay Sievers0296b222005-11-11 05:33:52 +010038#include <linux/kobject.h>
Arnaldo Carvalho de Melo20380732005-08-16 02:18:02 -030039#include <linux/net.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070040#include <linux/sysrq.h>
41#include <linux/highuid.h>
42#include <linux/writeback.h>
Ingo Molnar3fff4c42009-09-22 16:18:09 +020043#include <linux/ratelimit.h>
Mel Gorman76ab0f52010-05-24 14:32:28 -070044#include <linux/compaction.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#include <linux/hugetlb.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070046#include <linux/initrd.h>
David Howells0b77f5b2008-04-29 01:01:32 -070047#include <linux/key.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070048#include <linux/times.h>
49#include <linux/limits.h>
50#include <linux/dcache.h>
Alexey Dobriyan6e006702010-01-20 22:27:56 +020051#include <linux/dnotify.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070052#include <linux/syscalls.h>
Adrian Bunkc748e132008-07-23 21:27:03 -070053#include <linux/vmstat.h>
Pavel Machekc255d842006-02-20 18:27:58 -080054#include <linux/nfs_fs.h>
55#include <linux/acpi.h>
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -070056#include <linux/reboot.h>
Steven Rostedtb0fc4942008-05-12 21:20:43 +020057#include <linux/ftrace.h>
Ingo Molnarcdd6c482009-09-21 12:02:48 +020058#include <linux/perf_event.h>
Masami Hiramatsub2be84d2010-02-25 08:34:15 -050059#include <linux/kprobes.h>
Jens Axboeb492e952010-05-19 21:03:16 +020060#include <linux/pipe_fs_i.h>
David Rientjes8e4228e2010-08-09 17:18:56 -070061#include <linux/oom.h>
Eric Paris17f60a72011-04-01 17:07:50 -040062#include <linux/kmod.h>
Dan Ballard73efc032011-10-31 17:11:20 -070063#include <linux/capability.h>
Al Viro40401532012-02-13 03:58:52 +000064#include <linux/binfmts.h>
Clark Williamscf4aebc22013-02-07 09:46:59 -060065#include <linux/sched/sysctl.h>
Kees Cook79847542014-01-23 15:55:59 -080066#include <linux/kexec.h>
Alexei Starovoitov1be7f752015-10-07 22:23:21 -070067#include <linux/bpf.h>
Eric W. Biedermand2921682016-09-28 00:27:17 -050068#include <linux/mount.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070069
70#include <asm/uaccess.h>
71#include <asm/processor.h>
72
Andi Kleen29cbc782006-09-30 01:47:55 +020073#ifdef CONFIG_X86
74#include <asm/nmi.h>
Chuck Ebbert0741f4d2006-12-07 02:14:11 +010075#include <asm/stacktrace.h>
Ingo Molnar6e7c4022008-01-30 13:30:05 +010076#include <asm/io.h>
Andi Kleen29cbc782006-09-30 01:47:55 +020077#endif
David Howellsd550bbd2012-03-28 18:30:03 +010078#ifdef CONFIG_SPARC
79#include <asm/setup.h>
80#endif
Dave Youngc55b7c32010-03-10 15:24:08 -080081#ifdef CONFIG_BSD_PROCESS_ACCT
82#include <linux/acct.h>
83#endif
Dave Young4f0e0562010-03-10 15:24:09 -080084#ifdef CONFIG_RT_MUTEXES
85#include <linux/rtmutex.h>
86#endif
Dave Young2edf5e42010-03-10 15:24:10 -080087#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
88#include <linux/lockdep.h>
89#endif
Dave Young15485a42010-03-10 15:24:07 -080090#ifdef CONFIG_CHR_DEV_SG
91#include <scsi/sg.h>
92#endif
Andi Kleen29cbc782006-09-30 01:47:55 +020093
Don Zickus58687ac2010-05-07 17:11:44 -040094#ifdef CONFIG_LOCKUP_DETECTOR
Don Zickus504d7cf2010-02-12 17:19:19 -050095#include <linux/nmi.h>
96#endif
97
Linus Torvalds1da177e2005-04-16 15:20:36 -070098#if defined(CONFIG_SYSCTL)
99
100/* External variables not in a header file. */
Alan Coxd6e71142005-06-23 00:09:43 -0700101extern int suid_dumpable;
Alex Kelly046d6622012-10-04 17:15:23 -0700102#ifdef CONFIG_COREDUMP
103extern int core_uses_pid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104extern char core_pattern[];
Neil Hormana2939802009-09-23 15:56:56 -0700105extern unsigned int core_pipe_limit;
Alex Kelly046d6622012-10-04 17:15:23 -0700106#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107extern int pid_max;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108extern int pid_max_min, pid_max_max;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800109extern int percpu_pagelist_fraction;
Andi Kleenbebfa102006-06-26 13:56:52 +0200110extern int compat_log;
Arjan van de Ven97455122008-01-25 21:08:34 +0100111extern int latencytop_enabled;
Al Viroeceea0b2008-05-10 10:08:32 -0400112extern int sysctl_nr_open_min, sysctl_nr_open_max;
Paul Mundtdd8632a2009-01-08 12:04:47 +0000113#ifndef CONFIG_MMU
114extern int sysctl_nr_trim_pages;
115#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700117/* Constants used for minimum and maximum */
Don Zickus2508ce12010-05-07 17:11:46 -0400118#ifdef CONFIG_LOCKUP_DETECTOR
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700119static int sixty = 60;
120#endif
121
Aaron Tomlin270750db2014-01-20 17:34:13 +0000122static int __maybe_unused neg_one = -1;
123
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700124static int zero;
Linus Torvaldscd5f9a42009-04-06 13:38:46 -0700125static int __maybe_unused one = 1;
126static int __maybe_unused two = 2;
Dave Hansen5509a5d2014-04-03 14:48:19 -0700127static int __maybe_unused four = 4;
Sven Wegenerfc3501d2009-02-11 13:04:23 -0800128static unsigned long one_ul = 1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700129static int one_hundred = 100;
Johannes Weiner795ae7a2016-03-17 14:19:14 -0700130static int one_thousand = 1000;
Dave Youngaf913222009-09-22 16:43:33 -0700131#ifdef CONFIG_PRINTK
132static int ten_thousand = 10000;
133#endif
Arnaldo Carvalho de Meloc5dfd782016-04-21 12:28:50 -0300134#ifdef CONFIG_PERF_EVENTS
135static int six_hundred_forty_kb = 640 * 1024;
136#endif
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700137
Andrea Righi9e4a5bd2009-04-30 15:08:57 -0700138/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
139static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
140
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
142static int maxolduid = 65535;
143static int minolduid;
144
145static int ngroups_max = NGROUPS_MAX;
Dan Ballard73efc032011-10-31 17:11:20 -0700146static const int cap_last_cap = CAP_LAST_CAP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147
Liu Hua80df2842014-04-07 15:38:57 -0700148/*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */
149#ifdef CONFIG_DETECT_HUNG_TASK
150static unsigned long hung_task_timeout_max = (LONG_MAX/HZ);
151#endif
152
Dave Youngd14f1722010-02-25 20:28:57 -0500153#ifdef CONFIG_INOTIFY_USER
154#include <linux/inotify.h>
155#endif
David S. Miller72c57ed2008-09-11 23:29:54 -0700156#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157#endif
158
159#ifdef __hppa__
160extern int pwrsw_enabled;
Vineet Guptabf14e3b2013-01-18 15:12:24 +0530161#endif
162
163#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164extern int unaligned_enabled;
165#endif
166
Jes Sorensend2b176e2006-02-28 09:42:23 -0800167#ifdef CONFIG_IA64
Doug Chapman88fc2412009-01-15 10:38:56 -0800168extern int unaligned_dump_stack;
Jes Sorensend2b176e2006-02-28 09:42:23 -0800169#endif
170
Vineet Guptab6fca722013-01-09 20:06:28 +0530171#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
172extern int no_unaligned_warning;
173#endif
174
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700175#ifdef CONFIG_PROC_SYSCTL
Kees Cookf4aacea2014-06-06 14:37:19 -0700176
177#define SYSCTL_WRITES_LEGACY -1
178#define SYSCTL_WRITES_WARN 0
179#define SYSCTL_WRITES_STRICT 1
180
Kees Cook41662f52016-01-20 15:00:45 -0800181static int sysctl_writes_strict = SYSCTL_WRITES_STRICT;
Kees Cookf4aacea2014-06-06 14:37:19 -0700182
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700183static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700184 void __user *buffer, size_t *lenp, loff_t *ppos);
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700185static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800186 void __user *buffer, size_t *lenp, loff_t *ppos);
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700187#endif
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700188
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700189#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -0700190static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700191 void __user *buffer, size_t *lenp, loff_t *ppos);
192#endif
193
Kees Cook54b50192012-07-30 14:39:18 -0700194static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
195 void __user *buffer, size_t *lenp, loff_t *ppos);
Alex Kelly046d6622012-10-04 17:15:23 -0700196#ifdef CONFIG_COREDUMP
Kees Cook54b50192012-07-30 14:39:18 -0700197static int proc_dostring_coredump(struct ctl_table *table, int write,
198 void __user *buffer, size_t *lenp, loff_t *ppos);
Alex Kelly046d6622012-10-04 17:15:23 -0700199#endif
Kees Cook54b50192012-07-30 14:39:18 -0700200
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700201#ifdef CONFIG_MAGIC_SYSRQ
Andy Whitcroft8c6a98b2011-01-24 09:31:38 -0800202/* Note: sysrq code uses it's own private copy */
Ben Hutchings8eaede42013-10-07 01:05:46 +0100203static int __sysrq_enabled = CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE;
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700204
Joe Perches6f8fd1d2014-06-06 14:38:08 -0700205static int sysrq_sysctl_handler(struct ctl_table *table, int write,
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700206 void __user *buffer, size_t *lenp,
207 loff_t *ppos)
208{
209 int error;
210
211 error = proc_dointvec(table, write, buffer, lenp, ppos);
212 if (error)
213 return error;
214
215 if (write)
216 sysrq_toggle_support(__sysrq_enabled);
217
218 return 0;
219}
220
221#endif
222
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700223static struct ctl_table kern_table[];
224static struct ctl_table vm_table[];
225static struct ctl_table fs_table[];
226static struct ctl_table debug_table[];
227static struct ctl_table dev_table[];
228extern struct ctl_table random_table[];
Davide Libenzi7ef99642008-12-01 13:13:55 -0800229#ifdef CONFIG_EPOLL
230extern struct ctl_table epoll_table[];
231#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232
233#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
234int sysctl_legacy_va_layout;
235#endif
236
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237/* The default sysctl tables: */
238
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -0800239static struct ctl_table sysctl_base_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241 .procname = "kernel",
242 .mode = 0555,
243 .child = kern_table,
244 },
245 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246 .procname = "vm",
247 .mode = 0555,
248 .child = vm_table,
249 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700251 .procname = "fs",
252 .mode = 0555,
253 .child = fs_table,
254 },
255 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256 .procname = "debug",
257 .mode = 0555,
258 .child = debug_table,
259 },
260 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261 .procname = "dev",
262 .mode = 0555,
263 .child = dev_table,
264 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -0700265 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700266};
267
Ingo Molnar77e54a12007-07-09 18:52:00 +0200268#ifdef CONFIG_SCHED_DEBUG
Eric Dumazet73c4efd2007-12-18 15:21:13 +0100269static int min_sched_granularity_ns = 100000; /* 100 usecs */
270static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
271static int min_wakeup_granularity_ns; /* 0 usecs */
272static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
Peter Zijlstracbee9f82012-10-25 14:16:43 +0200273#ifdef CONFIG_SMP
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100274static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
275static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
Peter Zijlstracbee9f82012-10-25 14:16:43 +0200276#endif /* CONFIG_SMP */
277#endif /* CONFIG_SCHED_DEBUG */
Ingo Molnar77e54a12007-07-09 18:52:00 +0200278
Mel Gorman5e771902010-05-24 14:32:31 -0700279#ifdef CONFIG_COMPACTION
280static int min_extfrag_threshold;
281static int max_extfrag_threshold = 1000;
282#endif
283
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700284static struct ctl_table kern_table[] = {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200285 {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200286 .procname = "sched_child_runs_first",
287 .data = &sysctl_sched_child_runs_first,
288 .maxlen = sizeof(unsigned int),
289 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800290 .proc_handler = proc_dointvec,
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200291 },
Ingo Molnar77e54a12007-07-09 18:52:00 +0200292#ifdef CONFIG_SCHED_DEBUG
293 {
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100294 .procname = "sched_min_granularity_ns",
295 .data = &sysctl_sched_min_granularity,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200296 .maxlen = sizeof(unsigned int),
297 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800298 .proc_handler = sched_proc_update_handler,
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100299 .extra1 = &min_sched_granularity_ns,
300 .extra2 = &max_sched_granularity_ns,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200301 },
302 {
Peter Zijlstra21805082007-08-25 18:41:53 +0200303 .procname = "sched_latency_ns",
304 .data = &sysctl_sched_latency,
305 .maxlen = sizeof(unsigned int),
306 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800307 .proc_handler = sched_proc_update_handler,
Peter Zijlstra21805082007-08-25 18:41:53 +0200308 .extra1 = &min_sched_granularity_ns,
309 .extra2 = &max_sched_granularity_ns,
310 },
311 {
Ingo Molnar77e54a12007-07-09 18:52:00 +0200312 .procname = "sched_wakeup_granularity_ns",
313 .data = &sysctl_sched_wakeup_granularity,
314 .maxlen = sizeof(unsigned int),
315 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800316 .proc_handler = sched_proc_update_handler,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200317 .extra1 = &min_wakeup_granularity_ns,
318 .extra2 = &max_wakeup_granularity_ns,
319 },
Peter Zijlstracbee9f82012-10-25 14:16:43 +0200320#ifdef CONFIG_SMP
Ingo Molnar77e54a12007-07-09 18:52:00 +0200321 {
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100322 .procname = "sched_tunable_scaling",
323 .data = &sysctl_sched_tunable_scaling,
324 .maxlen = sizeof(enum sched_tunable_scaling),
325 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800326 .proc_handler = sched_proc_update_handler,
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100327 .extra1 = &min_sched_tunable_scaling,
328 .extra2 = &max_sched_tunable_scaling,
Peter Zijlstra2398f2c2008-06-27 13:41:35 +0200329 },
330 {
Namhyung Kimd00535d2012-08-16 11:15:30 +0900331 .procname = "sched_migration_cost_ns",
Ingo Molnarda84d962007-10-15 17:00:18 +0200332 .data = &sysctl_sched_migration_cost,
333 .maxlen = sizeof(unsigned int),
334 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800335 .proc_handler = proc_dointvec,
Ingo Molnarda84d962007-10-15 17:00:18 +0200336 },
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100337 {
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100338 .procname = "sched_nr_migrate",
339 .data = &sysctl_sched_nr_migrate,
340 .maxlen = sizeof(unsigned int),
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100341 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800342 .proc_handler = proc_dointvec,
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100343 },
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530344 {
Namhyung Kimd00535d2012-08-16 11:15:30 +0900345 .procname = "sched_time_avg_ms",
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200346 .data = &sysctl_sched_time_avg,
347 .maxlen = sizeof(unsigned int),
348 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800349 .proc_handler = proc_dointvec,
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200350 },
351 {
Namhyung Kimd00535d2012-08-16 11:15:30 +0900352 .procname = "sched_shares_window_ns",
Paul Turnera7a4f8a2010-11-15 15:47:06 -0800353 .data = &sysctl_sched_shares_window,
354 .maxlen = sizeof(unsigned int),
355 .mode = 0644,
356 .proc_handler = proc_dointvec,
357 },
Mel Gormancb251762016-02-05 09:08:36 +0000358#ifdef CONFIG_SCHEDSTATS
359 {
360 .procname = "sched_schedstats",
361 .data = NULL,
362 .maxlen = sizeof(unsigned int),
363 .mode = 0644,
364 .proc_handler = sysctl_schedstats,
365 .extra1 = &zero,
366 .extra2 = &one,
367 },
368#endif /* CONFIG_SCHEDSTATS */
Peter Zijlstracbee9f82012-10-25 14:16:43 +0200369#endif /* CONFIG_SMP */
370#ifdef CONFIG_NUMA_BALANCING
371 {
Peter Zijlstra4b96a292012-10-25 14:16:47 +0200372 .procname = "numa_balancing_scan_delay_ms",
373 .data = &sysctl_numa_balancing_scan_delay,
374 .maxlen = sizeof(unsigned int),
375 .mode = 0644,
376 .proc_handler = proc_dointvec,
377 },
378 {
Peter Zijlstracbee9f82012-10-25 14:16:43 +0200379 .procname = "numa_balancing_scan_period_min_ms",
380 .data = &sysctl_numa_balancing_scan_period_min,
381 .maxlen = sizeof(unsigned int),
382 .mode = 0644,
383 .proc_handler = proc_dointvec,
384 },
385 {
386 .procname = "numa_balancing_scan_period_max_ms",
387 .data = &sysctl_numa_balancing_scan_period_max,
388 .maxlen = sizeof(unsigned int),
389 .mode = 0644,
390 .proc_handler = proc_dointvec,
391 },
Peter Zijlstra6e5fb222012-10-25 14:16:45 +0200392 {
393 .procname = "numa_balancing_scan_size_mb",
394 .data = &sysctl_numa_balancing_scan_size,
395 .maxlen = sizeof(unsigned int),
396 .mode = 0644,
Kirill Tkhai64192652014-10-16 14:39:37 +0400397 .proc_handler = proc_dointvec_minmax,
398 .extra1 = &one,
Peter Zijlstra6e5fb222012-10-25 14:16:45 +0200399 },
Mel Gorman3a7053b2013-10-07 11:29:00 +0100400 {
Andi Kleen54a43d52014-01-23 15:53:13 -0800401 .procname = "numa_balancing",
402 .data = NULL, /* filled in by handler */
403 .maxlen = sizeof(unsigned int),
404 .mode = 0644,
405 .proc_handler = sysctl_numa_balancing,
406 .extra1 = &zero,
407 .extra2 = &one,
408 },
Peter Zijlstracbee9f82012-10-25 14:16:43 +0200409#endif /* CONFIG_NUMA_BALANCING */
410#endif /* CONFIG_SCHED_DEBUG */
Ingo Molnar1799e352007-09-19 23:34:46 +0200411 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100412 .procname = "sched_rt_period_us",
413 .data = &sysctl_sched_rt_period,
414 .maxlen = sizeof(unsigned int),
415 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800416 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100417 },
418 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100419 .procname = "sched_rt_runtime_us",
420 .data = &sysctl_sched_rt_runtime,
421 .maxlen = sizeof(int),
422 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800423 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100424 },
Clark Williamsce0dbbb2013-02-07 09:47:04 -0600425 {
426 .procname = "sched_rr_timeslice_ms",
427 .data = &sched_rr_timeslice,
428 .maxlen = sizeof(int),
429 .mode = 0644,
430 .proc_handler = sched_rr_handler,
431 },
Mike Galbraith5091faa2010-11-30 14:18:03 +0100432#ifdef CONFIG_SCHED_AUTOGROUP
433 {
434 .procname = "sched_autogroup_enabled",
435 .data = &sysctl_sched_autogroup_enabled,
436 .maxlen = sizeof(unsigned int),
437 .mode = 0644,
Yong Zhang1747b212011-02-20 15:08:12 +0800438 .proc_handler = proc_dointvec_minmax,
Mike Galbraith5091faa2010-11-30 14:18:03 +0100439 .extra1 = &zero,
440 .extra2 = &one,
441 },
442#endif
Paul Turnerec12cb72011-07-21 09:43:30 -0700443#ifdef CONFIG_CFS_BANDWIDTH
444 {
445 .procname = "sched_cfs_bandwidth_slice_us",
446 .data = &sysctl_sched_cfs_bandwidth_slice,
447 .maxlen = sizeof(unsigned int),
448 .mode = 0644,
449 .proc_handler = proc_dointvec_minmax,
450 .extra1 = &one,
451 },
452#endif
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700453#ifdef CONFIG_PROVE_LOCKING
454 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700455 .procname = "prove_locking",
456 .data = &prove_locking,
457 .maxlen = sizeof(int),
458 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800459 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700460 },
461#endif
462#ifdef CONFIG_LOCK_STAT
463 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700464 .procname = "lock_stat",
465 .data = &lock_stat,
466 .maxlen = sizeof(int),
467 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800468 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700469 },
470#endif
Ingo Molnar77e54a12007-07-09 18:52:00 +0200471 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700472 .procname = "panic",
473 .data = &panic_timeout,
474 .maxlen = sizeof(int),
475 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800476 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700477 },
Alex Kelly046d6622012-10-04 17:15:23 -0700478#ifdef CONFIG_COREDUMP
Linus Torvalds1da177e2005-04-16 15:20:36 -0700479 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700480 .procname = "core_uses_pid",
481 .data = &core_uses_pid,
482 .maxlen = sizeof(int),
483 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800484 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700485 },
486 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700487 .procname = "core_pattern",
488 .data = core_pattern,
Dan Aloni71ce92f2007-05-16 22:11:16 -0700489 .maxlen = CORENAME_MAX_SIZE,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700490 .mode = 0644,
Kees Cook54b50192012-07-30 14:39:18 -0700491 .proc_handler = proc_dostring_coredump,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700492 },
Neil Hormana2939802009-09-23 15:56:56 -0700493 {
Neil Hormana2939802009-09-23 15:56:56 -0700494 .procname = "core_pipe_limit",
495 .data = &core_pipe_limit,
496 .maxlen = sizeof(unsigned int),
497 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800498 .proc_handler = proc_dointvec,
Neil Hormana2939802009-09-23 15:56:56 -0700499 },
Alex Kelly046d6622012-10-04 17:15:23 -0700500#endif
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800501#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700503 .procname = "tainted",
Andi Kleen25ddbb12008-10-15 22:01:41 -0700504 .maxlen = sizeof(long),
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800505 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800506 .proc_handler = proc_taint,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507 },
Kees Cookf4aacea2014-06-06 14:37:19 -0700508 {
509 .procname = "sysctl_writes_strict",
510 .data = &sysctl_writes_strict,
511 .maxlen = sizeof(int),
512 .mode = 0644,
513 .proc_handler = proc_dointvec_minmax,
514 .extra1 = &neg_one,
515 .extra2 = &one,
516 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800517#endif
Arjan van de Ven97455122008-01-25 21:08:34 +0100518#ifdef CONFIG_LATENCYTOP
519 {
520 .procname = "latencytop",
521 .data = &latencytop_enabled,
522 .maxlen = sizeof(int),
523 .mode = 0644,
Mel Gormancb251762016-02-05 09:08:36 +0000524 .proc_handler = sysctl_latencytop,
Arjan van de Ven97455122008-01-25 21:08:34 +0100525 },
526#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700527#ifdef CONFIG_BLK_DEV_INITRD
528 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700529 .procname = "real-root-dev",
530 .data = &real_root_dev,
531 .maxlen = sizeof(int),
532 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800533 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700534 },
535#endif
Ingo Molnar45807a12007-07-15 23:40:10 -0700536 {
Ingo Molnar45807a12007-07-15 23:40:10 -0700537 .procname = "print-fatal-signals",
538 .data = &print_fatal_signals,
539 .maxlen = sizeof(int),
540 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800541 .proc_handler = proc_dointvec,
Ingo Molnar45807a12007-07-15 23:40:10 -0700542 },
David S. Miller72c57ed2008-09-11 23:29:54 -0700543#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700545 .procname = "reboot-cmd",
546 .data = reboot_command,
547 .maxlen = 256,
548 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800549 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700550 },
551 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700552 .procname = "stop-a",
553 .data = &stop_a_enabled,
554 .maxlen = sizeof (int),
555 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800556 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700557 },
558 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700559 .procname = "scons-poweroff",
560 .data = &scons_pwroff,
561 .maxlen = sizeof (int),
562 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800563 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 },
565#endif
David S. Miller08714202008-11-16 23:49:24 -0800566#ifdef CONFIG_SPARC64
567 {
David S. Miller08714202008-11-16 23:49:24 -0800568 .procname = "tsb-ratio",
569 .data = &sysctl_tsb_ratio,
570 .maxlen = sizeof (int),
571 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800572 .proc_handler = proc_dointvec,
David S. Miller08714202008-11-16 23:49:24 -0800573 },
574#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575#ifdef __hppa__
576 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700577 .procname = "soft-power",
578 .data = &pwrsw_enabled,
579 .maxlen = sizeof (int),
580 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800581 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700582 },
Vineet Guptabf14e3b2013-01-18 15:12:24 +0530583#endif
584#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
Linus Torvalds1da177e2005-04-16 15:20:36 -0700585 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586 .procname = "unaligned-trap",
587 .data = &unaligned_enabled,
588 .maxlen = sizeof (int),
589 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800590 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591 },
592#endif
593 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700594 .procname = "ctrl-alt-del",
595 .data = &C_A_D,
596 .maxlen = sizeof(int),
597 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800598 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599 },
Steven Rostedt606576c2008-10-06 19:06:12 -0400600#ifdef CONFIG_FUNCTION_TRACER
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200601 {
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200602 .procname = "ftrace_enabled",
603 .data = &ftrace_enabled,
604 .maxlen = sizeof(int),
605 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800606 .proc_handler = ftrace_enable_sysctl,
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200607 },
608#endif
Steven Rostedtf38f1d2a2008-12-16 23:06:40 -0500609#ifdef CONFIG_STACK_TRACER
610 {
Steven Rostedtf38f1d2a2008-12-16 23:06:40 -0500611 .procname = "stack_tracer_enabled",
612 .data = &stack_tracer_enabled,
613 .maxlen = sizeof(int),
614 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800615 .proc_handler = stack_trace_sysctl,
Steven Rostedtf38f1d2a2008-12-16 23:06:40 -0500616 },
617#endif
Steven Rostedt944ac422008-10-23 19:26:08 -0400618#ifdef CONFIG_TRACING
619 {
Peter Zijlstra3299b4d2008-11-04 11:58:21 +0100620 .procname = "ftrace_dump_on_oops",
Steven Rostedt944ac422008-10-23 19:26:08 -0400621 .data = &ftrace_dump_on_oops,
622 .maxlen = sizeof(int),
623 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800624 .proc_handler = proc_dointvec,
Steven Rostedt944ac422008-10-23 19:26:08 -0400625 },
Steven Rostedt (Red Hat)de7edd32013-06-14 16:21:43 -0400626 {
627 .procname = "traceoff_on_warning",
628 .data = &__disable_trace_on_warning,
629 .maxlen = sizeof(__disable_trace_on_warning),
630 .mode = 0644,
631 .proc_handler = proc_dointvec,
632 },
Steven Rostedt (Red Hat)0daa23022014-12-12 22:27:10 -0500633 {
634 .procname = "tracepoint_printk",
635 .data = &tracepoint_printk,
636 .maxlen = sizeof(tracepoint_printk),
637 .mode = 0644,
638 .proc_handler = proc_dointvec,
639 },
Steven Rostedt944ac422008-10-23 19:26:08 -0400640#endif
Dave Young2965faa2015-09-09 15:38:55 -0700641#ifdef CONFIG_KEXEC_CORE
Kees Cook79847542014-01-23 15:55:59 -0800642 {
643 .procname = "kexec_load_disabled",
644 .data = &kexec_load_disabled,
645 .maxlen = sizeof(int),
646 .mode = 0644,
647 /* only handle a transition from default "0" to "1" */
648 .proc_handler = proc_dointvec_minmax,
649 .extra1 = &one,
650 .extra2 = &one,
651 },
652#endif
Johannes Berga1ef5ad2008-07-08 19:00:17 +0200653#ifdef CONFIG_MODULES
Linus Torvalds1da177e2005-04-16 15:20:36 -0700654 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700655 .procname = "modprobe",
656 .data = &modprobe_path,
657 .maxlen = KMOD_PATH_LEN,
658 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800659 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700660 },
Kees Cook3d433212009-04-02 15:49:29 -0700661 {
Kees Cook3d433212009-04-02 15:49:29 -0700662 .procname = "modules_disabled",
663 .data = &modules_disabled,
664 .maxlen = sizeof(int),
665 .mode = 0644,
666 /* only handle a transition from default "0" to "1" */
Eric W. Biederman6d456112009-11-16 03:11:48 -0800667 .proc_handler = proc_dointvec_minmax,
Kees Cook3d433212009-04-02 15:49:29 -0700668 .extra1 = &one,
669 .extra2 = &one,
670 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700671#endif
Michael Marineau86d56132014-04-10 14:09:31 -0700672#ifdef CONFIG_UEVENT_HELPER
Linus Torvalds1da177e2005-04-16 15:20:36 -0700673 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700674 .procname = "hotplug",
Kay Sievers312c0042005-11-16 09:00:00 +0100675 .data = &uevent_helper,
676 .maxlen = UEVENT_HELPER_PATH_LEN,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700677 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800678 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700679 },
Michael Marineau86d56132014-04-10 14:09:31 -0700680#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700681#ifdef CONFIG_CHR_DEV_SG
682 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683 .procname = "sg-big-buff",
684 .data = &sg_big_buff,
685 .maxlen = sizeof (int),
686 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800687 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700688 },
689#endif
690#ifdef CONFIG_BSD_PROCESS_ACCT
691 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700692 .procname = "acct",
693 .data = &acct_parm,
694 .maxlen = 3*sizeof(int),
695 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800696 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700697 },
698#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700699#ifdef CONFIG_MAGIC_SYSRQ
700 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700701 .procname = "sysrq",
Ingo Molnar5d6f6472006-12-13 00:34:36 -0800702 .data = &__sysrq_enabled,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700703 .maxlen = sizeof (int),
704 .mode = 0644,
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700705 .proc_handler = sysrq_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700706 },
707#endif
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700708#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700709 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700710 .procname = "cad_pid",
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700711 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700712 .maxlen = sizeof (int),
713 .mode = 0600,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800714 .proc_handler = proc_do_cad_pid,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700715 },
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700716#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700717 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700718 .procname = "threads-max",
Heinrich Schuchardt16db3d32015-04-16 12:47:50 -0700719 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700720 .maxlen = sizeof(int),
721 .mode = 0644,
Heinrich Schuchardt16db3d32015-04-16 12:47:50 -0700722 .proc_handler = sysctl_max_threads,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700723 },
724 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700725 .procname = "random",
726 .mode = 0555,
727 .child = random_table,
728 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700729 {
Eric Paris17f60a72011-04-01 17:07:50 -0400730 .procname = "usermodehelper",
731 .mode = 0555,
732 .child = usermodehelper_table,
733 },
734 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700735 .procname = "overflowuid",
736 .data = &overflowuid,
737 .maxlen = sizeof(int),
738 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800739 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700740 .extra1 = &minolduid,
741 .extra2 = &maxolduid,
742 },
743 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700744 .procname = "overflowgid",
745 .data = &overflowgid,
746 .maxlen = sizeof(int),
747 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800748 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700749 .extra1 = &minolduid,
750 .extra2 = &maxolduid,
751 },
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -0800752#ifdef CONFIG_S390
Linus Torvalds1da177e2005-04-16 15:20:36 -0700753#ifdef CONFIG_MATHEMU
754 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700755 .procname = "ieee_emulation_warnings",
756 .data = &sysctl_ieee_emulation_warnings,
757 .maxlen = sizeof(int),
758 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800759 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700760 },
761#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700762 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700763 .procname = "userprocess_debug",
Heiko Carstensab3c68e2010-05-17 10:00:21 +0200764 .data = &show_unhandled_signals,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700765 .maxlen = sizeof(int),
766 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800767 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700768 },
769#endif
770 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700771 .procname = "pid_max",
772 .data = &pid_max,
773 .maxlen = sizeof (int),
774 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800775 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700776 .extra1 = &pid_max_min,
777 .extra2 = &pid_max_max,
778 },
779 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700780 .procname = "panic_on_oops",
781 .data = &panic_on_oops,
782 .maxlen = sizeof(int),
783 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800784 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700785 },
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800786#if defined CONFIG_PRINTK
787 {
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800788 .procname = "printk",
789 .data = &console_loglevel,
790 .maxlen = 4*sizeof(int),
791 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800792 .proc_handler = proc_dointvec,
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800793 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700794 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700795 .procname = "printk_ratelimit",
Dave Young717115e2008-07-25 01:45:58 -0700796 .data = &printk_ratelimit_state.interval,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700797 .maxlen = sizeof(int),
798 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800799 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700800 },
801 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700802 .procname = "printk_ratelimit_burst",
Dave Young717115e2008-07-25 01:45:58 -0700803 .data = &printk_ratelimit_state.burst,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700804 .maxlen = sizeof(int),
805 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800806 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700807 },
Dave Youngaf913222009-09-22 16:43:33 -0700808 {
Dave Youngaf913222009-09-22 16:43:33 -0700809 .procname = "printk_delay",
810 .data = &printk_delay_msec,
811 .maxlen = sizeof(int),
812 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800813 .proc_handler = proc_dointvec_minmax,
Dave Youngaf913222009-09-22 16:43:33 -0700814 .extra1 = &zero,
815 .extra2 = &ten_thousand,
816 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700817 {
Borislav Petkov750afe72016-08-02 14:04:07 -0700818 .procname = "printk_devkmsg",
819 .data = devkmsg_log_str,
820 .maxlen = DEVKMSG_STR_MAX_SIZE,
821 .mode = 0644,
822 .proc_handler = devkmsg_sysctl_set_loglvl,
823 },
824 {
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800825 .procname = "dmesg_restrict",
826 .data = &dmesg_restrict,
827 .maxlen = sizeof(int),
828 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700829 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800830 .extra1 = &zero,
831 .extra2 = &one,
832 },
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800833 {
834 .procname = "kptr_restrict",
835 .data = &kptr_restrict,
836 .maxlen = sizeof(int),
837 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700838 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800839 .extra1 = &zero,
840 .extra2 = &two,
841 },
Joe Perchesdf6e61d2010-11-15 21:17:27 -0800842#endif
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800843 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700844 .procname = "ngroups_max",
845 .data = &ngroups_max,
846 .maxlen = sizeof (int),
847 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800848 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700849 },
Dan Ballard73efc032011-10-31 17:11:20 -0700850 {
851 .procname = "cap_last_cap",
852 .data = (void *)&cap_last_cap,
853 .maxlen = sizeof(int),
854 .mode = 0444,
855 .proc_handler = proc_dointvec,
856 },
Don Zickus58687ac2010-05-07 17:11:44 -0400857#if defined(CONFIG_LOCKUP_DETECTOR)
Don Zickus504d7cf2010-02-12 17:19:19 -0500858 {
Don Zickus58687ac2010-05-07 17:11:44 -0400859 .procname = "watchdog",
Frederic Weisbecker3c00ea82013-05-19 20:45:15 +0200860 .data = &watchdog_user_enabled,
Don Zickus504d7cf2010-02-12 17:19:19 -0500861 .maxlen = sizeof (int),
862 .mode = 0644,
Ulrich Obergfell195daf62015-04-14 15:44:13 -0700863 .proc_handler = proc_watchdog,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700864 .extra1 = &zero,
865 .extra2 = &one,
Don Zickus58687ac2010-05-07 17:11:44 -0400866 },
867 {
868 .procname = "watchdog_thresh",
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700869 .data = &watchdog_thresh,
Don Zickus58687ac2010-05-07 17:11:44 -0400870 .maxlen = sizeof(int),
871 .mode = 0644,
Ulrich Obergfell195daf62015-04-14 15:44:13 -0700872 .proc_handler = proc_watchdog_thresh,
Li Zefana6572f82013-05-17 10:31:04 +0800873 .extra1 = &zero,
Don Zickus58687ac2010-05-07 17:11:44 -0400874 .extra2 = &sixty,
Don Zickus504d7cf2010-02-12 17:19:19 -0500875 },
Don Zickus2508ce12010-05-07 17:11:46 -0400876 {
Ulrich Obergfell195daf62015-04-14 15:44:13 -0700877 .procname = "nmi_watchdog",
878 .data = &nmi_watchdog_enabled,
879 .maxlen = sizeof (int),
880 .mode = 0644,
881 .proc_handler = proc_nmi_watchdog,
882 .extra1 = &zero,
883#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
884 .extra2 = &one,
885#else
886 .extra2 = &zero,
887#endif
888 },
889 {
890 .procname = "soft_watchdog",
891 .data = &soft_watchdog_enabled,
892 .maxlen = sizeof (int),
893 .mode = 0644,
894 .proc_handler = proc_soft_watchdog,
895 .extra1 = &zero,
896 .extra2 = &one,
897 },
898 {
Chris Metcalffe4ba3c2015-06-24 16:55:45 -0700899 .procname = "watchdog_cpumask",
900 .data = &watchdog_cpumask_bits,
901 .maxlen = NR_CPUS,
902 .mode = 0644,
903 .proc_handler = proc_watchdog_cpumask,
904 },
905 {
Don Zickus2508ce12010-05-07 17:11:46 -0400906 .procname = "softlockup_panic",
907 .data = &softlockup_panic,
908 .maxlen = sizeof(int),
909 .mode = 0644,
910 .proc_handler = proc_dointvec_minmax,
911 .extra1 = &zero,
912 .extra2 = &one,
913 },
Don Zickusac1f5912015-11-05 18:44:44 -0800914#ifdef CONFIG_HARDLOCKUP_DETECTOR
915 {
916 .procname = "hardlockup_panic",
917 .data = &hardlockup_panic,
918 .maxlen = sizeof(int),
919 .mode = 0644,
920 .proc_handler = proc_dointvec_minmax,
921 .extra1 = &zero,
922 .extra2 = &one,
923 },
924#endif
Aaron Tomlined235872014-06-23 13:22:05 -0700925#ifdef CONFIG_SMP
926 {
927 .procname = "softlockup_all_cpu_backtrace",
928 .data = &sysctl_softlockup_all_cpu_backtrace,
929 .maxlen = sizeof(int),
930 .mode = 0644,
931 .proc_handler = proc_dointvec_minmax,
932 .extra1 = &zero,
933 .extra2 = &one,
934 },
Jiri Kosina55537872015-11-05 18:44:41 -0800935 {
936 .procname = "hardlockup_all_cpu_backtrace",
937 .data = &sysctl_hardlockup_all_cpu_backtrace,
938 .maxlen = sizeof(int),
939 .mode = 0644,
940 .proc_handler = proc_dointvec_minmax,
941 .extra1 = &zero,
942 .extra2 = &one,
943 },
Aaron Tomlined235872014-06-23 13:22:05 -0700944#endif /* CONFIG_SMP */
Don Zickus5dc30552010-11-29 17:07:17 -0500945#endif
946#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
947 {
948 .procname = "unknown_nmi_panic",
949 .data = &unknown_nmi_panic,
950 .maxlen = sizeof (int),
951 .mode = 0644,
952 .proc_handler = proc_dointvec,
953 },
Don Zickus504d7cf2010-02-12 17:19:19 -0500954#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700955#if defined(CONFIG_X86)
956 {
Don Zickus8da5add2006-09-26 10:52:27 +0200957 .procname = "panic_on_unrecovered_nmi",
958 .data = &panic_on_unrecovered_nmi,
959 .maxlen = sizeof(int),
960 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800961 .proc_handler = proc_dointvec,
Don Zickus8da5add2006-09-26 10:52:27 +0200962 },
963 {
Kurt Garloff5211a242009-06-24 14:32:11 -0700964 .procname = "panic_on_io_nmi",
965 .data = &panic_on_io_nmi,
966 .maxlen = sizeof(int),
967 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800968 .proc_handler = proc_dointvec,
Kurt Garloff5211a242009-06-24 14:32:11 -0700969 },
Mitsuo Hayasaka55af7792011-11-29 15:08:36 +0900970#ifdef CONFIG_DEBUG_STACKOVERFLOW
971 {
972 .procname = "panic_on_stackoverflow",
973 .data = &sysctl_panic_on_stackoverflow,
974 .maxlen = sizeof(int),
975 .mode = 0644,
976 .proc_handler = proc_dointvec,
977 },
978#endif
Kurt Garloff5211a242009-06-24 14:32:11 -0700979 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700980 .procname = "bootloader_type",
981 .data = &bootloader_type,
982 .maxlen = sizeof (int),
983 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800984 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700985 },
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100986 {
H. Peter Anvin50312962009-05-07 16:54:11 -0700987 .procname = "bootloader_version",
988 .data = &bootloader_version,
989 .maxlen = sizeof (int),
990 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800991 .proc_handler = proc_dointvec,
H. Peter Anvin50312962009-05-07 16:54:11 -0700992 },
993 {
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100994 .procname = "kstack_depth_to_print",
995 .data = &kstack_depth_to_print,
996 .maxlen = sizeof(int),
997 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800998 .proc_handler = proc_dointvec,
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100999 },
Ingo Molnar6e7c4022008-01-30 13:30:05 +01001000 {
Ingo Molnar6e7c4022008-01-30 13:30:05 +01001001 .procname = "io_delay_type",
1002 .data = &io_delay_type,
1003 .maxlen = sizeof(int),
1004 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001005 .proc_handler = proc_dointvec,
Ingo Molnar6e7c4022008-01-30 13:30:05 +01001006 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001007#endif
Luke Yang7a9166e2006-02-20 18:28:07 -08001008#if defined(CONFIG_MMU)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001009 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001010 .procname = "randomize_va_space",
1011 .data = &randomize_va_space,
1012 .maxlen = sizeof(int),
1013 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001014 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001015 },
Luke Yang7a9166e2006-02-20 18:28:07 -08001016#endif
Martin Schwidefsky0152fb32006-01-14 13:21:00 -08001017#if defined(CONFIG_S390) && defined(CONFIG_SMP)
Martin Schwidefsky951f22d2005-07-27 11:44:57 -07001018 {
Martin Schwidefsky951f22d2005-07-27 11:44:57 -07001019 .procname = "spin_retry",
1020 .data = &spin_retry,
1021 .maxlen = sizeof (int),
1022 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001023 .proc_handler = proc_dointvec,
Martin Schwidefsky951f22d2005-07-27 11:44:57 -07001024 },
1025#endif
Len Brown673d5b42007-07-28 03:33:16 -04001026#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
Pavel Machekc255d842006-02-20 18:27:58 -08001027 {
Pavel Machekc255d842006-02-20 18:27:58 -08001028 .procname = "acpi_video_flags",
Pavel Machek77afcf72007-07-19 01:47:41 -07001029 .data = &acpi_realmode_flags,
Pavel Machekc255d842006-02-20 18:27:58 -08001030 .maxlen = sizeof (unsigned long),
1031 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001032 .proc_handler = proc_doulongvec_minmax,
Pavel Machekc255d842006-02-20 18:27:58 -08001033 },
1034#endif
Vineet Guptab6fca722013-01-09 20:06:28 +05301035#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
Jes Sorensend2b176e2006-02-28 09:42:23 -08001036 {
Jes Sorensend2b176e2006-02-28 09:42:23 -08001037 .procname = "ignore-unaligned-usertrap",
1038 .data = &no_unaligned_warning,
1039 .maxlen = sizeof (int),
1040 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001041 .proc_handler = proc_dointvec,
Jes Sorensend2b176e2006-02-28 09:42:23 -08001042 },
Vineet Guptab6fca722013-01-09 20:06:28 +05301043#endif
1044#ifdef CONFIG_IA64
Doug Chapman88fc2412009-01-15 10:38:56 -08001045 {
Doug Chapman88fc2412009-01-15 10:38:56 -08001046 .procname = "unaligned-dump-stack",
1047 .data = &unaligned_dump_stack,
1048 .maxlen = sizeof (int),
1049 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001050 .proc_handler = proc_dointvec,
Doug Chapman88fc2412009-01-15 10:38:56 -08001051 },
Jes Sorensend2b176e2006-02-28 09:42:23 -08001052#endif
Mandeep Singh Bainese162b392009-01-15 11:08:40 -08001053#ifdef CONFIG_DETECT_HUNG_TASK
1054 {
Mandeep Singh Bainese162b392009-01-15 11:08:40 -08001055 .procname = "hung_task_panic",
1056 .data = &sysctl_hung_task_panic,
1057 .maxlen = sizeof(int),
1058 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001059 .proc_handler = proc_dointvec_minmax,
Mandeep Singh Bainese162b392009-01-15 11:08:40 -08001060 .extra1 = &zero,
1061 .extra2 = &one,
1062 },
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001063 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001064 .procname = "hung_task_check_count",
1065 .data = &sysctl_hung_task_check_count,
Li Zefancd646472013-09-23 16:43:58 +08001066 .maxlen = sizeof(int),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001067 .mode = 0644,
Li Zefancd646472013-09-23 16:43:58 +08001068 .proc_handler = proc_dointvec_minmax,
1069 .extra1 = &zero,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001070 },
1071 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001072 .procname = "hung_task_timeout_secs",
1073 .data = &sysctl_hung_task_timeout_secs,
Ingo Molnar90739082008-01-25 21:08:34 +01001074 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001075 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001076 .proc_handler = proc_dohung_task_timeout_secs,
Liu Hua80df2842014-04-07 15:38:57 -07001077 .extra2 = &hung_task_timeout_max,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001078 },
1079 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001080 .procname = "hung_task_warnings",
1081 .data = &sysctl_hung_task_warnings,
Aaron Tomlin270750db2014-01-20 17:34:13 +00001082 .maxlen = sizeof(int),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001083 .mode = 0644,
Aaron Tomlin270750db2014-01-20 17:34:13 +00001084 .proc_handler = proc_dointvec_minmax,
1085 .extra1 = &neg_one,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001086 },
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -07001087#endif
Andi Kleenbebfa102006-06-26 13:56:52 +02001088#ifdef CONFIG_COMPAT
1089 {
Andi Kleenbebfa102006-06-26 13:56:52 +02001090 .procname = "compat-log",
1091 .data = &compat_log,
1092 .maxlen = sizeof (int),
1093 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001094 .proc_handler = proc_dointvec,
Andi Kleenbebfa102006-06-26 13:56:52 +02001095 },
1096#endif
Ingo Molnar23f78d4a2006-06-27 02:54:53 -07001097#ifdef CONFIG_RT_MUTEXES
1098 {
Ingo Molnar23f78d4a2006-06-27 02:54:53 -07001099 .procname = "max_lock_depth",
1100 .data = &max_lock_depth,
1101 .maxlen = sizeof(int),
1102 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001103 .proc_handler = proc_dointvec,
Ingo Molnar23f78d4a2006-06-27 02:54:53 -07001104 },
1105#endif
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -07001106 {
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -07001107 .procname = "poweroff_cmd",
1108 .data = &poweroff_cmd,
1109 .maxlen = POWEROFF_CMD_PATH_LEN,
1110 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001111 .proc_handler = proc_dostring,
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -07001112 },
David Howells0b77f5b2008-04-29 01:01:32 -07001113#ifdef CONFIG_KEYS
1114 {
David Howells0b77f5b2008-04-29 01:01:32 -07001115 .procname = "keys",
1116 .mode = 0555,
1117 .child = key_sysctls,
1118 },
1119#endif
Ingo Molnarcdd6c482009-09-21 12:02:48 +02001120#ifdef CONFIG_PERF_EVENTS
Vince Weaveraa4a2212011-06-03 17:54:40 -04001121 /*
1122 * User-space scripts rely on the existence of this file
1123 * as a feature check for perf_events being enabled.
1124 *
1125 * So it's an ABI, do not remove!
1126 */
Peter Zijlstra1ccd1542009-04-09 10:53:45 +02001127 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +02001128 .procname = "perf_event_paranoid",
1129 .data = &sysctl_perf_event_paranoid,
1130 .maxlen = sizeof(sysctl_perf_event_paranoid),
Peter Zijlstra1ccd1542009-04-09 10:53:45 +02001131 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001132 .proc_handler = proc_dointvec,
Peter Zijlstra1ccd1542009-04-09 10:53:45 +02001133 },
Peter Zijlstrac5078f72009-05-05 17:50:24 +02001134 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +02001135 .procname = "perf_event_mlock_kb",
1136 .data = &sysctl_perf_event_mlock,
1137 .maxlen = sizeof(sysctl_perf_event_mlock),
Peter Zijlstrac5078f72009-05-05 17:50:24 +02001138 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001139 .proc_handler = proc_dointvec,
Peter Zijlstrac5078f72009-05-05 17:50:24 +02001140 },
Peter Zijlstraa78ac322009-05-25 17:39:05 +02001141 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +02001142 .procname = "perf_event_max_sample_rate",
1143 .data = &sysctl_perf_event_sample_rate,
1144 .maxlen = sizeof(sysctl_perf_event_sample_rate),
Peter Zijlstraa78ac322009-05-25 17:39:05 +02001145 .mode = 0644,
Peter Zijlstra163ec432011-02-16 11:22:34 +01001146 .proc_handler = perf_proc_update_handler,
Knut Petersen723478c2013-09-25 14:29:37 +02001147 .extra1 = &one,
Peter Zijlstraa78ac322009-05-25 17:39:05 +02001148 },
Dave Hansen14c63f12013-06-21 08:51:36 -07001149 {
1150 .procname = "perf_cpu_time_max_percent",
1151 .data = &sysctl_perf_cpu_time_max_percent,
1152 .maxlen = sizeof(sysctl_perf_cpu_time_max_percent),
1153 .mode = 0644,
1154 .proc_handler = perf_cpu_time_max_percent_handler,
1155 .extra1 = &zero,
1156 .extra2 = &one_hundred,
1157 },
Arnaldo Carvalho de Meloc5dfd782016-04-21 12:28:50 -03001158 {
1159 .procname = "perf_event_max_stack",
Arnaldo Carvalho de Meloa8311002016-05-10 16:34:53 -03001160 .data = &sysctl_perf_event_max_stack,
Arnaldo Carvalho de Meloc5dfd782016-04-21 12:28:50 -03001161 .maxlen = sizeof(sysctl_perf_event_max_stack),
1162 .mode = 0644,
1163 .proc_handler = perf_event_max_stack_handler,
1164 .extra1 = &zero,
1165 .extra2 = &six_hundred_forty_kb,
1166 },
Arnaldo Carvalho de Meloc85b0332016-05-12 13:06:21 -03001167 {
1168 .procname = "perf_event_max_contexts_per_stack",
1169 .data = &sysctl_perf_event_max_contexts_per_stack,
1170 .maxlen = sizeof(sysctl_perf_event_max_contexts_per_stack),
1171 .mode = 0644,
1172 .proc_handler = perf_event_max_stack_handler,
1173 .extra1 = &zero,
1174 .extra2 = &one_thousand,
1175 },
Peter Zijlstra1ccd1542009-04-09 10:53:45 +02001176#endif
Vegard Nossumdfec0722008-04-04 00:51:41 +02001177#ifdef CONFIG_KMEMCHECK
1178 {
Vegard Nossumdfec0722008-04-04 00:51:41 +02001179 .procname = "kmemcheck",
1180 .data = &kmemcheck_enabled,
1181 .maxlen = sizeof(int),
1182 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001183 .proc_handler = proc_dointvec,
Vegard Nossumdfec0722008-04-04 00:51:41 +02001184 },
1185#endif
Prarit Bhargava9e3961a2014-12-10 15:45:50 -08001186 {
1187 .procname = "panic_on_warn",
1188 .data = &panic_on_warn,
1189 .maxlen = sizeof(int),
1190 .mode = 0644,
1191 .proc_handler = proc_dointvec_minmax,
1192 .extra1 = &zero,
1193 .extra2 = &one,
1194 },
Thomas Gleixnerbc7a34b2015-05-26 22:50:33 +00001195#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
1196 {
1197 .procname = "timer_migration",
1198 .data = &sysctl_timer_migration,
1199 .maxlen = sizeof(unsigned int),
1200 .mode = 0644,
1201 .proc_handler = timer_migration_handler,
1202 },
1203#endif
Alexei Starovoitov1be7f752015-10-07 22:23:21 -07001204#ifdef CONFIG_BPF_SYSCALL
1205 {
1206 .procname = "unprivileged_bpf_disabled",
1207 .data = &sysctl_unprivileged_bpf_disabled,
1208 .maxlen = sizeof(sysctl_unprivileged_bpf_disabled),
1209 .mode = 0644,
1210 /* only handle a transition from default "0" to "1" */
1211 .proc_handler = proc_dointvec_minmax,
1212 .extra1 = &one,
1213 .extra2 = &one,
1214 },
1215#endif
Daniel Bristot de Oliveira088e9d22016-06-02 13:51:41 -03001216#if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU)
1217 {
1218 .procname = "panic_on_rcu_stall",
1219 .data = &sysctl_panic_on_rcu_stall,
1220 .maxlen = sizeof(sysctl_panic_on_rcu_stall),
1221 .mode = 0644,
1222 .proc_handler = proc_dointvec_minmax,
1223 .extra1 = &zero,
1224 .extra2 = &one,
1225 },
1226#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001227 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001228};
1229
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001230static struct ctl_table vm_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001231 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001232 .procname = "overcommit_memory",
1233 .data = &sysctl_overcommit_memory,
1234 .maxlen = sizeof(sysctl_overcommit_memory),
1235 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001236 .proc_handler = proc_dointvec_minmax,
1237 .extra1 = &zero,
1238 .extra2 = &two,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001239 },
1240 {
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001241 .procname = "panic_on_oom",
1242 .data = &sysctl_panic_on_oom,
1243 .maxlen = sizeof(sysctl_panic_on_oom),
1244 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001245 .proc_handler = proc_dointvec_minmax,
1246 .extra1 = &zero,
1247 .extra2 = &two,
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001248 },
1249 {
David Rientjesfe071d72007-10-16 23:25:56 -07001250 .procname = "oom_kill_allocating_task",
1251 .data = &sysctl_oom_kill_allocating_task,
1252 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1253 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001254 .proc_handler = proc_dointvec,
David Rientjesfe071d72007-10-16 23:25:56 -07001255 },
1256 {
David Rientjesfef1bdd2008-02-07 00:14:07 -08001257 .procname = "oom_dump_tasks",
1258 .data = &sysctl_oom_dump_tasks,
1259 .maxlen = sizeof(sysctl_oom_dump_tasks),
1260 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001261 .proc_handler = proc_dointvec,
David Rientjesfef1bdd2008-02-07 00:14:07 -08001262 },
1263 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001264 .procname = "overcommit_ratio",
1265 .data = &sysctl_overcommit_ratio,
1266 .maxlen = sizeof(sysctl_overcommit_ratio),
1267 .mode = 0644,
Jerome Marchand49f0ce52014-01-21 15:49:14 -08001268 .proc_handler = overcommit_ratio_handler,
1269 },
1270 {
1271 .procname = "overcommit_kbytes",
1272 .data = &sysctl_overcommit_kbytes,
1273 .maxlen = sizeof(sysctl_overcommit_kbytes),
1274 .mode = 0644,
1275 .proc_handler = overcommit_kbytes_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001276 },
1277 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001278 .procname = "page-cluster",
1279 .data = &page_cluster,
1280 .maxlen = sizeof(int),
1281 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001282 .proc_handler = proc_dointvec_minmax,
1283 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001284 },
1285 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001286 .procname = "dirty_background_ratio",
1287 .data = &dirty_background_ratio,
1288 .maxlen = sizeof(dirty_background_ratio),
1289 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001290 .proc_handler = dirty_background_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001291 .extra1 = &zero,
1292 .extra2 = &one_hundred,
1293 },
1294 {
David Rientjes2da02992009-01-06 14:39:31 -08001295 .procname = "dirty_background_bytes",
1296 .data = &dirty_background_bytes,
1297 .maxlen = sizeof(dirty_background_bytes),
1298 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001299 .proc_handler = dirty_background_bytes_handler,
Sven Wegenerfc3501d2009-02-11 13:04:23 -08001300 .extra1 = &one_ul,
David Rientjes2da02992009-01-06 14:39:31 -08001301 },
1302 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001303 .procname = "dirty_ratio",
1304 .data = &vm_dirty_ratio,
1305 .maxlen = sizeof(vm_dirty_ratio),
1306 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001307 .proc_handler = dirty_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001308 .extra1 = &zero,
1309 .extra2 = &one_hundred,
1310 },
1311 {
David Rientjes2da02992009-01-06 14:39:31 -08001312 .procname = "dirty_bytes",
1313 .data = &vm_dirty_bytes,
1314 .maxlen = sizeof(vm_dirty_bytes),
1315 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001316 .proc_handler = dirty_bytes_handler,
Andrea Righi9e4a5bd2009-04-30 15:08:57 -07001317 .extra1 = &dirty_bytes_min,
David Rientjes2da02992009-01-06 14:39:31 -08001318 },
1319 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001320 .procname = "dirty_writeback_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001321 .data = &dirty_writeback_interval,
1322 .maxlen = sizeof(dirty_writeback_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001323 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001324 .proc_handler = dirty_writeback_centisecs_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001325 },
1326 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001327 .procname = "dirty_expire_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001328 .data = &dirty_expire_interval,
1329 .maxlen = sizeof(dirty_expire_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001330 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001331 .proc_handler = proc_dointvec_minmax,
1332 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001333 },
1334 {
Theodore Ts'o1efff912015-03-17 12:23:32 -04001335 .procname = "dirtytime_expire_seconds",
1336 .data = &dirtytime_expire_interval,
1337 .maxlen = sizeof(dirty_expire_interval),
1338 .mode = 0644,
1339 .proc_handler = dirtytime_interval_handler,
1340 .extra1 = &zero,
1341 },
1342 {
Wanpeng Li3965c9a2012-07-31 16:41:52 -07001343 .procname = "nr_pdflush_threads",
1344 .mode = 0444 /* read-only */,
1345 .proc_handler = pdflush_proc_obsolete,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001346 },
1347 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001348 .procname = "swappiness",
1349 .data = &vm_swappiness,
1350 .maxlen = sizeof(vm_swappiness),
1351 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001352 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001353 .extra1 = &zero,
1354 .extra2 = &one_hundred,
1355 },
1356#ifdef CONFIG_HUGETLB_PAGE
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001357 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001358 .procname = "nr_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001359 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001360 .maxlen = sizeof(unsigned long),
1361 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001362 .proc_handler = hugetlb_sysctl_handler,
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001363 },
1364#ifdef CONFIG_NUMA
1365 {
1366 .procname = "nr_hugepages_mempolicy",
1367 .data = NULL,
1368 .maxlen = sizeof(unsigned long),
1369 .mode = 0644,
1370 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001371 },
1372#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001373 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001374 .procname = "hugetlb_shm_group",
1375 .data = &sysctl_hugetlb_shm_group,
1376 .maxlen = sizeof(gid_t),
1377 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001378 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001379 },
Mel Gorman396faf02007-07-17 04:03:13 -07001380 {
Mel Gorman396faf02007-07-17 04:03:13 -07001381 .procname = "hugepages_treat_as_movable",
1382 .data = &hugepages_treat_as_movable,
1383 .maxlen = sizeof(int),
1384 .mode = 0644,
Naoya Horiguchi86cdb462013-09-11 14:22:13 -07001385 .proc_handler = proc_dointvec,
Mel Gorman396faf02007-07-17 04:03:13 -07001386 },
Adam Litke54f9f802007-10-16 01:26:20 -07001387 {
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001388 .procname = "nr_overcommit_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001389 .data = NULL,
1390 .maxlen = sizeof(unsigned long),
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001391 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001392 .proc_handler = hugetlb_overcommit_handler,
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001393 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001394#endif
1395 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001396 .procname = "lowmem_reserve_ratio",
1397 .data = &sysctl_lowmem_reserve_ratio,
1398 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1399 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001400 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001401 },
1402 {
Andrew Morton9d0243b2006-01-08 01:00:39 -08001403 .procname = "drop_caches",
1404 .data = &sysctl_drop_caches,
1405 .maxlen = sizeof(int),
1406 .mode = 0644,
1407 .proc_handler = drop_caches_sysctl_handler,
Petr Holasekcb16e952011-03-23 16:43:09 -07001408 .extra1 = &one,
Dave Hansen5509a5d2014-04-03 14:48:19 -07001409 .extra2 = &four,
Andrew Morton9d0243b2006-01-08 01:00:39 -08001410 },
Mel Gorman76ab0f52010-05-24 14:32:28 -07001411#ifdef CONFIG_COMPACTION
1412 {
1413 .procname = "compact_memory",
1414 .data = &sysctl_compact_memory,
1415 .maxlen = sizeof(int),
1416 .mode = 0200,
1417 .proc_handler = sysctl_compaction_handler,
1418 },
Mel Gorman5e771902010-05-24 14:32:31 -07001419 {
1420 .procname = "extfrag_threshold",
1421 .data = &sysctl_extfrag_threshold,
1422 .maxlen = sizeof(int),
1423 .mode = 0644,
1424 .proc_handler = sysctl_extfrag_handler,
1425 .extra1 = &min_extfrag_threshold,
1426 .extra2 = &max_extfrag_threshold,
1427 },
Eric B Munson5bbe3542015-04-15 16:13:20 -07001428 {
1429 .procname = "compact_unevictable_allowed",
1430 .data = &sysctl_compact_unevictable_allowed,
1431 .maxlen = sizeof(int),
1432 .mode = 0644,
1433 .proc_handler = proc_dointvec,
1434 .extra1 = &zero,
1435 .extra2 = &one,
1436 },
Mel Gorman5e771902010-05-24 14:32:31 -07001437
Mel Gorman76ab0f52010-05-24 14:32:28 -07001438#endif /* CONFIG_COMPACTION */
Andrew Morton9d0243b2006-01-08 01:00:39 -08001439 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001440 .procname = "min_free_kbytes",
1441 .data = &min_free_kbytes,
1442 .maxlen = sizeof(min_free_kbytes),
1443 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001444 .proc_handler = min_free_kbytes_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001445 .extra1 = &zero,
1446 },
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001447 {
Johannes Weiner795ae7a2016-03-17 14:19:14 -07001448 .procname = "watermark_scale_factor",
1449 .data = &watermark_scale_factor,
1450 .maxlen = sizeof(watermark_scale_factor),
1451 .mode = 0644,
1452 .proc_handler = watermark_scale_factor_sysctl_handler,
1453 .extra1 = &one,
1454 .extra2 = &one_thousand,
1455 },
1456 {
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001457 .procname = "percpu_pagelist_fraction",
1458 .data = &percpu_pagelist_fraction,
1459 .maxlen = sizeof(percpu_pagelist_fraction),
1460 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001461 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
David Rientjes7cd2b0a2014-06-23 13:22:04 -07001462 .extra1 = &zero,
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001463 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001464#ifdef CONFIG_MMU
1465 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001466 .procname = "max_map_count",
1467 .data = &sysctl_max_map_count,
1468 .maxlen = sizeof(sysctl_max_map_count),
1469 .mode = 0644,
WANG Cong3e261202009-12-17 15:27:05 -08001470 .proc_handler = proc_dointvec_minmax,
Amerigo Wang70da2342009-12-14 17:59:52 -08001471 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001472 },
Paul Mundtdd8632a2009-01-08 12:04:47 +00001473#else
1474 {
Paul Mundtdd8632a2009-01-08 12:04:47 +00001475 .procname = "nr_trim_pages",
1476 .data = &sysctl_nr_trim_pages,
1477 .maxlen = sizeof(sysctl_nr_trim_pages),
1478 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001479 .proc_handler = proc_dointvec_minmax,
Paul Mundtdd8632a2009-01-08 12:04:47 +00001480 .extra1 = &zero,
1481 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001482#endif
1483 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001484 .procname = "laptop_mode",
1485 .data = &laptop_mode,
1486 .maxlen = sizeof(laptop_mode),
1487 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001488 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001489 },
1490 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001491 .procname = "block_dump",
1492 .data = &block_dump,
1493 .maxlen = sizeof(block_dump),
1494 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001495 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001496 .extra1 = &zero,
1497 },
1498 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001499 .procname = "vfs_cache_pressure",
1500 .data = &sysctl_vfs_cache_pressure,
1501 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1502 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001503 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001504 .extra1 = &zero,
1505 },
1506#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1507 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001508 .procname = "legacy_va_layout",
1509 .data = &sysctl_legacy_va_layout,
1510 .maxlen = sizeof(sysctl_legacy_va_layout),
1511 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001512 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001513 .extra1 = &zero,
1514 },
1515#endif
Christoph Lameter17436602006-01-18 17:42:32 -08001516#ifdef CONFIG_NUMA
1517 {
Christoph Lameter17436602006-01-18 17:42:32 -08001518 .procname = "zone_reclaim_mode",
Mel Gormana5f5f912016-07-28 15:46:32 -07001519 .data = &node_reclaim_mode,
1520 .maxlen = sizeof(node_reclaim_mode),
Christoph Lameter17436602006-01-18 17:42:32 -08001521 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001522 .proc_handler = proc_dointvec,
Christoph Lameterc84db232006-02-01 03:05:29 -08001523 .extra1 = &zero,
Christoph Lameter17436602006-01-18 17:42:32 -08001524 },
Christoph Lameter96146342006-07-03 00:24:13 -07001525 {
Christoph Lameter96146342006-07-03 00:24:13 -07001526 .procname = "min_unmapped_ratio",
1527 .data = &sysctl_min_unmapped_ratio,
1528 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1529 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001530 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
Christoph Lameter96146342006-07-03 00:24:13 -07001531 .extra1 = &zero,
1532 .extra2 = &one_hundred,
1533 },
Christoph Lameter0ff38492006-09-25 23:31:52 -07001534 {
Christoph Lameter0ff38492006-09-25 23:31:52 -07001535 .procname = "min_slab_ratio",
1536 .data = &sysctl_min_slab_ratio,
1537 .maxlen = sizeof(sysctl_min_slab_ratio),
1538 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001539 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
Christoph Lameter0ff38492006-09-25 23:31:52 -07001540 .extra1 = &zero,
1541 .extra2 = &one_hundred,
1542 },
Christoph Lameter17436602006-01-18 17:42:32 -08001543#endif
Christoph Lameter77461ab2007-05-09 02:35:13 -07001544#ifdef CONFIG_SMP
1545 {
Christoph Lameter77461ab2007-05-09 02:35:13 -07001546 .procname = "stat_interval",
1547 .data = &sysctl_stat_interval,
1548 .maxlen = sizeof(sysctl_stat_interval),
1549 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001550 .proc_handler = proc_dointvec_jiffies,
Christoph Lameter77461ab2007-05-09 02:35:13 -07001551 },
Hugh Dickins52b6f462016-05-19 17:12:50 -07001552 {
1553 .procname = "stat_refresh",
1554 .data = NULL,
1555 .maxlen = 0,
1556 .mode = 0600,
1557 .proc_handler = vmstat_refresh,
1558 },
Christoph Lameter77461ab2007-05-09 02:35:13 -07001559#endif
David Howells6e141542009-12-15 19:27:45 +00001560#ifdef CONFIG_MMU
Eric Parised032182007-06-28 15:55:21 -04001561 {
Eric Parised032182007-06-28 15:55:21 -04001562 .procname = "mmap_min_addr",
Eric Paris788084a2009-07-31 12:54:11 -04001563 .data = &dac_mmap_min_addr,
1564 .maxlen = sizeof(unsigned long),
Eric Parised032182007-06-28 15:55:21 -04001565 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001566 .proc_handler = mmap_min_addr_handler,
Eric Parised032182007-06-28 15:55:21 -04001567 },
David Howells6e141542009-12-15 19:27:45 +00001568#endif
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001569#ifdef CONFIG_NUMA
1570 {
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001571 .procname = "numa_zonelist_order",
1572 .data = &numa_zonelist_order,
1573 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1574 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001575 .proc_handler = numa_zonelist_order_handler,
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001576 },
1577#endif
Al Viro2b8232c2007-10-13 08:16:04 +01001578#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
Paul Mundt5c36e652007-03-01 10:07:42 +09001579 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
Ingo Molnare6e54942006-06-27 02:53:50 -07001580 {
Ingo Molnare6e54942006-06-27 02:53:50 -07001581 .procname = "vdso_enabled",
Andy Lutomirski3d7ee962014-05-05 12:19:32 -07001582#ifdef CONFIG_X86_32
1583 .data = &vdso32_enabled,
1584 .maxlen = sizeof(vdso32_enabled),
1585#else
Ingo Molnare6e54942006-06-27 02:53:50 -07001586 .data = &vdso_enabled,
1587 .maxlen = sizeof(vdso_enabled),
Andy Lutomirski3d7ee962014-05-05 12:19:32 -07001588#endif
Ingo Molnare6e54942006-06-27 02:53:50 -07001589 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001590 .proc_handler = proc_dointvec,
Ingo Molnare6e54942006-06-27 02:53:50 -07001591 .extra1 = &zero,
1592 },
1593#endif
Bron Gondwana195cf4532008-02-04 22:29:20 -08001594#ifdef CONFIG_HIGHMEM
1595 {
Bron Gondwana195cf4532008-02-04 22:29:20 -08001596 .procname = "highmem_is_dirtyable",
1597 .data = &vm_highmem_is_dirtyable,
1598 .maxlen = sizeof(vm_highmem_is_dirtyable),
1599 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001600 .proc_handler = proc_dointvec_minmax,
Bron Gondwana195cf4532008-02-04 22:29:20 -08001601 .extra1 = &zero,
1602 .extra2 = &one,
1603 },
1604#endif
Andi Kleen6a460792009-09-16 11:50:15 +02001605#ifdef CONFIG_MEMORY_FAILURE
1606 {
Andi Kleen6a460792009-09-16 11:50:15 +02001607 .procname = "memory_failure_early_kill",
1608 .data = &sysctl_memory_failure_early_kill,
1609 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1610 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001611 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001612 .extra1 = &zero,
1613 .extra2 = &one,
1614 },
1615 {
Andi Kleen6a460792009-09-16 11:50:15 +02001616 .procname = "memory_failure_recovery",
1617 .data = &sysctl_memory_failure_recovery,
1618 .maxlen = sizeof(sysctl_memory_failure_recovery),
1619 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001620 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001621 .extra1 = &zero,
1622 .extra2 = &one,
1623 },
1624#endif
Andrew Shewmakerc9b1d092013-04-29 15:08:10 -07001625 {
1626 .procname = "user_reserve_kbytes",
1627 .data = &sysctl_user_reserve_kbytes,
1628 .maxlen = sizeof(sysctl_user_reserve_kbytes),
1629 .mode = 0644,
1630 .proc_handler = proc_doulongvec_minmax,
1631 },
Andrew Shewmaker4eeab4f2013-04-29 15:08:11 -07001632 {
1633 .procname = "admin_reserve_kbytes",
1634 .data = &sysctl_admin_reserve_kbytes,
1635 .maxlen = sizeof(sysctl_admin_reserve_kbytes),
1636 .mode = 0644,
1637 .proc_handler = proc_doulongvec_minmax,
1638 },
Daniel Cashmand07e2252016-01-14 15:19:53 -08001639#ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
1640 {
1641 .procname = "mmap_rnd_bits",
1642 .data = &mmap_rnd_bits,
1643 .maxlen = sizeof(mmap_rnd_bits),
1644 .mode = 0600,
1645 .proc_handler = proc_dointvec_minmax,
1646 .extra1 = (void *)&mmap_rnd_bits_min,
1647 .extra2 = (void *)&mmap_rnd_bits_max,
1648 },
1649#endif
1650#ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS
1651 {
1652 .procname = "mmap_rnd_compat_bits",
1653 .data = &mmap_rnd_compat_bits,
1654 .maxlen = sizeof(mmap_rnd_compat_bits),
1655 .mode = 0600,
1656 .proc_handler = proc_dointvec_minmax,
1657 .extra1 = (void *)&mmap_rnd_compat_bits_min,
1658 .extra2 = (void *)&mmap_rnd_compat_bits_max,
1659 },
1660#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001661 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001662};
1663
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001664static struct ctl_table fs_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001665 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001666 .procname = "inode-nr",
1667 .data = &inodes_stat,
Glauber Costa3942c072013-08-28 10:17:53 +10001668 .maxlen = 2*sizeof(long),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001669 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001670 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001671 },
1672 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001673 .procname = "inode-state",
1674 .data = &inodes_stat,
Glauber Costa3942c072013-08-28 10:17:53 +10001675 .maxlen = 7*sizeof(long),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001676 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001677 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001678 },
1679 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001680 .procname = "file-nr",
1681 .data = &files_stat,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001682 .maxlen = sizeof(files_stat),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001683 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001684 .proc_handler = proc_nr_files,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001685 },
1686 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001687 .procname = "file-max",
1688 .data = &files_stat.max_files,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001689 .maxlen = sizeof(files_stat.max_files),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001690 .mode = 0644,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001691 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001692 },
1693 {
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001694 .procname = "nr_open",
1695 .data = &sysctl_nr_open,
1696 .maxlen = sizeof(int),
1697 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001698 .proc_handler = proc_dointvec_minmax,
Al Viroeceea0b2008-05-10 10:08:32 -04001699 .extra1 = &sysctl_nr_open_min,
1700 .extra2 = &sysctl_nr_open_max,
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001701 },
1702 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001703 .procname = "dentry-state",
1704 .data = &dentry_stat,
Glauber Costa3942c072013-08-28 10:17:53 +10001705 .maxlen = 6*sizeof(long),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001706 .mode = 0444,
Christoph Hellwig312d3ca2010-10-10 05:36:23 -04001707 .proc_handler = proc_nr_dentry,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001708 },
1709 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001710 .procname = "overflowuid",
1711 .data = &fs_overflowuid,
1712 .maxlen = sizeof(int),
1713 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001714 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001715 .extra1 = &minolduid,
1716 .extra2 = &maxolduid,
1717 },
1718 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001719 .procname = "overflowgid",
1720 .data = &fs_overflowgid,
1721 .maxlen = sizeof(int),
1722 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001723 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001724 .extra1 = &minolduid,
1725 .extra2 = &maxolduid,
1726 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001727#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001728 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001729 .procname = "leases-enable",
1730 .data = &leases_enable,
1731 .maxlen = sizeof(int),
1732 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001733 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001734 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001735#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001736#ifdef CONFIG_DNOTIFY
1737 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001738 .procname = "dir-notify-enable",
1739 .data = &dir_notify_enable,
1740 .maxlen = sizeof(int),
1741 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001742 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001743 },
1744#endif
1745#ifdef CONFIG_MMU
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001746#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001747 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001748 .procname = "lease-break-time",
1749 .data = &lease_break_time,
1750 .maxlen = sizeof(int),
1751 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001752 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001753 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001754#endif
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001755#ifdef CONFIG_AIO
Linus Torvalds1da177e2005-04-16 15:20:36 -07001756 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001757 .procname = "aio-nr",
1758 .data = &aio_nr,
1759 .maxlen = sizeof(aio_nr),
1760 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001761 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001762 },
1763 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001764 .procname = "aio-max-nr",
1765 .data = &aio_max_nr,
1766 .maxlen = sizeof(aio_max_nr),
1767 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001768 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001769 },
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001770#endif /* CONFIG_AIO */
Amy Griffis2d9048e2006-06-01 13:10:59 -07001771#ifdef CONFIG_INOTIFY_USER
Robert Love0399cb02005-07-13 12:38:18 -04001772 {
Robert Love0399cb02005-07-13 12:38:18 -04001773 .procname = "inotify",
1774 .mode = 0555,
1775 .child = inotify_table,
1776 },
1777#endif
Davide Libenzi7ef99642008-12-01 13:13:55 -08001778#ifdef CONFIG_EPOLL
1779 {
1780 .procname = "epoll",
1781 .mode = 0555,
1782 .child = epoll_table,
1783 },
1784#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001785#endif
Alan Coxd6e71142005-06-23 00:09:43 -07001786 {
Kees Cook800179c2012-07-25 17:29:07 -07001787 .procname = "protected_symlinks",
1788 .data = &sysctl_protected_symlinks,
1789 .maxlen = sizeof(int),
1790 .mode = 0600,
1791 .proc_handler = proc_dointvec_minmax,
1792 .extra1 = &zero,
1793 .extra2 = &one,
1794 },
1795 {
1796 .procname = "protected_hardlinks",
1797 .data = &sysctl_protected_hardlinks,
1798 .maxlen = sizeof(int),
1799 .mode = 0600,
1800 .proc_handler = proc_dointvec_minmax,
1801 .extra1 = &zero,
1802 .extra2 = &one,
1803 },
1804 {
Alan Coxd6e71142005-06-23 00:09:43 -07001805 .procname = "suid_dumpable",
1806 .data = &suid_dumpable,
1807 .maxlen = sizeof(int),
1808 .mode = 0644,
Kees Cook54b50192012-07-30 14:39:18 -07001809 .proc_handler = proc_dointvec_minmax_coredump,
Matthew Wilcox8e654fb2009-04-02 16:58:33 -07001810 .extra1 = &zero,
1811 .extra2 = &two,
Alan Coxd6e71142005-06-23 00:09:43 -07001812 },
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001813#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1814 {
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001815 .procname = "binfmt_misc",
1816 .mode = 0555,
Eric W. Biedermanf9bd6732015-05-09 22:09:14 -05001817 .child = sysctl_mount_point,
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001818 },
1819#endif
Jens Axboeb492e952010-05-19 21:03:16 +02001820 {
Jens Axboeff9da692010-06-03 14:54:39 +02001821 .procname = "pipe-max-size",
1822 .data = &pipe_max_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001823 .maxlen = sizeof(int),
1824 .mode = 0644,
Jens Axboeff9da692010-06-03 14:54:39 +02001825 .proc_handler = &pipe_proc_fn,
1826 .extra1 = &pipe_min_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001827 },
Willy Tarreau759c0112016-01-18 16:36:09 +01001828 {
1829 .procname = "pipe-user-pages-hard",
1830 .data = &pipe_user_pages_hard,
1831 .maxlen = sizeof(pipe_user_pages_hard),
1832 .mode = 0644,
1833 .proc_handler = proc_doulongvec_minmax,
1834 },
1835 {
1836 .procname = "pipe-user-pages-soft",
1837 .data = &pipe_user_pages_soft,
1838 .maxlen = sizeof(pipe_user_pages_soft),
1839 .mode = 0644,
1840 .proc_handler = proc_doulongvec_minmax,
1841 },
Eric W. Biedermand2921682016-09-28 00:27:17 -05001842 {
1843 .procname = "mount-max",
1844 .data = &sysctl_mount_max,
1845 .maxlen = sizeof(unsigned int),
1846 .mode = 0644,
1847 .proc_handler = proc_dointvec_minmax,
1848 .extra1 = &one,
1849 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001850 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001851};
1852
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001853static struct ctl_table debug_table[] = {
Catalin Marinas7ac57a82012-10-08 16:28:16 -07001854#ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001855 {
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001856 .procname = "exception-trace",
1857 .data = &show_unhandled_signals,
1858 .maxlen = sizeof(int),
1859 .mode = 0644,
1860 .proc_handler = proc_dointvec
1861 },
1862#endif
Masami Hiramatsub2be84d2010-02-25 08:34:15 -05001863#if defined(CONFIG_OPTPROBES)
1864 {
1865 .procname = "kprobes-optimization",
1866 .data = &sysctl_kprobes_optimization,
1867 .maxlen = sizeof(int),
1868 .mode = 0644,
1869 .proc_handler = proc_kprobes_optimization_handler,
1870 .extra1 = &zero,
1871 .extra2 = &one,
1872 },
1873#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001874 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001875};
1876
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001877static struct ctl_table dev_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001878 { }
Robert Love0eeca282005-07-12 17:06:03 -04001879};
Linus Torvalds1da177e2005-04-16 15:20:36 -07001880
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001881int __init sysctl_init(void)
Al Viro330d57f2005-11-04 10:18:40 +00001882{
Steven Rostedtfd4b6162012-07-30 14:42:48 -07001883 struct ctl_table_header *hdr;
1884
1885 hdr = register_sysctl_table(sysctl_base_table);
1886 kmemleak_not_leak(hdr);
Eric W. Biedermand912b0c2007-02-14 00:34:13 -08001887 return 0;
1888}
1889
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001890#endif /* CONFIG_SYSCTL */
1891
Linus Torvalds1da177e2005-04-16 15:20:36 -07001892/*
1893 * /proc/sys support
1894 */
1895
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001896#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -07001897
Kees Cookf8808302014-06-06 14:37:17 -07001898static int _proc_do_string(char *data, int maxlen, int write,
1899 char __user *buffer,
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001900 size_t *lenp, loff_t *ppos)
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001901{
1902 size_t len;
1903 char __user *p;
1904 char c;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001905
1906 if (!data || !maxlen || !*lenp) {
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001907 *lenp = 0;
1908 return 0;
1909 }
Oleg Nesterov8d060872007-02-10 01:46:38 -08001910
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001911 if (write) {
Kees Cookf4aacea2014-06-06 14:37:19 -07001912 if (sysctl_writes_strict == SYSCTL_WRITES_STRICT) {
1913 /* Only continue writes not past the end of buffer. */
1914 len = strlen(data);
1915 if (len > maxlen - 1)
1916 len = maxlen - 1;
1917
1918 if (*ppos > len)
1919 return 0;
1920 len = *ppos;
1921 } else {
1922 /* Start writing from beginning of buffer. */
1923 len = 0;
1924 }
1925
Kees Cook2ca9bb42014-06-06 14:37:18 -07001926 *ppos += *lenp;
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001927 p = buffer;
Kees Cook2ca9bb42014-06-06 14:37:18 -07001928 while ((p - buffer) < *lenp && len < maxlen - 1) {
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001929 if (get_user(c, p++))
1930 return -EFAULT;
1931 if (c == 0 || c == '\n')
1932 break;
Kees Cook2ca9bb42014-06-06 14:37:18 -07001933 data[len++] = c;
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001934 }
Kees Cookf8808302014-06-06 14:37:17 -07001935 data[len] = 0;
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001936 } else {
1937 len = strlen(data);
1938 if (len > maxlen)
1939 len = maxlen;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001940
1941 if (*ppos > len) {
1942 *lenp = 0;
1943 return 0;
1944 }
1945
1946 data += *ppos;
1947 len -= *ppos;
1948
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001949 if (len > *lenp)
1950 len = *lenp;
1951 if (len)
Kees Cookf8808302014-06-06 14:37:17 -07001952 if (copy_to_user(buffer, data, len))
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001953 return -EFAULT;
1954 if (len < *lenp) {
Kees Cookf8808302014-06-06 14:37:17 -07001955 if (put_user('\n', buffer + len))
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001956 return -EFAULT;
1957 len++;
1958 }
1959 *lenp = len;
1960 *ppos += len;
1961 }
1962 return 0;
1963}
1964
Kees Cookf4aacea2014-06-06 14:37:19 -07001965static void warn_sysctl_write(struct ctl_table *table)
1966{
1967 pr_warn_once("%s wrote to %s when file position was not 0!\n"
1968 "This will not be supported in the future. To silence this\n"
1969 "warning, set kernel.sysctl_writes_strict = -1\n",
1970 current->comm, table->procname);
1971}
1972
Linus Torvalds1da177e2005-04-16 15:20:36 -07001973/**
1974 * proc_dostring - read a string sysctl
1975 * @table: the sysctl table
1976 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001977 * @buffer: the user buffer
1978 * @lenp: the size of the user buffer
1979 * @ppos: file position
1980 *
1981 * Reads/writes a string from/to the user buffer. If the kernel
1982 * buffer provided is not large enough to hold the string, the
1983 * string is truncated. The copied string is %NULL-terminated.
1984 * If the string is being read by the user process, it is copied
1985 * and a newline '\n' is added. It is truncated if the buffer is
1986 * not large enough.
1987 *
1988 * Returns 0 on success.
1989 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001990int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001991 void __user *buffer, size_t *lenp, loff_t *ppos)
1992{
Kees Cookf4aacea2014-06-06 14:37:19 -07001993 if (write && *ppos && sysctl_writes_strict == SYSCTL_WRITES_WARN)
1994 warn_sysctl_write(table);
1995
Kees Cookf8808302014-06-06 14:37:17 -07001996 return _proc_do_string((char *)(table->data), table->maxlen, write,
1997 (char __user *)buffer, lenp, ppos);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001998}
1999
Amerigo Wang00b7c332010-05-05 00:26:45 +00002000static size_t proc_skip_spaces(char **buf)
2001{
2002 size_t ret;
2003 char *tmp = skip_spaces(*buf);
2004 ret = tmp - *buf;
2005 *buf = tmp;
2006 return ret;
2007}
Linus Torvalds1da177e2005-04-16 15:20:36 -07002008
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002009static void proc_skip_char(char **buf, size_t *size, const char v)
2010{
2011 while (*size) {
2012 if (**buf != v)
2013 break;
2014 (*size)--;
2015 (*buf)++;
2016 }
2017}
2018
Amerigo Wang00b7c332010-05-05 00:26:45 +00002019#define TMPBUFLEN 22
2020/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07002021 * proc_get_long - reads an ASCII formatted integer from a user buffer
Amerigo Wang00b7c332010-05-05 00:26:45 +00002022 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07002023 * @buf: a kernel buffer
2024 * @size: size of the kernel buffer
2025 * @val: this is where the number will be stored
2026 * @neg: set to %TRUE if number is negative
2027 * @perm_tr: a vector which contains the allowed trailers
2028 * @perm_tr_len: size of the perm_tr vector
2029 * @tr: pointer to store the trailer character
Amerigo Wang00b7c332010-05-05 00:26:45 +00002030 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07002031 * In case of success %0 is returned and @buf and @size are updated with
2032 * the amount of bytes read. If @tr is non-NULL and a trailing
2033 * character exists (size is non-zero after returning from this
2034 * function), @tr is updated with the trailing character.
Amerigo Wang00b7c332010-05-05 00:26:45 +00002035 */
2036static int proc_get_long(char **buf, size_t *size,
2037 unsigned long *val, bool *neg,
2038 const char *perm_tr, unsigned perm_tr_len, char *tr)
2039{
2040 int len;
2041 char *p, tmp[TMPBUFLEN];
2042
2043 if (!*size)
2044 return -EINVAL;
2045
2046 len = *size;
2047 if (len > TMPBUFLEN - 1)
2048 len = TMPBUFLEN - 1;
2049
2050 memcpy(tmp, *buf, len);
2051
2052 tmp[len] = 0;
2053 p = tmp;
2054 if (*p == '-' && *size > 1) {
2055 *neg = true;
2056 p++;
2057 } else
2058 *neg = false;
2059 if (!isdigit(*p))
2060 return -EINVAL;
2061
2062 *val = simple_strtoul(p, &p, 0);
2063
2064 len = p - tmp;
2065
2066 /* We don't know if the next char is whitespace thus we may accept
2067 * invalid integers (e.g. 1234...a) or two integers instead of one
2068 * (e.g. 123...1). So lets not allow such large numbers. */
2069 if (len == TMPBUFLEN - 1)
2070 return -EINVAL;
2071
2072 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
2073 return -EINVAL;
2074
2075 if (tr && (len < *size))
2076 *tr = *p;
2077
2078 *buf += len;
2079 *size -= len;
2080
2081 return 0;
2082}
2083
2084/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07002085 * proc_put_long - converts an integer to a decimal ASCII formatted string
Amerigo Wang00b7c332010-05-05 00:26:45 +00002086 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07002087 * @buf: the user buffer
2088 * @size: the size of the user buffer
2089 * @val: the integer to be converted
2090 * @neg: sign of the number, %TRUE for negative
Amerigo Wang00b7c332010-05-05 00:26:45 +00002091 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07002092 * In case of success %0 is returned and @buf and @size are updated with
2093 * the amount of bytes written.
Amerigo Wang00b7c332010-05-05 00:26:45 +00002094 */
2095static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
2096 bool neg)
2097{
2098 int len;
2099 char tmp[TMPBUFLEN], *p = tmp;
2100
2101 sprintf(p, "%s%lu", neg ? "-" : "", val);
2102 len = strlen(tmp);
2103 if (len > *size)
2104 len = *size;
2105 if (copy_to_user(*buf, tmp, len))
2106 return -EFAULT;
2107 *size -= len;
2108 *buf += len;
2109 return 0;
2110}
2111#undef TMPBUFLEN
2112
2113static int proc_put_char(void __user **buf, size_t *size, char c)
2114{
2115 if (*size) {
2116 char __user **buffer = (char __user **)buf;
2117 if (put_user(c, *buffer))
2118 return -EFAULT;
2119 (*size)--, (*buffer)++;
2120 *buf = *buffer;
2121 }
2122 return 0;
2123}
2124
2125static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002126 int *valp,
2127 int write, void *data)
2128{
2129 if (write) {
Heinrich Schuchardt230633d2015-04-16 12:48:07 -07002130 if (*negp) {
2131 if (*lvalp > (unsigned long) INT_MAX + 1)
2132 return -EINVAL;
2133 *valp = -*lvalp;
2134 } else {
2135 if (*lvalp > (unsigned long) INT_MAX)
2136 return -EINVAL;
2137 *valp = *lvalp;
2138 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002139 } else {
2140 int val = *valp;
2141 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002142 *negp = true;
Ilya Dryomov9a5bc722015-09-09 15:39:06 -07002143 *lvalp = -(unsigned long)val;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002144 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002145 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002146 *lvalp = (unsigned long)val;
2147 }
2148 }
2149 return 0;
2150}
2151
Amerigo Wang00b7c332010-05-05 00:26:45 +00002152static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
2153
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002154static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002155 int write, void __user *buffer,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002156 size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00002157 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002158 int write, void *data),
2159 void *data)
2160{
Amerigo Wang00b7c332010-05-05 00:26:45 +00002161 int *i, vleft, first = 1, err = 0;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002162 size_t left;
Al Viro70f6cbb2015-12-24 00:13:10 -05002163 char *kbuf = NULL, *p;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002164
Amerigo Wang00b7c332010-05-05 00:26:45 +00002165 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002166 *lenp = 0;
2167 return 0;
2168 }
2169
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002170 i = (int *) tbl_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002171 vleft = table->maxlen / sizeof(*i);
2172 left = *lenp;
2173
2174 if (!conv)
2175 conv = do_proc_dointvec_conv;
2176
Linus Torvalds1da177e2005-04-16 15:20:36 -07002177 if (write) {
Kees Cookf4aacea2014-06-06 14:37:19 -07002178 if (*ppos) {
2179 switch (sysctl_writes_strict) {
2180 case SYSCTL_WRITES_STRICT:
2181 goto out;
2182 case SYSCTL_WRITES_WARN:
2183 warn_sysctl_write(table);
2184 break;
2185 default:
2186 break;
2187 }
2188 }
2189
Amerigo Wang00b7c332010-05-05 00:26:45 +00002190 if (left > PAGE_SIZE - 1)
2191 left = PAGE_SIZE - 1;
Al Viro70f6cbb2015-12-24 00:13:10 -05002192 p = kbuf = memdup_user_nul(buffer, left);
2193 if (IS_ERR(kbuf))
2194 return PTR_ERR(kbuf);
Amerigo Wang00b7c332010-05-05 00:26:45 +00002195 }
2196
2197 for (; left && vleft--; i++, first=0) {
2198 unsigned long lval;
2199 bool neg;
2200
2201 if (write) {
Al Viro70f6cbb2015-12-24 00:13:10 -05002202 left -= proc_skip_spaces(&p);
Amerigo Wang00b7c332010-05-05 00:26:45 +00002203
J. R. Okajima563b0462010-05-25 16:10:14 -07002204 if (!left)
2205 break;
Al Viro70f6cbb2015-12-24 00:13:10 -05002206 err = proc_get_long(&p, &left, &lval, &neg,
Amerigo Wang00b7c332010-05-05 00:26:45 +00002207 proc_wspace_sep,
2208 sizeof(proc_wspace_sep), NULL);
2209 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002210 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002211 if (conv(&neg, &lval, i, 1, data)) {
2212 err = -EINVAL;
2213 break;
2214 }
2215 } else {
2216 if (conv(&neg, &lval, i, 0, data)) {
2217 err = -EINVAL;
2218 break;
2219 }
2220 if (!first)
2221 err = proc_put_char(&buffer, &left, '\t');
2222 if (err)
2223 break;
2224 err = proc_put_long(&buffer, &left, lval, neg);
2225 if (err)
2226 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002227 }
2228 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002229
2230 if (!write && !first && left && !err)
2231 err = proc_put_char(&buffer, &left, '\n');
J. R. Okajima563b0462010-05-25 16:10:14 -07002232 if (write && !err && left)
Al Viro70f6cbb2015-12-24 00:13:10 -05002233 left -= proc_skip_spaces(&p);
Amerigo Wang00b7c332010-05-05 00:26:45 +00002234 if (write) {
Al Viro70f6cbb2015-12-24 00:13:10 -05002235 kfree(kbuf);
Amerigo Wang00b7c332010-05-05 00:26:45 +00002236 if (first)
2237 return err ? : -EINVAL;
2238 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002239 *lenp -= left;
Kees Cookf4aacea2014-06-06 14:37:19 -07002240out:
Linus Torvalds1da177e2005-04-16 15:20:36 -07002241 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002242 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002243}
2244
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002245static int do_proc_dointvec(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002246 void __user *buffer, size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00002247 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002248 int write, void *data),
2249 void *data)
2250{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002251 return __do_proc_dointvec(table->data, table, write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002252 buffer, lenp, ppos, conv, data);
2253}
2254
Linus Torvalds1da177e2005-04-16 15:20:36 -07002255/**
2256 * proc_dointvec - read a vector of integers
2257 * @table: the sysctl table
2258 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002259 * @buffer: the user buffer
2260 * @lenp: the size of the user buffer
2261 * @ppos: file position
2262 *
2263 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2264 * values from/to the user buffer, treated as an ASCII string.
2265 *
2266 * Returns 0 on success.
2267 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002268int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002269 void __user *buffer, size_t *lenp, loff_t *ppos)
2270{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002271 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002272 NULL,NULL);
2273}
2274
Theodore Ts'o34f5a392007-02-10 01:45:24 -08002275/*
Andi Kleen25ddbb12008-10-15 22:01:41 -07002276 * Taint values can only be increased
2277 * This means we can safely use a temporary.
Theodore Ts'o34f5a392007-02-10 01:45:24 -08002278 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002279static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -08002280 void __user *buffer, size_t *lenp, loff_t *ppos)
2281{
Andi Kleen25ddbb12008-10-15 22:01:41 -07002282 struct ctl_table t;
2283 unsigned long tmptaint = get_taint();
2284 int err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08002285
Bastian Blank91fcd412007-04-23 14:41:14 -07002286 if (write && !capable(CAP_SYS_ADMIN))
Theodore Ts'o34f5a392007-02-10 01:45:24 -08002287 return -EPERM;
2288
Andi Kleen25ddbb12008-10-15 22:01:41 -07002289 t = *table;
2290 t.data = &tmptaint;
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002291 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
Andi Kleen25ddbb12008-10-15 22:01:41 -07002292 if (err < 0)
2293 return err;
2294
2295 if (write) {
2296 /*
2297 * Poor man's atomic or. Not worth adding a primitive
2298 * to everyone's atomic.h for this
2299 */
2300 int i;
2301 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
2302 if ((tmptaint >> i) & 1)
Rusty Russell373d4d02013-01-21 17:17:39 +10302303 add_taint(i, LOCKDEP_STILL_OK);
Andi Kleen25ddbb12008-10-15 22:01:41 -07002304 }
2305 }
2306
2307 return err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08002308}
2309
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07002310#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -07002311static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07002312 void __user *buffer, size_t *lenp, loff_t *ppos)
2313{
2314 if (write && !capable(CAP_SYS_ADMIN))
2315 return -EPERM;
2316
2317 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
2318}
2319#endif
2320
Linus Torvalds1da177e2005-04-16 15:20:36 -07002321struct do_proc_dointvec_minmax_conv_param {
2322 int *min;
2323 int *max;
2324};
2325
Amerigo Wang00b7c332010-05-05 00:26:45 +00002326static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
2327 int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002328 int write, void *data)
2329{
2330 struct do_proc_dointvec_minmax_conv_param *param = data;
2331 if (write) {
2332 int val = *negp ? -*lvalp : *lvalp;
2333 if ((param->min && *param->min > val) ||
2334 (param->max && *param->max < val))
2335 return -EINVAL;
2336 *valp = val;
2337 } else {
2338 int val = *valp;
2339 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002340 *negp = true;
Ilya Dryomov9a5bc722015-09-09 15:39:06 -07002341 *lvalp = -(unsigned long)val;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002342 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002343 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002344 *lvalp = (unsigned long)val;
2345 }
2346 }
2347 return 0;
2348}
2349
2350/**
2351 * proc_dointvec_minmax - read a vector of integers with min/max values
2352 * @table: the sysctl table
2353 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002354 * @buffer: the user buffer
2355 * @lenp: the size of the user buffer
2356 * @ppos: file position
2357 *
2358 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2359 * values from/to the user buffer, treated as an ASCII string.
2360 *
2361 * This routine will ensure the values are within the range specified by
2362 * table->extra1 (min) and table->extra2 (max).
2363 *
2364 * Returns 0 on success.
2365 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002366int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002367 void __user *buffer, size_t *lenp, loff_t *ppos)
2368{
2369 struct do_proc_dointvec_minmax_conv_param param = {
2370 .min = (int *) table->extra1,
2371 .max = (int *) table->extra2,
2372 };
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002373 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002374 do_proc_dointvec_minmax_conv, &param);
2375}
2376
Kees Cook54b50192012-07-30 14:39:18 -07002377static void validate_coredump_safety(void)
2378{
Alex Kelly046d6622012-10-04 17:15:23 -07002379#ifdef CONFIG_COREDUMP
Kees Cooke579d2c2013-02-27 17:03:15 -08002380 if (suid_dumpable == SUID_DUMP_ROOT &&
Kees Cook54b50192012-07-30 14:39:18 -07002381 core_pattern[0] != '/' && core_pattern[0] != '|') {
2382 printk(KERN_WARNING "Unsafe core_pattern used with "\
2383 "suid_dumpable=2. Pipe handler or fully qualified "\
2384 "core dump path required.\n");
2385 }
Alex Kelly046d6622012-10-04 17:15:23 -07002386#endif
Kees Cook54b50192012-07-30 14:39:18 -07002387}
2388
2389static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
2390 void __user *buffer, size_t *lenp, loff_t *ppos)
2391{
2392 int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
2393 if (!error)
2394 validate_coredump_safety();
2395 return error;
2396}
2397
Alex Kelly046d6622012-10-04 17:15:23 -07002398#ifdef CONFIG_COREDUMP
Kees Cook54b50192012-07-30 14:39:18 -07002399static int proc_dostring_coredump(struct ctl_table *table, int write,
2400 void __user *buffer, size_t *lenp, loff_t *ppos)
2401{
2402 int error = proc_dostring(table, write, buffer, lenp, ppos);
2403 if (!error)
2404 validate_coredump_safety();
2405 return error;
2406}
Alex Kelly046d6622012-10-04 17:15:23 -07002407#endif
Kees Cook54b50192012-07-30 14:39:18 -07002408
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002409static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002410 void __user *buffer,
2411 size_t *lenp, loff_t *ppos,
2412 unsigned long convmul,
2413 unsigned long convdiv)
2414{
Amerigo Wang00b7c332010-05-05 00:26:45 +00002415 unsigned long *i, *min, *max;
2416 int vleft, first = 1, err = 0;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002417 size_t left;
Al Viro70f6cbb2015-12-24 00:13:10 -05002418 char *kbuf = NULL, *p;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002419
2420 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002421 *lenp = 0;
2422 return 0;
2423 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002424
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002425 i = (unsigned long *) data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002426 min = (unsigned long *) table->extra1;
2427 max = (unsigned long *) table->extra2;
2428 vleft = table->maxlen / sizeof(unsigned long);
2429 left = *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002430
2431 if (write) {
Kees Cookf4aacea2014-06-06 14:37:19 -07002432 if (*ppos) {
2433 switch (sysctl_writes_strict) {
2434 case SYSCTL_WRITES_STRICT:
2435 goto out;
2436 case SYSCTL_WRITES_WARN:
2437 warn_sysctl_write(table);
2438 break;
2439 default:
2440 break;
2441 }
2442 }
2443
Amerigo Wang00b7c332010-05-05 00:26:45 +00002444 if (left > PAGE_SIZE - 1)
2445 left = PAGE_SIZE - 1;
Al Viro70f6cbb2015-12-24 00:13:10 -05002446 p = kbuf = memdup_user_nul(buffer, left);
2447 if (IS_ERR(kbuf))
2448 return PTR_ERR(kbuf);
Amerigo Wang00b7c332010-05-05 00:26:45 +00002449 }
2450
Eric Dumazet27b3d802010-10-07 12:59:29 -07002451 for (; left && vleft--; i++, first = 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002452 unsigned long val;
2453
Linus Torvalds1da177e2005-04-16 15:20:36 -07002454 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002455 bool neg;
2456
Al Viro70f6cbb2015-12-24 00:13:10 -05002457 left -= proc_skip_spaces(&p);
Amerigo Wang00b7c332010-05-05 00:26:45 +00002458
Al Viro70f6cbb2015-12-24 00:13:10 -05002459 err = proc_get_long(&p, &left, &val, &neg,
Amerigo Wang00b7c332010-05-05 00:26:45 +00002460 proc_wspace_sep,
2461 sizeof(proc_wspace_sep), NULL);
2462 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002463 break;
2464 if (neg)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002465 continue;
2466 if ((min && val < *min) || (max && val > *max))
2467 continue;
2468 *i = val;
2469 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002470 val = convdiv * (*i) / convmul;
Chen Gang78338192013-11-12 15:11:21 -08002471 if (!first) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002472 err = proc_put_char(&buffer, &left, '\t');
Chen Gang78338192013-11-12 15:11:21 -08002473 if (err)
2474 break;
2475 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002476 err = proc_put_long(&buffer, &left, val, false);
2477 if (err)
2478 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002479 }
2480 }
2481
Amerigo Wang00b7c332010-05-05 00:26:45 +00002482 if (!write && !first && left && !err)
2483 err = proc_put_char(&buffer, &left, '\n');
2484 if (write && !err)
Al Viro70f6cbb2015-12-24 00:13:10 -05002485 left -= proc_skip_spaces(&p);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002486 if (write) {
Al Viro70f6cbb2015-12-24 00:13:10 -05002487 kfree(kbuf);
Amerigo Wang00b7c332010-05-05 00:26:45 +00002488 if (first)
2489 return err ? : -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002490 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002491 *lenp -= left;
Kees Cookf4aacea2014-06-06 14:37:19 -07002492out:
Linus Torvalds1da177e2005-04-16 15:20:36 -07002493 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002494 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002495}
2496
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002497static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002498 void __user *buffer,
2499 size_t *lenp, loff_t *ppos,
2500 unsigned long convmul,
2501 unsigned long convdiv)
2502{
2503 return __do_proc_doulongvec_minmax(table->data, table, write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002504 buffer, lenp, ppos, convmul, convdiv);
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002505}
2506
Linus Torvalds1da177e2005-04-16 15:20:36 -07002507/**
2508 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2509 * @table: the sysctl table
2510 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002511 * @buffer: the user buffer
2512 * @lenp: the size of the user buffer
2513 * @ppos: file position
2514 *
2515 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2516 * values from/to the user buffer, treated as an ASCII string.
2517 *
2518 * This routine will ensure the values are within the range specified by
2519 * table->extra1 (min) and table->extra2 (max).
2520 *
2521 * Returns 0 on success.
2522 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002523int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002524 void __user *buffer, size_t *lenp, loff_t *ppos)
2525{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002526 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002527}
2528
2529/**
2530 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2531 * @table: the sysctl table
2532 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002533 * @buffer: the user buffer
2534 * @lenp: the size of the user buffer
2535 * @ppos: file position
2536 *
2537 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2538 * values from/to the user buffer, treated as an ASCII string. The values
2539 * are treated as milliseconds, and converted to jiffies when they are stored.
2540 *
2541 * This routine will ensure the values are within the range specified by
2542 * table->extra1 (min) and table->extra2 (max).
2543 *
2544 * Returns 0 on success.
2545 */
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002546int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002547 void __user *buffer,
2548 size_t *lenp, loff_t *ppos)
2549{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002550 return do_proc_doulongvec_minmax(table, write, buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002551 lenp, ppos, HZ, 1000l);
2552}
2553
2554
Amerigo Wang00b7c332010-05-05 00:26:45 +00002555static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002556 int *valp,
2557 int write, void *data)
2558{
2559 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002560 if (*lvalp > LONG_MAX / HZ)
2561 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002562 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2563 } else {
2564 int val = *valp;
2565 unsigned long lval;
2566 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002567 *negp = true;
Ilya Dryomov9a5bc722015-09-09 15:39:06 -07002568 lval = -(unsigned long)val;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002569 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002570 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002571 lval = (unsigned long)val;
2572 }
2573 *lvalp = lval / HZ;
2574 }
2575 return 0;
2576}
2577
Amerigo Wang00b7c332010-05-05 00:26:45 +00002578static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002579 int *valp,
2580 int write, void *data)
2581{
2582 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002583 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2584 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002585 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2586 } else {
2587 int val = *valp;
2588 unsigned long lval;
2589 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002590 *negp = true;
Ilya Dryomov9a5bc722015-09-09 15:39:06 -07002591 lval = -(unsigned long)val;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002592 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002593 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002594 lval = (unsigned long)val;
2595 }
2596 *lvalp = jiffies_to_clock_t(lval);
2597 }
2598 return 0;
2599}
2600
Amerigo Wang00b7c332010-05-05 00:26:45 +00002601static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002602 int *valp,
2603 int write, void *data)
2604{
2605 if (write) {
Francesco Fuscod738ce82013-07-24 10:39:07 +02002606 unsigned long jif = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2607
2608 if (jif > INT_MAX)
2609 return 1;
2610 *valp = (int)jif;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002611 } else {
2612 int val = *valp;
2613 unsigned long lval;
2614 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002615 *negp = true;
Ilya Dryomov9a5bc722015-09-09 15:39:06 -07002616 lval = -(unsigned long)val;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002617 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002618 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002619 lval = (unsigned long)val;
2620 }
2621 *lvalp = jiffies_to_msecs(lval);
2622 }
2623 return 0;
2624}
2625
2626/**
2627 * proc_dointvec_jiffies - read a vector of integers as seconds
2628 * @table: the sysctl table
2629 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002630 * @buffer: the user buffer
2631 * @lenp: the size of the user buffer
2632 * @ppos: file position
2633 *
2634 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2635 * values from/to the user buffer, treated as an ASCII string.
2636 * The values read are assumed to be in seconds, and are converted into
2637 * jiffies.
2638 *
2639 * Returns 0 on success.
2640 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002641int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002642 void __user *buffer, size_t *lenp, loff_t *ppos)
2643{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002644 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002645 do_proc_dointvec_jiffies_conv,NULL);
2646}
2647
2648/**
2649 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2650 * @table: the sysctl table
2651 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002652 * @buffer: the user buffer
2653 * @lenp: the size of the user buffer
Randy Dunlap1e5d5332005-11-07 01:01:06 -08002654 * @ppos: pointer to the file position
Linus Torvalds1da177e2005-04-16 15:20:36 -07002655 *
2656 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2657 * values from/to the user buffer, treated as an ASCII string.
2658 * The values read are assumed to be in 1/USER_HZ seconds, and
2659 * are converted into jiffies.
2660 *
2661 * Returns 0 on success.
2662 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002663int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002664 void __user *buffer, size_t *lenp, loff_t *ppos)
2665{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002666 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002667 do_proc_dointvec_userhz_jiffies_conv,NULL);
2668}
2669
2670/**
2671 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2672 * @table: the sysctl table
2673 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002674 * @buffer: the user buffer
2675 * @lenp: the size of the user buffer
Martin Waitz67be2dd2005-05-01 08:59:26 -07002676 * @ppos: file position
2677 * @ppos: the current position in the file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002678 *
2679 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2680 * values from/to the user buffer, treated as an ASCII string.
2681 * The values read are assumed to be in 1/1000 seconds, and
2682 * are converted into jiffies.
2683 *
2684 * Returns 0 on success.
2685 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002686int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002687 void __user *buffer, size_t *lenp, loff_t *ppos)
2688{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002689 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002690 do_proc_dointvec_ms_jiffies_conv, NULL);
2691}
2692
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002693static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002694 void __user *buffer, size_t *lenp, loff_t *ppos)
2695{
2696 struct pid *new_pid;
2697 pid_t tmp;
2698 int r;
2699
Pavel Emelyanov6c5f3e72008-02-08 04:19:20 -08002700 tmp = pid_vnr(cad_pid);
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002701
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002702 r = __do_proc_dointvec(&tmp, table, write, buffer,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002703 lenp, ppos, NULL, NULL);
2704 if (r || !write)
2705 return r;
2706
2707 new_pid = find_get_pid(tmp);
2708 if (!new_pid)
2709 return -ESRCH;
2710
2711 put_pid(xchg(&cad_pid, new_pid));
2712 return 0;
2713}
2714
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002715/**
2716 * proc_do_large_bitmap - read/write from/to a large bitmap
2717 * @table: the sysctl table
2718 * @write: %TRUE if this is a write to the sysctl file
2719 * @buffer: the user buffer
2720 * @lenp: the size of the user buffer
2721 * @ppos: file position
2722 *
2723 * The bitmap is stored at table->data and the bitmap length (in bits)
2724 * in table->maxlen.
2725 *
2726 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2727 * large bitmaps may be represented in a compact manner. Writing into
2728 * the file will clear the bitmap then update it with the given input.
2729 *
2730 * Returns 0 on success.
2731 */
2732int proc_do_large_bitmap(struct ctl_table *table, int write,
2733 void __user *buffer, size_t *lenp, loff_t *ppos)
2734{
2735 int err = 0;
2736 bool first = 1;
2737 size_t left = *lenp;
2738 unsigned long bitmap_len = table->maxlen;
WANG Cong122ff242014-05-12 16:04:53 -07002739 unsigned long *bitmap = *(unsigned long **) table->data;
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002740 unsigned long *tmp_bitmap = NULL;
2741 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2742
WANG Cong122ff242014-05-12 16:04:53 -07002743 if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002744 *lenp = 0;
2745 return 0;
2746 }
2747
2748 if (write) {
Al Viro70f6cbb2015-12-24 00:13:10 -05002749 char *kbuf, *p;
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002750
2751 if (left > PAGE_SIZE - 1)
2752 left = PAGE_SIZE - 1;
2753
Al Viro70f6cbb2015-12-24 00:13:10 -05002754 p = kbuf = memdup_user_nul(buffer, left);
2755 if (IS_ERR(kbuf))
2756 return PTR_ERR(kbuf);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002757
2758 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2759 GFP_KERNEL);
2760 if (!tmp_bitmap) {
Al Viro70f6cbb2015-12-24 00:13:10 -05002761 kfree(kbuf);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002762 return -ENOMEM;
2763 }
Al Viro70f6cbb2015-12-24 00:13:10 -05002764 proc_skip_char(&p, &left, '\n');
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002765 while (!err && left) {
2766 unsigned long val_a, val_b;
2767 bool neg;
2768
Al Viro70f6cbb2015-12-24 00:13:10 -05002769 err = proc_get_long(&p, &left, &val_a, &neg, tr_a,
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002770 sizeof(tr_a), &c);
2771 if (err)
2772 break;
2773 if (val_a >= bitmap_len || neg) {
2774 err = -EINVAL;
2775 break;
2776 }
2777
2778 val_b = val_a;
2779 if (left) {
Al Viro70f6cbb2015-12-24 00:13:10 -05002780 p++;
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002781 left--;
2782 }
2783
2784 if (c == '-') {
Al Viro70f6cbb2015-12-24 00:13:10 -05002785 err = proc_get_long(&p, &left, &val_b,
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002786 &neg, tr_b, sizeof(tr_b),
2787 &c);
2788 if (err)
2789 break;
2790 if (val_b >= bitmap_len || neg ||
2791 val_a > val_b) {
2792 err = -EINVAL;
2793 break;
2794 }
2795 if (left) {
Al Viro70f6cbb2015-12-24 00:13:10 -05002796 p++;
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002797 left--;
2798 }
2799 }
2800
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002801 bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002802 first = 0;
Al Viro70f6cbb2015-12-24 00:13:10 -05002803 proc_skip_char(&p, &left, '\n');
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002804 }
Al Viro70f6cbb2015-12-24 00:13:10 -05002805 kfree(kbuf);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002806 } else {
2807 unsigned long bit_a, bit_b = 0;
2808
2809 while (left) {
2810 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2811 if (bit_a >= bitmap_len)
2812 break;
2813 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2814 bit_a + 1) - 1;
2815
2816 if (!first) {
2817 err = proc_put_char(&buffer, &left, ',');
2818 if (err)
2819 break;
2820 }
2821 err = proc_put_long(&buffer, &left, bit_a, false);
2822 if (err)
2823 break;
2824 if (bit_a != bit_b) {
2825 err = proc_put_char(&buffer, &left, '-');
2826 if (err)
2827 break;
2828 err = proc_put_long(&buffer, &left, bit_b, false);
2829 if (err)
2830 break;
2831 }
2832
2833 first = 0; bit_b++;
2834 }
2835 if (!err)
2836 err = proc_put_char(&buffer, &left, '\n');
2837 }
2838
2839 if (!err) {
2840 if (write) {
2841 if (*ppos)
2842 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2843 else
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002844 bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002845 }
2846 kfree(tmp_bitmap);
2847 *lenp -= left;
2848 *ppos += *lenp;
2849 return 0;
2850 } else {
2851 kfree(tmp_bitmap);
2852 return err;
2853 }
2854}
2855
Jovi Zhang55610502011-01-12 17:00:45 -08002856#else /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002857
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002858int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002859 void __user *buffer, size_t *lenp, loff_t *ppos)
2860{
2861 return -ENOSYS;
2862}
2863
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002864int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002865 void __user *buffer, size_t *lenp, loff_t *ppos)
2866{
2867 return -ENOSYS;
2868}
2869
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002870int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002871 void __user *buffer, size_t *lenp, loff_t *ppos)
2872{
2873 return -ENOSYS;
2874}
2875
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002876int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002877 void __user *buffer, size_t *lenp, loff_t *ppos)
2878{
2879 return -ENOSYS;
2880}
2881
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002882int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002883 void __user *buffer, size_t *lenp, loff_t *ppos)
2884{
2885 return -ENOSYS;
2886}
2887
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002888int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002889 void __user *buffer, size_t *lenp, loff_t *ppos)
2890{
2891 return -ENOSYS;
2892}
2893
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002894int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002895 void __user *buffer, size_t *lenp, loff_t *ppos)
2896{
2897 return -ENOSYS;
2898}
2899
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002900int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002901 void __user *buffer,
2902 size_t *lenp, loff_t *ppos)
2903{
2904 return -ENOSYS;
2905}
2906
2907
Jovi Zhang55610502011-01-12 17:00:45 -08002908#endif /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002909
Linus Torvalds1da177e2005-04-16 15:20:36 -07002910/*
2911 * No sense putting this after each symbol definition, twice,
2912 * exception granted :-)
2913 */
2914EXPORT_SYMBOL(proc_dointvec);
2915EXPORT_SYMBOL(proc_dointvec_jiffies);
2916EXPORT_SYMBOL(proc_dointvec_minmax);
2917EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2918EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2919EXPORT_SYMBOL(proc_dostring);
2920EXPORT_SYMBOL(proc_doulongvec_minmax);
2921EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);