blob: b46f496405e4683c2850f189940a870c09d3f513 [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>
Adrian Bunk62239ac2007-07-17 04:03:45 -070033#include <linux/fs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#include <linux/init.h>
35#include <linux/kernel.h>
Kay Sievers0296b222005-11-11 05:33:52 +010036#include <linux/kobject.h>
Arnaldo Carvalho de Melo20380732005-08-16 02:18:02 -030037#include <linux/net.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070038#include <linux/sysrq.h>
39#include <linux/highuid.h>
40#include <linux/writeback.h>
Ingo Molnar3fff4c42009-09-22 16:18:09 +020041#include <linux/ratelimit.h>
Mel Gorman76ab0f52010-05-24 14:32:28 -070042#include <linux/compaction.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070043#include <linux/hugetlb.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#include <linux/initrd.h>
David Howells0b77f5b2008-04-29 01:01:32 -070045#include <linux/key.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070046#include <linux/times.h>
47#include <linux/limits.h>
48#include <linux/dcache.h>
Alexey Dobriyan6e006702010-01-20 22:27:56 +020049#include <linux/dnotify.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070050#include <linux/syscalls.h>
Adrian Bunkc748e132008-07-23 21:27:03 -070051#include <linux/vmstat.h>
Pavel Machekc255d842006-02-20 18:27:58 -080052#include <linux/nfs_fs.h>
53#include <linux/acpi.h>
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -070054#include <linux/reboot.h>
Steven Rostedtb0fc4942008-05-12 21:20:43 +020055#include <linux/ftrace.h>
Ingo Molnarcdd6c482009-09-21 12:02:48 +020056#include <linux/perf_event.h>
Masami Hiramatsub2be84d2010-02-25 08:34:15 -050057#include <linux/kprobes.h>
Jens Axboeb492e952010-05-19 21:03:16 +020058#include <linux/pipe_fs_i.h>
David Rientjes8e4228e2010-08-09 17:18:56 -070059#include <linux/oom.h>
Eric Paris17f60a72011-04-01 17:07:50 -040060#include <linux/kmod.h>
Dan Ballard73efc032011-10-31 17:11:20 -070061#include <linux/capability.h>
Al Viro40401532012-02-13 03:58:52 +000062#include <linux/binfmts.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
64#include <asm/uaccess.h>
65#include <asm/processor.h>
66
Andi Kleen29cbc782006-09-30 01:47:55 +020067#ifdef CONFIG_X86
68#include <asm/nmi.h>
Chuck Ebbert0741f4d2006-12-07 02:14:11 +010069#include <asm/stacktrace.h>
Ingo Molnar6e7c4022008-01-30 13:30:05 +010070#include <asm/io.h>
Andi Kleen29cbc782006-09-30 01:47:55 +020071#endif
David Howellsd550bbd2012-03-28 18:30:03 +010072#ifdef CONFIG_SPARC
73#include <asm/setup.h>
74#endif
Dave Youngc55b7c32010-03-10 15:24:08 -080075#ifdef CONFIG_BSD_PROCESS_ACCT
76#include <linux/acct.h>
77#endif
Dave Young4f0e0562010-03-10 15:24:09 -080078#ifdef CONFIG_RT_MUTEXES
79#include <linux/rtmutex.h>
80#endif
Dave Young2edf5e42010-03-10 15:24:10 -080081#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
82#include <linux/lockdep.h>
83#endif
Dave Young15485a42010-03-10 15:24:07 -080084#ifdef CONFIG_CHR_DEV_SG
85#include <scsi/sg.h>
86#endif
Andi Kleen29cbc782006-09-30 01:47:55 +020087
Don Zickus58687ac2010-05-07 17:11:44 -040088#ifdef CONFIG_LOCKUP_DETECTOR
Don Zickus504d7cf2010-02-12 17:19:19 -050089#include <linux/nmi.h>
90#endif
91
Eric W. Biederman7058cb02007-10-18 03:05:58 -070092
Linus Torvalds1da177e2005-04-16 15:20:36 -070093#if defined(CONFIG_SYSCTL)
94
95/* External variables not in a header file. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070096extern int sysctl_overcommit_memory;
97extern int sysctl_overcommit_ratio;
98extern int max_threads;
Linus Torvalds1da177e2005-04-16 15:20:36 -070099extern int core_uses_pid;
Alan Coxd6e71142005-06-23 00:09:43 -0700100extern int suid_dumpable;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101extern char core_pattern[];
Neil Hormana2939802009-09-23 15:56:56 -0700102extern unsigned int core_pipe_limit;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103extern int pid_max;
104extern int min_free_kbytes;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105extern int pid_max_min, pid_max_max;
Andrew Morton9d0243b2006-01-08 01:00:39 -0800106extern int sysctl_drop_caches;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800107extern int percpu_pagelist_fraction;
Andi Kleenbebfa102006-06-26 13:56:52 +0200108extern int compat_log;
Arjan van de Ven97455122008-01-25 21:08:34 +0100109extern int latencytop_enabled;
Al Viroeceea0b2008-05-10 10:08:32 -0400110extern int sysctl_nr_open_min, sysctl_nr_open_max;
Paul Mundtdd8632a2009-01-08 12:04:47 +0000111#ifndef CONFIG_MMU
112extern int sysctl_nr_trim_pages;
113#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200114#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200115extern int blk_iopoll_enabled;
Jens Axboecb684b52009-09-15 21:53:11 +0200116#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700118/* Constants used for minimum and maximum */
Don Zickus2508ce12010-05-07 17:11:46 -0400119#ifdef CONFIG_LOCKUP_DETECTOR
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700120static int sixty = 60;
Dimitri Sivanich9383d962008-05-12 21:21:14 +0200121static int neg_one = -1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700122#endif
123
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700124static int zero;
Linus Torvaldscd5f9a42009-04-06 13:38:46 -0700125static int __maybe_unused one = 1;
126static int __maybe_unused two = 2;
Petr Holasekcb16e952011-03-23 16:43:09 -0700127static int __maybe_unused three = 3;
Sven Wegenerfc3501d2009-02-11 13:04:23 -0800128static unsigned long one_ul = 1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700129static int one_hundred = 100;
Dave Youngaf913222009-09-22 16:43:33 -0700130#ifdef CONFIG_PRINTK
131static int ten_thousand = 10000;
132#endif
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700133
Andrea Righi9e4a5bd2009-04-30 15:08:57 -0700134/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
135static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
136
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
138static int maxolduid = 65535;
139static int minolduid;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800140static int min_percpu_pagelist_fract = 8;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141
142static int ngroups_max = NGROUPS_MAX;
Dan Ballard73efc032011-10-31 17:11:20 -0700143static const int cap_last_cap = CAP_LAST_CAP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144
Dave Youngd14f1722010-02-25 20:28:57 -0500145#ifdef CONFIG_INOTIFY_USER
146#include <linux/inotify.h>
147#endif
David S. Miller72c57ed2008-09-11 23:29:54 -0700148#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149#endif
150
David S. Miller08714202008-11-16 23:49:24 -0800151#ifdef CONFIG_SPARC64
152extern int sysctl_tsb_ratio;
153#endif
154
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155#ifdef __hppa__
156extern int pwrsw_enabled;
157extern int unaligned_enabled;
158#endif
159
Jes Sorensend2b176e2006-02-28 09:42:23 -0800160#ifdef CONFIG_IA64
161extern int no_unaligned_warning;
Doug Chapman88fc2412009-01-15 10:38:56 -0800162extern int unaligned_dump_stack;
Jes Sorensend2b176e2006-02-28 09:42:23 -0800163#endif
164
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700165#ifdef CONFIG_PROC_SYSCTL
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700166static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700167 void __user *buffer, size_t *lenp, loff_t *ppos);
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700168static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800169 void __user *buffer, size_t *lenp, loff_t *ppos);
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700170#endif
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700171
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700172#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -0700173static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700174 void __user *buffer, size_t *lenp, loff_t *ppos);
175#endif
176
Kees Cook54b50192012-07-30 14:39:18 -0700177static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
178 void __user *buffer, size_t *lenp, loff_t *ppos);
179static int proc_dostring_coredump(struct ctl_table *table, int write,
180 void __user *buffer, size_t *lenp, loff_t *ppos);
181
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700182#ifdef CONFIG_MAGIC_SYSRQ
Andy Whitcroft8c6a98b2011-01-24 09:31:38 -0800183/* Note: sysrq code uses it's own private copy */
184static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700185
186static int sysrq_sysctl_handler(ctl_table *table, int write,
187 void __user *buffer, size_t *lenp,
188 loff_t *ppos)
189{
190 int error;
191
192 error = proc_dointvec(table, write, buffer, lenp, ppos);
193 if (error)
194 return error;
195
196 if (write)
197 sysrq_toggle_support(__sysrq_enabled);
198
199 return 0;
200}
201
202#endif
203
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700204static struct ctl_table kern_table[];
205static struct ctl_table vm_table[];
206static struct ctl_table fs_table[];
207static struct ctl_table debug_table[];
208static struct ctl_table dev_table[];
209extern struct ctl_table random_table[];
Davide Libenzi7ef99642008-12-01 13:13:55 -0800210#ifdef CONFIG_EPOLL
211extern struct ctl_table epoll_table[];
212#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213
214#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
215int sysctl_legacy_va_layout;
216#endif
217
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218/* The default sysctl tables: */
219
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -0800220static struct ctl_table sysctl_base_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 .procname = "kernel",
223 .mode = 0555,
224 .child = kern_table,
225 },
226 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227 .procname = "vm",
228 .mode = 0555,
229 .child = vm_table,
230 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232 .procname = "fs",
233 .mode = 0555,
234 .child = fs_table,
235 },
236 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237 .procname = "debug",
238 .mode = 0555,
239 .child = debug_table,
240 },
241 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242 .procname = "dev",
243 .mode = 0555,
244 .child = dev_table,
245 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -0700246 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247};
248
Ingo Molnar77e54a12007-07-09 18:52:00 +0200249#ifdef CONFIG_SCHED_DEBUG
Eric Dumazet73c4efd2007-12-18 15:21:13 +0100250static int min_sched_granularity_ns = 100000; /* 100 usecs */
251static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
252static int min_wakeup_granularity_ns; /* 0 usecs */
253static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100254static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
255static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
Ingo Molnar77e54a12007-07-09 18:52:00 +0200256#endif
257
Mel Gorman5e771902010-05-24 14:32:31 -0700258#ifdef CONFIG_COMPACTION
259static int min_extfrag_threshold;
260static int max_extfrag_threshold = 1000;
261#endif
262
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700263static struct ctl_table kern_table[] = {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200264 {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200265 .procname = "sched_child_runs_first",
266 .data = &sysctl_sched_child_runs_first,
267 .maxlen = sizeof(unsigned int),
268 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800269 .proc_handler = proc_dointvec,
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200270 },
Ingo Molnar77e54a12007-07-09 18:52:00 +0200271#ifdef CONFIG_SCHED_DEBUG
272 {
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100273 .procname = "sched_min_granularity_ns",
274 .data = &sysctl_sched_min_granularity,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200275 .maxlen = sizeof(unsigned int),
276 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800277 .proc_handler = sched_proc_update_handler,
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100278 .extra1 = &min_sched_granularity_ns,
279 .extra2 = &max_sched_granularity_ns,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200280 },
281 {
Peter Zijlstra21805082007-08-25 18:41:53 +0200282 .procname = "sched_latency_ns",
283 .data = &sysctl_sched_latency,
284 .maxlen = sizeof(unsigned int),
285 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800286 .proc_handler = sched_proc_update_handler,
Peter Zijlstra21805082007-08-25 18:41:53 +0200287 .extra1 = &min_sched_granularity_ns,
288 .extra2 = &max_sched_granularity_ns,
289 },
290 {
Ingo Molnar77e54a12007-07-09 18:52:00 +0200291 .procname = "sched_wakeup_granularity_ns",
292 .data = &sysctl_sched_wakeup_granularity,
293 .maxlen = sizeof(unsigned int),
294 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800295 .proc_handler = sched_proc_update_handler,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200296 .extra1 = &min_wakeup_granularity_ns,
297 .extra2 = &max_wakeup_granularity_ns,
298 },
299 {
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100300 .procname = "sched_tunable_scaling",
301 .data = &sysctl_sched_tunable_scaling,
302 .maxlen = sizeof(enum sched_tunable_scaling),
303 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800304 .proc_handler = sched_proc_update_handler,
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100305 .extra1 = &min_sched_tunable_scaling,
306 .extra2 = &max_sched_tunable_scaling,
Peter Zijlstra2398f2c2008-06-27 13:41:35 +0200307 },
308 {
Ingo Molnarda84d962007-10-15 17:00:18 +0200309 .procname = "sched_migration_cost",
310 .data = &sysctl_sched_migration_cost,
311 .maxlen = sizeof(unsigned int),
312 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800313 .proc_handler = proc_dointvec,
Ingo Molnarda84d962007-10-15 17:00:18 +0200314 },
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100315 {
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100316 .procname = "sched_nr_migrate",
317 .data = &sysctl_sched_nr_migrate,
318 .maxlen = sizeof(unsigned int),
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100319 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800320 .proc_handler = proc_dointvec,
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100321 },
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530322 {
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200323 .procname = "sched_time_avg",
324 .data = &sysctl_sched_time_avg,
325 .maxlen = sizeof(unsigned int),
326 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800327 .proc_handler = proc_dointvec,
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200328 },
329 {
Paul Turnera7a4f8a2010-11-15 15:47:06 -0800330 .procname = "sched_shares_window",
331 .data = &sysctl_sched_shares_window,
332 .maxlen = sizeof(unsigned int),
333 .mode = 0644,
334 .proc_handler = proc_dointvec,
335 },
336 {
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530337 .procname = "timer_migration",
338 .data = &sysctl_timer_migration,
339 .maxlen = sizeof(unsigned int),
340 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800341 .proc_handler = proc_dointvec_minmax,
Arun R Bharadwajbfdb4d92009-06-23 10:00:58 +0530342 .extra1 = &zero,
343 .extra2 = &one,
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530344 },
Peter Zijlstra1fc84aa2007-08-25 18:41:52 +0200345#endif
Ingo Molnar1799e352007-09-19 23:34:46 +0200346 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100347 .procname = "sched_rt_period_us",
348 .data = &sysctl_sched_rt_period,
349 .maxlen = sizeof(unsigned int),
350 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800351 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100352 },
353 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100354 .procname = "sched_rt_runtime_us",
355 .data = &sysctl_sched_rt_runtime,
356 .maxlen = sizeof(int),
357 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800358 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100359 },
Mike Galbraith5091faa2010-11-30 14:18:03 +0100360#ifdef CONFIG_SCHED_AUTOGROUP
361 {
362 .procname = "sched_autogroup_enabled",
363 .data = &sysctl_sched_autogroup_enabled,
364 .maxlen = sizeof(unsigned int),
365 .mode = 0644,
Yong Zhang1747b212011-02-20 15:08:12 +0800366 .proc_handler = proc_dointvec_minmax,
Mike Galbraith5091faa2010-11-30 14:18:03 +0100367 .extra1 = &zero,
368 .extra2 = &one,
369 },
370#endif
Paul Turnerec12cb72011-07-21 09:43:30 -0700371#ifdef CONFIG_CFS_BANDWIDTH
372 {
373 .procname = "sched_cfs_bandwidth_slice_us",
374 .data = &sysctl_sched_cfs_bandwidth_slice,
375 .maxlen = sizeof(unsigned int),
376 .mode = 0644,
377 .proc_handler = proc_dointvec_minmax,
378 .extra1 = &one,
379 },
380#endif
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700381#ifdef CONFIG_PROVE_LOCKING
382 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700383 .procname = "prove_locking",
384 .data = &prove_locking,
385 .maxlen = sizeof(int),
386 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800387 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700388 },
389#endif
390#ifdef CONFIG_LOCK_STAT
391 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700392 .procname = "lock_stat",
393 .data = &lock_stat,
394 .maxlen = sizeof(int),
395 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800396 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700397 },
398#endif
Ingo Molnar77e54a12007-07-09 18:52:00 +0200399 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700400 .procname = "panic",
401 .data = &panic_timeout,
402 .maxlen = sizeof(int),
403 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800404 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405 },
406 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407 .procname = "core_uses_pid",
408 .data = &core_uses_pid,
409 .maxlen = sizeof(int),
410 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800411 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700412 },
413 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414 .procname = "core_pattern",
415 .data = core_pattern,
Dan Aloni71ce92f2007-05-16 22:11:16 -0700416 .maxlen = CORENAME_MAX_SIZE,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417 .mode = 0644,
Kees Cook54b50192012-07-30 14:39:18 -0700418 .proc_handler = proc_dostring_coredump,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700419 },
Neil Hormana2939802009-09-23 15:56:56 -0700420 {
Neil Hormana2939802009-09-23 15:56:56 -0700421 .procname = "core_pipe_limit",
422 .data = &core_pipe_limit,
423 .maxlen = sizeof(unsigned int),
424 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800425 .proc_handler = proc_dointvec,
Neil Hormana2939802009-09-23 15:56:56 -0700426 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800427#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 .procname = "tainted",
Andi Kleen25ddbb12008-10-15 22:01:41 -0700430 .maxlen = sizeof(long),
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800431 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800432 .proc_handler = proc_taint,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700433 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800434#endif
Arjan van de Ven97455122008-01-25 21:08:34 +0100435#ifdef CONFIG_LATENCYTOP
436 {
437 .procname = "latencytop",
438 .data = &latencytop_enabled,
439 .maxlen = sizeof(int),
440 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800441 .proc_handler = proc_dointvec,
Arjan van de Ven97455122008-01-25 21:08:34 +0100442 },
443#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444#ifdef CONFIG_BLK_DEV_INITRD
445 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446 .procname = "real-root-dev",
447 .data = &real_root_dev,
448 .maxlen = sizeof(int),
449 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800450 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451 },
452#endif
Ingo Molnar45807a12007-07-15 23:40:10 -0700453 {
Ingo Molnar45807a12007-07-15 23:40:10 -0700454 .procname = "print-fatal-signals",
455 .data = &print_fatal_signals,
456 .maxlen = sizeof(int),
457 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800458 .proc_handler = proc_dointvec,
Ingo Molnar45807a12007-07-15 23:40:10 -0700459 },
David S. Miller72c57ed2008-09-11 23:29:54 -0700460#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700462 .procname = "reboot-cmd",
463 .data = reboot_command,
464 .maxlen = 256,
465 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800466 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467 },
468 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700469 .procname = "stop-a",
470 .data = &stop_a_enabled,
471 .maxlen = sizeof (int),
472 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800473 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700474 },
475 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476 .procname = "scons-poweroff",
477 .data = &scons_pwroff,
478 .maxlen = sizeof (int),
479 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800480 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700481 },
482#endif
David S. Miller08714202008-11-16 23:49:24 -0800483#ifdef CONFIG_SPARC64
484 {
David S. Miller08714202008-11-16 23:49:24 -0800485 .procname = "tsb-ratio",
486 .data = &sysctl_tsb_ratio,
487 .maxlen = sizeof (int),
488 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800489 .proc_handler = proc_dointvec,
David S. Miller08714202008-11-16 23:49:24 -0800490 },
491#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700492#ifdef __hppa__
493 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494 .procname = "soft-power",
495 .data = &pwrsw_enabled,
496 .maxlen = sizeof (int),
497 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800498 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700499 },
500 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501 .procname = "unaligned-trap",
502 .data = &unaligned_enabled,
503 .maxlen = sizeof (int),
504 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800505 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700506 },
507#endif
508 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700509 .procname = "ctrl-alt-del",
510 .data = &C_A_D,
511 .maxlen = sizeof(int),
512 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800513 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700514 },
Steven Rostedt606576c2008-10-06 19:06:12 -0400515#ifdef CONFIG_FUNCTION_TRACER
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200516 {
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200517 .procname = "ftrace_enabled",
518 .data = &ftrace_enabled,
519 .maxlen = sizeof(int),
520 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800521 .proc_handler = ftrace_enable_sysctl,
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200522 },
523#endif
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500524#ifdef CONFIG_STACK_TRACER
525 {
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500526 .procname = "stack_tracer_enabled",
527 .data = &stack_tracer_enabled,
528 .maxlen = sizeof(int),
529 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800530 .proc_handler = stack_trace_sysctl,
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500531 },
532#endif
Steven Rostedt944ac422008-10-23 19:26:08 -0400533#ifdef CONFIG_TRACING
534 {
Peter Zijlstra3299b4d2008-11-04 11:58:21 +0100535 .procname = "ftrace_dump_on_oops",
Steven Rostedt944ac422008-10-23 19:26:08 -0400536 .data = &ftrace_dump_on_oops,
537 .maxlen = sizeof(int),
538 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800539 .proc_handler = proc_dointvec,
Steven Rostedt944ac422008-10-23 19:26:08 -0400540 },
541#endif
Johannes Berga1ef5ad2008-07-08 19:00:17 +0200542#ifdef CONFIG_MODULES
Linus Torvalds1da177e2005-04-16 15:20:36 -0700543 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544 .procname = "modprobe",
545 .data = &modprobe_path,
546 .maxlen = KMOD_PATH_LEN,
547 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800548 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549 },
Kees Cook3d433212009-04-02 15:49:29 -0700550 {
Kees Cook3d433212009-04-02 15:49:29 -0700551 .procname = "modules_disabled",
552 .data = &modules_disabled,
553 .maxlen = sizeof(int),
554 .mode = 0644,
555 /* only handle a transition from default "0" to "1" */
Eric W. Biederman6d456112009-11-16 03:11:48 -0800556 .proc_handler = proc_dointvec_minmax,
Kees Cook3d433212009-04-02 15:49:29 -0700557 .extra1 = &one,
558 .extra2 = &one,
559 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700560#endif
Ian Abbott94f17cd2010-06-07 12:57:12 +0100561#ifdef CONFIG_HOTPLUG
Linus Torvalds1da177e2005-04-16 15:20:36 -0700562 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700563 .procname = "hotplug",
Kay Sievers312c0042005-11-16 09:00:00 +0100564 .data = &uevent_helper,
565 .maxlen = UEVENT_HELPER_PATH_LEN,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700566 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800567 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700568 },
569#endif
570#ifdef CONFIG_CHR_DEV_SG
571 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700572 .procname = "sg-big-buff",
573 .data = &sg_big_buff,
574 .maxlen = sizeof (int),
575 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800576 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700577 },
578#endif
579#ifdef CONFIG_BSD_PROCESS_ACCT
580 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700581 .procname = "acct",
582 .data = &acct_parm,
583 .maxlen = 3*sizeof(int),
584 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800585 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586 },
587#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700588#ifdef CONFIG_MAGIC_SYSRQ
589 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590 .procname = "sysrq",
Ingo Molnar5d6f6472006-12-13 00:34:36 -0800591 .data = &__sysrq_enabled,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700592 .maxlen = sizeof (int),
593 .mode = 0644,
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700594 .proc_handler = sysrq_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700595 },
596#endif
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700597#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700598 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599 .procname = "cad_pid",
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700600 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601 .maxlen = sizeof (int),
602 .mode = 0600,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800603 .proc_handler = proc_do_cad_pid,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700604 },
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700605#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700606 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607 .procname = "threads-max",
608 .data = &max_threads,
609 .maxlen = sizeof(int),
610 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800611 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700612 },
613 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700614 .procname = "random",
615 .mode = 0555,
616 .child = random_table,
617 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700618 {
Eric Paris17f60a72011-04-01 17:07:50 -0400619 .procname = "usermodehelper",
620 .mode = 0555,
621 .child = usermodehelper_table,
622 },
623 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700624 .procname = "overflowuid",
625 .data = &overflowuid,
626 .maxlen = sizeof(int),
627 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800628 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700629 .extra1 = &minolduid,
630 .extra2 = &maxolduid,
631 },
632 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700633 .procname = "overflowgid",
634 .data = &overflowgid,
635 .maxlen = sizeof(int),
636 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800637 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700638 .extra1 = &minolduid,
639 .extra2 = &maxolduid,
640 },
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -0800641#ifdef CONFIG_S390
Linus Torvalds1da177e2005-04-16 15:20:36 -0700642#ifdef CONFIG_MATHEMU
643 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700644 .procname = "ieee_emulation_warnings",
645 .data = &sysctl_ieee_emulation_warnings,
646 .maxlen = sizeof(int),
647 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800648 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700649 },
650#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700652 .procname = "userprocess_debug",
Heiko Carstensab3c68e2010-05-17 10:00:21 +0200653 .data = &show_unhandled_signals,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700654 .maxlen = sizeof(int),
655 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800656 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700657 },
658#endif
659 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700660 .procname = "pid_max",
661 .data = &pid_max,
662 .maxlen = sizeof (int),
663 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800664 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700665 .extra1 = &pid_max_min,
666 .extra2 = &pid_max_max,
667 },
668 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669 .procname = "panic_on_oops",
670 .data = &panic_on_oops,
671 .maxlen = sizeof(int),
672 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800673 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700674 },
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800675#if defined CONFIG_PRINTK
676 {
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800677 .procname = "printk",
678 .data = &console_loglevel,
679 .maxlen = 4*sizeof(int),
680 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800681 .proc_handler = proc_dointvec,
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800682 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700684 .procname = "printk_ratelimit",
Dave Young717115e2008-07-25 01:45:58 -0700685 .data = &printk_ratelimit_state.interval,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700686 .maxlen = sizeof(int),
687 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800688 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700689 },
690 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700691 .procname = "printk_ratelimit_burst",
Dave Young717115e2008-07-25 01:45:58 -0700692 .data = &printk_ratelimit_state.burst,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700693 .maxlen = sizeof(int),
694 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800695 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700696 },
Dave Youngaf913222009-09-22 16:43:33 -0700697 {
Dave Youngaf913222009-09-22 16:43:33 -0700698 .procname = "printk_delay",
699 .data = &printk_delay_msec,
700 .maxlen = sizeof(int),
701 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800702 .proc_handler = proc_dointvec_minmax,
Dave Youngaf913222009-09-22 16:43:33 -0700703 .extra1 = &zero,
704 .extra2 = &ten_thousand,
705 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700706 {
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800707 .procname = "dmesg_restrict",
708 .data = &dmesg_restrict,
709 .maxlen = sizeof(int),
710 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700711 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800712 .extra1 = &zero,
713 .extra2 = &one,
714 },
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800715 {
716 .procname = "kptr_restrict",
717 .data = &kptr_restrict,
718 .maxlen = sizeof(int),
719 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700720 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800721 .extra1 = &zero,
722 .extra2 = &two,
723 },
Joe Perchesdf6e61d2010-11-15 21:17:27 -0800724#endif
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800725 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700726 .procname = "ngroups_max",
727 .data = &ngroups_max,
728 .maxlen = sizeof (int),
729 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800730 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700731 },
Dan Ballard73efc032011-10-31 17:11:20 -0700732 {
733 .procname = "cap_last_cap",
734 .data = (void *)&cap_last_cap,
735 .maxlen = sizeof(int),
736 .mode = 0444,
737 .proc_handler = proc_dointvec,
738 },
Don Zickus58687ac2010-05-07 17:11:44 -0400739#if defined(CONFIG_LOCKUP_DETECTOR)
Don Zickus504d7cf2010-02-12 17:19:19 -0500740 {
Don Zickus58687ac2010-05-07 17:11:44 -0400741 .procname = "watchdog",
742 .data = &watchdog_enabled,
Don Zickus504d7cf2010-02-12 17:19:19 -0500743 .maxlen = sizeof (int),
744 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700745 .proc_handler = proc_dowatchdog,
746 .extra1 = &zero,
747 .extra2 = &one,
Don Zickus58687ac2010-05-07 17:11:44 -0400748 },
749 {
750 .procname = "watchdog_thresh",
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700751 .data = &watchdog_thresh,
Don Zickus58687ac2010-05-07 17:11:44 -0400752 .maxlen = sizeof(int),
753 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700754 .proc_handler = proc_dowatchdog,
Don Zickus58687ac2010-05-07 17:11:44 -0400755 .extra1 = &neg_one,
756 .extra2 = &sixty,
Don Zickus504d7cf2010-02-12 17:19:19 -0500757 },
Don Zickus2508ce12010-05-07 17:11:46 -0400758 {
759 .procname = "softlockup_panic",
760 .data = &softlockup_panic,
761 .maxlen = sizeof(int),
762 .mode = 0644,
763 .proc_handler = proc_dointvec_minmax,
764 .extra1 = &zero,
765 .extra2 = &one,
766 },
Don Zickus5dc30552010-11-29 17:07:17 -0500767 {
768 .procname = "nmi_watchdog",
769 .data = &watchdog_enabled,
770 .maxlen = sizeof (int),
771 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700772 .proc_handler = proc_dowatchdog,
773 .extra1 = &zero,
774 .extra2 = &one,
Don Zickus5dc30552010-11-29 17:07:17 -0500775 },
776#endif
777#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
778 {
779 .procname = "unknown_nmi_panic",
780 .data = &unknown_nmi_panic,
781 .maxlen = sizeof (int),
782 .mode = 0644,
783 .proc_handler = proc_dointvec,
784 },
Don Zickus504d7cf2010-02-12 17:19:19 -0500785#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700786#if defined(CONFIG_X86)
787 {
Don Zickus8da5add2006-09-26 10:52:27 +0200788 .procname = "panic_on_unrecovered_nmi",
789 .data = &panic_on_unrecovered_nmi,
790 .maxlen = sizeof(int),
791 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800792 .proc_handler = proc_dointvec,
Don Zickus8da5add2006-09-26 10:52:27 +0200793 },
794 {
Kurt Garloff5211a242009-06-24 14:32:11 -0700795 .procname = "panic_on_io_nmi",
796 .data = &panic_on_io_nmi,
797 .maxlen = sizeof(int),
798 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800799 .proc_handler = proc_dointvec,
Kurt Garloff5211a242009-06-24 14:32:11 -0700800 },
Mitsuo Hayasaka55af7792011-11-29 15:08:36 +0900801#ifdef CONFIG_DEBUG_STACKOVERFLOW
802 {
803 .procname = "panic_on_stackoverflow",
804 .data = &sysctl_panic_on_stackoverflow,
805 .maxlen = sizeof(int),
806 .mode = 0644,
807 .proc_handler = proc_dointvec,
808 },
809#endif
Kurt Garloff5211a242009-06-24 14:32:11 -0700810 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700811 .procname = "bootloader_type",
812 .data = &bootloader_type,
813 .maxlen = sizeof (int),
814 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800815 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700816 },
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100817 {
H. Peter Anvin50312962009-05-07 16:54:11 -0700818 .procname = "bootloader_version",
819 .data = &bootloader_version,
820 .maxlen = sizeof (int),
821 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800822 .proc_handler = proc_dointvec,
H. Peter Anvin50312962009-05-07 16:54:11 -0700823 },
824 {
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100825 .procname = "kstack_depth_to_print",
826 .data = &kstack_depth_to_print,
827 .maxlen = sizeof(int),
828 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800829 .proc_handler = proc_dointvec,
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100830 },
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100831 {
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100832 .procname = "io_delay_type",
833 .data = &io_delay_type,
834 .maxlen = sizeof(int),
835 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800836 .proc_handler = proc_dointvec,
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100837 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700838#endif
Luke Yang7a9166e2006-02-20 18:28:07 -0800839#if defined(CONFIG_MMU)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700840 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841 .procname = "randomize_va_space",
842 .data = &randomize_va_space,
843 .maxlen = sizeof(int),
844 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800845 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700846 },
Luke Yang7a9166e2006-02-20 18:28:07 -0800847#endif
Martin Schwidefsky0152fb32006-01-14 13:21:00 -0800848#if defined(CONFIG_S390) && defined(CONFIG_SMP)
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700849 {
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700850 .procname = "spin_retry",
851 .data = &spin_retry,
852 .maxlen = sizeof (int),
853 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800854 .proc_handler = proc_dointvec,
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700855 },
856#endif
Len Brown673d5b42007-07-28 03:33:16 -0400857#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
Pavel Machekc255d842006-02-20 18:27:58 -0800858 {
Pavel Machekc255d842006-02-20 18:27:58 -0800859 .procname = "acpi_video_flags",
Pavel Machek77afcf72007-07-19 01:47:41 -0700860 .data = &acpi_realmode_flags,
Pavel Machekc255d842006-02-20 18:27:58 -0800861 .maxlen = sizeof (unsigned long),
862 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800863 .proc_handler = proc_doulongvec_minmax,
Pavel Machekc255d842006-02-20 18:27:58 -0800864 },
865#endif
Jes Sorensend2b176e2006-02-28 09:42:23 -0800866#ifdef CONFIG_IA64
867 {
Jes Sorensend2b176e2006-02-28 09:42:23 -0800868 .procname = "ignore-unaligned-usertrap",
869 .data = &no_unaligned_warning,
870 .maxlen = sizeof (int),
871 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800872 .proc_handler = proc_dointvec,
Jes Sorensend2b176e2006-02-28 09:42:23 -0800873 },
Doug Chapman88fc2412009-01-15 10:38:56 -0800874 {
Doug Chapman88fc2412009-01-15 10:38:56 -0800875 .procname = "unaligned-dump-stack",
876 .data = &unaligned_dump_stack,
877 .maxlen = sizeof (int),
878 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800879 .proc_handler = proc_dointvec,
Doug Chapman88fc2412009-01-15 10:38:56 -0800880 },
Jes Sorensend2b176e2006-02-28 09:42:23 -0800881#endif
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800882#ifdef CONFIG_DETECT_HUNG_TASK
883 {
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800884 .procname = "hung_task_panic",
885 .data = &sysctl_hung_task_panic,
886 .maxlen = sizeof(int),
887 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800888 .proc_handler = proc_dointvec_minmax,
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800889 .extra1 = &zero,
890 .extra2 = &one,
891 },
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100892 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100893 .procname = "hung_task_check_count",
894 .data = &sysctl_hung_task_check_count,
Ingo Molnar90739082008-01-25 21:08:34 +0100895 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100896 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800897 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100898 },
899 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100900 .procname = "hung_task_timeout_secs",
901 .data = &sysctl_hung_task_timeout_secs,
Ingo Molnar90739082008-01-25 21:08:34 +0100902 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100903 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800904 .proc_handler = proc_dohung_task_timeout_secs,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100905 },
906 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100907 .procname = "hung_task_warnings",
908 .data = &sysctl_hung_task_warnings,
Ingo Molnar90739082008-01-25 21:08:34 +0100909 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100910 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800911 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100912 },
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700913#endif
Andi Kleenbebfa102006-06-26 13:56:52 +0200914#ifdef CONFIG_COMPAT
915 {
Andi Kleenbebfa102006-06-26 13:56:52 +0200916 .procname = "compat-log",
917 .data = &compat_log,
918 .maxlen = sizeof (int),
919 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800920 .proc_handler = proc_dointvec,
Andi Kleenbebfa102006-06-26 13:56:52 +0200921 },
922#endif
Ingo Molnar23f78d42006-06-27 02:54:53 -0700923#ifdef CONFIG_RT_MUTEXES
924 {
Ingo Molnar23f78d42006-06-27 02:54:53 -0700925 .procname = "max_lock_depth",
926 .data = &max_lock_depth,
927 .maxlen = sizeof(int),
928 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800929 .proc_handler = proc_dointvec,
Ingo Molnar23f78d42006-06-27 02:54:53 -0700930 },
931#endif
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700932 {
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700933 .procname = "poweroff_cmd",
934 .data = &poweroff_cmd,
935 .maxlen = POWEROFF_CMD_PATH_LEN,
936 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800937 .proc_handler = proc_dostring,
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700938 },
David Howells0b77f5b2008-04-29 01:01:32 -0700939#ifdef CONFIG_KEYS
940 {
David Howells0b77f5b2008-04-29 01:01:32 -0700941 .procname = "keys",
942 .mode = 0555,
943 .child = key_sysctls,
944 },
945#endif
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700946#ifdef CONFIG_RCU_TORTURE_TEST
947 {
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700948 .procname = "rcutorture_runnable",
949 .data = &rcutorture_runnable,
950 .maxlen = sizeof(int),
951 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800952 .proc_handler = proc_dointvec,
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700953 },
954#endif
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200955#ifdef CONFIG_PERF_EVENTS
Vince Weaveraa4a2212011-06-03 17:54:40 -0400956 /*
957 * User-space scripts rely on the existence of this file
958 * as a feature check for perf_events being enabled.
959 *
960 * So it's an ABI, do not remove!
961 */
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200962 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200963 .procname = "perf_event_paranoid",
964 .data = &sysctl_perf_event_paranoid,
965 .maxlen = sizeof(sysctl_perf_event_paranoid),
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200966 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800967 .proc_handler = proc_dointvec,
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200968 },
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200969 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200970 .procname = "perf_event_mlock_kb",
971 .data = &sysctl_perf_event_mlock,
972 .maxlen = sizeof(sysctl_perf_event_mlock),
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200973 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800974 .proc_handler = proc_dointvec,
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200975 },
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200976 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200977 .procname = "perf_event_max_sample_rate",
978 .data = &sysctl_perf_event_sample_rate,
979 .maxlen = sizeof(sysctl_perf_event_sample_rate),
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200980 .mode = 0644,
Peter Zijlstra163ec432011-02-16 11:22:34 +0100981 .proc_handler = perf_proc_update_handler,
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200982 },
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200983#endif
Vegard Nossumdfec0722008-04-04 00:51:41 +0200984#ifdef CONFIG_KMEMCHECK
985 {
Vegard Nossumdfec0722008-04-04 00:51:41 +0200986 .procname = "kmemcheck",
987 .data = &kmemcheck_enabled,
988 .maxlen = sizeof(int),
989 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800990 .proc_handler = proc_dointvec,
Vegard Nossumdfec0722008-04-04 00:51:41 +0200991 },
992#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200993#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200994 {
Jens Axboe5e605b62009-08-05 09:07:21 +0200995 .procname = "blk_iopoll",
996 .data = &blk_iopoll_enabled,
997 .maxlen = sizeof(int),
998 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800999 .proc_handler = proc_dointvec,
Jens Axboe5e605b62009-08-05 09:07:21 +02001000 },
Jens Axboecb684b52009-09-15 21:53:11 +02001001#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001002 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001003};
1004
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001005static struct ctl_table vm_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001006 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001007 .procname = "overcommit_memory",
1008 .data = &sysctl_overcommit_memory,
1009 .maxlen = sizeof(sysctl_overcommit_memory),
1010 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001011 .proc_handler = proc_dointvec_minmax,
1012 .extra1 = &zero,
1013 .extra2 = &two,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001014 },
1015 {
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001016 .procname = "panic_on_oom",
1017 .data = &sysctl_panic_on_oom,
1018 .maxlen = sizeof(sysctl_panic_on_oom),
1019 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001020 .proc_handler = proc_dointvec_minmax,
1021 .extra1 = &zero,
1022 .extra2 = &two,
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001023 },
1024 {
David Rientjesfe071d72007-10-16 23:25:56 -07001025 .procname = "oom_kill_allocating_task",
1026 .data = &sysctl_oom_kill_allocating_task,
1027 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1028 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001029 .proc_handler = proc_dointvec,
David Rientjesfe071d72007-10-16 23:25:56 -07001030 },
1031 {
David Rientjesfef1bdd2008-02-07 00:14:07 -08001032 .procname = "oom_dump_tasks",
1033 .data = &sysctl_oom_dump_tasks,
1034 .maxlen = sizeof(sysctl_oom_dump_tasks),
1035 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001036 .proc_handler = proc_dointvec,
David Rientjesfef1bdd2008-02-07 00:14:07 -08001037 },
1038 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001039 .procname = "overcommit_ratio",
1040 .data = &sysctl_overcommit_ratio,
1041 .maxlen = sizeof(sysctl_overcommit_ratio),
1042 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001043 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001044 },
1045 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001046 .procname = "page-cluster",
1047 .data = &page_cluster,
1048 .maxlen = sizeof(int),
1049 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001050 .proc_handler = proc_dointvec_minmax,
1051 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001052 },
1053 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001054 .procname = "dirty_background_ratio",
1055 .data = &dirty_background_ratio,
1056 .maxlen = sizeof(dirty_background_ratio),
1057 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001058 .proc_handler = dirty_background_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001059 .extra1 = &zero,
1060 .extra2 = &one_hundred,
1061 },
1062 {
David Rientjes2da02992009-01-06 14:39:31 -08001063 .procname = "dirty_background_bytes",
1064 .data = &dirty_background_bytes,
1065 .maxlen = sizeof(dirty_background_bytes),
1066 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001067 .proc_handler = dirty_background_bytes_handler,
Sven Wegenerfc3501d2009-02-11 13:04:23 -08001068 .extra1 = &one_ul,
David Rientjes2da02992009-01-06 14:39:31 -08001069 },
1070 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001071 .procname = "dirty_ratio",
1072 .data = &vm_dirty_ratio,
1073 .maxlen = sizeof(vm_dirty_ratio),
1074 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001075 .proc_handler = dirty_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001076 .extra1 = &zero,
1077 .extra2 = &one_hundred,
1078 },
1079 {
David Rientjes2da02992009-01-06 14:39:31 -08001080 .procname = "dirty_bytes",
1081 .data = &vm_dirty_bytes,
1082 .maxlen = sizeof(vm_dirty_bytes),
1083 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001084 .proc_handler = dirty_bytes_handler,
Andrea Righi9e4a5bd2009-04-30 15:08:57 -07001085 .extra1 = &dirty_bytes_min,
David Rientjes2da02992009-01-06 14:39:31 -08001086 },
1087 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001088 .procname = "dirty_writeback_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001089 .data = &dirty_writeback_interval,
1090 .maxlen = sizeof(dirty_writeback_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001091 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001092 .proc_handler = dirty_writeback_centisecs_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001093 },
1094 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001095 .procname = "dirty_expire_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001096 .data = &dirty_expire_interval,
1097 .maxlen = sizeof(dirty_expire_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001098 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001099 .proc_handler = proc_dointvec_minmax,
1100 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001101 },
1102 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001103 .procname = "nr_pdflush_threads",
1104 .data = &nr_pdflush_threads,
1105 .maxlen = sizeof nr_pdflush_threads,
1106 .mode = 0444 /* read-only*/,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001107 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001108 },
1109 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001110 .procname = "swappiness",
1111 .data = &vm_swappiness,
1112 .maxlen = sizeof(vm_swappiness),
1113 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001114 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001115 .extra1 = &zero,
1116 .extra2 = &one_hundred,
1117 },
1118#ifdef CONFIG_HUGETLB_PAGE
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001119 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001120 .procname = "nr_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001121 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001122 .maxlen = sizeof(unsigned long),
1123 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001124 .proc_handler = hugetlb_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001125 .extra1 = (void *)&hugetlb_zero,
1126 .extra2 = (void *)&hugetlb_infinity,
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001127 },
1128#ifdef CONFIG_NUMA
1129 {
1130 .procname = "nr_hugepages_mempolicy",
1131 .data = NULL,
1132 .maxlen = sizeof(unsigned long),
1133 .mode = 0644,
1134 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1135 .extra1 = (void *)&hugetlb_zero,
1136 .extra2 = (void *)&hugetlb_infinity,
1137 },
1138#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001139 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001140 .procname = "hugetlb_shm_group",
1141 .data = &sysctl_hugetlb_shm_group,
1142 .maxlen = sizeof(gid_t),
1143 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001144 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001145 },
Mel Gorman396faf02007-07-17 04:03:13 -07001146 {
Mel Gorman396faf02007-07-17 04:03:13 -07001147 .procname = "hugepages_treat_as_movable",
1148 .data = &hugepages_treat_as_movable,
1149 .maxlen = sizeof(int),
1150 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001151 .proc_handler = hugetlb_treat_movable_handler,
Mel Gorman396faf02007-07-17 04:03:13 -07001152 },
Adam Litke54f9f802007-10-16 01:26:20 -07001153 {
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001154 .procname = "nr_overcommit_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001155 .data = NULL,
1156 .maxlen = sizeof(unsigned long),
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001157 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001158 .proc_handler = hugetlb_overcommit_handler,
Andi Kleene5ff2152008-07-23 21:27:42 -07001159 .extra1 = (void *)&hugetlb_zero,
1160 .extra2 = (void *)&hugetlb_infinity,
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001161 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001162#endif
1163 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001164 .procname = "lowmem_reserve_ratio",
1165 .data = &sysctl_lowmem_reserve_ratio,
1166 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1167 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001168 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001169 },
1170 {
Andrew Morton9d0243b2006-01-08 01:00:39 -08001171 .procname = "drop_caches",
1172 .data = &sysctl_drop_caches,
1173 .maxlen = sizeof(int),
1174 .mode = 0644,
1175 .proc_handler = drop_caches_sysctl_handler,
Petr Holasekcb16e952011-03-23 16:43:09 -07001176 .extra1 = &one,
1177 .extra2 = &three,
Andrew Morton9d0243b2006-01-08 01:00:39 -08001178 },
Mel Gorman76ab0f52010-05-24 14:32:28 -07001179#ifdef CONFIG_COMPACTION
1180 {
1181 .procname = "compact_memory",
1182 .data = &sysctl_compact_memory,
1183 .maxlen = sizeof(int),
1184 .mode = 0200,
1185 .proc_handler = sysctl_compaction_handler,
1186 },
Mel Gorman5e771902010-05-24 14:32:31 -07001187 {
1188 .procname = "extfrag_threshold",
1189 .data = &sysctl_extfrag_threshold,
1190 .maxlen = sizeof(int),
1191 .mode = 0644,
1192 .proc_handler = sysctl_extfrag_handler,
1193 .extra1 = &min_extfrag_threshold,
1194 .extra2 = &max_extfrag_threshold,
1195 },
1196
Mel Gorman76ab0f52010-05-24 14:32:28 -07001197#endif /* CONFIG_COMPACTION */
Andrew Morton9d0243b2006-01-08 01:00:39 -08001198 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001199 .procname = "min_free_kbytes",
1200 .data = &min_free_kbytes,
1201 .maxlen = sizeof(min_free_kbytes),
1202 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001203 .proc_handler = min_free_kbytes_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001204 .extra1 = &zero,
1205 },
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001206 {
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001207 .procname = "percpu_pagelist_fraction",
1208 .data = &percpu_pagelist_fraction,
1209 .maxlen = sizeof(percpu_pagelist_fraction),
1210 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001211 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001212 .extra1 = &min_percpu_pagelist_fract,
1213 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001214#ifdef CONFIG_MMU
1215 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001216 .procname = "max_map_count",
1217 .data = &sysctl_max_map_count,
1218 .maxlen = sizeof(sysctl_max_map_count),
1219 .mode = 0644,
WANG Cong3e261202009-12-17 15:27:05 -08001220 .proc_handler = proc_dointvec_minmax,
Amerigo Wang70da2342009-12-14 17:59:52 -08001221 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001222 },
Paul Mundtdd8632a2009-01-08 12:04:47 +00001223#else
1224 {
Paul Mundtdd8632a2009-01-08 12:04:47 +00001225 .procname = "nr_trim_pages",
1226 .data = &sysctl_nr_trim_pages,
1227 .maxlen = sizeof(sysctl_nr_trim_pages),
1228 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001229 .proc_handler = proc_dointvec_minmax,
Paul Mundtdd8632a2009-01-08 12:04:47 +00001230 .extra1 = &zero,
1231 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001232#endif
1233 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001234 .procname = "laptop_mode",
1235 .data = &laptop_mode,
1236 .maxlen = sizeof(laptop_mode),
1237 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001238 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001239 },
1240 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001241 .procname = "block_dump",
1242 .data = &block_dump,
1243 .maxlen = sizeof(block_dump),
1244 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001245 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001246 .extra1 = &zero,
1247 },
1248 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001249 .procname = "vfs_cache_pressure",
1250 .data = &sysctl_vfs_cache_pressure,
1251 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1252 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001253 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001254 .extra1 = &zero,
1255 },
1256#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1257 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001258 .procname = "legacy_va_layout",
1259 .data = &sysctl_legacy_va_layout,
1260 .maxlen = sizeof(sysctl_legacy_va_layout),
1261 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001262 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001263 .extra1 = &zero,
1264 },
1265#endif
Christoph Lameter17436602006-01-18 17:42:32 -08001266#ifdef CONFIG_NUMA
1267 {
Christoph Lameter17436602006-01-18 17:42:32 -08001268 .procname = "zone_reclaim_mode",
1269 .data = &zone_reclaim_mode,
1270 .maxlen = sizeof(zone_reclaim_mode),
1271 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001272 .proc_handler = proc_dointvec,
Christoph Lameterc84db232006-02-01 03:05:29 -08001273 .extra1 = &zero,
Christoph Lameter17436602006-01-18 17:42:32 -08001274 },
Christoph Lameter96146342006-07-03 00:24:13 -07001275 {
Christoph Lameter96146342006-07-03 00:24:13 -07001276 .procname = "min_unmapped_ratio",
1277 .data = &sysctl_min_unmapped_ratio,
1278 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1279 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001280 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
Christoph Lameter96146342006-07-03 00:24:13 -07001281 .extra1 = &zero,
1282 .extra2 = &one_hundred,
1283 },
Christoph Lameter0ff38492006-09-25 23:31:52 -07001284 {
Christoph Lameter0ff38492006-09-25 23:31:52 -07001285 .procname = "min_slab_ratio",
1286 .data = &sysctl_min_slab_ratio,
1287 .maxlen = sizeof(sysctl_min_slab_ratio),
1288 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001289 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
Christoph Lameter0ff38492006-09-25 23:31:52 -07001290 .extra1 = &zero,
1291 .extra2 = &one_hundred,
1292 },
Christoph Lameter17436602006-01-18 17:42:32 -08001293#endif
Christoph Lameter77461ab2007-05-09 02:35:13 -07001294#ifdef CONFIG_SMP
1295 {
Christoph Lameter77461ab2007-05-09 02:35:13 -07001296 .procname = "stat_interval",
1297 .data = &sysctl_stat_interval,
1298 .maxlen = sizeof(sysctl_stat_interval),
1299 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001300 .proc_handler = proc_dointvec_jiffies,
Christoph Lameter77461ab2007-05-09 02:35:13 -07001301 },
1302#endif
David Howells6e141542009-12-15 19:27:45 +00001303#ifdef CONFIG_MMU
Eric Parised032182007-06-28 15:55:21 -04001304 {
Eric Parised032182007-06-28 15:55:21 -04001305 .procname = "mmap_min_addr",
Eric Paris788084a2009-07-31 12:54:11 -04001306 .data = &dac_mmap_min_addr,
1307 .maxlen = sizeof(unsigned long),
Eric Parised032182007-06-28 15:55:21 -04001308 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001309 .proc_handler = mmap_min_addr_handler,
Eric Parised032182007-06-28 15:55:21 -04001310 },
David Howells6e141542009-12-15 19:27:45 +00001311#endif
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001312#ifdef CONFIG_NUMA
1313 {
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001314 .procname = "numa_zonelist_order",
1315 .data = &numa_zonelist_order,
1316 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1317 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001318 .proc_handler = numa_zonelist_order_handler,
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001319 },
1320#endif
Al Viro2b8232c2007-10-13 08:16:04 +01001321#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
Paul Mundt5c36e652007-03-01 10:07:42 +09001322 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
Ingo Molnare6e54942006-06-27 02:53:50 -07001323 {
Ingo Molnare6e54942006-06-27 02:53:50 -07001324 .procname = "vdso_enabled",
1325 .data = &vdso_enabled,
1326 .maxlen = sizeof(vdso_enabled),
1327 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001328 .proc_handler = proc_dointvec,
Ingo Molnare6e54942006-06-27 02:53:50 -07001329 .extra1 = &zero,
1330 },
1331#endif
Bron Gondwana195cf452008-02-04 22:29:20 -08001332#ifdef CONFIG_HIGHMEM
1333 {
Bron Gondwana195cf452008-02-04 22:29:20 -08001334 .procname = "highmem_is_dirtyable",
1335 .data = &vm_highmem_is_dirtyable,
1336 .maxlen = sizeof(vm_highmem_is_dirtyable),
1337 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001338 .proc_handler = proc_dointvec_minmax,
Bron Gondwana195cf452008-02-04 22:29:20 -08001339 .extra1 = &zero,
1340 .extra2 = &one,
1341 },
1342#endif
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001343 {
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001344 .procname = "scan_unevictable_pages",
1345 .data = &scan_unevictable_pages,
1346 .maxlen = sizeof(scan_unevictable_pages),
1347 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001348 .proc_handler = scan_unevictable_handler,
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001349 },
Andi Kleen6a460792009-09-16 11:50:15 +02001350#ifdef CONFIG_MEMORY_FAILURE
1351 {
Andi Kleen6a460792009-09-16 11:50:15 +02001352 .procname = "memory_failure_early_kill",
1353 .data = &sysctl_memory_failure_early_kill,
1354 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1355 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001356 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001357 .extra1 = &zero,
1358 .extra2 = &one,
1359 },
1360 {
Andi Kleen6a460792009-09-16 11:50:15 +02001361 .procname = "memory_failure_recovery",
1362 .data = &sysctl_memory_failure_recovery,
1363 .maxlen = sizeof(sysctl_memory_failure_recovery),
1364 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001365 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001366 .extra1 = &zero,
1367 .extra2 = &one,
1368 },
1369#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001370 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001371};
1372
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001373#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001374static struct ctl_table binfmt_misc_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001375 { }
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001376};
1377#endif
1378
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001379static struct ctl_table fs_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001380 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001381 .procname = "inode-nr",
1382 .data = &inodes_stat,
1383 .maxlen = 2*sizeof(int),
1384 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001385 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001386 },
1387 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001388 .procname = "inode-state",
1389 .data = &inodes_stat,
1390 .maxlen = 7*sizeof(int),
1391 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001392 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001393 },
1394 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001395 .procname = "file-nr",
1396 .data = &files_stat,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001397 .maxlen = sizeof(files_stat),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001398 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001399 .proc_handler = proc_nr_files,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001400 },
1401 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001402 .procname = "file-max",
1403 .data = &files_stat.max_files,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001404 .maxlen = sizeof(files_stat.max_files),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001405 .mode = 0644,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001406 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001407 },
1408 {
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001409 .procname = "nr_open",
1410 .data = &sysctl_nr_open,
1411 .maxlen = sizeof(int),
1412 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001413 .proc_handler = proc_dointvec_minmax,
Al Viroeceea0b2008-05-10 10:08:32 -04001414 .extra1 = &sysctl_nr_open_min,
1415 .extra2 = &sysctl_nr_open_max,
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001416 },
1417 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001418 .procname = "dentry-state",
1419 .data = &dentry_stat,
1420 .maxlen = 6*sizeof(int),
1421 .mode = 0444,
Christoph Hellwig312d3ca2010-10-10 05:36:23 -04001422 .proc_handler = proc_nr_dentry,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001423 },
1424 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001425 .procname = "overflowuid",
1426 .data = &fs_overflowuid,
1427 .maxlen = sizeof(int),
1428 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001429 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001430 .extra1 = &minolduid,
1431 .extra2 = &maxolduid,
1432 },
1433 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001434 .procname = "overflowgid",
1435 .data = &fs_overflowgid,
1436 .maxlen = sizeof(int),
1437 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001438 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001439 .extra1 = &minolduid,
1440 .extra2 = &maxolduid,
1441 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001442#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001443 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001444 .procname = "leases-enable",
1445 .data = &leases_enable,
1446 .maxlen = sizeof(int),
1447 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001448 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001449 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001450#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001451#ifdef CONFIG_DNOTIFY
1452 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001453 .procname = "dir-notify-enable",
1454 .data = &dir_notify_enable,
1455 .maxlen = sizeof(int),
1456 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001457 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001458 },
1459#endif
1460#ifdef CONFIG_MMU
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001461#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001462 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001463 .procname = "lease-break-time",
1464 .data = &lease_break_time,
1465 .maxlen = sizeof(int),
1466 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001467 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001468 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001469#endif
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001470#ifdef CONFIG_AIO
Linus Torvalds1da177e2005-04-16 15:20:36 -07001471 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001472 .procname = "aio-nr",
1473 .data = &aio_nr,
1474 .maxlen = sizeof(aio_nr),
1475 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001476 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001477 },
1478 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001479 .procname = "aio-max-nr",
1480 .data = &aio_max_nr,
1481 .maxlen = sizeof(aio_max_nr),
1482 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001483 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001484 },
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001485#endif /* CONFIG_AIO */
Amy Griffis2d9048e2006-06-01 13:10:59 -07001486#ifdef CONFIG_INOTIFY_USER
Robert Love0399cb02005-07-13 12:38:18 -04001487 {
Robert Love0399cb02005-07-13 12:38:18 -04001488 .procname = "inotify",
1489 .mode = 0555,
1490 .child = inotify_table,
1491 },
1492#endif
Davide Libenzi7ef99642008-12-01 13:13:55 -08001493#ifdef CONFIG_EPOLL
1494 {
1495 .procname = "epoll",
1496 .mode = 0555,
1497 .child = epoll_table,
1498 },
1499#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001500#endif
Alan Coxd6e71142005-06-23 00:09:43 -07001501 {
Alan Coxd6e71142005-06-23 00:09:43 -07001502 .procname = "suid_dumpable",
1503 .data = &suid_dumpable,
1504 .maxlen = sizeof(int),
1505 .mode = 0644,
Kees Cook54b50192012-07-30 14:39:18 -07001506 .proc_handler = proc_dointvec_minmax_coredump,
Matthew Wilcox8e654fb2009-04-02 16:58:33 -07001507 .extra1 = &zero,
1508 .extra2 = &two,
Alan Coxd6e71142005-06-23 00:09:43 -07001509 },
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001510#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1511 {
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001512 .procname = "binfmt_misc",
1513 .mode = 0555,
1514 .child = binfmt_misc_table,
1515 },
1516#endif
Jens Axboeb492e952010-05-19 21:03:16 +02001517 {
Jens Axboeff9da692010-06-03 14:54:39 +02001518 .procname = "pipe-max-size",
1519 .data = &pipe_max_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001520 .maxlen = sizeof(int),
1521 .mode = 0644,
Jens Axboeff9da692010-06-03 14:54:39 +02001522 .proc_handler = &pipe_proc_fn,
1523 .extra1 = &pipe_min_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001524 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001525 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001526};
1527
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001528static struct ctl_table debug_table[] = {
Heiko Carstensab3c68e2010-05-17 10:00:21 +02001529#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
Chris Metcalf571d76a2011-05-16 14:23:44 -04001530 defined(CONFIG_S390) || defined(CONFIG_TILE)
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001531 {
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001532 .procname = "exception-trace",
1533 .data = &show_unhandled_signals,
1534 .maxlen = sizeof(int),
1535 .mode = 0644,
1536 .proc_handler = proc_dointvec
1537 },
1538#endif
Masami Hiramatsub2be84d2010-02-25 08:34:15 -05001539#if defined(CONFIG_OPTPROBES)
1540 {
1541 .procname = "kprobes-optimization",
1542 .data = &sysctl_kprobes_optimization,
1543 .maxlen = sizeof(int),
1544 .mode = 0644,
1545 .proc_handler = proc_kprobes_optimization_handler,
1546 .extra1 = &zero,
1547 .extra2 = &one,
1548 },
1549#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001550 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001551};
1552
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001553static struct ctl_table dev_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001554 { }
Robert Love0eeca282005-07-12 17:06:03 -04001555};
Linus Torvalds1da177e2005-04-16 15:20:36 -07001556
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001557int __init sysctl_init(void)
Al Viro330d57f2005-11-04 10:18:40 +00001558{
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001559 register_sysctl_table(sysctl_base_table);
Eric W. Biedermand912b0c2007-02-14 00:34:13 -08001560 return 0;
1561}
1562
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001563#endif /* CONFIG_SYSCTL */
1564
Linus Torvalds1da177e2005-04-16 15:20:36 -07001565/*
1566 * /proc/sys support
1567 */
1568
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001569#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -07001570
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001571static int _proc_do_string(void* data, int maxlen, int write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001572 void __user *buffer,
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001573 size_t *lenp, loff_t *ppos)
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001574{
1575 size_t len;
1576 char __user *p;
1577 char c;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001578
1579 if (!data || !maxlen || !*lenp) {
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001580 *lenp = 0;
1581 return 0;
1582 }
Oleg Nesterov8d060872007-02-10 01:46:38 -08001583
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001584 if (write) {
1585 len = 0;
1586 p = buffer;
1587 while (len < *lenp) {
1588 if (get_user(c, p++))
1589 return -EFAULT;
1590 if (c == 0 || c == '\n')
1591 break;
1592 len++;
1593 }
1594 if (len >= maxlen)
1595 len = maxlen-1;
1596 if(copy_from_user(data, buffer, len))
1597 return -EFAULT;
1598 ((char *) data)[len] = 0;
1599 *ppos += *lenp;
1600 } else {
1601 len = strlen(data);
1602 if (len > maxlen)
1603 len = maxlen;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001604
1605 if (*ppos > len) {
1606 *lenp = 0;
1607 return 0;
1608 }
1609
1610 data += *ppos;
1611 len -= *ppos;
1612
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001613 if (len > *lenp)
1614 len = *lenp;
1615 if (len)
1616 if(copy_to_user(buffer, data, len))
1617 return -EFAULT;
1618 if (len < *lenp) {
1619 if(put_user('\n', ((char __user *) buffer) + len))
1620 return -EFAULT;
1621 len++;
1622 }
1623 *lenp = len;
1624 *ppos += len;
1625 }
1626 return 0;
1627}
1628
Linus Torvalds1da177e2005-04-16 15:20:36 -07001629/**
1630 * proc_dostring - read a string sysctl
1631 * @table: the sysctl table
1632 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001633 * @buffer: the user buffer
1634 * @lenp: the size of the user buffer
1635 * @ppos: file position
1636 *
1637 * Reads/writes a string from/to the user buffer. If the kernel
1638 * buffer provided is not large enough to hold the string, the
1639 * string is truncated. The copied string is %NULL-terminated.
1640 * If the string is being read by the user process, it is copied
1641 * and a newline '\n' is added. It is truncated if the buffer is
1642 * not large enough.
1643 *
1644 * Returns 0 on success.
1645 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001646int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001647 void __user *buffer, size_t *lenp, loff_t *ppos)
1648{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001649 return _proc_do_string(table->data, table->maxlen, write,
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001650 buffer, lenp, ppos);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001651}
1652
Amerigo Wang00b7c332010-05-05 00:26:45 +00001653static size_t proc_skip_spaces(char **buf)
1654{
1655 size_t ret;
1656 char *tmp = skip_spaces(*buf);
1657 ret = tmp - *buf;
1658 *buf = tmp;
1659 return ret;
1660}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001661
Octavian Purdila9f977fb2010-05-05 00:26:55 +00001662static void proc_skip_char(char **buf, size_t *size, const char v)
1663{
1664 while (*size) {
1665 if (**buf != v)
1666 break;
1667 (*size)--;
1668 (*buf)++;
1669 }
1670}
1671
Amerigo Wang00b7c332010-05-05 00:26:45 +00001672#define TMPBUFLEN 22
1673/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001674 * proc_get_long - reads an ASCII formatted integer from a user buffer
Amerigo Wang00b7c332010-05-05 00:26:45 +00001675 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001676 * @buf: a kernel buffer
1677 * @size: size of the kernel buffer
1678 * @val: this is where the number will be stored
1679 * @neg: set to %TRUE if number is negative
1680 * @perm_tr: a vector which contains the allowed trailers
1681 * @perm_tr_len: size of the perm_tr vector
1682 * @tr: pointer to store the trailer character
Amerigo Wang00b7c332010-05-05 00:26:45 +00001683 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001684 * In case of success %0 is returned and @buf and @size are updated with
1685 * the amount of bytes read. If @tr is non-NULL and a trailing
1686 * character exists (size is non-zero after returning from this
1687 * function), @tr is updated with the trailing character.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001688 */
1689static int proc_get_long(char **buf, size_t *size,
1690 unsigned long *val, bool *neg,
1691 const char *perm_tr, unsigned perm_tr_len, char *tr)
1692{
1693 int len;
1694 char *p, tmp[TMPBUFLEN];
1695
1696 if (!*size)
1697 return -EINVAL;
1698
1699 len = *size;
1700 if (len > TMPBUFLEN - 1)
1701 len = TMPBUFLEN - 1;
1702
1703 memcpy(tmp, *buf, len);
1704
1705 tmp[len] = 0;
1706 p = tmp;
1707 if (*p == '-' && *size > 1) {
1708 *neg = true;
1709 p++;
1710 } else
1711 *neg = false;
1712 if (!isdigit(*p))
1713 return -EINVAL;
1714
1715 *val = simple_strtoul(p, &p, 0);
1716
1717 len = p - tmp;
1718
1719 /* We don't know if the next char is whitespace thus we may accept
1720 * invalid integers (e.g. 1234...a) or two integers instead of one
1721 * (e.g. 123...1). So lets not allow such large numbers. */
1722 if (len == TMPBUFLEN - 1)
1723 return -EINVAL;
1724
1725 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
1726 return -EINVAL;
1727
1728 if (tr && (len < *size))
1729 *tr = *p;
1730
1731 *buf += len;
1732 *size -= len;
1733
1734 return 0;
1735}
1736
1737/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001738 * proc_put_long - converts an integer to a decimal ASCII formatted string
Amerigo Wang00b7c332010-05-05 00:26:45 +00001739 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001740 * @buf: the user buffer
1741 * @size: the size of the user buffer
1742 * @val: the integer to be converted
1743 * @neg: sign of the number, %TRUE for negative
Amerigo Wang00b7c332010-05-05 00:26:45 +00001744 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001745 * In case of success %0 is returned and @buf and @size are updated with
1746 * the amount of bytes written.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001747 */
1748static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
1749 bool neg)
1750{
1751 int len;
1752 char tmp[TMPBUFLEN], *p = tmp;
1753
1754 sprintf(p, "%s%lu", neg ? "-" : "", val);
1755 len = strlen(tmp);
1756 if (len > *size)
1757 len = *size;
1758 if (copy_to_user(*buf, tmp, len))
1759 return -EFAULT;
1760 *size -= len;
1761 *buf += len;
1762 return 0;
1763}
1764#undef TMPBUFLEN
1765
1766static int proc_put_char(void __user **buf, size_t *size, char c)
1767{
1768 if (*size) {
1769 char __user **buffer = (char __user **)buf;
1770 if (put_user(c, *buffer))
1771 return -EFAULT;
1772 (*size)--, (*buffer)++;
1773 *buf = *buffer;
1774 }
1775 return 0;
1776}
1777
1778static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001779 int *valp,
1780 int write, void *data)
1781{
1782 if (write) {
1783 *valp = *negp ? -*lvalp : *lvalp;
1784 } else {
1785 int val = *valp;
1786 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001787 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001788 *lvalp = (unsigned long)-val;
1789 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001790 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001791 *lvalp = (unsigned long)val;
1792 }
1793 }
1794 return 0;
1795}
1796
Amerigo Wang00b7c332010-05-05 00:26:45 +00001797static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
1798
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001799static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001800 int write, void __user *buffer,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001801 size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001802 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001803 int write, void *data),
1804 void *data)
1805{
Amerigo Wang00b7c332010-05-05 00:26:45 +00001806 int *i, vleft, first = 1, err = 0;
1807 unsigned long page = 0;
1808 size_t left;
1809 char *kbuf;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001810
Amerigo Wang00b7c332010-05-05 00:26:45 +00001811 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001812 *lenp = 0;
1813 return 0;
1814 }
1815
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001816 i = (int *) tbl_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001817 vleft = table->maxlen / sizeof(*i);
1818 left = *lenp;
1819
1820 if (!conv)
1821 conv = do_proc_dointvec_conv;
1822
Linus Torvalds1da177e2005-04-16 15:20:36 -07001823 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001824 if (left > PAGE_SIZE - 1)
1825 left = PAGE_SIZE - 1;
1826 page = __get_free_page(GFP_TEMPORARY);
1827 kbuf = (char *) page;
1828 if (!kbuf)
1829 return -ENOMEM;
1830 if (copy_from_user(kbuf, buffer, left)) {
1831 err = -EFAULT;
1832 goto free;
1833 }
1834 kbuf[left] = 0;
1835 }
1836
1837 for (; left && vleft--; i++, first=0) {
1838 unsigned long lval;
1839 bool neg;
1840
1841 if (write) {
1842 left -= proc_skip_spaces(&kbuf);
1843
J. R. Okajima563b0462010-05-25 16:10:14 -07001844 if (!left)
1845 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001846 err = proc_get_long(&kbuf, &left, &lval, &neg,
1847 proc_wspace_sep,
1848 sizeof(proc_wspace_sep), NULL);
1849 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001850 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001851 if (conv(&neg, &lval, i, 1, data)) {
1852 err = -EINVAL;
1853 break;
1854 }
1855 } else {
1856 if (conv(&neg, &lval, i, 0, data)) {
1857 err = -EINVAL;
1858 break;
1859 }
1860 if (!first)
1861 err = proc_put_char(&buffer, &left, '\t');
1862 if (err)
1863 break;
1864 err = proc_put_long(&buffer, &left, lval, neg);
1865 if (err)
1866 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001867 }
1868 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00001869
1870 if (!write && !first && left && !err)
1871 err = proc_put_char(&buffer, &left, '\n');
J. R. Okajima563b0462010-05-25 16:10:14 -07001872 if (write && !err && left)
Amerigo Wang00b7c332010-05-05 00:26:45 +00001873 left -= proc_skip_spaces(&kbuf);
1874free:
1875 if (write) {
1876 free_page(page);
1877 if (first)
1878 return err ? : -EINVAL;
1879 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001880 *lenp -= left;
1881 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001882 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001883}
1884
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001885static int do_proc_dointvec(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001886 void __user *buffer, size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001887 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001888 int write, void *data),
1889 void *data)
1890{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001891 return __do_proc_dointvec(table->data, table, write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001892 buffer, lenp, ppos, conv, data);
1893}
1894
Linus Torvalds1da177e2005-04-16 15:20:36 -07001895/**
1896 * proc_dointvec - read a vector of integers
1897 * @table: the sysctl table
1898 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001899 * @buffer: the user buffer
1900 * @lenp: the size of the user buffer
1901 * @ppos: file position
1902 *
1903 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1904 * values from/to the user buffer, treated as an ASCII string.
1905 *
1906 * Returns 0 on success.
1907 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001908int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001909 void __user *buffer, size_t *lenp, loff_t *ppos)
1910{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001911 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001912 NULL,NULL);
1913}
1914
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001915/*
Andi Kleen25ddbb12008-10-15 22:01:41 -07001916 * Taint values can only be increased
1917 * This means we can safely use a temporary.
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001918 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001919static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001920 void __user *buffer, size_t *lenp, loff_t *ppos)
1921{
Andi Kleen25ddbb12008-10-15 22:01:41 -07001922 struct ctl_table t;
1923 unsigned long tmptaint = get_taint();
1924 int err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001925
Bastian Blank91fcd412007-04-23 14:41:14 -07001926 if (write && !capable(CAP_SYS_ADMIN))
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001927 return -EPERM;
1928
Andi Kleen25ddbb12008-10-15 22:01:41 -07001929 t = *table;
1930 t.data = &tmptaint;
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001931 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
Andi Kleen25ddbb12008-10-15 22:01:41 -07001932 if (err < 0)
1933 return err;
1934
1935 if (write) {
1936 /*
1937 * Poor man's atomic or. Not worth adding a primitive
1938 * to everyone's atomic.h for this
1939 */
1940 int i;
1941 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
1942 if ((tmptaint >> i) & 1)
1943 add_taint(i);
1944 }
1945 }
1946
1947 return err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001948}
1949
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001950#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -07001951static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001952 void __user *buffer, size_t *lenp, loff_t *ppos)
1953{
1954 if (write && !capable(CAP_SYS_ADMIN))
1955 return -EPERM;
1956
1957 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
1958}
1959#endif
1960
Linus Torvalds1da177e2005-04-16 15:20:36 -07001961struct do_proc_dointvec_minmax_conv_param {
1962 int *min;
1963 int *max;
1964};
1965
Amerigo Wang00b7c332010-05-05 00:26:45 +00001966static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
1967 int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001968 int write, void *data)
1969{
1970 struct do_proc_dointvec_minmax_conv_param *param = data;
1971 if (write) {
1972 int val = *negp ? -*lvalp : *lvalp;
1973 if ((param->min && *param->min > val) ||
1974 (param->max && *param->max < val))
1975 return -EINVAL;
1976 *valp = val;
1977 } else {
1978 int val = *valp;
1979 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001980 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001981 *lvalp = (unsigned long)-val;
1982 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001983 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001984 *lvalp = (unsigned long)val;
1985 }
1986 }
1987 return 0;
1988}
1989
1990/**
1991 * proc_dointvec_minmax - read a vector of integers with min/max values
1992 * @table: the sysctl table
1993 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001994 * @buffer: the user buffer
1995 * @lenp: the size of the user buffer
1996 * @ppos: file position
1997 *
1998 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1999 * values from/to the user buffer, treated as an ASCII string.
2000 *
2001 * This routine will ensure the values are within the range specified by
2002 * table->extra1 (min) and table->extra2 (max).
2003 *
2004 * Returns 0 on success.
2005 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002006int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002007 void __user *buffer, size_t *lenp, loff_t *ppos)
2008{
2009 struct do_proc_dointvec_minmax_conv_param param = {
2010 .min = (int *) table->extra1,
2011 .max = (int *) table->extra2,
2012 };
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002013 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002014 do_proc_dointvec_minmax_conv, &param);
2015}
2016
Kees Cook54b50192012-07-30 14:39:18 -07002017static void validate_coredump_safety(void)
2018{
2019 if (suid_dumpable == SUID_DUMPABLE_SAFE &&
2020 core_pattern[0] != '/' && core_pattern[0] != '|') {
2021 printk(KERN_WARNING "Unsafe core_pattern used with "\
2022 "suid_dumpable=2. Pipe handler or fully qualified "\
2023 "core dump path required.\n");
2024 }
2025}
2026
2027static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
2028 void __user *buffer, size_t *lenp, loff_t *ppos)
2029{
2030 int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
2031 if (!error)
2032 validate_coredump_safety();
2033 return error;
2034}
2035
2036static int proc_dostring_coredump(struct ctl_table *table, int write,
2037 void __user *buffer, size_t *lenp, loff_t *ppos)
2038{
2039 int error = proc_dostring(table, write, buffer, lenp, ppos);
2040 if (!error)
2041 validate_coredump_safety();
2042 return error;
2043}
2044
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002045static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002046 void __user *buffer,
2047 size_t *lenp, loff_t *ppos,
2048 unsigned long convmul,
2049 unsigned long convdiv)
2050{
Amerigo Wang00b7c332010-05-05 00:26:45 +00002051 unsigned long *i, *min, *max;
2052 int vleft, first = 1, err = 0;
2053 unsigned long page = 0;
2054 size_t left;
2055 char *kbuf;
2056
2057 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002058 *lenp = 0;
2059 return 0;
2060 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002061
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002062 i = (unsigned long *) data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002063 min = (unsigned long *) table->extra1;
2064 max = (unsigned long *) table->extra2;
2065 vleft = table->maxlen / sizeof(unsigned long);
2066 left = *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002067
2068 if (write) {
2069 if (left > PAGE_SIZE - 1)
2070 left = PAGE_SIZE - 1;
2071 page = __get_free_page(GFP_TEMPORARY);
2072 kbuf = (char *) page;
2073 if (!kbuf)
2074 return -ENOMEM;
2075 if (copy_from_user(kbuf, buffer, left)) {
2076 err = -EFAULT;
2077 goto free;
2078 }
2079 kbuf[left] = 0;
2080 }
2081
Eric Dumazet27b3d802010-10-07 12:59:29 -07002082 for (; left && vleft--; i++, first = 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002083 unsigned long val;
2084
Linus Torvalds1da177e2005-04-16 15:20:36 -07002085 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002086 bool neg;
2087
2088 left -= proc_skip_spaces(&kbuf);
2089
2090 err = proc_get_long(&kbuf, &left, &val, &neg,
2091 proc_wspace_sep,
2092 sizeof(proc_wspace_sep), NULL);
2093 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002094 break;
2095 if (neg)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002096 continue;
2097 if ((min && val < *min) || (max && val > *max))
2098 continue;
2099 *i = val;
2100 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002101 val = convdiv * (*i) / convmul;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002102 if (!first)
Amerigo Wang00b7c332010-05-05 00:26:45 +00002103 err = proc_put_char(&buffer, &left, '\t');
2104 err = proc_put_long(&buffer, &left, val, false);
2105 if (err)
2106 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002107 }
2108 }
2109
Amerigo Wang00b7c332010-05-05 00:26:45 +00002110 if (!write && !first && left && !err)
2111 err = proc_put_char(&buffer, &left, '\n');
2112 if (write && !err)
2113 left -= proc_skip_spaces(&kbuf);
2114free:
Linus Torvalds1da177e2005-04-16 15:20:36 -07002115 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002116 free_page(page);
2117 if (first)
2118 return err ? : -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002119 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002120 *lenp -= left;
2121 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002122 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002123}
2124
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002125static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002126 void __user *buffer,
2127 size_t *lenp, loff_t *ppos,
2128 unsigned long convmul,
2129 unsigned long convdiv)
2130{
2131 return __do_proc_doulongvec_minmax(table->data, table, write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002132 buffer, lenp, ppos, convmul, convdiv);
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002133}
2134
Linus Torvalds1da177e2005-04-16 15:20:36 -07002135/**
2136 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2137 * @table: the sysctl table
2138 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002139 * @buffer: the user buffer
2140 * @lenp: the size of the user buffer
2141 * @ppos: file position
2142 *
2143 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2144 * values from/to the user buffer, treated as an ASCII string.
2145 *
2146 * This routine will ensure the values are within the range specified by
2147 * table->extra1 (min) and table->extra2 (max).
2148 *
2149 * Returns 0 on success.
2150 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002151int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002152 void __user *buffer, size_t *lenp, loff_t *ppos)
2153{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002154 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002155}
2156
2157/**
2158 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2159 * @table: the sysctl table
2160 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002161 * @buffer: the user buffer
2162 * @lenp: the size of the user buffer
2163 * @ppos: file position
2164 *
2165 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2166 * values from/to the user buffer, treated as an ASCII string. The values
2167 * are treated as milliseconds, and converted to jiffies when they are stored.
2168 *
2169 * This routine will ensure the values are within the range specified by
2170 * table->extra1 (min) and table->extra2 (max).
2171 *
2172 * Returns 0 on success.
2173 */
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002174int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002175 void __user *buffer,
2176 size_t *lenp, loff_t *ppos)
2177{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002178 return do_proc_doulongvec_minmax(table, write, buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002179 lenp, ppos, HZ, 1000l);
2180}
2181
2182
Amerigo Wang00b7c332010-05-05 00:26:45 +00002183static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002184 int *valp,
2185 int write, void *data)
2186{
2187 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002188 if (*lvalp > LONG_MAX / HZ)
2189 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002190 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2191 } else {
2192 int val = *valp;
2193 unsigned long lval;
2194 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002195 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002196 lval = (unsigned long)-val;
2197 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002198 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002199 lval = (unsigned long)val;
2200 }
2201 *lvalp = lval / HZ;
2202 }
2203 return 0;
2204}
2205
Amerigo Wang00b7c332010-05-05 00:26:45 +00002206static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002207 int *valp,
2208 int write, void *data)
2209{
2210 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002211 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2212 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002213 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2214 } else {
2215 int val = *valp;
2216 unsigned long lval;
2217 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002218 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002219 lval = (unsigned long)-val;
2220 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002221 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002222 lval = (unsigned long)val;
2223 }
2224 *lvalp = jiffies_to_clock_t(lval);
2225 }
2226 return 0;
2227}
2228
Amerigo Wang00b7c332010-05-05 00:26:45 +00002229static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002230 int *valp,
2231 int write, void *data)
2232{
2233 if (write) {
2234 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2235 } else {
2236 int val = *valp;
2237 unsigned long lval;
2238 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002239 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002240 lval = (unsigned long)-val;
2241 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002242 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002243 lval = (unsigned long)val;
2244 }
2245 *lvalp = jiffies_to_msecs(lval);
2246 }
2247 return 0;
2248}
2249
2250/**
2251 * proc_dointvec_jiffies - read a vector of integers as seconds
2252 * @table: the sysctl table
2253 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002254 * @buffer: the user buffer
2255 * @lenp: the size of the user buffer
2256 * @ppos: file position
2257 *
2258 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2259 * values from/to the user buffer, treated as an ASCII string.
2260 * The values read are assumed to be in seconds, and are converted into
2261 * jiffies.
2262 *
2263 * Returns 0 on success.
2264 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002265int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002266 void __user *buffer, size_t *lenp, loff_t *ppos)
2267{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002268 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002269 do_proc_dointvec_jiffies_conv,NULL);
2270}
2271
2272/**
2273 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2274 * @table: the sysctl table
2275 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002276 * @buffer: the user buffer
2277 * @lenp: the size of the user buffer
Randy Dunlap1e5d5332005-11-07 01:01:06 -08002278 * @ppos: pointer to the file position
Linus Torvalds1da177e2005-04-16 15:20:36 -07002279 *
2280 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2281 * values from/to the user buffer, treated as an ASCII string.
2282 * The values read are assumed to be in 1/USER_HZ seconds, and
2283 * are converted into jiffies.
2284 *
2285 * Returns 0 on success.
2286 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002287int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002288 void __user *buffer, size_t *lenp, loff_t *ppos)
2289{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002290 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002291 do_proc_dointvec_userhz_jiffies_conv,NULL);
2292}
2293
2294/**
2295 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2296 * @table: the sysctl table
2297 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002298 * @buffer: the user buffer
2299 * @lenp: the size of the user buffer
Martin Waitz67be2dd2005-05-01 08:59:26 -07002300 * @ppos: file position
2301 * @ppos: the current position in the file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002302 *
2303 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2304 * values from/to the user buffer, treated as an ASCII string.
2305 * The values read are assumed to be in 1/1000 seconds, and
2306 * are converted into jiffies.
2307 *
2308 * Returns 0 on success.
2309 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002310int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002311 void __user *buffer, size_t *lenp, loff_t *ppos)
2312{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002313 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002314 do_proc_dointvec_ms_jiffies_conv, NULL);
2315}
2316
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002317static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002318 void __user *buffer, size_t *lenp, loff_t *ppos)
2319{
2320 struct pid *new_pid;
2321 pid_t tmp;
2322 int r;
2323
Pavel Emelyanov6c5f3e72008-02-08 04:19:20 -08002324 tmp = pid_vnr(cad_pid);
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002325
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002326 r = __do_proc_dointvec(&tmp, table, write, buffer,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002327 lenp, ppos, NULL, NULL);
2328 if (r || !write)
2329 return r;
2330
2331 new_pid = find_get_pid(tmp);
2332 if (!new_pid)
2333 return -ESRCH;
2334
2335 put_pid(xchg(&cad_pid, new_pid));
2336 return 0;
2337}
2338
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002339/**
2340 * proc_do_large_bitmap - read/write from/to a large bitmap
2341 * @table: the sysctl table
2342 * @write: %TRUE if this is a write to the sysctl file
2343 * @buffer: the user buffer
2344 * @lenp: the size of the user buffer
2345 * @ppos: file position
2346 *
2347 * The bitmap is stored at table->data and the bitmap length (in bits)
2348 * in table->maxlen.
2349 *
2350 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2351 * large bitmaps may be represented in a compact manner. Writing into
2352 * the file will clear the bitmap then update it with the given input.
2353 *
2354 * Returns 0 on success.
2355 */
2356int proc_do_large_bitmap(struct ctl_table *table, int write,
2357 void __user *buffer, size_t *lenp, loff_t *ppos)
2358{
2359 int err = 0;
2360 bool first = 1;
2361 size_t left = *lenp;
2362 unsigned long bitmap_len = table->maxlen;
2363 unsigned long *bitmap = (unsigned long *) table->data;
2364 unsigned long *tmp_bitmap = NULL;
2365 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2366
2367 if (!bitmap_len || !left || (*ppos && !write)) {
2368 *lenp = 0;
2369 return 0;
2370 }
2371
2372 if (write) {
2373 unsigned long page = 0;
2374 char *kbuf;
2375
2376 if (left > PAGE_SIZE - 1)
2377 left = PAGE_SIZE - 1;
2378
2379 page = __get_free_page(GFP_TEMPORARY);
2380 kbuf = (char *) page;
2381 if (!kbuf)
2382 return -ENOMEM;
2383 if (copy_from_user(kbuf, buffer, left)) {
2384 free_page(page);
2385 return -EFAULT;
2386 }
2387 kbuf[left] = 0;
2388
2389 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2390 GFP_KERNEL);
2391 if (!tmp_bitmap) {
2392 free_page(page);
2393 return -ENOMEM;
2394 }
2395 proc_skip_char(&kbuf, &left, '\n');
2396 while (!err && left) {
2397 unsigned long val_a, val_b;
2398 bool neg;
2399
2400 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2401 sizeof(tr_a), &c);
2402 if (err)
2403 break;
2404 if (val_a >= bitmap_len || neg) {
2405 err = -EINVAL;
2406 break;
2407 }
2408
2409 val_b = val_a;
2410 if (left) {
2411 kbuf++;
2412 left--;
2413 }
2414
2415 if (c == '-') {
2416 err = proc_get_long(&kbuf, &left, &val_b,
2417 &neg, tr_b, sizeof(tr_b),
2418 &c);
2419 if (err)
2420 break;
2421 if (val_b >= bitmap_len || neg ||
2422 val_a > val_b) {
2423 err = -EINVAL;
2424 break;
2425 }
2426 if (left) {
2427 kbuf++;
2428 left--;
2429 }
2430 }
2431
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002432 bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002433 first = 0;
2434 proc_skip_char(&kbuf, &left, '\n');
2435 }
2436 free_page(page);
2437 } else {
2438 unsigned long bit_a, bit_b = 0;
2439
2440 while (left) {
2441 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2442 if (bit_a >= bitmap_len)
2443 break;
2444 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2445 bit_a + 1) - 1;
2446
2447 if (!first) {
2448 err = proc_put_char(&buffer, &left, ',');
2449 if (err)
2450 break;
2451 }
2452 err = proc_put_long(&buffer, &left, bit_a, false);
2453 if (err)
2454 break;
2455 if (bit_a != bit_b) {
2456 err = proc_put_char(&buffer, &left, '-');
2457 if (err)
2458 break;
2459 err = proc_put_long(&buffer, &left, bit_b, false);
2460 if (err)
2461 break;
2462 }
2463
2464 first = 0; bit_b++;
2465 }
2466 if (!err)
2467 err = proc_put_char(&buffer, &left, '\n');
2468 }
2469
2470 if (!err) {
2471 if (write) {
2472 if (*ppos)
2473 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2474 else
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002475 bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002476 }
2477 kfree(tmp_bitmap);
2478 *lenp -= left;
2479 *ppos += *lenp;
2480 return 0;
2481 } else {
2482 kfree(tmp_bitmap);
2483 return err;
2484 }
2485}
2486
Jovi Zhang55610502011-01-12 17:00:45 -08002487#else /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002488
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002489int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002490 void __user *buffer, size_t *lenp, loff_t *ppos)
2491{
2492 return -ENOSYS;
2493}
2494
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002495int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002496 void __user *buffer, size_t *lenp, loff_t *ppos)
2497{
2498 return -ENOSYS;
2499}
2500
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002501int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002502 void __user *buffer, size_t *lenp, loff_t *ppos)
2503{
2504 return -ENOSYS;
2505}
2506
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002507int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002508 void __user *buffer, size_t *lenp, loff_t *ppos)
2509{
2510 return -ENOSYS;
2511}
2512
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002513int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002514 void __user *buffer, size_t *lenp, loff_t *ppos)
2515{
2516 return -ENOSYS;
2517}
2518
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002519int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002520 void __user *buffer, size_t *lenp, loff_t *ppos)
2521{
2522 return -ENOSYS;
2523}
2524
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002525int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002526 void __user *buffer, size_t *lenp, loff_t *ppos)
2527{
2528 return -ENOSYS;
2529}
2530
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002531int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002532 void __user *buffer,
2533 size_t *lenp, loff_t *ppos)
2534{
2535 return -ENOSYS;
2536}
2537
2538
Jovi Zhang55610502011-01-12 17:00:45 -08002539#endif /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002540
Linus Torvalds1da177e2005-04-16 15:20:36 -07002541/*
2542 * No sense putting this after each symbol definition, twice,
2543 * exception granted :-)
2544 */
2545EXPORT_SYMBOL(proc_dointvec);
2546EXPORT_SYMBOL(proc_dointvec_jiffies);
2547EXPORT_SYMBOL(proc_dointvec_minmax);
2548EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2549EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2550EXPORT_SYMBOL(proc_dostring);
2551EXPORT_SYMBOL(proc_doulongvec_minmax);
2552EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);