blob: 97186b99b0e40326a739e8b086abb4859f6d1eab [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 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001104 .procname = "nr_pdflush_threads",
1105 .data = &nr_pdflush_threads,
1106 .maxlen = sizeof nr_pdflush_threads,
1107 .mode = 0444 /* read-only*/,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001108 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001109 },
1110 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001111 .procname = "swappiness",
1112 .data = &vm_swappiness,
1113 .maxlen = sizeof(vm_swappiness),
1114 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001115 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001116 .extra1 = &zero,
1117 .extra2 = &one_hundred,
1118 },
1119#ifdef CONFIG_HUGETLB_PAGE
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001120 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001121 .procname = "nr_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001122 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001123 .maxlen = sizeof(unsigned long),
1124 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001125 .proc_handler = hugetlb_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001126 .extra1 = (void *)&hugetlb_zero,
1127 .extra2 = (void *)&hugetlb_infinity,
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001128 },
1129#ifdef CONFIG_NUMA
1130 {
1131 .procname = "nr_hugepages_mempolicy",
1132 .data = NULL,
1133 .maxlen = sizeof(unsigned long),
1134 .mode = 0644,
1135 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1136 .extra1 = (void *)&hugetlb_zero,
1137 .extra2 = (void *)&hugetlb_infinity,
1138 },
1139#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001140 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001141 .procname = "hugetlb_shm_group",
1142 .data = &sysctl_hugetlb_shm_group,
1143 .maxlen = sizeof(gid_t),
1144 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001145 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001146 },
Mel Gorman396faf02007-07-17 04:03:13 -07001147 {
Mel Gorman396faf02007-07-17 04:03:13 -07001148 .procname = "hugepages_treat_as_movable",
1149 .data = &hugepages_treat_as_movable,
1150 .maxlen = sizeof(int),
1151 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001152 .proc_handler = hugetlb_treat_movable_handler,
Mel Gorman396faf02007-07-17 04:03:13 -07001153 },
Adam Litke54f9f802007-10-16 01:26:20 -07001154 {
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001155 .procname = "nr_overcommit_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001156 .data = NULL,
1157 .maxlen = sizeof(unsigned long),
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001158 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001159 .proc_handler = hugetlb_overcommit_handler,
Andi Kleene5ff2152008-07-23 21:27:42 -07001160 .extra1 = (void *)&hugetlb_zero,
1161 .extra2 = (void *)&hugetlb_infinity,
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001162 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001163#endif
1164 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001165 .procname = "lowmem_reserve_ratio",
1166 .data = &sysctl_lowmem_reserve_ratio,
1167 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1168 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001169 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001170 },
1171 {
Andrew Morton9d0243b2006-01-08 01:00:39 -08001172 .procname = "drop_caches",
1173 .data = &sysctl_drop_caches,
1174 .maxlen = sizeof(int),
1175 .mode = 0644,
1176 .proc_handler = drop_caches_sysctl_handler,
Petr Holasekcb16e952011-03-23 16:43:09 -07001177 .extra1 = &one,
1178 .extra2 = &three,
Andrew Morton9d0243b2006-01-08 01:00:39 -08001179 },
Mel Gorman76ab0f52010-05-24 14:32:28 -07001180#ifdef CONFIG_COMPACTION
1181 {
1182 .procname = "compact_memory",
1183 .data = &sysctl_compact_memory,
1184 .maxlen = sizeof(int),
1185 .mode = 0200,
1186 .proc_handler = sysctl_compaction_handler,
1187 },
Mel Gorman5e771902010-05-24 14:32:31 -07001188 {
1189 .procname = "extfrag_threshold",
1190 .data = &sysctl_extfrag_threshold,
1191 .maxlen = sizeof(int),
1192 .mode = 0644,
1193 .proc_handler = sysctl_extfrag_handler,
1194 .extra1 = &min_extfrag_threshold,
1195 .extra2 = &max_extfrag_threshold,
1196 },
1197
Mel Gorman76ab0f52010-05-24 14:32:28 -07001198#endif /* CONFIG_COMPACTION */
Andrew Morton9d0243b2006-01-08 01:00:39 -08001199 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001200 .procname = "min_free_kbytes",
1201 .data = &min_free_kbytes,
1202 .maxlen = sizeof(min_free_kbytes),
1203 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001204 .proc_handler = min_free_kbytes_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001205 .extra1 = &zero,
1206 },
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001207 {
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001208 .procname = "percpu_pagelist_fraction",
1209 .data = &percpu_pagelist_fraction,
1210 .maxlen = sizeof(percpu_pagelist_fraction),
1211 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001212 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001213 .extra1 = &min_percpu_pagelist_fract,
1214 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001215#ifdef CONFIG_MMU
1216 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001217 .procname = "max_map_count",
1218 .data = &sysctl_max_map_count,
1219 .maxlen = sizeof(sysctl_max_map_count),
1220 .mode = 0644,
WANG Cong3e261202009-12-17 15:27:05 -08001221 .proc_handler = proc_dointvec_minmax,
Amerigo Wang70da2342009-12-14 17:59:52 -08001222 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001223 },
Paul Mundtdd8632a2009-01-08 12:04:47 +00001224#else
1225 {
Paul Mundtdd8632a2009-01-08 12:04:47 +00001226 .procname = "nr_trim_pages",
1227 .data = &sysctl_nr_trim_pages,
1228 .maxlen = sizeof(sysctl_nr_trim_pages),
1229 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001230 .proc_handler = proc_dointvec_minmax,
Paul Mundtdd8632a2009-01-08 12:04:47 +00001231 .extra1 = &zero,
1232 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001233#endif
1234 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001235 .procname = "laptop_mode",
1236 .data = &laptop_mode,
1237 .maxlen = sizeof(laptop_mode),
1238 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001239 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001240 },
1241 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001242 .procname = "block_dump",
1243 .data = &block_dump,
1244 .maxlen = sizeof(block_dump),
1245 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001246 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001247 .extra1 = &zero,
1248 },
1249 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001250 .procname = "vfs_cache_pressure",
1251 .data = &sysctl_vfs_cache_pressure,
1252 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1253 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001254 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001255 .extra1 = &zero,
1256 },
1257#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1258 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001259 .procname = "legacy_va_layout",
1260 .data = &sysctl_legacy_va_layout,
1261 .maxlen = sizeof(sysctl_legacy_va_layout),
1262 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001263 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001264 .extra1 = &zero,
1265 },
1266#endif
Christoph Lameter17436602006-01-18 17:42:32 -08001267#ifdef CONFIG_NUMA
1268 {
Christoph Lameter17436602006-01-18 17:42:32 -08001269 .procname = "zone_reclaim_mode",
1270 .data = &zone_reclaim_mode,
1271 .maxlen = sizeof(zone_reclaim_mode),
1272 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001273 .proc_handler = proc_dointvec,
Christoph Lameterc84db232006-02-01 03:05:29 -08001274 .extra1 = &zero,
Christoph Lameter17436602006-01-18 17:42:32 -08001275 },
Christoph Lameter96146342006-07-03 00:24:13 -07001276 {
Christoph Lameter96146342006-07-03 00:24:13 -07001277 .procname = "min_unmapped_ratio",
1278 .data = &sysctl_min_unmapped_ratio,
1279 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1280 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001281 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
Christoph Lameter96146342006-07-03 00:24:13 -07001282 .extra1 = &zero,
1283 .extra2 = &one_hundred,
1284 },
Christoph Lameter0ff38492006-09-25 23:31:52 -07001285 {
Christoph Lameter0ff38492006-09-25 23:31:52 -07001286 .procname = "min_slab_ratio",
1287 .data = &sysctl_min_slab_ratio,
1288 .maxlen = sizeof(sysctl_min_slab_ratio),
1289 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001290 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
Christoph Lameter0ff38492006-09-25 23:31:52 -07001291 .extra1 = &zero,
1292 .extra2 = &one_hundred,
1293 },
Christoph Lameter17436602006-01-18 17:42:32 -08001294#endif
Christoph Lameter77461ab2007-05-09 02:35:13 -07001295#ifdef CONFIG_SMP
1296 {
Christoph Lameter77461ab2007-05-09 02:35:13 -07001297 .procname = "stat_interval",
1298 .data = &sysctl_stat_interval,
1299 .maxlen = sizeof(sysctl_stat_interval),
1300 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001301 .proc_handler = proc_dointvec_jiffies,
Christoph Lameter77461ab2007-05-09 02:35:13 -07001302 },
1303#endif
David Howells6e141542009-12-15 19:27:45 +00001304#ifdef CONFIG_MMU
Eric Parised032182007-06-28 15:55:21 -04001305 {
Eric Parised032182007-06-28 15:55:21 -04001306 .procname = "mmap_min_addr",
Eric Paris788084a2009-07-31 12:54:11 -04001307 .data = &dac_mmap_min_addr,
1308 .maxlen = sizeof(unsigned long),
Eric Parised032182007-06-28 15:55:21 -04001309 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001310 .proc_handler = mmap_min_addr_handler,
Eric Parised032182007-06-28 15:55:21 -04001311 },
David Howells6e141542009-12-15 19:27:45 +00001312#endif
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001313#ifdef CONFIG_NUMA
1314 {
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001315 .procname = "numa_zonelist_order",
1316 .data = &numa_zonelist_order,
1317 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1318 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001319 .proc_handler = numa_zonelist_order_handler,
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001320 },
1321#endif
Al Viro2b8232c2007-10-13 08:16:04 +01001322#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
Paul Mundt5c36e652007-03-01 10:07:42 +09001323 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
Ingo Molnare6e54942006-06-27 02:53:50 -07001324 {
Ingo Molnare6e54942006-06-27 02:53:50 -07001325 .procname = "vdso_enabled",
1326 .data = &vdso_enabled,
1327 .maxlen = sizeof(vdso_enabled),
1328 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001329 .proc_handler = proc_dointvec,
Ingo Molnare6e54942006-06-27 02:53:50 -07001330 .extra1 = &zero,
1331 },
1332#endif
Bron Gondwana195cf4532008-02-04 22:29:20 -08001333#ifdef CONFIG_HIGHMEM
1334 {
Bron Gondwana195cf4532008-02-04 22:29:20 -08001335 .procname = "highmem_is_dirtyable",
1336 .data = &vm_highmem_is_dirtyable,
1337 .maxlen = sizeof(vm_highmem_is_dirtyable),
1338 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001339 .proc_handler = proc_dointvec_minmax,
Bron Gondwana195cf4532008-02-04 22:29:20 -08001340 .extra1 = &zero,
1341 .extra2 = &one,
1342 },
1343#endif
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001344 {
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001345 .procname = "scan_unevictable_pages",
1346 .data = &scan_unevictable_pages,
1347 .maxlen = sizeof(scan_unevictable_pages),
1348 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001349 .proc_handler = scan_unevictable_handler,
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001350 },
Andi Kleen6a460792009-09-16 11:50:15 +02001351#ifdef CONFIG_MEMORY_FAILURE
1352 {
Andi Kleen6a460792009-09-16 11:50:15 +02001353 .procname = "memory_failure_early_kill",
1354 .data = &sysctl_memory_failure_early_kill,
1355 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1356 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001357 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001358 .extra1 = &zero,
1359 .extra2 = &one,
1360 },
1361 {
Andi Kleen6a460792009-09-16 11:50:15 +02001362 .procname = "memory_failure_recovery",
1363 .data = &sysctl_memory_failure_recovery,
1364 .maxlen = sizeof(sysctl_memory_failure_recovery),
1365 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001366 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001367 .extra1 = &zero,
1368 .extra2 = &one,
1369 },
1370#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001371 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001372};
1373
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001374#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001375static struct ctl_table binfmt_misc_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001376 { }
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001377};
1378#endif
1379
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001380static struct ctl_table fs_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001381 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001382 .procname = "inode-nr",
1383 .data = &inodes_stat,
1384 .maxlen = 2*sizeof(int),
1385 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001386 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001387 },
1388 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001389 .procname = "inode-state",
1390 .data = &inodes_stat,
1391 .maxlen = 7*sizeof(int),
1392 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001393 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001394 },
1395 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001396 .procname = "file-nr",
1397 .data = &files_stat,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001398 .maxlen = sizeof(files_stat),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001399 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001400 .proc_handler = proc_nr_files,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001401 },
1402 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001403 .procname = "file-max",
1404 .data = &files_stat.max_files,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001405 .maxlen = sizeof(files_stat.max_files),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001406 .mode = 0644,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001407 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001408 },
1409 {
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001410 .procname = "nr_open",
1411 .data = &sysctl_nr_open,
1412 .maxlen = sizeof(int),
1413 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001414 .proc_handler = proc_dointvec_minmax,
Al Viroeceea0b2008-05-10 10:08:32 -04001415 .extra1 = &sysctl_nr_open_min,
1416 .extra2 = &sysctl_nr_open_max,
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001417 },
1418 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001419 .procname = "dentry-state",
1420 .data = &dentry_stat,
1421 .maxlen = 6*sizeof(int),
1422 .mode = 0444,
Christoph Hellwig312d3ca2010-10-10 05:36:23 -04001423 .proc_handler = proc_nr_dentry,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001424 },
1425 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001426 .procname = "overflowuid",
1427 .data = &fs_overflowuid,
1428 .maxlen = sizeof(int),
1429 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001430 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001431 .extra1 = &minolduid,
1432 .extra2 = &maxolduid,
1433 },
1434 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001435 .procname = "overflowgid",
1436 .data = &fs_overflowgid,
1437 .maxlen = sizeof(int),
1438 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001439 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001440 .extra1 = &minolduid,
1441 .extra2 = &maxolduid,
1442 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001443#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001444 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001445 .procname = "leases-enable",
1446 .data = &leases_enable,
1447 .maxlen = sizeof(int),
1448 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001449 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001450 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001451#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001452#ifdef CONFIG_DNOTIFY
1453 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001454 .procname = "dir-notify-enable",
1455 .data = &dir_notify_enable,
1456 .maxlen = sizeof(int),
1457 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001458 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001459 },
1460#endif
1461#ifdef CONFIG_MMU
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001462#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001463 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001464 .procname = "lease-break-time",
1465 .data = &lease_break_time,
1466 .maxlen = sizeof(int),
1467 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001468 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001469 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001470#endif
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001471#ifdef CONFIG_AIO
Linus Torvalds1da177e2005-04-16 15:20:36 -07001472 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001473 .procname = "aio-nr",
1474 .data = &aio_nr,
1475 .maxlen = sizeof(aio_nr),
1476 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001477 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001478 },
1479 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001480 .procname = "aio-max-nr",
1481 .data = &aio_max_nr,
1482 .maxlen = sizeof(aio_max_nr),
1483 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001484 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001485 },
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001486#endif /* CONFIG_AIO */
Amy Griffis2d9048e2006-06-01 13:10:59 -07001487#ifdef CONFIG_INOTIFY_USER
Robert Love0399cb02005-07-13 12:38:18 -04001488 {
Robert Love0399cb02005-07-13 12:38:18 -04001489 .procname = "inotify",
1490 .mode = 0555,
1491 .child = inotify_table,
1492 },
1493#endif
Davide Libenzi7ef99642008-12-01 13:13:55 -08001494#ifdef CONFIG_EPOLL
1495 {
1496 .procname = "epoll",
1497 .mode = 0555,
1498 .child = epoll_table,
1499 },
1500#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001501#endif
Alan Coxd6e71142005-06-23 00:09:43 -07001502 {
Alan Coxd6e71142005-06-23 00:09:43 -07001503 .procname = "suid_dumpable",
1504 .data = &suid_dumpable,
1505 .maxlen = sizeof(int),
1506 .mode = 0644,
Kees Cook54b50192012-07-30 14:39:18 -07001507 .proc_handler = proc_dointvec_minmax_coredump,
Matthew Wilcox8e654fb2009-04-02 16:58:33 -07001508 .extra1 = &zero,
1509 .extra2 = &two,
Alan Coxd6e71142005-06-23 00:09:43 -07001510 },
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001511#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1512 {
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001513 .procname = "binfmt_misc",
1514 .mode = 0555,
1515 .child = binfmt_misc_table,
1516 },
1517#endif
Jens Axboeb492e952010-05-19 21:03:16 +02001518 {
Jens Axboeff9da692010-06-03 14:54:39 +02001519 .procname = "pipe-max-size",
1520 .data = &pipe_max_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001521 .maxlen = sizeof(int),
1522 .mode = 0644,
Jens Axboeff9da692010-06-03 14:54:39 +02001523 .proc_handler = &pipe_proc_fn,
1524 .extra1 = &pipe_min_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001525 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001526 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001527};
1528
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001529static struct ctl_table debug_table[] = {
Heiko Carstensab3c68e2010-05-17 10:00:21 +02001530#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
Chris Metcalf571d76a2011-05-16 14:23:44 -04001531 defined(CONFIG_S390) || defined(CONFIG_TILE)
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001532 {
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001533 .procname = "exception-trace",
1534 .data = &show_unhandled_signals,
1535 .maxlen = sizeof(int),
1536 .mode = 0644,
1537 .proc_handler = proc_dointvec
1538 },
1539#endif
Masami Hiramatsub2be84d2010-02-25 08:34:15 -05001540#if defined(CONFIG_OPTPROBES)
1541 {
1542 .procname = "kprobes-optimization",
1543 .data = &sysctl_kprobes_optimization,
1544 .maxlen = sizeof(int),
1545 .mode = 0644,
1546 .proc_handler = proc_kprobes_optimization_handler,
1547 .extra1 = &zero,
1548 .extra2 = &one,
1549 },
1550#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001551 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001552};
1553
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001554static struct ctl_table dev_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001555 { }
Robert Love0eeca282005-07-12 17:06:03 -04001556};
Linus Torvalds1da177e2005-04-16 15:20:36 -07001557
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001558int __init sysctl_init(void)
Al Viro330d57f2005-11-04 10:18:40 +00001559{
Steven Rostedtfd4b6162012-07-30 14:42:48 -07001560 struct ctl_table_header *hdr;
1561
1562 hdr = register_sysctl_table(sysctl_base_table);
1563 kmemleak_not_leak(hdr);
Eric W. Biedermand912b0c2007-02-14 00:34:13 -08001564 return 0;
1565}
1566
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001567#endif /* CONFIG_SYSCTL */
1568
Linus Torvalds1da177e2005-04-16 15:20:36 -07001569/*
1570 * /proc/sys support
1571 */
1572
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001573#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -07001574
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001575static int _proc_do_string(void* data, int maxlen, int write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001576 void __user *buffer,
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001577 size_t *lenp, loff_t *ppos)
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001578{
1579 size_t len;
1580 char __user *p;
1581 char c;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001582
1583 if (!data || !maxlen || !*lenp) {
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001584 *lenp = 0;
1585 return 0;
1586 }
Oleg Nesterov8d060872007-02-10 01:46:38 -08001587
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001588 if (write) {
1589 len = 0;
1590 p = buffer;
1591 while (len < *lenp) {
1592 if (get_user(c, p++))
1593 return -EFAULT;
1594 if (c == 0 || c == '\n')
1595 break;
1596 len++;
1597 }
1598 if (len >= maxlen)
1599 len = maxlen-1;
1600 if(copy_from_user(data, buffer, len))
1601 return -EFAULT;
1602 ((char *) data)[len] = 0;
1603 *ppos += *lenp;
1604 } else {
1605 len = strlen(data);
1606 if (len > maxlen)
1607 len = maxlen;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001608
1609 if (*ppos > len) {
1610 *lenp = 0;
1611 return 0;
1612 }
1613
1614 data += *ppos;
1615 len -= *ppos;
1616
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001617 if (len > *lenp)
1618 len = *lenp;
1619 if (len)
1620 if(copy_to_user(buffer, data, len))
1621 return -EFAULT;
1622 if (len < *lenp) {
1623 if(put_user('\n', ((char __user *) buffer) + len))
1624 return -EFAULT;
1625 len++;
1626 }
1627 *lenp = len;
1628 *ppos += len;
1629 }
1630 return 0;
1631}
1632
Linus Torvalds1da177e2005-04-16 15:20:36 -07001633/**
1634 * proc_dostring - read a string sysctl
1635 * @table: the sysctl table
1636 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001637 * @buffer: the user buffer
1638 * @lenp: the size of the user buffer
1639 * @ppos: file position
1640 *
1641 * Reads/writes a string from/to the user buffer. If the kernel
1642 * buffer provided is not large enough to hold the string, the
1643 * string is truncated. The copied string is %NULL-terminated.
1644 * If the string is being read by the user process, it is copied
1645 * and a newline '\n' is added. It is truncated if the buffer is
1646 * not large enough.
1647 *
1648 * Returns 0 on success.
1649 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001650int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001651 void __user *buffer, size_t *lenp, loff_t *ppos)
1652{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001653 return _proc_do_string(table->data, table->maxlen, write,
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001654 buffer, lenp, ppos);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001655}
1656
Amerigo Wang00b7c332010-05-05 00:26:45 +00001657static size_t proc_skip_spaces(char **buf)
1658{
1659 size_t ret;
1660 char *tmp = skip_spaces(*buf);
1661 ret = tmp - *buf;
1662 *buf = tmp;
1663 return ret;
1664}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001665
Octavian Purdila9f977fb2010-05-05 00:26:55 +00001666static void proc_skip_char(char **buf, size_t *size, const char v)
1667{
1668 while (*size) {
1669 if (**buf != v)
1670 break;
1671 (*size)--;
1672 (*buf)++;
1673 }
1674}
1675
Amerigo Wang00b7c332010-05-05 00:26:45 +00001676#define TMPBUFLEN 22
1677/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001678 * proc_get_long - reads an ASCII formatted integer from a user buffer
Amerigo Wang00b7c332010-05-05 00:26:45 +00001679 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001680 * @buf: a kernel buffer
1681 * @size: size of the kernel buffer
1682 * @val: this is where the number will be stored
1683 * @neg: set to %TRUE if number is negative
1684 * @perm_tr: a vector which contains the allowed trailers
1685 * @perm_tr_len: size of the perm_tr vector
1686 * @tr: pointer to store the trailer character
Amerigo Wang00b7c332010-05-05 00:26:45 +00001687 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001688 * In case of success %0 is returned and @buf and @size are updated with
1689 * the amount of bytes read. If @tr is non-NULL and a trailing
1690 * character exists (size is non-zero after returning from this
1691 * function), @tr is updated with the trailing character.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001692 */
1693static int proc_get_long(char **buf, size_t *size,
1694 unsigned long *val, bool *neg,
1695 const char *perm_tr, unsigned perm_tr_len, char *tr)
1696{
1697 int len;
1698 char *p, tmp[TMPBUFLEN];
1699
1700 if (!*size)
1701 return -EINVAL;
1702
1703 len = *size;
1704 if (len > TMPBUFLEN - 1)
1705 len = TMPBUFLEN - 1;
1706
1707 memcpy(tmp, *buf, len);
1708
1709 tmp[len] = 0;
1710 p = tmp;
1711 if (*p == '-' && *size > 1) {
1712 *neg = true;
1713 p++;
1714 } else
1715 *neg = false;
1716 if (!isdigit(*p))
1717 return -EINVAL;
1718
1719 *val = simple_strtoul(p, &p, 0);
1720
1721 len = p - tmp;
1722
1723 /* We don't know if the next char is whitespace thus we may accept
1724 * invalid integers (e.g. 1234...a) or two integers instead of one
1725 * (e.g. 123...1). So lets not allow such large numbers. */
1726 if (len == TMPBUFLEN - 1)
1727 return -EINVAL;
1728
1729 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
1730 return -EINVAL;
1731
1732 if (tr && (len < *size))
1733 *tr = *p;
1734
1735 *buf += len;
1736 *size -= len;
1737
1738 return 0;
1739}
1740
1741/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001742 * proc_put_long - converts an integer to a decimal ASCII formatted string
Amerigo Wang00b7c332010-05-05 00:26:45 +00001743 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001744 * @buf: the user buffer
1745 * @size: the size of the user buffer
1746 * @val: the integer to be converted
1747 * @neg: sign of the number, %TRUE for negative
Amerigo Wang00b7c332010-05-05 00:26:45 +00001748 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001749 * In case of success %0 is returned and @buf and @size are updated with
1750 * the amount of bytes written.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001751 */
1752static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
1753 bool neg)
1754{
1755 int len;
1756 char tmp[TMPBUFLEN], *p = tmp;
1757
1758 sprintf(p, "%s%lu", neg ? "-" : "", val);
1759 len = strlen(tmp);
1760 if (len > *size)
1761 len = *size;
1762 if (copy_to_user(*buf, tmp, len))
1763 return -EFAULT;
1764 *size -= len;
1765 *buf += len;
1766 return 0;
1767}
1768#undef TMPBUFLEN
1769
1770static int proc_put_char(void __user **buf, size_t *size, char c)
1771{
1772 if (*size) {
1773 char __user **buffer = (char __user **)buf;
1774 if (put_user(c, *buffer))
1775 return -EFAULT;
1776 (*size)--, (*buffer)++;
1777 *buf = *buffer;
1778 }
1779 return 0;
1780}
1781
1782static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001783 int *valp,
1784 int write, void *data)
1785{
1786 if (write) {
1787 *valp = *negp ? -*lvalp : *lvalp;
1788 } else {
1789 int val = *valp;
1790 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001791 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001792 *lvalp = (unsigned long)-val;
1793 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001794 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001795 *lvalp = (unsigned long)val;
1796 }
1797 }
1798 return 0;
1799}
1800
Amerigo Wang00b7c332010-05-05 00:26:45 +00001801static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
1802
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001803static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001804 int write, void __user *buffer,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001805 size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001806 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001807 int write, void *data),
1808 void *data)
1809{
Amerigo Wang00b7c332010-05-05 00:26:45 +00001810 int *i, vleft, first = 1, err = 0;
1811 unsigned long page = 0;
1812 size_t left;
1813 char *kbuf;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001814
Amerigo Wang00b7c332010-05-05 00:26:45 +00001815 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001816 *lenp = 0;
1817 return 0;
1818 }
1819
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001820 i = (int *) tbl_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001821 vleft = table->maxlen / sizeof(*i);
1822 left = *lenp;
1823
1824 if (!conv)
1825 conv = do_proc_dointvec_conv;
1826
Linus Torvalds1da177e2005-04-16 15:20:36 -07001827 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001828 if (left > PAGE_SIZE - 1)
1829 left = PAGE_SIZE - 1;
1830 page = __get_free_page(GFP_TEMPORARY);
1831 kbuf = (char *) page;
1832 if (!kbuf)
1833 return -ENOMEM;
1834 if (copy_from_user(kbuf, buffer, left)) {
1835 err = -EFAULT;
1836 goto free;
1837 }
1838 kbuf[left] = 0;
1839 }
1840
1841 for (; left && vleft--; i++, first=0) {
1842 unsigned long lval;
1843 bool neg;
1844
1845 if (write) {
1846 left -= proc_skip_spaces(&kbuf);
1847
J. R. Okajima563b0462010-05-25 16:10:14 -07001848 if (!left)
1849 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001850 err = proc_get_long(&kbuf, &left, &lval, &neg,
1851 proc_wspace_sep,
1852 sizeof(proc_wspace_sep), NULL);
1853 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001854 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001855 if (conv(&neg, &lval, i, 1, data)) {
1856 err = -EINVAL;
1857 break;
1858 }
1859 } else {
1860 if (conv(&neg, &lval, i, 0, data)) {
1861 err = -EINVAL;
1862 break;
1863 }
1864 if (!first)
1865 err = proc_put_char(&buffer, &left, '\t');
1866 if (err)
1867 break;
1868 err = proc_put_long(&buffer, &left, lval, neg);
1869 if (err)
1870 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001871 }
1872 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00001873
1874 if (!write && !first && left && !err)
1875 err = proc_put_char(&buffer, &left, '\n');
J. R. Okajima563b0462010-05-25 16:10:14 -07001876 if (write && !err && left)
Amerigo Wang00b7c332010-05-05 00:26:45 +00001877 left -= proc_skip_spaces(&kbuf);
1878free:
1879 if (write) {
1880 free_page(page);
1881 if (first)
1882 return err ? : -EINVAL;
1883 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001884 *lenp -= left;
1885 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001886 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001887}
1888
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001889static int do_proc_dointvec(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001890 void __user *buffer, size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001891 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001892 int write, void *data),
1893 void *data)
1894{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001895 return __do_proc_dointvec(table->data, table, write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001896 buffer, lenp, ppos, conv, data);
1897}
1898
Linus Torvalds1da177e2005-04-16 15:20:36 -07001899/**
1900 * proc_dointvec - read a vector of integers
1901 * @table: the sysctl table
1902 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001903 * @buffer: the user buffer
1904 * @lenp: the size of the user buffer
1905 * @ppos: file position
1906 *
1907 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1908 * values from/to the user buffer, treated as an ASCII string.
1909 *
1910 * Returns 0 on success.
1911 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001912int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001913 void __user *buffer, size_t *lenp, loff_t *ppos)
1914{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001915 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001916 NULL,NULL);
1917}
1918
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001919/*
Andi Kleen25ddbb12008-10-15 22:01:41 -07001920 * Taint values can only be increased
1921 * This means we can safely use a temporary.
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001922 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001923static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001924 void __user *buffer, size_t *lenp, loff_t *ppos)
1925{
Andi Kleen25ddbb12008-10-15 22:01:41 -07001926 struct ctl_table t;
1927 unsigned long tmptaint = get_taint();
1928 int err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001929
Bastian Blank91fcd412007-04-23 14:41:14 -07001930 if (write && !capable(CAP_SYS_ADMIN))
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001931 return -EPERM;
1932
Andi Kleen25ddbb12008-10-15 22:01:41 -07001933 t = *table;
1934 t.data = &tmptaint;
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001935 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
Andi Kleen25ddbb12008-10-15 22:01:41 -07001936 if (err < 0)
1937 return err;
1938
1939 if (write) {
1940 /*
1941 * Poor man's atomic or. Not worth adding a primitive
1942 * to everyone's atomic.h for this
1943 */
1944 int i;
1945 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
1946 if ((tmptaint >> i) & 1)
1947 add_taint(i);
1948 }
1949 }
1950
1951 return err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001952}
1953
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001954#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -07001955static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001956 void __user *buffer, size_t *lenp, loff_t *ppos)
1957{
1958 if (write && !capable(CAP_SYS_ADMIN))
1959 return -EPERM;
1960
1961 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
1962}
1963#endif
1964
Linus Torvalds1da177e2005-04-16 15:20:36 -07001965struct do_proc_dointvec_minmax_conv_param {
1966 int *min;
1967 int *max;
1968};
1969
Amerigo Wang00b7c332010-05-05 00:26:45 +00001970static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
1971 int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001972 int write, void *data)
1973{
1974 struct do_proc_dointvec_minmax_conv_param *param = data;
1975 if (write) {
1976 int val = *negp ? -*lvalp : *lvalp;
1977 if ((param->min && *param->min > val) ||
1978 (param->max && *param->max < val))
1979 return -EINVAL;
1980 *valp = val;
1981 } else {
1982 int val = *valp;
1983 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001984 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001985 *lvalp = (unsigned long)-val;
1986 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001987 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001988 *lvalp = (unsigned long)val;
1989 }
1990 }
1991 return 0;
1992}
1993
1994/**
1995 * proc_dointvec_minmax - read a vector of integers with min/max values
1996 * @table: the sysctl table
1997 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001998 * @buffer: the user buffer
1999 * @lenp: the size of the user buffer
2000 * @ppos: file position
2001 *
2002 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2003 * values from/to the user buffer, treated as an ASCII string.
2004 *
2005 * This routine will ensure the values are within the range specified by
2006 * table->extra1 (min) and table->extra2 (max).
2007 *
2008 * Returns 0 on success.
2009 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002010int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002011 void __user *buffer, size_t *lenp, loff_t *ppos)
2012{
2013 struct do_proc_dointvec_minmax_conv_param param = {
2014 .min = (int *) table->extra1,
2015 .max = (int *) table->extra2,
2016 };
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002017 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002018 do_proc_dointvec_minmax_conv, &param);
2019}
2020
Kees Cook54b50192012-07-30 14:39:18 -07002021static void validate_coredump_safety(void)
2022{
2023 if (suid_dumpable == SUID_DUMPABLE_SAFE &&
2024 core_pattern[0] != '/' && core_pattern[0] != '|') {
2025 printk(KERN_WARNING "Unsafe core_pattern used with "\
2026 "suid_dumpable=2. Pipe handler or fully qualified "\
2027 "core dump path required.\n");
2028 }
2029}
2030
2031static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
2032 void __user *buffer, size_t *lenp, loff_t *ppos)
2033{
2034 int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
2035 if (!error)
2036 validate_coredump_safety();
2037 return error;
2038}
2039
2040static int proc_dostring_coredump(struct ctl_table *table, int write,
2041 void __user *buffer, size_t *lenp, loff_t *ppos)
2042{
2043 int error = proc_dostring(table, write, buffer, lenp, ppos);
2044 if (!error)
2045 validate_coredump_safety();
2046 return error;
2047}
2048
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002049static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002050 void __user *buffer,
2051 size_t *lenp, loff_t *ppos,
2052 unsigned long convmul,
2053 unsigned long convdiv)
2054{
Amerigo Wang00b7c332010-05-05 00:26:45 +00002055 unsigned long *i, *min, *max;
2056 int vleft, first = 1, err = 0;
2057 unsigned long page = 0;
2058 size_t left;
2059 char *kbuf;
2060
2061 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002062 *lenp = 0;
2063 return 0;
2064 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002065
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002066 i = (unsigned long *) data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002067 min = (unsigned long *) table->extra1;
2068 max = (unsigned long *) table->extra2;
2069 vleft = table->maxlen / sizeof(unsigned long);
2070 left = *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002071
2072 if (write) {
2073 if (left > PAGE_SIZE - 1)
2074 left = PAGE_SIZE - 1;
2075 page = __get_free_page(GFP_TEMPORARY);
2076 kbuf = (char *) page;
2077 if (!kbuf)
2078 return -ENOMEM;
2079 if (copy_from_user(kbuf, buffer, left)) {
2080 err = -EFAULT;
2081 goto free;
2082 }
2083 kbuf[left] = 0;
2084 }
2085
Eric Dumazet27b3d802010-10-07 12:59:29 -07002086 for (; left && vleft--; i++, first = 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002087 unsigned long val;
2088
Linus Torvalds1da177e2005-04-16 15:20:36 -07002089 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002090 bool neg;
2091
2092 left -= proc_skip_spaces(&kbuf);
2093
2094 err = proc_get_long(&kbuf, &left, &val, &neg,
2095 proc_wspace_sep,
2096 sizeof(proc_wspace_sep), NULL);
2097 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002098 break;
2099 if (neg)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002100 continue;
2101 if ((min && val < *min) || (max && val > *max))
2102 continue;
2103 *i = val;
2104 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002105 val = convdiv * (*i) / convmul;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002106 if (!first)
Amerigo Wang00b7c332010-05-05 00:26:45 +00002107 err = proc_put_char(&buffer, &left, '\t');
2108 err = proc_put_long(&buffer, &left, val, false);
2109 if (err)
2110 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002111 }
2112 }
2113
Amerigo Wang00b7c332010-05-05 00:26:45 +00002114 if (!write && !first && left && !err)
2115 err = proc_put_char(&buffer, &left, '\n');
2116 if (write && !err)
2117 left -= proc_skip_spaces(&kbuf);
2118free:
Linus Torvalds1da177e2005-04-16 15:20:36 -07002119 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002120 free_page(page);
2121 if (first)
2122 return err ? : -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002123 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002124 *lenp -= left;
2125 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002126 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002127}
2128
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002129static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002130 void __user *buffer,
2131 size_t *lenp, loff_t *ppos,
2132 unsigned long convmul,
2133 unsigned long convdiv)
2134{
2135 return __do_proc_doulongvec_minmax(table->data, table, write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002136 buffer, lenp, ppos, convmul, convdiv);
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002137}
2138
Linus Torvalds1da177e2005-04-16 15:20:36 -07002139/**
2140 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2141 * @table: the sysctl table
2142 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002143 * @buffer: the user buffer
2144 * @lenp: the size of the user buffer
2145 * @ppos: file position
2146 *
2147 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2148 * values from/to the user buffer, treated as an ASCII string.
2149 *
2150 * This routine will ensure the values are within the range specified by
2151 * table->extra1 (min) and table->extra2 (max).
2152 *
2153 * Returns 0 on success.
2154 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002155int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002156 void __user *buffer, size_t *lenp, loff_t *ppos)
2157{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002158 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002159}
2160
2161/**
2162 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2163 * @table: the sysctl table
2164 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002165 * @buffer: the user buffer
2166 * @lenp: the size of the user buffer
2167 * @ppos: file position
2168 *
2169 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2170 * values from/to the user buffer, treated as an ASCII string. The values
2171 * are treated as milliseconds, and converted to jiffies when they are stored.
2172 *
2173 * This routine will ensure the values are within the range specified by
2174 * table->extra1 (min) and table->extra2 (max).
2175 *
2176 * Returns 0 on success.
2177 */
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002178int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002179 void __user *buffer,
2180 size_t *lenp, loff_t *ppos)
2181{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002182 return do_proc_doulongvec_minmax(table, write, buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002183 lenp, ppos, HZ, 1000l);
2184}
2185
2186
Amerigo Wang00b7c332010-05-05 00:26:45 +00002187static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002188 int *valp,
2189 int write, void *data)
2190{
2191 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002192 if (*lvalp > LONG_MAX / HZ)
2193 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002194 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2195 } else {
2196 int val = *valp;
2197 unsigned long lval;
2198 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002199 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002200 lval = (unsigned long)-val;
2201 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002202 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002203 lval = (unsigned long)val;
2204 }
2205 *lvalp = lval / HZ;
2206 }
2207 return 0;
2208}
2209
Amerigo Wang00b7c332010-05-05 00:26:45 +00002210static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002211 int *valp,
2212 int write, void *data)
2213{
2214 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002215 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2216 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002217 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2218 } else {
2219 int val = *valp;
2220 unsigned long lval;
2221 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002222 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002223 lval = (unsigned long)-val;
2224 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002225 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002226 lval = (unsigned long)val;
2227 }
2228 *lvalp = jiffies_to_clock_t(lval);
2229 }
2230 return 0;
2231}
2232
Amerigo Wang00b7c332010-05-05 00:26:45 +00002233static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002234 int *valp,
2235 int write, void *data)
2236{
2237 if (write) {
2238 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2239 } else {
2240 int val = *valp;
2241 unsigned long lval;
2242 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002243 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002244 lval = (unsigned long)-val;
2245 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002246 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002247 lval = (unsigned long)val;
2248 }
2249 *lvalp = jiffies_to_msecs(lval);
2250 }
2251 return 0;
2252}
2253
2254/**
2255 * proc_dointvec_jiffies - read a vector of integers as seconds
2256 * @table: the sysctl table
2257 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002258 * @buffer: the user buffer
2259 * @lenp: the size of the user buffer
2260 * @ppos: file position
2261 *
2262 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2263 * values from/to the user buffer, treated as an ASCII string.
2264 * The values read are assumed to be in seconds, and are converted into
2265 * jiffies.
2266 *
2267 * Returns 0 on success.
2268 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002269int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002270 void __user *buffer, size_t *lenp, loff_t *ppos)
2271{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002272 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002273 do_proc_dointvec_jiffies_conv,NULL);
2274}
2275
2276/**
2277 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2278 * @table: the sysctl table
2279 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002280 * @buffer: the user buffer
2281 * @lenp: the size of the user buffer
Randy Dunlap1e5d5332005-11-07 01:01:06 -08002282 * @ppos: pointer to the file position
Linus Torvalds1da177e2005-04-16 15:20:36 -07002283 *
2284 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2285 * values from/to the user buffer, treated as an ASCII string.
2286 * The values read are assumed to be in 1/USER_HZ seconds, and
2287 * are converted into jiffies.
2288 *
2289 * Returns 0 on success.
2290 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002291int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002292 void __user *buffer, size_t *lenp, loff_t *ppos)
2293{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002294 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002295 do_proc_dointvec_userhz_jiffies_conv,NULL);
2296}
2297
2298/**
2299 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2300 * @table: the sysctl table
2301 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002302 * @buffer: the user buffer
2303 * @lenp: the size of the user buffer
Martin Waitz67be2dd2005-05-01 08:59:26 -07002304 * @ppos: file position
2305 * @ppos: the current position in the file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002306 *
2307 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2308 * values from/to the user buffer, treated as an ASCII string.
2309 * The values read are assumed to be in 1/1000 seconds, and
2310 * are converted into jiffies.
2311 *
2312 * Returns 0 on success.
2313 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002314int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002315 void __user *buffer, size_t *lenp, loff_t *ppos)
2316{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002317 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002318 do_proc_dointvec_ms_jiffies_conv, NULL);
2319}
2320
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002321static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002322 void __user *buffer, size_t *lenp, loff_t *ppos)
2323{
2324 struct pid *new_pid;
2325 pid_t tmp;
2326 int r;
2327
Pavel Emelyanov6c5f3e72008-02-08 04:19:20 -08002328 tmp = pid_vnr(cad_pid);
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002329
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002330 r = __do_proc_dointvec(&tmp, table, write, buffer,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002331 lenp, ppos, NULL, NULL);
2332 if (r || !write)
2333 return r;
2334
2335 new_pid = find_get_pid(tmp);
2336 if (!new_pid)
2337 return -ESRCH;
2338
2339 put_pid(xchg(&cad_pid, new_pid));
2340 return 0;
2341}
2342
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002343/**
2344 * proc_do_large_bitmap - read/write from/to a large bitmap
2345 * @table: the sysctl table
2346 * @write: %TRUE if this is a write to the sysctl file
2347 * @buffer: the user buffer
2348 * @lenp: the size of the user buffer
2349 * @ppos: file position
2350 *
2351 * The bitmap is stored at table->data and the bitmap length (in bits)
2352 * in table->maxlen.
2353 *
2354 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2355 * large bitmaps may be represented in a compact manner. Writing into
2356 * the file will clear the bitmap then update it with the given input.
2357 *
2358 * Returns 0 on success.
2359 */
2360int proc_do_large_bitmap(struct ctl_table *table, int write,
2361 void __user *buffer, size_t *lenp, loff_t *ppos)
2362{
2363 int err = 0;
2364 bool first = 1;
2365 size_t left = *lenp;
2366 unsigned long bitmap_len = table->maxlen;
2367 unsigned long *bitmap = (unsigned long *) table->data;
2368 unsigned long *tmp_bitmap = NULL;
2369 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2370
2371 if (!bitmap_len || !left || (*ppos && !write)) {
2372 *lenp = 0;
2373 return 0;
2374 }
2375
2376 if (write) {
2377 unsigned long page = 0;
2378 char *kbuf;
2379
2380 if (left > PAGE_SIZE - 1)
2381 left = PAGE_SIZE - 1;
2382
2383 page = __get_free_page(GFP_TEMPORARY);
2384 kbuf = (char *) page;
2385 if (!kbuf)
2386 return -ENOMEM;
2387 if (copy_from_user(kbuf, buffer, left)) {
2388 free_page(page);
2389 return -EFAULT;
2390 }
2391 kbuf[left] = 0;
2392
2393 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2394 GFP_KERNEL);
2395 if (!tmp_bitmap) {
2396 free_page(page);
2397 return -ENOMEM;
2398 }
2399 proc_skip_char(&kbuf, &left, '\n');
2400 while (!err && left) {
2401 unsigned long val_a, val_b;
2402 bool neg;
2403
2404 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2405 sizeof(tr_a), &c);
2406 if (err)
2407 break;
2408 if (val_a >= bitmap_len || neg) {
2409 err = -EINVAL;
2410 break;
2411 }
2412
2413 val_b = val_a;
2414 if (left) {
2415 kbuf++;
2416 left--;
2417 }
2418
2419 if (c == '-') {
2420 err = proc_get_long(&kbuf, &left, &val_b,
2421 &neg, tr_b, sizeof(tr_b),
2422 &c);
2423 if (err)
2424 break;
2425 if (val_b >= bitmap_len || neg ||
2426 val_a > val_b) {
2427 err = -EINVAL;
2428 break;
2429 }
2430 if (left) {
2431 kbuf++;
2432 left--;
2433 }
2434 }
2435
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002436 bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002437 first = 0;
2438 proc_skip_char(&kbuf, &left, '\n');
2439 }
2440 free_page(page);
2441 } else {
2442 unsigned long bit_a, bit_b = 0;
2443
2444 while (left) {
2445 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2446 if (bit_a >= bitmap_len)
2447 break;
2448 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2449 bit_a + 1) - 1;
2450
2451 if (!first) {
2452 err = proc_put_char(&buffer, &left, ',');
2453 if (err)
2454 break;
2455 }
2456 err = proc_put_long(&buffer, &left, bit_a, false);
2457 if (err)
2458 break;
2459 if (bit_a != bit_b) {
2460 err = proc_put_char(&buffer, &left, '-');
2461 if (err)
2462 break;
2463 err = proc_put_long(&buffer, &left, bit_b, false);
2464 if (err)
2465 break;
2466 }
2467
2468 first = 0; bit_b++;
2469 }
2470 if (!err)
2471 err = proc_put_char(&buffer, &left, '\n');
2472 }
2473
2474 if (!err) {
2475 if (write) {
2476 if (*ppos)
2477 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2478 else
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002479 bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002480 }
2481 kfree(tmp_bitmap);
2482 *lenp -= left;
2483 *ppos += *lenp;
2484 return 0;
2485 } else {
2486 kfree(tmp_bitmap);
2487 return err;
2488 }
2489}
2490
Jovi Zhang55610502011-01-12 17:00:45 -08002491#else /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002492
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002493int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002494 void __user *buffer, size_t *lenp, loff_t *ppos)
2495{
2496 return -ENOSYS;
2497}
2498
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002499int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002500 void __user *buffer, size_t *lenp, loff_t *ppos)
2501{
2502 return -ENOSYS;
2503}
2504
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002505int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002506 void __user *buffer, size_t *lenp, loff_t *ppos)
2507{
2508 return -ENOSYS;
2509}
2510
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002511int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002512 void __user *buffer, size_t *lenp, loff_t *ppos)
2513{
2514 return -ENOSYS;
2515}
2516
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002517int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002518 void __user *buffer, size_t *lenp, loff_t *ppos)
2519{
2520 return -ENOSYS;
2521}
2522
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002523int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002524 void __user *buffer, size_t *lenp, loff_t *ppos)
2525{
2526 return -ENOSYS;
2527}
2528
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002529int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002530 void __user *buffer, size_t *lenp, loff_t *ppos)
2531{
2532 return -ENOSYS;
2533}
2534
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002535int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002536 void __user *buffer,
2537 size_t *lenp, loff_t *ppos)
2538{
2539 return -ENOSYS;
2540}
2541
2542
Jovi Zhang55610502011-01-12 17:00:45 -08002543#endif /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002544
Linus Torvalds1da177e2005-04-16 15:20:36 -07002545/*
2546 * No sense putting this after each symbol definition, twice,
2547 * exception granted :-)
2548 */
2549EXPORT_SYMBOL(proc_dointvec);
2550EXPORT_SYMBOL(proc_dointvec_jiffies);
2551EXPORT_SYMBOL(proc_dointvec_minmax);
2552EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2553EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2554EXPORT_SYMBOL(proc_dostring);
2555EXPORT_SYMBOL(proc_doulongvec_minmax);
2556EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);