blob: 6502d35a25bafb9de258d5f9946c77648c55f368 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * sysctl.c: General linux system control interface
3 *
4 * Begun 24 March 1995, Stephen Tweedie
5 * Added /proc support, Dec 1995
6 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
7 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
8 * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
9 * Dynamic registration fixes, Stephen Tweedie.
10 * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
11 * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
12 * Horn.
13 * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
14 * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
15 * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
16 * Wendling.
17 * The list_for_each() macro wasn't appropriate for the sysctl loop.
18 * Removed it and replaced it with older style, 03/23/00, Bill Wendling
19 */
20
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <linux/module.h>
22#include <linux/mm.h>
23#include <linux/swap.h>
24#include <linux/slab.h>
25#include <linux/sysctl.h>
Akinobu Mita5a04cca2012-03-28 14:42:50 -070026#include <linux/bitmap.h>
Dave Youngd33ed522010-03-10 15:23:59 -080027#include <linux/signal.h>
Dan Rosenberg455cd5a2011-01-12 16:59:41 -080028#include <linux/printk.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include <linux/proc_fs.h>
Andrew Morgan72c2d582007-10-18 03:05:59 -070030#include <linux/security.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <linux/ctype.h>
Vegard Nossumdfec0722008-04-04 00:51:41 +020032#include <linux/kmemcheck.h>
Steven Rostedtfd4b6162012-07-30 14:42:48 -070033#include <linux/kmemleak.h>
Adrian Bunk62239ac2007-07-17 04:03:45 -070034#include <linux/fs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070035#include <linux/init.h>
36#include <linux/kernel.h>
Kay Sievers0296b222005-11-11 05:33:52 +010037#include <linux/kobject.h>
Arnaldo Carvalho de Melo20380732005-08-16 02:18:02 -030038#include <linux/net.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070039#include <linux/sysrq.h>
40#include <linux/highuid.h>
41#include <linux/writeback.h>
Ingo Molnar3fff4c42009-09-22 16:18:09 +020042#include <linux/ratelimit.h>
Mel Gorman76ab0f52010-05-24 14:32:28 -070043#include <linux/compaction.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#include <linux/hugetlb.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#include <linux/initrd.h>
David Howells0b77f5b2008-04-29 01:01:32 -070046#include <linux/key.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070047#include <linux/times.h>
48#include <linux/limits.h>
49#include <linux/dcache.h>
Alexey Dobriyan6e006702010-01-20 22:27:56 +020050#include <linux/dnotify.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070051#include <linux/syscalls.h>
Adrian Bunkc748e132008-07-23 21:27:03 -070052#include <linux/vmstat.h>
Pavel Machekc255d842006-02-20 18:27:58 -080053#include <linux/nfs_fs.h>
54#include <linux/acpi.h>
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -070055#include <linux/reboot.h>
Steven Rostedtb0fc4942008-05-12 21:20:43 +020056#include <linux/ftrace.h>
Ingo Molnarcdd6c482009-09-21 12:02:48 +020057#include <linux/perf_event.h>
Masami Hiramatsub2be84d2010-02-25 08:34:15 -050058#include <linux/kprobes.h>
Jens Axboeb492e952010-05-19 21:03:16 +020059#include <linux/pipe_fs_i.h>
David Rientjes8e4228e2010-08-09 17:18:56 -070060#include <linux/oom.h>
Eric Paris17f60a72011-04-01 17:07:50 -040061#include <linux/kmod.h>
Dan Ballard73efc032011-10-31 17:11:20 -070062#include <linux/capability.h>
Al Viro40401532012-02-13 03:58:52 +000063#include <linux/binfmts.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070064
65#include <asm/uaccess.h>
66#include <asm/processor.h>
67
Andi Kleen29cbc782006-09-30 01:47:55 +020068#ifdef CONFIG_X86
69#include <asm/nmi.h>
Chuck Ebbert0741f4d2006-12-07 02:14:11 +010070#include <asm/stacktrace.h>
Ingo Molnar6e7c4022008-01-30 13:30:05 +010071#include <asm/io.h>
Andi Kleen29cbc782006-09-30 01:47:55 +020072#endif
David Howellsd550bbd2012-03-28 18:30:03 +010073#ifdef CONFIG_SPARC
74#include <asm/setup.h>
75#endif
Dave Youngc55b7c32010-03-10 15:24:08 -080076#ifdef CONFIG_BSD_PROCESS_ACCT
77#include <linux/acct.h>
78#endif
Dave Young4f0e0562010-03-10 15:24:09 -080079#ifdef CONFIG_RT_MUTEXES
80#include <linux/rtmutex.h>
81#endif
Dave Young2edf5e42010-03-10 15:24:10 -080082#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
83#include <linux/lockdep.h>
84#endif
Dave Young15485a42010-03-10 15:24:07 -080085#ifdef CONFIG_CHR_DEV_SG
86#include <scsi/sg.h>
87#endif
Andi Kleen29cbc782006-09-30 01:47:55 +020088
Don Zickus58687ac2010-05-07 17:11:44 -040089#ifdef CONFIG_LOCKUP_DETECTOR
Don Zickus504d7cf2010-02-12 17:19:19 -050090#include <linux/nmi.h>
91#endif
92
Eric W. Biederman7058cb02007-10-18 03:05:58 -070093
Linus Torvalds1da177e2005-04-16 15:20:36 -070094#if defined(CONFIG_SYSCTL)
95
96/* External variables not in a header file. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070097extern int sysctl_overcommit_memory;
98extern int sysctl_overcommit_ratio;
99extern int max_threads;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100extern int core_uses_pid;
Alan Coxd6e71142005-06-23 00:09:43 -0700101extern int suid_dumpable;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102extern char core_pattern[];
Neil Hormana2939802009-09-23 15:56:56 -0700103extern unsigned int core_pipe_limit;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104extern int pid_max;
105extern int min_free_kbytes;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106extern int pid_max_min, pid_max_max;
Andrew Morton9d0243b2006-01-08 01:00:39 -0800107extern int sysctl_drop_caches;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800108extern int percpu_pagelist_fraction;
Andi Kleenbebfa102006-06-26 13:56:52 +0200109extern int compat_log;
Arjan van de Ven97455122008-01-25 21:08:34 +0100110extern int latencytop_enabled;
Al Viroeceea0b2008-05-10 10:08:32 -0400111extern int sysctl_nr_open_min, sysctl_nr_open_max;
Paul Mundtdd8632a2009-01-08 12:04:47 +0000112#ifndef CONFIG_MMU
113extern int sysctl_nr_trim_pages;
114#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200115#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200116extern int blk_iopoll_enabled;
Jens Axboecb684b52009-09-15 21:53:11 +0200117#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700119/* Constants used for minimum and maximum */
Don Zickus2508ce12010-05-07 17:11:46 -0400120#ifdef CONFIG_LOCKUP_DETECTOR
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700121static int sixty = 60;
Dimitri Sivanich9383d962008-05-12 21:21:14 +0200122static int neg_one = -1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700123#endif
124
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700125static int zero;
Linus Torvaldscd5f9a42009-04-06 13:38:46 -0700126static int __maybe_unused one = 1;
127static int __maybe_unused two = 2;
Petr Holasekcb16e952011-03-23 16:43:09 -0700128static int __maybe_unused three = 3;
Sven Wegenerfc3501d2009-02-11 13:04:23 -0800129static unsigned long one_ul = 1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700130static int one_hundred = 100;
Dave Youngaf913222009-09-22 16:43:33 -0700131#ifdef CONFIG_PRINTK
132static int ten_thousand = 10000;
133#endif
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700134
Andrea Righi9e4a5bd2009-04-30 15:08:57 -0700135/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
136static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
137
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
139static int maxolduid = 65535;
140static int minolduid;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800141static int min_percpu_pagelist_fract = 8;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142
143static int ngroups_max = NGROUPS_MAX;
Dan Ballard73efc032011-10-31 17:11:20 -0700144static const int cap_last_cap = CAP_LAST_CAP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145
Dave Youngd14f1722010-02-25 20:28:57 -0500146#ifdef CONFIG_INOTIFY_USER
147#include <linux/inotify.h>
148#endif
David S. Miller72c57ed2008-09-11 23:29:54 -0700149#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150#endif
151
David S. Miller08714202008-11-16 23:49:24 -0800152#ifdef CONFIG_SPARC64
153extern int sysctl_tsb_ratio;
154#endif
155
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156#ifdef __hppa__
157extern int pwrsw_enabled;
158extern int unaligned_enabled;
159#endif
160
Jes Sorensend2b176e2006-02-28 09:42:23 -0800161#ifdef CONFIG_IA64
162extern int no_unaligned_warning;
Doug Chapman88fc2412009-01-15 10:38:56 -0800163extern int unaligned_dump_stack;
Jes Sorensend2b176e2006-02-28 09:42:23 -0800164#endif
165
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700166#ifdef CONFIG_PROC_SYSCTL
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700167static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700168 void __user *buffer, size_t *lenp, loff_t *ppos);
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700169static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800170 void __user *buffer, size_t *lenp, loff_t *ppos);
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700171#endif
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700172
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700173#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -0700174static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700175 void __user *buffer, size_t *lenp, loff_t *ppos);
176#endif
177
Kees Cook54b50192012-07-30 14:39:18 -0700178static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
179 void __user *buffer, size_t *lenp, loff_t *ppos);
180static int proc_dostring_coredump(struct ctl_table *table, int write,
181 void __user *buffer, size_t *lenp, loff_t *ppos);
182
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700183#ifdef CONFIG_MAGIC_SYSRQ
Andy Whitcroft8c6a98b2011-01-24 09:31:38 -0800184/* Note: sysrq code uses it's own private copy */
185static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700186
187static int sysrq_sysctl_handler(ctl_table *table, int write,
188 void __user *buffer, size_t *lenp,
189 loff_t *ppos)
190{
191 int error;
192
193 error = proc_dointvec(table, write, buffer, lenp, ppos);
194 if (error)
195 return error;
196
197 if (write)
198 sysrq_toggle_support(__sysrq_enabled);
199
200 return 0;
201}
202
203#endif
204
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700205static struct ctl_table kern_table[];
206static struct ctl_table vm_table[];
207static struct ctl_table fs_table[];
208static struct ctl_table debug_table[];
209static struct ctl_table dev_table[];
210extern struct ctl_table random_table[];
Davide Libenzi7ef99642008-12-01 13:13:55 -0800211#ifdef CONFIG_EPOLL
212extern struct ctl_table epoll_table[];
213#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214
215#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
216int sysctl_legacy_va_layout;
217#endif
218
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219/* The default sysctl tables: */
220
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -0800221static struct ctl_table sysctl_base_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223 .procname = "kernel",
224 .mode = 0555,
225 .child = kern_table,
226 },
227 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228 .procname = "vm",
229 .mode = 0555,
230 .child = vm_table,
231 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233 .procname = "fs",
234 .mode = 0555,
235 .child = fs_table,
236 },
237 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 .procname = "debug",
239 .mode = 0555,
240 .child = debug_table,
241 },
242 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243 .procname = "dev",
244 .mode = 0555,
245 .child = dev_table,
246 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -0700247 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248};
249
Ingo Molnar77e54a12007-07-09 18:52:00 +0200250#ifdef CONFIG_SCHED_DEBUG
Eric Dumazet73c4efd2007-12-18 15:21:13 +0100251static int min_sched_granularity_ns = 100000; /* 100 usecs */
252static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
253static int min_wakeup_granularity_ns; /* 0 usecs */
254static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100255static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
256static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
Ingo Molnar77e54a12007-07-09 18:52:00 +0200257#endif
258
Mel Gorman5e771902010-05-24 14:32:31 -0700259#ifdef CONFIG_COMPACTION
260static int min_extfrag_threshold;
261static int max_extfrag_threshold = 1000;
262#endif
263
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700264static struct ctl_table kern_table[] = {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200265 {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200266 .procname = "sched_child_runs_first",
267 .data = &sysctl_sched_child_runs_first,
268 .maxlen = sizeof(unsigned int),
269 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800270 .proc_handler = proc_dointvec,
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200271 },
Ingo Molnar77e54a12007-07-09 18:52:00 +0200272#ifdef CONFIG_SCHED_DEBUG
273 {
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100274 .procname = "sched_min_granularity_ns",
275 .data = &sysctl_sched_min_granularity,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200276 .maxlen = sizeof(unsigned int),
277 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800278 .proc_handler = sched_proc_update_handler,
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100279 .extra1 = &min_sched_granularity_ns,
280 .extra2 = &max_sched_granularity_ns,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200281 },
282 {
Peter Zijlstra21805082007-08-25 18:41:53 +0200283 .procname = "sched_latency_ns",
284 .data = &sysctl_sched_latency,
285 .maxlen = sizeof(unsigned int),
286 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800287 .proc_handler = sched_proc_update_handler,
Peter Zijlstra21805082007-08-25 18:41:53 +0200288 .extra1 = &min_sched_granularity_ns,
289 .extra2 = &max_sched_granularity_ns,
290 },
291 {
Ingo Molnar77e54a12007-07-09 18:52:00 +0200292 .procname = "sched_wakeup_granularity_ns",
293 .data = &sysctl_sched_wakeup_granularity,
294 .maxlen = sizeof(unsigned int),
295 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800296 .proc_handler = sched_proc_update_handler,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200297 .extra1 = &min_wakeup_granularity_ns,
298 .extra2 = &max_wakeup_granularity_ns,
299 },
300 {
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100301 .procname = "sched_tunable_scaling",
302 .data = &sysctl_sched_tunable_scaling,
303 .maxlen = sizeof(enum sched_tunable_scaling),
304 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800305 .proc_handler = sched_proc_update_handler,
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100306 .extra1 = &min_sched_tunable_scaling,
307 .extra2 = &max_sched_tunable_scaling,
Peter Zijlstra2398f2c2008-06-27 13:41:35 +0200308 },
309 {
Ingo Molnarda84d962007-10-15 17:00:18 +0200310 .procname = "sched_migration_cost",
311 .data = &sysctl_sched_migration_cost,
312 .maxlen = sizeof(unsigned int),
313 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800314 .proc_handler = proc_dointvec,
Ingo Molnarda84d962007-10-15 17:00:18 +0200315 },
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100316 {
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100317 .procname = "sched_nr_migrate",
318 .data = &sysctl_sched_nr_migrate,
319 .maxlen = sizeof(unsigned int),
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100320 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800321 .proc_handler = proc_dointvec,
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100322 },
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530323 {
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200324 .procname = "sched_time_avg",
325 .data = &sysctl_sched_time_avg,
326 .maxlen = sizeof(unsigned int),
327 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800328 .proc_handler = proc_dointvec,
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200329 },
330 {
Paul Turnera7a4f8a2010-11-15 15:47:06 -0800331 .procname = "sched_shares_window",
332 .data = &sysctl_sched_shares_window,
333 .maxlen = sizeof(unsigned int),
334 .mode = 0644,
335 .proc_handler = proc_dointvec,
336 },
337 {
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530338 .procname = "timer_migration",
339 .data = &sysctl_timer_migration,
340 .maxlen = sizeof(unsigned int),
341 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800342 .proc_handler = proc_dointvec_minmax,
Arun R Bharadwajbfdb4d92009-06-23 10:00:58 +0530343 .extra1 = &zero,
344 .extra2 = &one,
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530345 },
Peter Zijlstra1fc84aa2007-08-25 18:41:52 +0200346#endif
Ingo Molnar1799e352007-09-19 23:34:46 +0200347 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100348 .procname = "sched_rt_period_us",
349 .data = &sysctl_sched_rt_period,
350 .maxlen = sizeof(unsigned int),
351 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800352 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100353 },
354 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100355 .procname = "sched_rt_runtime_us",
356 .data = &sysctl_sched_rt_runtime,
357 .maxlen = sizeof(int),
358 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800359 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100360 },
Mike Galbraith5091faa2010-11-30 14:18:03 +0100361#ifdef CONFIG_SCHED_AUTOGROUP
362 {
363 .procname = "sched_autogroup_enabled",
364 .data = &sysctl_sched_autogroup_enabled,
365 .maxlen = sizeof(unsigned int),
366 .mode = 0644,
Yong Zhang1747b212011-02-20 15:08:12 +0800367 .proc_handler = proc_dointvec_minmax,
Mike Galbraith5091faa2010-11-30 14:18:03 +0100368 .extra1 = &zero,
369 .extra2 = &one,
370 },
371#endif
Paul Turnerec12cb72011-07-21 09:43:30 -0700372#ifdef CONFIG_CFS_BANDWIDTH
373 {
374 .procname = "sched_cfs_bandwidth_slice_us",
375 .data = &sysctl_sched_cfs_bandwidth_slice,
376 .maxlen = sizeof(unsigned int),
377 .mode = 0644,
378 .proc_handler = proc_dointvec_minmax,
379 .extra1 = &one,
380 },
381#endif
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700382#ifdef CONFIG_PROVE_LOCKING
383 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700384 .procname = "prove_locking",
385 .data = &prove_locking,
386 .maxlen = sizeof(int),
387 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800388 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700389 },
390#endif
391#ifdef CONFIG_LOCK_STAT
392 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700393 .procname = "lock_stat",
394 .data = &lock_stat,
395 .maxlen = sizeof(int),
396 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800397 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700398 },
399#endif
Ingo Molnar77e54a12007-07-09 18:52:00 +0200400 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401 .procname = "panic",
402 .data = &panic_timeout,
403 .maxlen = sizeof(int),
404 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800405 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700406 },
407 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408 .procname = "core_uses_pid",
409 .data = &core_uses_pid,
410 .maxlen = sizeof(int),
411 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800412 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413 },
414 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415 .procname = "core_pattern",
416 .data = core_pattern,
Dan Aloni71ce92f2007-05-16 22:11:16 -0700417 .maxlen = CORENAME_MAX_SIZE,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418 .mode = 0644,
Kees Cook54b50192012-07-30 14:39:18 -0700419 .proc_handler = proc_dostring_coredump,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700420 },
Neil Hormana2939802009-09-23 15:56:56 -0700421 {
Neil Hormana2939802009-09-23 15:56:56 -0700422 .procname = "core_pipe_limit",
423 .data = &core_pipe_limit,
424 .maxlen = sizeof(unsigned int),
425 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800426 .proc_handler = proc_dointvec,
Neil Hormana2939802009-09-23 15:56:56 -0700427 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800428#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700430 .procname = "tainted",
Andi Kleen25ddbb12008-10-15 22:01:41 -0700431 .maxlen = sizeof(long),
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800432 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800433 .proc_handler = proc_taint,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800435#endif
Arjan van de Ven97455122008-01-25 21:08:34 +0100436#ifdef CONFIG_LATENCYTOP
437 {
438 .procname = "latencytop",
439 .data = &latencytop_enabled,
440 .maxlen = sizeof(int),
441 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800442 .proc_handler = proc_dointvec,
Arjan van de Ven97455122008-01-25 21:08:34 +0100443 },
444#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700445#ifdef CONFIG_BLK_DEV_INITRD
446 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447 .procname = "real-root-dev",
448 .data = &real_root_dev,
449 .maxlen = sizeof(int),
450 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800451 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700452 },
453#endif
Ingo Molnar45807a12007-07-15 23:40:10 -0700454 {
Ingo Molnar45807a12007-07-15 23:40:10 -0700455 .procname = "print-fatal-signals",
456 .data = &print_fatal_signals,
457 .maxlen = sizeof(int),
458 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800459 .proc_handler = proc_dointvec,
Ingo Molnar45807a12007-07-15 23:40:10 -0700460 },
David S. Miller72c57ed2008-09-11 23:29:54 -0700461#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700462 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700463 .procname = "reboot-cmd",
464 .data = reboot_command,
465 .maxlen = 256,
466 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800467 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700468 },
469 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470 .procname = "stop-a",
471 .data = &stop_a_enabled,
472 .maxlen = sizeof (int),
473 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800474 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700475 },
476 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700477 .procname = "scons-poweroff",
478 .data = &scons_pwroff,
479 .maxlen = sizeof (int),
480 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800481 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700482 },
483#endif
David S. Miller08714202008-11-16 23:49:24 -0800484#ifdef CONFIG_SPARC64
485 {
David S. Miller08714202008-11-16 23:49:24 -0800486 .procname = "tsb-ratio",
487 .data = &sysctl_tsb_ratio,
488 .maxlen = sizeof (int),
489 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800490 .proc_handler = proc_dointvec,
David S. Miller08714202008-11-16 23:49:24 -0800491 },
492#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700493#ifdef __hppa__
494 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700495 .procname = "soft-power",
496 .data = &pwrsw_enabled,
497 .maxlen = sizeof (int),
498 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800499 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700500 },
501 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502 .procname = "unaligned-trap",
503 .data = &unaligned_enabled,
504 .maxlen = sizeof (int),
505 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800506 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507 },
508#endif
509 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700510 .procname = "ctrl-alt-del",
511 .data = &C_A_D,
512 .maxlen = sizeof(int),
513 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800514 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700515 },
Steven Rostedt606576c2008-10-06 19:06:12 -0400516#ifdef CONFIG_FUNCTION_TRACER
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200517 {
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200518 .procname = "ftrace_enabled",
519 .data = &ftrace_enabled,
520 .maxlen = sizeof(int),
521 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800522 .proc_handler = ftrace_enable_sysctl,
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200523 },
524#endif
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500525#ifdef CONFIG_STACK_TRACER
526 {
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500527 .procname = "stack_tracer_enabled",
528 .data = &stack_tracer_enabled,
529 .maxlen = sizeof(int),
530 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800531 .proc_handler = stack_trace_sysctl,
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500532 },
533#endif
Steven Rostedt944ac422008-10-23 19:26:08 -0400534#ifdef CONFIG_TRACING
535 {
Peter Zijlstra3299b4d2008-11-04 11:58:21 +0100536 .procname = "ftrace_dump_on_oops",
Steven Rostedt944ac422008-10-23 19:26:08 -0400537 .data = &ftrace_dump_on_oops,
538 .maxlen = sizeof(int),
539 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800540 .proc_handler = proc_dointvec,
Steven Rostedt944ac422008-10-23 19:26:08 -0400541 },
542#endif
Johannes Berga1ef5ad2008-07-08 19:00:17 +0200543#ifdef CONFIG_MODULES
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700545 .procname = "modprobe",
546 .data = &modprobe_path,
547 .maxlen = KMOD_PATH_LEN,
548 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800549 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700550 },
Kees Cook3d433212009-04-02 15:49:29 -0700551 {
Kees Cook3d433212009-04-02 15:49:29 -0700552 .procname = "modules_disabled",
553 .data = &modules_disabled,
554 .maxlen = sizeof(int),
555 .mode = 0644,
556 /* only handle a transition from default "0" to "1" */
Eric W. Biederman6d456112009-11-16 03:11:48 -0800557 .proc_handler = proc_dointvec_minmax,
Kees Cook3d433212009-04-02 15:49:29 -0700558 .extra1 = &one,
559 .extra2 = &one,
560 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561#endif
Ian Abbott94f17cd2010-06-07 12:57:12 +0100562#ifdef CONFIG_HOTPLUG
Linus Torvalds1da177e2005-04-16 15:20:36 -0700563 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 .procname = "hotplug",
Kay Sievers312c0042005-11-16 09:00:00 +0100565 .data = &uevent_helper,
566 .maxlen = UEVENT_HELPER_PATH_LEN,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800568 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569 },
570#endif
571#ifdef CONFIG_CHR_DEV_SG
572 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700573 .procname = "sg-big-buff",
574 .data = &sg_big_buff,
575 .maxlen = sizeof (int),
576 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800577 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700578 },
579#endif
580#ifdef CONFIG_BSD_PROCESS_ACCT
581 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700582 .procname = "acct",
583 .data = &acct_parm,
584 .maxlen = 3*sizeof(int),
585 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800586 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700587 },
588#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700589#ifdef CONFIG_MAGIC_SYSRQ
590 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591 .procname = "sysrq",
Ingo Molnar5d6f6472006-12-13 00:34:36 -0800592 .data = &__sysrq_enabled,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700593 .maxlen = sizeof (int),
594 .mode = 0644,
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700595 .proc_handler = sysrq_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700596 },
597#endif
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700598#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700600 .procname = "cad_pid",
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700601 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 .maxlen = sizeof (int),
603 .mode = 0600,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800604 .proc_handler = proc_do_cad_pid,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700605 },
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700606#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700608 .procname = "threads-max",
609 .data = &max_threads,
610 .maxlen = sizeof(int),
611 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800612 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613 },
614 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700615 .procname = "random",
616 .mode = 0555,
617 .child = random_table,
618 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700619 {
Eric Paris17f60a72011-04-01 17:07:50 -0400620 .procname = "usermodehelper",
621 .mode = 0555,
622 .child = usermodehelper_table,
623 },
624 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700625 .procname = "overflowuid",
626 .data = &overflowuid,
627 .maxlen = sizeof(int),
628 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800629 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700630 .extra1 = &minolduid,
631 .extra2 = &maxolduid,
632 },
633 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700634 .procname = "overflowgid",
635 .data = &overflowgid,
636 .maxlen = sizeof(int),
637 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800638 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700639 .extra1 = &minolduid,
640 .extra2 = &maxolduid,
641 },
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -0800642#ifdef CONFIG_S390
Linus Torvalds1da177e2005-04-16 15:20:36 -0700643#ifdef CONFIG_MATHEMU
644 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700645 .procname = "ieee_emulation_warnings",
646 .data = &sysctl_ieee_emulation_warnings,
647 .maxlen = sizeof(int),
648 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800649 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700650 },
651#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700652 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700653 .procname = "userprocess_debug",
Heiko Carstensab3c68e2010-05-17 10:00:21 +0200654 .data = &show_unhandled_signals,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700655 .maxlen = sizeof(int),
656 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800657 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700658 },
659#endif
660 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700661 .procname = "pid_max",
662 .data = &pid_max,
663 .maxlen = sizeof (int),
664 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800665 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700666 .extra1 = &pid_max_min,
667 .extra2 = &pid_max_max,
668 },
669 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700670 .procname = "panic_on_oops",
671 .data = &panic_on_oops,
672 .maxlen = sizeof(int),
673 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800674 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675 },
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800676#if defined CONFIG_PRINTK
677 {
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800678 .procname = "printk",
679 .data = &console_loglevel,
680 .maxlen = 4*sizeof(int),
681 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800682 .proc_handler = proc_dointvec,
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800683 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700684 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700685 .procname = "printk_ratelimit",
Dave Young717115e2008-07-25 01:45:58 -0700686 .data = &printk_ratelimit_state.interval,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700687 .maxlen = sizeof(int),
688 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800689 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700690 },
691 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700692 .procname = "printk_ratelimit_burst",
Dave Young717115e2008-07-25 01:45:58 -0700693 .data = &printk_ratelimit_state.burst,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700694 .maxlen = sizeof(int),
695 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800696 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700697 },
Dave Youngaf913222009-09-22 16:43:33 -0700698 {
Dave Youngaf913222009-09-22 16:43:33 -0700699 .procname = "printk_delay",
700 .data = &printk_delay_msec,
701 .maxlen = sizeof(int),
702 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800703 .proc_handler = proc_dointvec_minmax,
Dave Youngaf913222009-09-22 16:43:33 -0700704 .extra1 = &zero,
705 .extra2 = &ten_thousand,
706 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700707 {
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800708 .procname = "dmesg_restrict",
709 .data = &dmesg_restrict,
710 .maxlen = sizeof(int),
711 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700712 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800713 .extra1 = &zero,
714 .extra2 = &one,
715 },
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800716 {
717 .procname = "kptr_restrict",
718 .data = &kptr_restrict,
719 .maxlen = sizeof(int),
720 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700721 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800722 .extra1 = &zero,
723 .extra2 = &two,
724 },
Joe Perchesdf6e61d2010-11-15 21:17:27 -0800725#endif
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800726 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700727 .procname = "ngroups_max",
728 .data = &ngroups_max,
729 .maxlen = sizeof (int),
730 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800731 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700732 },
Dan Ballard73efc032011-10-31 17:11:20 -0700733 {
734 .procname = "cap_last_cap",
735 .data = (void *)&cap_last_cap,
736 .maxlen = sizeof(int),
737 .mode = 0444,
738 .proc_handler = proc_dointvec,
739 },
Don Zickus58687ac2010-05-07 17:11:44 -0400740#if defined(CONFIG_LOCKUP_DETECTOR)
Don Zickus504d7cf2010-02-12 17:19:19 -0500741 {
Don Zickus58687ac2010-05-07 17:11:44 -0400742 .procname = "watchdog",
743 .data = &watchdog_enabled,
Don Zickus504d7cf2010-02-12 17:19:19 -0500744 .maxlen = sizeof (int),
745 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700746 .proc_handler = proc_dowatchdog,
747 .extra1 = &zero,
748 .extra2 = &one,
Don Zickus58687ac2010-05-07 17:11:44 -0400749 },
750 {
751 .procname = "watchdog_thresh",
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700752 .data = &watchdog_thresh,
Don Zickus58687ac2010-05-07 17:11:44 -0400753 .maxlen = sizeof(int),
754 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700755 .proc_handler = proc_dowatchdog,
Don Zickus58687ac2010-05-07 17:11:44 -0400756 .extra1 = &neg_one,
757 .extra2 = &sixty,
Don Zickus504d7cf2010-02-12 17:19:19 -0500758 },
Don Zickus2508ce12010-05-07 17:11:46 -0400759 {
760 .procname = "softlockup_panic",
761 .data = &softlockup_panic,
762 .maxlen = sizeof(int),
763 .mode = 0644,
764 .proc_handler = proc_dointvec_minmax,
765 .extra1 = &zero,
766 .extra2 = &one,
767 },
Don Zickus5dc30552010-11-29 17:07:17 -0500768 {
769 .procname = "nmi_watchdog",
770 .data = &watchdog_enabled,
771 .maxlen = sizeof (int),
772 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700773 .proc_handler = proc_dowatchdog,
774 .extra1 = &zero,
775 .extra2 = &one,
Don Zickus5dc30552010-11-29 17:07:17 -0500776 },
777#endif
778#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
779 {
780 .procname = "unknown_nmi_panic",
781 .data = &unknown_nmi_panic,
782 .maxlen = sizeof (int),
783 .mode = 0644,
784 .proc_handler = proc_dointvec,
785 },
Don Zickus504d7cf2010-02-12 17:19:19 -0500786#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700787#if defined(CONFIG_X86)
788 {
Don Zickus8da5add2006-09-26 10:52:27 +0200789 .procname = "panic_on_unrecovered_nmi",
790 .data = &panic_on_unrecovered_nmi,
791 .maxlen = sizeof(int),
792 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800793 .proc_handler = proc_dointvec,
Don Zickus8da5add2006-09-26 10:52:27 +0200794 },
795 {
Kurt Garloff5211a242009-06-24 14:32:11 -0700796 .procname = "panic_on_io_nmi",
797 .data = &panic_on_io_nmi,
798 .maxlen = sizeof(int),
799 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800800 .proc_handler = proc_dointvec,
Kurt Garloff5211a242009-06-24 14:32:11 -0700801 },
Mitsuo Hayasaka55af7792011-11-29 15:08:36 +0900802#ifdef CONFIG_DEBUG_STACKOVERFLOW
803 {
804 .procname = "panic_on_stackoverflow",
805 .data = &sysctl_panic_on_stackoverflow,
806 .maxlen = sizeof(int),
807 .mode = 0644,
808 .proc_handler = proc_dointvec,
809 },
810#endif
Kurt Garloff5211a242009-06-24 14:32:11 -0700811 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700812 .procname = "bootloader_type",
813 .data = &bootloader_type,
814 .maxlen = sizeof (int),
815 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800816 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700817 },
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100818 {
H. Peter Anvin50312962009-05-07 16:54:11 -0700819 .procname = "bootloader_version",
820 .data = &bootloader_version,
821 .maxlen = sizeof (int),
822 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800823 .proc_handler = proc_dointvec,
H. Peter Anvin50312962009-05-07 16:54:11 -0700824 },
825 {
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100826 .procname = "kstack_depth_to_print",
827 .data = &kstack_depth_to_print,
828 .maxlen = sizeof(int),
829 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800830 .proc_handler = proc_dointvec,
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100831 },
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100832 {
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100833 .procname = "io_delay_type",
834 .data = &io_delay_type,
835 .maxlen = sizeof(int),
836 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800837 .proc_handler = proc_dointvec,
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100838 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700839#endif
Luke Yang7a9166e2006-02-20 18:28:07 -0800840#if defined(CONFIG_MMU)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700842 .procname = "randomize_va_space",
843 .data = &randomize_va_space,
844 .maxlen = sizeof(int),
845 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800846 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700847 },
Luke Yang7a9166e2006-02-20 18:28:07 -0800848#endif
Martin Schwidefsky0152fb32006-01-14 13:21:00 -0800849#if defined(CONFIG_S390) && defined(CONFIG_SMP)
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700850 {
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700851 .procname = "spin_retry",
852 .data = &spin_retry,
853 .maxlen = sizeof (int),
854 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800855 .proc_handler = proc_dointvec,
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700856 },
857#endif
Len Brown673d5b42007-07-28 03:33:16 -0400858#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
Pavel Machekc255d842006-02-20 18:27:58 -0800859 {
Pavel Machekc255d842006-02-20 18:27:58 -0800860 .procname = "acpi_video_flags",
Pavel Machek77afcf72007-07-19 01:47:41 -0700861 .data = &acpi_realmode_flags,
Pavel Machekc255d842006-02-20 18:27:58 -0800862 .maxlen = sizeof (unsigned long),
863 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800864 .proc_handler = proc_doulongvec_minmax,
Pavel Machekc255d842006-02-20 18:27:58 -0800865 },
866#endif
Jes Sorensend2b176e2006-02-28 09:42:23 -0800867#ifdef CONFIG_IA64
868 {
Jes Sorensend2b176e2006-02-28 09:42:23 -0800869 .procname = "ignore-unaligned-usertrap",
870 .data = &no_unaligned_warning,
871 .maxlen = sizeof (int),
872 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800873 .proc_handler = proc_dointvec,
Jes Sorensend2b176e2006-02-28 09:42:23 -0800874 },
Doug Chapman88fc2412009-01-15 10:38:56 -0800875 {
Doug Chapman88fc2412009-01-15 10:38:56 -0800876 .procname = "unaligned-dump-stack",
877 .data = &unaligned_dump_stack,
878 .maxlen = sizeof (int),
879 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800880 .proc_handler = proc_dointvec,
Doug Chapman88fc2412009-01-15 10:38:56 -0800881 },
Jes Sorensend2b176e2006-02-28 09:42:23 -0800882#endif
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800883#ifdef CONFIG_DETECT_HUNG_TASK
884 {
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800885 .procname = "hung_task_panic",
886 .data = &sysctl_hung_task_panic,
887 .maxlen = sizeof(int),
888 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800889 .proc_handler = proc_dointvec_minmax,
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800890 .extra1 = &zero,
891 .extra2 = &one,
892 },
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100893 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100894 .procname = "hung_task_check_count",
895 .data = &sysctl_hung_task_check_count,
Ingo Molnar90739082008-01-25 21:08:34 +0100896 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100897 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800898 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100899 },
900 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100901 .procname = "hung_task_timeout_secs",
902 .data = &sysctl_hung_task_timeout_secs,
Ingo Molnar90739082008-01-25 21:08:34 +0100903 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100904 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800905 .proc_handler = proc_dohung_task_timeout_secs,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100906 },
907 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100908 .procname = "hung_task_warnings",
909 .data = &sysctl_hung_task_warnings,
Ingo Molnar90739082008-01-25 21:08:34 +0100910 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100911 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800912 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100913 },
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700914#endif
Andi Kleenbebfa102006-06-26 13:56:52 +0200915#ifdef CONFIG_COMPAT
916 {
Andi Kleenbebfa102006-06-26 13:56:52 +0200917 .procname = "compat-log",
918 .data = &compat_log,
919 .maxlen = sizeof (int),
920 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800921 .proc_handler = proc_dointvec,
Andi Kleenbebfa102006-06-26 13:56:52 +0200922 },
923#endif
Ingo Molnar23f78d4a2006-06-27 02:54:53 -0700924#ifdef CONFIG_RT_MUTEXES
925 {
Ingo Molnar23f78d4a2006-06-27 02:54:53 -0700926 .procname = "max_lock_depth",
927 .data = &max_lock_depth,
928 .maxlen = sizeof(int),
929 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800930 .proc_handler = proc_dointvec,
Ingo Molnar23f78d4a2006-06-27 02:54:53 -0700931 },
932#endif
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700933 {
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700934 .procname = "poweroff_cmd",
935 .data = &poweroff_cmd,
936 .maxlen = POWEROFF_CMD_PATH_LEN,
937 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800938 .proc_handler = proc_dostring,
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700939 },
David Howells0b77f5b2008-04-29 01:01:32 -0700940#ifdef CONFIG_KEYS
941 {
David Howells0b77f5b2008-04-29 01:01:32 -0700942 .procname = "keys",
943 .mode = 0555,
944 .child = key_sysctls,
945 },
946#endif
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700947#ifdef CONFIG_RCU_TORTURE_TEST
948 {
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700949 .procname = "rcutorture_runnable",
950 .data = &rcutorture_runnable,
951 .maxlen = sizeof(int),
952 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800953 .proc_handler = proc_dointvec,
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700954 },
955#endif
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200956#ifdef CONFIG_PERF_EVENTS
Vince Weaveraa4a2212011-06-03 17:54:40 -0400957 /*
958 * User-space scripts rely on the existence of this file
959 * as a feature check for perf_events being enabled.
960 *
961 * So it's an ABI, do not remove!
962 */
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200963 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200964 .procname = "perf_event_paranoid",
965 .data = &sysctl_perf_event_paranoid,
966 .maxlen = sizeof(sysctl_perf_event_paranoid),
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200967 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800968 .proc_handler = proc_dointvec,
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200969 },
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200970 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200971 .procname = "perf_event_mlock_kb",
972 .data = &sysctl_perf_event_mlock,
973 .maxlen = sizeof(sysctl_perf_event_mlock),
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200974 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800975 .proc_handler = proc_dointvec,
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200976 },
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200977 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200978 .procname = "perf_event_max_sample_rate",
979 .data = &sysctl_perf_event_sample_rate,
980 .maxlen = sizeof(sysctl_perf_event_sample_rate),
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200981 .mode = 0644,
Peter Zijlstra163ec432011-02-16 11:22:34 +0100982 .proc_handler = perf_proc_update_handler,
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200983 },
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200984#endif
Vegard Nossumdfec0722008-04-04 00:51:41 +0200985#ifdef CONFIG_KMEMCHECK
986 {
Vegard Nossumdfec0722008-04-04 00:51:41 +0200987 .procname = "kmemcheck",
988 .data = &kmemcheck_enabled,
989 .maxlen = sizeof(int),
990 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800991 .proc_handler = proc_dointvec,
Vegard Nossumdfec0722008-04-04 00:51:41 +0200992 },
993#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200994#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200995 {
Jens Axboe5e605b62009-08-05 09:07:21 +0200996 .procname = "blk_iopoll",
997 .data = &blk_iopoll_enabled,
998 .maxlen = sizeof(int),
999 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001000 .proc_handler = proc_dointvec,
Jens Axboe5e605b62009-08-05 09:07:21 +02001001 },
Jens Axboecb684b52009-09-15 21:53:11 +02001002#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001003 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001004};
1005
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001006static struct ctl_table vm_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001007 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001008 .procname = "overcommit_memory",
1009 .data = &sysctl_overcommit_memory,
1010 .maxlen = sizeof(sysctl_overcommit_memory),
1011 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001012 .proc_handler = proc_dointvec_minmax,
1013 .extra1 = &zero,
1014 .extra2 = &two,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001015 },
1016 {
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001017 .procname = "panic_on_oom",
1018 .data = &sysctl_panic_on_oom,
1019 .maxlen = sizeof(sysctl_panic_on_oom),
1020 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001021 .proc_handler = proc_dointvec_minmax,
1022 .extra1 = &zero,
1023 .extra2 = &two,
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001024 },
1025 {
David Rientjesfe071d72007-10-16 23:25:56 -07001026 .procname = "oom_kill_allocating_task",
1027 .data = &sysctl_oom_kill_allocating_task,
1028 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1029 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001030 .proc_handler = proc_dointvec,
David Rientjesfe071d72007-10-16 23:25:56 -07001031 },
1032 {
David Rientjesfef1bdd2008-02-07 00:14:07 -08001033 .procname = "oom_dump_tasks",
1034 .data = &sysctl_oom_dump_tasks,
1035 .maxlen = sizeof(sysctl_oom_dump_tasks),
1036 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001037 .proc_handler = proc_dointvec,
David Rientjesfef1bdd2008-02-07 00:14:07 -08001038 },
1039 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001040 .procname = "overcommit_ratio",
1041 .data = &sysctl_overcommit_ratio,
1042 .maxlen = sizeof(sysctl_overcommit_ratio),
1043 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001044 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001045 },
1046 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001047 .procname = "page-cluster",
1048 .data = &page_cluster,
1049 .maxlen = sizeof(int),
1050 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001051 .proc_handler = proc_dointvec_minmax,
1052 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001053 },
1054 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001055 .procname = "dirty_background_ratio",
1056 .data = &dirty_background_ratio,
1057 .maxlen = sizeof(dirty_background_ratio),
1058 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001059 .proc_handler = dirty_background_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001060 .extra1 = &zero,
1061 .extra2 = &one_hundred,
1062 },
1063 {
David Rientjes2da02992009-01-06 14:39:31 -08001064 .procname = "dirty_background_bytes",
1065 .data = &dirty_background_bytes,
1066 .maxlen = sizeof(dirty_background_bytes),
1067 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001068 .proc_handler = dirty_background_bytes_handler,
Sven Wegenerfc3501d2009-02-11 13:04:23 -08001069 .extra1 = &one_ul,
David Rientjes2da02992009-01-06 14:39:31 -08001070 },
1071 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001072 .procname = "dirty_ratio",
1073 .data = &vm_dirty_ratio,
1074 .maxlen = sizeof(vm_dirty_ratio),
1075 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001076 .proc_handler = dirty_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001077 .extra1 = &zero,
1078 .extra2 = &one_hundred,
1079 },
1080 {
David Rientjes2da02992009-01-06 14:39:31 -08001081 .procname = "dirty_bytes",
1082 .data = &vm_dirty_bytes,
1083 .maxlen = sizeof(vm_dirty_bytes),
1084 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001085 .proc_handler = dirty_bytes_handler,
Andrea Righi9e4a5bd2009-04-30 15:08:57 -07001086 .extra1 = &dirty_bytes_min,
David Rientjes2da02992009-01-06 14:39:31 -08001087 },
1088 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001089 .procname = "dirty_writeback_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001090 .data = &dirty_writeback_interval,
1091 .maxlen = sizeof(dirty_writeback_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001092 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001093 .proc_handler = dirty_writeback_centisecs_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001094 },
1095 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001096 .procname = "dirty_expire_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001097 .data = &dirty_expire_interval,
1098 .maxlen = sizeof(dirty_expire_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001099 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001100 .proc_handler = proc_dointvec_minmax,
1101 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001102 },
1103 {
Wanpeng Li3965c9a2012-07-31 16:41:52 -07001104 .procname = "nr_pdflush_threads",
1105 .mode = 0444 /* read-only */,
1106 .proc_handler = pdflush_proc_obsolete,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001107 },
1108 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001109 .procname = "swappiness",
1110 .data = &vm_swappiness,
1111 .maxlen = sizeof(vm_swappiness),
1112 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001113 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001114 .extra1 = &zero,
1115 .extra2 = &one_hundred,
1116 },
1117#ifdef CONFIG_HUGETLB_PAGE
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001118 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001119 .procname = "nr_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001120 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001121 .maxlen = sizeof(unsigned long),
1122 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001123 .proc_handler = hugetlb_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001124 .extra1 = (void *)&hugetlb_zero,
1125 .extra2 = (void *)&hugetlb_infinity,
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001126 },
1127#ifdef CONFIG_NUMA
1128 {
1129 .procname = "nr_hugepages_mempolicy",
1130 .data = NULL,
1131 .maxlen = sizeof(unsigned long),
1132 .mode = 0644,
1133 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1134 .extra1 = (void *)&hugetlb_zero,
1135 .extra2 = (void *)&hugetlb_infinity,
1136 },
1137#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001138 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001139 .procname = "hugetlb_shm_group",
1140 .data = &sysctl_hugetlb_shm_group,
1141 .maxlen = sizeof(gid_t),
1142 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001143 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001144 },
Mel Gorman396faf02007-07-17 04:03:13 -07001145 {
Mel Gorman396faf02007-07-17 04:03:13 -07001146 .procname = "hugepages_treat_as_movable",
1147 .data = &hugepages_treat_as_movable,
1148 .maxlen = sizeof(int),
1149 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001150 .proc_handler = hugetlb_treat_movable_handler,
Mel Gorman396faf02007-07-17 04:03:13 -07001151 },
Adam Litke54f9f802007-10-16 01:26:20 -07001152 {
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001153 .procname = "nr_overcommit_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001154 .data = NULL,
1155 .maxlen = sizeof(unsigned long),
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001156 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001157 .proc_handler = hugetlb_overcommit_handler,
Andi Kleene5ff2152008-07-23 21:27:42 -07001158 .extra1 = (void *)&hugetlb_zero,
1159 .extra2 = (void *)&hugetlb_infinity,
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001160 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001161#endif
1162 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001163 .procname = "lowmem_reserve_ratio",
1164 .data = &sysctl_lowmem_reserve_ratio,
1165 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1166 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001167 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001168 },
1169 {
Andrew Morton9d0243b2006-01-08 01:00:39 -08001170 .procname = "drop_caches",
1171 .data = &sysctl_drop_caches,
1172 .maxlen = sizeof(int),
1173 .mode = 0644,
1174 .proc_handler = drop_caches_sysctl_handler,
Petr Holasekcb16e952011-03-23 16:43:09 -07001175 .extra1 = &one,
1176 .extra2 = &three,
Andrew Morton9d0243b2006-01-08 01:00:39 -08001177 },
Mel Gorman76ab0f52010-05-24 14:32:28 -07001178#ifdef CONFIG_COMPACTION
1179 {
1180 .procname = "compact_memory",
1181 .data = &sysctl_compact_memory,
1182 .maxlen = sizeof(int),
1183 .mode = 0200,
1184 .proc_handler = sysctl_compaction_handler,
1185 },
Mel Gorman5e771902010-05-24 14:32:31 -07001186 {
1187 .procname = "extfrag_threshold",
1188 .data = &sysctl_extfrag_threshold,
1189 .maxlen = sizeof(int),
1190 .mode = 0644,
1191 .proc_handler = sysctl_extfrag_handler,
1192 .extra1 = &min_extfrag_threshold,
1193 .extra2 = &max_extfrag_threshold,
1194 },
1195
Mel Gorman76ab0f52010-05-24 14:32:28 -07001196#endif /* CONFIG_COMPACTION */
Andrew Morton9d0243b2006-01-08 01:00:39 -08001197 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001198 .procname = "min_free_kbytes",
1199 .data = &min_free_kbytes,
1200 .maxlen = sizeof(min_free_kbytes),
1201 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001202 .proc_handler = min_free_kbytes_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001203 .extra1 = &zero,
1204 },
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001205 {
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001206 .procname = "percpu_pagelist_fraction",
1207 .data = &percpu_pagelist_fraction,
1208 .maxlen = sizeof(percpu_pagelist_fraction),
1209 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001210 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001211 .extra1 = &min_percpu_pagelist_fract,
1212 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001213#ifdef CONFIG_MMU
1214 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001215 .procname = "max_map_count",
1216 .data = &sysctl_max_map_count,
1217 .maxlen = sizeof(sysctl_max_map_count),
1218 .mode = 0644,
WANG Cong3e261202009-12-17 15:27:05 -08001219 .proc_handler = proc_dointvec_minmax,
Amerigo Wang70da2342009-12-14 17:59:52 -08001220 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001221 },
Paul Mundtdd8632a2009-01-08 12:04:47 +00001222#else
1223 {
Paul Mundtdd8632a2009-01-08 12:04:47 +00001224 .procname = "nr_trim_pages",
1225 .data = &sysctl_nr_trim_pages,
1226 .maxlen = sizeof(sysctl_nr_trim_pages),
1227 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001228 .proc_handler = proc_dointvec_minmax,
Paul Mundtdd8632a2009-01-08 12:04:47 +00001229 .extra1 = &zero,
1230 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001231#endif
1232 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001233 .procname = "laptop_mode",
1234 .data = &laptop_mode,
1235 .maxlen = sizeof(laptop_mode),
1236 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001237 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001238 },
1239 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001240 .procname = "block_dump",
1241 .data = &block_dump,
1242 .maxlen = sizeof(block_dump),
1243 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001244 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001245 .extra1 = &zero,
1246 },
1247 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001248 .procname = "vfs_cache_pressure",
1249 .data = &sysctl_vfs_cache_pressure,
1250 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1251 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001252 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001253 .extra1 = &zero,
1254 },
1255#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1256 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001257 .procname = "legacy_va_layout",
1258 .data = &sysctl_legacy_va_layout,
1259 .maxlen = sizeof(sysctl_legacy_va_layout),
1260 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001261 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001262 .extra1 = &zero,
1263 },
1264#endif
Christoph Lameter17436602006-01-18 17:42:32 -08001265#ifdef CONFIG_NUMA
1266 {
Christoph Lameter17436602006-01-18 17:42:32 -08001267 .procname = "zone_reclaim_mode",
1268 .data = &zone_reclaim_mode,
1269 .maxlen = sizeof(zone_reclaim_mode),
1270 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001271 .proc_handler = proc_dointvec,
Christoph Lameterc84db232006-02-01 03:05:29 -08001272 .extra1 = &zero,
Christoph Lameter17436602006-01-18 17:42:32 -08001273 },
Christoph Lameter96146342006-07-03 00:24:13 -07001274 {
Christoph Lameter96146342006-07-03 00:24:13 -07001275 .procname = "min_unmapped_ratio",
1276 .data = &sysctl_min_unmapped_ratio,
1277 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1278 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001279 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
Christoph Lameter96146342006-07-03 00:24:13 -07001280 .extra1 = &zero,
1281 .extra2 = &one_hundred,
1282 },
Christoph Lameter0ff38492006-09-25 23:31:52 -07001283 {
Christoph Lameter0ff38492006-09-25 23:31:52 -07001284 .procname = "min_slab_ratio",
1285 .data = &sysctl_min_slab_ratio,
1286 .maxlen = sizeof(sysctl_min_slab_ratio),
1287 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001288 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
Christoph Lameter0ff38492006-09-25 23:31:52 -07001289 .extra1 = &zero,
1290 .extra2 = &one_hundred,
1291 },
Christoph Lameter17436602006-01-18 17:42:32 -08001292#endif
Christoph Lameter77461ab2007-05-09 02:35:13 -07001293#ifdef CONFIG_SMP
1294 {
Christoph Lameter77461ab2007-05-09 02:35:13 -07001295 .procname = "stat_interval",
1296 .data = &sysctl_stat_interval,
1297 .maxlen = sizeof(sysctl_stat_interval),
1298 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001299 .proc_handler = proc_dointvec_jiffies,
Christoph Lameter77461ab2007-05-09 02:35:13 -07001300 },
1301#endif
David Howells6e141542009-12-15 19:27:45 +00001302#ifdef CONFIG_MMU
Eric Parised032182007-06-28 15:55:21 -04001303 {
Eric Parised032182007-06-28 15:55:21 -04001304 .procname = "mmap_min_addr",
Eric Paris788084a2009-07-31 12:54:11 -04001305 .data = &dac_mmap_min_addr,
1306 .maxlen = sizeof(unsigned long),
Eric Parised032182007-06-28 15:55:21 -04001307 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001308 .proc_handler = mmap_min_addr_handler,
Eric Parised032182007-06-28 15:55:21 -04001309 },
David Howells6e141542009-12-15 19:27:45 +00001310#endif
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001311#ifdef CONFIG_NUMA
1312 {
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001313 .procname = "numa_zonelist_order",
1314 .data = &numa_zonelist_order,
1315 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1316 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001317 .proc_handler = numa_zonelist_order_handler,
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001318 },
1319#endif
Al Viro2b8232c2007-10-13 08:16:04 +01001320#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
Paul Mundt5c36e652007-03-01 10:07:42 +09001321 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
Ingo Molnare6e54942006-06-27 02:53:50 -07001322 {
Ingo Molnare6e54942006-06-27 02:53:50 -07001323 .procname = "vdso_enabled",
1324 .data = &vdso_enabled,
1325 .maxlen = sizeof(vdso_enabled),
1326 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001327 .proc_handler = proc_dointvec,
Ingo Molnare6e54942006-06-27 02:53:50 -07001328 .extra1 = &zero,
1329 },
1330#endif
Bron Gondwana195cf4532008-02-04 22:29:20 -08001331#ifdef CONFIG_HIGHMEM
1332 {
Bron Gondwana195cf4532008-02-04 22:29:20 -08001333 .procname = "highmem_is_dirtyable",
1334 .data = &vm_highmem_is_dirtyable,
1335 .maxlen = sizeof(vm_highmem_is_dirtyable),
1336 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001337 .proc_handler = proc_dointvec_minmax,
Bron Gondwana195cf4532008-02-04 22:29:20 -08001338 .extra1 = &zero,
1339 .extra2 = &one,
1340 },
1341#endif
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001342 {
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001343 .procname = "scan_unevictable_pages",
1344 .data = &scan_unevictable_pages,
1345 .maxlen = sizeof(scan_unevictable_pages),
1346 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001347 .proc_handler = scan_unevictable_handler,
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001348 },
Andi Kleen6a460792009-09-16 11:50:15 +02001349#ifdef CONFIG_MEMORY_FAILURE
1350 {
Andi Kleen6a460792009-09-16 11:50:15 +02001351 .procname = "memory_failure_early_kill",
1352 .data = &sysctl_memory_failure_early_kill,
1353 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1354 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001355 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001356 .extra1 = &zero,
1357 .extra2 = &one,
1358 },
1359 {
Andi Kleen6a460792009-09-16 11:50:15 +02001360 .procname = "memory_failure_recovery",
1361 .data = &sysctl_memory_failure_recovery,
1362 .maxlen = sizeof(sysctl_memory_failure_recovery),
1363 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001364 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001365 .extra1 = &zero,
1366 .extra2 = &one,
1367 },
1368#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001369 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001370};
1371
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001372#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001373static struct ctl_table binfmt_misc_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001374 { }
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001375};
1376#endif
1377
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001378static struct ctl_table fs_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001379 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001380 .procname = "inode-nr",
1381 .data = &inodes_stat,
1382 .maxlen = 2*sizeof(int),
1383 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001384 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001385 },
1386 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001387 .procname = "inode-state",
1388 .data = &inodes_stat,
1389 .maxlen = 7*sizeof(int),
1390 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001391 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001392 },
1393 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001394 .procname = "file-nr",
1395 .data = &files_stat,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001396 .maxlen = sizeof(files_stat),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001397 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001398 .proc_handler = proc_nr_files,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001399 },
1400 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001401 .procname = "file-max",
1402 .data = &files_stat.max_files,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001403 .maxlen = sizeof(files_stat.max_files),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001404 .mode = 0644,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001405 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001406 },
1407 {
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001408 .procname = "nr_open",
1409 .data = &sysctl_nr_open,
1410 .maxlen = sizeof(int),
1411 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001412 .proc_handler = proc_dointvec_minmax,
Al Viroeceea0b2008-05-10 10:08:32 -04001413 .extra1 = &sysctl_nr_open_min,
1414 .extra2 = &sysctl_nr_open_max,
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001415 },
1416 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001417 .procname = "dentry-state",
1418 .data = &dentry_stat,
1419 .maxlen = 6*sizeof(int),
1420 .mode = 0444,
Christoph Hellwig312d3ca2010-10-10 05:36:23 -04001421 .proc_handler = proc_nr_dentry,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001422 },
1423 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001424 .procname = "overflowuid",
1425 .data = &fs_overflowuid,
1426 .maxlen = sizeof(int),
1427 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001428 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001429 .extra1 = &minolduid,
1430 .extra2 = &maxolduid,
1431 },
1432 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001433 .procname = "overflowgid",
1434 .data = &fs_overflowgid,
1435 .maxlen = sizeof(int),
1436 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001437 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001438 .extra1 = &minolduid,
1439 .extra2 = &maxolduid,
1440 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001441#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001442 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001443 .procname = "leases-enable",
1444 .data = &leases_enable,
1445 .maxlen = sizeof(int),
1446 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001447 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001448 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001449#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001450#ifdef CONFIG_DNOTIFY
1451 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001452 .procname = "dir-notify-enable",
1453 .data = &dir_notify_enable,
1454 .maxlen = sizeof(int),
1455 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001456 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001457 },
1458#endif
1459#ifdef CONFIG_MMU
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001460#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001461 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001462 .procname = "lease-break-time",
1463 .data = &lease_break_time,
1464 .maxlen = sizeof(int),
1465 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001466 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001467 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001468#endif
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001469#ifdef CONFIG_AIO
Linus Torvalds1da177e2005-04-16 15:20:36 -07001470 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001471 .procname = "aio-nr",
1472 .data = &aio_nr,
1473 .maxlen = sizeof(aio_nr),
1474 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001475 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001476 },
1477 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001478 .procname = "aio-max-nr",
1479 .data = &aio_max_nr,
1480 .maxlen = sizeof(aio_max_nr),
1481 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001482 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001483 },
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001484#endif /* CONFIG_AIO */
Amy Griffis2d9048e2006-06-01 13:10:59 -07001485#ifdef CONFIG_INOTIFY_USER
Robert Love0399cb02005-07-13 12:38:18 -04001486 {
Robert Love0399cb02005-07-13 12:38:18 -04001487 .procname = "inotify",
1488 .mode = 0555,
1489 .child = inotify_table,
1490 },
1491#endif
Davide Libenzi7ef99642008-12-01 13:13:55 -08001492#ifdef CONFIG_EPOLL
1493 {
1494 .procname = "epoll",
1495 .mode = 0555,
1496 .child = epoll_table,
1497 },
1498#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001499#endif
Alan Coxd6e71142005-06-23 00:09:43 -07001500 {
Alan Coxd6e71142005-06-23 00:09:43 -07001501 .procname = "suid_dumpable",
1502 .data = &suid_dumpable,
1503 .maxlen = sizeof(int),
1504 .mode = 0644,
Kees Cook54b50192012-07-30 14:39:18 -07001505 .proc_handler = proc_dointvec_minmax_coredump,
Matthew Wilcox8e654fb2009-04-02 16:58:33 -07001506 .extra1 = &zero,
1507 .extra2 = &two,
Alan Coxd6e71142005-06-23 00:09:43 -07001508 },
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001509#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1510 {
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001511 .procname = "binfmt_misc",
1512 .mode = 0555,
1513 .child = binfmt_misc_table,
1514 },
1515#endif
Jens Axboeb492e952010-05-19 21:03:16 +02001516 {
Jens Axboeff9da692010-06-03 14:54:39 +02001517 .procname = "pipe-max-size",
1518 .data = &pipe_max_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001519 .maxlen = sizeof(int),
1520 .mode = 0644,
Jens Axboeff9da692010-06-03 14:54:39 +02001521 .proc_handler = &pipe_proc_fn,
1522 .extra1 = &pipe_min_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001523 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001524 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001525};
1526
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001527static struct ctl_table debug_table[] = {
Heiko Carstensab3c68e2010-05-17 10:00:21 +02001528#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
Chris Metcalf571d76a2011-05-16 14:23:44 -04001529 defined(CONFIG_S390) || defined(CONFIG_TILE)
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001530 {
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001531 .procname = "exception-trace",
1532 .data = &show_unhandled_signals,
1533 .maxlen = sizeof(int),
1534 .mode = 0644,
1535 .proc_handler = proc_dointvec
1536 },
1537#endif
Masami Hiramatsub2be84d2010-02-25 08:34:15 -05001538#if defined(CONFIG_OPTPROBES)
1539 {
1540 .procname = "kprobes-optimization",
1541 .data = &sysctl_kprobes_optimization,
1542 .maxlen = sizeof(int),
1543 .mode = 0644,
1544 .proc_handler = proc_kprobes_optimization_handler,
1545 .extra1 = &zero,
1546 .extra2 = &one,
1547 },
1548#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001549 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001550};
1551
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001552static struct ctl_table dev_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001553 { }
Robert Love0eeca282005-07-12 17:06:03 -04001554};
Linus Torvalds1da177e2005-04-16 15:20:36 -07001555
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001556int __init sysctl_init(void)
Al Viro330d57f2005-11-04 10:18:40 +00001557{
Steven Rostedtfd4b6162012-07-30 14:42:48 -07001558 struct ctl_table_header *hdr;
1559
1560 hdr = register_sysctl_table(sysctl_base_table);
1561 kmemleak_not_leak(hdr);
Eric W. Biedermand912b0c2007-02-14 00:34:13 -08001562 return 0;
1563}
1564
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001565#endif /* CONFIG_SYSCTL */
1566
Linus Torvalds1da177e2005-04-16 15:20:36 -07001567/*
1568 * /proc/sys support
1569 */
1570
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001571#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -07001572
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001573static int _proc_do_string(void* data, int maxlen, int write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001574 void __user *buffer,
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001575 size_t *lenp, loff_t *ppos)
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001576{
1577 size_t len;
1578 char __user *p;
1579 char c;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001580
1581 if (!data || !maxlen || !*lenp) {
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001582 *lenp = 0;
1583 return 0;
1584 }
Oleg Nesterov8d060872007-02-10 01:46:38 -08001585
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001586 if (write) {
1587 len = 0;
1588 p = buffer;
1589 while (len < *lenp) {
1590 if (get_user(c, p++))
1591 return -EFAULT;
1592 if (c == 0 || c == '\n')
1593 break;
1594 len++;
1595 }
1596 if (len >= maxlen)
1597 len = maxlen-1;
1598 if(copy_from_user(data, buffer, len))
1599 return -EFAULT;
1600 ((char *) data)[len] = 0;
1601 *ppos += *lenp;
1602 } else {
1603 len = strlen(data);
1604 if (len > maxlen)
1605 len = maxlen;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001606
1607 if (*ppos > len) {
1608 *lenp = 0;
1609 return 0;
1610 }
1611
1612 data += *ppos;
1613 len -= *ppos;
1614
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001615 if (len > *lenp)
1616 len = *lenp;
1617 if (len)
1618 if(copy_to_user(buffer, data, len))
1619 return -EFAULT;
1620 if (len < *lenp) {
1621 if(put_user('\n', ((char __user *) buffer) + len))
1622 return -EFAULT;
1623 len++;
1624 }
1625 *lenp = len;
1626 *ppos += len;
1627 }
1628 return 0;
1629}
1630
Linus Torvalds1da177e2005-04-16 15:20:36 -07001631/**
1632 * proc_dostring - read a string sysctl
1633 * @table: the sysctl table
1634 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001635 * @buffer: the user buffer
1636 * @lenp: the size of the user buffer
1637 * @ppos: file position
1638 *
1639 * Reads/writes a string from/to the user buffer. If the kernel
1640 * buffer provided is not large enough to hold the string, the
1641 * string is truncated. The copied string is %NULL-terminated.
1642 * If the string is being read by the user process, it is copied
1643 * and a newline '\n' is added. It is truncated if the buffer is
1644 * not large enough.
1645 *
1646 * Returns 0 on success.
1647 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001648int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001649 void __user *buffer, size_t *lenp, loff_t *ppos)
1650{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001651 return _proc_do_string(table->data, table->maxlen, write,
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001652 buffer, lenp, ppos);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001653}
1654
Amerigo Wang00b7c332010-05-05 00:26:45 +00001655static size_t proc_skip_spaces(char **buf)
1656{
1657 size_t ret;
1658 char *tmp = skip_spaces(*buf);
1659 ret = tmp - *buf;
1660 *buf = tmp;
1661 return ret;
1662}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001663
Octavian Purdila9f977fb2010-05-05 00:26:55 +00001664static void proc_skip_char(char **buf, size_t *size, const char v)
1665{
1666 while (*size) {
1667 if (**buf != v)
1668 break;
1669 (*size)--;
1670 (*buf)++;
1671 }
1672}
1673
Amerigo Wang00b7c332010-05-05 00:26:45 +00001674#define TMPBUFLEN 22
1675/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001676 * proc_get_long - reads an ASCII formatted integer from a user buffer
Amerigo Wang00b7c332010-05-05 00:26:45 +00001677 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001678 * @buf: a kernel buffer
1679 * @size: size of the kernel buffer
1680 * @val: this is where the number will be stored
1681 * @neg: set to %TRUE if number is negative
1682 * @perm_tr: a vector which contains the allowed trailers
1683 * @perm_tr_len: size of the perm_tr vector
1684 * @tr: pointer to store the trailer character
Amerigo Wang00b7c332010-05-05 00:26:45 +00001685 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001686 * In case of success %0 is returned and @buf and @size are updated with
1687 * the amount of bytes read. If @tr is non-NULL and a trailing
1688 * character exists (size is non-zero after returning from this
1689 * function), @tr is updated with the trailing character.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001690 */
1691static int proc_get_long(char **buf, size_t *size,
1692 unsigned long *val, bool *neg,
1693 const char *perm_tr, unsigned perm_tr_len, char *tr)
1694{
1695 int len;
1696 char *p, tmp[TMPBUFLEN];
1697
1698 if (!*size)
1699 return -EINVAL;
1700
1701 len = *size;
1702 if (len > TMPBUFLEN - 1)
1703 len = TMPBUFLEN - 1;
1704
1705 memcpy(tmp, *buf, len);
1706
1707 tmp[len] = 0;
1708 p = tmp;
1709 if (*p == '-' && *size > 1) {
1710 *neg = true;
1711 p++;
1712 } else
1713 *neg = false;
1714 if (!isdigit(*p))
1715 return -EINVAL;
1716
1717 *val = simple_strtoul(p, &p, 0);
1718
1719 len = p - tmp;
1720
1721 /* We don't know if the next char is whitespace thus we may accept
1722 * invalid integers (e.g. 1234...a) or two integers instead of one
1723 * (e.g. 123...1). So lets not allow such large numbers. */
1724 if (len == TMPBUFLEN - 1)
1725 return -EINVAL;
1726
1727 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
1728 return -EINVAL;
1729
1730 if (tr && (len < *size))
1731 *tr = *p;
1732
1733 *buf += len;
1734 *size -= len;
1735
1736 return 0;
1737}
1738
1739/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001740 * proc_put_long - converts an integer to a decimal ASCII formatted string
Amerigo Wang00b7c332010-05-05 00:26:45 +00001741 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001742 * @buf: the user buffer
1743 * @size: the size of the user buffer
1744 * @val: the integer to be converted
1745 * @neg: sign of the number, %TRUE for negative
Amerigo Wang00b7c332010-05-05 00:26:45 +00001746 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001747 * In case of success %0 is returned and @buf and @size are updated with
1748 * the amount of bytes written.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001749 */
1750static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
1751 bool neg)
1752{
1753 int len;
1754 char tmp[TMPBUFLEN], *p = tmp;
1755
1756 sprintf(p, "%s%lu", neg ? "-" : "", val);
1757 len = strlen(tmp);
1758 if (len > *size)
1759 len = *size;
1760 if (copy_to_user(*buf, tmp, len))
1761 return -EFAULT;
1762 *size -= len;
1763 *buf += len;
1764 return 0;
1765}
1766#undef TMPBUFLEN
1767
1768static int proc_put_char(void __user **buf, size_t *size, char c)
1769{
1770 if (*size) {
1771 char __user **buffer = (char __user **)buf;
1772 if (put_user(c, *buffer))
1773 return -EFAULT;
1774 (*size)--, (*buffer)++;
1775 *buf = *buffer;
1776 }
1777 return 0;
1778}
1779
1780static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001781 int *valp,
1782 int write, void *data)
1783{
1784 if (write) {
1785 *valp = *negp ? -*lvalp : *lvalp;
1786 } else {
1787 int val = *valp;
1788 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001789 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001790 *lvalp = (unsigned long)-val;
1791 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001792 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001793 *lvalp = (unsigned long)val;
1794 }
1795 }
1796 return 0;
1797}
1798
Amerigo Wang00b7c332010-05-05 00:26:45 +00001799static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
1800
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001801static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001802 int write, void __user *buffer,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001803 size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001804 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001805 int write, void *data),
1806 void *data)
1807{
Amerigo Wang00b7c332010-05-05 00:26:45 +00001808 int *i, vleft, first = 1, err = 0;
1809 unsigned long page = 0;
1810 size_t left;
1811 char *kbuf;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001812
Amerigo Wang00b7c332010-05-05 00:26:45 +00001813 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001814 *lenp = 0;
1815 return 0;
1816 }
1817
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001818 i = (int *) tbl_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001819 vleft = table->maxlen / sizeof(*i);
1820 left = *lenp;
1821
1822 if (!conv)
1823 conv = do_proc_dointvec_conv;
1824
Linus Torvalds1da177e2005-04-16 15:20:36 -07001825 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001826 if (left > PAGE_SIZE - 1)
1827 left = PAGE_SIZE - 1;
1828 page = __get_free_page(GFP_TEMPORARY);
1829 kbuf = (char *) page;
1830 if (!kbuf)
1831 return -ENOMEM;
1832 if (copy_from_user(kbuf, buffer, left)) {
1833 err = -EFAULT;
1834 goto free;
1835 }
1836 kbuf[left] = 0;
1837 }
1838
1839 for (; left && vleft--; i++, first=0) {
1840 unsigned long lval;
1841 bool neg;
1842
1843 if (write) {
1844 left -= proc_skip_spaces(&kbuf);
1845
J. R. Okajima563b0462010-05-25 16:10:14 -07001846 if (!left)
1847 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001848 err = proc_get_long(&kbuf, &left, &lval, &neg,
1849 proc_wspace_sep,
1850 sizeof(proc_wspace_sep), NULL);
1851 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001852 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001853 if (conv(&neg, &lval, i, 1, data)) {
1854 err = -EINVAL;
1855 break;
1856 }
1857 } else {
1858 if (conv(&neg, &lval, i, 0, data)) {
1859 err = -EINVAL;
1860 break;
1861 }
1862 if (!first)
1863 err = proc_put_char(&buffer, &left, '\t');
1864 if (err)
1865 break;
1866 err = proc_put_long(&buffer, &left, lval, neg);
1867 if (err)
1868 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001869 }
1870 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00001871
1872 if (!write && !first && left && !err)
1873 err = proc_put_char(&buffer, &left, '\n');
J. R. Okajima563b0462010-05-25 16:10:14 -07001874 if (write && !err && left)
Amerigo Wang00b7c332010-05-05 00:26:45 +00001875 left -= proc_skip_spaces(&kbuf);
1876free:
1877 if (write) {
1878 free_page(page);
1879 if (first)
1880 return err ? : -EINVAL;
1881 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001882 *lenp -= left;
1883 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001884 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001885}
1886
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001887static int do_proc_dointvec(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001888 void __user *buffer, size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001889 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001890 int write, void *data),
1891 void *data)
1892{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001893 return __do_proc_dointvec(table->data, table, write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001894 buffer, lenp, ppos, conv, data);
1895}
1896
Linus Torvalds1da177e2005-04-16 15:20:36 -07001897/**
1898 * proc_dointvec - read a vector of integers
1899 * @table: the sysctl table
1900 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001901 * @buffer: the user buffer
1902 * @lenp: the size of the user buffer
1903 * @ppos: file position
1904 *
1905 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1906 * values from/to the user buffer, treated as an ASCII string.
1907 *
1908 * Returns 0 on success.
1909 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001910int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001911 void __user *buffer, size_t *lenp, loff_t *ppos)
1912{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001913 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001914 NULL,NULL);
1915}
1916
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001917/*
Andi Kleen25ddbb12008-10-15 22:01:41 -07001918 * Taint values can only be increased
1919 * This means we can safely use a temporary.
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001920 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001921static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001922 void __user *buffer, size_t *lenp, loff_t *ppos)
1923{
Andi Kleen25ddbb12008-10-15 22:01:41 -07001924 struct ctl_table t;
1925 unsigned long tmptaint = get_taint();
1926 int err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001927
Bastian Blank91fcd412007-04-23 14:41:14 -07001928 if (write && !capable(CAP_SYS_ADMIN))
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001929 return -EPERM;
1930
Andi Kleen25ddbb12008-10-15 22:01:41 -07001931 t = *table;
1932 t.data = &tmptaint;
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001933 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
Andi Kleen25ddbb12008-10-15 22:01:41 -07001934 if (err < 0)
1935 return err;
1936
1937 if (write) {
1938 /*
1939 * Poor man's atomic or. Not worth adding a primitive
1940 * to everyone's atomic.h for this
1941 */
1942 int i;
1943 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
1944 if ((tmptaint >> i) & 1)
1945 add_taint(i);
1946 }
1947 }
1948
1949 return err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001950}
1951
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001952#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -07001953static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001954 void __user *buffer, size_t *lenp, loff_t *ppos)
1955{
1956 if (write && !capable(CAP_SYS_ADMIN))
1957 return -EPERM;
1958
1959 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
1960}
1961#endif
1962
Linus Torvalds1da177e2005-04-16 15:20:36 -07001963struct do_proc_dointvec_minmax_conv_param {
1964 int *min;
1965 int *max;
1966};
1967
Amerigo Wang00b7c332010-05-05 00:26:45 +00001968static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
1969 int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001970 int write, void *data)
1971{
1972 struct do_proc_dointvec_minmax_conv_param *param = data;
1973 if (write) {
1974 int val = *negp ? -*lvalp : *lvalp;
1975 if ((param->min && *param->min > val) ||
1976 (param->max && *param->max < val))
1977 return -EINVAL;
1978 *valp = val;
1979 } else {
1980 int val = *valp;
1981 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001982 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001983 *lvalp = (unsigned long)-val;
1984 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001985 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001986 *lvalp = (unsigned long)val;
1987 }
1988 }
1989 return 0;
1990}
1991
1992/**
1993 * proc_dointvec_minmax - read a vector of integers with min/max values
1994 * @table: the sysctl table
1995 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001996 * @buffer: the user buffer
1997 * @lenp: the size of the user buffer
1998 * @ppos: file position
1999 *
2000 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2001 * values from/to the user buffer, treated as an ASCII string.
2002 *
2003 * This routine will ensure the values are within the range specified by
2004 * table->extra1 (min) and table->extra2 (max).
2005 *
2006 * Returns 0 on success.
2007 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002008int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002009 void __user *buffer, size_t *lenp, loff_t *ppos)
2010{
2011 struct do_proc_dointvec_minmax_conv_param param = {
2012 .min = (int *) table->extra1,
2013 .max = (int *) table->extra2,
2014 };
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002015 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002016 do_proc_dointvec_minmax_conv, &param);
2017}
2018
Kees Cook54b50192012-07-30 14:39:18 -07002019static void validate_coredump_safety(void)
2020{
2021 if (suid_dumpable == SUID_DUMPABLE_SAFE &&
2022 core_pattern[0] != '/' && core_pattern[0] != '|') {
2023 printk(KERN_WARNING "Unsafe core_pattern used with "\
2024 "suid_dumpable=2. Pipe handler or fully qualified "\
2025 "core dump path required.\n");
2026 }
2027}
2028
2029static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
2030 void __user *buffer, size_t *lenp, loff_t *ppos)
2031{
2032 int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
2033 if (!error)
2034 validate_coredump_safety();
2035 return error;
2036}
2037
2038static int proc_dostring_coredump(struct ctl_table *table, int write,
2039 void __user *buffer, size_t *lenp, loff_t *ppos)
2040{
2041 int error = proc_dostring(table, write, buffer, lenp, ppos);
2042 if (!error)
2043 validate_coredump_safety();
2044 return error;
2045}
2046
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002047static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002048 void __user *buffer,
2049 size_t *lenp, loff_t *ppos,
2050 unsigned long convmul,
2051 unsigned long convdiv)
2052{
Amerigo Wang00b7c332010-05-05 00:26:45 +00002053 unsigned long *i, *min, *max;
2054 int vleft, first = 1, err = 0;
2055 unsigned long page = 0;
2056 size_t left;
2057 char *kbuf;
2058
2059 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002060 *lenp = 0;
2061 return 0;
2062 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002063
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002064 i = (unsigned long *) data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002065 min = (unsigned long *) table->extra1;
2066 max = (unsigned long *) table->extra2;
2067 vleft = table->maxlen / sizeof(unsigned long);
2068 left = *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002069
2070 if (write) {
2071 if (left > PAGE_SIZE - 1)
2072 left = PAGE_SIZE - 1;
2073 page = __get_free_page(GFP_TEMPORARY);
2074 kbuf = (char *) page;
2075 if (!kbuf)
2076 return -ENOMEM;
2077 if (copy_from_user(kbuf, buffer, left)) {
2078 err = -EFAULT;
2079 goto free;
2080 }
2081 kbuf[left] = 0;
2082 }
2083
Eric Dumazet27b3d802010-10-07 12:59:29 -07002084 for (; left && vleft--; i++, first = 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002085 unsigned long val;
2086
Linus Torvalds1da177e2005-04-16 15:20:36 -07002087 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002088 bool neg;
2089
2090 left -= proc_skip_spaces(&kbuf);
2091
2092 err = proc_get_long(&kbuf, &left, &val, &neg,
2093 proc_wspace_sep,
2094 sizeof(proc_wspace_sep), NULL);
2095 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002096 break;
2097 if (neg)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002098 continue;
2099 if ((min && val < *min) || (max && val > *max))
2100 continue;
2101 *i = val;
2102 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002103 val = convdiv * (*i) / convmul;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002104 if (!first)
Amerigo Wang00b7c332010-05-05 00:26:45 +00002105 err = proc_put_char(&buffer, &left, '\t');
2106 err = proc_put_long(&buffer, &left, val, false);
2107 if (err)
2108 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002109 }
2110 }
2111
Amerigo Wang00b7c332010-05-05 00:26:45 +00002112 if (!write && !first && left && !err)
2113 err = proc_put_char(&buffer, &left, '\n');
2114 if (write && !err)
2115 left -= proc_skip_spaces(&kbuf);
2116free:
Linus Torvalds1da177e2005-04-16 15:20:36 -07002117 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002118 free_page(page);
2119 if (first)
2120 return err ? : -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002121 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002122 *lenp -= left;
2123 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002124 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002125}
2126
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002127static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002128 void __user *buffer,
2129 size_t *lenp, loff_t *ppos,
2130 unsigned long convmul,
2131 unsigned long convdiv)
2132{
2133 return __do_proc_doulongvec_minmax(table->data, table, write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002134 buffer, lenp, ppos, convmul, convdiv);
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002135}
2136
Linus Torvalds1da177e2005-04-16 15:20:36 -07002137/**
2138 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2139 * @table: the sysctl table
2140 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002141 * @buffer: the user buffer
2142 * @lenp: the size of the user buffer
2143 * @ppos: file position
2144 *
2145 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2146 * values from/to the user buffer, treated as an ASCII string.
2147 *
2148 * This routine will ensure the values are within the range specified by
2149 * table->extra1 (min) and table->extra2 (max).
2150 *
2151 * Returns 0 on success.
2152 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002153int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002154 void __user *buffer, size_t *lenp, loff_t *ppos)
2155{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002156 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002157}
2158
2159/**
2160 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2161 * @table: the sysctl table
2162 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002163 * @buffer: the user buffer
2164 * @lenp: the size of the user buffer
2165 * @ppos: file position
2166 *
2167 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2168 * values from/to the user buffer, treated as an ASCII string. The values
2169 * are treated as milliseconds, and converted to jiffies when they are stored.
2170 *
2171 * This routine will ensure the values are within the range specified by
2172 * table->extra1 (min) and table->extra2 (max).
2173 *
2174 * Returns 0 on success.
2175 */
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002176int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002177 void __user *buffer,
2178 size_t *lenp, loff_t *ppos)
2179{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002180 return do_proc_doulongvec_minmax(table, write, buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002181 lenp, ppos, HZ, 1000l);
2182}
2183
2184
Amerigo Wang00b7c332010-05-05 00:26:45 +00002185static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002186 int *valp,
2187 int write, void *data)
2188{
2189 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002190 if (*lvalp > LONG_MAX / HZ)
2191 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002192 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2193 } else {
2194 int val = *valp;
2195 unsigned long lval;
2196 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002197 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002198 lval = (unsigned long)-val;
2199 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002200 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002201 lval = (unsigned long)val;
2202 }
2203 *lvalp = lval / HZ;
2204 }
2205 return 0;
2206}
2207
Amerigo Wang00b7c332010-05-05 00:26:45 +00002208static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002209 int *valp,
2210 int write, void *data)
2211{
2212 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002213 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2214 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002215 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2216 } else {
2217 int val = *valp;
2218 unsigned long lval;
2219 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002220 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002221 lval = (unsigned long)-val;
2222 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002223 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002224 lval = (unsigned long)val;
2225 }
2226 *lvalp = jiffies_to_clock_t(lval);
2227 }
2228 return 0;
2229}
2230
Amerigo Wang00b7c332010-05-05 00:26:45 +00002231static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002232 int *valp,
2233 int write, void *data)
2234{
2235 if (write) {
2236 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2237 } else {
2238 int val = *valp;
2239 unsigned long lval;
2240 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002241 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002242 lval = (unsigned long)-val;
2243 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002244 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002245 lval = (unsigned long)val;
2246 }
2247 *lvalp = jiffies_to_msecs(lval);
2248 }
2249 return 0;
2250}
2251
2252/**
2253 * proc_dointvec_jiffies - read a vector of integers as seconds
2254 * @table: the sysctl table
2255 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002256 * @buffer: the user buffer
2257 * @lenp: the size of the user buffer
2258 * @ppos: file position
2259 *
2260 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2261 * values from/to the user buffer, treated as an ASCII string.
2262 * The values read are assumed to be in seconds, and are converted into
2263 * jiffies.
2264 *
2265 * Returns 0 on success.
2266 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002267int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002268 void __user *buffer, size_t *lenp, loff_t *ppos)
2269{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002270 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002271 do_proc_dointvec_jiffies_conv,NULL);
2272}
2273
2274/**
2275 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2276 * @table: the sysctl table
2277 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002278 * @buffer: the user buffer
2279 * @lenp: the size of the user buffer
Randy Dunlap1e5d5332005-11-07 01:01:06 -08002280 * @ppos: pointer to the file position
Linus Torvalds1da177e2005-04-16 15:20:36 -07002281 *
2282 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2283 * values from/to the user buffer, treated as an ASCII string.
2284 * The values read are assumed to be in 1/USER_HZ seconds, and
2285 * are converted into jiffies.
2286 *
2287 * Returns 0 on success.
2288 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002289int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002290 void __user *buffer, size_t *lenp, loff_t *ppos)
2291{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002292 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002293 do_proc_dointvec_userhz_jiffies_conv,NULL);
2294}
2295
2296/**
2297 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2298 * @table: the sysctl table
2299 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002300 * @buffer: the user buffer
2301 * @lenp: the size of the user buffer
Martin Waitz67be2dd2005-05-01 08:59:26 -07002302 * @ppos: file position
2303 * @ppos: the current position in the file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002304 *
2305 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2306 * values from/to the user buffer, treated as an ASCII string.
2307 * The values read are assumed to be in 1/1000 seconds, and
2308 * are converted into jiffies.
2309 *
2310 * Returns 0 on success.
2311 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002312int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002313 void __user *buffer, size_t *lenp, loff_t *ppos)
2314{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002315 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002316 do_proc_dointvec_ms_jiffies_conv, NULL);
2317}
2318
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002319static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002320 void __user *buffer, size_t *lenp, loff_t *ppos)
2321{
2322 struct pid *new_pid;
2323 pid_t tmp;
2324 int r;
2325
Pavel Emelyanov6c5f3e72008-02-08 04:19:20 -08002326 tmp = pid_vnr(cad_pid);
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002327
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002328 r = __do_proc_dointvec(&tmp, table, write, buffer,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002329 lenp, ppos, NULL, NULL);
2330 if (r || !write)
2331 return r;
2332
2333 new_pid = find_get_pid(tmp);
2334 if (!new_pid)
2335 return -ESRCH;
2336
2337 put_pid(xchg(&cad_pid, new_pid));
2338 return 0;
2339}
2340
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002341/**
2342 * proc_do_large_bitmap - read/write from/to a large bitmap
2343 * @table: the sysctl table
2344 * @write: %TRUE if this is a write to the sysctl file
2345 * @buffer: the user buffer
2346 * @lenp: the size of the user buffer
2347 * @ppos: file position
2348 *
2349 * The bitmap is stored at table->data and the bitmap length (in bits)
2350 * in table->maxlen.
2351 *
2352 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2353 * large bitmaps may be represented in a compact manner. Writing into
2354 * the file will clear the bitmap then update it with the given input.
2355 *
2356 * Returns 0 on success.
2357 */
2358int proc_do_large_bitmap(struct ctl_table *table, int write,
2359 void __user *buffer, size_t *lenp, loff_t *ppos)
2360{
2361 int err = 0;
2362 bool first = 1;
2363 size_t left = *lenp;
2364 unsigned long bitmap_len = table->maxlen;
2365 unsigned long *bitmap = (unsigned long *) table->data;
2366 unsigned long *tmp_bitmap = NULL;
2367 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2368
2369 if (!bitmap_len || !left || (*ppos && !write)) {
2370 *lenp = 0;
2371 return 0;
2372 }
2373
2374 if (write) {
2375 unsigned long page = 0;
2376 char *kbuf;
2377
2378 if (left > PAGE_SIZE - 1)
2379 left = PAGE_SIZE - 1;
2380
2381 page = __get_free_page(GFP_TEMPORARY);
2382 kbuf = (char *) page;
2383 if (!kbuf)
2384 return -ENOMEM;
2385 if (copy_from_user(kbuf, buffer, left)) {
2386 free_page(page);
2387 return -EFAULT;
2388 }
2389 kbuf[left] = 0;
2390
2391 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2392 GFP_KERNEL);
2393 if (!tmp_bitmap) {
2394 free_page(page);
2395 return -ENOMEM;
2396 }
2397 proc_skip_char(&kbuf, &left, '\n');
2398 while (!err && left) {
2399 unsigned long val_a, val_b;
2400 bool neg;
2401
2402 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2403 sizeof(tr_a), &c);
2404 if (err)
2405 break;
2406 if (val_a >= bitmap_len || neg) {
2407 err = -EINVAL;
2408 break;
2409 }
2410
2411 val_b = val_a;
2412 if (left) {
2413 kbuf++;
2414 left--;
2415 }
2416
2417 if (c == '-') {
2418 err = proc_get_long(&kbuf, &left, &val_b,
2419 &neg, tr_b, sizeof(tr_b),
2420 &c);
2421 if (err)
2422 break;
2423 if (val_b >= bitmap_len || neg ||
2424 val_a > val_b) {
2425 err = -EINVAL;
2426 break;
2427 }
2428 if (left) {
2429 kbuf++;
2430 left--;
2431 }
2432 }
2433
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002434 bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002435 first = 0;
2436 proc_skip_char(&kbuf, &left, '\n');
2437 }
2438 free_page(page);
2439 } else {
2440 unsigned long bit_a, bit_b = 0;
2441
2442 while (left) {
2443 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2444 if (bit_a >= bitmap_len)
2445 break;
2446 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2447 bit_a + 1) - 1;
2448
2449 if (!first) {
2450 err = proc_put_char(&buffer, &left, ',');
2451 if (err)
2452 break;
2453 }
2454 err = proc_put_long(&buffer, &left, bit_a, false);
2455 if (err)
2456 break;
2457 if (bit_a != bit_b) {
2458 err = proc_put_char(&buffer, &left, '-');
2459 if (err)
2460 break;
2461 err = proc_put_long(&buffer, &left, bit_b, false);
2462 if (err)
2463 break;
2464 }
2465
2466 first = 0; bit_b++;
2467 }
2468 if (!err)
2469 err = proc_put_char(&buffer, &left, '\n');
2470 }
2471
2472 if (!err) {
2473 if (write) {
2474 if (*ppos)
2475 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2476 else
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002477 bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002478 }
2479 kfree(tmp_bitmap);
2480 *lenp -= left;
2481 *ppos += *lenp;
2482 return 0;
2483 } else {
2484 kfree(tmp_bitmap);
2485 return err;
2486 }
2487}
2488
Jovi Zhang55610502011-01-12 17:00:45 -08002489#else /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002490
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002491int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002492 void __user *buffer, size_t *lenp, loff_t *ppos)
2493{
2494 return -ENOSYS;
2495}
2496
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002497int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002498 void __user *buffer, size_t *lenp, loff_t *ppos)
2499{
2500 return -ENOSYS;
2501}
2502
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002503int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002504 void __user *buffer, size_t *lenp, loff_t *ppos)
2505{
2506 return -ENOSYS;
2507}
2508
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002509int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002510 void __user *buffer, size_t *lenp, loff_t *ppos)
2511{
2512 return -ENOSYS;
2513}
2514
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002515int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002516 void __user *buffer, size_t *lenp, loff_t *ppos)
2517{
2518 return -ENOSYS;
2519}
2520
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002521int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002522 void __user *buffer, size_t *lenp, loff_t *ppos)
2523{
2524 return -ENOSYS;
2525}
2526
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002527int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002528 void __user *buffer, size_t *lenp, loff_t *ppos)
2529{
2530 return -ENOSYS;
2531}
2532
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002533int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002534 void __user *buffer,
2535 size_t *lenp, loff_t *ppos)
2536{
2537 return -ENOSYS;
2538}
2539
2540
Jovi Zhang55610502011-01-12 17:00:45 -08002541#endif /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002542
Linus Torvalds1da177e2005-04-16 15:20:36 -07002543/*
2544 * No sense putting this after each symbol definition, twice,
2545 * exception granted :-)
2546 */
2547EXPORT_SYMBOL(proc_dointvec);
2548EXPORT_SYMBOL(proc_dointvec_jiffies);
2549EXPORT_SYMBOL(proc_dointvec_minmax);
2550EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2551EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2552EXPORT_SYMBOL(proc_dostring);
2553EXPORT_SYMBOL(proc_doulongvec_minmax);
2554EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);