blob: 87174ef59161eb32ce298f5ef9c2b0e9feb1b3f1 [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>
22#include <linux/mm.h>
23#include <linux/swap.h>
24#include <linux/slab.h>
25#include <linux/sysctl.h>
Akinobu Mita5a04cca2012-03-28 14:42:50 -070026#include <linux/bitmap.h>
Dave Youngd33ed522010-03-10 15:23:59 -080027#include <linux/signal.h>
Dan Rosenberg455cd5a2011-01-12 16:59:41 -080028#include <linux/printk.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include <linux/proc_fs.h>
Andrew Morgan72c2d582007-10-18 03:05:59 -070030#include <linux/security.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <linux/ctype.h>
Vegard Nossumdfec0722008-04-04 00:51:41 +020032#include <linux/kmemcheck.h>
Steven Rostedtfd4b6162012-07-30 14:42:48 -070033#include <linux/kmemleak.h>
Adrian Bunk62239ac2007-07-17 04:03:45 -070034#include <linux/fs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070035#include <linux/init.h>
36#include <linux/kernel.h>
Kay Sievers0296b222005-11-11 05:33:52 +010037#include <linux/kobject.h>
Arnaldo Carvalho de Melo20380732005-08-16 02:18:02 -030038#include <linux/net.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070039#include <linux/sysrq.h>
40#include <linux/highuid.h>
41#include <linux/writeback.h>
Ingo Molnar3fff4c42009-09-22 16:18:09 +020042#include <linux/ratelimit.h>
Mel Gorman76ab0f52010-05-24 14:32:28 -070043#include <linux/compaction.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#include <linux/hugetlb.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#include <linux/initrd.h>
David Howells0b77f5b2008-04-29 01:01:32 -070046#include <linux/key.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070047#include <linux/times.h>
48#include <linux/limits.h>
49#include <linux/dcache.h>
Alexey Dobriyan6e006702010-01-20 22:27:56 +020050#include <linux/dnotify.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070051#include <linux/syscalls.h>
Adrian Bunkc748e132008-07-23 21:27:03 -070052#include <linux/vmstat.h>
Pavel Machekc255d842006-02-20 18:27:58 -080053#include <linux/nfs_fs.h>
54#include <linux/acpi.h>
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -070055#include <linux/reboot.h>
Steven Rostedtb0fc4942008-05-12 21:20:43 +020056#include <linux/ftrace.h>
Ingo Molnarcdd6c482009-09-21 12:02:48 +020057#include <linux/perf_event.h>
Masami Hiramatsub2be84d2010-02-25 08:34:15 -050058#include <linux/kprobes.h>
Jens Axboeb492e952010-05-19 21:03:16 +020059#include <linux/pipe_fs_i.h>
David Rientjes8e4228e2010-08-09 17:18:56 -070060#include <linux/oom.h>
Eric Paris17f60a72011-04-01 17:07:50 -040061#include <linux/kmod.h>
Dan Ballard73efc032011-10-31 17:11:20 -070062#include <linux/capability.h>
Al Viro40401532012-02-13 03:58:52 +000063#include <linux/binfmts.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070064
65#include <asm/uaccess.h>
66#include <asm/processor.h>
67
Andi Kleen29cbc782006-09-30 01:47:55 +020068#ifdef CONFIG_X86
69#include <asm/nmi.h>
Chuck Ebbert0741f4d2006-12-07 02:14:11 +010070#include <asm/stacktrace.h>
Ingo Molnar6e7c4022008-01-30 13:30:05 +010071#include <asm/io.h>
Andi Kleen29cbc782006-09-30 01:47:55 +020072#endif
David Howellsd550bbd2012-03-28 18:30:03 +010073#ifdef CONFIG_SPARC
74#include <asm/setup.h>
75#endif
Dave Youngc55b7c32010-03-10 15:24:08 -080076#ifdef CONFIG_BSD_PROCESS_ACCT
77#include <linux/acct.h>
78#endif
Dave Young4f0e0562010-03-10 15:24:09 -080079#ifdef CONFIG_RT_MUTEXES
80#include <linux/rtmutex.h>
81#endif
Dave Young2edf5e42010-03-10 15:24:10 -080082#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
83#include <linux/lockdep.h>
84#endif
Dave Young15485a42010-03-10 15:24:07 -080085#ifdef CONFIG_CHR_DEV_SG
86#include <scsi/sg.h>
87#endif
Andi Kleen29cbc782006-09-30 01:47:55 +020088
Don Zickus58687ac2010-05-07 17:11:44 -040089#ifdef CONFIG_LOCKUP_DETECTOR
Don Zickus504d7cf2010-02-12 17:19:19 -050090#include <linux/nmi.h>
91#endif
92
Eric W. Biederman7058cb02007-10-18 03:05:58 -070093
Linus Torvalds1da177e2005-04-16 15:20:36 -070094#if defined(CONFIG_SYSCTL)
95
96/* External variables not in a header file. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070097extern int sysctl_overcommit_memory;
98extern int sysctl_overcommit_ratio;
99extern int max_threads;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100extern int core_uses_pid;
Alan Coxd6e71142005-06-23 00:09:43 -0700101extern int suid_dumpable;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102extern char core_pattern[];
Neil Hormana2939802009-09-23 15:56:56 -0700103extern unsigned int core_pipe_limit;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104extern int pid_max;
105extern int min_free_kbytes;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106extern int pid_max_min, pid_max_max;
Andrew Morton9d0243b2006-01-08 01:00:39 -0800107extern int sysctl_drop_caches;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800108extern int percpu_pagelist_fraction;
Andi Kleenbebfa102006-06-26 13:56:52 +0200109extern int compat_log;
Arjan van de Ven97455122008-01-25 21:08:34 +0100110extern int latencytop_enabled;
Al Viroeceea0b2008-05-10 10:08:32 -0400111extern int sysctl_nr_open_min, sysctl_nr_open_max;
Paul Mundtdd8632a2009-01-08 12:04:47 +0000112#ifndef CONFIG_MMU
113extern int sysctl_nr_trim_pages;
114#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200115#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200116extern int blk_iopoll_enabled;
Jens Axboecb684b52009-09-15 21:53:11 +0200117#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700119/* Constants used for minimum and maximum */
Don Zickus2508ce12010-05-07 17:11:46 -0400120#ifdef CONFIG_LOCKUP_DETECTOR
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700121static int sixty = 60;
Dimitri Sivanich9383d962008-05-12 21:21:14 +0200122static int neg_one = -1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700123#endif
124
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700125static int zero;
Linus Torvaldscd5f9a42009-04-06 13:38:46 -0700126static int __maybe_unused one = 1;
127static int __maybe_unused two = 2;
Petr Holasekcb16e952011-03-23 16:43:09 -0700128static int __maybe_unused three = 3;
Sven Wegenerfc3501d2009-02-11 13:04:23 -0800129static unsigned long one_ul = 1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700130static int one_hundred = 100;
Dave Youngaf913222009-09-22 16:43:33 -0700131#ifdef CONFIG_PRINTK
132static int ten_thousand = 10000;
133#endif
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700134
Andrea Righi9e4a5bd2009-04-30 15:08:57 -0700135/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
136static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
137
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
139static int maxolduid = 65535;
140static int minolduid;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800141static int min_percpu_pagelist_fract = 8;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142
143static int ngroups_max = NGROUPS_MAX;
Dan Ballard73efc032011-10-31 17:11:20 -0700144static const int cap_last_cap = CAP_LAST_CAP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145
Dave Youngd14f1722010-02-25 20:28:57 -0500146#ifdef CONFIG_INOTIFY_USER
147#include <linux/inotify.h>
148#endif
David S. Miller72c57ed2008-09-11 23:29:54 -0700149#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150#endif
151
David S. Miller08714202008-11-16 23:49:24 -0800152#ifdef CONFIG_SPARC64
153extern int sysctl_tsb_ratio;
154#endif
155
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156#ifdef __hppa__
157extern int pwrsw_enabled;
158extern int unaligned_enabled;
159#endif
160
Jes Sorensend2b176e2006-02-28 09:42:23 -0800161#ifdef CONFIG_IA64
162extern int no_unaligned_warning;
Doug Chapman88fc2412009-01-15 10:38:56 -0800163extern int unaligned_dump_stack;
Jes Sorensend2b176e2006-02-28 09:42:23 -0800164#endif
165
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700166#ifdef CONFIG_PROC_SYSCTL
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700167static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700168 void __user *buffer, size_t *lenp, loff_t *ppos);
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700169static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800170 void __user *buffer, size_t *lenp, loff_t *ppos);
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700171#endif
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700172
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700173#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -0700174static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700175 void __user *buffer, size_t *lenp, loff_t *ppos);
176#endif
177
Kees Cook54b50192012-07-30 14:39:18 -0700178static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
179 void __user *buffer, size_t *lenp, loff_t *ppos);
180static int proc_dostring_coredump(struct ctl_table *table, int write,
181 void __user *buffer, size_t *lenp, loff_t *ppos);
182
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700183#ifdef CONFIG_MAGIC_SYSRQ
Andy Whitcroft8c6a98b2011-01-24 09:31:38 -0800184/* Note: sysrq code uses it's own private copy */
185static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700186
187static int sysrq_sysctl_handler(ctl_table *table, int write,
188 void __user *buffer, size_t *lenp,
189 loff_t *ppos)
190{
191 int error;
192
193 error = proc_dointvec(table, write, buffer, lenp, ppos);
194 if (error)
195 return error;
196
197 if (write)
198 sysrq_toggle_support(__sysrq_enabled);
199
200 return 0;
201}
202
203#endif
204
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700205static struct ctl_table kern_table[];
206static struct ctl_table vm_table[];
207static struct ctl_table fs_table[];
208static struct ctl_table debug_table[];
209static struct ctl_table dev_table[];
210extern struct ctl_table random_table[];
Davide Libenzi7ef99642008-12-01 13:13:55 -0800211#ifdef CONFIG_EPOLL
212extern struct ctl_table epoll_table[];
213#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214
215#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
216int sysctl_legacy_va_layout;
217#endif
218
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219/* The default sysctl tables: */
220
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -0800221static struct ctl_table sysctl_base_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223 .procname = "kernel",
224 .mode = 0555,
225 .child = kern_table,
226 },
227 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228 .procname = "vm",
229 .mode = 0555,
230 .child = vm_table,
231 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233 .procname = "fs",
234 .mode = 0555,
235 .child = fs_table,
236 },
237 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 .procname = "debug",
239 .mode = 0555,
240 .child = debug_table,
241 },
242 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243 .procname = "dev",
244 .mode = 0555,
245 .child = dev_table,
246 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -0700247 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248};
249
Ingo Molnar77e54a12007-07-09 18:52:00 +0200250#ifdef CONFIG_SCHED_DEBUG
Eric Dumazet73c4efd2007-12-18 15:21:13 +0100251static int min_sched_granularity_ns = 100000; /* 100 usecs */
252static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
253static int min_wakeup_granularity_ns; /* 0 usecs */
254static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100255static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
256static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
Ingo Molnar77e54a12007-07-09 18:52:00 +0200257#endif
258
Mel Gorman5e771902010-05-24 14:32:31 -0700259#ifdef CONFIG_COMPACTION
260static int min_extfrag_threshold;
261static int max_extfrag_threshold = 1000;
262#endif
263
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700264static struct ctl_table kern_table[] = {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200265 {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200266 .procname = "sched_child_runs_first",
267 .data = &sysctl_sched_child_runs_first,
268 .maxlen = sizeof(unsigned int),
269 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800270 .proc_handler = proc_dointvec,
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200271 },
Ingo Molnar77e54a12007-07-09 18:52:00 +0200272#ifdef CONFIG_SCHED_DEBUG
273 {
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100274 .procname = "sched_min_granularity_ns",
275 .data = &sysctl_sched_min_granularity,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200276 .maxlen = sizeof(unsigned int),
277 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800278 .proc_handler = sched_proc_update_handler,
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100279 .extra1 = &min_sched_granularity_ns,
280 .extra2 = &max_sched_granularity_ns,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200281 },
282 {
Peter Zijlstra21805082007-08-25 18:41:53 +0200283 .procname = "sched_latency_ns",
284 .data = &sysctl_sched_latency,
285 .maxlen = sizeof(unsigned int),
286 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800287 .proc_handler = sched_proc_update_handler,
Peter Zijlstra21805082007-08-25 18:41:53 +0200288 .extra1 = &min_sched_granularity_ns,
289 .extra2 = &max_sched_granularity_ns,
290 },
291 {
Ingo Molnar77e54a12007-07-09 18:52:00 +0200292 .procname = "sched_wakeup_granularity_ns",
293 .data = &sysctl_sched_wakeup_granularity,
294 .maxlen = sizeof(unsigned int),
295 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800296 .proc_handler = sched_proc_update_handler,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200297 .extra1 = &min_wakeup_granularity_ns,
298 .extra2 = &max_wakeup_granularity_ns,
299 },
300 {
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100301 .procname = "sched_tunable_scaling",
302 .data = &sysctl_sched_tunable_scaling,
303 .maxlen = sizeof(enum sched_tunable_scaling),
304 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800305 .proc_handler = sched_proc_update_handler,
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100306 .extra1 = &min_sched_tunable_scaling,
307 .extra2 = &max_sched_tunable_scaling,
Peter Zijlstra2398f2c2008-06-27 13:41:35 +0200308 },
309 {
Ingo Molnarda84d962007-10-15 17:00:18 +0200310 .procname = "sched_migration_cost",
311 .data = &sysctl_sched_migration_cost,
312 .maxlen = sizeof(unsigned int),
313 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800314 .proc_handler = proc_dointvec,
Ingo Molnarda84d962007-10-15 17:00:18 +0200315 },
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100316 {
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100317 .procname = "sched_nr_migrate",
318 .data = &sysctl_sched_nr_migrate,
319 .maxlen = sizeof(unsigned int),
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100320 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800321 .proc_handler = proc_dointvec,
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100322 },
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530323 {
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200324 .procname = "sched_time_avg",
325 .data = &sysctl_sched_time_avg,
326 .maxlen = sizeof(unsigned int),
327 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800328 .proc_handler = proc_dointvec,
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200329 },
330 {
Paul Turnera7a4f8a2010-11-15 15:47:06 -0800331 .procname = "sched_shares_window",
332 .data = &sysctl_sched_shares_window,
333 .maxlen = sizeof(unsigned int),
334 .mode = 0644,
335 .proc_handler = proc_dointvec,
336 },
337 {
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530338 .procname = "timer_migration",
339 .data = &sysctl_timer_migration,
340 .maxlen = sizeof(unsigned int),
341 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800342 .proc_handler = proc_dointvec_minmax,
Arun R Bharadwajbfdb4d92009-06-23 10:00:58 +0530343 .extra1 = &zero,
344 .extra2 = &one,
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530345 },
Peter Zijlstra1fc84aa2007-08-25 18:41:52 +0200346#endif
Ingo Molnar1799e352007-09-19 23:34:46 +0200347 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100348 .procname = "sched_rt_period_us",
349 .data = &sysctl_sched_rt_period,
350 .maxlen = sizeof(unsigned int),
351 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800352 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100353 },
354 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100355 .procname = "sched_rt_runtime_us",
356 .data = &sysctl_sched_rt_runtime,
357 .maxlen = sizeof(int),
358 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800359 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100360 },
Mike Galbraith5091faa2010-11-30 14:18:03 +0100361#ifdef CONFIG_SCHED_AUTOGROUP
362 {
363 .procname = "sched_autogroup_enabled",
364 .data = &sysctl_sched_autogroup_enabled,
365 .maxlen = sizeof(unsigned int),
366 .mode = 0644,
Yong Zhang1747b212011-02-20 15:08:12 +0800367 .proc_handler = proc_dointvec_minmax,
Mike Galbraith5091faa2010-11-30 14:18:03 +0100368 .extra1 = &zero,
369 .extra2 = &one,
370 },
371#endif
Paul Turnerec12cb72011-07-21 09:43:30 -0700372#ifdef CONFIG_CFS_BANDWIDTH
373 {
374 .procname = "sched_cfs_bandwidth_slice_us",
375 .data = &sysctl_sched_cfs_bandwidth_slice,
376 .maxlen = sizeof(unsigned int),
377 .mode = 0644,
378 .proc_handler = proc_dointvec_minmax,
379 .extra1 = &one,
380 },
381#endif
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700382#ifdef CONFIG_PROVE_LOCKING
383 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700384 .procname = "prove_locking",
385 .data = &prove_locking,
386 .maxlen = sizeof(int),
387 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800388 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700389 },
390#endif
391#ifdef CONFIG_LOCK_STAT
392 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700393 .procname = "lock_stat",
394 .data = &lock_stat,
395 .maxlen = sizeof(int),
396 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800397 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700398 },
399#endif
Ingo Molnar77e54a12007-07-09 18:52:00 +0200400 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401 .procname = "panic",
402 .data = &panic_timeout,
403 .maxlen = sizeof(int),
404 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800405 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700406 },
407 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408 .procname = "core_uses_pid",
409 .data = &core_uses_pid,
410 .maxlen = sizeof(int),
411 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800412 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413 },
414 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415 .procname = "core_pattern",
416 .data = core_pattern,
Dan Aloni71ce92f2007-05-16 22:11:16 -0700417 .maxlen = CORENAME_MAX_SIZE,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418 .mode = 0644,
Kees Cook54b50192012-07-30 14:39:18 -0700419 .proc_handler = proc_dostring_coredump,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700420 },
Neil Hormana2939802009-09-23 15:56:56 -0700421 {
Neil Hormana2939802009-09-23 15:56:56 -0700422 .procname = "core_pipe_limit",
423 .data = &core_pipe_limit,
424 .maxlen = sizeof(unsigned int),
425 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800426 .proc_handler = proc_dointvec,
Neil Hormana2939802009-09-23 15:56:56 -0700427 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800428#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700430 .procname = "tainted",
Andi Kleen25ddbb12008-10-15 22:01:41 -0700431 .maxlen = sizeof(long),
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800432 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800433 .proc_handler = proc_taint,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800435#endif
Arjan van de Ven97455122008-01-25 21:08:34 +0100436#ifdef CONFIG_LATENCYTOP
437 {
438 .procname = "latencytop",
439 .data = &latencytop_enabled,
440 .maxlen = sizeof(int),
441 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800442 .proc_handler = proc_dointvec,
Arjan van de Ven97455122008-01-25 21:08:34 +0100443 },
444#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700445#ifdef CONFIG_BLK_DEV_INITRD
446 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447 .procname = "real-root-dev",
448 .data = &real_root_dev,
449 .maxlen = sizeof(int),
450 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800451 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700452 },
453#endif
Ingo Molnar45807a12007-07-15 23:40:10 -0700454 {
Ingo Molnar45807a12007-07-15 23:40:10 -0700455 .procname = "print-fatal-signals",
456 .data = &print_fatal_signals,
457 .maxlen = sizeof(int),
458 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800459 .proc_handler = proc_dointvec,
Ingo Molnar45807a12007-07-15 23:40:10 -0700460 },
David S. Miller72c57ed2008-09-11 23:29:54 -0700461#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700462 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700463 .procname = "reboot-cmd",
464 .data = reboot_command,
465 .maxlen = 256,
466 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800467 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700468 },
469 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470 .procname = "stop-a",
471 .data = &stop_a_enabled,
472 .maxlen = sizeof (int),
473 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800474 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700475 },
476 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700477 .procname = "scons-poweroff",
478 .data = &scons_pwroff,
479 .maxlen = sizeof (int),
480 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800481 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700482 },
483#endif
David S. Miller08714202008-11-16 23:49:24 -0800484#ifdef CONFIG_SPARC64
485 {
David S. Miller08714202008-11-16 23:49:24 -0800486 .procname = "tsb-ratio",
487 .data = &sysctl_tsb_ratio,
488 .maxlen = sizeof (int),
489 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800490 .proc_handler = proc_dointvec,
David S. Miller08714202008-11-16 23:49:24 -0800491 },
492#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700493#ifdef __hppa__
494 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700495 .procname = "soft-power",
496 .data = &pwrsw_enabled,
497 .maxlen = sizeof (int),
498 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800499 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700500 },
501 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502 .procname = "unaligned-trap",
503 .data = &unaligned_enabled,
504 .maxlen = sizeof (int),
505 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800506 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507 },
508#endif
509 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700510 .procname = "ctrl-alt-del",
511 .data = &C_A_D,
512 .maxlen = sizeof(int),
513 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800514 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700515 },
Steven Rostedt606576c2008-10-06 19:06:12 -0400516#ifdef CONFIG_FUNCTION_TRACER
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200517 {
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200518 .procname = "ftrace_enabled",
519 .data = &ftrace_enabled,
520 .maxlen = sizeof(int),
521 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800522 .proc_handler = ftrace_enable_sysctl,
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200523 },
524#endif
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500525#ifdef CONFIG_STACK_TRACER
526 {
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500527 .procname = "stack_tracer_enabled",
528 .data = &stack_tracer_enabled,
529 .maxlen = sizeof(int),
530 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800531 .proc_handler = stack_trace_sysctl,
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500532 },
533#endif
Steven Rostedt944ac422008-10-23 19:26:08 -0400534#ifdef CONFIG_TRACING
535 {
Peter Zijlstra3299b4d2008-11-04 11:58:21 +0100536 .procname = "ftrace_dump_on_oops",
Steven Rostedt944ac422008-10-23 19:26:08 -0400537 .data = &ftrace_dump_on_oops,
538 .maxlen = sizeof(int),
539 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800540 .proc_handler = proc_dointvec,
Steven Rostedt944ac422008-10-23 19:26:08 -0400541 },
542#endif
Johannes Berga1ef5ad2008-07-08 19:00:17 +0200543#ifdef CONFIG_MODULES
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700545 .procname = "modprobe",
546 .data = &modprobe_path,
547 .maxlen = KMOD_PATH_LEN,
548 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800549 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700550 },
Kees Cook3d433212009-04-02 15:49:29 -0700551 {
Kees Cook3d433212009-04-02 15:49:29 -0700552 .procname = "modules_disabled",
553 .data = &modules_disabled,
554 .maxlen = sizeof(int),
555 .mode = 0644,
556 /* only handle a transition from default "0" to "1" */
Eric W. Biederman6d456112009-11-16 03:11:48 -0800557 .proc_handler = proc_dointvec_minmax,
Kees Cook3d433212009-04-02 15:49:29 -0700558 .extra1 = &one,
559 .extra2 = &one,
560 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561#endif
Ian Abbott94f17cd2010-06-07 12:57:12 +0100562#ifdef CONFIG_HOTPLUG
Linus Torvalds1da177e2005-04-16 15:20:36 -0700563 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 .procname = "hotplug",
Kay Sievers312c0042005-11-16 09:00:00 +0100565 .data = &uevent_helper,
566 .maxlen = UEVENT_HELPER_PATH_LEN,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800568 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569 },
570#endif
571#ifdef CONFIG_CHR_DEV_SG
572 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700573 .procname = "sg-big-buff",
574 .data = &sg_big_buff,
575 .maxlen = sizeof (int),
576 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800577 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700578 },
579#endif
580#ifdef CONFIG_BSD_PROCESS_ACCT
581 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700582 .procname = "acct",
583 .data = &acct_parm,
584 .maxlen = 3*sizeof(int),
585 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800586 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700587 },
588#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700589#ifdef CONFIG_MAGIC_SYSRQ
590 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591 .procname = "sysrq",
Ingo Molnar5d6f6472006-12-13 00:34:36 -0800592 .data = &__sysrq_enabled,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700593 .maxlen = sizeof (int),
594 .mode = 0644,
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700595 .proc_handler = sysrq_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700596 },
597#endif
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700598#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700600 .procname = "cad_pid",
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700601 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 .maxlen = sizeof (int),
603 .mode = 0600,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800604 .proc_handler = proc_do_cad_pid,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700605 },
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700606#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700608 .procname = "threads-max",
609 .data = &max_threads,
610 .maxlen = sizeof(int),
611 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800612 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613 },
614 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700615 .procname = "random",
616 .mode = 0555,
617 .child = random_table,
618 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700619 {
Eric Paris17f60a72011-04-01 17:07:50 -0400620 .procname = "usermodehelper",
621 .mode = 0555,
622 .child = usermodehelper_table,
623 },
624 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700625 .procname = "overflowuid",
626 .data = &overflowuid,
627 .maxlen = sizeof(int),
628 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800629 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700630 .extra1 = &minolduid,
631 .extra2 = &maxolduid,
632 },
633 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700634 .procname = "overflowgid",
635 .data = &overflowgid,
636 .maxlen = sizeof(int),
637 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800638 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700639 .extra1 = &minolduid,
640 .extra2 = &maxolduid,
641 },
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -0800642#ifdef CONFIG_S390
Linus Torvalds1da177e2005-04-16 15:20:36 -0700643#ifdef CONFIG_MATHEMU
644 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700645 .procname = "ieee_emulation_warnings",
646 .data = &sysctl_ieee_emulation_warnings,
647 .maxlen = sizeof(int),
648 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800649 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700650 },
651#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700652 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700653 .procname = "userprocess_debug",
Heiko Carstensab3c68e2010-05-17 10:00:21 +0200654 .data = &show_unhandled_signals,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700655 .maxlen = sizeof(int),
656 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800657 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700658 },
659#endif
660 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700661 .procname = "pid_max",
662 .data = &pid_max,
663 .maxlen = sizeof (int),
664 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800665 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700666 .extra1 = &pid_max_min,
667 .extra2 = &pid_max_max,
668 },
669 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700670 .procname = "panic_on_oops",
671 .data = &panic_on_oops,
672 .maxlen = sizeof(int),
673 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800674 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675 },
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800676#if defined CONFIG_PRINTK
677 {
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800678 .procname = "printk",
679 .data = &console_loglevel,
680 .maxlen = 4*sizeof(int),
681 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800682 .proc_handler = proc_dointvec,
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800683 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700684 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700685 .procname = "printk_ratelimit",
Dave Young717115e2008-07-25 01:45:58 -0700686 .data = &printk_ratelimit_state.interval,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700687 .maxlen = sizeof(int),
688 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800689 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700690 },
691 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700692 .procname = "printk_ratelimit_burst",
Dave Young717115e2008-07-25 01:45:58 -0700693 .data = &printk_ratelimit_state.burst,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700694 .maxlen = 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 },
Dave Youngaf913222009-09-22 16:43:33 -0700698 {
Dave Youngaf913222009-09-22 16:43:33 -0700699 .procname = "printk_delay",
700 .data = &printk_delay_msec,
701 .maxlen = sizeof(int),
702 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800703 .proc_handler = proc_dointvec_minmax,
Dave Youngaf913222009-09-22 16:43:33 -0700704 .extra1 = &zero,
705 .extra2 = &ten_thousand,
706 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700707 {
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800708 .procname = "dmesg_restrict",
709 .data = &dmesg_restrict,
710 .maxlen = sizeof(int),
711 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700712 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800713 .extra1 = &zero,
714 .extra2 = &one,
715 },
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800716 {
717 .procname = "kptr_restrict",
718 .data = &kptr_restrict,
719 .maxlen = sizeof(int),
720 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700721 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800722 .extra1 = &zero,
723 .extra2 = &two,
724 },
Joe Perchesdf6e61d2010-11-15 21:17:27 -0800725#endif
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800726 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700727 .procname = "ngroups_max",
728 .data = &ngroups_max,
729 .maxlen = sizeof (int),
730 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800731 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700732 },
Dan Ballard73efc032011-10-31 17:11:20 -0700733 {
734 .procname = "cap_last_cap",
735 .data = (void *)&cap_last_cap,
736 .maxlen = sizeof(int),
737 .mode = 0444,
738 .proc_handler = proc_dointvec,
739 },
Don Zickus58687ac2010-05-07 17:11:44 -0400740#if defined(CONFIG_LOCKUP_DETECTOR)
Don Zickus504d7cf2010-02-12 17:19:19 -0500741 {
Don Zickus58687ac2010-05-07 17:11:44 -0400742 .procname = "watchdog",
743 .data = &watchdog_enabled,
Don Zickus504d7cf2010-02-12 17:19:19 -0500744 .maxlen = sizeof (int),
745 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700746 .proc_handler = proc_dowatchdog,
747 .extra1 = &zero,
748 .extra2 = &one,
Don Zickus58687ac2010-05-07 17:11:44 -0400749 },
750 {
751 .procname = "watchdog_thresh",
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700752 .data = &watchdog_thresh,
Don Zickus58687ac2010-05-07 17:11:44 -0400753 .maxlen = sizeof(int),
754 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700755 .proc_handler = proc_dowatchdog,
Don Zickus58687ac2010-05-07 17:11:44 -0400756 .extra1 = &neg_one,
757 .extra2 = &sixty,
Don Zickus504d7cf2010-02-12 17:19:19 -0500758 },
Don Zickus2508ce12010-05-07 17:11:46 -0400759 {
760 .procname = "softlockup_panic",
761 .data = &softlockup_panic,
762 .maxlen = sizeof(int),
763 .mode = 0644,
764 .proc_handler = proc_dointvec_minmax,
765 .extra1 = &zero,
766 .extra2 = &one,
767 },
Don Zickus5dc30552010-11-29 17:07:17 -0500768 {
769 .procname = "nmi_watchdog",
770 .data = &watchdog_enabled,
771 .maxlen = sizeof (int),
772 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700773 .proc_handler = proc_dowatchdog,
774 .extra1 = &zero,
775 .extra2 = &one,
Don Zickus5dc30552010-11-29 17:07:17 -0500776 },
777#endif
778#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
779 {
780 .procname = "unknown_nmi_panic",
781 .data = &unknown_nmi_panic,
782 .maxlen = sizeof (int),
783 .mode = 0644,
784 .proc_handler = proc_dointvec,
785 },
Don Zickus504d7cf2010-02-12 17:19:19 -0500786#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700787#if defined(CONFIG_X86)
788 {
Don Zickus8da5add2006-09-26 10:52:27 +0200789 .procname = "panic_on_unrecovered_nmi",
790 .data = &panic_on_unrecovered_nmi,
791 .maxlen = sizeof(int),
792 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800793 .proc_handler = proc_dointvec,
Don Zickus8da5add2006-09-26 10:52:27 +0200794 },
795 {
Kurt Garloff5211a242009-06-24 14:32:11 -0700796 .procname = "panic_on_io_nmi",
797 .data = &panic_on_io_nmi,
798 .maxlen = sizeof(int),
799 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800800 .proc_handler = proc_dointvec,
Kurt Garloff5211a242009-06-24 14:32:11 -0700801 },
Mitsuo Hayasaka55af7792011-11-29 15:08:36 +0900802#ifdef CONFIG_DEBUG_STACKOVERFLOW
803 {
804 .procname = "panic_on_stackoverflow",
805 .data = &sysctl_panic_on_stackoverflow,
806 .maxlen = sizeof(int),
807 .mode = 0644,
808 .proc_handler = proc_dointvec,
809 },
810#endif
Kurt Garloff5211a242009-06-24 14:32:11 -0700811 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700812 .procname = "bootloader_type",
813 .data = &bootloader_type,
814 .maxlen = sizeof (int),
815 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800816 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700817 },
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100818 {
H. Peter Anvin50312962009-05-07 16:54:11 -0700819 .procname = "bootloader_version",
820 .data = &bootloader_version,
821 .maxlen = sizeof (int),
822 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800823 .proc_handler = proc_dointvec,
H. Peter Anvin50312962009-05-07 16:54:11 -0700824 },
825 {
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100826 .procname = "kstack_depth_to_print",
827 .data = &kstack_depth_to_print,
828 .maxlen = sizeof(int),
829 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800830 .proc_handler = proc_dointvec,
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100831 },
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100832 {
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100833 .procname = "io_delay_type",
834 .data = &io_delay_type,
835 .maxlen = sizeof(int),
836 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800837 .proc_handler = proc_dointvec,
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100838 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700839#endif
Luke Yang7a9166e2006-02-20 18:28:07 -0800840#if defined(CONFIG_MMU)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700842 .procname = "randomize_va_space",
843 .data = &randomize_va_space,
844 .maxlen = sizeof(int),
845 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800846 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700847 },
Luke Yang7a9166e2006-02-20 18:28:07 -0800848#endif
Martin Schwidefsky0152fb32006-01-14 13:21:00 -0800849#if defined(CONFIG_S390) && defined(CONFIG_SMP)
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700850 {
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700851 .procname = "spin_retry",
852 .data = &spin_retry,
853 .maxlen = sizeof (int),
854 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800855 .proc_handler = proc_dointvec,
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700856 },
857#endif
Len Brown673d5b42007-07-28 03:33:16 -0400858#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
Pavel Machekc255d842006-02-20 18:27:58 -0800859 {
Pavel Machekc255d842006-02-20 18:27:58 -0800860 .procname = "acpi_video_flags",
Pavel Machek77afcf72007-07-19 01:47:41 -0700861 .data = &acpi_realmode_flags,
Pavel Machekc255d842006-02-20 18:27:58 -0800862 .maxlen = sizeof (unsigned long),
863 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800864 .proc_handler = proc_doulongvec_minmax,
Pavel Machekc255d842006-02-20 18:27:58 -0800865 },
866#endif
Jes Sorensend2b176e2006-02-28 09:42:23 -0800867#ifdef CONFIG_IA64
868 {
Jes Sorensend2b176e2006-02-28 09:42:23 -0800869 .procname = "ignore-unaligned-usertrap",
870 .data = &no_unaligned_warning,
871 .maxlen = sizeof (int),
872 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800873 .proc_handler = proc_dointvec,
Jes Sorensend2b176e2006-02-28 09:42:23 -0800874 },
Doug Chapman88fc2412009-01-15 10:38:56 -0800875 {
Doug Chapman88fc2412009-01-15 10:38:56 -0800876 .procname = "unaligned-dump-stack",
877 .data = &unaligned_dump_stack,
878 .maxlen = sizeof (int),
879 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800880 .proc_handler = proc_dointvec,
Doug Chapman88fc2412009-01-15 10:38:56 -0800881 },
Jes Sorensend2b176e2006-02-28 09:42:23 -0800882#endif
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800883#ifdef CONFIG_DETECT_HUNG_TASK
884 {
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800885 .procname = "hung_task_panic",
886 .data = &sysctl_hung_task_panic,
887 .maxlen = sizeof(int),
888 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800889 .proc_handler = proc_dointvec_minmax,
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800890 .extra1 = &zero,
891 .extra2 = &one,
892 },
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100893 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100894 .procname = "hung_task_check_count",
895 .data = &sysctl_hung_task_check_count,
Ingo Molnar90739082008-01-25 21:08:34 +0100896 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100897 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800898 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100899 },
900 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100901 .procname = "hung_task_timeout_secs",
902 .data = &sysctl_hung_task_timeout_secs,
Ingo Molnar90739082008-01-25 21:08:34 +0100903 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100904 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800905 .proc_handler = proc_dohung_task_timeout_secs,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100906 },
907 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100908 .procname = "hung_task_warnings",
909 .data = &sysctl_hung_task_warnings,
Ingo Molnar90739082008-01-25 21:08:34 +0100910 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100911 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800912 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100913 },
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700914#endif
Andi Kleenbebfa102006-06-26 13:56:52 +0200915#ifdef CONFIG_COMPAT
916 {
Andi Kleenbebfa102006-06-26 13:56:52 +0200917 .procname = "compat-log",
918 .data = &compat_log,
919 .maxlen = sizeof (int),
920 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800921 .proc_handler = proc_dointvec,
Andi Kleenbebfa102006-06-26 13:56:52 +0200922 },
923#endif
Ingo Molnar23f78d4a2006-06-27 02:54:53 -0700924#ifdef CONFIG_RT_MUTEXES
925 {
Ingo Molnar23f78d4a2006-06-27 02:54:53 -0700926 .procname = "max_lock_depth",
927 .data = &max_lock_depth,
928 .maxlen = sizeof(int),
929 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800930 .proc_handler = proc_dointvec,
Ingo Molnar23f78d4a2006-06-27 02:54:53 -0700931 },
932#endif
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700933 {
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700934 .procname = "poweroff_cmd",
935 .data = &poweroff_cmd,
936 .maxlen = POWEROFF_CMD_PATH_LEN,
937 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800938 .proc_handler = proc_dostring,
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700939 },
David Howells0b77f5b2008-04-29 01:01:32 -0700940#ifdef CONFIG_KEYS
941 {
David Howells0b77f5b2008-04-29 01:01:32 -0700942 .procname = "keys",
943 .mode = 0555,
944 .child = key_sysctls,
945 },
946#endif
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700947#ifdef CONFIG_RCU_TORTURE_TEST
948 {
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700949 .procname = "rcutorture_runnable",
950 .data = &rcutorture_runnable,
951 .maxlen = sizeof(int),
952 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800953 .proc_handler = proc_dointvec,
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700954 },
955#endif
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200956#ifdef CONFIG_PERF_EVENTS
Vince Weaveraa4a2212011-06-03 17:54:40 -0400957 /*
958 * User-space scripts rely on the existence of this file
959 * as a feature check for perf_events being enabled.
960 *
961 * So it's an ABI, do not remove!
962 */
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200963 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200964 .procname = "perf_event_paranoid",
965 .data = &sysctl_perf_event_paranoid,
966 .maxlen = sizeof(sysctl_perf_event_paranoid),
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200967 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800968 .proc_handler = proc_dointvec,
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200969 },
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200970 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200971 .procname = "perf_event_mlock_kb",
972 .data = &sysctl_perf_event_mlock,
973 .maxlen = sizeof(sysctl_perf_event_mlock),
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200974 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800975 .proc_handler = proc_dointvec,
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200976 },
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200977 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200978 .procname = "perf_event_max_sample_rate",
979 .data = &sysctl_perf_event_sample_rate,
980 .maxlen = sizeof(sysctl_perf_event_sample_rate),
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200981 .mode = 0644,
Peter Zijlstra163ec432011-02-16 11:22:34 +0100982 .proc_handler = perf_proc_update_handler,
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200983 },
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200984#endif
Vegard Nossumdfec0722008-04-04 00:51:41 +0200985#ifdef CONFIG_KMEMCHECK
986 {
Vegard Nossumdfec0722008-04-04 00:51:41 +0200987 .procname = "kmemcheck",
988 .data = &kmemcheck_enabled,
989 .maxlen = sizeof(int),
990 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800991 .proc_handler = proc_dointvec,
Vegard Nossumdfec0722008-04-04 00:51:41 +0200992 },
993#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200994#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200995 {
Jens Axboe5e605b62009-08-05 09:07:21 +0200996 .procname = "blk_iopoll",
997 .data = &blk_iopoll_enabled,
998 .maxlen = sizeof(int),
999 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001000 .proc_handler = proc_dointvec,
Jens Axboe5e605b62009-08-05 09:07:21 +02001001 },
Jens Axboecb684b52009-09-15 21:53:11 +02001002#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001003 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001004};
1005
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001006static struct ctl_table vm_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001007 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001008 .procname = "overcommit_memory",
1009 .data = &sysctl_overcommit_memory,
1010 .maxlen = sizeof(sysctl_overcommit_memory),
1011 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001012 .proc_handler = proc_dointvec_minmax,
1013 .extra1 = &zero,
1014 .extra2 = &two,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001015 },
1016 {
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001017 .procname = "panic_on_oom",
1018 .data = &sysctl_panic_on_oom,
1019 .maxlen = sizeof(sysctl_panic_on_oom),
1020 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001021 .proc_handler = proc_dointvec_minmax,
1022 .extra1 = &zero,
1023 .extra2 = &two,
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001024 },
1025 {
David Rientjesfe071d72007-10-16 23:25:56 -07001026 .procname = "oom_kill_allocating_task",
1027 .data = &sysctl_oom_kill_allocating_task,
1028 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1029 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001030 .proc_handler = proc_dointvec,
David Rientjesfe071d72007-10-16 23:25:56 -07001031 },
1032 {
David Rientjesfef1bdd2008-02-07 00:14:07 -08001033 .procname = "oom_dump_tasks",
1034 .data = &sysctl_oom_dump_tasks,
1035 .maxlen = sizeof(sysctl_oom_dump_tasks),
1036 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001037 .proc_handler = proc_dointvec,
David Rientjesfef1bdd2008-02-07 00:14:07 -08001038 },
1039 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001040 .procname = "overcommit_ratio",
1041 .data = &sysctl_overcommit_ratio,
1042 .maxlen = sizeof(sysctl_overcommit_ratio),
1043 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001044 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001045 },
1046 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001047 .procname = "page-cluster",
1048 .data = &page_cluster,
1049 .maxlen = sizeof(int),
1050 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001051 .proc_handler = proc_dointvec_minmax,
1052 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001053 },
1054 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001055 .procname = "dirty_background_ratio",
1056 .data = &dirty_background_ratio,
1057 .maxlen = sizeof(dirty_background_ratio),
1058 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001059 .proc_handler = dirty_background_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001060 .extra1 = &zero,
1061 .extra2 = &one_hundred,
1062 },
1063 {
David Rientjes2da02992009-01-06 14:39:31 -08001064 .procname = "dirty_background_bytes",
1065 .data = &dirty_background_bytes,
1066 .maxlen = sizeof(dirty_background_bytes),
1067 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001068 .proc_handler = dirty_background_bytes_handler,
Sven Wegenerfc3501d2009-02-11 13:04:23 -08001069 .extra1 = &one_ul,
David Rientjes2da02992009-01-06 14:39:31 -08001070 },
1071 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001072 .procname = "dirty_ratio",
1073 .data = &vm_dirty_ratio,
1074 .maxlen = sizeof(vm_dirty_ratio),
1075 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001076 .proc_handler = dirty_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001077 .extra1 = &zero,
1078 .extra2 = &one_hundred,
1079 },
1080 {
David Rientjes2da02992009-01-06 14:39:31 -08001081 .procname = "dirty_bytes",
1082 .data = &vm_dirty_bytes,
1083 .maxlen = sizeof(vm_dirty_bytes),
1084 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001085 .proc_handler = dirty_bytes_handler,
Andrea Righi9e4a5bd2009-04-30 15:08:57 -07001086 .extra1 = &dirty_bytes_min,
David Rientjes2da02992009-01-06 14:39:31 -08001087 },
1088 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001089 .procname = "dirty_writeback_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001090 .data = &dirty_writeback_interval,
1091 .maxlen = sizeof(dirty_writeback_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001092 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001093 .proc_handler = dirty_writeback_centisecs_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001094 },
1095 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001096 .procname = "dirty_expire_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001097 .data = &dirty_expire_interval,
1098 .maxlen = sizeof(dirty_expire_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001099 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001100 .proc_handler = proc_dointvec_minmax,
1101 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001102 },
1103 {
Wanpeng Li3965c9a2012-07-31 16:41:52 -07001104 .procname = "nr_pdflush_threads",
1105 .mode = 0444 /* read-only */,
1106 .proc_handler = pdflush_proc_obsolete,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001107 },
1108 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001109 .procname = "swappiness",
1110 .data = &vm_swappiness,
1111 .maxlen = sizeof(vm_swappiness),
1112 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001113 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001114 .extra1 = &zero,
1115 .extra2 = &one_hundred,
1116 },
1117#ifdef CONFIG_HUGETLB_PAGE
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001118 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001119 .procname = "nr_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001120 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001121 .maxlen = sizeof(unsigned long),
1122 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001123 .proc_handler = hugetlb_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001124 .extra1 = (void *)&hugetlb_zero,
1125 .extra2 = (void *)&hugetlb_infinity,
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001126 },
1127#ifdef CONFIG_NUMA
1128 {
1129 .procname = "nr_hugepages_mempolicy",
1130 .data = NULL,
1131 .maxlen = sizeof(unsigned long),
1132 .mode = 0644,
1133 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1134 .extra1 = (void *)&hugetlb_zero,
1135 .extra2 = (void *)&hugetlb_infinity,
1136 },
1137#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001138 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001139 .procname = "hugetlb_shm_group",
1140 .data = &sysctl_hugetlb_shm_group,
1141 .maxlen = sizeof(gid_t),
1142 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001143 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001144 },
Mel Gorman396faf02007-07-17 04:03:13 -07001145 {
Mel Gorman396faf02007-07-17 04:03:13 -07001146 .procname = "hugepages_treat_as_movable",
1147 .data = &hugepages_treat_as_movable,
1148 .maxlen = sizeof(int),
1149 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001150 .proc_handler = hugetlb_treat_movable_handler,
Mel Gorman396faf02007-07-17 04:03:13 -07001151 },
Adam Litke54f9f802007-10-16 01:26:20 -07001152 {
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001153 .procname = "nr_overcommit_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001154 .data = NULL,
1155 .maxlen = sizeof(unsigned long),
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001156 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001157 .proc_handler = hugetlb_overcommit_handler,
Andi Kleene5ff2152008-07-23 21:27:42 -07001158 .extra1 = (void *)&hugetlb_zero,
1159 .extra2 = (void *)&hugetlb_infinity,
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001160 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001161#endif
1162 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001163 .procname = "lowmem_reserve_ratio",
1164 .data = &sysctl_lowmem_reserve_ratio,
1165 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1166 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001167 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001168 },
1169 {
Andrew Morton9d0243b2006-01-08 01:00:39 -08001170 .procname = "drop_caches",
1171 .data = &sysctl_drop_caches,
1172 .maxlen = sizeof(int),
1173 .mode = 0644,
1174 .proc_handler = drop_caches_sysctl_handler,
Petr Holasekcb16e952011-03-23 16:43:09 -07001175 .extra1 = &one,
1176 .extra2 = &three,
Andrew Morton9d0243b2006-01-08 01:00:39 -08001177 },
Mel Gorman76ab0f52010-05-24 14:32:28 -07001178#ifdef CONFIG_COMPACTION
1179 {
1180 .procname = "compact_memory",
1181 .data = &sysctl_compact_memory,
1182 .maxlen = sizeof(int),
1183 .mode = 0200,
1184 .proc_handler = sysctl_compaction_handler,
1185 },
Mel Gorman5e771902010-05-24 14:32:31 -07001186 {
1187 .procname = "extfrag_threshold",
1188 .data = &sysctl_extfrag_threshold,
1189 .maxlen = sizeof(int),
1190 .mode = 0644,
1191 .proc_handler = sysctl_extfrag_handler,
1192 .extra1 = &min_extfrag_threshold,
1193 .extra2 = &max_extfrag_threshold,
1194 },
1195
Mel Gorman76ab0f52010-05-24 14:32:28 -07001196#endif /* CONFIG_COMPACTION */
Andrew Morton9d0243b2006-01-08 01:00:39 -08001197 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001198 .procname = "min_free_kbytes",
1199 .data = &min_free_kbytes,
1200 .maxlen = sizeof(min_free_kbytes),
1201 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001202 .proc_handler = min_free_kbytes_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001203 .extra1 = &zero,
1204 },
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001205 {
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001206 .procname = "percpu_pagelist_fraction",
1207 .data = &percpu_pagelist_fraction,
1208 .maxlen = sizeof(percpu_pagelist_fraction),
1209 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001210 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001211 .extra1 = &min_percpu_pagelist_fract,
1212 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001213#ifdef CONFIG_MMU
1214 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001215 .procname = "max_map_count",
1216 .data = &sysctl_max_map_count,
1217 .maxlen = sizeof(sysctl_max_map_count),
1218 .mode = 0644,
WANG Cong3e261202009-12-17 15:27:05 -08001219 .proc_handler = proc_dointvec_minmax,
Amerigo Wang70da2342009-12-14 17:59:52 -08001220 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001221 },
Paul Mundtdd8632a2009-01-08 12:04:47 +00001222#else
1223 {
Paul Mundtdd8632a2009-01-08 12:04:47 +00001224 .procname = "nr_trim_pages",
1225 .data = &sysctl_nr_trim_pages,
1226 .maxlen = sizeof(sysctl_nr_trim_pages),
1227 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001228 .proc_handler = proc_dointvec_minmax,
Paul Mundtdd8632a2009-01-08 12:04:47 +00001229 .extra1 = &zero,
1230 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001231#endif
1232 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001233 .procname = "laptop_mode",
1234 .data = &laptop_mode,
1235 .maxlen = sizeof(laptop_mode),
1236 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001237 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001238 },
1239 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001240 .procname = "block_dump",
1241 .data = &block_dump,
1242 .maxlen = sizeof(block_dump),
1243 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001244 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001245 .extra1 = &zero,
1246 },
1247 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001248 .procname = "vfs_cache_pressure",
1249 .data = &sysctl_vfs_cache_pressure,
1250 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1251 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001252 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001253 .extra1 = &zero,
1254 },
1255#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1256 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001257 .procname = "legacy_va_layout",
1258 .data = &sysctl_legacy_va_layout,
1259 .maxlen = sizeof(sysctl_legacy_va_layout),
1260 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001261 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001262 .extra1 = &zero,
1263 },
1264#endif
Christoph Lameter17436602006-01-18 17:42:32 -08001265#ifdef CONFIG_NUMA
1266 {
Christoph Lameter17436602006-01-18 17:42:32 -08001267 .procname = "zone_reclaim_mode",
1268 .data = &zone_reclaim_mode,
1269 .maxlen = sizeof(zone_reclaim_mode),
1270 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001271 .proc_handler = proc_dointvec,
Christoph Lameterc84db232006-02-01 03:05:29 -08001272 .extra1 = &zero,
Christoph Lameter17436602006-01-18 17:42:32 -08001273 },
Christoph Lameter96146342006-07-03 00:24:13 -07001274 {
Christoph Lameter96146342006-07-03 00:24:13 -07001275 .procname = "min_unmapped_ratio",
1276 .data = &sysctl_min_unmapped_ratio,
1277 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1278 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001279 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
Christoph Lameter96146342006-07-03 00:24:13 -07001280 .extra1 = &zero,
1281 .extra2 = &one_hundred,
1282 },
Christoph Lameter0ff38492006-09-25 23:31:52 -07001283 {
Christoph Lameter0ff38492006-09-25 23:31:52 -07001284 .procname = "min_slab_ratio",
1285 .data = &sysctl_min_slab_ratio,
1286 .maxlen = sizeof(sysctl_min_slab_ratio),
1287 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001288 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
Christoph Lameter0ff38492006-09-25 23:31:52 -07001289 .extra1 = &zero,
1290 .extra2 = &one_hundred,
1291 },
Christoph Lameter17436602006-01-18 17:42:32 -08001292#endif
Christoph Lameter77461ab2007-05-09 02:35:13 -07001293#ifdef CONFIG_SMP
1294 {
Christoph Lameter77461ab2007-05-09 02:35:13 -07001295 .procname = "stat_interval",
1296 .data = &sysctl_stat_interval,
1297 .maxlen = sizeof(sysctl_stat_interval),
1298 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001299 .proc_handler = proc_dointvec_jiffies,
Christoph Lameter77461ab2007-05-09 02:35:13 -07001300 },
1301#endif
David Howells6e141542009-12-15 19:27:45 +00001302#ifdef CONFIG_MMU
Eric Parised032182007-06-28 15:55:21 -04001303 {
Eric Parised032182007-06-28 15:55:21 -04001304 .procname = "mmap_min_addr",
Eric Paris788084a2009-07-31 12:54:11 -04001305 .data = &dac_mmap_min_addr,
1306 .maxlen = sizeof(unsigned long),
Eric Parised032182007-06-28 15:55:21 -04001307 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001308 .proc_handler = mmap_min_addr_handler,
Eric Parised032182007-06-28 15:55:21 -04001309 },
David Howells6e141542009-12-15 19:27:45 +00001310#endif
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001311#ifdef CONFIG_NUMA
1312 {
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001313 .procname = "numa_zonelist_order",
1314 .data = &numa_zonelist_order,
1315 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1316 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001317 .proc_handler = numa_zonelist_order_handler,
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001318 },
1319#endif
Al Viro2b8232c2007-10-13 08:16:04 +01001320#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
Paul Mundt5c36e652007-03-01 10:07:42 +09001321 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
Ingo Molnare6e54942006-06-27 02:53:50 -07001322 {
Ingo Molnare6e54942006-06-27 02:53:50 -07001323 .procname = "vdso_enabled",
1324 .data = &vdso_enabled,
1325 .maxlen = sizeof(vdso_enabled),
1326 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001327 .proc_handler = proc_dointvec,
Ingo Molnare6e54942006-06-27 02:53:50 -07001328 .extra1 = &zero,
1329 },
1330#endif
Bron Gondwana195cf4532008-02-04 22:29:20 -08001331#ifdef CONFIG_HIGHMEM
1332 {
Bron Gondwana195cf4532008-02-04 22:29:20 -08001333 .procname = "highmem_is_dirtyable",
1334 .data = &vm_highmem_is_dirtyable,
1335 .maxlen = sizeof(vm_highmem_is_dirtyable),
1336 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001337 .proc_handler = proc_dointvec_minmax,
Bron Gondwana195cf4532008-02-04 22:29:20 -08001338 .extra1 = &zero,
1339 .extra2 = &one,
1340 },
1341#endif
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001342 {
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001343 .procname = "scan_unevictable_pages",
1344 .data = &scan_unevictable_pages,
1345 .maxlen = sizeof(scan_unevictable_pages),
1346 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001347 .proc_handler = scan_unevictable_handler,
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001348 },
Andi Kleen6a460792009-09-16 11:50:15 +02001349#ifdef CONFIG_MEMORY_FAILURE
1350 {
Andi Kleen6a460792009-09-16 11:50:15 +02001351 .procname = "memory_failure_early_kill",
1352 .data = &sysctl_memory_failure_early_kill,
1353 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1354 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001355 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001356 .extra1 = &zero,
1357 .extra2 = &one,
1358 },
1359 {
Andi Kleen6a460792009-09-16 11:50:15 +02001360 .procname = "memory_failure_recovery",
1361 .data = &sysctl_memory_failure_recovery,
1362 .maxlen = sizeof(sysctl_memory_failure_recovery),
1363 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001364 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001365 .extra1 = &zero,
1366 .extra2 = &one,
1367 },
1368#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001369 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001370};
1371
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001372#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001373static struct ctl_table binfmt_misc_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001374 { }
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001375};
1376#endif
1377
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001378static struct ctl_table fs_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001379 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001380 .procname = "inode-nr",
1381 .data = &inodes_stat,
1382 .maxlen = 2*sizeof(int),
1383 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001384 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001385 },
1386 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001387 .procname = "inode-state",
1388 .data = &inodes_stat,
1389 .maxlen = 7*sizeof(int),
1390 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001391 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001392 },
1393 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001394 .procname = "file-nr",
1395 .data = &files_stat,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001396 .maxlen = sizeof(files_stat),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001397 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001398 .proc_handler = proc_nr_files,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001399 },
1400 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001401 .procname = "file-max",
1402 .data = &files_stat.max_files,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001403 .maxlen = sizeof(files_stat.max_files),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001404 .mode = 0644,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001405 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001406 },
1407 {
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001408 .procname = "nr_open",
1409 .data = &sysctl_nr_open,
1410 .maxlen = sizeof(int),
1411 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001412 .proc_handler = proc_dointvec_minmax,
Al Viroeceea0b2008-05-10 10:08:32 -04001413 .extra1 = &sysctl_nr_open_min,
1414 .extra2 = &sysctl_nr_open_max,
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001415 },
1416 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001417 .procname = "dentry-state",
1418 .data = &dentry_stat,
1419 .maxlen = 6*sizeof(int),
1420 .mode = 0444,
Christoph Hellwig312d3ca2010-10-10 05:36:23 -04001421 .proc_handler = proc_nr_dentry,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001422 },
1423 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001424 .procname = "overflowuid",
1425 .data = &fs_overflowuid,
1426 .maxlen = sizeof(int),
1427 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001428 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001429 .extra1 = &minolduid,
1430 .extra2 = &maxolduid,
1431 },
1432 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001433 .procname = "overflowgid",
1434 .data = &fs_overflowgid,
1435 .maxlen = sizeof(int),
1436 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001437 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001438 .extra1 = &minolduid,
1439 .extra2 = &maxolduid,
1440 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001441#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001442 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001443 .procname = "leases-enable",
1444 .data = &leases_enable,
1445 .maxlen = sizeof(int),
1446 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001447 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001448 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001449#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001450#ifdef CONFIG_DNOTIFY
1451 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001452 .procname = "dir-notify-enable",
1453 .data = &dir_notify_enable,
1454 .maxlen = sizeof(int),
1455 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001456 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001457 },
1458#endif
1459#ifdef CONFIG_MMU
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001460#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001461 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001462 .procname = "lease-break-time",
1463 .data = &lease_break_time,
1464 .maxlen = sizeof(int),
1465 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001466 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001467 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001468#endif
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001469#ifdef CONFIG_AIO
Linus Torvalds1da177e2005-04-16 15:20:36 -07001470 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001471 .procname = "aio-nr",
1472 .data = &aio_nr,
1473 .maxlen = sizeof(aio_nr),
1474 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001475 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001476 },
1477 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001478 .procname = "aio-max-nr",
1479 .data = &aio_max_nr,
1480 .maxlen = sizeof(aio_max_nr),
1481 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001482 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001483 },
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001484#endif /* CONFIG_AIO */
Amy Griffis2d9048e2006-06-01 13:10:59 -07001485#ifdef CONFIG_INOTIFY_USER
Robert Love0399cb02005-07-13 12:38:18 -04001486 {
Robert Love0399cb02005-07-13 12:38:18 -04001487 .procname = "inotify",
1488 .mode = 0555,
1489 .child = inotify_table,
1490 },
1491#endif
Davide Libenzi7ef99642008-12-01 13:13:55 -08001492#ifdef CONFIG_EPOLL
1493 {
1494 .procname = "epoll",
1495 .mode = 0555,
1496 .child = epoll_table,
1497 },
1498#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001499#endif
Alan Coxd6e71142005-06-23 00:09:43 -07001500 {
Kees Cook800179c2012-07-25 17:29:07 -07001501 .procname = "protected_symlinks",
1502 .data = &sysctl_protected_symlinks,
1503 .maxlen = sizeof(int),
1504 .mode = 0600,
1505 .proc_handler = proc_dointvec_minmax,
1506 .extra1 = &zero,
1507 .extra2 = &one,
1508 },
1509 {
1510 .procname = "protected_hardlinks",
1511 .data = &sysctl_protected_hardlinks,
1512 .maxlen = sizeof(int),
1513 .mode = 0600,
1514 .proc_handler = proc_dointvec_minmax,
1515 .extra1 = &zero,
1516 .extra2 = &one,
1517 },
1518 {
Alan Coxd6e71142005-06-23 00:09:43 -07001519 .procname = "suid_dumpable",
1520 .data = &suid_dumpable,
1521 .maxlen = sizeof(int),
1522 .mode = 0644,
Kees Cook54b50192012-07-30 14:39:18 -07001523 .proc_handler = proc_dointvec_minmax_coredump,
Matthew Wilcox8e654fb2009-04-02 16:58:33 -07001524 .extra1 = &zero,
1525 .extra2 = &two,
Alan Coxd6e71142005-06-23 00:09:43 -07001526 },
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001527#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1528 {
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001529 .procname = "binfmt_misc",
1530 .mode = 0555,
1531 .child = binfmt_misc_table,
1532 },
1533#endif
Jens Axboeb492e952010-05-19 21:03:16 +02001534 {
Jens Axboeff9da692010-06-03 14:54:39 +02001535 .procname = "pipe-max-size",
1536 .data = &pipe_max_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001537 .maxlen = sizeof(int),
1538 .mode = 0644,
Jens Axboeff9da692010-06-03 14:54:39 +02001539 .proc_handler = &pipe_proc_fn,
1540 .extra1 = &pipe_min_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001541 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001542 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001543};
1544
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001545static struct ctl_table debug_table[] = {
Heiko Carstensab3c68e2010-05-17 10:00:21 +02001546#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
Chris Metcalf571d76a2011-05-16 14:23:44 -04001547 defined(CONFIG_S390) || defined(CONFIG_TILE)
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001548 {
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001549 .procname = "exception-trace",
1550 .data = &show_unhandled_signals,
1551 .maxlen = sizeof(int),
1552 .mode = 0644,
1553 .proc_handler = proc_dointvec
1554 },
1555#endif
Masami Hiramatsub2be84d2010-02-25 08:34:15 -05001556#if defined(CONFIG_OPTPROBES)
1557 {
1558 .procname = "kprobes-optimization",
1559 .data = &sysctl_kprobes_optimization,
1560 .maxlen = sizeof(int),
1561 .mode = 0644,
1562 .proc_handler = proc_kprobes_optimization_handler,
1563 .extra1 = &zero,
1564 .extra2 = &one,
1565 },
1566#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001567 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001568};
1569
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001570static struct ctl_table dev_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001571 { }
Robert Love0eeca282005-07-12 17:06:03 -04001572};
Linus Torvalds1da177e2005-04-16 15:20:36 -07001573
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001574int __init sysctl_init(void)
Al Viro330d57f2005-11-04 10:18:40 +00001575{
Steven Rostedtfd4b6162012-07-30 14:42:48 -07001576 struct ctl_table_header *hdr;
1577
1578 hdr = register_sysctl_table(sysctl_base_table);
1579 kmemleak_not_leak(hdr);
Eric W. Biedermand912b0c2007-02-14 00:34:13 -08001580 return 0;
1581}
1582
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001583#endif /* CONFIG_SYSCTL */
1584
Linus Torvalds1da177e2005-04-16 15:20:36 -07001585/*
1586 * /proc/sys support
1587 */
1588
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001589#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -07001590
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001591static int _proc_do_string(void* data, int maxlen, int write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001592 void __user *buffer,
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001593 size_t *lenp, loff_t *ppos)
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001594{
1595 size_t len;
1596 char __user *p;
1597 char c;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001598
1599 if (!data || !maxlen || !*lenp) {
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001600 *lenp = 0;
1601 return 0;
1602 }
Oleg Nesterov8d060872007-02-10 01:46:38 -08001603
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001604 if (write) {
1605 len = 0;
1606 p = buffer;
1607 while (len < *lenp) {
1608 if (get_user(c, p++))
1609 return -EFAULT;
1610 if (c == 0 || c == '\n')
1611 break;
1612 len++;
1613 }
1614 if (len >= maxlen)
1615 len = maxlen-1;
1616 if(copy_from_user(data, buffer, len))
1617 return -EFAULT;
1618 ((char *) data)[len] = 0;
1619 *ppos += *lenp;
1620 } else {
1621 len = strlen(data);
1622 if (len > maxlen)
1623 len = maxlen;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001624
1625 if (*ppos > len) {
1626 *lenp = 0;
1627 return 0;
1628 }
1629
1630 data += *ppos;
1631 len -= *ppos;
1632
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001633 if (len > *lenp)
1634 len = *lenp;
1635 if (len)
1636 if(copy_to_user(buffer, data, len))
1637 return -EFAULT;
1638 if (len < *lenp) {
1639 if(put_user('\n', ((char __user *) buffer) + len))
1640 return -EFAULT;
1641 len++;
1642 }
1643 *lenp = len;
1644 *ppos += len;
1645 }
1646 return 0;
1647}
1648
Linus Torvalds1da177e2005-04-16 15:20:36 -07001649/**
1650 * proc_dostring - read a string sysctl
1651 * @table: the sysctl table
1652 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001653 * @buffer: the user buffer
1654 * @lenp: the size of the user buffer
1655 * @ppos: file position
1656 *
1657 * Reads/writes a string from/to the user buffer. If the kernel
1658 * buffer provided is not large enough to hold the string, the
1659 * string is truncated. The copied string is %NULL-terminated.
1660 * If the string is being read by the user process, it is copied
1661 * and a newline '\n' is added. It is truncated if the buffer is
1662 * not large enough.
1663 *
1664 * Returns 0 on success.
1665 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001666int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001667 void __user *buffer, size_t *lenp, loff_t *ppos)
1668{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001669 return _proc_do_string(table->data, table->maxlen, write,
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001670 buffer, lenp, ppos);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001671}
1672
Amerigo Wang00b7c332010-05-05 00:26:45 +00001673static size_t proc_skip_spaces(char **buf)
1674{
1675 size_t ret;
1676 char *tmp = skip_spaces(*buf);
1677 ret = tmp - *buf;
1678 *buf = tmp;
1679 return ret;
1680}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001681
Octavian Purdila9f977fb2010-05-05 00:26:55 +00001682static void proc_skip_char(char **buf, size_t *size, const char v)
1683{
1684 while (*size) {
1685 if (**buf != v)
1686 break;
1687 (*size)--;
1688 (*buf)++;
1689 }
1690}
1691
Amerigo Wang00b7c332010-05-05 00:26:45 +00001692#define TMPBUFLEN 22
1693/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001694 * proc_get_long - reads an ASCII formatted integer from a user buffer
Amerigo Wang00b7c332010-05-05 00:26:45 +00001695 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001696 * @buf: a kernel buffer
1697 * @size: size of the kernel buffer
1698 * @val: this is where the number will be stored
1699 * @neg: set to %TRUE if number is negative
1700 * @perm_tr: a vector which contains the allowed trailers
1701 * @perm_tr_len: size of the perm_tr vector
1702 * @tr: pointer to store the trailer character
Amerigo Wang00b7c332010-05-05 00:26:45 +00001703 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001704 * In case of success %0 is returned and @buf and @size are updated with
1705 * the amount of bytes read. If @tr is non-NULL and a trailing
1706 * character exists (size is non-zero after returning from this
1707 * function), @tr is updated with the trailing character.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001708 */
1709static int proc_get_long(char **buf, size_t *size,
1710 unsigned long *val, bool *neg,
1711 const char *perm_tr, unsigned perm_tr_len, char *tr)
1712{
1713 int len;
1714 char *p, tmp[TMPBUFLEN];
1715
1716 if (!*size)
1717 return -EINVAL;
1718
1719 len = *size;
1720 if (len > TMPBUFLEN - 1)
1721 len = TMPBUFLEN - 1;
1722
1723 memcpy(tmp, *buf, len);
1724
1725 tmp[len] = 0;
1726 p = tmp;
1727 if (*p == '-' && *size > 1) {
1728 *neg = true;
1729 p++;
1730 } else
1731 *neg = false;
1732 if (!isdigit(*p))
1733 return -EINVAL;
1734
1735 *val = simple_strtoul(p, &p, 0);
1736
1737 len = p - tmp;
1738
1739 /* We don't know if the next char is whitespace thus we may accept
1740 * invalid integers (e.g. 1234...a) or two integers instead of one
1741 * (e.g. 123...1). So lets not allow such large numbers. */
1742 if (len == TMPBUFLEN - 1)
1743 return -EINVAL;
1744
1745 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
1746 return -EINVAL;
1747
1748 if (tr && (len < *size))
1749 *tr = *p;
1750
1751 *buf += len;
1752 *size -= len;
1753
1754 return 0;
1755}
1756
1757/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001758 * proc_put_long - converts an integer to a decimal ASCII formatted string
Amerigo Wang00b7c332010-05-05 00:26:45 +00001759 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001760 * @buf: the user buffer
1761 * @size: the size of the user buffer
1762 * @val: the integer to be converted
1763 * @neg: sign of the number, %TRUE for negative
Amerigo Wang00b7c332010-05-05 00:26:45 +00001764 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001765 * In case of success %0 is returned and @buf and @size are updated with
1766 * the amount of bytes written.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001767 */
1768static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
1769 bool neg)
1770{
1771 int len;
1772 char tmp[TMPBUFLEN], *p = tmp;
1773
1774 sprintf(p, "%s%lu", neg ? "-" : "", val);
1775 len = strlen(tmp);
1776 if (len > *size)
1777 len = *size;
1778 if (copy_to_user(*buf, tmp, len))
1779 return -EFAULT;
1780 *size -= len;
1781 *buf += len;
1782 return 0;
1783}
1784#undef TMPBUFLEN
1785
1786static int proc_put_char(void __user **buf, size_t *size, char c)
1787{
1788 if (*size) {
1789 char __user **buffer = (char __user **)buf;
1790 if (put_user(c, *buffer))
1791 return -EFAULT;
1792 (*size)--, (*buffer)++;
1793 *buf = *buffer;
1794 }
1795 return 0;
1796}
1797
1798static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001799 int *valp,
1800 int write, void *data)
1801{
1802 if (write) {
1803 *valp = *negp ? -*lvalp : *lvalp;
1804 } else {
1805 int val = *valp;
1806 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001807 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001808 *lvalp = (unsigned long)-val;
1809 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001810 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001811 *lvalp = (unsigned long)val;
1812 }
1813 }
1814 return 0;
1815}
1816
Amerigo Wang00b7c332010-05-05 00:26:45 +00001817static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
1818
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001819static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001820 int write, void __user *buffer,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001821 size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001822 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001823 int write, void *data),
1824 void *data)
1825{
Amerigo Wang00b7c332010-05-05 00:26:45 +00001826 int *i, vleft, first = 1, err = 0;
1827 unsigned long page = 0;
1828 size_t left;
1829 char *kbuf;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001830
Amerigo Wang00b7c332010-05-05 00:26:45 +00001831 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001832 *lenp = 0;
1833 return 0;
1834 }
1835
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001836 i = (int *) tbl_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001837 vleft = table->maxlen / sizeof(*i);
1838 left = *lenp;
1839
1840 if (!conv)
1841 conv = do_proc_dointvec_conv;
1842
Linus Torvalds1da177e2005-04-16 15:20:36 -07001843 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001844 if (left > PAGE_SIZE - 1)
1845 left = PAGE_SIZE - 1;
1846 page = __get_free_page(GFP_TEMPORARY);
1847 kbuf = (char *) page;
1848 if (!kbuf)
1849 return -ENOMEM;
1850 if (copy_from_user(kbuf, buffer, left)) {
1851 err = -EFAULT;
1852 goto free;
1853 }
1854 kbuf[left] = 0;
1855 }
1856
1857 for (; left && vleft--; i++, first=0) {
1858 unsigned long lval;
1859 bool neg;
1860
1861 if (write) {
1862 left -= proc_skip_spaces(&kbuf);
1863
J. R. Okajima563b0462010-05-25 16:10:14 -07001864 if (!left)
1865 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001866 err = proc_get_long(&kbuf, &left, &lval, &neg,
1867 proc_wspace_sep,
1868 sizeof(proc_wspace_sep), NULL);
1869 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001870 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001871 if (conv(&neg, &lval, i, 1, data)) {
1872 err = -EINVAL;
1873 break;
1874 }
1875 } else {
1876 if (conv(&neg, &lval, i, 0, data)) {
1877 err = -EINVAL;
1878 break;
1879 }
1880 if (!first)
1881 err = proc_put_char(&buffer, &left, '\t');
1882 if (err)
1883 break;
1884 err = proc_put_long(&buffer, &left, lval, neg);
1885 if (err)
1886 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001887 }
1888 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00001889
1890 if (!write && !first && left && !err)
1891 err = proc_put_char(&buffer, &left, '\n');
J. R. Okajima563b0462010-05-25 16:10:14 -07001892 if (write && !err && left)
Amerigo Wang00b7c332010-05-05 00:26:45 +00001893 left -= proc_skip_spaces(&kbuf);
1894free:
1895 if (write) {
1896 free_page(page);
1897 if (first)
1898 return err ? : -EINVAL;
1899 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001900 *lenp -= left;
1901 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001902 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001903}
1904
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001905static int do_proc_dointvec(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001906 void __user *buffer, size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001907 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001908 int write, void *data),
1909 void *data)
1910{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001911 return __do_proc_dointvec(table->data, table, write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001912 buffer, lenp, ppos, conv, data);
1913}
1914
Linus Torvalds1da177e2005-04-16 15:20:36 -07001915/**
1916 * proc_dointvec - read a vector of integers
1917 * @table: the sysctl table
1918 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001919 * @buffer: the user buffer
1920 * @lenp: the size of the user buffer
1921 * @ppos: file position
1922 *
1923 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1924 * values from/to the user buffer, treated as an ASCII string.
1925 *
1926 * Returns 0 on success.
1927 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001928int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001929 void __user *buffer, size_t *lenp, loff_t *ppos)
1930{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001931 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001932 NULL,NULL);
1933}
1934
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001935/*
Andi Kleen25ddbb12008-10-15 22:01:41 -07001936 * Taint values can only be increased
1937 * This means we can safely use a temporary.
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001938 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001939static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001940 void __user *buffer, size_t *lenp, loff_t *ppos)
1941{
Andi Kleen25ddbb12008-10-15 22:01:41 -07001942 struct ctl_table t;
1943 unsigned long tmptaint = get_taint();
1944 int err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001945
Bastian Blank91fcd412007-04-23 14:41:14 -07001946 if (write && !capable(CAP_SYS_ADMIN))
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001947 return -EPERM;
1948
Andi Kleen25ddbb12008-10-15 22:01:41 -07001949 t = *table;
1950 t.data = &tmptaint;
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001951 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
Andi Kleen25ddbb12008-10-15 22:01:41 -07001952 if (err < 0)
1953 return err;
1954
1955 if (write) {
1956 /*
1957 * Poor man's atomic or. Not worth adding a primitive
1958 * to everyone's atomic.h for this
1959 */
1960 int i;
1961 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
1962 if ((tmptaint >> i) & 1)
1963 add_taint(i);
1964 }
1965 }
1966
1967 return err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001968}
1969
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001970#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -07001971static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001972 void __user *buffer, size_t *lenp, loff_t *ppos)
1973{
1974 if (write && !capable(CAP_SYS_ADMIN))
1975 return -EPERM;
1976
1977 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
1978}
1979#endif
1980
Linus Torvalds1da177e2005-04-16 15:20:36 -07001981struct do_proc_dointvec_minmax_conv_param {
1982 int *min;
1983 int *max;
1984};
1985
Amerigo Wang00b7c332010-05-05 00:26:45 +00001986static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
1987 int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001988 int write, void *data)
1989{
1990 struct do_proc_dointvec_minmax_conv_param *param = data;
1991 if (write) {
1992 int val = *negp ? -*lvalp : *lvalp;
1993 if ((param->min && *param->min > val) ||
1994 (param->max && *param->max < val))
1995 return -EINVAL;
1996 *valp = val;
1997 } else {
1998 int val = *valp;
1999 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002000 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002001 *lvalp = (unsigned long)-val;
2002 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002003 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002004 *lvalp = (unsigned long)val;
2005 }
2006 }
2007 return 0;
2008}
2009
2010/**
2011 * proc_dointvec_minmax - read a vector of integers with min/max values
2012 * @table: the sysctl table
2013 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002014 * @buffer: the user buffer
2015 * @lenp: the size of the user buffer
2016 * @ppos: file position
2017 *
2018 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2019 * values from/to the user buffer, treated as an ASCII string.
2020 *
2021 * This routine will ensure the values are within the range specified by
2022 * table->extra1 (min) and table->extra2 (max).
2023 *
2024 * Returns 0 on success.
2025 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002026int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002027 void __user *buffer, size_t *lenp, loff_t *ppos)
2028{
2029 struct do_proc_dointvec_minmax_conv_param param = {
2030 .min = (int *) table->extra1,
2031 .max = (int *) table->extra2,
2032 };
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002033 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002034 do_proc_dointvec_minmax_conv, &param);
2035}
2036
Kees Cook54b50192012-07-30 14:39:18 -07002037static void validate_coredump_safety(void)
2038{
2039 if (suid_dumpable == SUID_DUMPABLE_SAFE &&
2040 core_pattern[0] != '/' && core_pattern[0] != '|') {
2041 printk(KERN_WARNING "Unsafe core_pattern used with "\
2042 "suid_dumpable=2. Pipe handler or fully qualified "\
2043 "core dump path required.\n");
2044 }
2045}
2046
2047static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
2048 void __user *buffer, size_t *lenp, loff_t *ppos)
2049{
2050 int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
2051 if (!error)
2052 validate_coredump_safety();
2053 return error;
2054}
2055
2056static int proc_dostring_coredump(struct ctl_table *table, int write,
2057 void __user *buffer, size_t *lenp, loff_t *ppos)
2058{
2059 int error = proc_dostring(table, write, buffer, lenp, ppos);
2060 if (!error)
2061 validate_coredump_safety();
2062 return error;
2063}
2064
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002065static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002066 void __user *buffer,
2067 size_t *lenp, loff_t *ppos,
2068 unsigned long convmul,
2069 unsigned long convdiv)
2070{
Amerigo Wang00b7c332010-05-05 00:26:45 +00002071 unsigned long *i, *min, *max;
2072 int vleft, first = 1, err = 0;
2073 unsigned long page = 0;
2074 size_t left;
2075 char *kbuf;
2076
2077 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002078 *lenp = 0;
2079 return 0;
2080 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002081
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002082 i = (unsigned long *) data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002083 min = (unsigned long *) table->extra1;
2084 max = (unsigned long *) table->extra2;
2085 vleft = table->maxlen / sizeof(unsigned long);
2086 left = *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002087
2088 if (write) {
2089 if (left > PAGE_SIZE - 1)
2090 left = PAGE_SIZE - 1;
2091 page = __get_free_page(GFP_TEMPORARY);
2092 kbuf = (char *) page;
2093 if (!kbuf)
2094 return -ENOMEM;
2095 if (copy_from_user(kbuf, buffer, left)) {
2096 err = -EFAULT;
2097 goto free;
2098 }
2099 kbuf[left] = 0;
2100 }
2101
Eric Dumazet27b3d802010-10-07 12:59:29 -07002102 for (; left && vleft--; i++, first = 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002103 unsigned long val;
2104
Linus Torvalds1da177e2005-04-16 15:20:36 -07002105 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002106 bool neg;
2107
2108 left -= proc_skip_spaces(&kbuf);
2109
2110 err = proc_get_long(&kbuf, &left, &val, &neg,
2111 proc_wspace_sep,
2112 sizeof(proc_wspace_sep), NULL);
2113 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002114 break;
2115 if (neg)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002116 continue;
2117 if ((min && val < *min) || (max && val > *max))
2118 continue;
2119 *i = val;
2120 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002121 val = convdiv * (*i) / convmul;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002122 if (!first)
Amerigo Wang00b7c332010-05-05 00:26:45 +00002123 err = proc_put_char(&buffer, &left, '\t');
2124 err = proc_put_long(&buffer, &left, val, false);
2125 if (err)
2126 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002127 }
2128 }
2129
Amerigo Wang00b7c332010-05-05 00:26:45 +00002130 if (!write && !first && left && !err)
2131 err = proc_put_char(&buffer, &left, '\n');
2132 if (write && !err)
2133 left -= proc_skip_spaces(&kbuf);
2134free:
Linus Torvalds1da177e2005-04-16 15:20:36 -07002135 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002136 free_page(page);
2137 if (first)
2138 return err ? : -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002139 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002140 *lenp -= left;
2141 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002142 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002143}
2144
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002145static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002146 void __user *buffer,
2147 size_t *lenp, loff_t *ppos,
2148 unsigned long convmul,
2149 unsigned long convdiv)
2150{
2151 return __do_proc_doulongvec_minmax(table->data, table, write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002152 buffer, lenp, ppos, convmul, convdiv);
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002153}
2154
Linus Torvalds1da177e2005-04-16 15:20:36 -07002155/**
2156 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2157 * @table: the sysctl table
2158 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002159 * @buffer: the user buffer
2160 * @lenp: the size of the user buffer
2161 * @ppos: file position
2162 *
2163 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2164 * values from/to the user buffer, treated as an ASCII string.
2165 *
2166 * This routine will ensure the values are within the range specified by
2167 * table->extra1 (min) and table->extra2 (max).
2168 *
2169 * Returns 0 on success.
2170 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002171int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002172 void __user *buffer, size_t *lenp, loff_t *ppos)
2173{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002174 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002175}
2176
2177/**
2178 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2179 * @table: the sysctl table
2180 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002181 * @buffer: the user buffer
2182 * @lenp: the size of the user buffer
2183 * @ppos: file position
2184 *
2185 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2186 * values from/to the user buffer, treated as an ASCII string. The values
2187 * are treated as milliseconds, and converted to jiffies when they are stored.
2188 *
2189 * This routine will ensure the values are within the range specified by
2190 * table->extra1 (min) and table->extra2 (max).
2191 *
2192 * Returns 0 on success.
2193 */
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002194int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002195 void __user *buffer,
2196 size_t *lenp, loff_t *ppos)
2197{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002198 return do_proc_doulongvec_minmax(table, write, buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002199 lenp, ppos, HZ, 1000l);
2200}
2201
2202
Amerigo Wang00b7c332010-05-05 00:26:45 +00002203static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002204 int *valp,
2205 int write, void *data)
2206{
2207 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002208 if (*lvalp > LONG_MAX / HZ)
2209 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002210 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2211 } else {
2212 int val = *valp;
2213 unsigned long lval;
2214 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002215 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002216 lval = (unsigned long)-val;
2217 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002218 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002219 lval = (unsigned long)val;
2220 }
2221 *lvalp = lval / HZ;
2222 }
2223 return 0;
2224}
2225
Amerigo Wang00b7c332010-05-05 00:26:45 +00002226static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002227 int *valp,
2228 int write, void *data)
2229{
2230 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002231 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2232 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002233 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2234 } else {
2235 int val = *valp;
2236 unsigned long lval;
2237 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002238 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002239 lval = (unsigned long)-val;
2240 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002241 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002242 lval = (unsigned long)val;
2243 }
2244 *lvalp = jiffies_to_clock_t(lval);
2245 }
2246 return 0;
2247}
2248
Amerigo Wang00b7c332010-05-05 00:26:45 +00002249static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002250 int *valp,
2251 int write, void *data)
2252{
2253 if (write) {
2254 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2255 } else {
2256 int val = *valp;
2257 unsigned long lval;
2258 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002259 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002260 lval = (unsigned long)-val;
2261 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002262 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002263 lval = (unsigned long)val;
2264 }
2265 *lvalp = jiffies_to_msecs(lval);
2266 }
2267 return 0;
2268}
2269
2270/**
2271 * proc_dointvec_jiffies - read a vector of integers as seconds
2272 * @table: the sysctl table
2273 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002274 * @buffer: the user buffer
2275 * @lenp: the size of the user buffer
2276 * @ppos: file position
2277 *
2278 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2279 * values from/to the user buffer, treated as an ASCII string.
2280 * The values read are assumed to be in seconds, and are converted into
2281 * jiffies.
2282 *
2283 * Returns 0 on success.
2284 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002285int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002286 void __user *buffer, size_t *lenp, loff_t *ppos)
2287{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002288 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002289 do_proc_dointvec_jiffies_conv,NULL);
2290}
2291
2292/**
2293 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2294 * @table: the sysctl table
2295 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002296 * @buffer: the user buffer
2297 * @lenp: the size of the user buffer
Randy Dunlap1e5d5332005-11-07 01:01:06 -08002298 * @ppos: pointer to the file position
Linus Torvalds1da177e2005-04-16 15:20:36 -07002299 *
2300 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2301 * values from/to the user buffer, treated as an ASCII string.
2302 * The values read are assumed to be in 1/USER_HZ seconds, and
2303 * are converted into jiffies.
2304 *
2305 * Returns 0 on success.
2306 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002307int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002308 void __user *buffer, size_t *lenp, loff_t *ppos)
2309{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002310 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002311 do_proc_dointvec_userhz_jiffies_conv,NULL);
2312}
2313
2314/**
2315 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2316 * @table: the sysctl table
2317 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002318 * @buffer: the user buffer
2319 * @lenp: the size of the user buffer
Martin Waitz67be2dd2005-05-01 08:59:26 -07002320 * @ppos: file position
2321 * @ppos: the current position in the file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002322 *
2323 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2324 * values from/to the user buffer, treated as an ASCII string.
2325 * The values read are assumed to be in 1/1000 seconds, and
2326 * are converted into jiffies.
2327 *
2328 * Returns 0 on success.
2329 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002330int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002331 void __user *buffer, size_t *lenp, loff_t *ppos)
2332{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002333 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002334 do_proc_dointvec_ms_jiffies_conv, NULL);
2335}
2336
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002337static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002338 void __user *buffer, size_t *lenp, loff_t *ppos)
2339{
2340 struct pid *new_pid;
2341 pid_t tmp;
2342 int r;
2343
Pavel Emelyanov6c5f3e72008-02-08 04:19:20 -08002344 tmp = pid_vnr(cad_pid);
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002345
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002346 r = __do_proc_dointvec(&tmp, table, write, buffer,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002347 lenp, ppos, NULL, NULL);
2348 if (r || !write)
2349 return r;
2350
2351 new_pid = find_get_pid(tmp);
2352 if (!new_pid)
2353 return -ESRCH;
2354
2355 put_pid(xchg(&cad_pid, new_pid));
2356 return 0;
2357}
2358
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002359/**
2360 * proc_do_large_bitmap - read/write from/to a large bitmap
2361 * @table: the sysctl table
2362 * @write: %TRUE if this is a write to the sysctl file
2363 * @buffer: the user buffer
2364 * @lenp: the size of the user buffer
2365 * @ppos: file position
2366 *
2367 * The bitmap is stored at table->data and the bitmap length (in bits)
2368 * in table->maxlen.
2369 *
2370 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2371 * large bitmaps may be represented in a compact manner. Writing into
2372 * the file will clear the bitmap then update it with the given input.
2373 *
2374 * Returns 0 on success.
2375 */
2376int proc_do_large_bitmap(struct ctl_table *table, int write,
2377 void __user *buffer, size_t *lenp, loff_t *ppos)
2378{
2379 int err = 0;
2380 bool first = 1;
2381 size_t left = *lenp;
2382 unsigned long bitmap_len = table->maxlen;
2383 unsigned long *bitmap = (unsigned long *) table->data;
2384 unsigned long *tmp_bitmap = NULL;
2385 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2386
2387 if (!bitmap_len || !left || (*ppos && !write)) {
2388 *lenp = 0;
2389 return 0;
2390 }
2391
2392 if (write) {
2393 unsigned long page = 0;
2394 char *kbuf;
2395
2396 if (left > PAGE_SIZE - 1)
2397 left = PAGE_SIZE - 1;
2398
2399 page = __get_free_page(GFP_TEMPORARY);
2400 kbuf = (char *) page;
2401 if (!kbuf)
2402 return -ENOMEM;
2403 if (copy_from_user(kbuf, buffer, left)) {
2404 free_page(page);
2405 return -EFAULT;
2406 }
2407 kbuf[left] = 0;
2408
2409 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2410 GFP_KERNEL);
2411 if (!tmp_bitmap) {
2412 free_page(page);
2413 return -ENOMEM;
2414 }
2415 proc_skip_char(&kbuf, &left, '\n');
2416 while (!err && left) {
2417 unsigned long val_a, val_b;
2418 bool neg;
2419
2420 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2421 sizeof(tr_a), &c);
2422 if (err)
2423 break;
2424 if (val_a >= bitmap_len || neg) {
2425 err = -EINVAL;
2426 break;
2427 }
2428
2429 val_b = val_a;
2430 if (left) {
2431 kbuf++;
2432 left--;
2433 }
2434
2435 if (c == '-') {
2436 err = proc_get_long(&kbuf, &left, &val_b,
2437 &neg, tr_b, sizeof(tr_b),
2438 &c);
2439 if (err)
2440 break;
2441 if (val_b >= bitmap_len || neg ||
2442 val_a > val_b) {
2443 err = -EINVAL;
2444 break;
2445 }
2446 if (left) {
2447 kbuf++;
2448 left--;
2449 }
2450 }
2451
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002452 bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002453 first = 0;
2454 proc_skip_char(&kbuf, &left, '\n');
2455 }
2456 free_page(page);
2457 } else {
2458 unsigned long bit_a, bit_b = 0;
2459
2460 while (left) {
2461 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2462 if (bit_a >= bitmap_len)
2463 break;
2464 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2465 bit_a + 1) - 1;
2466
2467 if (!first) {
2468 err = proc_put_char(&buffer, &left, ',');
2469 if (err)
2470 break;
2471 }
2472 err = proc_put_long(&buffer, &left, bit_a, false);
2473 if (err)
2474 break;
2475 if (bit_a != bit_b) {
2476 err = proc_put_char(&buffer, &left, '-');
2477 if (err)
2478 break;
2479 err = proc_put_long(&buffer, &left, bit_b, false);
2480 if (err)
2481 break;
2482 }
2483
2484 first = 0; bit_b++;
2485 }
2486 if (!err)
2487 err = proc_put_char(&buffer, &left, '\n');
2488 }
2489
2490 if (!err) {
2491 if (write) {
2492 if (*ppos)
2493 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2494 else
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002495 bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002496 }
2497 kfree(tmp_bitmap);
2498 *lenp -= left;
2499 *ppos += *lenp;
2500 return 0;
2501 } else {
2502 kfree(tmp_bitmap);
2503 return err;
2504 }
2505}
2506
Jovi Zhang55610502011-01-12 17:00:45 -08002507#else /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002508
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002509int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002510 void __user *buffer, size_t *lenp, loff_t *ppos)
2511{
2512 return -ENOSYS;
2513}
2514
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002515int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002516 void __user *buffer, size_t *lenp, loff_t *ppos)
2517{
2518 return -ENOSYS;
2519}
2520
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002521int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002522 void __user *buffer, size_t *lenp, loff_t *ppos)
2523{
2524 return -ENOSYS;
2525}
2526
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002527int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002528 void __user *buffer, size_t *lenp, loff_t *ppos)
2529{
2530 return -ENOSYS;
2531}
2532
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002533int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002534 void __user *buffer, size_t *lenp, loff_t *ppos)
2535{
2536 return -ENOSYS;
2537}
2538
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002539int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002540 void __user *buffer, size_t *lenp, loff_t *ppos)
2541{
2542 return -ENOSYS;
2543}
2544
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002545int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002546 void __user *buffer, size_t *lenp, loff_t *ppos)
2547{
2548 return -ENOSYS;
2549}
2550
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002551int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002552 void __user *buffer,
2553 size_t *lenp, loff_t *ppos)
2554{
2555 return -ENOSYS;
2556}
2557
2558
Jovi Zhang55610502011-01-12 17:00:45 -08002559#endif /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002560
Linus Torvalds1da177e2005-04-16 15:20:36 -07002561/*
2562 * No sense putting this after each symbol definition, twice,
2563 * exception granted :-)
2564 */
2565EXPORT_SYMBOL(proc_dointvec);
2566EXPORT_SYMBOL(proc_dointvec_jiffies);
2567EXPORT_SYMBOL(proc_dointvec_minmax);
2568EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2569EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2570EXPORT_SYMBOL(proc_dostring);
2571EXPORT_SYMBOL(proc_doulongvec_minmax);
2572EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);