blob: 1475d2545b7e8ba6ef789ad6276ab5191b1b741f [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * sysctl.c: General linux system control interface
3 *
4 * Begun 24 March 1995, Stephen Tweedie
5 * Added /proc support, Dec 1995
6 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
7 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
8 * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
9 * Dynamic registration fixes, Stephen Tweedie.
10 * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
11 * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
12 * Horn.
13 * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
14 * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
15 * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
16 * Wendling.
17 * The list_for_each() macro wasn't appropriate for the sysctl loop.
18 * Removed it and replaced it with older style, 03/23/00, Bill Wendling
19 */
20
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <linux/module.h>
Christoph Hellwige2e40f22015-02-22 08:58:50 -080022#include <linux/aio.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include <linux/mm.h>
24#include <linux/swap.h>
25#include <linux/slab.h>
26#include <linux/sysctl.h>
Akinobu Mita5a04cca2012-03-28 14:42:50 -070027#include <linux/bitmap.h>
Dave Youngd33ed522010-03-10 15:23:59 -080028#include <linux/signal.h>
Dan Rosenberg455cd5a2011-01-12 16:59:41 -080029#include <linux/printk.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#include <linux/proc_fs.h>
Andrew Morgan72c2d582007-10-18 03:05:59 -070031#include <linux/security.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#include <linux/ctype.h>
Vegard Nossumdfec0722008-04-04 00:51:41 +020033#include <linux/kmemcheck.h>
Steven Rostedtfd4b6162012-07-30 14:42:48 -070034#include <linux/kmemleak.h>
Adrian Bunk62239ac2007-07-17 04:03:45 -070035#include <linux/fs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070036#include <linux/init.h>
37#include <linux/kernel.h>
Kay Sievers0296b222005-11-11 05:33:52 +010038#include <linux/kobject.h>
Arnaldo Carvalho de Melo20380732005-08-16 02:18:02 -030039#include <linux/net.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070040#include <linux/sysrq.h>
41#include <linux/highuid.h>
42#include <linux/writeback.h>
Ingo Molnar3fff4c42009-09-22 16:18:09 +020043#include <linux/ratelimit.h>
Mel Gorman76ab0f52010-05-24 14:32:28 -070044#include <linux/compaction.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#include <linux/hugetlb.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070046#include <linux/initrd.h>
David Howells0b77f5b2008-04-29 01:01:32 -070047#include <linux/key.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070048#include <linux/times.h>
49#include <linux/limits.h>
50#include <linux/dcache.h>
Alexey Dobriyan6e006702010-01-20 22:27:56 +020051#include <linux/dnotify.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070052#include <linux/syscalls.h>
Adrian Bunkc748e132008-07-23 21:27:03 -070053#include <linux/vmstat.h>
Pavel Machekc255d842006-02-20 18:27:58 -080054#include <linux/nfs_fs.h>
55#include <linux/acpi.h>
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -070056#include <linux/reboot.h>
Steven Rostedtb0fc4942008-05-12 21:20:43 +020057#include <linux/ftrace.h>
Ingo Molnarcdd6c482009-09-21 12:02:48 +020058#include <linux/perf_event.h>
Masami Hiramatsub2be84d2010-02-25 08:34:15 -050059#include <linux/kprobes.h>
Jens Axboeb492e952010-05-19 21:03:16 +020060#include <linux/pipe_fs_i.h>
David Rientjes8e4228e2010-08-09 17:18:56 -070061#include <linux/oom.h>
Eric Paris17f60a72011-04-01 17:07:50 -040062#include <linux/kmod.h>
Dan Ballard73efc032011-10-31 17:11:20 -070063#include <linux/capability.h>
Al Viro40401532012-02-13 03:58:52 +000064#include <linux/binfmts.h>
Clark Williamscf4aebc22013-02-07 09:46:59 -060065#include <linux/sched/sysctl.h>
Kees Cook79847542014-01-23 15:55:59 -080066#include <linux/kexec.h>
Alexei Starovoitov1be7f752015-10-07 22:23:21 -070067#include <linux/bpf.h>
Eric W. Biedermand2921682016-09-28 00:27:17 -050068#include <linux/mount.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070069
70#include <asm/uaccess.h>
71#include <asm/processor.h>
72
Andi Kleen29cbc782006-09-30 01:47:55 +020073#ifdef CONFIG_X86
74#include <asm/nmi.h>
Chuck Ebbert0741f4d2006-12-07 02:14:11 +010075#include <asm/stacktrace.h>
Ingo Molnar6e7c4022008-01-30 13:30:05 +010076#include <asm/io.h>
Andi Kleen29cbc782006-09-30 01:47:55 +020077#endif
David Howellsd550bbd2012-03-28 18:30:03 +010078#ifdef CONFIG_SPARC
79#include <asm/setup.h>
80#endif
Dave Youngc55b7c32010-03-10 15:24:08 -080081#ifdef CONFIG_BSD_PROCESS_ACCT
82#include <linux/acct.h>
83#endif
Dave Young4f0e0562010-03-10 15:24:09 -080084#ifdef CONFIG_RT_MUTEXES
85#include <linux/rtmutex.h>
86#endif
Dave Young2edf5e42010-03-10 15:24:10 -080087#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
88#include <linux/lockdep.h>
89#endif
Dave Young15485a42010-03-10 15:24:07 -080090#ifdef CONFIG_CHR_DEV_SG
91#include <scsi/sg.h>
92#endif
Andi Kleen29cbc782006-09-30 01:47:55 +020093
Don Zickus58687ac2010-05-07 17:11:44 -040094#ifdef CONFIG_LOCKUP_DETECTOR
Don Zickus504d7cf2010-02-12 17:19:19 -050095#include <linux/nmi.h>
96#endif
97
Linus Torvalds1da177e2005-04-16 15:20:36 -070098#if defined(CONFIG_SYSCTL)
99
100/* External variables not in a header file. */
Alan Coxd6e71142005-06-23 00:09:43 -0700101extern int suid_dumpable;
Alex Kelly046d6622012-10-04 17:15:23 -0700102#ifdef CONFIG_COREDUMP
103extern int core_uses_pid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104extern char core_pattern[];
Neil Hormana2939802009-09-23 15:56:56 -0700105extern unsigned int core_pipe_limit;
Alex Kelly046d6622012-10-04 17:15:23 -0700106#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107extern int pid_max;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108extern int pid_max_min, pid_max_max;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800109extern int percpu_pagelist_fraction;
Arjan van de Ven97455122008-01-25 21:08:34 +0100110extern int latencytop_enabled;
Alexey Dobriyan9b80a182016-09-02 00:38:52 +0300111extern unsigned int sysctl_nr_open_min, sysctl_nr_open_max;
Paul Mundtdd8632a2009-01-08 12:04:47 +0000112#ifndef CONFIG_MMU
113extern int sysctl_nr_trim_pages;
114#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700116/* Constants used for minimum and maximum */
Don Zickus2508ce12010-05-07 17:11:46 -0400117#ifdef CONFIG_LOCKUP_DETECTOR
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700118static int sixty = 60;
119#endif
120
Aaron Tomlin270750db2014-01-20 17:34:13 +0000121static int __maybe_unused neg_one = -1;
122
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700123static int zero;
Linus Torvaldscd5f9a42009-04-06 13:38:46 -0700124static int __maybe_unused one = 1;
125static int __maybe_unused two = 2;
Dave Hansen5509a5d2014-04-03 14:48:19 -0700126static int __maybe_unused four = 4;
Sven Wegenerfc3501d2009-02-11 13:04:23 -0800127static unsigned long one_ul = 1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700128static int one_hundred = 100;
Johannes Weiner795ae7a2016-03-17 14:19:14 -0700129static int one_thousand = 1000;
Dave Youngaf913222009-09-22 16:43:33 -0700130#ifdef CONFIG_PRINTK
131static int ten_thousand = 10000;
132#endif
Arnaldo Carvalho de Meloc5dfd782016-04-21 12:28:50 -0300133#ifdef CONFIG_PERF_EVENTS
134static int six_hundred_forty_kb = 640 * 1024;
135#endif
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700136
Andrea Righi9e4a5bd2009-04-30 15:08:57 -0700137/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
138static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
139
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
141static int maxolduid = 65535;
142static int minolduid;
143
144static int ngroups_max = NGROUPS_MAX;
Dan Ballard73efc032011-10-31 17:11:20 -0700145static const int cap_last_cap = CAP_LAST_CAP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146
Liu Hua80df2842014-04-07 15:38:57 -0700147/*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */
148#ifdef CONFIG_DETECT_HUNG_TASK
149static unsigned long hung_task_timeout_max = (LONG_MAX/HZ);
150#endif
151
Dave Youngd14f1722010-02-25 20:28:57 -0500152#ifdef CONFIG_INOTIFY_USER
153#include <linux/inotify.h>
154#endif
David S. Miller72c57ed2008-09-11 23:29:54 -0700155#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156#endif
157
158#ifdef __hppa__
159extern int pwrsw_enabled;
Vineet Guptabf14e3b2013-01-18 15:12:24 +0530160#endif
161
162#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163extern int unaligned_enabled;
164#endif
165
Jes Sorensend2b176e2006-02-28 09:42:23 -0800166#ifdef CONFIG_IA64
Doug Chapman88fc2412009-01-15 10:38:56 -0800167extern int unaligned_dump_stack;
Jes Sorensend2b176e2006-02-28 09:42:23 -0800168#endif
169
Vineet Guptab6fca722013-01-09 20:06:28 +0530170#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
171extern int no_unaligned_warning;
172#endif
173
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700174#ifdef CONFIG_PROC_SYSCTL
Kees Cookf4aacea2014-06-06 14:37:19 -0700175
176#define SYSCTL_WRITES_LEGACY -1
177#define SYSCTL_WRITES_WARN 0
178#define SYSCTL_WRITES_STRICT 1
179
Kees Cook41662f52016-01-20 15:00:45 -0800180static int sysctl_writes_strict = SYSCTL_WRITES_STRICT;
Kees Cookf4aacea2014-06-06 14:37:19 -0700181
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700182static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700183 void __user *buffer, size_t *lenp, loff_t *ppos);
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700184static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800185 void __user *buffer, size_t *lenp, loff_t *ppos);
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700186#endif
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700187
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700188#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -0700189static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700190 void __user *buffer, size_t *lenp, loff_t *ppos);
191#endif
192
Kees Cook54b50192012-07-30 14:39:18 -0700193static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
194 void __user *buffer, size_t *lenp, loff_t *ppos);
Alex Kelly046d6622012-10-04 17:15:23 -0700195#ifdef CONFIG_COREDUMP
Kees Cook54b50192012-07-30 14:39:18 -0700196static int proc_dostring_coredump(struct ctl_table *table, int write,
197 void __user *buffer, size_t *lenp, loff_t *ppos);
Alex Kelly046d6622012-10-04 17:15:23 -0700198#endif
Kees Cook54b50192012-07-30 14:39:18 -0700199
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700200#ifdef CONFIG_MAGIC_SYSRQ
Andy Whitcroft8c6a98b2011-01-24 09:31:38 -0800201/* Note: sysrq code uses it's own private copy */
Ben Hutchings8eaede42013-10-07 01:05:46 +0100202static int __sysrq_enabled = CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE;
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700203
Joe Perches6f8fd1d2014-06-06 14:38:08 -0700204static int sysrq_sysctl_handler(struct ctl_table *table, int write,
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700205 void __user *buffer, size_t *lenp,
206 loff_t *ppos)
207{
208 int error;
209
210 error = proc_dointvec(table, write, buffer, lenp, ppos);
211 if (error)
212 return error;
213
214 if (write)
215 sysrq_toggle_support(__sysrq_enabled);
216
217 return 0;
218}
219
220#endif
221
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700222static struct ctl_table kern_table[];
223static struct ctl_table vm_table[];
224static struct ctl_table fs_table[];
225static struct ctl_table debug_table[];
226static struct ctl_table dev_table[];
227extern struct ctl_table random_table[];
Davide Libenzi7ef99642008-12-01 13:13:55 -0800228#ifdef CONFIG_EPOLL
229extern struct ctl_table epoll_table[];
230#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231
232#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
233int sysctl_legacy_va_layout;
234#endif
235
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236/* The default sysctl tables: */
237
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -0800238static struct ctl_table sysctl_base_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240 .procname = "kernel",
241 .mode = 0555,
242 .child = kern_table,
243 },
244 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245 .procname = "vm",
246 .mode = 0555,
247 .child = vm_table,
248 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250 .procname = "fs",
251 .mode = 0555,
252 .child = fs_table,
253 },
254 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255 .procname = "debug",
256 .mode = 0555,
257 .child = debug_table,
258 },
259 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260 .procname = "dev",
261 .mode = 0555,
262 .child = dev_table,
263 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -0700264 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265};
266
Ingo Molnar77e54a12007-07-09 18:52:00 +0200267#ifdef CONFIG_SCHED_DEBUG
Eric Dumazet73c4efd2007-12-18 15:21:13 +0100268static int min_sched_granularity_ns = 100000; /* 100 usecs */
269static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
270static int min_wakeup_granularity_ns; /* 0 usecs */
271static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
Peter Zijlstracbee9f82012-10-25 14:16:43 +0200272#ifdef CONFIG_SMP
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100273static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
274static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
Peter Zijlstracbee9f82012-10-25 14:16:43 +0200275#endif /* CONFIG_SMP */
276#endif /* CONFIG_SCHED_DEBUG */
Ingo Molnar77e54a12007-07-09 18:52:00 +0200277
Mel Gorman5e771902010-05-24 14:32:31 -0700278#ifdef CONFIG_COMPACTION
279static int min_extfrag_threshold;
280static int max_extfrag_threshold = 1000;
281#endif
282
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700283static struct ctl_table kern_table[] = {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200284 {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200285 .procname = "sched_child_runs_first",
286 .data = &sysctl_sched_child_runs_first,
287 .maxlen = sizeof(unsigned int),
288 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800289 .proc_handler = proc_dointvec,
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200290 },
Ingo Molnar77e54a12007-07-09 18:52:00 +0200291#ifdef CONFIG_SCHED_DEBUG
292 {
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100293 .procname = "sched_min_granularity_ns",
294 .data = &sysctl_sched_min_granularity,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200295 .maxlen = sizeof(unsigned int),
296 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800297 .proc_handler = sched_proc_update_handler,
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100298 .extra1 = &min_sched_granularity_ns,
299 .extra2 = &max_sched_granularity_ns,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200300 },
301 {
Peter Zijlstra21805082007-08-25 18:41:53 +0200302 .procname = "sched_latency_ns",
303 .data = &sysctl_sched_latency,
304 .maxlen = sizeof(unsigned int),
305 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800306 .proc_handler = sched_proc_update_handler,
Peter Zijlstra21805082007-08-25 18:41:53 +0200307 .extra1 = &min_sched_granularity_ns,
308 .extra2 = &max_sched_granularity_ns,
309 },
310 {
Ingo Molnar77e54a12007-07-09 18:52:00 +0200311 .procname = "sched_wakeup_granularity_ns",
312 .data = &sysctl_sched_wakeup_granularity,
313 .maxlen = sizeof(unsigned int),
314 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800315 .proc_handler = sched_proc_update_handler,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200316 .extra1 = &min_wakeup_granularity_ns,
317 .extra2 = &max_wakeup_granularity_ns,
318 },
Peter Zijlstracbee9f82012-10-25 14:16:43 +0200319#ifdef CONFIG_SMP
Ingo Molnar77e54a12007-07-09 18:52:00 +0200320 {
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100321 .procname = "sched_tunable_scaling",
322 .data = &sysctl_sched_tunable_scaling,
323 .maxlen = sizeof(enum sched_tunable_scaling),
324 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800325 .proc_handler = sched_proc_update_handler,
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100326 .extra1 = &min_sched_tunable_scaling,
327 .extra2 = &max_sched_tunable_scaling,
Peter Zijlstra2398f2c2008-06-27 13:41:35 +0200328 },
329 {
Namhyung Kimd00535d2012-08-16 11:15:30 +0900330 .procname = "sched_migration_cost_ns",
Ingo Molnarda84d962007-10-15 17:00:18 +0200331 .data = &sysctl_sched_migration_cost,
332 .maxlen = sizeof(unsigned int),
333 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800334 .proc_handler = proc_dointvec,
Ingo Molnarda84d962007-10-15 17:00:18 +0200335 },
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100336 {
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100337 .procname = "sched_nr_migrate",
338 .data = &sysctl_sched_nr_migrate,
339 .maxlen = sizeof(unsigned int),
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100340 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800341 .proc_handler = proc_dointvec,
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100342 },
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530343 {
Namhyung Kimd00535d2012-08-16 11:15:30 +0900344 .procname = "sched_time_avg_ms",
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200345 .data = &sysctl_sched_time_avg,
346 .maxlen = sizeof(unsigned int),
347 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800348 .proc_handler = proc_dointvec,
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200349 },
Mel Gormancb251762016-02-05 09:08:36 +0000350#ifdef CONFIG_SCHEDSTATS
351 {
352 .procname = "sched_schedstats",
353 .data = NULL,
354 .maxlen = sizeof(unsigned int),
355 .mode = 0644,
356 .proc_handler = sysctl_schedstats,
357 .extra1 = &zero,
358 .extra2 = &one,
359 },
360#endif /* CONFIG_SCHEDSTATS */
Peter Zijlstracbee9f82012-10-25 14:16:43 +0200361#endif /* CONFIG_SMP */
362#ifdef CONFIG_NUMA_BALANCING
363 {
Peter Zijlstra4b96a292012-10-25 14:16:47 +0200364 .procname = "numa_balancing_scan_delay_ms",
365 .data = &sysctl_numa_balancing_scan_delay,
366 .maxlen = sizeof(unsigned int),
367 .mode = 0644,
368 .proc_handler = proc_dointvec,
369 },
370 {
Peter Zijlstracbee9f82012-10-25 14:16:43 +0200371 .procname = "numa_balancing_scan_period_min_ms",
372 .data = &sysctl_numa_balancing_scan_period_min,
373 .maxlen = sizeof(unsigned int),
374 .mode = 0644,
375 .proc_handler = proc_dointvec,
376 },
377 {
378 .procname = "numa_balancing_scan_period_max_ms",
379 .data = &sysctl_numa_balancing_scan_period_max,
380 .maxlen = sizeof(unsigned int),
381 .mode = 0644,
382 .proc_handler = proc_dointvec,
383 },
Peter Zijlstra6e5fb222012-10-25 14:16:45 +0200384 {
385 .procname = "numa_balancing_scan_size_mb",
386 .data = &sysctl_numa_balancing_scan_size,
387 .maxlen = sizeof(unsigned int),
388 .mode = 0644,
Kirill Tkhai64192652014-10-16 14:39:37 +0400389 .proc_handler = proc_dointvec_minmax,
390 .extra1 = &one,
Peter Zijlstra6e5fb222012-10-25 14:16:45 +0200391 },
Mel Gorman3a7053b2013-10-07 11:29:00 +0100392 {
Andi Kleen54a43d52014-01-23 15:53:13 -0800393 .procname = "numa_balancing",
394 .data = NULL, /* filled in by handler */
395 .maxlen = sizeof(unsigned int),
396 .mode = 0644,
397 .proc_handler = sysctl_numa_balancing,
398 .extra1 = &zero,
399 .extra2 = &one,
400 },
Peter Zijlstracbee9f82012-10-25 14:16:43 +0200401#endif /* CONFIG_NUMA_BALANCING */
402#endif /* CONFIG_SCHED_DEBUG */
Ingo Molnar1799e352007-09-19 23:34:46 +0200403 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100404 .procname = "sched_rt_period_us",
405 .data = &sysctl_sched_rt_period,
406 .maxlen = sizeof(unsigned int),
407 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800408 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100409 },
410 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100411 .procname = "sched_rt_runtime_us",
412 .data = &sysctl_sched_rt_runtime,
413 .maxlen = sizeof(int),
414 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800415 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100416 },
Clark Williamsce0dbbb2013-02-07 09:47:04 -0600417 {
418 .procname = "sched_rr_timeslice_ms",
419 .data = &sched_rr_timeslice,
420 .maxlen = sizeof(int),
421 .mode = 0644,
422 .proc_handler = sched_rr_handler,
423 },
Mike Galbraith5091faa2010-11-30 14:18:03 +0100424#ifdef CONFIG_SCHED_AUTOGROUP
425 {
426 .procname = "sched_autogroup_enabled",
427 .data = &sysctl_sched_autogroup_enabled,
428 .maxlen = sizeof(unsigned int),
429 .mode = 0644,
Yong Zhang1747b212011-02-20 15:08:12 +0800430 .proc_handler = proc_dointvec_minmax,
Mike Galbraith5091faa2010-11-30 14:18:03 +0100431 .extra1 = &zero,
432 .extra2 = &one,
433 },
434#endif
Paul Turnerec12cb72011-07-21 09:43:30 -0700435#ifdef CONFIG_CFS_BANDWIDTH
436 {
437 .procname = "sched_cfs_bandwidth_slice_us",
438 .data = &sysctl_sched_cfs_bandwidth_slice,
439 .maxlen = sizeof(unsigned int),
440 .mode = 0644,
441 .proc_handler = proc_dointvec_minmax,
442 .extra1 = &one,
443 },
444#endif
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700445#ifdef CONFIG_PROVE_LOCKING
446 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700447 .procname = "prove_locking",
448 .data = &prove_locking,
449 .maxlen = sizeof(int),
450 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800451 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700452 },
453#endif
454#ifdef CONFIG_LOCK_STAT
455 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700456 .procname = "lock_stat",
457 .data = &lock_stat,
458 .maxlen = sizeof(int),
459 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800460 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700461 },
462#endif
Ingo Molnar77e54a12007-07-09 18:52:00 +0200463 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700464 .procname = "panic",
465 .data = &panic_timeout,
466 .maxlen = sizeof(int),
467 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800468 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700469 },
Alex Kelly046d6622012-10-04 17:15:23 -0700470#ifdef CONFIG_COREDUMP
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700472 .procname = "core_uses_pid",
473 .data = &core_uses_pid,
474 .maxlen = sizeof(int),
475 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800476 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700477 },
478 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700479 .procname = "core_pattern",
480 .data = core_pattern,
Dan Aloni71ce92f2007-05-16 22:11:16 -0700481 .maxlen = CORENAME_MAX_SIZE,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700482 .mode = 0644,
Kees Cook54b50192012-07-30 14:39:18 -0700483 .proc_handler = proc_dostring_coredump,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700484 },
Neil Hormana2939802009-09-23 15:56:56 -0700485 {
Neil Hormana2939802009-09-23 15:56:56 -0700486 .procname = "core_pipe_limit",
487 .data = &core_pipe_limit,
488 .maxlen = sizeof(unsigned int),
489 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800490 .proc_handler = proc_dointvec,
Neil Hormana2939802009-09-23 15:56:56 -0700491 },
Alex Kelly046d6622012-10-04 17:15:23 -0700492#endif
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800493#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700495 .procname = "tainted",
Andi Kleen25ddbb12008-10-15 22:01:41 -0700496 .maxlen = sizeof(long),
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800497 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800498 .proc_handler = proc_taint,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700499 },
Kees Cookf4aacea2014-06-06 14:37:19 -0700500 {
501 .procname = "sysctl_writes_strict",
502 .data = &sysctl_writes_strict,
503 .maxlen = sizeof(int),
504 .mode = 0644,
505 .proc_handler = proc_dointvec_minmax,
506 .extra1 = &neg_one,
507 .extra2 = &one,
508 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800509#endif
Arjan van de Ven97455122008-01-25 21:08:34 +0100510#ifdef CONFIG_LATENCYTOP
511 {
512 .procname = "latencytop",
513 .data = &latencytop_enabled,
514 .maxlen = sizeof(int),
515 .mode = 0644,
Mel Gormancb251762016-02-05 09:08:36 +0000516 .proc_handler = sysctl_latencytop,
Arjan van de Ven97455122008-01-25 21:08:34 +0100517 },
518#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700519#ifdef CONFIG_BLK_DEV_INITRD
520 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700521 .procname = "real-root-dev",
522 .data = &real_root_dev,
523 .maxlen = sizeof(int),
524 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800525 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700526 },
527#endif
Ingo Molnar45807a12007-07-15 23:40:10 -0700528 {
Ingo Molnar45807a12007-07-15 23:40:10 -0700529 .procname = "print-fatal-signals",
530 .data = &print_fatal_signals,
531 .maxlen = sizeof(int),
532 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800533 .proc_handler = proc_dointvec,
Ingo Molnar45807a12007-07-15 23:40:10 -0700534 },
David S. Miller72c57ed2008-09-11 23:29:54 -0700535#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700536 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700537 .procname = "reboot-cmd",
538 .data = reboot_command,
539 .maxlen = 256,
540 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800541 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542 },
543 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544 .procname = "stop-a",
545 .data = &stop_a_enabled,
546 .maxlen = sizeof (int),
547 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800548 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549 },
550 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551 .procname = "scons-poweroff",
552 .data = &scons_pwroff,
553 .maxlen = sizeof (int),
554 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800555 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700556 },
557#endif
David S. Miller08714202008-11-16 23:49:24 -0800558#ifdef CONFIG_SPARC64
559 {
David S. Miller08714202008-11-16 23:49:24 -0800560 .procname = "tsb-ratio",
561 .data = &sysctl_tsb_ratio,
562 .maxlen = sizeof (int),
563 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800564 .proc_handler = proc_dointvec,
David S. Miller08714202008-11-16 23:49:24 -0800565 },
566#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567#ifdef __hppa__
568 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569 .procname = "soft-power",
570 .data = &pwrsw_enabled,
571 .maxlen = sizeof (int),
572 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800573 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700574 },
Vineet Guptabf14e3b2013-01-18 15:12:24 +0530575#endif
576#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
Linus Torvalds1da177e2005-04-16 15:20:36 -0700577 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700578 .procname = "unaligned-trap",
579 .data = &unaligned_enabled,
580 .maxlen = sizeof (int),
581 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800582 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700583 },
584#endif
585 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586 .procname = "ctrl-alt-del",
587 .data = &C_A_D,
588 .maxlen = sizeof(int),
589 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800590 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591 },
Steven Rostedt606576c2008-10-06 19:06:12 -0400592#ifdef CONFIG_FUNCTION_TRACER
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200593 {
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200594 .procname = "ftrace_enabled",
595 .data = &ftrace_enabled,
596 .maxlen = sizeof(int),
597 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800598 .proc_handler = ftrace_enable_sysctl,
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200599 },
600#endif
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500601#ifdef CONFIG_STACK_TRACER
602 {
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500603 .procname = "stack_tracer_enabled",
604 .data = &stack_tracer_enabled,
605 .maxlen = sizeof(int),
606 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800607 .proc_handler = stack_trace_sysctl,
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500608 },
609#endif
Steven Rostedt944ac422008-10-23 19:26:08 -0400610#ifdef CONFIG_TRACING
611 {
Peter Zijlstra3299b4d2008-11-04 11:58:21 +0100612 .procname = "ftrace_dump_on_oops",
Steven Rostedt944ac422008-10-23 19:26:08 -0400613 .data = &ftrace_dump_on_oops,
614 .maxlen = sizeof(int),
615 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800616 .proc_handler = proc_dointvec,
Steven Rostedt944ac422008-10-23 19:26:08 -0400617 },
Steven Rostedt (Red Hat)de7edd32013-06-14 16:21:43 -0400618 {
619 .procname = "traceoff_on_warning",
620 .data = &__disable_trace_on_warning,
621 .maxlen = sizeof(__disable_trace_on_warning),
622 .mode = 0644,
623 .proc_handler = proc_dointvec,
624 },
Steven Rostedt (Red Hat)0daa23022014-12-12 22:27:10 -0500625 {
626 .procname = "tracepoint_printk",
627 .data = &tracepoint_printk,
628 .maxlen = sizeof(tracepoint_printk),
629 .mode = 0644,
630 .proc_handler = proc_dointvec,
631 },
Steven Rostedt944ac422008-10-23 19:26:08 -0400632#endif
Dave Young2965faa2015-09-09 15:38:55 -0700633#ifdef CONFIG_KEXEC_CORE
Kees Cook79847542014-01-23 15:55:59 -0800634 {
635 .procname = "kexec_load_disabled",
636 .data = &kexec_load_disabled,
637 .maxlen = sizeof(int),
638 .mode = 0644,
639 /* only handle a transition from default "0" to "1" */
640 .proc_handler = proc_dointvec_minmax,
641 .extra1 = &one,
642 .extra2 = &one,
643 },
644#endif
Johannes Berga1ef5ad2008-07-08 19:00:17 +0200645#ifdef CONFIG_MODULES
Linus Torvalds1da177e2005-04-16 15:20:36 -0700646 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700647 .procname = "modprobe",
648 .data = &modprobe_path,
649 .maxlen = KMOD_PATH_LEN,
650 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800651 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700652 },
Kees Cook3d433212009-04-02 15:49:29 -0700653 {
Kees Cook3d433212009-04-02 15:49:29 -0700654 .procname = "modules_disabled",
655 .data = &modules_disabled,
656 .maxlen = sizeof(int),
657 .mode = 0644,
658 /* only handle a transition from default "0" to "1" */
Eric W. Biederman6d456112009-11-16 03:11:48 -0800659 .proc_handler = proc_dointvec_minmax,
Kees Cook3d433212009-04-02 15:49:29 -0700660 .extra1 = &one,
661 .extra2 = &one,
662 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700663#endif
Michael Marineau86d56132014-04-10 14:09:31 -0700664#ifdef CONFIG_UEVENT_HELPER
Linus Torvalds1da177e2005-04-16 15:20:36 -0700665 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700666 .procname = "hotplug",
Kay Sievers312c0042005-11-16 09:00:00 +0100667 .data = &uevent_helper,
668 .maxlen = UEVENT_HELPER_PATH_LEN,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800670 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700671 },
Michael Marineau86d56132014-04-10 14:09:31 -0700672#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700673#ifdef CONFIG_CHR_DEV_SG
674 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675 .procname = "sg-big-buff",
676 .data = &sg_big_buff,
677 .maxlen = sizeof (int),
678 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800679 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700680 },
681#endif
682#ifdef CONFIG_BSD_PROCESS_ACCT
683 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700684 .procname = "acct",
685 .data = &acct_parm,
686 .maxlen = 3*sizeof(int),
687 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800688 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700689 },
690#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700691#ifdef CONFIG_MAGIC_SYSRQ
692 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700693 .procname = "sysrq",
Ingo Molnar5d6f6472006-12-13 00:34:36 -0800694 .data = &__sysrq_enabled,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700695 .maxlen = sizeof (int),
696 .mode = 0644,
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700697 .proc_handler = sysrq_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700698 },
699#endif
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700700#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700701 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702 .procname = "cad_pid",
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700703 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700704 .maxlen = sizeof (int),
705 .mode = 0600,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800706 .proc_handler = proc_do_cad_pid,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700707 },
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700708#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700709 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700710 .procname = "threads-max",
Heinrich Schuchardt16db3d32015-04-16 12:47:50 -0700711 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700712 .maxlen = sizeof(int),
713 .mode = 0644,
Heinrich Schuchardt16db3d32015-04-16 12:47:50 -0700714 .proc_handler = sysctl_max_threads,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700715 },
716 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700717 .procname = "random",
718 .mode = 0555,
719 .child = random_table,
720 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700721 {
Eric Paris17f60a72011-04-01 17:07:50 -0400722 .procname = "usermodehelper",
723 .mode = 0555,
724 .child = usermodehelper_table,
725 },
726 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700727 .procname = "overflowuid",
728 .data = &overflowuid,
729 .maxlen = sizeof(int),
730 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800731 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700732 .extra1 = &minolduid,
733 .extra2 = &maxolduid,
734 },
735 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700736 .procname = "overflowgid",
737 .data = &overflowgid,
738 .maxlen = sizeof(int),
739 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800740 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700741 .extra1 = &minolduid,
742 .extra2 = &maxolduid,
743 },
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -0800744#ifdef CONFIG_S390
Linus Torvalds1da177e2005-04-16 15:20:36 -0700745#ifdef CONFIG_MATHEMU
746 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700747 .procname = "ieee_emulation_warnings",
748 .data = &sysctl_ieee_emulation_warnings,
749 .maxlen = sizeof(int),
750 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800751 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700752 },
753#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700754 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700755 .procname = "userprocess_debug",
Heiko Carstensab3c68e2010-05-17 10:00:21 +0200756 .data = &show_unhandled_signals,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700757 .maxlen = sizeof(int),
758 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800759 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700760 },
761#endif
762 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700763 .procname = "pid_max",
764 .data = &pid_max,
765 .maxlen = sizeof (int),
766 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800767 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700768 .extra1 = &pid_max_min,
769 .extra2 = &pid_max_max,
770 },
771 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700772 .procname = "panic_on_oops",
773 .data = &panic_on_oops,
774 .maxlen = sizeof(int),
775 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800776 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700777 },
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800778#if defined CONFIG_PRINTK
779 {
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800780 .procname = "printk",
781 .data = &console_loglevel,
782 .maxlen = 4*sizeof(int),
783 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800784 .proc_handler = proc_dointvec,
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800785 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700786 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700787 .procname = "printk_ratelimit",
Dave Young717115e2008-07-25 01:45:58 -0700788 .data = &printk_ratelimit_state.interval,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700789 .maxlen = sizeof(int),
790 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800791 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700792 },
793 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700794 .procname = "printk_ratelimit_burst",
Dave Young717115e2008-07-25 01:45:58 -0700795 .data = &printk_ratelimit_state.burst,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700796 .maxlen = sizeof(int),
797 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800798 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700799 },
Dave Youngaf913222009-09-22 16:43:33 -0700800 {
Dave Youngaf913222009-09-22 16:43:33 -0700801 .procname = "printk_delay",
802 .data = &printk_delay_msec,
803 .maxlen = sizeof(int),
804 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800805 .proc_handler = proc_dointvec_minmax,
Dave Youngaf913222009-09-22 16:43:33 -0700806 .extra1 = &zero,
807 .extra2 = &ten_thousand,
808 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700809 {
Borislav Petkov750afe72016-08-02 14:04:07 -0700810 .procname = "printk_devkmsg",
811 .data = devkmsg_log_str,
812 .maxlen = DEVKMSG_STR_MAX_SIZE,
813 .mode = 0644,
814 .proc_handler = devkmsg_sysctl_set_loglvl,
815 },
816 {
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800817 .procname = "dmesg_restrict",
818 .data = &dmesg_restrict,
819 .maxlen = sizeof(int),
820 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700821 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800822 .extra1 = &zero,
823 .extra2 = &one,
824 },
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800825 {
826 .procname = "kptr_restrict",
827 .data = &kptr_restrict,
828 .maxlen = sizeof(int),
829 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700830 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800831 .extra1 = &zero,
832 .extra2 = &two,
833 },
Joe Perchesdf6e61d2010-11-15 21:17:27 -0800834#endif
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800835 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700836 .procname = "ngroups_max",
837 .data = &ngroups_max,
838 .maxlen = sizeof (int),
839 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800840 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841 },
Dan Ballard73efc032011-10-31 17:11:20 -0700842 {
843 .procname = "cap_last_cap",
844 .data = (void *)&cap_last_cap,
845 .maxlen = sizeof(int),
846 .mode = 0444,
847 .proc_handler = proc_dointvec,
848 },
Don Zickus58687ac2010-05-07 17:11:44 -0400849#if defined(CONFIG_LOCKUP_DETECTOR)
Don Zickus504d7cf2010-02-12 17:19:19 -0500850 {
Don Zickus58687ac2010-05-07 17:11:44 -0400851 .procname = "watchdog",
Frederic Weisbecker3c00ea82013-05-19 20:45:15 +0200852 .data = &watchdog_user_enabled,
Don Zickus504d7cf2010-02-12 17:19:19 -0500853 .maxlen = sizeof (int),
854 .mode = 0644,
Ulrich Obergfell195daf62015-04-14 15:44:13 -0700855 .proc_handler = proc_watchdog,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700856 .extra1 = &zero,
857 .extra2 = &one,
Don Zickus58687ac2010-05-07 17:11:44 -0400858 },
859 {
860 .procname = "watchdog_thresh",
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700861 .data = &watchdog_thresh,
Don Zickus58687ac2010-05-07 17:11:44 -0400862 .maxlen = sizeof(int),
863 .mode = 0644,
Ulrich Obergfell195daf62015-04-14 15:44:13 -0700864 .proc_handler = proc_watchdog_thresh,
Li Zefana6572f82013-05-17 10:31:04 +0800865 .extra1 = &zero,
Don Zickus58687ac2010-05-07 17:11:44 -0400866 .extra2 = &sixty,
Don Zickus504d7cf2010-02-12 17:19:19 -0500867 },
Don Zickus2508ce12010-05-07 17:11:46 -0400868 {
Ulrich Obergfell195daf62015-04-14 15:44:13 -0700869 .procname = "nmi_watchdog",
870 .data = &nmi_watchdog_enabled,
871 .maxlen = sizeof (int),
872 .mode = 0644,
873 .proc_handler = proc_nmi_watchdog,
874 .extra1 = &zero,
875#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
876 .extra2 = &one,
877#else
878 .extra2 = &zero,
879#endif
880 },
881 {
882 .procname = "soft_watchdog",
883 .data = &soft_watchdog_enabled,
884 .maxlen = sizeof (int),
885 .mode = 0644,
886 .proc_handler = proc_soft_watchdog,
887 .extra1 = &zero,
888 .extra2 = &one,
889 },
890 {
Chris Metcalffe4ba3c2015-06-24 16:55:45 -0700891 .procname = "watchdog_cpumask",
892 .data = &watchdog_cpumask_bits,
893 .maxlen = NR_CPUS,
894 .mode = 0644,
895 .proc_handler = proc_watchdog_cpumask,
896 },
897 {
Don Zickus2508ce12010-05-07 17:11:46 -0400898 .procname = "softlockup_panic",
899 .data = &softlockup_panic,
900 .maxlen = sizeof(int),
901 .mode = 0644,
902 .proc_handler = proc_dointvec_minmax,
903 .extra1 = &zero,
904 .extra2 = &one,
905 },
Don Zickusac1f5912015-11-05 18:44:44 -0800906#ifdef CONFIG_HARDLOCKUP_DETECTOR
907 {
908 .procname = "hardlockup_panic",
909 .data = &hardlockup_panic,
910 .maxlen = sizeof(int),
911 .mode = 0644,
912 .proc_handler = proc_dointvec_minmax,
913 .extra1 = &zero,
914 .extra2 = &one,
915 },
916#endif
Aaron Tomlined235872014-06-23 13:22:05 -0700917#ifdef CONFIG_SMP
918 {
919 .procname = "softlockup_all_cpu_backtrace",
920 .data = &sysctl_softlockup_all_cpu_backtrace,
921 .maxlen = sizeof(int),
922 .mode = 0644,
923 .proc_handler = proc_dointvec_minmax,
924 .extra1 = &zero,
925 .extra2 = &one,
926 },
Jiri Kosina55537872015-11-05 18:44:41 -0800927 {
928 .procname = "hardlockup_all_cpu_backtrace",
929 .data = &sysctl_hardlockup_all_cpu_backtrace,
930 .maxlen = sizeof(int),
931 .mode = 0644,
932 .proc_handler = proc_dointvec_minmax,
933 .extra1 = &zero,
934 .extra2 = &one,
935 },
Aaron Tomlined235872014-06-23 13:22:05 -0700936#endif /* CONFIG_SMP */
Don Zickus5dc30552010-11-29 17:07:17 -0500937#endif
938#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
939 {
940 .procname = "unknown_nmi_panic",
941 .data = &unknown_nmi_panic,
942 .maxlen = sizeof (int),
943 .mode = 0644,
944 .proc_handler = proc_dointvec,
945 },
Don Zickus504d7cf2010-02-12 17:19:19 -0500946#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700947#if defined(CONFIG_X86)
948 {
Don Zickus8da5add2006-09-26 10:52:27 +0200949 .procname = "panic_on_unrecovered_nmi",
950 .data = &panic_on_unrecovered_nmi,
951 .maxlen = sizeof(int),
952 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800953 .proc_handler = proc_dointvec,
Don Zickus8da5add2006-09-26 10:52:27 +0200954 },
955 {
Kurt Garloff5211a242009-06-24 14:32:11 -0700956 .procname = "panic_on_io_nmi",
957 .data = &panic_on_io_nmi,
958 .maxlen = sizeof(int),
959 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800960 .proc_handler = proc_dointvec,
Kurt Garloff5211a242009-06-24 14:32:11 -0700961 },
Mitsuo Hayasaka55af7792011-11-29 15:08:36 +0900962#ifdef CONFIG_DEBUG_STACKOVERFLOW
963 {
964 .procname = "panic_on_stackoverflow",
965 .data = &sysctl_panic_on_stackoverflow,
966 .maxlen = sizeof(int),
967 .mode = 0644,
968 .proc_handler = proc_dointvec,
969 },
970#endif
Kurt Garloff5211a242009-06-24 14:32:11 -0700971 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700972 .procname = "bootloader_type",
973 .data = &bootloader_type,
974 .maxlen = sizeof (int),
975 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800976 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700977 },
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100978 {
H. Peter Anvin50312962009-05-07 16:54:11 -0700979 .procname = "bootloader_version",
980 .data = &bootloader_version,
981 .maxlen = sizeof (int),
982 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800983 .proc_handler = proc_dointvec,
H. Peter Anvin50312962009-05-07 16:54:11 -0700984 },
985 {
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100986 .procname = "io_delay_type",
987 .data = &io_delay_type,
988 .maxlen = sizeof(int),
989 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800990 .proc_handler = proc_dointvec,
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100991 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700992#endif
Luke Yang7a9166e2006-02-20 18:28:07 -0800993#if defined(CONFIG_MMU)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700994 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700995 .procname = "randomize_va_space",
996 .data = &randomize_va_space,
997 .maxlen = sizeof(int),
998 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800999 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001000 },
Luke Yang7a9166e2006-02-20 18:28:07 -08001001#endif
Martin Schwidefsky0152fb32006-01-14 13:21:00 -08001002#if defined(CONFIG_S390) && defined(CONFIG_SMP)
Martin Schwidefsky951f22d2005-07-27 11:44:57 -07001003 {
Martin Schwidefsky951f22d2005-07-27 11:44:57 -07001004 .procname = "spin_retry",
1005 .data = &spin_retry,
1006 .maxlen = sizeof (int),
1007 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001008 .proc_handler = proc_dointvec,
Martin Schwidefsky951f22d2005-07-27 11:44:57 -07001009 },
1010#endif
Len Brown673d5b42007-07-28 03:33:16 -04001011#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
Pavel Machekc255d842006-02-20 18:27:58 -08001012 {
Pavel Machekc255d842006-02-20 18:27:58 -08001013 .procname = "acpi_video_flags",
Pavel Machek77afcf72007-07-19 01:47:41 -07001014 .data = &acpi_realmode_flags,
Pavel Machekc255d842006-02-20 18:27:58 -08001015 .maxlen = sizeof (unsigned long),
1016 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001017 .proc_handler = proc_doulongvec_minmax,
Pavel Machekc255d842006-02-20 18:27:58 -08001018 },
1019#endif
Vineet Guptab6fca722013-01-09 20:06:28 +05301020#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
Jes Sorensend2b176e2006-02-28 09:42:23 -08001021 {
Jes Sorensend2b176e2006-02-28 09:42:23 -08001022 .procname = "ignore-unaligned-usertrap",
1023 .data = &no_unaligned_warning,
1024 .maxlen = sizeof (int),
1025 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001026 .proc_handler = proc_dointvec,
Jes Sorensend2b176e2006-02-28 09:42:23 -08001027 },
Vineet Guptab6fca722013-01-09 20:06:28 +05301028#endif
1029#ifdef CONFIG_IA64
Doug Chapman88fc2412009-01-15 10:38:56 -08001030 {
Doug Chapman88fc2412009-01-15 10:38:56 -08001031 .procname = "unaligned-dump-stack",
1032 .data = &unaligned_dump_stack,
1033 .maxlen = sizeof (int),
1034 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001035 .proc_handler = proc_dointvec,
Doug Chapman88fc2412009-01-15 10:38:56 -08001036 },
Jes Sorensend2b176e2006-02-28 09:42:23 -08001037#endif
Mandeep Singh Bainese162b392009-01-15 11:08:40 -08001038#ifdef CONFIG_DETECT_HUNG_TASK
1039 {
Mandeep Singh Bainese162b392009-01-15 11:08:40 -08001040 .procname = "hung_task_panic",
1041 .data = &sysctl_hung_task_panic,
1042 .maxlen = sizeof(int),
1043 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001044 .proc_handler = proc_dointvec_minmax,
Mandeep Singh Bainese162b392009-01-15 11:08:40 -08001045 .extra1 = &zero,
1046 .extra2 = &one,
1047 },
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001048 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001049 .procname = "hung_task_check_count",
1050 .data = &sysctl_hung_task_check_count,
Li Zefancd646472013-09-23 16:43:58 +08001051 .maxlen = sizeof(int),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001052 .mode = 0644,
Li Zefancd646472013-09-23 16:43:58 +08001053 .proc_handler = proc_dointvec_minmax,
1054 .extra1 = &zero,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001055 },
1056 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001057 .procname = "hung_task_timeout_secs",
1058 .data = &sysctl_hung_task_timeout_secs,
Ingo Molnar90739082008-01-25 21:08:34 +01001059 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001060 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001061 .proc_handler = proc_dohung_task_timeout_secs,
Liu Hua80df2842014-04-07 15:38:57 -07001062 .extra2 = &hung_task_timeout_max,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001063 },
1064 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001065 .procname = "hung_task_warnings",
1066 .data = &sysctl_hung_task_warnings,
Aaron Tomlin270750db2014-01-20 17:34:13 +00001067 .maxlen = sizeof(int),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001068 .mode = 0644,
Aaron Tomlin270750db2014-01-20 17:34:13 +00001069 .proc_handler = proc_dointvec_minmax,
1070 .extra1 = &neg_one,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +01001071 },
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -07001072#endif
Ingo Molnar23f78d4a2006-06-27 02:54:53 -07001073#ifdef CONFIG_RT_MUTEXES
1074 {
Ingo Molnar23f78d4a2006-06-27 02:54:53 -07001075 .procname = "max_lock_depth",
1076 .data = &max_lock_depth,
1077 .maxlen = sizeof(int),
1078 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001079 .proc_handler = proc_dointvec,
Ingo Molnar23f78d4a2006-06-27 02:54:53 -07001080 },
1081#endif
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -07001082 {
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -07001083 .procname = "poweroff_cmd",
1084 .data = &poweroff_cmd,
1085 .maxlen = POWEROFF_CMD_PATH_LEN,
1086 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001087 .proc_handler = proc_dostring,
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -07001088 },
David Howells0b77f5b2008-04-29 01:01:32 -07001089#ifdef CONFIG_KEYS
1090 {
David Howells0b77f5b2008-04-29 01:01:32 -07001091 .procname = "keys",
1092 .mode = 0555,
1093 .child = key_sysctls,
1094 },
1095#endif
Ingo Molnarcdd6c482009-09-21 12:02:48 +02001096#ifdef CONFIG_PERF_EVENTS
Vince Weaveraa4a2212011-06-03 17:54:40 -04001097 /*
1098 * User-space scripts rely on the existence of this file
1099 * as a feature check for perf_events being enabled.
1100 *
1101 * So it's an ABI, do not remove!
1102 */
Peter Zijlstra1ccd1542009-04-09 10:53:45 +02001103 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +02001104 .procname = "perf_event_paranoid",
1105 .data = &sysctl_perf_event_paranoid,
1106 .maxlen = sizeof(sysctl_perf_event_paranoid),
Peter Zijlstra1ccd1542009-04-09 10:53:45 +02001107 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001108 .proc_handler = proc_dointvec,
Peter Zijlstra1ccd1542009-04-09 10:53:45 +02001109 },
Peter Zijlstrac5078f72009-05-05 17:50:24 +02001110 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +02001111 .procname = "perf_event_mlock_kb",
1112 .data = &sysctl_perf_event_mlock,
1113 .maxlen = sizeof(sysctl_perf_event_mlock),
Peter Zijlstrac5078f72009-05-05 17:50:24 +02001114 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001115 .proc_handler = proc_dointvec,
Peter Zijlstrac5078f72009-05-05 17:50:24 +02001116 },
Peter Zijlstraa78ac322009-05-25 17:39:05 +02001117 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +02001118 .procname = "perf_event_max_sample_rate",
1119 .data = &sysctl_perf_event_sample_rate,
1120 .maxlen = sizeof(sysctl_perf_event_sample_rate),
Peter Zijlstraa78ac322009-05-25 17:39:05 +02001121 .mode = 0644,
Peter Zijlstra163ec432011-02-16 11:22:34 +01001122 .proc_handler = perf_proc_update_handler,
Knut Petersen723478c2013-09-25 14:29:37 +02001123 .extra1 = &one,
Peter Zijlstraa78ac322009-05-25 17:39:05 +02001124 },
Dave Hansen14c63f12013-06-21 08:51:36 -07001125 {
1126 .procname = "perf_cpu_time_max_percent",
1127 .data = &sysctl_perf_cpu_time_max_percent,
1128 .maxlen = sizeof(sysctl_perf_cpu_time_max_percent),
1129 .mode = 0644,
1130 .proc_handler = perf_cpu_time_max_percent_handler,
1131 .extra1 = &zero,
1132 .extra2 = &one_hundred,
1133 },
Arnaldo Carvalho de Meloc5dfd782016-04-21 12:28:50 -03001134 {
1135 .procname = "perf_event_max_stack",
Arnaldo Carvalho de Meloa8311002016-05-10 16:34:53 -03001136 .data = &sysctl_perf_event_max_stack,
Arnaldo Carvalho de Meloc5dfd782016-04-21 12:28:50 -03001137 .maxlen = sizeof(sysctl_perf_event_max_stack),
1138 .mode = 0644,
1139 .proc_handler = perf_event_max_stack_handler,
1140 .extra1 = &zero,
1141 .extra2 = &six_hundred_forty_kb,
1142 },
Arnaldo Carvalho de Meloc85b0332016-05-12 13:06:21 -03001143 {
1144 .procname = "perf_event_max_contexts_per_stack",
1145 .data = &sysctl_perf_event_max_contexts_per_stack,
1146 .maxlen = sizeof(sysctl_perf_event_max_contexts_per_stack),
1147 .mode = 0644,
1148 .proc_handler = perf_event_max_stack_handler,
1149 .extra1 = &zero,
1150 .extra2 = &one_thousand,
1151 },
Peter Zijlstra1ccd1542009-04-09 10:53:45 +02001152#endif
Vegard Nossumdfec0722008-04-04 00:51:41 +02001153#ifdef CONFIG_KMEMCHECK
1154 {
Vegard Nossumdfec0722008-04-04 00:51:41 +02001155 .procname = "kmemcheck",
1156 .data = &kmemcheck_enabled,
1157 .maxlen = sizeof(int),
1158 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001159 .proc_handler = proc_dointvec,
Vegard Nossumdfec0722008-04-04 00:51:41 +02001160 },
1161#endif
Prarit Bhargava9e3961a2014-12-10 15:45:50 -08001162 {
1163 .procname = "panic_on_warn",
1164 .data = &panic_on_warn,
1165 .maxlen = sizeof(int),
1166 .mode = 0644,
1167 .proc_handler = proc_dointvec_minmax,
1168 .extra1 = &zero,
1169 .extra2 = &one,
1170 },
Thomas Gleixnerbc7a34b2015-05-26 22:50:33 +00001171#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
1172 {
1173 .procname = "timer_migration",
1174 .data = &sysctl_timer_migration,
1175 .maxlen = sizeof(unsigned int),
1176 .mode = 0644,
1177 .proc_handler = timer_migration_handler,
1178 },
1179#endif
Alexei Starovoitov1be7f752015-10-07 22:23:21 -07001180#ifdef CONFIG_BPF_SYSCALL
1181 {
1182 .procname = "unprivileged_bpf_disabled",
1183 .data = &sysctl_unprivileged_bpf_disabled,
1184 .maxlen = sizeof(sysctl_unprivileged_bpf_disabled),
1185 .mode = 0644,
1186 /* only handle a transition from default "0" to "1" */
1187 .proc_handler = proc_dointvec_minmax,
1188 .extra1 = &one,
1189 .extra2 = &one,
1190 },
1191#endif
Daniel Bristot de Oliveira088e9d22016-06-02 13:51:41 -03001192#if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU)
1193 {
1194 .procname = "panic_on_rcu_stall",
1195 .data = &sysctl_panic_on_rcu_stall,
1196 .maxlen = sizeof(sysctl_panic_on_rcu_stall),
1197 .mode = 0644,
1198 .proc_handler = proc_dointvec_minmax,
1199 .extra1 = &zero,
1200 .extra2 = &one,
1201 },
1202#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001203 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001204};
1205
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001206static struct ctl_table vm_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001207 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001208 .procname = "overcommit_memory",
1209 .data = &sysctl_overcommit_memory,
1210 .maxlen = sizeof(sysctl_overcommit_memory),
1211 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001212 .proc_handler = proc_dointvec_minmax,
1213 .extra1 = &zero,
1214 .extra2 = &two,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001215 },
1216 {
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001217 .procname = "panic_on_oom",
1218 .data = &sysctl_panic_on_oom,
1219 .maxlen = sizeof(sysctl_panic_on_oom),
1220 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001221 .proc_handler = proc_dointvec_minmax,
1222 .extra1 = &zero,
1223 .extra2 = &two,
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001224 },
1225 {
David Rientjesfe071d72007-10-16 23:25:56 -07001226 .procname = "oom_kill_allocating_task",
1227 .data = &sysctl_oom_kill_allocating_task,
1228 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1229 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001230 .proc_handler = proc_dointvec,
David Rientjesfe071d72007-10-16 23:25:56 -07001231 },
1232 {
David Rientjesfef1bdd2008-02-07 00:14:07 -08001233 .procname = "oom_dump_tasks",
1234 .data = &sysctl_oom_dump_tasks,
1235 .maxlen = sizeof(sysctl_oom_dump_tasks),
1236 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001237 .proc_handler = proc_dointvec,
David Rientjesfef1bdd2008-02-07 00:14:07 -08001238 },
1239 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001240 .procname = "overcommit_ratio",
1241 .data = &sysctl_overcommit_ratio,
1242 .maxlen = sizeof(sysctl_overcommit_ratio),
1243 .mode = 0644,
Jerome Marchand49f0ce52014-01-21 15:49:14 -08001244 .proc_handler = overcommit_ratio_handler,
1245 },
1246 {
1247 .procname = "overcommit_kbytes",
1248 .data = &sysctl_overcommit_kbytes,
1249 .maxlen = sizeof(sysctl_overcommit_kbytes),
1250 .mode = 0644,
1251 .proc_handler = overcommit_kbytes_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001252 },
1253 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001254 .procname = "page-cluster",
1255 .data = &page_cluster,
1256 .maxlen = sizeof(int),
1257 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001258 .proc_handler = proc_dointvec_minmax,
1259 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001260 },
1261 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001262 .procname = "dirty_background_ratio",
1263 .data = &dirty_background_ratio,
1264 .maxlen = sizeof(dirty_background_ratio),
1265 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001266 .proc_handler = dirty_background_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001267 .extra1 = &zero,
1268 .extra2 = &one_hundred,
1269 },
1270 {
David Rientjes2da02992009-01-06 14:39:31 -08001271 .procname = "dirty_background_bytes",
1272 .data = &dirty_background_bytes,
1273 .maxlen = sizeof(dirty_background_bytes),
1274 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001275 .proc_handler = dirty_background_bytes_handler,
Sven Wegenerfc3501d2009-02-11 13:04:23 -08001276 .extra1 = &one_ul,
David Rientjes2da02992009-01-06 14:39:31 -08001277 },
1278 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001279 .procname = "dirty_ratio",
1280 .data = &vm_dirty_ratio,
1281 .maxlen = sizeof(vm_dirty_ratio),
1282 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001283 .proc_handler = dirty_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001284 .extra1 = &zero,
1285 .extra2 = &one_hundred,
1286 },
1287 {
David Rientjes2da02992009-01-06 14:39:31 -08001288 .procname = "dirty_bytes",
1289 .data = &vm_dirty_bytes,
1290 .maxlen = sizeof(vm_dirty_bytes),
1291 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001292 .proc_handler = dirty_bytes_handler,
Andrea Righi9e4a5bd2009-04-30 15:08:57 -07001293 .extra1 = &dirty_bytes_min,
David Rientjes2da02992009-01-06 14:39:31 -08001294 },
1295 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001296 .procname = "dirty_writeback_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001297 .data = &dirty_writeback_interval,
1298 .maxlen = sizeof(dirty_writeback_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001299 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001300 .proc_handler = dirty_writeback_centisecs_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001301 },
1302 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001303 .procname = "dirty_expire_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001304 .data = &dirty_expire_interval,
1305 .maxlen = sizeof(dirty_expire_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001306 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001307 .proc_handler = proc_dointvec_minmax,
1308 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001309 },
1310 {
Theodore Ts'o1efff912015-03-17 12:23:32 -04001311 .procname = "dirtytime_expire_seconds",
1312 .data = &dirtytime_expire_interval,
1313 .maxlen = sizeof(dirty_expire_interval),
1314 .mode = 0644,
1315 .proc_handler = dirtytime_interval_handler,
1316 .extra1 = &zero,
1317 },
1318 {
Wanpeng Li3965c9a2012-07-31 16:41:52 -07001319 .procname = "nr_pdflush_threads",
1320 .mode = 0444 /* read-only */,
1321 .proc_handler = pdflush_proc_obsolete,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001322 },
1323 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001324 .procname = "swappiness",
1325 .data = &vm_swappiness,
1326 .maxlen = sizeof(vm_swappiness),
1327 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001328 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001329 .extra1 = &zero,
1330 .extra2 = &one_hundred,
1331 },
1332#ifdef CONFIG_HUGETLB_PAGE
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001333 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001334 .procname = "nr_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001335 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001336 .maxlen = sizeof(unsigned long),
1337 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001338 .proc_handler = hugetlb_sysctl_handler,
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001339 },
1340#ifdef CONFIG_NUMA
1341 {
1342 .procname = "nr_hugepages_mempolicy",
1343 .data = NULL,
1344 .maxlen = sizeof(unsigned long),
1345 .mode = 0644,
1346 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001347 },
1348#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001349 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001350 .procname = "hugetlb_shm_group",
1351 .data = &sysctl_hugetlb_shm_group,
1352 .maxlen = sizeof(gid_t),
1353 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001354 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001355 },
Mel Gorman396faf02007-07-17 04:03:13 -07001356 {
Mel Gorman396faf02007-07-17 04:03:13 -07001357 .procname = "hugepages_treat_as_movable",
1358 .data = &hugepages_treat_as_movable,
1359 .maxlen = sizeof(int),
1360 .mode = 0644,
Naoya Horiguchi86cdb462013-09-11 14:22:13 -07001361 .proc_handler = proc_dointvec,
Mel Gorman396faf02007-07-17 04:03:13 -07001362 },
Adam Litke54f9f802007-10-16 01:26:20 -07001363 {
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001364 .procname = "nr_overcommit_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001365 .data = NULL,
1366 .maxlen = sizeof(unsigned long),
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001367 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001368 .proc_handler = hugetlb_overcommit_handler,
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001369 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001370#endif
1371 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001372 .procname = "lowmem_reserve_ratio",
1373 .data = &sysctl_lowmem_reserve_ratio,
1374 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1375 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001376 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001377 },
1378 {
Andrew Morton9d0243b2006-01-08 01:00:39 -08001379 .procname = "drop_caches",
1380 .data = &sysctl_drop_caches,
1381 .maxlen = sizeof(int),
1382 .mode = 0644,
1383 .proc_handler = drop_caches_sysctl_handler,
Petr Holasekcb16e952011-03-23 16:43:09 -07001384 .extra1 = &one,
Dave Hansen5509a5d2014-04-03 14:48:19 -07001385 .extra2 = &four,
Andrew Morton9d0243b2006-01-08 01:00:39 -08001386 },
Mel Gorman76ab0f52010-05-24 14:32:28 -07001387#ifdef CONFIG_COMPACTION
1388 {
1389 .procname = "compact_memory",
1390 .data = &sysctl_compact_memory,
1391 .maxlen = sizeof(int),
1392 .mode = 0200,
1393 .proc_handler = sysctl_compaction_handler,
1394 },
Mel Gorman5e771902010-05-24 14:32:31 -07001395 {
1396 .procname = "extfrag_threshold",
1397 .data = &sysctl_extfrag_threshold,
1398 .maxlen = sizeof(int),
1399 .mode = 0644,
1400 .proc_handler = sysctl_extfrag_handler,
1401 .extra1 = &min_extfrag_threshold,
1402 .extra2 = &max_extfrag_threshold,
1403 },
Eric B Munson5bbe3542015-04-15 16:13:20 -07001404 {
1405 .procname = "compact_unevictable_allowed",
1406 .data = &sysctl_compact_unevictable_allowed,
1407 .maxlen = sizeof(int),
1408 .mode = 0644,
1409 .proc_handler = proc_dointvec,
1410 .extra1 = &zero,
1411 .extra2 = &one,
1412 },
Mel Gorman5e771902010-05-24 14:32:31 -07001413
Mel Gorman76ab0f52010-05-24 14:32:28 -07001414#endif /* CONFIG_COMPACTION */
Andrew Morton9d0243b2006-01-08 01:00:39 -08001415 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001416 .procname = "min_free_kbytes",
1417 .data = &min_free_kbytes,
1418 .maxlen = sizeof(min_free_kbytes),
1419 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001420 .proc_handler = min_free_kbytes_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001421 .extra1 = &zero,
1422 },
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001423 {
Johannes Weiner795ae7a2016-03-17 14:19:14 -07001424 .procname = "watermark_scale_factor",
1425 .data = &watermark_scale_factor,
1426 .maxlen = sizeof(watermark_scale_factor),
1427 .mode = 0644,
1428 .proc_handler = watermark_scale_factor_sysctl_handler,
1429 .extra1 = &one,
1430 .extra2 = &one_thousand,
1431 },
1432 {
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001433 .procname = "percpu_pagelist_fraction",
1434 .data = &percpu_pagelist_fraction,
1435 .maxlen = sizeof(percpu_pagelist_fraction),
1436 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001437 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
David Rientjes7cd2b0a2014-06-23 13:22:04 -07001438 .extra1 = &zero,
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001439 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001440#ifdef CONFIG_MMU
1441 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001442 .procname = "max_map_count",
1443 .data = &sysctl_max_map_count,
1444 .maxlen = sizeof(sysctl_max_map_count),
1445 .mode = 0644,
WANG Cong3e261202009-12-17 15:27:05 -08001446 .proc_handler = proc_dointvec_minmax,
Amerigo Wang70da2342009-12-14 17:59:52 -08001447 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001448 },
Paul Mundtdd8632a2009-01-08 12:04:47 +00001449#else
1450 {
Paul Mundtdd8632a2009-01-08 12:04:47 +00001451 .procname = "nr_trim_pages",
1452 .data = &sysctl_nr_trim_pages,
1453 .maxlen = sizeof(sysctl_nr_trim_pages),
1454 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001455 .proc_handler = proc_dointvec_minmax,
Paul Mundtdd8632a2009-01-08 12:04:47 +00001456 .extra1 = &zero,
1457 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001458#endif
1459 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001460 .procname = "laptop_mode",
1461 .data = &laptop_mode,
1462 .maxlen = sizeof(laptop_mode),
1463 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001464 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001465 },
1466 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001467 .procname = "block_dump",
1468 .data = &block_dump,
1469 .maxlen = sizeof(block_dump),
1470 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001471 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001472 .extra1 = &zero,
1473 },
1474 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001475 .procname = "vfs_cache_pressure",
1476 .data = &sysctl_vfs_cache_pressure,
1477 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1478 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001479 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001480 .extra1 = &zero,
1481 },
1482#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1483 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001484 .procname = "legacy_va_layout",
1485 .data = &sysctl_legacy_va_layout,
1486 .maxlen = sizeof(sysctl_legacy_va_layout),
1487 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001488 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001489 .extra1 = &zero,
1490 },
1491#endif
Christoph Lameter17436602006-01-18 17:42:32 -08001492#ifdef CONFIG_NUMA
1493 {
Christoph Lameter17436602006-01-18 17:42:32 -08001494 .procname = "zone_reclaim_mode",
Mel Gormana5f5f912016-07-28 15:46:32 -07001495 .data = &node_reclaim_mode,
1496 .maxlen = sizeof(node_reclaim_mode),
Christoph Lameter17436602006-01-18 17:42:32 -08001497 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001498 .proc_handler = proc_dointvec,
Christoph Lameterc84db232006-02-01 03:05:29 -08001499 .extra1 = &zero,
Christoph Lameter17436602006-01-18 17:42:32 -08001500 },
Christoph Lameter96146342006-07-03 00:24:13 -07001501 {
Christoph Lameter96146342006-07-03 00:24:13 -07001502 .procname = "min_unmapped_ratio",
1503 .data = &sysctl_min_unmapped_ratio,
1504 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1505 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001506 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
Christoph Lameter96146342006-07-03 00:24:13 -07001507 .extra1 = &zero,
1508 .extra2 = &one_hundred,
1509 },
Christoph Lameter0ff38492006-09-25 23:31:52 -07001510 {
Christoph Lameter0ff38492006-09-25 23:31:52 -07001511 .procname = "min_slab_ratio",
1512 .data = &sysctl_min_slab_ratio,
1513 .maxlen = sizeof(sysctl_min_slab_ratio),
1514 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001515 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
Christoph Lameter0ff38492006-09-25 23:31:52 -07001516 .extra1 = &zero,
1517 .extra2 = &one_hundred,
1518 },
Christoph Lameter17436602006-01-18 17:42:32 -08001519#endif
Christoph Lameter77461ab2007-05-09 02:35:13 -07001520#ifdef CONFIG_SMP
1521 {
Christoph Lameter77461ab2007-05-09 02:35:13 -07001522 .procname = "stat_interval",
1523 .data = &sysctl_stat_interval,
1524 .maxlen = sizeof(sysctl_stat_interval),
1525 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001526 .proc_handler = proc_dointvec_jiffies,
Christoph Lameter77461ab2007-05-09 02:35:13 -07001527 },
Hugh Dickins52b6f462016-05-19 17:12:50 -07001528 {
1529 .procname = "stat_refresh",
1530 .data = NULL,
1531 .maxlen = 0,
1532 .mode = 0600,
1533 .proc_handler = vmstat_refresh,
1534 },
Christoph Lameter77461ab2007-05-09 02:35:13 -07001535#endif
David Howells6e141542009-12-15 19:27:45 +00001536#ifdef CONFIG_MMU
Eric Parised032182007-06-28 15:55:21 -04001537 {
Eric Parised032182007-06-28 15:55:21 -04001538 .procname = "mmap_min_addr",
Eric Paris788084a2009-07-31 12:54:11 -04001539 .data = &dac_mmap_min_addr,
1540 .maxlen = sizeof(unsigned long),
Eric Parised032182007-06-28 15:55:21 -04001541 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001542 .proc_handler = mmap_min_addr_handler,
Eric Parised032182007-06-28 15:55:21 -04001543 },
David Howells6e141542009-12-15 19:27:45 +00001544#endif
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001545#ifdef CONFIG_NUMA
1546 {
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001547 .procname = "numa_zonelist_order",
1548 .data = &numa_zonelist_order,
1549 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1550 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001551 .proc_handler = numa_zonelist_order_handler,
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001552 },
1553#endif
Al Viro2b8232c2007-10-13 08:16:04 +01001554#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
Paul Mundt5c36e652007-03-01 10:07:42 +09001555 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
Ingo Molnare6e54942006-06-27 02:53:50 -07001556 {
Ingo Molnare6e54942006-06-27 02:53:50 -07001557 .procname = "vdso_enabled",
Andy Lutomirski3d7ee962014-05-05 12:19:32 -07001558#ifdef CONFIG_X86_32
1559 .data = &vdso32_enabled,
1560 .maxlen = sizeof(vdso32_enabled),
1561#else
Ingo Molnare6e54942006-06-27 02:53:50 -07001562 .data = &vdso_enabled,
1563 .maxlen = sizeof(vdso_enabled),
Andy Lutomirski3d7ee962014-05-05 12:19:32 -07001564#endif
Ingo Molnare6e54942006-06-27 02:53:50 -07001565 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001566 .proc_handler = proc_dointvec,
Ingo Molnare6e54942006-06-27 02:53:50 -07001567 .extra1 = &zero,
1568 },
1569#endif
Bron Gondwana195cf4532008-02-04 22:29:20 -08001570#ifdef CONFIG_HIGHMEM
1571 {
Bron Gondwana195cf4532008-02-04 22:29:20 -08001572 .procname = "highmem_is_dirtyable",
1573 .data = &vm_highmem_is_dirtyable,
1574 .maxlen = sizeof(vm_highmem_is_dirtyable),
1575 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001576 .proc_handler = proc_dointvec_minmax,
Bron Gondwana195cf4532008-02-04 22:29:20 -08001577 .extra1 = &zero,
1578 .extra2 = &one,
1579 },
1580#endif
Andi Kleen6a460792009-09-16 11:50:15 +02001581#ifdef CONFIG_MEMORY_FAILURE
1582 {
Andi Kleen6a460792009-09-16 11:50:15 +02001583 .procname = "memory_failure_early_kill",
1584 .data = &sysctl_memory_failure_early_kill,
1585 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1586 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001587 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001588 .extra1 = &zero,
1589 .extra2 = &one,
1590 },
1591 {
Andi Kleen6a460792009-09-16 11:50:15 +02001592 .procname = "memory_failure_recovery",
1593 .data = &sysctl_memory_failure_recovery,
1594 .maxlen = sizeof(sysctl_memory_failure_recovery),
1595 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001596 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001597 .extra1 = &zero,
1598 .extra2 = &one,
1599 },
1600#endif
Andrew Shewmakerc9b1d092013-04-29 15:08:10 -07001601 {
1602 .procname = "user_reserve_kbytes",
1603 .data = &sysctl_user_reserve_kbytes,
1604 .maxlen = sizeof(sysctl_user_reserve_kbytes),
1605 .mode = 0644,
1606 .proc_handler = proc_doulongvec_minmax,
1607 },
Andrew Shewmaker4eeab4f2013-04-29 15:08:11 -07001608 {
1609 .procname = "admin_reserve_kbytes",
1610 .data = &sysctl_admin_reserve_kbytes,
1611 .maxlen = sizeof(sysctl_admin_reserve_kbytes),
1612 .mode = 0644,
1613 .proc_handler = proc_doulongvec_minmax,
1614 },
Daniel Cashmand07e2252016-01-14 15:19:53 -08001615#ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
1616 {
1617 .procname = "mmap_rnd_bits",
1618 .data = &mmap_rnd_bits,
1619 .maxlen = sizeof(mmap_rnd_bits),
1620 .mode = 0600,
1621 .proc_handler = proc_dointvec_minmax,
1622 .extra1 = (void *)&mmap_rnd_bits_min,
1623 .extra2 = (void *)&mmap_rnd_bits_max,
1624 },
1625#endif
1626#ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS
1627 {
1628 .procname = "mmap_rnd_compat_bits",
1629 .data = &mmap_rnd_compat_bits,
1630 .maxlen = sizeof(mmap_rnd_compat_bits),
1631 .mode = 0600,
1632 .proc_handler = proc_dointvec_minmax,
1633 .extra1 = (void *)&mmap_rnd_compat_bits_min,
1634 .extra2 = (void *)&mmap_rnd_compat_bits_max,
1635 },
1636#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001637 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001638};
1639
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001640static struct ctl_table fs_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001641 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001642 .procname = "inode-nr",
1643 .data = &inodes_stat,
Glauber Costa3942c072013-08-28 10:17:53 +10001644 .maxlen = 2*sizeof(long),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001645 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001646 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001647 },
1648 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001649 .procname = "inode-state",
1650 .data = &inodes_stat,
Glauber Costa3942c072013-08-28 10:17:53 +10001651 .maxlen = 7*sizeof(long),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001652 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001653 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001654 },
1655 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001656 .procname = "file-nr",
1657 .data = &files_stat,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001658 .maxlen = sizeof(files_stat),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001659 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001660 .proc_handler = proc_nr_files,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001661 },
1662 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001663 .procname = "file-max",
1664 .data = &files_stat.max_files,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001665 .maxlen = sizeof(files_stat.max_files),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001666 .mode = 0644,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001667 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001668 },
1669 {
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001670 .procname = "nr_open",
1671 .data = &sysctl_nr_open,
Alexey Dobriyan9b80a182016-09-02 00:38:52 +03001672 .maxlen = sizeof(unsigned int),
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001673 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001674 .proc_handler = proc_dointvec_minmax,
Al Viroeceea0b2008-05-10 10:08:32 -04001675 .extra1 = &sysctl_nr_open_min,
1676 .extra2 = &sysctl_nr_open_max,
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001677 },
1678 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001679 .procname = "dentry-state",
1680 .data = &dentry_stat,
Glauber Costa3942c072013-08-28 10:17:53 +10001681 .maxlen = 6*sizeof(long),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001682 .mode = 0444,
Christoph Hellwig312d3ca2010-10-10 05:36:23 -04001683 .proc_handler = proc_nr_dentry,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001684 },
1685 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001686 .procname = "overflowuid",
1687 .data = &fs_overflowuid,
1688 .maxlen = sizeof(int),
1689 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001690 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001691 .extra1 = &minolduid,
1692 .extra2 = &maxolduid,
1693 },
1694 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001695 .procname = "overflowgid",
1696 .data = &fs_overflowgid,
1697 .maxlen = sizeof(int),
1698 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001699 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001700 .extra1 = &minolduid,
1701 .extra2 = &maxolduid,
1702 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001703#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001704 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001705 .procname = "leases-enable",
1706 .data = &leases_enable,
1707 .maxlen = sizeof(int),
1708 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001709 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001710 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001711#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001712#ifdef CONFIG_DNOTIFY
1713 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001714 .procname = "dir-notify-enable",
1715 .data = &dir_notify_enable,
1716 .maxlen = sizeof(int),
1717 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001718 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001719 },
1720#endif
1721#ifdef CONFIG_MMU
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001722#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001723 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001724 .procname = "lease-break-time",
1725 .data = &lease_break_time,
1726 .maxlen = sizeof(int),
1727 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001728 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001729 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001730#endif
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001731#ifdef CONFIG_AIO
Linus Torvalds1da177e2005-04-16 15:20:36 -07001732 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001733 .procname = "aio-nr",
1734 .data = &aio_nr,
1735 .maxlen = sizeof(aio_nr),
1736 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001737 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001738 },
1739 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001740 .procname = "aio-max-nr",
1741 .data = &aio_max_nr,
1742 .maxlen = sizeof(aio_max_nr),
1743 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001744 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001745 },
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001746#endif /* CONFIG_AIO */
Amy Griffis2d9048e2006-06-01 13:10:59 -07001747#ifdef CONFIG_INOTIFY_USER
Robert Love0399cb02005-07-13 12:38:18 -04001748 {
Robert Love0399cb02005-07-13 12:38:18 -04001749 .procname = "inotify",
1750 .mode = 0555,
1751 .child = inotify_table,
1752 },
1753#endif
Davide Libenzi7ef99642008-12-01 13:13:55 -08001754#ifdef CONFIG_EPOLL
1755 {
1756 .procname = "epoll",
1757 .mode = 0555,
1758 .child = epoll_table,
1759 },
1760#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001761#endif
Alan Coxd6e71142005-06-23 00:09:43 -07001762 {
Kees Cook800179c2012-07-25 17:29:07 -07001763 .procname = "protected_symlinks",
1764 .data = &sysctl_protected_symlinks,
1765 .maxlen = sizeof(int),
1766 .mode = 0600,
1767 .proc_handler = proc_dointvec_minmax,
1768 .extra1 = &zero,
1769 .extra2 = &one,
1770 },
1771 {
1772 .procname = "protected_hardlinks",
1773 .data = &sysctl_protected_hardlinks,
1774 .maxlen = sizeof(int),
1775 .mode = 0600,
1776 .proc_handler = proc_dointvec_minmax,
1777 .extra1 = &zero,
1778 .extra2 = &one,
1779 },
1780 {
Alan Coxd6e71142005-06-23 00:09:43 -07001781 .procname = "suid_dumpable",
1782 .data = &suid_dumpable,
1783 .maxlen = sizeof(int),
1784 .mode = 0644,
Kees Cook54b50192012-07-30 14:39:18 -07001785 .proc_handler = proc_dointvec_minmax_coredump,
Matthew Wilcox8e654fb2009-04-02 16:58:33 -07001786 .extra1 = &zero,
1787 .extra2 = &two,
Alan Coxd6e71142005-06-23 00:09:43 -07001788 },
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001789#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1790 {
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001791 .procname = "binfmt_misc",
1792 .mode = 0555,
Eric W. Biedermanf9bd6732015-05-09 22:09:14 -05001793 .child = sysctl_mount_point,
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001794 },
1795#endif
Jens Axboeb492e952010-05-19 21:03:16 +02001796 {
Jens Axboeff9da692010-06-03 14:54:39 +02001797 .procname = "pipe-max-size",
1798 .data = &pipe_max_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001799 .maxlen = sizeof(int),
1800 .mode = 0644,
Jens Axboeff9da692010-06-03 14:54:39 +02001801 .proc_handler = &pipe_proc_fn,
1802 .extra1 = &pipe_min_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001803 },
Willy Tarreau759c0112016-01-18 16:36:09 +01001804 {
1805 .procname = "pipe-user-pages-hard",
1806 .data = &pipe_user_pages_hard,
1807 .maxlen = sizeof(pipe_user_pages_hard),
1808 .mode = 0644,
1809 .proc_handler = proc_doulongvec_minmax,
1810 },
1811 {
1812 .procname = "pipe-user-pages-soft",
1813 .data = &pipe_user_pages_soft,
1814 .maxlen = sizeof(pipe_user_pages_soft),
1815 .mode = 0644,
1816 .proc_handler = proc_doulongvec_minmax,
1817 },
Eric W. Biedermand2921682016-09-28 00:27:17 -05001818 {
1819 .procname = "mount-max",
1820 .data = &sysctl_mount_max,
1821 .maxlen = sizeof(unsigned int),
1822 .mode = 0644,
1823 .proc_handler = proc_dointvec_minmax,
1824 .extra1 = &one,
1825 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001826 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001827};
1828
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001829static struct ctl_table debug_table[] = {
Catalin Marinas7ac57a82012-10-08 16:28:16 -07001830#ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001831 {
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001832 .procname = "exception-trace",
1833 .data = &show_unhandled_signals,
1834 .maxlen = sizeof(int),
1835 .mode = 0644,
1836 .proc_handler = proc_dointvec
1837 },
1838#endif
Masami Hiramatsub2be84d2010-02-25 08:34:15 -05001839#if defined(CONFIG_OPTPROBES)
1840 {
1841 .procname = "kprobes-optimization",
1842 .data = &sysctl_kprobes_optimization,
1843 .maxlen = sizeof(int),
1844 .mode = 0644,
1845 .proc_handler = proc_kprobes_optimization_handler,
1846 .extra1 = &zero,
1847 .extra2 = &one,
1848 },
1849#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001850 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001851};
1852
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001853static struct ctl_table dev_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001854 { }
Robert Love0eeca282005-07-12 17:06:03 -04001855};
Linus Torvalds1da177e2005-04-16 15:20:36 -07001856
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001857int __init sysctl_init(void)
Al Viro330d57f2005-11-04 10:18:40 +00001858{
Steven Rostedtfd4b6162012-07-30 14:42:48 -07001859 struct ctl_table_header *hdr;
1860
1861 hdr = register_sysctl_table(sysctl_base_table);
1862 kmemleak_not_leak(hdr);
Eric W. Biedermand912b0c2007-02-14 00:34:13 -08001863 return 0;
1864}
1865
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001866#endif /* CONFIG_SYSCTL */
1867
Linus Torvalds1da177e2005-04-16 15:20:36 -07001868/*
1869 * /proc/sys support
1870 */
1871
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001872#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -07001873
Kees Cookf8808302014-06-06 14:37:17 -07001874static int _proc_do_string(char *data, int maxlen, int write,
1875 char __user *buffer,
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001876 size_t *lenp, loff_t *ppos)
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001877{
1878 size_t len;
1879 char __user *p;
1880 char c;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001881
1882 if (!data || !maxlen || !*lenp) {
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001883 *lenp = 0;
1884 return 0;
1885 }
Oleg Nesterov8d060872007-02-10 01:46:38 -08001886
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001887 if (write) {
Kees Cookf4aacea2014-06-06 14:37:19 -07001888 if (sysctl_writes_strict == SYSCTL_WRITES_STRICT) {
1889 /* Only continue writes not past the end of buffer. */
1890 len = strlen(data);
1891 if (len > maxlen - 1)
1892 len = maxlen - 1;
1893
1894 if (*ppos > len)
1895 return 0;
1896 len = *ppos;
1897 } else {
1898 /* Start writing from beginning of buffer. */
1899 len = 0;
1900 }
1901
Kees Cook2ca9bb42014-06-06 14:37:18 -07001902 *ppos += *lenp;
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001903 p = buffer;
Kees Cook2ca9bb42014-06-06 14:37:18 -07001904 while ((p - buffer) < *lenp && len < maxlen - 1) {
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001905 if (get_user(c, p++))
1906 return -EFAULT;
1907 if (c == 0 || c == '\n')
1908 break;
Kees Cook2ca9bb42014-06-06 14:37:18 -07001909 data[len++] = c;
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001910 }
Kees Cookf8808302014-06-06 14:37:17 -07001911 data[len] = 0;
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001912 } else {
1913 len = strlen(data);
1914 if (len > maxlen)
1915 len = maxlen;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001916
1917 if (*ppos > len) {
1918 *lenp = 0;
1919 return 0;
1920 }
1921
1922 data += *ppos;
1923 len -= *ppos;
1924
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001925 if (len > *lenp)
1926 len = *lenp;
1927 if (len)
Kees Cookf8808302014-06-06 14:37:17 -07001928 if (copy_to_user(buffer, data, len))
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001929 return -EFAULT;
1930 if (len < *lenp) {
Kees Cookf8808302014-06-06 14:37:17 -07001931 if (put_user('\n', buffer + len))
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001932 return -EFAULT;
1933 len++;
1934 }
1935 *lenp = len;
1936 *ppos += len;
1937 }
1938 return 0;
1939}
1940
Kees Cookf4aacea2014-06-06 14:37:19 -07001941static void warn_sysctl_write(struct ctl_table *table)
1942{
1943 pr_warn_once("%s wrote to %s when file position was not 0!\n"
1944 "This will not be supported in the future. To silence this\n"
1945 "warning, set kernel.sysctl_writes_strict = -1\n",
1946 current->comm, table->procname);
1947}
1948
Linus Torvalds1da177e2005-04-16 15:20:36 -07001949/**
1950 * proc_dostring - read a string sysctl
1951 * @table: the sysctl table
1952 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001953 * @buffer: the user buffer
1954 * @lenp: the size of the user buffer
1955 * @ppos: file position
1956 *
1957 * Reads/writes a string from/to the user buffer. If the kernel
1958 * buffer provided is not large enough to hold the string, the
1959 * string is truncated. The copied string is %NULL-terminated.
1960 * If the string is being read by the user process, it is copied
1961 * and a newline '\n' is added. It is truncated if the buffer is
1962 * not large enough.
1963 *
1964 * Returns 0 on success.
1965 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001966int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001967 void __user *buffer, size_t *lenp, loff_t *ppos)
1968{
Kees Cookf4aacea2014-06-06 14:37:19 -07001969 if (write && *ppos && sysctl_writes_strict == SYSCTL_WRITES_WARN)
1970 warn_sysctl_write(table);
1971
Kees Cookf8808302014-06-06 14:37:17 -07001972 return _proc_do_string((char *)(table->data), table->maxlen, write,
1973 (char __user *)buffer, lenp, ppos);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001974}
1975
Amerigo Wang00b7c332010-05-05 00:26:45 +00001976static size_t proc_skip_spaces(char **buf)
1977{
1978 size_t ret;
1979 char *tmp = skip_spaces(*buf);
1980 ret = tmp - *buf;
1981 *buf = tmp;
1982 return ret;
1983}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001984
Octavian Purdila9f977fb2010-05-05 00:26:55 +00001985static void proc_skip_char(char **buf, size_t *size, const char v)
1986{
1987 while (*size) {
1988 if (**buf != v)
1989 break;
1990 (*size)--;
1991 (*buf)++;
1992 }
1993}
1994
Amerigo Wang00b7c332010-05-05 00:26:45 +00001995#define TMPBUFLEN 22
1996/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001997 * proc_get_long - reads an ASCII formatted integer from a user buffer
Amerigo Wang00b7c332010-05-05 00:26:45 +00001998 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001999 * @buf: a kernel buffer
2000 * @size: size of the kernel buffer
2001 * @val: this is where the number will be stored
2002 * @neg: set to %TRUE if number is negative
2003 * @perm_tr: a vector which contains the allowed trailers
2004 * @perm_tr_len: size of the perm_tr vector
2005 * @tr: pointer to store the trailer character
Amerigo Wang00b7c332010-05-05 00:26:45 +00002006 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07002007 * In case of success %0 is returned and @buf and @size are updated with
2008 * the amount of bytes read. If @tr is non-NULL and a trailing
2009 * character exists (size is non-zero after returning from this
2010 * function), @tr is updated with the trailing character.
Amerigo Wang00b7c332010-05-05 00:26:45 +00002011 */
2012static int proc_get_long(char **buf, size_t *size,
2013 unsigned long *val, bool *neg,
2014 const char *perm_tr, unsigned perm_tr_len, char *tr)
2015{
2016 int len;
2017 char *p, tmp[TMPBUFLEN];
2018
2019 if (!*size)
2020 return -EINVAL;
2021
2022 len = *size;
2023 if (len > TMPBUFLEN - 1)
2024 len = TMPBUFLEN - 1;
2025
2026 memcpy(tmp, *buf, len);
2027
2028 tmp[len] = 0;
2029 p = tmp;
2030 if (*p == '-' && *size > 1) {
2031 *neg = true;
2032 p++;
2033 } else
2034 *neg = false;
2035 if (!isdigit(*p))
2036 return -EINVAL;
2037
2038 *val = simple_strtoul(p, &p, 0);
2039
2040 len = p - tmp;
2041
2042 /* We don't know if the next char is whitespace thus we may accept
2043 * invalid integers (e.g. 1234...a) or two integers instead of one
2044 * (e.g. 123...1). So lets not allow such large numbers. */
2045 if (len == TMPBUFLEN - 1)
2046 return -EINVAL;
2047
2048 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
2049 return -EINVAL;
2050
2051 if (tr && (len < *size))
2052 *tr = *p;
2053
2054 *buf += len;
2055 *size -= len;
2056
2057 return 0;
2058}
2059
2060/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07002061 * proc_put_long - converts an integer to a decimal ASCII formatted string
Amerigo Wang00b7c332010-05-05 00:26:45 +00002062 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07002063 * @buf: the user buffer
2064 * @size: the size of the user buffer
2065 * @val: the integer to be converted
2066 * @neg: sign of the number, %TRUE for negative
Amerigo Wang00b7c332010-05-05 00:26:45 +00002067 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07002068 * In case of success %0 is returned and @buf and @size are updated with
2069 * the amount of bytes written.
Amerigo Wang00b7c332010-05-05 00:26:45 +00002070 */
2071static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
2072 bool neg)
2073{
2074 int len;
2075 char tmp[TMPBUFLEN], *p = tmp;
2076
2077 sprintf(p, "%s%lu", neg ? "-" : "", val);
2078 len = strlen(tmp);
2079 if (len > *size)
2080 len = *size;
2081 if (copy_to_user(*buf, tmp, len))
2082 return -EFAULT;
2083 *size -= len;
2084 *buf += len;
2085 return 0;
2086}
2087#undef TMPBUFLEN
2088
2089static int proc_put_char(void __user **buf, size_t *size, char c)
2090{
2091 if (*size) {
2092 char __user **buffer = (char __user **)buf;
2093 if (put_user(c, *buffer))
2094 return -EFAULT;
2095 (*size)--, (*buffer)++;
2096 *buf = *buffer;
2097 }
2098 return 0;
2099}
2100
2101static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002102 int *valp,
2103 int write, void *data)
2104{
2105 if (write) {
Heinrich Schuchardt230633d2015-04-16 12:48:07 -07002106 if (*negp) {
2107 if (*lvalp > (unsigned long) INT_MAX + 1)
2108 return -EINVAL;
2109 *valp = -*lvalp;
2110 } else {
2111 if (*lvalp > (unsigned long) INT_MAX)
2112 return -EINVAL;
2113 *valp = *lvalp;
2114 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002115 } else {
2116 int val = *valp;
2117 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002118 *negp = true;
Ilya Dryomov9a5bc722015-09-09 15:39:06 -07002119 *lvalp = -(unsigned long)val;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002120 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002121 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002122 *lvalp = (unsigned long)val;
2123 }
2124 }
2125 return 0;
2126}
2127
Subash Abhinov Kasiviswanathane7d316a2016-08-25 15:16:51 -07002128static int do_proc_douintvec_conv(bool *negp, unsigned long *lvalp,
2129 int *valp,
2130 int write, void *data)
2131{
2132 if (write) {
2133 if (*negp)
2134 return -EINVAL;
2135 *valp = *lvalp;
2136 } else {
2137 unsigned int val = *valp;
2138 *lvalp = (unsigned long)val;
2139 }
2140 return 0;
2141}
2142
Amerigo Wang00b7c332010-05-05 00:26:45 +00002143static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
2144
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002145static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002146 int write, void __user *buffer,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002147 size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00002148 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002149 int write, void *data),
2150 void *data)
2151{
Amerigo Wang00b7c332010-05-05 00:26:45 +00002152 int *i, vleft, first = 1, err = 0;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002153 size_t left;
Al Viro70f6cbb2015-12-24 00:13:10 -05002154 char *kbuf = NULL, *p;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002155
Amerigo Wang00b7c332010-05-05 00:26:45 +00002156 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002157 *lenp = 0;
2158 return 0;
2159 }
2160
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002161 i = (int *) tbl_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002162 vleft = table->maxlen / sizeof(*i);
2163 left = *lenp;
2164
2165 if (!conv)
2166 conv = do_proc_dointvec_conv;
2167
Linus Torvalds1da177e2005-04-16 15:20:36 -07002168 if (write) {
Kees Cookf4aacea2014-06-06 14:37:19 -07002169 if (*ppos) {
2170 switch (sysctl_writes_strict) {
2171 case SYSCTL_WRITES_STRICT:
2172 goto out;
2173 case SYSCTL_WRITES_WARN:
2174 warn_sysctl_write(table);
2175 break;
2176 default:
2177 break;
2178 }
2179 }
2180
Amerigo Wang00b7c332010-05-05 00:26:45 +00002181 if (left > PAGE_SIZE - 1)
2182 left = PAGE_SIZE - 1;
Al Viro70f6cbb2015-12-24 00:13:10 -05002183 p = kbuf = memdup_user_nul(buffer, left);
2184 if (IS_ERR(kbuf))
2185 return PTR_ERR(kbuf);
Amerigo Wang00b7c332010-05-05 00:26:45 +00002186 }
2187
2188 for (; left && vleft--; i++, first=0) {
2189 unsigned long lval;
2190 bool neg;
2191
2192 if (write) {
Al Viro70f6cbb2015-12-24 00:13:10 -05002193 left -= proc_skip_spaces(&p);
Amerigo Wang00b7c332010-05-05 00:26:45 +00002194
J. R. Okajima563b0462010-05-25 16:10:14 -07002195 if (!left)
2196 break;
Al Viro70f6cbb2015-12-24 00:13:10 -05002197 err = proc_get_long(&p, &left, &lval, &neg,
Amerigo Wang00b7c332010-05-05 00:26:45 +00002198 proc_wspace_sep,
2199 sizeof(proc_wspace_sep), NULL);
2200 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002201 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002202 if (conv(&neg, &lval, i, 1, data)) {
2203 err = -EINVAL;
2204 break;
2205 }
2206 } else {
2207 if (conv(&neg, &lval, i, 0, data)) {
2208 err = -EINVAL;
2209 break;
2210 }
2211 if (!first)
2212 err = proc_put_char(&buffer, &left, '\t');
2213 if (err)
2214 break;
2215 err = proc_put_long(&buffer, &left, lval, neg);
2216 if (err)
2217 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002218 }
2219 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002220
2221 if (!write && !first && left && !err)
2222 err = proc_put_char(&buffer, &left, '\n');
J. R. Okajima563b0462010-05-25 16:10:14 -07002223 if (write && !err && left)
Al Viro70f6cbb2015-12-24 00:13:10 -05002224 left -= proc_skip_spaces(&p);
Amerigo Wang00b7c332010-05-05 00:26:45 +00002225 if (write) {
Al Viro70f6cbb2015-12-24 00:13:10 -05002226 kfree(kbuf);
Amerigo Wang00b7c332010-05-05 00:26:45 +00002227 if (first)
2228 return err ? : -EINVAL;
2229 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002230 *lenp -= left;
Kees Cookf4aacea2014-06-06 14:37:19 -07002231out:
Linus Torvalds1da177e2005-04-16 15:20:36 -07002232 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002233 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002234}
2235
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002236static int do_proc_dointvec(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002237 void __user *buffer, size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00002238 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002239 int write, void *data),
2240 void *data)
2241{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002242 return __do_proc_dointvec(table->data, table, write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002243 buffer, lenp, ppos, conv, data);
2244}
2245
Linus Torvalds1da177e2005-04-16 15:20:36 -07002246/**
2247 * proc_dointvec - read a vector of integers
2248 * @table: the sysctl table
2249 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002250 * @buffer: the user buffer
2251 * @lenp: the size of the user buffer
2252 * @ppos: file position
2253 *
2254 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2255 * values from/to the user buffer, treated as an ASCII string.
2256 *
2257 * Returns 0 on success.
2258 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002259int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002260 void __user *buffer, size_t *lenp, loff_t *ppos)
2261{
Subash Abhinov Kasiviswanathane7d316a2016-08-25 15:16:51 -07002262 return do_proc_dointvec(table, write, buffer, lenp, ppos, NULL, NULL);
2263}
2264
2265/**
2266 * proc_douintvec - read a vector of unsigned integers
2267 * @table: the sysctl table
2268 * @write: %TRUE if this is a write to the sysctl file
2269 * @buffer: the user buffer
2270 * @lenp: the size of the user buffer
2271 * @ppos: file position
2272 *
2273 * Reads/writes up to table->maxlen/sizeof(unsigned int) unsigned integer
2274 * values from/to the user buffer, treated as an ASCII string.
2275 *
2276 * Returns 0 on success.
2277 */
2278int proc_douintvec(struct ctl_table *table, int write,
2279 void __user *buffer, size_t *lenp, loff_t *ppos)
2280{
2281 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2282 do_proc_douintvec_conv, NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002283}
2284
Theodore Ts'o34f5a392007-02-10 01:45:24 -08002285/*
Andi Kleen25ddbb12008-10-15 22:01:41 -07002286 * Taint values can only be increased
2287 * This means we can safely use a temporary.
Theodore Ts'o34f5a392007-02-10 01:45:24 -08002288 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002289static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -08002290 void __user *buffer, size_t *lenp, loff_t *ppos)
2291{
Andi Kleen25ddbb12008-10-15 22:01:41 -07002292 struct ctl_table t;
2293 unsigned long tmptaint = get_taint();
2294 int err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08002295
Bastian Blank91fcd412007-04-23 14:41:14 -07002296 if (write && !capable(CAP_SYS_ADMIN))
Theodore Ts'o34f5a392007-02-10 01:45:24 -08002297 return -EPERM;
2298
Andi Kleen25ddbb12008-10-15 22:01:41 -07002299 t = *table;
2300 t.data = &tmptaint;
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002301 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
Andi Kleen25ddbb12008-10-15 22:01:41 -07002302 if (err < 0)
2303 return err;
2304
2305 if (write) {
2306 /*
2307 * Poor man's atomic or. Not worth adding a primitive
2308 * to everyone's atomic.h for this
2309 */
2310 int i;
2311 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
2312 if ((tmptaint >> i) & 1)
Rusty Russell373d4d02013-01-21 17:17:39 +10302313 add_taint(i, LOCKDEP_STILL_OK);
Andi Kleen25ddbb12008-10-15 22:01:41 -07002314 }
2315 }
2316
2317 return err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08002318}
2319
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07002320#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -07002321static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07002322 void __user *buffer, size_t *lenp, loff_t *ppos)
2323{
2324 if (write && !capable(CAP_SYS_ADMIN))
2325 return -EPERM;
2326
2327 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
2328}
2329#endif
2330
Linus Torvalds1da177e2005-04-16 15:20:36 -07002331struct do_proc_dointvec_minmax_conv_param {
2332 int *min;
2333 int *max;
2334};
2335
Amerigo Wang00b7c332010-05-05 00:26:45 +00002336static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
2337 int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002338 int write, void *data)
2339{
2340 struct do_proc_dointvec_minmax_conv_param *param = data;
2341 if (write) {
2342 int val = *negp ? -*lvalp : *lvalp;
2343 if ((param->min && *param->min > val) ||
2344 (param->max && *param->max < val))
2345 return -EINVAL;
2346 *valp = val;
2347 } else {
2348 int val = *valp;
2349 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002350 *negp = true;
Ilya Dryomov9a5bc722015-09-09 15:39:06 -07002351 *lvalp = -(unsigned long)val;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002352 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002353 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002354 *lvalp = (unsigned long)val;
2355 }
2356 }
2357 return 0;
2358}
2359
2360/**
2361 * proc_dointvec_minmax - read a vector of integers with min/max values
2362 * @table: the sysctl table
2363 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002364 * @buffer: the user buffer
2365 * @lenp: the size of the user buffer
2366 * @ppos: file position
2367 *
2368 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2369 * values from/to the user buffer, treated as an ASCII string.
2370 *
2371 * This routine will ensure the values are within the range specified by
2372 * table->extra1 (min) and table->extra2 (max).
2373 *
2374 * Returns 0 on success.
2375 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002376int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002377 void __user *buffer, size_t *lenp, loff_t *ppos)
2378{
2379 struct do_proc_dointvec_minmax_conv_param param = {
2380 .min = (int *) table->extra1,
2381 .max = (int *) table->extra2,
2382 };
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002383 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002384 do_proc_dointvec_minmax_conv, &param);
2385}
2386
Kees Cook54b50192012-07-30 14:39:18 -07002387static void validate_coredump_safety(void)
2388{
Alex Kelly046d6622012-10-04 17:15:23 -07002389#ifdef CONFIG_COREDUMP
Kees Cooke579d2c2013-02-27 17:03:15 -08002390 if (suid_dumpable == SUID_DUMP_ROOT &&
Kees Cook54b50192012-07-30 14:39:18 -07002391 core_pattern[0] != '/' && core_pattern[0] != '|') {
Alexey Dobriyan760c6a92016-12-14 15:04:14 -08002392 printk(KERN_WARNING
2393"Unsafe core_pattern used with fs.suid_dumpable=2.\n"
2394"Pipe handler or fully qualified core dump path required.\n"
2395"Set kernel.core_pattern before fs.suid_dumpable.\n"
2396 );
Kees Cook54b50192012-07-30 14:39:18 -07002397 }
Alex Kelly046d6622012-10-04 17:15:23 -07002398#endif
Kees Cook54b50192012-07-30 14:39:18 -07002399}
2400
2401static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
2402 void __user *buffer, size_t *lenp, loff_t *ppos)
2403{
2404 int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
2405 if (!error)
2406 validate_coredump_safety();
2407 return error;
2408}
2409
Alex Kelly046d6622012-10-04 17:15:23 -07002410#ifdef CONFIG_COREDUMP
Kees Cook54b50192012-07-30 14:39:18 -07002411static int proc_dostring_coredump(struct ctl_table *table, int write,
2412 void __user *buffer, size_t *lenp, loff_t *ppos)
2413{
2414 int error = proc_dostring(table, write, buffer, lenp, ppos);
2415 if (!error)
2416 validate_coredump_safety();
2417 return error;
2418}
Alex Kelly046d6622012-10-04 17:15:23 -07002419#endif
Kees Cook54b50192012-07-30 14:39:18 -07002420
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002421static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002422 void __user *buffer,
2423 size_t *lenp, loff_t *ppos,
2424 unsigned long convmul,
2425 unsigned long convdiv)
2426{
Amerigo Wang00b7c332010-05-05 00:26:45 +00002427 unsigned long *i, *min, *max;
2428 int vleft, first = 1, err = 0;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002429 size_t left;
Al Viro70f6cbb2015-12-24 00:13:10 -05002430 char *kbuf = NULL, *p;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002431
2432 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002433 *lenp = 0;
2434 return 0;
2435 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002436
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002437 i = (unsigned long *) data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002438 min = (unsigned long *) table->extra1;
2439 max = (unsigned long *) table->extra2;
2440 vleft = table->maxlen / sizeof(unsigned long);
2441 left = *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002442
2443 if (write) {
Kees Cookf4aacea2014-06-06 14:37:19 -07002444 if (*ppos) {
2445 switch (sysctl_writes_strict) {
2446 case SYSCTL_WRITES_STRICT:
2447 goto out;
2448 case SYSCTL_WRITES_WARN:
2449 warn_sysctl_write(table);
2450 break;
2451 default:
2452 break;
2453 }
2454 }
2455
Amerigo Wang00b7c332010-05-05 00:26:45 +00002456 if (left > PAGE_SIZE - 1)
2457 left = PAGE_SIZE - 1;
Al Viro70f6cbb2015-12-24 00:13:10 -05002458 p = kbuf = memdup_user_nul(buffer, left);
2459 if (IS_ERR(kbuf))
2460 return PTR_ERR(kbuf);
Amerigo Wang00b7c332010-05-05 00:26:45 +00002461 }
2462
Eric Dumazet27b3d802010-10-07 12:59:29 -07002463 for (; left && vleft--; i++, first = 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002464 unsigned long val;
2465
Linus Torvalds1da177e2005-04-16 15:20:36 -07002466 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002467 bool neg;
2468
Al Viro70f6cbb2015-12-24 00:13:10 -05002469 left -= proc_skip_spaces(&p);
Amerigo Wang00b7c332010-05-05 00:26:45 +00002470
Al Viro70f6cbb2015-12-24 00:13:10 -05002471 err = proc_get_long(&p, &left, &val, &neg,
Amerigo Wang00b7c332010-05-05 00:26:45 +00002472 proc_wspace_sep,
2473 sizeof(proc_wspace_sep), NULL);
2474 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002475 break;
2476 if (neg)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002477 continue;
2478 if ((min && val < *min) || (max && val > *max))
2479 continue;
2480 *i = val;
2481 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002482 val = convdiv * (*i) / convmul;
Chen Gang78338192013-11-12 15:11:21 -08002483 if (!first) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002484 err = proc_put_char(&buffer, &left, '\t');
Chen Gang78338192013-11-12 15:11:21 -08002485 if (err)
2486 break;
2487 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002488 err = proc_put_long(&buffer, &left, val, false);
2489 if (err)
2490 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002491 }
2492 }
2493
Amerigo Wang00b7c332010-05-05 00:26:45 +00002494 if (!write && !first && left && !err)
2495 err = proc_put_char(&buffer, &left, '\n');
2496 if (write && !err)
Al Viro70f6cbb2015-12-24 00:13:10 -05002497 left -= proc_skip_spaces(&p);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002498 if (write) {
Al Viro70f6cbb2015-12-24 00:13:10 -05002499 kfree(kbuf);
Amerigo Wang00b7c332010-05-05 00:26:45 +00002500 if (first)
2501 return err ? : -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002502 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002503 *lenp -= left;
Kees Cookf4aacea2014-06-06 14:37:19 -07002504out:
Linus Torvalds1da177e2005-04-16 15:20:36 -07002505 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002506 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002507}
2508
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002509static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002510 void __user *buffer,
2511 size_t *lenp, loff_t *ppos,
2512 unsigned long convmul,
2513 unsigned long convdiv)
2514{
2515 return __do_proc_doulongvec_minmax(table->data, table, write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002516 buffer, lenp, ppos, convmul, convdiv);
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002517}
2518
Linus Torvalds1da177e2005-04-16 15:20:36 -07002519/**
2520 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2521 * @table: the sysctl table
2522 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002523 * @buffer: the user buffer
2524 * @lenp: the size of the user buffer
2525 * @ppos: file position
2526 *
2527 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2528 * values from/to the user buffer, treated as an ASCII string.
2529 *
2530 * This routine will ensure the values are within the range specified by
2531 * table->extra1 (min) and table->extra2 (max).
2532 *
2533 * Returns 0 on success.
2534 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002535int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002536 void __user *buffer, size_t *lenp, loff_t *ppos)
2537{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002538 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002539}
2540
2541/**
2542 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2543 * @table: the sysctl table
2544 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002545 * @buffer: the user buffer
2546 * @lenp: the size of the user buffer
2547 * @ppos: file position
2548 *
2549 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2550 * values from/to the user buffer, treated as an ASCII string. The values
2551 * are treated as milliseconds, and converted to jiffies when they are stored.
2552 *
2553 * This routine will ensure the values are within the range specified by
2554 * table->extra1 (min) and table->extra2 (max).
2555 *
2556 * Returns 0 on success.
2557 */
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002558int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002559 void __user *buffer,
2560 size_t *lenp, loff_t *ppos)
2561{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002562 return do_proc_doulongvec_minmax(table, write, buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002563 lenp, ppos, HZ, 1000l);
2564}
2565
2566
Amerigo Wang00b7c332010-05-05 00:26:45 +00002567static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002568 int *valp,
2569 int write, void *data)
2570{
2571 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002572 if (*lvalp > LONG_MAX / HZ)
2573 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002574 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2575 } else {
2576 int val = *valp;
2577 unsigned long lval;
2578 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002579 *negp = true;
Ilya Dryomov9a5bc722015-09-09 15:39:06 -07002580 lval = -(unsigned long)val;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002581 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002582 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002583 lval = (unsigned long)val;
2584 }
2585 *lvalp = lval / HZ;
2586 }
2587 return 0;
2588}
2589
Amerigo Wang00b7c332010-05-05 00:26:45 +00002590static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002591 int *valp,
2592 int write, void *data)
2593{
2594 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002595 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2596 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002597 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2598 } else {
2599 int val = *valp;
2600 unsigned long lval;
2601 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002602 *negp = true;
Ilya Dryomov9a5bc722015-09-09 15:39:06 -07002603 lval = -(unsigned long)val;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002604 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002605 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002606 lval = (unsigned long)val;
2607 }
2608 *lvalp = jiffies_to_clock_t(lval);
2609 }
2610 return 0;
2611}
2612
Amerigo Wang00b7c332010-05-05 00:26:45 +00002613static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002614 int *valp,
2615 int write, void *data)
2616{
2617 if (write) {
Francesco Fuscod738ce82013-07-24 10:39:07 +02002618 unsigned long jif = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2619
2620 if (jif > INT_MAX)
2621 return 1;
2622 *valp = (int)jif;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002623 } else {
2624 int val = *valp;
2625 unsigned long lval;
2626 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002627 *negp = true;
Ilya Dryomov9a5bc722015-09-09 15:39:06 -07002628 lval = -(unsigned long)val;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002629 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002630 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002631 lval = (unsigned long)val;
2632 }
2633 *lvalp = jiffies_to_msecs(lval);
2634 }
2635 return 0;
2636}
2637
2638/**
2639 * proc_dointvec_jiffies - read a vector of integers as seconds
2640 * @table: the sysctl table
2641 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002642 * @buffer: the user buffer
2643 * @lenp: the size of the user buffer
2644 * @ppos: file position
2645 *
2646 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2647 * values from/to the user buffer, treated as an ASCII string.
2648 * The values read are assumed to be in seconds, and are converted into
2649 * jiffies.
2650 *
2651 * Returns 0 on success.
2652 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002653int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002654 void __user *buffer, size_t *lenp, loff_t *ppos)
2655{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002656 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002657 do_proc_dointvec_jiffies_conv,NULL);
2658}
2659
2660/**
2661 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2662 * @table: the sysctl table
2663 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002664 * @buffer: the user buffer
2665 * @lenp: the size of the user buffer
Randy Dunlap1e5d5332005-11-07 01:01:06 -08002666 * @ppos: pointer to the file position
Linus Torvalds1da177e2005-04-16 15:20:36 -07002667 *
2668 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2669 * values from/to the user buffer, treated as an ASCII string.
2670 * The values read are assumed to be in 1/USER_HZ seconds, and
2671 * are converted into jiffies.
2672 *
2673 * Returns 0 on success.
2674 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002675int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002676 void __user *buffer, size_t *lenp, loff_t *ppos)
2677{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002678 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002679 do_proc_dointvec_userhz_jiffies_conv,NULL);
2680}
2681
2682/**
2683 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2684 * @table: the sysctl table
2685 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002686 * @buffer: the user buffer
2687 * @lenp: the size of the user buffer
Martin Waitz67be2dd2005-05-01 08:59:26 -07002688 * @ppos: file position
2689 * @ppos: the current position in the file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002690 *
2691 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2692 * values from/to the user buffer, treated as an ASCII string.
2693 * The values read are assumed to be in 1/1000 seconds, and
2694 * are converted into jiffies.
2695 *
2696 * Returns 0 on success.
2697 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002698int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002699 void __user *buffer, size_t *lenp, loff_t *ppos)
2700{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002701 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002702 do_proc_dointvec_ms_jiffies_conv, NULL);
2703}
2704
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002705static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002706 void __user *buffer, size_t *lenp, loff_t *ppos)
2707{
2708 struct pid *new_pid;
2709 pid_t tmp;
2710 int r;
2711
Pavel Emelyanov6c5f3e72008-02-08 04:19:20 -08002712 tmp = pid_vnr(cad_pid);
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002713
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002714 r = __do_proc_dointvec(&tmp, table, write, buffer,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002715 lenp, ppos, NULL, NULL);
2716 if (r || !write)
2717 return r;
2718
2719 new_pid = find_get_pid(tmp);
2720 if (!new_pid)
2721 return -ESRCH;
2722
2723 put_pid(xchg(&cad_pid, new_pid));
2724 return 0;
2725}
2726
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002727/**
2728 * proc_do_large_bitmap - read/write from/to a large bitmap
2729 * @table: the sysctl table
2730 * @write: %TRUE if this is a write to the sysctl file
2731 * @buffer: the user buffer
2732 * @lenp: the size of the user buffer
2733 * @ppos: file position
2734 *
2735 * The bitmap is stored at table->data and the bitmap length (in bits)
2736 * in table->maxlen.
2737 *
2738 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2739 * large bitmaps may be represented in a compact manner. Writing into
2740 * the file will clear the bitmap then update it with the given input.
2741 *
2742 * Returns 0 on success.
2743 */
2744int proc_do_large_bitmap(struct ctl_table *table, int write,
2745 void __user *buffer, size_t *lenp, loff_t *ppos)
2746{
2747 int err = 0;
2748 bool first = 1;
2749 size_t left = *lenp;
2750 unsigned long bitmap_len = table->maxlen;
WANG Cong122ff242014-05-12 16:04:53 -07002751 unsigned long *bitmap = *(unsigned long **) table->data;
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002752 unsigned long *tmp_bitmap = NULL;
2753 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2754
WANG Cong122ff242014-05-12 16:04:53 -07002755 if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002756 *lenp = 0;
2757 return 0;
2758 }
2759
2760 if (write) {
Al Viro70f6cbb2015-12-24 00:13:10 -05002761 char *kbuf, *p;
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002762
2763 if (left > PAGE_SIZE - 1)
2764 left = PAGE_SIZE - 1;
2765
Al Viro70f6cbb2015-12-24 00:13:10 -05002766 p = kbuf = memdup_user_nul(buffer, left);
2767 if (IS_ERR(kbuf))
2768 return PTR_ERR(kbuf);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002769
2770 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2771 GFP_KERNEL);
2772 if (!tmp_bitmap) {
Al Viro70f6cbb2015-12-24 00:13:10 -05002773 kfree(kbuf);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002774 return -ENOMEM;
2775 }
Al Viro70f6cbb2015-12-24 00:13:10 -05002776 proc_skip_char(&p, &left, '\n');
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002777 while (!err && left) {
2778 unsigned long val_a, val_b;
2779 bool neg;
2780
Al Viro70f6cbb2015-12-24 00:13:10 -05002781 err = proc_get_long(&p, &left, &val_a, &neg, tr_a,
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002782 sizeof(tr_a), &c);
2783 if (err)
2784 break;
2785 if (val_a >= bitmap_len || neg) {
2786 err = -EINVAL;
2787 break;
2788 }
2789
2790 val_b = val_a;
2791 if (left) {
Al Viro70f6cbb2015-12-24 00:13:10 -05002792 p++;
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002793 left--;
2794 }
2795
2796 if (c == '-') {
Al Viro70f6cbb2015-12-24 00:13:10 -05002797 err = proc_get_long(&p, &left, &val_b,
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002798 &neg, tr_b, sizeof(tr_b),
2799 &c);
2800 if (err)
2801 break;
2802 if (val_b >= bitmap_len || neg ||
2803 val_a > val_b) {
2804 err = -EINVAL;
2805 break;
2806 }
2807 if (left) {
Al Viro70f6cbb2015-12-24 00:13:10 -05002808 p++;
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002809 left--;
2810 }
2811 }
2812
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002813 bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002814 first = 0;
Al Viro70f6cbb2015-12-24 00:13:10 -05002815 proc_skip_char(&p, &left, '\n');
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002816 }
Al Viro70f6cbb2015-12-24 00:13:10 -05002817 kfree(kbuf);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002818 } else {
2819 unsigned long bit_a, bit_b = 0;
2820
2821 while (left) {
2822 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2823 if (bit_a >= bitmap_len)
2824 break;
2825 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2826 bit_a + 1) - 1;
2827
2828 if (!first) {
2829 err = proc_put_char(&buffer, &left, ',');
2830 if (err)
2831 break;
2832 }
2833 err = proc_put_long(&buffer, &left, bit_a, false);
2834 if (err)
2835 break;
2836 if (bit_a != bit_b) {
2837 err = proc_put_char(&buffer, &left, '-');
2838 if (err)
2839 break;
2840 err = proc_put_long(&buffer, &left, bit_b, false);
2841 if (err)
2842 break;
2843 }
2844
2845 first = 0; bit_b++;
2846 }
2847 if (!err)
2848 err = proc_put_char(&buffer, &left, '\n');
2849 }
2850
2851 if (!err) {
2852 if (write) {
2853 if (*ppos)
2854 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2855 else
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002856 bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002857 }
2858 kfree(tmp_bitmap);
2859 *lenp -= left;
2860 *ppos += *lenp;
2861 return 0;
2862 } else {
2863 kfree(tmp_bitmap);
2864 return err;
2865 }
2866}
2867
Jovi Zhang55610502011-01-12 17:00:45 -08002868#else /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002869
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002870int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002871 void __user *buffer, size_t *lenp, loff_t *ppos)
2872{
2873 return -ENOSYS;
2874}
2875
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002876int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002877 void __user *buffer, size_t *lenp, loff_t *ppos)
2878{
2879 return -ENOSYS;
2880}
2881
Subash Abhinov Kasiviswanathane7d316a2016-08-25 15:16:51 -07002882int proc_douintvec(struct ctl_table *table, int write,
2883 void __user *buffer, size_t *lenp, loff_t *ppos)
2884{
2885 return -ENOSYS;
2886}
2887
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002888int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002889 void __user *buffer, size_t *lenp, loff_t *ppos)
2890{
2891 return -ENOSYS;
2892}
2893
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002894int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002895 void __user *buffer, size_t *lenp, loff_t *ppos)
2896{
2897 return -ENOSYS;
2898}
2899
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002900int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002901 void __user *buffer, size_t *lenp, loff_t *ppos)
2902{
2903 return -ENOSYS;
2904}
2905
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002906int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002907 void __user *buffer, size_t *lenp, loff_t *ppos)
2908{
2909 return -ENOSYS;
2910}
2911
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002912int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002913 void __user *buffer, size_t *lenp, loff_t *ppos)
2914{
2915 return -ENOSYS;
2916}
2917
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002918int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002919 void __user *buffer,
2920 size_t *lenp, loff_t *ppos)
2921{
2922 return -ENOSYS;
2923}
2924
2925
Jovi Zhang55610502011-01-12 17:00:45 -08002926#endif /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002927
Linus Torvalds1da177e2005-04-16 15:20:36 -07002928/*
2929 * No sense putting this after each symbol definition, twice,
2930 * exception granted :-)
2931 */
2932EXPORT_SYMBOL(proc_dointvec);
Subash Abhinov Kasiviswanathane7d316a2016-08-25 15:16:51 -07002933EXPORT_SYMBOL(proc_douintvec);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002934EXPORT_SYMBOL(proc_dointvec_jiffies);
2935EXPORT_SYMBOL(proc_dointvec_minmax);
2936EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2937EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2938EXPORT_SYMBOL(proc_dostring);
2939EXPORT_SYMBOL(proc_doulongvec_minmax);
2940EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);