Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | #include <linux/module.h> |
Christoph Hellwig | e2e40f2 | 2015-02-22 08:58:50 -0800 | [diff] [blame] | 22 | #include <linux/aio.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | #include <linux/mm.h> |
| 24 | #include <linux/swap.h> |
| 25 | #include <linux/slab.h> |
| 26 | #include <linux/sysctl.h> |
Akinobu Mita | 5a04cca | 2012-03-28 14:42:50 -0700 | [diff] [blame] | 27 | #include <linux/bitmap.h> |
Dave Young | d33ed52 | 2010-03-10 15:23:59 -0800 | [diff] [blame] | 28 | #include <linux/signal.h> |
Dan Rosenberg | 455cd5a | 2011-01-12 16:59:41 -0800 | [diff] [blame] | 29 | #include <linux/printk.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | #include <linux/proc_fs.h> |
Andrew Morgan | 72c2d58 | 2007-10-18 03:05:59 -0700 | [diff] [blame] | 31 | #include <linux/security.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #include <linux/ctype.h> |
Vegard Nossum | dfec072 | 2008-04-04 00:51:41 +0200 | [diff] [blame] | 33 | #include <linux/kmemcheck.h> |
Steven Rostedt | fd4b616 | 2012-07-30 14:42:48 -0700 | [diff] [blame] | 34 | #include <linux/kmemleak.h> |
Adrian Bunk | 62239ac | 2007-07-17 04:03:45 -0700 | [diff] [blame] | 35 | #include <linux/fs.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | #include <linux/init.h> |
| 37 | #include <linux/kernel.h> |
Kay Sievers | 0296b22 | 2005-11-11 05:33:52 +0100 | [diff] [blame] | 38 | #include <linux/kobject.h> |
Arnaldo Carvalho de Melo | 2038073 | 2005-08-16 02:18:02 -0300 | [diff] [blame] | 39 | #include <linux/net.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | #include <linux/sysrq.h> |
| 41 | #include <linux/highuid.h> |
| 42 | #include <linux/writeback.h> |
Ingo Molnar | 3fff4c4 | 2009-09-22 16:18:09 +0200 | [diff] [blame] | 43 | #include <linux/ratelimit.h> |
Mel Gorman | 76ab0f5 | 2010-05-24 14:32:28 -0700 | [diff] [blame] | 44 | #include <linux/compaction.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | #include <linux/hugetlb.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | #include <linux/initrd.h> |
David Howells | 0b77f5b | 2008-04-29 01:01:32 -0700 | [diff] [blame] | 47 | #include <linux/key.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | #include <linux/times.h> |
| 49 | #include <linux/limits.h> |
| 50 | #include <linux/dcache.h> |
Alexey Dobriyan | 6e00670 | 2010-01-20 22:27:56 +0200 | [diff] [blame] | 51 | #include <linux/dnotify.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | #include <linux/syscalls.h> |
Adrian Bunk | c748e13 | 2008-07-23 21:27:03 -0700 | [diff] [blame] | 53 | #include <linux/vmstat.h> |
Pavel Machek | c255d84 | 2006-02-20 18:27:58 -0800 | [diff] [blame] | 54 | #include <linux/nfs_fs.h> |
| 55 | #include <linux/acpi.h> |
Jeremy Fitzhardinge | 10a0a8d | 2007-07-17 18:37:02 -0700 | [diff] [blame] | 56 | #include <linux/reboot.h> |
Steven Rostedt | b0fc494 | 2008-05-12 21:20:43 +0200 | [diff] [blame] | 57 | #include <linux/ftrace.h> |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 58 | #include <linux/perf_event.h> |
Masami Hiramatsu | b2be84d | 2010-02-25 08:34:15 -0500 | [diff] [blame] | 59 | #include <linux/kprobes.h> |
Jens Axboe | b492e95 | 2010-05-19 21:03:16 +0200 | [diff] [blame] | 60 | #include <linux/pipe_fs_i.h> |
David Rientjes | 8e4228e | 2010-08-09 17:18:56 -0700 | [diff] [blame] | 61 | #include <linux/oom.h> |
Eric Paris | 17f60a7 | 2011-04-01 17:07:50 -0400 | [diff] [blame] | 62 | #include <linux/kmod.h> |
Dan Ballard | 73efc03 | 2011-10-31 17:11:20 -0700 | [diff] [blame] | 63 | #include <linux/capability.h> |
Al Viro | 4040153 | 2012-02-13 03:58:52 +0000 | [diff] [blame] | 64 | #include <linux/binfmts.h> |
Clark Williams | cf4aebc2 | 2013-02-07 09:46:59 -0600 | [diff] [blame] | 65 | #include <linux/sched/sysctl.h> |
Kees Cook | 7984754 | 2014-01-23 15:55:59 -0800 | [diff] [blame] | 66 | #include <linux/kexec.h> |
Alexei Starovoitov | 1be7f75 | 2015-10-07 22:23:21 -0700 | [diff] [blame] | 67 | #include <linux/bpf.h> |
Eric W. Biederman | d292168 | 2016-09-28 00:27:17 -0500 | [diff] [blame] | 68 | #include <linux/mount.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | |
| 70 | #include <asm/uaccess.h> |
| 71 | #include <asm/processor.h> |
| 72 | |
Andi Kleen | 29cbc78 | 2006-09-30 01:47:55 +0200 | [diff] [blame] | 73 | #ifdef CONFIG_X86 |
| 74 | #include <asm/nmi.h> |
Chuck Ebbert | 0741f4d | 2006-12-07 02:14:11 +0100 | [diff] [blame] | 75 | #include <asm/stacktrace.h> |
Ingo Molnar | 6e7c402 | 2008-01-30 13:30:05 +0100 | [diff] [blame] | 76 | #include <asm/io.h> |
Andi Kleen | 29cbc78 | 2006-09-30 01:47:55 +0200 | [diff] [blame] | 77 | #endif |
David Howells | d550bbd | 2012-03-28 18:30:03 +0100 | [diff] [blame] | 78 | #ifdef CONFIG_SPARC |
| 79 | #include <asm/setup.h> |
| 80 | #endif |
Dave Young | c55b7c3 | 2010-03-10 15:24:08 -0800 | [diff] [blame] | 81 | #ifdef CONFIG_BSD_PROCESS_ACCT |
| 82 | #include <linux/acct.h> |
| 83 | #endif |
Dave Young | 4f0e056 | 2010-03-10 15:24:09 -0800 | [diff] [blame] | 84 | #ifdef CONFIG_RT_MUTEXES |
| 85 | #include <linux/rtmutex.h> |
| 86 | #endif |
Dave Young | 2edf5e4 | 2010-03-10 15:24:10 -0800 | [diff] [blame] | 87 | #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT) |
| 88 | #include <linux/lockdep.h> |
| 89 | #endif |
Dave Young | 15485a4 | 2010-03-10 15:24:07 -0800 | [diff] [blame] | 90 | #ifdef CONFIG_CHR_DEV_SG |
| 91 | #include <scsi/sg.h> |
| 92 | #endif |
Andi Kleen | 29cbc78 | 2006-09-30 01:47:55 +0200 | [diff] [blame] | 93 | |
Don Zickus | 58687ac | 2010-05-07 17:11:44 -0400 | [diff] [blame] | 94 | #ifdef CONFIG_LOCKUP_DETECTOR |
Don Zickus | 504d7cf | 2010-02-12 17:19:19 -0500 | [diff] [blame] | 95 | #include <linux/nmi.h> |
| 96 | #endif |
| 97 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | #if defined(CONFIG_SYSCTL) |
| 99 | |
| 100 | /* External variables not in a header file. */ |
Alan Cox | d6e7114 | 2005-06-23 00:09:43 -0700 | [diff] [blame] | 101 | extern int suid_dumpable; |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 102 | #ifdef CONFIG_COREDUMP |
| 103 | extern int core_uses_pid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | extern char core_pattern[]; |
Neil Horman | a293980 | 2009-09-23 15:56:56 -0700 | [diff] [blame] | 105 | extern unsigned int core_pipe_limit; |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 106 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | extern int pid_max; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | extern int pid_max_min, pid_max_max; |
Rohit Seth | 8ad4b1f | 2006-01-08 01:00:40 -0800 | [diff] [blame] | 109 | extern int percpu_pagelist_fraction; |
Arjan van de Ven | 9745512 | 2008-01-25 21:08:34 +0100 | [diff] [blame] | 110 | extern int latencytop_enabled; |
Alexey Dobriyan | 9b80a18 | 2016-09-02 00:38:52 +0300 | [diff] [blame] | 111 | extern unsigned int sysctl_nr_open_min, sysctl_nr_open_max; |
Paul Mundt | dd8632a | 2009-01-08 12:04:47 +0000 | [diff] [blame] | 112 | #ifndef CONFIG_MMU |
| 113 | extern int sysctl_nr_trim_pages; |
| 114 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | |
Ravikiran G Thirumalai | c4f3b63 | 2007-10-16 23:26:09 -0700 | [diff] [blame] | 116 | /* Constants used for minimum and maximum */ |
Don Zickus | 2508ce1 | 2010-05-07 17:11:46 -0400 | [diff] [blame] | 117 | #ifdef CONFIG_LOCKUP_DETECTOR |
Ravikiran G Thirumalai | c4f3b63 | 2007-10-16 23:26:09 -0700 | [diff] [blame] | 118 | static int sixty = 60; |
| 119 | #endif |
| 120 | |
Aaron Tomlin | 270750db | 2014-01-20 17:34:13 +0000 | [diff] [blame] | 121 | static int __maybe_unused neg_one = -1; |
| 122 | |
Ravikiran G Thirumalai | c4f3b63 | 2007-10-16 23:26:09 -0700 | [diff] [blame] | 123 | static int zero; |
Linus Torvalds | cd5f9a4 | 2009-04-06 13:38:46 -0700 | [diff] [blame] | 124 | static int __maybe_unused one = 1; |
| 125 | static int __maybe_unused two = 2; |
Dave Hansen | 5509a5d | 2014-04-03 14:48:19 -0700 | [diff] [blame] | 126 | static int __maybe_unused four = 4; |
Sven Wegener | fc3501d | 2009-02-11 13:04:23 -0800 | [diff] [blame] | 127 | static unsigned long one_ul = 1; |
Ravikiran G Thirumalai | c4f3b63 | 2007-10-16 23:26:09 -0700 | [diff] [blame] | 128 | static int one_hundred = 100; |
Johannes Weiner | 795ae7a | 2016-03-17 14:19:14 -0700 | [diff] [blame] | 129 | static int one_thousand = 1000; |
Dave Young | af91322 | 2009-09-22 16:43:33 -0700 | [diff] [blame] | 130 | #ifdef CONFIG_PRINTK |
| 131 | static int ten_thousand = 10000; |
| 132 | #endif |
Arnaldo Carvalho de Melo | c5dfd78 | 2016-04-21 12:28:50 -0300 | [diff] [blame] | 133 | #ifdef CONFIG_PERF_EVENTS |
| 134 | static int six_hundred_forty_kb = 640 * 1024; |
| 135 | #endif |
Ravikiran G Thirumalai | c4f3b63 | 2007-10-16 23:26:09 -0700 | [diff] [blame] | 136 | |
Andrea Righi | 9e4a5bd | 2009-04-30 15:08:57 -0700 | [diff] [blame] | 137 | /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */ |
| 138 | static unsigned long dirty_bytes_min = 2 * PAGE_SIZE; |
| 139 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ |
| 141 | static int maxolduid = 65535; |
| 142 | static int minolduid; |
| 143 | |
| 144 | static int ngroups_max = NGROUPS_MAX; |
Dan Ballard | 73efc03 | 2011-10-31 17:11:20 -0700 | [diff] [blame] | 145 | static const int cap_last_cap = CAP_LAST_CAP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | |
Liu Hua | 80df284 | 2014-04-07 15:38:57 -0700 | [diff] [blame] | 147 | /*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */ |
| 148 | #ifdef CONFIG_DETECT_HUNG_TASK |
| 149 | static unsigned long hung_task_timeout_max = (LONG_MAX/HZ); |
| 150 | #endif |
| 151 | |
Dave Young | d14f172 | 2010-02-25 20:28:57 -0500 | [diff] [blame] | 152 | #ifdef CONFIG_INOTIFY_USER |
| 153 | #include <linux/inotify.h> |
| 154 | #endif |
David S. Miller | 72c57ed | 2008-09-11 23:29:54 -0700 | [diff] [blame] | 155 | #ifdef CONFIG_SPARC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | #endif |
| 157 | |
| 158 | #ifdef __hppa__ |
| 159 | extern int pwrsw_enabled; |
Vineet Gupta | bf14e3b | 2013-01-18 15:12:24 +0530 | [diff] [blame] | 160 | #endif |
| 161 | |
| 162 | #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | extern int unaligned_enabled; |
| 164 | #endif |
| 165 | |
Jes Sorensen | d2b176e | 2006-02-28 09:42:23 -0800 | [diff] [blame] | 166 | #ifdef CONFIG_IA64 |
Doug Chapman | 88fc241 | 2009-01-15 10:38:56 -0800 | [diff] [blame] | 167 | extern int unaligned_dump_stack; |
Jes Sorensen | d2b176e | 2006-02-28 09:42:23 -0800 | [diff] [blame] | 168 | #endif |
| 169 | |
Vineet Gupta | b6fca72 | 2013-01-09 20:06:28 +0530 | [diff] [blame] | 170 | #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN |
| 171 | extern int no_unaligned_warning; |
| 172 | #endif |
| 173 | |
Randy Dunlap | d6f8ff7 | 2006-10-19 23:28:34 -0700 | [diff] [blame] | 174 | #ifdef CONFIG_PROC_SYSCTL |
Kees Cook | f4aacea | 2014-06-06 14:37:19 -0700 | [diff] [blame] | 175 | |
| 176 | #define SYSCTL_WRITES_LEGACY -1 |
| 177 | #define SYSCTL_WRITES_WARN 0 |
| 178 | #define SYSCTL_WRITES_STRICT 1 |
| 179 | |
Kees Cook | 41662f5 | 2016-01-20 15:00:45 -0800 | [diff] [blame] | 180 | static int sysctl_writes_strict = SYSCTL_WRITES_STRICT; |
Kees Cook | f4aacea | 2014-06-06 14:37:19 -0700 | [diff] [blame] | 181 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 182 | static int proc_do_cad_pid(struct ctl_table *table, int write, |
Cedric Le Goater | 9ec5209 | 2006-10-02 02:19:00 -0700 | [diff] [blame] | 183 | void __user *buffer, size_t *lenp, loff_t *ppos); |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 184 | static int proc_taint(struct ctl_table *table, int write, |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 185 | void __user *buffer, size_t *lenp, loff_t *ppos); |
Randy Dunlap | d6f8ff7 | 2006-10-19 23:28:34 -0700 | [diff] [blame] | 186 | #endif |
Cedric Le Goater | 9ec5209 | 2006-10-02 02:19:00 -0700 | [diff] [blame] | 187 | |
Richard Weinberger | bfdc0b4 | 2011-03-23 16:43:11 -0700 | [diff] [blame] | 188 | #ifdef CONFIG_PRINTK |
Kees Cook | 620f6e8 | 2012-04-04 11:40:19 -0700 | [diff] [blame] | 189 | static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write, |
Richard Weinberger | bfdc0b4 | 2011-03-23 16:43:11 -0700 | [diff] [blame] | 190 | void __user *buffer, size_t *lenp, loff_t *ppos); |
| 191 | #endif |
| 192 | |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 193 | static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write, |
| 194 | void __user *buffer, size_t *lenp, loff_t *ppos); |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 195 | #ifdef CONFIG_COREDUMP |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 196 | static int proc_dostring_coredump(struct ctl_table *table, int write, |
| 197 | void __user *buffer, size_t *lenp, loff_t *ppos); |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 198 | #endif |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 199 | |
Dmitry Torokhov | 97f5f0c | 2010-03-21 22:31:26 -0700 | [diff] [blame] | 200 | #ifdef CONFIG_MAGIC_SYSRQ |
Andy Whitcroft | 8c6a98b | 2011-01-24 09:31:38 -0800 | [diff] [blame] | 201 | /* Note: sysrq code uses it's own private copy */ |
Ben Hutchings | 8eaede4 | 2013-10-07 01:05:46 +0100 | [diff] [blame] | 202 | static int __sysrq_enabled = CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE; |
Dmitry Torokhov | 97f5f0c | 2010-03-21 22:31:26 -0700 | [diff] [blame] | 203 | |
Joe Perches | 6f8fd1d | 2014-06-06 14:38:08 -0700 | [diff] [blame] | 204 | static int sysrq_sysctl_handler(struct ctl_table *table, int write, |
Dmitry Torokhov | 97f5f0c | 2010-03-21 22:31:26 -0700 | [diff] [blame] | 205 | 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. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 222 | static struct ctl_table kern_table[]; |
| 223 | static struct ctl_table vm_table[]; |
| 224 | static struct ctl_table fs_table[]; |
| 225 | static struct ctl_table debug_table[]; |
| 226 | static struct ctl_table dev_table[]; |
| 227 | extern struct ctl_table random_table[]; |
Davide Libenzi | 7ef9964 | 2008-12-01 13:13:55 -0800 | [diff] [blame] | 228 | #ifdef CONFIG_EPOLL |
| 229 | extern struct ctl_table epoll_table[]; |
| 230 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | |
| 232 | #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT |
| 233 | int sysctl_legacy_va_layout; |
| 234 | #endif |
| 235 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | /* The default sysctl tables: */ |
| 237 | |
Eric W. Biederman | de4e83bd | 2012-01-06 03:34:20 -0800 | [diff] [blame] | 238 | static struct ctl_table sysctl_base_table[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | .procname = "kernel", |
| 241 | .mode = 0555, |
| 242 | .child = kern_table, |
| 243 | }, |
| 244 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | .procname = "vm", |
| 246 | .mode = 0555, |
| 247 | .child = vm_table, |
| 248 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | .procname = "fs", |
| 251 | .mode = 0555, |
| 252 | .child = fs_table, |
| 253 | }, |
| 254 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 | .procname = "debug", |
| 256 | .mode = 0555, |
| 257 | .child = debug_table, |
| 258 | }, |
| 259 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | .procname = "dev", |
| 261 | .mode = 0555, |
| 262 | .child = dev_table, |
| 263 | }, |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 264 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | }; |
| 266 | |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 267 | #ifdef CONFIG_SCHED_DEBUG |
Eric Dumazet | 73c4efd | 2007-12-18 15:21:13 +0100 | [diff] [blame] | 268 | static int min_sched_granularity_ns = 100000; /* 100 usecs */ |
| 269 | static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */ |
| 270 | static int min_wakeup_granularity_ns; /* 0 usecs */ |
| 271 | static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */ |
Peter Zijlstra | cbee9f8 | 2012-10-25 14:16:43 +0200 | [diff] [blame] | 272 | #ifdef CONFIG_SMP |
Christian Ehrhardt | 1983a92 | 2009-11-30 12:16:47 +0100 | [diff] [blame] | 273 | static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE; |
| 274 | static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1; |
Peter Zijlstra | cbee9f8 | 2012-10-25 14:16:43 +0200 | [diff] [blame] | 275 | #endif /* CONFIG_SMP */ |
| 276 | #endif /* CONFIG_SCHED_DEBUG */ |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 277 | |
Mel Gorman | 5e77190 | 2010-05-24 14:32:31 -0700 | [diff] [blame] | 278 | #ifdef CONFIG_COMPACTION |
| 279 | static int min_extfrag_threshold; |
| 280 | static int max_extfrag_threshold = 1000; |
| 281 | #endif |
| 282 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 283 | static struct ctl_table kern_table[] = { |
Mike Galbraith | 2bba22c | 2009-09-09 15:41:37 +0200 | [diff] [blame] | 284 | { |
Mike Galbraith | 2bba22c | 2009-09-09 15:41:37 +0200 | [diff] [blame] | 285 | .procname = "sched_child_runs_first", |
| 286 | .data = &sysctl_sched_child_runs_first, |
| 287 | .maxlen = sizeof(unsigned int), |
| 288 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 289 | .proc_handler = proc_dointvec, |
Mike Galbraith | 2bba22c | 2009-09-09 15:41:37 +0200 | [diff] [blame] | 290 | }, |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 291 | #ifdef CONFIG_SCHED_DEBUG |
| 292 | { |
Peter Zijlstra | b2be5e9 | 2007-11-09 22:39:37 +0100 | [diff] [blame] | 293 | .procname = "sched_min_granularity_ns", |
| 294 | .data = &sysctl_sched_min_granularity, |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 295 | .maxlen = sizeof(unsigned int), |
| 296 | .mode = 0644, |
Linus Torvalds | 702a7c7 | 2009-12-12 11:34:10 -0800 | [diff] [blame] | 297 | .proc_handler = sched_proc_update_handler, |
Peter Zijlstra | b2be5e9 | 2007-11-09 22:39:37 +0100 | [diff] [blame] | 298 | .extra1 = &min_sched_granularity_ns, |
| 299 | .extra2 = &max_sched_granularity_ns, |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 300 | }, |
| 301 | { |
Peter Zijlstra | 2180508 | 2007-08-25 18:41:53 +0200 | [diff] [blame] | 302 | .procname = "sched_latency_ns", |
| 303 | .data = &sysctl_sched_latency, |
| 304 | .maxlen = sizeof(unsigned int), |
| 305 | .mode = 0644, |
Linus Torvalds | 702a7c7 | 2009-12-12 11:34:10 -0800 | [diff] [blame] | 306 | .proc_handler = sched_proc_update_handler, |
Peter Zijlstra | 2180508 | 2007-08-25 18:41:53 +0200 | [diff] [blame] | 307 | .extra1 = &min_sched_granularity_ns, |
| 308 | .extra2 = &max_sched_granularity_ns, |
| 309 | }, |
| 310 | { |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 311 | .procname = "sched_wakeup_granularity_ns", |
| 312 | .data = &sysctl_sched_wakeup_granularity, |
| 313 | .maxlen = sizeof(unsigned int), |
| 314 | .mode = 0644, |
Linus Torvalds | 702a7c7 | 2009-12-12 11:34:10 -0800 | [diff] [blame] | 315 | .proc_handler = sched_proc_update_handler, |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 316 | .extra1 = &min_wakeup_granularity_ns, |
| 317 | .extra2 = &max_wakeup_granularity_ns, |
| 318 | }, |
Peter Zijlstra | cbee9f8 | 2012-10-25 14:16:43 +0200 | [diff] [blame] | 319 | #ifdef CONFIG_SMP |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 320 | { |
Christian Ehrhardt | 1983a92 | 2009-11-30 12:16:47 +0100 | [diff] [blame] | 321 | .procname = "sched_tunable_scaling", |
| 322 | .data = &sysctl_sched_tunable_scaling, |
| 323 | .maxlen = sizeof(enum sched_tunable_scaling), |
| 324 | .mode = 0644, |
Linus Torvalds | 702a7c7 | 2009-12-12 11:34:10 -0800 | [diff] [blame] | 325 | .proc_handler = sched_proc_update_handler, |
Christian Ehrhardt | 1983a92 | 2009-11-30 12:16:47 +0100 | [diff] [blame] | 326 | .extra1 = &min_sched_tunable_scaling, |
| 327 | .extra2 = &max_sched_tunable_scaling, |
Peter Zijlstra | 2398f2c | 2008-06-27 13:41:35 +0200 | [diff] [blame] | 328 | }, |
| 329 | { |
Namhyung Kim | d00535d | 2012-08-16 11:15:30 +0900 | [diff] [blame] | 330 | .procname = "sched_migration_cost_ns", |
Ingo Molnar | da84d96 | 2007-10-15 17:00:18 +0200 | [diff] [blame] | 331 | .data = &sysctl_sched_migration_cost, |
| 332 | .maxlen = sizeof(unsigned int), |
| 333 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 334 | .proc_handler = proc_dointvec, |
Ingo Molnar | da84d96 | 2007-10-15 17:00:18 +0200 | [diff] [blame] | 335 | }, |
Peter Zijlstra | b82d9fd | 2007-11-09 22:39:39 +0100 | [diff] [blame] | 336 | { |
Peter Zijlstra | b82d9fd | 2007-11-09 22:39:39 +0100 | [diff] [blame] | 337 | .procname = "sched_nr_migrate", |
| 338 | .data = &sysctl_sched_nr_migrate, |
| 339 | .maxlen = sizeof(unsigned int), |
Peter Zijlstra | fa85ae2 | 2008-01-25 21:08:29 +0100 | [diff] [blame] | 340 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 341 | .proc_handler = proc_dointvec, |
Peter Zijlstra | fa85ae2 | 2008-01-25 21:08:29 +0100 | [diff] [blame] | 342 | }, |
Arun R Bharadwaj | cd1bb94 | 2009-04-16 12:15:34 +0530 | [diff] [blame] | 343 | { |
Namhyung Kim | d00535d | 2012-08-16 11:15:30 +0900 | [diff] [blame] | 344 | .procname = "sched_time_avg_ms", |
Peter Zijlstra | e9e9250 | 2009-09-01 10:34:37 +0200 | [diff] [blame] | 345 | .data = &sysctl_sched_time_avg, |
| 346 | .maxlen = sizeof(unsigned int), |
| 347 | .mode = 0644, |
Ethan Zhao | fe0034a | 2017-09-04 13:59:34 +0800 | [diff] [blame] | 348 | .proc_handler = proc_dointvec_minmax, |
| 349 | .extra1 = &one, |
Peter Zijlstra | e9e9250 | 2009-09-01 10:34:37 +0200 | [diff] [blame] | 350 | }, |
| 351 | { |
Namhyung Kim | d00535d | 2012-08-16 11:15:30 +0900 | [diff] [blame] | 352 | .procname = "sched_shares_window_ns", |
Paul Turner | a7a4f8a | 2010-11-15 15:47:06 -0800 | [diff] [blame] | 353 | .data = &sysctl_sched_shares_window, |
| 354 | .maxlen = sizeof(unsigned int), |
| 355 | .mode = 0644, |
| 356 | .proc_handler = proc_dointvec, |
| 357 | }, |
Mel Gorman | cb25176 | 2016-02-05 09:08:36 +0000 | [diff] [blame] | 358 | #ifdef CONFIG_SCHEDSTATS |
| 359 | { |
| 360 | .procname = "sched_schedstats", |
| 361 | .data = NULL, |
| 362 | .maxlen = sizeof(unsigned int), |
| 363 | .mode = 0644, |
| 364 | .proc_handler = sysctl_schedstats, |
| 365 | .extra1 = &zero, |
| 366 | .extra2 = &one, |
| 367 | }, |
| 368 | #endif /* CONFIG_SCHEDSTATS */ |
Peter Zijlstra | cbee9f8 | 2012-10-25 14:16:43 +0200 | [diff] [blame] | 369 | #endif /* CONFIG_SMP */ |
| 370 | #ifdef CONFIG_NUMA_BALANCING |
| 371 | { |
Peter Zijlstra | 4b96a29 | 2012-10-25 14:16:47 +0200 | [diff] [blame] | 372 | .procname = "numa_balancing_scan_delay_ms", |
| 373 | .data = &sysctl_numa_balancing_scan_delay, |
| 374 | .maxlen = sizeof(unsigned int), |
| 375 | .mode = 0644, |
| 376 | .proc_handler = proc_dointvec, |
| 377 | }, |
| 378 | { |
Peter Zijlstra | cbee9f8 | 2012-10-25 14:16:43 +0200 | [diff] [blame] | 379 | .procname = "numa_balancing_scan_period_min_ms", |
| 380 | .data = &sysctl_numa_balancing_scan_period_min, |
| 381 | .maxlen = sizeof(unsigned int), |
| 382 | .mode = 0644, |
| 383 | .proc_handler = proc_dointvec, |
| 384 | }, |
| 385 | { |
| 386 | .procname = "numa_balancing_scan_period_max_ms", |
| 387 | .data = &sysctl_numa_balancing_scan_period_max, |
| 388 | .maxlen = sizeof(unsigned int), |
| 389 | .mode = 0644, |
| 390 | .proc_handler = proc_dointvec, |
| 391 | }, |
Peter Zijlstra | 6e5fb22 | 2012-10-25 14:16:45 +0200 | [diff] [blame] | 392 | { |
| 393 | .procname = "numa_balancing_scan_size_mb", |
| 394 | .data = &sysctl_numa_balancing_scan_size, |
| 395 | .maxlen = sizeof(unsigned int), |
| 396 | .mode = 0644, |
Kirill Tkhai | 6419265 | 2014-10-16 14:39:37 +0400 | [diff] [blame] | 397 | .proc_handler = proc_dointvec_minmax, |
| 398 | .extra1 = &one, |
Peter Zijlstra | 6e5fb22 | 2012-10-25 14:16:45 +0200 | [diff] [blame] | 399 | }, |
Mel Gorman | 3a7053b | 2013-10-07 11:29:00 +0100 | [diff] [blame] | 400 | { |
Andi Kleen | 54a43d5 | 2014-01-23 15:53:13 -0800 | [diff] [blame] | 401 | .procname = "numa_balancing", |
| 402 | .data = NULL, /* filled in by handler */ |
| 403 | .maxlen = sizeof(unsigned int), |
| 404 | .mode = 0644, |
| 405 | .proc_handler = sysctl_numa_balancing, |
| 406 | .extra1 = &zero, |
| 407 | .extra2 = &one, |
| 408 | }, |
Peter Zijlstra | cbee9f8 | 2012-10-25 14:16:43 +0200 | [diff] [blame] | 409 | #endif /* CONFIG_NUMA_BALANCING */ |
| 410 | #endif /* CONFIG_SCHED_DEBUG */ |
Ingo Molnar | 1799e35 | 2007-09-19 23:34:46 +0200 | [diff] [blame] | 411 | { |
Peter Zijlstra | 9f0c1e5 | 2008-02-13 15:45:39 +0100 | [diff] [blame] | 412 | .procname = "sched_rt_period_us", |
| 413 | .data = &sysctl_sched_rt_period, |
| 414 | .maxlen = sizeof(unsigned int), |
| 415 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 416 | .proc_handler = sched_rt_handler, |
Peter Zijlstra | 9f0c1e5 | 2008-02-13 15:45:39 +0100 | [diff] [blame] | 417 | }, |
| 418 | { |
Peter Zijlstra | 9f0c1e5 | 2008-02-13 15:45:39 +0100 | [diff] [blame] | 419 | .procname = "sched_rt_runtime_us", |
| 420 | .data = &sysctl_sched_rt_runtime, |
| 421 | .maxlen = sizeof(int), |
| 422 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 423 | .proc_handler = sched_rt_handler, |
Peter Zijlstra | 9f0c1e5 | 2008-02-13 15:45:39 +0100 | [diff] [blame] | 424 | }, |
Clark Williams | ce0dbbb | 2013-02-07 09:47:04 -0600 | [diff] [blame] | 425 | { |
| 426 | .procname = "sched_rr_timeslice_ms", |
| 427 | .data = &sched_rr_timeslice, |
| 428 | .maxlen = sizeof(int), |
| 429 | .mode = 0644, |
| 430 | .proc_handler = sched_rr_handler, |
| 431 | }, |
Mike Galbraith | 5091faa | 2010-11-30 14:18:03 +0100 | [diff] [blame] | 432 | #ifdef CONFIG_SCHED_AUTOGROUP |
| 433 | { |
| 434 | .procname = "sched_autogroup_enabled", |
| 435 | .data = &sysctl_sched_autogroup_enabled, |
| 436 | .maxlen = sizeof(unsigned int), |
| 437 | .mode = 0644, |
Yong Zhang | 1747b21 | 2011-02-20 15:08:12 +0800 | [diff] [blame] | 438 | .proc_handler = proc_dointvec_minmax, |
Mike Galbraith | 5091faa | 2010-11-30 14:18:03 +0100 | [diff] [blame] | 439 | .extra1 = &zero, |
| 440 | .extra2 = &one, |
| 441 | }, |
| 442 | #endif |
Paul Turner | ec12cb7 | 2011-07-21 09:43:30 -0700 | [diff] [blame] | 443 | #ifdef CONFIG_CFS_BANDWIDTH |
| 444 | { |
| 445 | .procname = "sched_cfs_bandwidth_slice_us", |
| 446 | .data = &sysctl_sched_cfs_bandwidth_slice, |
| 447 | .maxlen = sizeof(unsigned int), |
| 448 | .mode = 0644, |
| 449 | .proc_handler = proc_dointvec_minmax, |
| 450 | .extra1 = &one, |
| 451 | }, |
| 452 | #endif |
Peter Zijlstra | f20786f | 2007-07-19 01:48:56 -0700 | [diff] [blame] | 453 | #ifdef CONFIG_PROVE_LOCKING |
| 454 | { |
Peter Zijlstra | f20786f | 2007-07-19 01:48:56 -0700 | [diff] [blame] | 455 | .procname = "prove_locking", |
| 456 | .data = &prove_locking, |
| 457 | .maxlen = sizeof(int), |
| 458 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 459 | .proc_handler = proc_dointvec, |
Peter Zijlstra | f20786f | 2007-07-19 01:48:56 -0700 | [diff] [blame] | 460 | }, |
| 461 | #endif |
| 462 | #ifdef CONFIG_LOCK_STAT |
| 463 | { |
Peter Zijlstra | f20786f | 2007-07-19 01:48:56 -0700 | [diff] [blame] | 464 | .procname = "lock_stat", |
| 465 | .data = &lock_stat, |
| 466 | .maxlen = sizeof(int), |
| 467 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 468 | .proc_handler = proc_dointvec, |
Peter Zijlstra | f20786f | 2007-07-19 01:48:56 -0700 | [diff] [blame] | 469 | }, |
| 470 | #endif |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 471 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | .procname = "panic", |
| 473 | .data = &panic_timeout, |
| 474 | .maxlen = sizeof(int), |
| 475 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 476 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 477 | }, |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 478 | #ifdef CONFIG_COREDUMP |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 480 | .procname = "core_uses_pid", |
| 481 | .data = &core_uses_pid, |
| 482 | .maxlen = sizeof(int), |
| 483 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 484 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 485 | }, |
| 486 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 487 | .procname = "core_pattern", |
| 488 | .data = core_pattern, |
Dan Aloni | 71ce92f | 2007-05-16 22:11:16 -0700 | [diff] [blame] | 489 | .maxlen = CORENAME_MAX_SIZE, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 490 | .mode = 0644, |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 491 | .proc_handler = proc_dostring_coredump, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 492 | }, |
Neil Horman | a293980 | 2009-09-23 15:56:56 -0700 | [diff] [blame] | 493 | { |
Neil Horman | a293980 | 2009-09-23 15:56:56 -0700 | [diff] [blame] | 494 | .procname = "core_pipe_limit", |
| 495 | .data = &core_pipe_limit, |
| 496 | .maxlen = sizeof(unsigned int), |
| 497 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 498 | .proc_handler = proc_dointvec, |
Neil Horman | a293980 | 2009-09-23 15:56:56 -0700 | [diff] [blame] | 499 | }, |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 500 | #endif |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 501 | #ifdef CONFIG_PROC_SYSCTL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 502 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 503 | .procname = "tainted", |
Andi Kleen | 25ddbb1 | 2008-10-15 22:01:41 -0700 | [diff] [blame] | 504 | .maxlen = sizeof(long), |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 505 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 506 | .proc_handler = proc_taint, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 507 | }, |
Kees Cook | f4aacea | 2014-06-06 14:37:19 -0700 | [diff] [blame] | 508 | { |
| 509 | .procname = "sysctl_writes_strict", |
| 510 | .data = &sysctl_writes_strict, |
| 511 | .maxlen = sizeof(int), |
| 512 | .mode = 0644, |
| 513 | .proc_handler = proc_dointvec_minmax, |
| 514 | .extra1 = &neg_one, |
| 515 | .extra2 = &one, |
| 516 | }, |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 517 | #endif |
Arjan van de Ven | 9745512 | 2008-01-25 21:08:34 +0100 | [diff] [blame] | 518 | #ifdef CONFIG_LATENCYTOP |
| 519 | { |
| 520 | .procname = "latencytop", |
| 521 | .data = &latencytop_enabled, |
| 522 | .maxlen = sizeof(int), |
| 523 | .mode = 0644, |
Mel Gorman | cb25176 | 2016-02-05 09:08:36 +0000 | [diff] [blame] | 524 | .proc_handler = sysctl_latencytop, |
Arjan van de Ven | 9745512 | 2008-01-25 21:08:34 +0100 | [diff] [blame] | 525 | }, |
| 526 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 527 | #ifdef CONFIG_BLK_DEV_INITRD |
| 528 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 529 | .procname = "real-root-dev", |
| 530 | .data = &real_root_dev, |
| 531 | .maxlen = sizeof(int), |
| 532 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 533 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 534 | }, |
| 535 | #endif |
Ingo Molnar | 45807a1 | 2007-07-15 23:40:10 -0700 | [diff] [blame] | 536 | { |
Ingo Molnar | 45807a1 | 2007-07-15 23:40:10 -0700 | [diff] [blame] | 537 | .procname = "print-fatal-signals", |
| 538 | .data = &print_fatal_signals, |
| 539 | .maxlen = sizeof(int), |
| 540 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 541 | .proc_handler = proc_dointvec, |
Ingo Molnar | 45807a1 | 2007-07-15 23:40:10 -0700 | [diff] [blame] | 542 | }, |
David S. Miller | 72c57ed | 2008-09-11 23:29:54 -0700 | [diff] [blame] | 543 | #ifdef CONFIG_SPARC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 544 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 545 | .procname = "reboot-cmd", |
| 546 | .data = reboot_command, |
| 547 | .maxlen = 256, |
| 548 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 549 | .proc_handler = proc_dostring, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 550 | }, |
| 551 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 552 | .procname = "stop-a", |
| 553 | .data = &stop_a_enabled, |
| 554 | .maxlen = sizeof (int), |
| 555 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 556 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 557 | }, |
| 558 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 559 | .procname = "scons-poweroff", |
| 560 | .data = &scons_pwroff, |
| 561 | .maxlen = sizeof (int), |
| 562 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 563 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 564 | }, |
| 565 | #endif |
David S. Miller | 0871420 | 2008-11-16 23:49:24 -0800 | [diff] [blame] | 566 | #ifdef CONFIG_SPARC64 |
| 567 | { |
David S. Miller | 0871420 | 2008-11-16 23:49:24 -0800 | [diff] [blame] | 568 | .procname = "tsb-ratio", |
| 569 | .data = &sysctl_tsb_ratio, |
| 570 | .maxlen = sizeof (int), |
| 571 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 572 | .proc_handler = proc_dointvec, |
David S. Miller | 0871420 | 2008-11-16 23:49:24 -0800 | [diff] [blame] | 573 | }, |
| 574 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 575 | #ifdef __hppa__ |
| 576 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 577 | .procname = "soft-power", |
| 578 | .data = &pwrsw_enabled, |
| 579 | .maxlen = sizeof (int), |
| 580 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 581 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 582 | }, |
Vineet Gupta | bf14e3b | 2013-01-18 15:12:24 +0530 | [diff] [blame] | 583 | #endif |
| 584 | #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 585 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 586 | .procname = "unaligned-trap", |
| 587 | .data = &unaligned_enabled, |
| 588 | .maxlen = sizeof (int), |
| 589 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 590 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 591 | }, |
| 592 | #endif |
| 593 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 594 | .procname = "ctrl-alt-del", |
| 595 | .data = &C_A_D, |
| 596 | .maxlen = sizeof(int), |
| 597 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 598 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 599 | }, |
Steven Rostedt | 606576c | 2008-10-06 19:06:12 -0400 | [diff] [blame] | 600 | #ifdef CONFIG_FUNCTION_TRACER |
Steven Rostedt | b0fc494 | 2008-05-12 21:20:43 +0200 | [diff] [blame] | 601 | { |
Steven Rostedt | b0fc494 | 2008-05-12 21:20:43 +0200 | [diff] [blame] | 602 | .procname = "ftrace_enabled", |
| 603 | .data = &ftrace_enabled, |
| 604 | .maxlen = sizeof(int), |
| 605 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 606 | .proc_handler = ftrace_enable_sysctl, |
Steven Rostedt | b0fc494 | 2008-05-12 21:20:43 +0200 | [diff] [blame] | 607 | }, |
| 608 | #endif |
Steven Rostedt | f38f1d2 | 2008-12-16 23:06:40 -0500 | [diff] [blame] | 609 | #ifdef CONFIG_STACK_TRACER |
| 610 | { |
Steven Rostedt | f38f1d2 | 2008-12-16 23:06:40 -0500 | [diff] [blame] | 611 | .procname = "stack_tracer_enabled", |
| 612 | .data = &stack_tracer_enabled, |
| 613 | .maxlen = sizeof(int), |
| 614 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 615 | .proc_handler = stack_trace_sysctl, |
Steven Rostedt | f38f1d2 | 2008-12-16 23:06:40 -0500 | [diff] [blame] | 616 | }, |
| 617 | #endif |
Steven Rostedt | 944ac42 | 2008-10-23 19:26:08 -0400 | [diff] [blame] | 618 | #ifdef CONFIG_TRACING |
| 619 | { |
Peter Zijlstra | 3299b4d | 2008-11-04 11:58:21 +0100 | [diff] [blame] | 620 | .procname = "ftrace_dump_on_oops", |
Steven Rostedt | 944ac42 | 2008-10-23 19:26:08 -0400 | [diff] [blame] | 621 | .data = &ftrace_dump_on_oops, |
| 622 | .maxlen = sizeof(int), |
| 623 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 624 | .proc_handler = proc_dointvec, |
Steven Rostedt | 944ac42 | 2008-10-23 19:26:08 -0400 | [diff] [blame] | 625 | }, |
Steven Rostedt (Red Hat) | de7edd3 | 2013-06-14 16:21:43 -0400 | [diff] [blame] | 626 | { |
| 627 | .procname = "traceoff_on_warning", |
| 628 | .data = &__disable_trace_on_warning, |
| 629 | .maxlen = sizeof(__disable_trace_on_warning), |
| 630 | .mode = 0644, |
| 631 | .proc_handler = proc_dointvec, |
| 632 | }, |
Steven Rostedt (Red Hat) | 0daa2302 | 2014-12-12 22:27:10 -0500 | [diff] [blame] | 633 | { |
| 634 | .procname = "tracepoint_printk", |
| 635 | .data = &tracepoint_printk, |
| 636 | .maxlen = sizeof(tracepoint_printk), |
| 637 | .mode = 0644, |
| 638 | .proc_handler = proc_dointvec, |
| 639 | }, |
Steven Rostedt | 944ac42 | 2008-10-23 19:26:08 -0400 | [diff] [blame] | 640 | #endif |
Dave Young | 2965faa | 2015-09-09 15:38:55 -0700 | [diff] [blame] | 641 | #ifdef CONFIG_KEXEC_CORE |
Kees Cook | 7984754 | 2014-01-23 15:55:59 -0800 | [diff] [blame] | 642 | { |
| 643 | .procname = "kexec_load_disabled", |
| 644 | .data = &kexec_load_disabled, |
| 645 | .maxlen = sizeof(int), |
| 646 | .mode = 0644, |
| 647 | /* only handle a transition from default "0" to "1" */ |
| 648 | .proc_handler = proc_dointvec_minmax, |
| 649 | .extra1 = &one, |
| 650 | .extra2 = &one, |
| 651 | }, |
| 652 | #endif |
Johannes Berg | a1ef5ad | 2008-07-08 19:00:17 +0200 | [diff] [blame] | 653 | #ifdef CONFIG_MODULES |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 654 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 655 | .procname = "modprobe", |
| 656 | .data = &modprobe_path, |
| 657 | .maxlen = KMOD_PATH_LEN, |
| 658 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 659 | .proc_handler = proc_dostring, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 660 | }, |
Kees Cook | 3d43321 | 2009-04-02 15:49:29 -0700 | [diff] [blame] | 661 | { |
Kees Cook | 3d43321 | 2009-04-02 15:49:29 -0700 | [diff] [blame] | 662 | .procname = "modules_disabled", |
| 663 | .data = &modules_disabled, |
| 664 | .maxlen = sizeof(int), |
| 665 | .mode = 0644, |
| 666 | /* only handle a transition from default "0" to "1" */ |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 667 | .proc_handler = proc_dointvec_minmax, |
Kees Cook | 3d43321 | 2009-04-02 15:49:29 -0700 | [diff] [blame] | 668 | .extra1 = &one, |
| 669 | .extra2 = &one, |
| 670 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 671 | #endif |
Michael Marineau | 86d5613 | 2014-04-10 14:09:31 -0700 | [diff] [blame] | 672 | #ifdef CONFIG_UEVENT_HELPER |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 673 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 674 | .procname = "hotplug", |
Kay Sievers | 312c004 | 2005-11-16 09:00:00 +0100 | [diff] [blame] | 675 | .data = &uevent_helper, |
| 676 | .maxlen = UEVENT_HELPER_PATH_LEN, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 677 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 678 | .proc_handler = proc_dostring, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 679 | }, |
Michael Marineau | 86d5613 | 2014-04-10 14:09:31 -0700 | [diff] [blame] | 680 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 681 | #ifdef CONFIG_CHR_DEV_SG |
| 682 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 683 | .procname = "sg-big-buff", |
| 684 | .data = &sg_big_buff, |
| 685 | .maxlen = sizeof (int), |
| 686 | .mode = 0444, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 687 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 688 | }, |
| 689 | #endif |
| 690 | #ifdef CONFIG_BSD_PROCESS_ACCT |
| 691 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 692 | .procname = "acct", |
| 693 | .data = &acct_parm, |
| 694 | .maxlen = 3*sizeof(int), |
| 695 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 696 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 697 | }, |
| 698 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 699 | #ifdef CONFIG_MAGIC_SYSRQ |
| 700 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 701 | .procname = "sysrq", |
Ingo Molnar | 5d6f647 | 2006-12-13 00:34:36 -0800 | [diff] [blame] | 702 | .data = &__sysrq_enabled, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 703 | .maxlen = sizeof (int), |
| 704 | .mode = 0644, |
Dmitry Torokhov | 97f5f0c | 2010-03-21 22:31:26 -0700 | [diff] [blame] | 705 | .proc_handler = sysrq_sysctl_handler, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 706 | }, |
| 707 | #endif |
Randy Dunlap | d6f8ff7 | 2006-10-19 23:28:34 -0700 | [diff] [blame] | 708 | #ifdef CONFIG_PROC_SYSCTL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 709 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 710 | .procname = "cad_pid", |
Cedric Le Goater | 9ec5209 | 2006-10-02 02:19:00 -0700 | [diff] [blame] | 711 | .data = NULL, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 712 | .maxlen = sizeof (int), |
| 713 | .mode = 0600, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 714 | .proc_handler = proc_do_cad_pid, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 715 | }, |
Randy Dunlap | d6f8ff7 | 2006-10-19 23:28:34 -0700 | [diff] [blame] | 716 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 717 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 718 | .procname = "threads-max", |
Heinrich Schuchardt | 16db3d3 | 2015-04-16 12:47:50 -0700 | [diff] [blame] | 719 | .data = NULL, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 720 | .maxlen = sizeof(int), |
| 721 | .mode = 0644, |
Heinrich Schuchardt | 16db3d3 | 2015-04-16 12:47:50 -0700 | [diff] [blame] | 722 | .proc_handler = sysctl_max_threads, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 723 | }, |
| 724 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 725 | .procname = "random", |
| 726 | .mode = 0555, |
| 727 | .child = random_table, |
| 728 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 729 | { |
Eric Paris | 17f60a7 | 2011-04-01 17:07:50 -0400 | [diff] [blame] | 730 | .procname = "usermodehelper", |
| 731 | .mode = 0555, |
| 732 | .child = usermodehelper_table, |
| 733 | }, |
| 734 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 735 | .procname = "overflowuid", |
| 736 | .data = &overflowuid, |
| 737 | .maxlen = sizeof(int), |
| 738 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 739 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 740 | .extra1 = &minolduid, |
| 741 | .extra2 = &maxolduid, |
| 742 | }, |
| 743 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 744 | .procname = "overflowgid", |
| 745 | .data = &overflowgid, |
| 746 | .maxlen = sizeof(int), |
| 747 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 748 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 749 | .extra1 = &minolduid, |
| 750 | .extra2 = &maxolduid, |
| 751 | }, |
Martin Schwidefsky | 347a8dc | 2006-01-06 00:19:28 -0800 | [diff] [blame] | 752 | #ifdef CONFIG_S390 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 753 | #ifdef CONFIG_MATHEMU |
| 754 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 755 | .procname = "ieee_emulation_warnings", |
| 756 | .data = &sysctl_ieee_emulation_warnings, |
| 757 | .maxlen = sizeof(int), |
| 758 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 759 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 760 | }, |
| 761 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 762 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 763 | .procname = "userprocess_debug", |
Heiko Carstens | ab3c68e | 2010-05-17 10:00:21 +0200 | [diff] [blame] | 764 | .data = &show_unhandled_signals, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 765 | .maxlen = sizeof(int), |
| 766 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 767 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 768 | }, |
| 769 | #endif |
| 770 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 771 | .procname = "pid_max", |
| 772 | .data = &pid_max, |
| 773 | .maxlen = sizeof (int), |
| 774 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 775 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 776 | .extra1 = &pid_max_min, |
| 777 | .extra2 = &pid_max_max, |
| 778 | }, |
| 779 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 780 | .procname = "panic_on_oops", |
| 781 | .data = &panic_on_oops, |
| 782 | .maxlen = sizeof(int), |
| 783 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 784 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 785 | }, |
Joe Perches | 7ef3d2f | 2008-02-08 04:21:25 -0800 | [diff] [blame] | 786 | #if defined CONFIG_PRINTK |
| 787 | { |
Joe Perches | 7ef3d2f | 2008-02-08 04:21:25 -0800 | [diff] [blame] | 788 | .procname = "printk", |
| 789 | .data = &console_loglevel, |
| 790 | .maxlen = 4*sizeof(int), |
| 791 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 792 | .proc_handler = proc_dointvec, |
Joe Perches | 7ef3d2f | 2008-02-08 04:21:25 -0800 | [diff] [blame] | 793 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 794 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 795 | .procname = "printk_ratelimit", |
Dave Young | 717115e | 2008-07-25 01:45:58 -0700 | [diff] [blame] | 796 | .data = &printk_ratelimit_state.interval, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 797 | .maxlen = sizeof(int), |
| 798 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 799 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 800 | }, |
| 801 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 802 | .procname = "printk_ratelimit_burst", |
Dave Young | 717115e | 2008-07-25 01:45:58 -0700 | [diff] [blame] | 803 | .data = &printk_ratelimit_state.burst, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 804 | .maxlen = sizeof(int), |
| 805 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 806 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 807 | }, |
Dave Young | af91322 | 2009-09-22 16:43:33 -0700 | [diff] [blame] | 808 | { |
Dave Young | af91322 | 2009-09-22 16:43:33 -0700 | [diff] [blame] | 809 | .procname = "printk_delay", |
| 810 | .data = &printk_delay_msec, |
| 811 | .maxlen = sizeof(int), |
| 812 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 813 | .proc_handler = proc_dointvec_minmax, |
Dave Young | af91322 | 2009-09-22 16:43:33 -0700 | [diff] [blame] | 814 | .extra1 = &zero, |
| 815 | .extra2 = &ten_thousand, |
| 816 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 817 | { |
Borislav Petkov | 750afe7 | 2016-08-02 14:04:07 -0700 | [diff] [blame] | 818 | .procname = "printk_devkmsg", |
| 819 | .data = devkmsg_log_str, |
| 820 | .maxlen = DEVKMSG_STR_MAX_SIZE, |
| 821 | .mode = 0644, |
| 822 | .proc_handler = devkmsg_sysctl_set_loglvl, |
| 823 | }, |
| 824 | { |
Dan Rosenberg | eaf06b2 | 2010-11-11 14:05:18 -0800 | [diff] [blame] | 825 | .procname = "dmesg_restrict", |
| 826 | .data = &dmesg_restrict, |
| 827 | .maxlen = sizeof(int), |
| 828 | .mode = 0644, |
Kees Cook | 620f6e8 | 2012-04-04 11:40:19 -0700 | [diff] [blame] | 829 | .proc_handler = proc_dointvec_minmax_sysadmin, |
Dan Rosenberg | eaf06b2 | 2010-11-11 14:05:18 -0800 | [diff] [blame] | 830 | .extra1 = &zero, |
| 831 | .extra2 = &one, |
| 832 | }, |
Dan Rosenberg | 455cd5a | 2011-01-12 16:59:41 -0800 | [diff] [blame] | 833 | { |
| 834 | .procname = "kptr_restrict", |
| 835 | .data = &kptr_restrict, |
| 836 | .maxlen = sizeof(int), |
| 837 | .mode = 0644, |
Kees Cook | 620f6e8 | 2012-04-04 11:40:19 -0700 | [diff] [blame] | 838 | .proc_handler = proc_dointvec_minmax_sysadmin, |
Dan Rosenberg | 455cd5a | 2011-01-12 16:59:41 -0800 | [diff] [blame] | 839 | .extra1 = &zero, |
| 840 | .extra2 = &two, |
| 841 | }, |
Joe Perches | df6e61d | 2010-11-15 21:17:27 -0800 | [diff] [blame] | 842 | #endif |
Dan Rosenberg | eaf06b2 | 2010-11-11 14:05:18 -0800 | [diff] [blame] | 843 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 844 | .procname = "ngroups_max", |
| 845 | .data = &ngroups_max, |
| 846 | .maxlen = sizeof (int), |
| 847 | .mode = 0444, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 848 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 849 | }, |
Dan Ballard | 73efc03 | 2011-10-31 17:11:20 -0700 | [diff] [blame] | 850 | { |
| 851 | .procname = "cap_last_cap", |
| 852 | .data = (void *)&cap_last_cap, |
| 853 | .maxlen = sizeof(int), |
| 854 | .mode = 0444, |
| 855 | .proc_handler = proc_dointvec, |
| 856 | }, |
Don Zickus | 58687ac | 2010-05-07 17:11:44 -0400 | [diff] [blame] | 857 | #if defined(CONFIG_LOCKUP_DETECTOR) |
Don Zickus | 504d7cf | 2010-02-12 17:19:19 -0500 | [diff] [blame] | 858 | { |
Don Zickus | 58687ac | 2010-05-07 17:11:44 -0400 | [diff] [blame] | 859 | .procname = "watchdog", |
Frederic Weisbecker | 3c00ea8 | 2013-05-19 20:45:15 +0200 | [diff] [blame] | 860 | .data = &watchdog_user_enabled, |
Don Zickus | 504d7cf | 2010-02-12 17:19:19 -0500 | [diff] [blame] | 861 | .maxlen = sizeof (int), |
| 862 | .mode = 0644, |
Ulrich Obergfell | 195daf6 | 2015-04-14 15:44:13 -0700 | [diff] [blame] | 863 | .proc_handler = proc_watchdog, |
Mandeep Singh Baines | 586692a | 2011-05-22 22:10:22 -0700 | [diff] [blame] | 864 | .extra1 = &zero, |
| 865 | .extra2 = &one, |
Don Zickus | 58687ac | 2010-05-07 17:11:44 -0400 | [diff] [blame] | 866 | }, |
| 867 | { |
| 868 | .procname = "watchdog_thresh", |
Mandeep Singh Baines | 586692a | 2011-05-22 22:10:22 -0700 | [diff] [blame] | 869 | .data = &watchdog_thresh, |
Don Zickus | 58687ac | 2010-05-07 17:11:44 -0400 | [diff] [blame] | 870 | .maxlen = sizeof(int), |
| 871 | .mode = 0644, |
Ulrich Obergfell | 195daf6 | 2015-04-14 15:44:13 -0700 | [diff] [blame] | 872 | .proc_handler = proc_watchdog_thresh, |
Li Zefan | a6572f8 | 2013-05-17 10:31:04 +0800 | [diff] [blame] | 873 | .extra1 = &zero, |
Don Zickus | 58687ac | 2010-05-07 17:11:44 -0400 | [diff] [blame] | 874 | .extra2 = &sixty, |
Don Zickus | 504d7cf | 2010-02-12 17:19:19 -0500 | [diff] [blame] | 875 | }, |
Don Zickus | 2508ce1 | 2010-05-07 17:11:46 -0400 | [diff] [blame] | 876 | { |
Ulrich Obergfell | 195daf6 | 2015-04-14 15:44:13 -0700 | [diff] [blame] | 877 | .procname = "nmi_watchdog", |
| 878 | .data = &nmi_watchdog_enabled, |
| 879 | .maxlen = sizeof (int), |
| 880 | .mode = 0644, |
| 881 | .proc_handler = proc_nmi_watchdog, |
| 882 | .extra1 = &zero, |
| 883 | #if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR) |
| 884 | .extra2 = &one, |
| 885 | #else |
| 886 | .extra2 = &zero, |
| 887 | #endif |
| 888 | }, |
| 889 | { |
| 890 | .procname = "soft_watchdog", |
| 891 | .data = &soft_watchdog_enabled, |
| 892 | .maxlen = sizeof (int), |
| 893 | .mode = 0644, |
| 894 | .proc_handler = proc_soft_watchdog, |
| 895 | .extra1 = &zero, |
| 896 | .extra2 = &one, |
| 897 | }, |
| 898 | { |
Chris Metcalf | fe4ba3c | 2015-06-24 16:55:45 -0700 | [diff] [blame] | 899 | .procname = "watchdog_cpumask", |
| 900 | .data = &watchdog_cpumask_bits, |
| 901 | .maxlen = NR_CPUS, |
| 902 | .mode = 0644, |
| 903 | .proc_handler = proc_watchdog_cpumask, |
| 904 | }, |
| 905 | { |
Don Zickus | 2508ce1 | 2010-05-07 17:11:46 -0400 | [diff] [blame] | 906 | .procname = "softlockup_panic", |
| 907 | .data = &softlockup_panic, |
| 908 | .maxlen = sizeof(int), |
| 909 | .mode = 0644, |
| 910 | .proc_handler = proc_dointvec_minmax, |
| 911 | .extra1 = &zero, |
| 912 | .extra2 = &one, |
| 913 | }, |
Don Zickus | ac1f591 | 2015-11-05 18:44:44 -0800 | [diff] [blame] | 914 | #ifdef CONFIG_HARDLOCKUP_DETECTOR |
| 915 | { |
| 916 | .procname = "hardlockup_panic", |
| 917 | .data = &hardlockup_panic, |
| 918 | .maxlen = sizeof(int), |
| 919 | .mode = 0644, |
| 920 | .proc_handler = proc_dointvec_minmax, |
| 921 | .extra1 = &zero, |
| 922 | .extra2 = &one, |
| 923 | }, |
| 924 | #endif |
Aaron Tomlin | ed23587 | 2014-06-23 13:22:05 -0700 | [diff] [blame] | 925 | #ifdef CONFIG_SMP |
| 926 | { |
| 927 | .procname = "softlockup_all_cpu_backtrace", |
| 928 | .data = &sysctl_softlockup_all_cpu_backtrace, |
| 929 | .maxlen = sizeof(int), |
| 930 | .mode = 0644, |
| 931 | .proc_handler = proc_dointvec_minmax, |
| 932 | .extra1 = &zero, |
| 933 | .extra2 = &one, |
| 934 | }, |
Jiri Kosina | 5553787 | 2015-11-05 18:44:41 -0800 | [diff] [blame] | 935 | { |
| 936 | .procname = "hardlockup_all_cpu_backtrace", |
| 937 | .data = &sysctl_hardlockup_all_cpu_backtrace, |
| 938 | .maxlen = sizeof(int), |
| 939 | .mode = 0644, |
| 940 | .proc_handler = proc_dointvec_minmax, |
| 941 | .extra1 = &zero, |
| 942 | .extra2 = &one, |
| 943 | }, |
Aaron Tomlin | ed23587 | 2014-06-23 13:22:05 -0700 | [diff] [blame] | 944 | #endif /* CONFIG_SMP */ |
Don Zickus | 5dc3055 | 2010-11-29 17:07:17 -0500 | [diff] [blame] | 945 | #endif |
| 946 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) |
| 947 | { |
| 948 | .procname = "unknown_nmi_panic", |
| 949 | .data = &unknown_nmi_panic, |
| 950 | .maxlen = sizeof (int), |
| 951 | .mode = 0644, |
| 952 | .proc_handler = proc_dointvec, |
| 953 | }, |
Don Zickus | 504d7cf | 2010-02-12 17:19:19 -0500 | [diff] [blame] | 954 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 955 | #if defined(CONFIG_X86) |
| 956 | { |
Don Zickus | 8da5add | 2006-09-26 10:52:27 +0200 | [diff] [blame] | 957 | .procname = "panic_on_unrecovered_nmi", |
| 958 | .data = &panic_on_unrecovered_nmi, |
| 959 | .maxlen = sizeof(int), |
| 960 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 961 | .proc_handler = proc_dointvec, |
Don Zickus | 8da5add | 2006-09-26 10:52:27 +0200 | [diff] [blame] | 962 | }, |
| 963 | { |
Kurt Garloff | 5211a24 | 2009-06-24 14:32:11 -0700 | [diff] [blame] | 964 | .procname = "panic_on_io_nmi", |
| 965 | .data = &panic_on_io_nmi, |
| 966 | .maxlen = sizeof(int), |
| 967 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 968 | .proc_handler = proc_dointvec, |
Kurt Garloff | 5211a24 | 2009-06-24 14:32:11 -0700 | [diff] [blame] | 969 | }, |
Mitsuo Hayasaka | 55af779 | 2011-11-29 15:08:36 +0900 | [diff] [blame] | 970 | #ifdef CONFIG_DEBUG_STACKOVERFLOW |
| 971 | { |
| 972 | .procname = "panic_on_stackoverflow", |
| 973 | .data = &sysctl_panic_on_stackoverflow, |
| 974 | .maxlen = sizeof(int), |
| 975 | .mode = 0644, |
| 976 | .proc_handler = proc_dointvec, |
| 977 | }, |
| 978 | #endif |
Kurt Garloff | 5211a24 | 2009-06-24 14:32:11 -0700 | [diff] [blame] | 979 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 980 | .procname = "bootloader_type", |
| 981 | .data = &bootloader_type, |
| 982 | .maxlen = sizeof (int), |
| 983 | .mode = 0444, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 984 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 985 | }, |
Chuck Ebbert | 0741f4d | 2006-12-07 02:14:11 +0100 | [diff] [blame] | 986 | { |
H. Peter Anvin | 5031296 | 2009-05-07 16:54:11 -0700 | [diff] [blame] | 987 | .procname = "bootloader_version", |
| 988 | .data = &bootloader_version, |
| 989 | .maxlen = sizeof (int), |
| 990 | .mode = 0444, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 991 | .proc_handler = proc_dointvec, |
H. Peter Anvin | 5031296 | 2009-05-07 16:54:11 -0700 | [diff] [blame] | 992 | }, |
| 993 | { |
Chuck Ebbert | 0741f4d | 2006-12-07 02:14:11 +0100 | [diff] [blame] | 994 | .procname = "kstack_depth_to_print", |
| 995 | .data = &kstack_depth_to_print, |
| 996 | .maxlen = sizeof(int), |
| 997 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 998 | .proc_handler = proc_dointvec, |
Chuck Ebbert | 0741f4d | 2006-12-07 02:14:11 +0100 | [diff] [blame] | 999 | }, |
Ingo Molnar | 6e7c402 | 2008-01-30 13:30:05 +0100 | [diff] [blame] | 1000 | { |
Ingo Molnar | 6e7c402 | 2008-01-30 13:30:05 +0100 | [diff] [blame] | 1001 | .procname = "io_delay_type", |
| 1002 | .data = &io_delay_type, |
| 1003 | .maxlen = sizeof(int), |
| 1004 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1005 | .proc_handler = proc_dointvec, |
Ingo Molnar | 6e7c402 | 2008-01-30 13:30:05 +0100 | [diff] [blame] | 1006 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1007 | #endif |
Luke Yang | 7a9166e | 2006-02-20 18:28:07 -0800 | [diff] [blame] | 1008 | #if defined(CONFIG_MMU) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1009 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1010 | .procname = "randomize_va_space", |
| 1011 | .data = &randomize_va_space, |
| 1012 | .maxlen = sizeof(int), |
| 1013 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1014 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1015 | }, |
Luke Yang | 7a9166e | 2006-02-20 18:28:07 -0800 | [diff] [blame] | 1016 | #endif |
Martin Schwidefsky | 0152fb3 | 2006-01-14 13:21:00 -0800 | [diff] [blame] | 1017 | #if defined(CONFIG_S390) && defined(CONFIG_SMP) |
Martin Schwidefsky | 951f22d | 2005-07-27 11:44:57 -0700 | [diff] [blame] | 1018 | { |
Martin Schwidefsky | 951f22d | 2005-07-27 11:44:57 -0700 | [diff] [blame] | 1019 | .procname = "spin_retry", |
| 1020 | .data = &spin_retry, |
| 1021 | .maxlen = sizeof (int), |
| 1022 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1023 | .proc_handler = proc_dointvec, |
Martin Schwidefsky | 951f22d | 2005-07-27 11:44:57 -0700 | [diff] [blame] | 1024 | }, |
| 1025 | #endif |
Len Brown | 673d5b4 | 2007-07-28 03:33:16 -0400 | [diff] [blame] | 1026 | #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86) |
Pavel Machek | c255d84 | 2006-02-20 18:27:58 -0800 | [diff] [blame] | 1027 | { |
Pavel Machek | c255d84 | 2006-02-20 18:27:58 -0800 | [diff] [blame] | 1028 | .procname = "acpi_video_flags", |
Pavel Machek | 77afcf7 | 2007-07-19 01:47:41 -0700 | [diff] [blame] | 1029 | .data = &acpi_realmode_flags, |
Pavel Machek | c255d84 | 2006-02-20 18:27:58 -0800 | [diff] [blame] | 1030 | .maxlen = sizeof (unsigned long), |
| 1031 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1032 | .proc_handler = proc_doulongvec_minmax, |
Pavel Machek | c255d84 | 2006-02-20 18:27:58 -0800 | [diff] [blame] | 1033 | }, |
| 1034 | #endif |
Vineet Gupta | b6fca72 | 2013-01-09 20:06:28 +0530 | [diff] [blame] | 1035 | #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN |
Jes Sorensen | d2b176e | 2006-02-28 09:42:23 -0800 | [diff] [blame] | 1036 | { |
Jes Sorensen | d2b176e | 2006-02-28 09:42:23 -0800 | [diff] [blame] | 1037 | .procname = "ignore-unaligned-usertrap", |
| 1038 | .data = &no_unaligned_warning, |
| 1039 | .maxlen = sizeof (int), |
| 1040 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1041 | .proc_handler = proc_dointvec, |
Jes Sorensen | d2b176e | 2006-02-28 09:42:23 -0800 | [diff] [blame] | 1042 | }, |
Vineet Gupta | b6fca72 | 2013-01-09 20:06:28 +0530 | [diff] [blame] | 1043 | #endif |
| 1044 | #ifdef CONFIG_IA64 |
Doug Chapman | 88fc241 | 2009-01-15 10:38:56 -0800 | [diff] [blame] | 1045 | { |
Doug Chapman | 88fc241 | 2009-01-15 10:38:56 -0800 | [diff] [blame] | 1046 | .procname = "unaligned-dump-stack", |
| 1047 | .data = &unaligned_dump_stack, |
| 1048 | .maxlen = sizeof (int), |
| 1049 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1050 | .proc_handler = proc_dointvec, |
Doug Chapman | 88fc241 | 2009-01-15 10:38:56 -0800 | [diff] [blame] | 1051 | }, |
Jes Sorensen | d2b176e | 2006-02-28 09:42:23 -0800 | [diff] [blame] | 1052 | #endif |
Mandeep Singh Baines | e162b39 | 2009-01-15 11:08:40 -0800 | [diff] [blame] | 1053 | #ifdef CONFIG_DETECT_HUNG_TASK |
| 1054 | { |
Mandeep Singh Baines | e162b39 | 2009-01-15 11:08:40 -0800 | [diff] [blame] | 1055 | .procname = "hung_task_panic", |
| 1056 | .data = &sysctl_hung_task_panic, |
| 1057 | .maxlen = sizeof(int), |
| 1058 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1059 | .proc_handler = proc_dointvec_minmax, |
Mandeep Singh Baines | e162b39 | 2009-01-15 11:08:40 -0800 | [diff] [blame] | 1060 | .extra1 = &zero, |
| 1061 | .extra2 = &one, |
| 1062 | }, |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 1063 | { |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 1064 | .procname = "hung_task_check_count", |
| 1065 | .data = &sysctl_hung_task_check_count, |
Li Zefan | cd64647 | 2013-09-23 16:43:58 +0800 | [diff] [blame] | 1066 | .maxlen = sizeof(int), |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 1067 | .mode = 0644, |
Li Zefan | cd64647 | 2013-09-23 16:43:58 +0800 | [diff] [blame] | 1068 | .proc_handler = proc_dointvec_minmax, |
| 1069 | .extra1 = &zero, |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 1070 | }, |
| 1071 | { |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 1072 | .procname = "hung_task_timeout_secs", |
| 1073 | .data = &sysctl_hung_task_timeout_secs, |
Ingo Molnar | 9073908 | 2008-01-25 21:08:34 +0100 | [diff] [blame] | 1074 | .maxlen = sizeof(unsigned long), |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 1075 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1076 | .proc_handler = proc_dohung_task_timeout_secs, |
Liu Hua | 80df284 | 2014-04-07 15:38:57 -0700 | [diff] [blame] | 1077 | .extra2 = &hung_task_timeout_max, |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 1078 | }, |
| 1079 | { |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 1080 | .procname = "hung_task_warnings", |
| 1081 | .data = &sysctl_hung_task_warnings, |
Aaron Tomlin | 270750db | 2014-01-20 17:34:13 +0000 | [diff] [blame] | 1082 | .maxlen = sizeof(int), |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 1083 | .mode = 0644, |
Aaron Tomlin | 270750db | 2014-01-20 17:34:13 +0000 | [diff] [blame] | 1084 | .proc_handler = proc_dointvec_minmax, |
| 1085 | .extra1 = &neg_one, |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 1086 | }, |
Ravikiran G Thirumalai | c4f3b63 | 2007-10-16 23:26:09 -0700 | [diff] [blame] | 1087 | #endif |
Ingo Molnar | 23f78d4a | 2006-06-27 02:54:53 -0700 | [diff] [blame] | 1088 | #ifdef CONFIG_RT_MUTEXES |
| 1089 | { |
Ingo Molnar | 23f78d4a | 2006-06-27 02:54:53 -0700 | [diff] [blame] | 1090 | .procname = "max_lock_depth", |
| 1091 | .data = &max_lock_depth, |
| 1092 | .maxlen = sizeof(int), |
| 1093 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1094 | .proc_handler = proc_dointvec, |
Ingo Molnar | 23f78d4a | 2006-06-27 02:54:53 -0700 | [diff] [blame] | 1095 | }, |
| 1096 | #endif |
Jeremy Fitzhardinge | 10a0a8d | 2007-07-17 18:37:02 -0700 | [diff] [blame] | 1097 | { |
Jeremy Fitzhardinge | 10a0a8d | 2007-07-17 18:37:02 -0700 | [diff] [blame] | 1098 | .procname = "poweroff_cmd", |
| 1099 | .data = &poweroff_cmd, |
| 1100 | .maxlen = POWEROFF_CMD_PATH_LEN, |
| 1101 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1102 | .proc_handler = proc_dostring, |
Jeremy Fitzhardinge | 10a0a8d | 2007-07-17 18:37:02 -0700 | [diff] [blame] | 1103 | }, |
David Howells | 0b77f5b | 2008-04-29 01:01:32 -0700 | [diff] [blame] | 1104 | #ifdef CONFIG_KEYS |
| 1105 | { |
David Howells | 0b77f5b | 2008-04-29 01:01:32 -0700 | [diff] [blame] | 1106 | .procname = "keys", |
| 1107 | .mode = 0555, |
| 1108 | .child = key_sysctls, |
| 1109 | }, |
| 1110 | #endif |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 1111 | #ifdef CONFIG_PERF_EVENTS |
Vince Weaver | aa4a221 | 2011-06-03 17:54:40 -0400 | [diff] [blame] | 1112 | /* |
| 1113 | * User-space scripts rely on the existence of this file |
| 1114 | * as a feature check for perf_events being enabled. |
| 1115 | * |
| 1116 | * So it's an ABI, do not remove! |
| 1117 | */ |
Peter Zijlstra | 1ccd154 | 2009-04-09 10:53:45 +0200 | [diff] [blame] | 1118 | { |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 1119 | .procname = "perf_event_paranoid", |
| 1120 | .data = &sysctl_perf_event_paranoid, |
| 1121 | .maxlen = sizeof(sysctl_perf_event_paranoid), |
Peter Zijlstra | 1ccd154 | 2009-04-09 10:53:45 +0200 | [diff] [blame] | 1122 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1123 | .proc_handler = proc_dointvec, |
Peter Zijlstra | 1ccd154 | 2009-04-09 10:53:45 +0200 | [diff] [blame] | 1124 | }, |
Peter Zijlstra | c5078f7 | 2009-05-05 17:50:24 +0200 | [diff] [blame] | 1125 | { |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 1126 | .procname = "perf_event_mlock_kb", |
| 1127 | .data = &sysctl_perf_event_mlock, |
| 1128 | .maxlen = sizeof(sysctl_perf_event_mlock), |
Peter Zijlstra | c5078f7 | 2009-05-05 17:50:24 +0200 | [diff] [blame] | 1129 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1130 | .proc_handler = proc_dointvec, |
Peter Zijlstra | c5078f7 | 2009-05-05 17:50:24 +0200 | [diff] [blame] | 1131 | }, |
Peter Zijlstra | a78ac32 | 2009-05-25 17:39:05 +0200 | [diff] [blame] | 1132 | { |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 1133 | .procname = "perf_event_max_sample_rate", |
| 1134 | .data = &sysctl_perf_event_sample_rate, |
| 1135 | .maxlen = sizeof(sysctl_perf_event_sample_rate), |
Peter Zijlstra | a78ac32 | 2009-05-25 17:39:05 +0200 | [diff] [blame] | 1136 | .mode = 0644, |
Peter Zijlstra | 163ec43 | 2011-02-16 11:22:34 +0100 | [diff] [blame] | 1137 | .proc_handler = perf_proc_update_handler, |
Knut Petersen | 723478c | 2013-09-25 14:29:37 +0200 | [diff] [blame] | 1138 | .extra1 = &one, |
Peter Zijlstra | a78ac32 | 2009-05-25 17:39:05 +0200 | [diff] [blame] | 1139 | }, |
Dave Hansen | 14c63f1 | 2013-06-21 08:51:36 -0700 | [diff] [blame] | 1140 | { |
| 1141 | .procname = "perf_cpu_time_max_percent", |
| 1142 | .data = &sysctl_perf_cpu_time_max_percent, |
| 1143 | .maxlen = sizeof(sysctl_perf_cpu_time_max_percent), |
| 1144 | .mode = 0644, |
| 1145 | .proc_handler = perf_cpu_time_max_percent_handler, |
| 1146 | .extra1 = &zero, |
| 1147 | .extra2 = &one_hundred, |
| 1148 | }, |
Arnaldo Carvalho de Melo | c5dfd78 | 2016-04-21 12:28:50 -0300 | [diff] [blame] | 1149 | { |
| 1150 | .procname = "perf_event_max_stack", |
Arnaldo Carvalho de Melo | a831100 | 2016-05-10 16:34:53 -0300 | [diff] [blame] | 1151 | .data = &sysctl_perf_event_max_stack, |
Arnaldo Carvalho de Melo | c5dfd78 | 2016-04-21 12:28:50 -0300 | [diff] [blame] | 1152 | .maxlen = sizeof(sysctl_perf_event_max_stack), |
| 1153 | .mode = 0644, |
| 1154 | .proc_handler = perf_event_max_stack_handler, |
| 1155 | .extra1 = &zero, |
| 1156 | .extra2 = &six_hundred_forty_kb, |
| 1157 | }, |
Arnaldo Carvalho de Melo | c85b033 | 2016-05-12 13:06:21 -0300 | [diff] [blame] | 1158 | { |
| 1159 | .procname = "perf_event_max_contexts_per_stack", |
| 1160 | .data = &sysctl_perf_event_max_contexts_per_stack, |
| 1161 | .maxlen = sizeof(sysctl_perf_event_max_contexts_per_stack), |
| 1162 | .mode = 0644, |
| 1163 | .proc_handler = perf_event_max_stack_handler, |
| 1164 | .extra1 = &zero, |
| 1165 | .extra2 = &one_thousand, |
| 1166 | }, |
Peter Zijlstra | 1ccd154 | 2009-04-09 10:53:45 +0200 | [diff] [blame] | 1167 | #endif |
Vegard Nossum | dfec072 | 2008-04-04 00:51:41 +0200 | [diff] [blame] | 1168 | #ifdef CONFIG_KMEMCHECK |
| 1169 | { |
Vegard Nossum | dfec072 | 2008-04-04 00:51:41 +0200 | [diff] [blame] | 1170 | .procname = "kmemcheck", |
| 1171 | .data = &kmemcheck_enabled, |
| 1172 | .maxlen = sizeof(int), |
| 1173 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1174 | .proc_handler = proc_dointvec, |
Vegard Nossum | dfec072 | 2008-04-04 00:51:41 +0200 | [diff] [blame] | 1175 | }, |
| 1176 | #endif |
Prarit Bhargava | 9e3961a | 2014-12-10 15:45:50 -0800 | [diff] [blame] | 1177 | { |
| 1178 | .procname = "panic_on_warn", |
| 1179 | .data = &panic_on_warn, |
| 1180 | .maxlen = sizeof(int), |
| 1181 | .mode = 0644, |
| 1182 | .proc_handler = proc_dointvec_minmax, |
| 1183 | .extra1 = &zero, |
| 1184 | .extra2 = &one, |
| 1185 | }, |
Thomas Gleixner | bc7a34b | 2015-05-26 22:50:33 +0000 | [diff] [blame] | 1186 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) |
| 1187 | { |
| 1188 | .procname = "timer_migration", |
| 1189 | .data = &sysctl_timer_migration, |
| 1190 | .maxlen = sizeof(unsigned int), |
| 1191 | .mode = 0644, |
| 1192 | .proc_handler = timer_migration_handler, |
Myungho Jung | 4c00015 | 2017-04-19 15:24:50 -0700 | [diff] [blame] | 1193 | .extra1 = &zero, |
| 1194 | .extra2 = &one, |
Thomas Gleixner | bc7a34b | 2015-05-26 22:50:33 +0000 | [diff] [blame] | 1195 | }, |
| 1196 | #endif |
Alexei Starovoitov | 1be7f75 | 2015-10-07 22:23:21 -0700 | [diff] [blame] | 1197 | #ifdef CONFIG_BPF_SYSCALL |
| 1198 | { |
| 1199 | .procname = "unprivileged_bpf_disabled", |
| 1200 | .data = &sysctl_unprivileged_bpf_disabled, |
| 1201 | .maxlen = sizeof(sysctl_unprivileged_bpf_disabled), |
| 1202 | .mode = 0644, |
| 1203 | /* only handle a transition from default "0" to "1" */ |
| 1204 | .proc_handler = proc_dointvec_minmax, |
| 1205 | .extra1 = &one, |
| 1206 | .extra2 = &one, |
| 1207 | }, |
| 1208 | #endif |
Daniel Bristot de Oliveira | 088e9d2 | 2016-06-02 13:51:41 -0300 | [diff] [blame] | 1209 | #if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU) |
| 1210 | { |
| 1211 | .procname = "panic_on_rcu_stall", |
| 1212 | .data = &sysctl_panic_on_rcu_stall, |
| 1213 | .maxlen = sizeof(sysctl_panic_on_rcu_stall), |
| 1214 | .mode = 0644, |
| 1215 | .proc_handler = proc_dointvec_minmax, |
| 1216 | .extra1 = &zero, |
| 1217 | .extra2 = &one, |
| 1218 | }, |
| 1219 | #endif |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 1220 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1221 | }; |
| 1222 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 1223 | static struct ctl_table vm_table[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1224 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1225 | .procname = "overcommit_memory", |
| 1226 | .data = &sysctl_overcommit_memory, |
| 1227 | .maxlen = sizeof(sysctl_overcommit_memory), |
| 1228 | .mode = 0644, |
Petr Holasek | cb16e95 | 2011-03-23 16:43:09 -0700 | [diff] [blame] | 1229 | .proc_handler = proc_dointvec_minmax, |
| 1230 | .extra1 = &zero, |
| 1231 | .extra2 = &two, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1232 | }, |
| 1233 | { |
KAMEZAWA Hiroyuki | fadd8fb | 2006-06-23 02:03:13 -0700 | [diff] [blame] | 1234 | .procname = "panic_on_oom", |
| 1235 | .data = &sysctl_panic_on_oom, |
| 1236 | .maxlen = sizeof(sysctl_panic_on_oom), |
| 1237 | .mode = 0644, |
Petr Holasek | cb16e95 | 2011-03-23 16:43:09 -0700 | [diff] [blame] | 1238 | .proc_handler = proc_dointvec_minmax, |
| 1239 | .extra1 = &zero, |
| 1240 | .extra2 = &two, |
KAMEZAWA Hiroyuki | fadd8fb | 2006-06-23 02:03:13 -0700 | [diff] [blame] | 1241 | }, |
| 1242 | { |
David Rientjes | fe071d7 | 2007-10-16 23:25:56 -0700 | [diff] [blame] | 1243 | .procname = "oom_kill_allocating_task", |
| 1244 | .data = &sysctl_oom_kill_allocating_task, |
| 1245 | .maxlen = sizeof(sysctl_oom_kill_allocating_task), |
| 1246 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1247 | .proc_handler = proc_dointvec, |
David Rientjes | fe071d7 | 2007-10-16 23:25:56 -0700 | [diff] [blame] | 1248 | }, |
| 1249 | { |
David Rientjes | fef1bdd | 2008-02-07 00:14:07 -0800 | [diff] [blame] | 1250 | .procname = "oom_dump_tasks", |
| 1251 | .data = &sysctl_oom_dump_tasks, |
| 1252 | .maxlen = sizeof(sysctl_oom_dump_tasks), |
| 1253 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1254 | .proc_handler = proc_dointvec, |
David Rientjes | fef1bdd | 2008-02-07 00:14:07 -0800 | [diff] [blame] | 1255 | }, |
| 1256 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1257 | .procname = "overcommit_ratio", |
| 1258 | .data = &sysctl_overcommit_ratio, |
| 1259 | .maxlen = sizeof(sysctl_overcommit_ratio), |
| 1260 | .mode = 0644, |
Jerome Marchand | 49f0ce5 | 2014-01-21 15:49:14 -0800 | [diff] [blame] | 1261 | .proc_handler = overcommit_ratio_handler, |
| 1262 | }, |
| 1263 | { |
| 1264 | .procname = "overcommit_kbytes", |
| 1265 | .data = &sysctl_overcommit_kbytes, |
| 1266 | .maxlen = sizeof(sysctl_overcommit_kbytes), |
| 1267 | .mode = 0644, |
| 1268 | .proc_handler = overcommit_kbytes_handler, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1269 | }, |
| 1270 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1271 | .procname = "page-cluster", |
| 1272 | .data = &page_cluster, |
| 1273 | .maxlen = sizeof(int), |
| 1274 | .mode = 0644, |
Petr Holasek | cb16e95 | 2011-03-23 16:43:09 -0700 | [diff] [blame] | 1275 | .proc_handler = proc_dointvec_minmax, |
| 1276 | .extra1 = &zero, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1277 | }, |
| 1278 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1279 | .procname = "dirty_background_ratio", |
| 1280 | .data = &dirty_background_ratio, |
| 1281 | .maxlen = sizeof(dirty_background_ratio), |
| 1282 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1283 | .proc_handler = dirty_background_ratio_handler, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1284 | .extra1 = &zero, |
| 1285 | .extra2 = &one_hundred, |
| 1286 | }, |
| 1287 | { |
David Rientjes | 2da0299 | 2009-01-06 14:39:31 -0800 | [diff] [blame] | 1288 | .procname = "dirty_background_bytes", |
| 1289 | .data = &dirty_background_bytes, |
| 1290 | .maxlen = sizeof(dirty_background_bytes), |
| 1291 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1292 | .proc_handler = dirty_background_bytes_handler, |
Sven Wegener | fc3501d | 2009-02-11 13:04:23 -0800 | [diff] [blame] | 1293 | .extra1 = &one_ul, |
David Rientjes | 2da0299 | 2009-01-06 14:39:31 -0800 | [diff] [blame] | 1294 | }, |
| 1295 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1296 | .procname = "dirty_ratio", |
| 1297 | .data = &vm_dirty_ratio, |
| 1298 | .maxlen = sizeof(vm_dirty_ratio), |
| 1299 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1300 | .proc_handler = dirty_ratio_handler, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1301 | .extra1 = &zero, |
| 1302 | .extra2 = &one_hundred, |
| 1303 | }, |
| 1304 | { |
David Rientjes | 2da0299 | 2009-01-06 14:39:31 -0800 | [diff] [blame] | 1305 | .procname = "dirty_bytes", |
| 1306 | .data = &vm_dirty_bytes, |
| 1307 | .maxlen = sizeof(vm_dirty_bytes), |
| 1308 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1309 | .proc_handler = dirty_bytes_handler, |
Andrea Righi | 9e4a5bd | 2009-04-30 15:08:57 -0700 | [diff] [blame] | 1310 | .extra1 = &dirty_bytes_min, |
David Rientjes | 2da0299 | 2009-01-06 14:39:31 -0800 | [diff] [blame] | 1311 | }, |
| 1312 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1313 | .procname = "dirty_writeback_centisecs", |
Bart Samwel | f6ef943 | 2006-03-24 03:15:48 -0800 | [diff] [blame] | 1314 | .data = &dirty_writeback_interval, |
| 1315 | .maxlen = sizeof(dirty_writeback_interval), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1316 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1317 | .proc_handler = dirty_writeback_centisecs_handler, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1318 | }, |
| 1319 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1320 | .procname = "dirty_expire_centisecs", |
Bart Samwel | f6ef943 | 2006-03-24 03:15:48 -0800 | [diff] [blame] | 1321 | .data = &dirty_expire_interval, |
| 1322 | .maxlen = sizeof(dirty_expire_interval), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1323 | .mode = 0644, |
Petr Holasek | cb16e95 | 2011-03-23 16:43:09 -0700 | [diff] [blame] | 1324 | .proc_handler = proc_dointvec_minmax, |
| 1325 | .extra1 = &zero, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1326 | }, |
| 1327 | { |
Theodore Ts'o | 1efff91 | 2015-03-17 12:23:32 -0400 | [diff] [blame] | 1328 | .procname = "dirtytime_expire_seconds", |
| 1329 | .data = &dirtytime_expire_interval, |
| 1330 | .maxlen = sizeof(dirty_expire_interval), |
| 1331 | .mode = 0644, |
| 1332 | .proc_handler = dirtytime_interval_handler, |
| 1333 | .extra1 = &zero, |
| 1334 | }, |
| 1335 | { |
Wanpeng Li | 3965c9a | 2012-07-31 16:41:52 -0700 | [diff] [blame] | 1336 | .procname = "nr_pdflush_threads", |
| 1337 | .mode = 0444 /* read-only */, |
| 1338 | .proc_handler = pdflush_proc_obsolete, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1339 | }, |
| 1340 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1341 | .procname = "swappiness", |
| 1342 | .data = &vm_swappiness, |
| 1343 | .maxlen = sizeof(vm_swappiness), |
| 1344 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1345 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1346 | .extra1 = &zero, |
| 1347 | .extra2 = &one_hundred, |
| 1348 | }, |
| 1349 | #ifdef CONFIG_HUGETLB_PAGE |
Lee Schermerhorn | 06808b0 | 2009-12-14 17:58:21 -0800 | [diff] [blame] | 1350 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1351 | .procname = "nr_hugepages", |
Andi Kleen | e5ff215 | 2008-07-23 21:27:42 -0700 | [diff] [blame] | 1352 | .data = NULL, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1353 | .maxlen = sizeof(unsigned long), |
| 1354 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1355 | .proc_handler = hugetlb_sysctl_handler, |
Lee Schermerhorn | 06808b0 | 2009-12-14 17:58:21 -0800 | [diff] [blame] | 1356 | }, |
| 1357 | #ifdef CONFIG_NUMA |
| 1358 | { |
| 1359 | .procname = "nr_hugepages_mempolicy", |
| 1360 | .data = NULL, |
| 1361 | .maxlen = sizeof(unsigned long), |
| 1362 | .mode = 0644, |
| 1363 | .proc_handler = &hugetlb_mempolicy_sysctl_handler, |
Lee Schermerhorn | 06808b0 | 2009-12-14 17:58:21 -0800 | [diff] [blame] | 1364 | }, |
| 1365 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1366 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1367 | .procname = "hugetlb_shm_group", |
| 1368 | .data = &sysctl_hugetlb_shm_group, |
| 1369 | .maxlen = sizeof(gid_t), |
| 1370 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1371 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1372 | }, |
Mel Gorman | 396faf0 | 2007-07-17 04:03:13 -0700 | [diff] [blame] | 1373 | { |
Mel Gorman | 396faf0 | 2007-07-17 04:03:13 -0700 | [diff] [blame] | 1374 | .procname = "hugepages_treat_as_movable", |
| 1375 | .data = &hugepages_treat_as_movable, |
| 1376 | .maxlen = sizeof(int), |
| 1377 | .mode = 0644, |
Naoya Horiguchi | 86cdb46 | 2013-09-11 14:22:13 -0700 | [diff] [blame] | 1378 | .proc_handler = proc_dointvec, |
Mel Gorman | 396faf0 | 2007-07-17 04:03:13 -0700 | [diff] [blame] | 1379 | }, |
Adam Litke | 54f9f80 | 2007-10-16 01:26:20 -0700 | [diff] [blame] | 1380 | { |
Nishanth Aravamudan | d1c3fb1 | 2007-12-17 16:20:12 -0800 | [diff] [blame] | 1381 | .procname = "nr_overcommit_hugepages", |
Andi Kleen | e5ff215 | 2008-07-23 21:27:42 -0700 | [diff] [blame] | 1382 | .data = NULL, |
| 1383 | .maxlen = sizeof(unsigned long), |
Nishanth Aravamudan | d1c3fb1 | 2007-12-17 16:20:12 -0800 | [diff] [blame] | 1384 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1385 | .proc_handler = hugetlb_overcommit_handler, |
Nishanth Aravamudan | d1c3fb1 | 2007-12-17 16:20:12 -0800 | [diff] [blame] | 1386 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1387 | #endif |
| 1388 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1389 | .procname = "lowmem_reserve_ratio", |
| 1390 | .data = &sysctl_lowmem_reserve_ratio, |
| 1391 | .maxlen = sizeof(sysctl_lowmem_reserve_ratio), |
| 1392 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1393 | .proc_handler = lowmem_reserve_ratio_sysctl_handler, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1394 | }, |
| 1395 | { |
Andrew Morton | 9d0243b | 2006-01-08 01:00:39 -0800 | [diff] [blame] | 1396 | .procname = "drop_caches", |
| 1397 | .data = &sysctl_drop_caches, |
| 1398 | .maxlen = sizeof(int), |
| 1399 | .mode = 0644, |
| 1400 | .proc_handler = drop_caches_sysctl_handler, |
Petr Holasek | cb16e95 | 2011-03-23 16:43:09 -0700 | [diff] [blame] | 1401 | .extra1 = &one, |
Dave Hansen | 5509a5d | 2014-04-03 14:48:19 -0700 | [diff] [blame] | 1402 | .extra2 = &four, |
Andrew Morton | 9d0243b | 2006-01-08 01:00:39 -0800 | [diff] [blame] | 1403 | }, |
Mel Gorman | 76ab0f5 | 2010-05-24 14:32:28 -0700 | [diff] [blame] | 1404 | #ifdef CONFIG_COMPACTION |
| 1405 | { |
| 1406 | .procname = "compact_memory", |
| 1407 | .data = &sysctl_compact_memory, |
| 1408 | .maxlen = sizeof(int), |
| 1409 | .mode = 0200, |
| 1410 | .proc_handler = sysctl_compaction_handler, |
| 1411 | }, |
Mel Gorman | 5e77190 | 2010-05-24 14:32:31 -0700 | [diff] [blame] | 1412 | { |
| 1413 | .procname = "extfrag_threshold", |
| 1414 | .data = &sysctl_extfrag_threshold, |
| 1415 | .maxlen = sizeof(int), |
| 1416 | .mode = 0644, |
| 1417 | .proc_handler = sysctl_extfrag_handler, |
| 1418 | .extra1 = &min_extfrag_threshold, |
| 1419 | .extra2 = &max_extfrag_threshold, |
| 1420 | }, |
Eric B Munson | 5bbe354 | 2015-04-15 16:13:20 -0700 | [diff] [blame] | 1421 | { |
| 1422 | .procname = "compact_unevictable_allowed", |
| 1423 | .data = &sysctl_compact_unevictable_allowed, |
| 1424 | .maxlen = sizeof(int), |
| 1425 | .mode = 0644, |
| 1426 | .proc_handler = proc_dointvec, |
| 1427 | .extra1 = &zero, |
| 1428 | .extra2 = &one, |
| 1429 | }, |
Mel Gorman | 5e77190 | 2010-05-24 14:32:31 -0700 | [diff] [blame] | 1430 | |
Mel Gorman | 76ab0f5 | 2010-05-24 14:32:28 -0700 | [diff] [blame] | 1431 | #endif /* CONFIG_COMPACTION */ |
Andrew Morton | 9d0243b | 2006-01-08 01:00:39 -0800 | [diff] [blame] | 1432 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1433 | .procname = "min_free_kbytes", |
| 1434 | .data = &min_free_kbytes, |
| 1435 | .maxlen = sizeof(min_free_kbytes), |
| 1436 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1437 | .proc_handler = min_free_kbytes_sysctl_handler, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1438 | .extra1 = &zero, |
| 1439 | }, |
Rohit Seth | 8ad4b1f | 2006-01-08 01:00:40 -0800 | [diff] [blame] | 1440 | { |
Johannes Weiner | 795ae7a | 2016-03-17 14:19:14 -0700 | [diff] [blame] | 1441 | .procname = "watermark_scale_factor", |
| 1442 | .data = &watermark_scale_factor, |
| 1443 | .maxlen = sizeof(watermark_scale_factor), |
| 1444 | .mode = 0644, |
| 1445 | .proc_handler = watermark_scale_factor_sysctl_handler, |
| 1446 | .extra1 = &one, |
| 1447 | .extra2 = &one_thousand, |
| 1448 | }, |
| 1449 | { |
Rohit Seth | 8ad4b1f | 2006-01-08 01:00:40 -0800 | [diff] [blame] | 1450 | .procname = "percpu_pagelist_fraction", |
| 1451 | .data = &percpu_pagelist_fraction, |
| 1452 | .maxlen = sizeof(percpu_pagelist_fraction), |
| 1453 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1454 | .proc_handler = percpu_pagelist_fraction_sysctl_handler, |
David Rientjes | 7cd2b0a | 2014-06-23 13:22:04 -0700 | [diff] [blame] | 1455 | .extra1 = &zero, |
Rohit Seth | 8ad4b1f | 2006-01-08 01:00:40 -0800 | [diff] [blame] | 1456 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1457 | #ifdef CONFIG_MMU |
| 1458 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1459 | .procname = "max_map_count", |
| 1460 | .data = &sysctl_max_map_count, |
| 1461 | .maxlen = sizeof(sysctl_max_map_count), |
| 1462 | .mode = 0644, |
WANG Cong | 3e26120 | 2009-12-17 15:27:05 -0800 | [diff] [blame] | 1463 | .proc_handler = proc_dointvec_minmax, |
Amerigo Wang | 70da234 | 2009-12-14 17:59:52 -0800 | [diff] [blame] | 1464 | .extra1 = &zero, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1465 | }, |
Paul Mundt | dd8632a | 2009-01-08 12:04:47 +0000 | [diff] [blame] | 1466 | #else |
| 1467 | { |
Paul Mundt | dd8632a | 2009-01-08 12:04:47 +0000 | [diff] [blame] | 1468 | .procname = "nr_trim_pages", |
| 1469 | .data = &sysctl_nr_trim_pages, |
| 1470 | .maxlen = sizeof(sysctl_nr_trim_pages), |
| 1471 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1472 | .proc_handler = proc_dointvec_minmax, |
Paul Mundt | dd8632a | 2009-01-08 12:04:47 +0000 | [diff] [blame] | 1473 | .extra1 = &zero, |
| 1474 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1475 | #endif |
| 1476 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1477 | .procname = "laptop_mode", |
| 1478 | .data = &laptop_mode, |
| 1479 | .maxlen = sizeof(laptop_mode), |
| 1480 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1481 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1482 | }, |
| 1483 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1484 | .procname = "block_dump", |
| 1485 | .data = &block_dump, |
| 1486 | .maxlen = sizeof(block_dump), |
| 1487 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1488 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1489 | .extra1 = &zero, |
| 1490 | }, |
| 1491 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1492 | .procname = "vfs_cache_pressure", |
| 1493 | .data = &sysctl_vfs_cache_pressure, |
| 1494 | .maxlen = sizeof(sysctl_vfs_cache_pressure), |
| 1495 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1496 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1497 | .extra1 = &zero, |
| 1498 | }, |
| 1499 | #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT |
| 1500 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1501 | .procname = "legacy_va_layout", |
| 1502 | .data = &sysctl_legacy_va_layout, |
| 1503 | .maxlen = sizeof(sysctl_legacy_va_layout), |
| 1504 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1505 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1506 | .extra1 = &zero, |
| 1507 | }, |
| 1508 | #endif |
Christoph Lameter | 1743660 | 2006-01-18 17:42:32 -0800 | [diff] [blame] | 1509 | #ifdef CONFIG_NUMA |
| 1510 | { |
Christoph Lameter | 1743660 | 2006-01-18 17:42:32 -0800 | [diff] [blame] | 1511 | .procname = "zone_reclaim_mode", |
Mel Gorman | a5f5f91 | 2016-07-28 15:46:32 -0700 | [diff] [blame] | 1512 | .data = &node_reclaim_mode, |
| 1513 | .maxlen = sizeof(node_reclaim_mode), |
Christoph Lameter | 1743660 | 2006-01-18 17:42:32 -0800 | [diff] [blame] | 1514 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1515 | .proc_handler = proc_dointvec, |
Christoph Lameter | c84db23 | 2006-02-01 03:05:29 -0800 | [diff] [blame] | 1516 | .extra1 = &zero, |
Christoph Lameter | 1743660 | 2006-01-18 17:42:32 -0800 | [diff] [blame] | 1517 | }, |
Christoph Lameter | 9614634 | 2006-07-03 00:24:13 -0700 | [diff] [blame] | 1518 | { |
Christoph Lameter | 9614634 | 2006-07-03 00:24:13 -0700 | [diff] [blame] | 1519 | .procname = "min_unmapped_ratio", |
| 1520 | .data = &sysctl_min_unmapped_ratio, |
| 1521 | .maxlen = sizeof(sysctl_min_unmapped_ratio), |
| 1522 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1523 | .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler, |
Christoph Lameter | 9614634 | 2006-07-03 00:24:13 -0700 | [diff] [blame] | 1524 | .extra1 = &zero, |
| 1525 | .extra2 = &one_hundred, |
| 1526 | }, |
Christoph Lameter | 0ff3849 | 2006-09-25 23:31:52 -0700 | [diff] [blame] | 1527 | { |
Christoph Lameter | 0ff3849 | 2006-09-25 23:31:52 -0700 | [diff] [blame] | 1528 | .procname = "min_slab_ratio", |
| 1529 | .data = &sysctl_min_slab_ratio, |
| 1530 | .maxlen = sizeof(sysctl_min_slab_ratio), |
| 1531 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1532 | .proc_handler = sysctl_min_slab_ratio_sysctl_handler, |
Christoph Lameter | 0ff3849 | 2006-09-25 23:31:52 -0700 | [diff] [blame] | 1533 | .extra1 = &zero, |
| 1534 | .extra2 = &one_hundred, |
| 1535 | }, |
Christoph Lameter | 1743660 | 2006-01-18 17:42:32 -0800 | [diff] [blame] | 1536 | #endif |
Christoph Lameter | 77461ab | 2007-05-09 02:35:13 -0700 | [diff] [blame] | 1537 | #ifdef CONFIG_SMP |
| 1538 | { |
Christoph Lameter | 77461ab | 2007-05-09 02:35:13 -0700 | [diff] [blame] | 1539 | .procname = "stat_interval", |
| 1540 | .data = &sysctl_stat_interval, |
| 1541 | .maxlen = sizeof(sysctl_stat_interval), |
| 1542 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1543 | .proc_handler = proc_dointvec_jiffies, |
Christoph Lameter | 77461ab | 2007-05-09 02:35:13 -0700 | [diff] [blame] | 1544 | }, |
Hugh Dickins | 52b6f46 | 2016-05-19 17:12:50 -0700 | [diff] [blame] | 1545 | { |
| 1546 | .procname = "stat_refresh", |
| 1547 | .data = NULL, |
| 1548 | .maxlen = 0, |
| 1549 | .mode = 0600, |
| 1550 | .proc_handler = vmstat_refresh, |
| 1551 | }, |
Christoph Lameter | 77461ab | 2007-05-09 02:35:13 -0700 | [diff] [blame] | 1552 | #endif |
David Howells | 6e14154 | 2009-12-15 19:27:45 +0000 | [diff] [blame] | 1553 | #ifdef CONFIG_MMU |
Eric Paris | ed03218 | 2007-06-28 15:55:21 -0400 | [diff] [blame] | 1554 | { |
Eric Paris | ed03218 | 2007-06-28 15:55:21 -0400 | [diff] [blame] | 1555 | .procname = "mmap_min_addr", |
Eric Paris | 788084a | 2009-07-31 12:54:11 -0400 | [diff] [blame] | 1556 | .data = &dac_mmap_min_addr, |
| 1557 | .maxlen = sizeof(unsigned long), |
Eric Paris | ed03218 | 2007-06-28 15:55:21 -0400 | [diff] [blame] | 1558 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1559 | .proc_handler = mmap_min_addr_handler, |
Eric Paris | ed03218 | 2007-06-28 15:55:21 -0400 | [diff] [blame] | 1560 | }, |
David Howells | 6e14154 | 2009-12-15 19:27:45 +0000 | [diff] [blame] | 1561 | #endif |
KAMEZAWA Hiroyuki | f0c0b2b | 2007-07-15 23:38:01 -0700 | [diff] [blame] | 1562 | #ifdef CONFIG_NUMA |
| 1563 | { |
KAMEZAWA Hiroyuki | f0c0b2b | 2007-07-15 23:38:01 -0700 | [diff] [blame] | 1564 | .procname = "numa_zonelist_order", |
| 1565 | .data = &numa_zonelist_order, |
| 1566 | .maxlen = NUMA_ZONELIST_ORDER_LEN, |
| 1567 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1568 | .proc_handler = numa_zonelist_order_handler, |
KAMEZAWA Hiroyuki | f0c0b2b | 2007-07-15 23:38:01 -0700 | [diff] [blame] | 1569 | }, |
| 1570 | #endif |
Al Viro | 2b8232c | 2007-10-13 08:16:04 +0100 | [diff] [blame] | 1571 | #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \ |
Paul Mundt | 5c36e65 | 2007-03-01 10:07:42 +0900 | [diff] [blame] | 1572 | (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) |
Ingo Molnar | e6e5494 | 2006-06-27 02:53:50 -0700 | [diff] [blame] | 1573 | { |
Ingo Molnar | e6e5494 | 2006-06-27 02:53:50 -0700 | [diff] [blame] | 1574 | .procname = "vdso_enabled", |
Andy Lutomirski | 3d7ee96 | 2014-05-05 12:19:32 -0700 | [diff] [blame] | 1575 | #ifdef CONFIG_X86_32 |
| 1576 | .data = &vdso32_enabled, |
| 1577 | .maxlen = sizeof(vdso32_enabled), |
| 1578 | #else |
Ingo Molnar | e6e5494 | 2006-06-27 02:53:50 -0700 | [diff] [blame] | 1579 | .data = &vdso_enabled, |
| 1580 | .maxlen = sizeof(vdso_enabled), |
Andy Lutomirski | 3d7ee96 | 2014-05-05 12:19:32 -0700 | [diff] [blame] | 1581 | #endif |
Ingo Molnar | e6e5494 | 2006-06-27 02:53:50 -0700 | [diff] [blame] | 1582 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1583 | .proc_handler = proc_dointvec, |
Ingo Molnar | e6e5494 | 2006-06-27 02:53:50 -0700 | [diff] [blame] | 1584 | .extra1 = &zero, |
| 1585 | }, |
| 1586 | #endif |
Bron Gondwana | 195cf45 | 2008-02-04 22:29:20 -0800 | [diff] [blame] | 1587 | #ifdef CONFIG_HIGHMEM |
| 1588 | { |
Bron Gondwana | 195cf45 | 2008-02-04 22:29:20 -0800 | [diff] [blame] | 1589 | .procname = "highmem_is_dirtyable", |
| 1590 | .data = &vm_highmem_is_dirtyable, |
| 1591 | .maxlen = sizeof(vm_highmem_is_dirtyable), |
| 1592 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1593 | .proc_handler = proc_dointvec_minmax, |
Bron Gondwana | 195cf45 | 2008-02-04 22:29:20 -0800 | [diff] [blame] | 1594 | .extra1 = &zero, |
| 1595 | .extra2 = &one, |
| 1596 | }, |
| 1597 | #endif |
Andi Kleen | 6a46079 | 2009-09-16 11:50:15 +0200 | [diff] [blame] | 1598 | #ifdef CONFIG_MEMORY_FAILURE |
| 1599 | { |
Andi Kleen | 6a46079 | 2009-09-16 11:50:15 +0200 | [diff] [blame] | 1600 | .procname = "memory_failure_early_kill", |
| 1601 | .data = &sysctl_memory_failure_early_kill, |
| 1602 | .maxlen = sizeof(sysctl_memory_failure_early_kill), |
| 1603 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1604 | .proc_handler = proc_dointvec_minmax, |
Andi Kleen | 6a46079 | 2009-09-16 11:50:15 +0200 | [diff] [blame] | 1605 | .extra1 = &zero, |
| 1606 | .extra2 = &one, |
| 1607 | }, |
| 1608 | { |
Andi Kleen | 6a46079 | 2009-09-16 11:50:15 +0200 | [diff] [blame] | 1609 | .procname = "memory_failure_recovery", |
| 1610 | .data = &sysctl_memory_failure_recovery, |
| 1611 | .maxlen = sizeof(sysctl_memory_failure_recovery), |
| 1612 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1613 | .proc_handler = proc_dointvec_minmax, |
Andi Kleen | 6a46079 | 2009-09-16 11:50:15 +0200 | [diff] [blame] | 1614 | .extra1 = &zero, |
| 1615 | .extra2 = &one, |
| 1616 | }, |
| 1617 | #endif |
Andrew Shewmaker | c9b1d09 | 2013-04-29 15:08:10 -0700 | [diff] [blame] | 1618 | { |
| 1619 | .procname = "user_reserve_kbytes", |
| 1620 | .data = &sysctl_user_reserve_kbytes, |
| 1621 | .maxlen = sizeof(sysctl_user_reserve_kbytes), |
| 1622 | .mode = 0644, |
| 1623 | .proc_handler = proc_doulongvec_minmax, |
| 1624 | }, |
Andrew Shewmaker | 4eeab4f | 2013-04-29 15:08:11 -0700 | [diff] [blame] | 1625 | { |
| 1626 | .procname = "admin_reserve_kbytes", |
| 1627 | .data = &sysctl_admin_reserve_kbytes, |
| 1628 | .maxlen = sizeof(sysctl_admin_reserve_kbytes), |
| 1629 | .mode = 0644, |
| 1630 | .proc_handler = proc_doulongvec_minmax, |
| 1631 | }, |
Daniel Cashman | d07e225 | 2016-01-14 15:19:53 -0800 | [diff] [blame] | 1632 | #ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS |
| 1633 | { |
| 1634 | .procname = "mmap_rnd_bits", |
| 1635 | .data = &mmap_rnd_bits, |
| 1636 | .maxlen = sizeof(mmap_rnd_bits), |
| 1637 | .mode = 0600, |
| 1638 | .proc_handler = proc_dointvec_minmax, |
| 1639 | .extra1 = (void *)&mmap_rnd_bits_min, |
| 1640 | .extra2 = (void *)&mmap_rnd_bits_max, |
| 1641 | }, |
| 1642 | #endif |
| 1643 | #ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS |
| 1644 | { |
| 1645 | .procname = "mmap_rnd_compat_bits", |
| 1646 | .data = &mmap_rnd_compat_bits, |
| 1647 | .maxlen = sizeof(mmap_rnd_compat_bits), |
| 1648 | .mode = 0600, |
| 1649 | .proc_handler = proc_dointvec_minmax, |
| 1650 | .extra1 = (void *)&mmap_rnd_compat_bits_min, |
| 1651 | .extra2 = (void *)&mmap_rnd_compat_bits_max, |
| 1652 | }, |
| 1653 | #endif |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 1654 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1655 | }; |
| 1656 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 1657 | static struct ctl_table fs_table[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1658 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1659 | .procname = "inode-nr", |
| 1660 | .data = &inodes_stat, |
Glauber Costa | 3942c07 | 2013-08-28 10:17:53 +1000 | [diff] [blame] | 1661 | .maxlen = 2*sizeof(long), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1662 | .mode = 0444, |
Dave Chinner | cffbc8a | 2010-10-23 05:03:02 -0400 | [diff] [blame] | 1663 | .proc_handler = proc_nr_inodes, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1664 | }, |
| 1665 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1666 | .procname = "inode-state", |
| 1667 | .data = &inodes_stat, |
Glauber Costa | 3942c07 | 2013-08-28 10:17:53 +1000 | [diff] [blame] | 1668 | .maxlen = 7*sizeof(long), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1669 | .mode = 0444, |
Dave Chinner | cffbc8a | 2010-10-23 05:03:02 -0400 | [diff] [blame] | 1670 | .proc_handler = proc_nr_inodes, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1671 | }, |
| 1672 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1673 | .procname = "file-nr", |
| 1674 | .data = &files_stat, |
Eric Dumazet | 518de9b | 2010-10-26 14:22:44 -0700 | [diff] [blame] | 1675 | .maxlen = sizeof(files_stat), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1676 | .mode = 0444, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1677 | .proc_handler = proc_nr_files, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1678 | }, |
| 1679 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1680 | .procname = "file-max", |
| 1681 | .data = &files_stat.max_files, |
Eric Dumazet | 518de9b | 2010-10-26 14:22:44 -0700 | [diff] [blame] | 1682 | .maxlen = sizeof(files_stat.max_files), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1683 | .mode = 0644, |
Eric Dumazet | 518de9b | 2010-10-26 14:22:44 -0700 | [diff] [blame] | 1684 | .proc_handler = proc_doulongvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1685 | }, |
| 1686 | { |
Eric Dumazet | 9cfe015 | 2008-02-06 01:37:16 -0800 | [diff] [blame] | 1687 | .procname = "nr_open", |
| 1688 | .data = &sysctl_nr_open, |
Alexey Dobriyan | 9b80a18 | 2016-09-02 00:38:52 +0300 | [diff] [blame] | 1689 | .maxlen = sizeof(unsigned int), |
Eric Dumazet | 9cfe015 | 2008-02-06 01:37:16 -0800 | [diff] [blame] | 1690 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1691 | .proc_handler = proc_dointvec_minmax, |
Al Viro | eceea0b | 2008-05-10 10:08:32 -0400 | [diff] [blame] | 1692 | .extra1 = &sysctl_nr_open_min, |
| 1693 | .extra2 = &sysctl_nr_open_max, |
Eric Dumazet | 9cfe015 | 2008-02-06 01:37:16 -0800 | [diff] [blame] | 1694 | }, |
| 1695 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1696 | .procname = "dentry-state", |
| 1697 | .data = &dentry_stat, |
Glauber Costa | 3942c07 | 2013-08-28 10:17:53 +1000 | [diff] [blame] | 1698 | .maxlen = 6*sizeof(long), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1699 | .mode = 0444, |
Christoph Hellwig | 312d3ca | 2010-10-10 05:36:23 -0400 | [diff] [blame] | 1700 | .proc_handler = proc_nr_dentry, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1701 | }, |
| 1702 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1703 | .procname = "overflowuid", |
| 1704 | .data = &fs_overflowuid, |
| 1705 | .maxlen = sizeof(int), |
| 1706 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1707 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1708 | .extra1 = &minolduid, |
| 1709 | .extra2 = &maxolduid, |
| 1710 | }, |
| 1711 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1712 | .procname = "overflowgid", |
| 1713 | .data = &fs_overflowgid, |
| 1714 | .maxlen = sizeof(int), |
| 1715 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1716 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1717 | .extra1 = &minolduid, |
| 1718 | .extra2 = &maxolduid, |
| 1719 | }, |
Thomas Petazzoni | bfcd17a | 2008-08-06 15:12:22 +0200 | [diff] [blame] | 1720 | #ifdef CONFIG_FILE_LOCKING |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1721 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1722 | .procname = "leases-enable", |
| 1723 | .data = &leases_enable, |
| 1724 | .maxlen = sizeof(int), |
| 1725 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1726 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1727 | }, |
Thomas Petazzoni | bfcd17a | 2008-08-06 15:12:22 +0200 | [diff] [blame] | 1728 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1729 | #ifdef CONFIG_DNOTIFY |
| 1730 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1731 | .procname = "dir-notify-enable", |
| 1732 | .data = &dir_notify_enable, |
| 1733 | .maxlen = sizeof(int), |
| 1734 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1735 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1736 | }, |
| 1737 | #endif |
| 1738 | #ifdef CONFIG_MMU |
Thomas Petazzoni | bfcd17a | 2008-08-06 15:12:22 +0200 | [diff] [blame] | 1739 | #ifdef CONFIG_FILE_LOCKING |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1740 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1741 | .procname = "lease-break-time", |
| 1742 | .data = &lease_break_time, |
| 1743 | .maxlen = sizeof(int), |
| 1744 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1745 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1746 | }, |
Thomas Petazzoni | bfcd17a | 2008-08-06 15:12:22 +0200 | [diff] [blame] | 1747 | #endif |
Thomas Petazzoni | ebf3f09 | 2008-10-15 22:05:12 -0700 | [diff] [blame] | 1748 | #ifdef CONFIG_AIO |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1749 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1750 | .procname = "aio-nr", |
| 1751 | .data = &aio_nr, |
| 1752 | .maxlen = sizeof(aio_nr), |
| 1753 | .mode = 0444, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1754 | .proc_handler = proc_doulongvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1755 | }, |
| 1756 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1757 | .procname = "aio-max-nr", |
| 1758 | .data = &aio_max_nr, |
| 1759 | .maxlen = sizeof(aio_max_nr), |
| 1760 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1761 | .proc_handler = proc_doulongvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1762 | }, |
Thomas Petazzoni | ebf3f09 | 2008-10-15 22:05:12 -0700 | [diff] [blame] | 1763 | #endif /* CONFIG_AIO */ |
Amy Griffis | 2d9048e | 2006-06-01 13:10:59 -0700 | [diff] [blame] | 1764 | #ifdef CONFIG_INOTIFY_USER |
Robert Love | 0399cb0 | 2005-07-13 12:38:18 -0400 | [diff] [blame] | 1765 | { |
Robert Love | 0399cb0 | 2005-07-13 12:38:18 -0400 | [diff] [blame] | 1766 | .procname = "inotify", |
| 1767 | .mode = 0555, |
| 1768 | .child = inotify_table, |
| 1769 | }, |
| 1770 | #endif |
Davide Libenzi | 7ef9964 | 2008-12-01 13:13:55 -0800 | [diff] [blame] | 1771 | #ifdef CONFIG_EPOLL |
| 1772 | { |
| 1773 | .procname = "epoll", |
| 1774 | .mode = 0555, |
| 1775 | .child = epoll_table, |
| 1776 | }, |
| 1777 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1778 | #endif |
Alan Cox | d6e7114 | 2005-06-23 00:09:43 -0700 | [diff] [blame] | 1779 | { |
Kees Cook | 800179c | 2012-07-25 17:29:07 -0700 | [diff] [blame] | 1780 | .procname = "protected_symlinks", |
| 1781 | .data = &sysctl_protected_symlinks, |
| 1782 | .maxlen = sizeof(int), |
| 1783 | .mode = 0600, |
| 1784 | .proc_handler = proc_dointvec_minmax, |
| 1785 | .extra1 = &zero, |
| 1786 | .extra2 = &one, |
| 1787 | }, |
| 1788 | { |
| 1789 | .procname = "protected_hardlinks", |
| 1790 | .data = &sysctl_protected_hardlinks, |
| 1791 | .maxlen = sizeof(int), |
| 1792 | .mode = 0600, |
| 1793 | .proc_handler = proc_dointvec_minmax, |
| 1794 | .extra1 = &zero, |
| 1795 | .extra2 = &one, |
| 1796 | }, |
| 1797 | { |
Salvatore Mesoraca | 0c41bee | 2018-08-23 17:00:35 -0700 | [diff] [blame^] | 1798 | .procname = "protected_fifos", |
| 1799 | .data = &sysctl_protected_fifos, |
| 1800 | .maxlen = sizeof(int), |
| 1801 | .mode = 0600, |
| 1802 | .proc_handler = proc_dointvec_minmax, |
| 1803 | .extra1 = &zero, |
| 1804 | .extra2 = &two, |
| 1805 | }, |
| 1806 | { |
| 1807 | .procname = "protected_regular", |
| 1808 | .data = &sysctl_protected_regular, |
| 1809 | .maxlen = sizeof(int), |
| 1810 | .mode = 0600, |
| 1811 | .proc_handler = proc_dointvec_minmax, |
| 1812 | .extra1 = &zero, |
| 1813 | .extra2 = &two, |
| 1814 | }, |
| 1815 | { |
Alan Cox | d6e7114 | 2005-06-23 00:09:43 -0700 | [diff] [blame] | 1816 | .procname = "suid_dumpable", |
| 1817 | .data = &suid_dumpable, |
| 1818 | .maxlen = sizeof(int), |
| 1819 | .mode = 0644, |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 1820 | .proc_handler = proc_dointvec_minmax_coredump, |
Matthew Wilcox | 8e654fb | 2009-04-02 16:58:33 -0700 | [diff] [blame] | 1821 | .extra1 = &zero, |
| 1822 | .extra2 = &two, |
Alan Cox | d6e7114 | 2005-06-23 00:09:43 -0700 | [diff] [blame] | 1823 | }, |
Eric W. Biederman | 2abc26f | 2007-02-14 00:34:07 -0800 | [diff] [blame] | 1824 | #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) |
| 1825 | { |
Eric W. Biederman | 2abc26f | 2007-02-14 00:34:07 -0800 | [diff] [blame] | 1826 | .procname = "binfmt_misc", |
| 1827 | .mode = 0555, |
Eric W. Biederman | f9bd673 | 2015-05-09 22:09:14 -0500 | [diff] [blame] | 1828 | .child = sysctl_mount_point, |
Eric W. Biederman | 2abc26f | 2007-02-14 00:34:07 -0800 | [diff] [blame] | 1829 | }, |
| 1830 | #endif |
Jens Axboe | b492e95 | 2010-05-19 21:03:16 +0200 | [diff] [blame] | 1831 | { |
Jens Axboe | ff9da69 | 2010-06-03 14:54:39 +0200 | [diff] [blame] | 1832 | .procname = "pipe-max-size", |
| 1833 | .data = &pipe_max_size, |
Jens Axboe | b492e95 | 2010-05-19 21:03:16 +0200 | [diff] [blame] | 1834 | .maxlen = sizeof(int), |
| 1835 | .mode = 0644, |
Jens Axboe | ff9da69 | 2010-06-03 14:54:39 +0200 | [diff] [blame] | 1836 | .proc_handler = &pipe_proc_fn, |
| 1837 | .extra1 = &pipe_min_size, |
Jens Axboe | b492e95 | 2010-05-19 21:03:16 +0200 | [diff] [blame] | 1838 | }, |
Willy Tarreau | 759c011 | 2016-01-18 16:36:09 +0100 | [diff] [blame] | 1839 | { |
| 1840 | .procname = "pipe-user-pages-hard", |
| 1841 | .data = &pipe_user_pages_hard, |
| 1842 | .maxlen = sizeof(pipe_user_pages_hard), |
| 1843 | .mode = 0644, |
| 1844 | .proc_handler = proc_doulongvec_minmax, |
| 1845 | }, |
| 1846 | { |
| 1847 | .procname = "pipe-user-pages-soft", |
| 1848 | .data = &pipe_user_pages_soft, |
| 1849 | .maxlen = sizeof(pipe_user_pages_soft), |
| 1850 | .mode = 0644, |
| 1851 | .proc_handler = proc_doulongvec_minmax, |
| 1852 | }, |
Eric W. Biederman | d292168 | 2016-09-28 00:27:17 -0500 | [diff] [blame] | 1853 | { |
| 1854 | .procname = "mount-max", |
| 1855 | .data = &sysctl_mount_max, |
| 1856 | .maxlen = sizeof(unsigned int), |
| 1857 | .mode = 0644, |
| 1858 | .proc_handler = proc_dointvec_minmax, |
| 1859 | .extra1 = &one, |
| 1860 | }, |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 1861 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1862 | }; |
| 1863 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 1864 | static struct ctl_table debug_table[] = { |
Catalin Marinas | 7ac57a8 | 2012-10-08 16:28:16 -0700 | [diff] [blame] | 1865 | #ifdef CONFIG_SYSCTL_EXCEPTION_TRACE |
Masoud Asgharifard Sharbiani | abd4f75 | 2007-07-22 11:12:28 +0200 | [diff] [blame] | 1866 | { |
Masoud Asgharifard Sharbiani | abd4f75 | 2007-07-22 11:12:28 +0200 | [diff] [blame] | 1867 | .procname = "exception-trace", |
| 1868 | .data = &show_unhandled_signals, |
| 1869 | .maxlen = sizeof(int), |
| 1870 | .mode = 0644, |
| 1871 | .proc_handler = proc_dointvec |
| 1872 | }, |
| 1873 | #endif |
Masami Hiramatsu | b2be84d | 2010-02-25 08:34:15 -0500 | [diff] [blame] | 1874 | #if defined(CONFIG_OPTPROBES) |
| 1875 | { |
| 1876 | .procname = "kprobes-optimization", |
| 1877 | .data = &sysctl_kprobes_optimization, |
| 1878 | .maxlen = sizeof(int), |
| 1879 | .mode = 0644, |
| 1880 | .proc_handler = proc_kprobes_optimization_handler, |
| 1881 | .extra1 = &zero, |
| 1882 | .extra2 = &one, |
| 1883 | }, |
| 1884 | #endif |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 1885 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1886 | }; |
| 1887 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 1888 | static struct ctl_table dev_table[] = { |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 1889 | { } |
Robert Love | 0eeca28 | 2005-07-12 17:06:03 -0400 | [diff] [blame] | 1890 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1891 | |
Eric W. Biederman | de4e83bd | 2012-01-06 03:34:20 -0800 | [diff] [blame] | 1892 | int __init sysctl_init(void) |
Al Viro | 330d57f | 2005-11-04 10:18:40 +0000 | [diff] [blame] | 1893 | { |
Steven Rostedt | fd4b616 | 2012-07-30 14:42:48 -0700 | [diff] [blame] | 1894 | struct ctl_table_header *hdr; |
| 1895 | |
| 1896 | hdr = register_sysctl_table(sysctl_base_table); |
| 1897 | kmemleak_not_leak(hdr); |
Eric W. Biederman | d912b0c | 2007-02-14 00:34:13 -0800 | [diff] [blame] | 1898 | return 0; |
| 1899 | } |
| 1900 | |
Eric W. Biederman | b89a817 | 2006-09-27 01:51:04 -0700 | [diff] [blame] | 1901 | #endif /* CONFIG_SYSCTL */ |
| 1902 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1903 | /* |
| 1904 | * /proc/sys support |
| 1905 | */ |
| 1906 | |
Eric W. Biederman | b89a817 | 2006-09-27 01:51:04 -0700 | [diff] [blame] | 1907 | #ifdef CONFIG_PROC_SYSCTL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1908 | |
Kees Cook | f880830 | 2014-06-06 14:37:17 -0700 | [diff] [blame] | 1909 | static int _proc_do_string(char *data, int maxlen, int write, |
| 1910 | char __user *buffer, |
Adrian Bunk | b1ba4dd | 2006-10-02 02:18:05 -0700 | [diff] [blame] | 1911 | size_t *lenp, loff_t *ppos) |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1912 | { |
| 1913 | size_t len; |
| 1914 | char __user *p; |
| 1915 | char c; |
Oleg Nesterov | 8d06087 | 2007-02-10 01:46:38 -0800 | [diff] [blame] | 1916 | |
| 1917 | if (!data || !maxlen || !*lenp) { |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1918 | *lenp = 0; |
| 1919 | return 0; |
| 1920 | } |
Oleg Nesterov | 8d06087 | 2007-02-10 01:46:38 -0800 | [diff] [blame] | 1921 | |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1922 | if (write) { |
Kees Cook | f4aacea | 2014-06-06 14:37:19 -0700 | [diff] [blame] | 1923 | if (sysctl_writes_strict == SYSCTL_WRITES_STRICT) { |
| 1924 | /* Only continue writes not past the end of buffer. */ |
| 1925 | len = strlen(data); |
| 1926 | if (len > maxlen - 1) |
| 1927 | len = maxlen - 1; |
| 1928 | |
| 1929 | if (*ppos > len) |
| 1930 | return 0; |
| 1931 | len = *ppos; |
| 1932 | } else { |
| 1933 | /* Start writing from beginning of buffer. */ |
| 1934 | len = 0; |
| 1935 | } |
| 1936 | |
Kees Cook | 2ca9bb4 | 2014-06-06 14:37:18 -0700 | [diff] [blame] | 1937 | *ppos += *lenp; |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1938 | p = buffer; |
Kees Cook | 2ca9bb4 | 2014-06-06 14:37:18 -0700 | [diff] [blame] | 1939 | while ((p - buffer) < *lenp && len < maxlen - 1) { |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1940 | if (get_user(c, p++)) |
| 1941 | return -EFAULT; |
| 1942 | if (c == 0 || c == '\n') |
| 1943 | break; |
Kees Cook | 2ca9bb4 | 2014-06-06 14:37:18 -0700 | [diff] [blame] | 1944 | data[len++] = c; |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1945 | } |
Kees Cook | f880830 | 2014-06-06 14:37:17 -0700 | [diff] [blame] | 1946 | data[len] = 0; |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1947 | } else { |
| 1948 | len = strlen(data); |
| 1949 | if (len > maxlen) |
| 1950 | len = maxlen; |
Oleg Nesterov | 8d06087 | 2007-02-10 01:46:38 -0800 | [diff] [blame] | 1951 | |
| 1952 | if (*ppos > len) { |
| 1953 | *lenp = 0; |
| 1954 | return 0; |
| 1955 | } |
| 1956 | |
| 1957 | data += *ppos; |
| 1958 | len -= *ppos; |
| 1959 | |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1960 | if (len > *lenp) |
| 1961 | len = *lenp; |
| 1962 | if (len) |
Kees Cook | f880830 | 2014-06-06 14:37:17 -0700 | [diff] [blame] | 1963 | if (copy_to_user(buffer, data, len)) |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1964 | return -EFAULT; |
| 1965 | if (len < *lenp) { |
Kees Cook | f880830 | 2014-06-06 14:37:17 -0700 | [diff] [blame] | 1966 | if (put_user('\n', buffer + len)) |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1967 | return -EFAULT; |
| 1968 | len++; |
| 1969 | } |
| 1970 | *lenp = len; |
| 1971 | *ppos += len; |
| 1972 | } |
| 1973 | return 0; |
| 1974 | } |
| 1975 | |
Kees Cook | f4aacea | 2014-06-06 14:37:19 -0700 | [diff] [blame] | 1976 | static void warn_sysctl_write(struct ctl_table *table) |
| 1977 | { |
| 1978 | pr_warn_once("%s wrote to %s when file position was not 0!\n" |
| 1979 | "This will not be supported in the future. To silence this\n" |
| 1980 | "warning, set kernel.sysctl_writes_strict = -1\n", |
| 1981 | current->comm, table->procname); |
| 1982 | } |
| 1983 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1984 | /** |
| 1985 | * proc_dostring - read a string sysctl |
| 1986 | * @table: the sysctl table |
| 1987 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1988 | * @buffer: the user buffer |
| 1989 | * @lenp: the size of the user buffer |
| 1990 | * @ppos: file position |
| 1991 | * |
| 1992 | * Reads/writes a string from/to the user buffer. If the kernel |
| 1993 | * buffer provided is not large enough to hold the string, the |
| 1994 | * string is truncated. The copied string is %NULL-terminated. |
| 1995 | * If the string is being read by the user process, it is copied |
| 1996 | * and a newline '\n' is added. It is truncated if the buffer is |
| 1997 | * not large enough. |
| 1998 | * |
| 1999 | * Returns 0 on success. |
| 2000 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2001 | int proc_dostring(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2002 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2003 | { |
Kees Cook | f4aacea | 2014-06-06 14:37:19 -0700 | [diff] [blame] | 2004 | if (write && *ppos && sysctl_writes_strict == SYSCTL_WRITES_WARN) |
| 2005 | warn_sysctl_write(table); |
| 2006 | |
Kees Cook | f880830 | 2014-06-06 14:37:17 -0700 | [diff] [blame] | 2007 | return _proc_do_string((char *)(table->data), table->maxlen, write, |
| 2008 | (char __user *)buffer, lenp, ppos); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2009 | } |
| 2010 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2011 | static size_t proc_skip_spaces(char **buf) |
| 2012 | { |
| 2013 | size_t ret; |
| 2014 | char *tmp = skip_spaces(*buf); |
| 2015 | ret = tmp - *buf; |
| 2016 | *buf = tmp; |
| 2017 | return ret; |
| 2018 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2019 | |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2020 | static void proc_skip_char(char **buf, size_t *size, const char v) |
| 2021 | { |
| 2022 | while (*size) { |
| 2023 | if (**buf != v) |
| 2024 | break; |
| 2025 | (*size)--; |
| 2026 | (*buf)++; |
| 2027 | } |
| 2028 | } |
| 2029 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2030 | #define TMPBUFLEN 22 |
| 2031 | /** |
Randy Dunlap | 0fc377b | 2010-05-21 11:29:53 -0700 | [diff] [blame] | 2032 | * proc_get_long - reads an ASCII formatted integer from a user buffer |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2033 | * |
Randy Dunlap | 0fc377b | 2010-05-21 11:29:53 -0700 | [diff] [blame] | 2034 | * @buf: a kernel buffer |
| 2035 | * @size: size of the kernel buffer |
| 2036 | * @val: this is where the number will be stored |
| 2037 | * @neg: set to %TRUE if number is negative |
| 2038 | * @perm_tr: a vector which contains the allowed trailers |
| 2039 | * @perm_tr_len: size of the perm_tr vector |
| 2040 | * @tr: pointer to store the trailer character |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2041 | * |
Randy Dunlap | 0fc377b | 2010-05-21 11:29:53 -0700 | [diff] [blame] | 2042 | * In case of success %0 is returned and @buf and @size are updated with |
| 2043 | * the amount of bytes read. If @tr is non-NULL and a trailing |
| 2044 | * character exists (size is non-zero after returning from this |
| 2045 | * function), @tr is updated with the trailing character. |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2046 | */ |
| 2047 | static int proc_get_long(char **buf, size_t *size, |
| 2048 | unsigned long *val, bool *neg, |
| 2049 | const char *perm_tr, unsigned perm_tr_len, char *tr) |
| 2050 | { |
| 2051 | int len; |
| 2052 | char *p, tmp[TMPBUFLEN]; |
| 2053 | |
| 2054 | if (!*size) |
| 2055 | return -EINVAL; |
| 2056 | |
| 2057 | len = *size; |
| 2058 | if (len > TMPBUFLEN - 1) |
| 2059 | len = TMPBUFLEN - 1; |
| 2060 | |
| 2061 | memcpy(tmp, *buf, len); |
| 2062 | |
| 2063 | tmp[len] = 0; |
| 2064 | p = tmp; |
| 2065 | if (*p == '-' && *size > 1) { |
| 2066 | *neg = true; |
| 2067 | p++; |
| 2068 | } else |
| 2069 | *neg = false; |
| 2070 | if (!isdigit(*p)) |
| 2071 | return -EINVAL; |
| 2072 | |
| 2073 | *val = simple_strtoul(p, &p, 0); |
| 2074 | |
| 2075 | len = p - tmp; |
| 2076 | |
| 2077 | /* We don't know if the next char is whitespace thus we may accept |
| 2078 | * invalid integers (e.g. 1234...a) or two integers instead of one |
| 2079 | * (e.g. 123...1). So lets not allow such large numbers. */ |
| 2080 | if (len == TMPBUFLEN - 1) |
| 2081 | return -EINVAL; |
| 2082 | |
| 2083 | if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len)) |
| 2084 | return -EINVAL; |
| 2085 | |
| 2086 | if (tr && (len < *size)) |
| 2087 | *tr = *p; |
| 2088 | |
| 2089 | *buf += len; |
| 2090 | *size -= len; |
| 2091 | |
| 2092 | return 0; |
| 2093 | } |
| 2094 | |
| 2095 | /** |
Randy Dunlap | 0fc377b | 2010-05-21 11:29:53 -0700 | [diff] [blame] | 2096 | * proc_put_long - converts an integer to a decimal ASCII formatted string |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2097 | * |
Randy Dunlap | 0fc377b | 2010-05-21 11:29:53 -0700 | [diff] [blame] | 2098 | * @buf: the user buffer |
| 2099 | * @size: the size of the user buffer |
| 2100 | * @val: the integer to be converted |
| 2101 | * @neg: sign of the number, %TRUE for negative |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2102 | * |
Randy Dunlap | 0fc377b | 2010-05-21 11:29:53 -0700 | [diff] [blame] | 2103 | * In case of success %0 is returned and @buf and @size are updated with |
| 2104 | * the amount of bytes written. |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2105 | */ |
| 2106 | static int proc_put_long(void __user **buf, size_t *size, unsigned long val, |
| 2107 | bool neg) |
| 2108 | { |
| 2109 | int len; |
| 2110 | char tmp[TMPBUFLEN], *p = tmp; |
| 2111 | |
| 2112 | sprintf(p, "%s%lu", neg ? "-" : "", val); |
| 2113 | len = strlen(tmp); |
| 2114 | if (len > *size) |
| 2115 | len = *size; |
| 2116 | if (copy_to_user(*buf, tmp, len)) |
| 2117 | return -EFAULT; |
| 2118 | *size -= len; |
| 2119 | *buf += len; |
| 2120 | return 0; |
| 2121 | } |
| 2122 | #undef TMPBUFLEN |
| 2123 | |
| 2124 | static int proc_put_char(void __user **buf, size_t *size, char c) |
| 2125 | { |
| 2126 | if (*size) { |
| 2127 | char __user **buffer = (char __user **)buf; |
| 2128 | if (put_user(c, *buffer)) |
| 2129 | return -EFAULT; |
| 2130 | (*size)--, (*buffer)++; |
| 2131 | *buf = *buffer; |
| 2132 | } |
| 2133 | return 0; |
| 2134 | } |
| 2135 | |
| 2136 | static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2137 | int *valp, |
| 2138 | int write, void *data) |
| 2139 | { |
| 2140 | if (write) { |
Heinrich Schuchardt | 230633d | 2015-04-16 12:48:07 -0700 | [diff] [blame] | 2141 | if (*negp) { |
| 2142 | if (*lvalp > (unsigned long) INT_MAX + 1) |
| 2143 | return -EINVAL; |
| 2144 | *valp = -*lvalp; |
| 2145 | } else { |
| 2146 | if (*lvalp > (unsigned long) INT_MAX) |
| 2147 | return -EINVAL; |
| 2148 | *valp = *lvalp; |
| 2149 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2150 | } else { |
| 2151 | int val = *valp; |
| 2152 | if (val < 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2153 | *negp = true; |
Ilya Dryomov | 9a5bc72 | 2015-09-09 15:39:06 -0700 | [diff] [blame] | 2154 | *lvalp = -(unsigned long)val; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2155 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2156 | *negp = false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2157 | *lvalp = (unsigned long)val; |
| 2158 | } |
| 2159 | } |
| 2160 | return 0; |
| 2161 | } |
| 2162 | |
Subash Abhinov Kasiviswanathan | e7d316a | 2016-08-25 15:16:51 -0700 | [diff] [blame] | 2163 | static int do_proc_douintvec_conv(bool *negp, unsigned long *lvalp, |
| 2164 | int *valp, |
| 2165 | int write, void *data) |
| 2166 | { |
| 2167 | if (write) { |
| 2168 | if (*negp) |
| 2169 | return -EINVAL; |
Liping Zhang | 7bdacd3 | 2017-04-07 23:51:07 +0800 | [diff] [blame] | 2170 | if (*lvalp > UINT_MAX) |
| 2171 | return -EINVAL; |
Subash Abhinov Kasiviswanathan | e7d316a | 2016-08-25 15:16:51 -0700 | [diff] [blame] | 2172 | *valp = *lvalp; |
| 2173 | } else { |
| 2174 | unsigned int val = *valp; |
Liping Zhang | 3a20c57 | 2017-04-07 23:51:06 +0800 | [diff] [blame] | 2175 | *negp = false; |
Subash Abhinov Kasiviswanathan | e7d316a | 2016-08-25 15:16:51 -0700 | [diff] [blame] | 2176 | *lvalp = (unsigned long)val; |
| 2177 | } |
| 2178 | return 0; |
| 2179 | } |
| 2180 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2181 | static const char proc_wspace_sep[] = { ' ', '\t', '\n' }; |
| 2182 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 2183 | static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2184 | int write, void __user *buffer, |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2185 | size_t *lenp, loff_t *ppos, |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2186 | int (*conv)(bool *negp, unsigned long *lvalp, int *valp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2187 | int write, void *data), |
| 2188 | void *data) |
| 2189 | { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2190 | int *i, vleft, first = 1, err = 0; |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2191 | size_t left; |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2192 | char *kbuf = NULL, *p; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2193 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2194 | if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2195 | *lenp = 0; |
| 2196 | return 0; |
| 2197 | } |
| 2198 | |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2199 | i = (int *) tbl_data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2200 | vleft = table->maxlen / sizeof(*i); |
| 2201 | left = *lenp; |
| 2202 | |
| 2203 | if (!conv) |
| 2204 | conv = do_proc_dointvec_conv; |
| 2205 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2206 | if (write) { |
Kees Cook | f4aacea | 2014-06-06 14:37:19 -0700 | [diff] [blame] | 2207 | if (*ppos) { |
| 2208 | switch (sysctl_writes_strict) { |
| 2209 | case SYSCTL_WRITES_STRICT: |
| 2210 | goto out; |
| 2211 | case SYSCTL_WRITES_WARN: |
| 2212 | warn_sysctl_write(table); |
| 2213 | break; |
| 2214 | default: |
| 2215 | break; |
| 2216 | } |
| 2217 | } |
| 2218 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2219 | if (left > PAGE_SIZE - 1) |
| 2220 | left = PAGE_SIZE - 1; |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2221 | p = kbuf = memdup_user_nul(buffer, left); |
| 2222 | if (IS_ERR(kbuf)) |
| 2223 | return PTR_ERR(kbuf); |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2224 | } |
| 2225 | |
| 2226 | for (; left && vleft--; i++, first=0) { |
| 2227 | unsigned long lval; |
| 2228 | bool neg; |
| 2229 | |
| 2230 | if (write) { |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2231 | left -= proc_skip_spaces(&p); |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2232 | |
J. R. Okajima | 563b046 | 2010-05-25 16:10:14 -0700 | [diff] [blame] | 2233 | if (!left) |
| 2234 | break; |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2235 | err = proc_get_long(&p, &left, &lval, &neg, |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2236 | proc_wspace_sep, |
| 2237 | sizeof(proc_wspace_sep), NULL); |
| 2238 | if (err) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2239 | break; |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2240 | if (conv(&neg, &lval, i, 1, data)) { |
| 2241 | err = -EINVAL; |
| 2242 | break; |
| 2243 | } |
| 2244 | } else { |
| 2245 | if (conv(&neg, &lval, i, 0, data)) { |
| 2246 | err = -EINVAL; |
| 2247 | break; |
| 2248 | } |
| 2249 | if (!first) |
| 2250 | err = proc_put_char(&buffer, &left, '\t'); |
| 2251 | if (err) |
| 2252 | break; |
| 2253 | err = proc_put_long(&buffer, &left, lval, neg); |
| 2254 | if (err) |
| 2255 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2256 | } |
| 2257 | } |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2258 | |
| 2259 | if (!write && !first && left && !err) |
| 2260 | err = proc_put_char(&buffer, &left, '\n'); |
J. R. Okajima | 563b046 | 2010-05-25 16:10:14 -0700 | [diff] [blame] | 2261 | if (write && !err && left) |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2262 | left -= proc_skip_spaces(&p); |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2263 | if (write) { |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2264 | kfree(kbuf); |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2265 | if (first) |
| 2266 | return err ? : -EINVAL; |
| 2267 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2268 | *lenp -= left; |
Kees Cook | f4aacea | 2014-06-06 14:37:19 -0700 | [diff] [blame] | 2269 | out: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2270 | *ppos += *lenp; |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2271 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2272 | } |
| 2273 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2274 | static int do_proc_dointvec(struct ctl_table *table, int write, |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2275 | void __user *buffer, size_t *lenp, loff_t *ppos, |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2276 | int (*conv)(bool *negp, unsigned long *lvalp, int *valp, |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2277 | int write, void *data), |
| 2278 | void *data) |
| 2279 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2280 | return __do_proc_dointvec(table->data, table, write, |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2281 | buffer, lenp, ppos, conv, data); |
| 2282 | } |
| 2283 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2284 | /** |
| 2285 | * proc_dointvec - read a vector of integers |
| 2286 | * @table: the sysctl table |
| 2287 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2288 | * @buffer: the user buffer |
| 2289 | * @lenp: the size of the user buffer |
| 2290 | * @ppos: file position |
| 2291 | * |
| 2292 | * Reads/writes up to table->maxlen/sizeof(unsigned int) integer |
| 2293 | * values from/to the user buffer, treated as an ASCII string. |
| 2294 | * |
| 2295 | * Returns 0 on success. |
| 2296 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2297 | int proc_dointvec(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2298 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2299 | { |
Subash Abhinov Kasiviswanathan | e7d316a | 2016-08-25 15:16:51 -0700 | [diff] [blame] | 2300 | return do_proc_dointvec(table, write, buffer, lenp, ppos, NULL, NULL); |
| 2301 | } |
| 2302 | |
| 2303 | /** |
| 2304 | * proc_douintvec - read a vector of unsigned integers |
| 2305 | * @table: the sysctl table |
| 2306 | * @write: %TRUE if this is a write to the sysctl file |
| 2307 | * @buffer: the user buffer |
| 2308 | * @lenp: the size of the user buffer |
| 2309 | * @ppos: file position |
| 2310 | * |
| 2311 | * Reads/writes up to table->maxlen/sizeof(unsigned int) unsigned integer |
| 2312 | * values from/to the user buffer, treated as an ASCII string. |
| 2313 | * |
| 2314 | * Returns 0 on success. |
| 2315 | */ |
| 2316 | int proc_douintvec(struct ctl_table *table, int write, |
| 2317 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2318 | { |
| 2319 | return do_proc_dointvec(table, write, buffer, lenp, ppos, |
| 2320 | do_proc_douintvec_conv, NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2321 | } |
| 2322 | |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2323 | /* |
Andi Kleen | 25ddbb1 | 2008-10-15 22:01:41 -0700 | [diff] [blame] | 2324 | * Taint values can only be increased |
| 2325 | * This means we can safely use a temporary. |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2326 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2327 | static int proc_taint(struct ctl_table *table, int write, |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2328 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2329 | { |
Andi Kleen | 25ddbb1 | 2008-10-15 22:01:41 -0700 | [diff] [blame] | 2330 | struct ctl_table t; |
| 2331 | unsigned long tmptaint = get_taint(); |
| 2332 | int err; |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2333 | |
Bastian Blank | 91fcd41 | 2007-04-23 14:41:14 -0700 | [diff] [blame] | 2334 | if (write && !capable(CAP_SYS_ADMIN)) |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2335 | return -EPERM; |
| 2336 | |
Andi Kleen | 25ddbb1 | 2008-10-15 22:01:41 -0700 | [diff] [blame] | 2337 | t = *table; |
| 2338 | t.data = &tmptaint; |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2339 | err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos); |
Andi Kleen | 25ddbb1 | 2008-10-15 22:01:41 -0700 | [diff] [blame] | 2340 | if (err < 0) |
| 2341 | return err; |
| 2342 | |
| 2343 | if (write) { |
| 2344 | /* |
| 2345 | * Poor man's atomic or. Not worth adding a primitive |
| 2346 | * to everyone's atomic.h for this |
| 2347 | */ |
| 2348 | int i; |
| 2349 | for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) { |
| 2350 | if ((tmptaint >> i) & 1) |
Rusty Russell | 373d4d0 | 2013-01-21 17:17:39 +1030 | [diff] [blame] | 2351 | add_taint(i, LOCKDEP_STILL_OK); |
Andi Kleen | 25ddbb1 | 2008-10-15 22:01:41 -0700 | [diff] [blame] | 2352 | } |
| 2353 | } |
| 2354 | |
| 2355 | return err; |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2356 | } |
| 2357 | |
Richard Weinberger | bfdc0b4 | 2011-03-23 16:43:11 -0700 | [diff] [blame] | 2358 | #ifdef CONFIG_PRINTK |
Kees Cook | 620f6e8 | 2012-04-04 11:40:19 -0700 | [diff] [blame] | 2359 | static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write, |
Richard Weinberger | bfdc0b4 | 2011-03-23 16:43:11 -0700 | [diff] [blame] | 2360 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2361 | { |
| 2362 | if (write && !capable(CAP_SYS_ADMIN)) |
| 2363 | return -EPERM; |
| 2364 | |
| 2365 | return proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
| 2366 | } |
| 2367 | #endif |
| 2368 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2369 | struct do_proc_dointvec_minmax_conv_param { |
| 2370 | int *min; |
| 2371 | int *max; |
| 2372 | }; |
| 2373 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2374 | static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp, |
| 2375 | int *valp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2376 | int write, void *data) |
| 2377 | { |
| 2378 | struct do_proc_dointvec_minmax_conv_param *param = data; |
| 2379 | if (write) { |
| 2380 | int val = *negp ? -*lvalp : *lvalp; |
| 2381 | if ((param->min && *param->min > val) || |
| 2382 | (param->max && *param->max < val)) |
| 2383 | return -EINVAL; |
| 2384 | *valp = val; |
| 2385 | } else { |
| 2386 | int val = *valp; |
| 2387 | if (val < 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2388 | *negp = true; |
Ilya Dryomov | 9a5bc72 | 2015-09-09 15:39:06 -0700 | [diff] [blame] | 2389 | *lvalp = -(unsigned long)val; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2390 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2391 | *negp = false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2392 | *lvalp = (unsigned long)val; |
| 2393 | } |
| 2394 | } |
| 2395 | return 0; |
| 2396 | } |
| 2397 | |
| 2398 | /** |
| 2399 | * proc_dointvec_minmax - read a vector of integers with min/max values |
| 2400 | * @table: the sysctl table |
| 2401 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2402 | * @buffer: the user buffer |
| 2403 | * @lenp: the size of the user buffer |
| 2404 | * @ppos: file position |
| 2405 | * |
| 2406 | * Reads/writes up to table->maxlen/sizeof(unsigned int) integer |
| 2407 | * values from/to the user buffer, treated as an ASCII string. |
| 2408 | * |
| 2409 | * This routine will ensure the values are within the range specified by |
| 2410 | * table->extra1 (min) and table->extra2 (max). |
| 2411 | * |
| 2412 | * Returns 0 on success. |
| 2413 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2414 | int proc_dointvec_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2415 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2416 | { |
| 2417 | struct do_proc_dointvec_minmax_conv_param param = { |
| 2418 | .min = (int *) table->extra1, |
| 2419 | .max = (int *) table->extra2, |
| 2420 | }; |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2421 | return do_proc_dointvec(table, write, buffer, lenp, ppos, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2422 | do_proc_dointvec_minmax_conv, ¶m); |
| 2423 | } |
| 2424 | |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 2425 | static void validate_coredump_safety(void) |
| 2426 | { |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 2427 | #ifdef CONFIG_COREDUMP |
Kees Cook | e579d2c | 2013-02-27 17:03:15 -0800 | [diff] [blame] | 2428 | if (suid_dumpable == SUID_DUMP_ROOT && |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 2429 | core_pattern[0] != '/' && core_pattern[0] != '|') { |
| 2430 | printk(KERN_WARNING "Unsafe core_pattern used with "\ |
| 2431 | "suid_dumpable=2. Pipe handler or fully qualified "\ |
| 2432 | "core dump path required.\n"); |
| 2433 | } |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 2434 | #endif |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 2435 | } |
| 2436 | |
| 2437 | static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write, |
| 2438 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2439 | { |
| 2440 | int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
| 2441 | if (!error) |
| 2442 | validate_coredump_safety(); |
| 2443 | return error; |
| 2444 | } |
| 2445 | |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 2446 | #ifdef CONFIG_COREDUMP |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 2447 | static int proc_dostring_coredump(struct ctl_table *table, int write, |
| 2448 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2449 | { |
| 2450 | int error = proc_dostring(table, write, buffer, lenp, ppos); |
| 2451 | if (!error) |
| 2452 | validate_coredump_safety(); |
| 2453 | return error; |
| 2454 | } |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 2455 | #endif |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 2456 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 2457 | static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2458 | void __user *buffer, |
| 2459 | size_t *lenp, loff_t *ppos, |
| 2460 | unsigned long convmul, |
| 2461 | unsigned long convdiv) |
| 2462 | { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2463 | unsigned long *i, *min, *max; |
| 2464 | int vleft, first = 1, err = 0; |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2465 | size_t left; |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2466 | char *kbuf = NULL, *p; |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2467 | |
| 2468 | if (!data || !table->maxlen || !*lenp || (*ppos && !write)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2469 | *lenp = 0; |
| 2470 | return 0; |
| 2471 | } |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2472 | |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2473 | i = (unsigned long *) data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2474 | min = (unsigned long *) table->extra1; |
| 2475 | max = (unsigned long *) table->extra2; |
| 2476 | vleft = table->maxlen / sizeof(unsigned long); |
| 2477 | left = *lenp; |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2478 | |
| 2479 | if (write) { |
Kees Cook | f4aacea | 2014-06-06 14:37:19 -0700 | [diff] [blame] | 2480 | if (*ppos) { |
| 2481 | switch (sysctl_writes_strict) { |
| 2482 | case SYSCTL_WRITES_STRICT: |
| 2483 | goto out; |
| 2484 | case SYSCTL_WRITES_WARN: |
| 2485 | warn_sysctl_write(table); |
| 2486 | break; |
| 2487 | default: |
| 2488 | break; |
| 2489 | } |
| 2490 | } |
| 2491 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2492 | if (left > PAGE_SIZE - 1) |
| 2493 | left = PAGE_SIZE - 1; |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2494 | p = kbuf = memdup_user_nul(buffer, left); |
| 2495 | if (IS_ERR(kbuf)) |
| 2496 | return PTR_ERR(kbuf); |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2497 | } |
| 2498 | |
Eric Dumazet | 27b3d80 | 2010-10-07 12:59:29 -0700 | [diff] [blame] | 2499 | for (; left && vleft--; i++, first = 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2500 | unsigned long val; |
| 2501 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2502 | if (write) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2503 | bool neg; |
| 2504 | |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2505 | left -= proc_skip_spaces(&p); |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2506 | |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2507 | err = proc_get_long(&p, &left, &val, &neg, |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2508 | proc_wspace_sep, |
| 2509 | sizeof(proc_wspace_sep), NULL); |
| 2510 | if (err) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2511 | break; |
| 2512 | if (neg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2513 | continue; |
Eric Dumazet | 03707d6 | 2017-01-25 18:20:55 -0800 | [diff] [blame] | 2514 | val = convmul * val / convdiv; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2515 | if ((min && val < *min) || (max && val > *max)) |
| 2516 | continue; |
| 2517 | *i = val; |
| 2518 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2519 | val = convdiv * (*i) / convmul; |
Chen Gang | 7833819 | 2013-11-12 15:11:21 -0800 | [diff] [blame] | 2520 | if (!first) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2521 | err = proc_put_char(&buffer, &left, '\t'); |
Chen Gang | 7833819 | 2013-11-12 15:11:21 -0800 | [diff] [blame] | 2522 | if (err) |
| 2523 | break; |
| 2524 | } |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2525 | err = proc_put_long(&buffer, &left, val, false); |
| 2526 | if (err) |
| 2527 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2528 | } |
| 2529 | } |
| 2530 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2531 | if (!write && !first && left && !err) |
| 2532 | err = proc_put_char(&buffer, &left, '\n'); |
| 2533 | if (write && !err) |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2534 | left -= proc_skip_spaces(&p); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2535 | if (write) { |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2536 | kfree(kbuf); |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2537 | if (first) |
| 2538 | return err ? : -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2539 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2540 | *lenp -= left; |
Kees Cook | f4aacea | 2014-06-06 14:37:19 -0700 | [diff] [blame] | 2541 | out: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2542 | *ppos += *lenp; |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2543 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2544 | } |
| 2545 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 2546 | static int do_proc_doulongvec_minmax(struct ctl_table *table, int write, |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2547 | void __user *buffer, |
| 2548 | size_t *lenp, loff_t *ppos, |
| 2549 | unsigned long convmul, |
| 2550 | unsigned long convdiv) |
| 2551 | { |
| 2552 | return __do_proc_doulongvec_minmax(table->data, table, write, |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2553 | buffer, lenp, ppos, convmul, convdiv); |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2554 | } |
| 2555 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2556 | /** |
| 2557 | * proc_doulongvec_minmax - read a vector of long integers with min/max values |
| 2558 | * @table: the sysctl table |
| 2559 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2560 | * @buffer: the user buffer |
| 2561 | * @lenp: the size of the user buffer |
| 2562 | * @ppos: file position |
| 2563 | * |
| 2564 | * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long |
| 2565 | * values from/to the user buffer, treated as an ASCII string. |
| 2566 | * |
| 2567 | * This routine will ensure the values are within the range specified by |
| 2568 | * table->extra1 (min) and table->extra2 (max). |
| 2569 | * |
| 2570 | * Returns 0 on success. |
| 2571 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2572 | int proc_doulongvec_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2573 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2574 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2575 | return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2576 | } |
| 2577 | |
| 2578 | /** |
| 2579 | * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values |
| 2580 | * @table: the sysctl table |
| 2581 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2582 | * @buffer: the user buffer |
| 2583 | * @lenp: the size of the user buffer |
| 2584 | * @ppos: file position |
| 2585 | * |
| 2586 | * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long |
| 2587 | * values from/to the user buffer, treated as an ASCII string. The values |
| 2588 | * are treated as milliseconds, and converted to jiffies when they are stored. |
| 2589 | * |
| 2590 | * This routine will ensure the values are within the range specified by |
| 2591 | * table->extra1 (min) and table->extra2 (max). |
| 2592 | * |
| 2593 | * Returns 0 on success. |
| 2594 | */ |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 2595 | int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2596 | void __user *buffer, |
| 2597 | size_t *lenp, loff_t *ppos) |
| 2598 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2599 | return do_proc_doulongvec_minmax(table, write, buffer, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2600 | lenp, ppos, HZ, 1000l); |
| 2601 | } |
| 2602 | |
| 2603 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2604 | static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2605 | int *valp, |
| 2606 | int write, void *data) |
| 2607 | { |
| 2608 | if (write) { |
Bart Samwel | cba9f33 | 2006-03-24 03:15:50 -0800 | [diff] [blame] | 2609 | if (*lvalp > LONG_MAX / HZ) |
| 2610 | return 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2611 | *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ); |
| 2612 | } else { |
| 2613 | int val = *valp; |
| 2614 | unsigned long lval; |
| 2615 | if (val < 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2616 | *negp = true; |
Ilya Dryomov | 9a5bc72 | 2015-09-09 15:39:06 -0700 | [diff] [blame] | 2617 | lval = -(unsigned long)val; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2618 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2619 | *negp = false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2620 | lval = (unsigned long)val; |
| 2621 | } |
| 2622 | *lvalp = lval / HZ; |
| 2623 | } |
| 2624 | return 0; |
| 2625 | } |
| 2626 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2627 | static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2628 | int *valp, |
| 2629 | int write, void *data) |
| 2630 | { |
| 2631 | if (write) { |
Bart Samwel | cba9f33 | 2006-03-24 03:15:50 -0800 | [diff] [blame] | 2632 | if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ) |
| 2633 | return 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2634 | *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp); |
| 2635 | } else { |
| 2636 | int val = *valp; |
| 2637 | unsigned long lval; |
| 2638 | if (val < 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2639 | *negp = true; |
Ilya Dryomov | 9a5bc72 | 2015-09-09 15:39:06 -0700 | [diff] [blame] | 2640 | lval = -(unsigned long)val; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2641 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2642 | *negp = false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2643 | lval = (unsigned long)val; |
| 2644 | } |
| 2645 | *lvalp = jiffies_to_clock_t(lval); |
| 2646 | } |
| 2647 | return 0; |
| 2648 | } |
| 2649 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2650 | static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2651 | int *valp, |
| 2652 | int write, void *data) |
| 2653 | { |
| 2654 | if (write) { |
Francesco Fusco | d738ce8 | 2013-07-24 10:39:07 +0200 | [diff] [blame] | 2655 | unsigned long jif = msecs_to_jiffies(*negp ? -*lvalp : *lvalp); |
| 2656 | |
| 2657 | if (jif > INT_MAX) |
| 2658 | return 1; |
| 2659 | *valp = (int)jif; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2660 | } else { |
| 2661 | int val = *valp; |
| 2662 | unsigned long lval; |
| 2663 | if (val < 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2664 | *negp = true; |
Ilya Dryomov | 9a5bc72 | 2015-09-09 15:39:06 -0700 | [diff] [blame] | 2665 | lval = -(unsigned long)val; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2666 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2667 | *negp = false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2668 | lval = (unsigned long)val; |
| 2669 | } |
| 2670 | *lvalp = jiffies_to_msecs(lval); |
| 2671 | } |
| 2672 | return 0; |
| 2673 | } |
| 2674 | |
| 2675 | /** |
| 2676 | * proc_dointvec_jiffies - read a vector of integers as seconds |
| 2677 | * @table: the sysctl table |
| 2678 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2679 | * @buffer: the user buffer |
| 2680 | * @lenp: the size of the user buffer |
| 2681 | * @ppos: file position |
| 2682 | * |
| 2683 | * Reads/writes up to table->maxlen/sizeof(unsigned int) integer |
| 2684 | * values from/to the user buffer, treated as an ASCII string. |
| 2685 | * The values read are assumed to be in seconds, and are converted into |
| 2686 | * jiffies. |
| 2687 | * |
| 2688 | * Returns 0 on success. |
| 2689 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2690 | int proc_dointvec_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2691 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2692 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2693 | return do_proc_dointvec(table,write,buffer,lenp,ppos, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2694 | do_proc_dointvec_jiffies_conv,NULL); |
| 2695 | } |
| 2696 | |
| 2697 | /** |
| 2698 | * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds |
| 2699 | * @table: the sysctl table |
| 2700 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2701 | * @buffer: the user buffer |
| 2702 | * @lenp: the size of the user buffer |
Randy Dunlap | 1e5d533 | 2005-11-07 01:01:06 -0800 | [diff] [blame] | 2703 | * @ppos: pointer to the file position |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2704 | * |
| 2705 | * Reads/writes up to table->maxlen/sizeof(unsigned int) integer |
| 2706 | * values from/to the user buffer, treated as an ASCII string. |
| 2707 | * The values read are assumed to be in 1/USER_HZ seconds, and |
| 2708 | * are converted into jiffies. |
| 2709 | * |
| 2710 | * Returns 0 on success. |
| 2711 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2712 | int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2713 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2714 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2715 | return do_proc_dointvec(table,write,buffer,lenp,ppos, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2716 | do_proc_dointvec_userhz_jiffies_conv,NULL); |
| 2717 | } |
| 2718 | |
| 2719 | /** |
| 2720 | * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds |
| 2721 | * @table: the sysctl table |
| 2722 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2723 | * @buffer: the user buffer |
| 2724 | * @lenp: the size of the user buffer |
Martin Waitz | 67be2dd | 2005-05-01 08:59:26 -0700 | [diff] [blame] | 2725 | * @ppos: file position |
| 2726 | * @ppos: the current position in the file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2727 | * |
| 2728 | * Reads/writes up to table->maxlen/sizeof(unsigned int) integer |
| 2729 | * values from/to the user buffer, treated as an ASCII string. |
| 2730 | * The values read are assumed to be in 1/1000 seconds, and |
| 2731 | * are converted into jiffies. |
| 2732 | * |
| 2733 | * Returns 0 on success. |
| 2734 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2735 | int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2736 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2737 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2738 | return do_proc_dointvec(table, write, buffer, lenp, ppos, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2739 | do_proc_dointvec_ms_jiffies_conv, NULL); |
| 2740 | } |
| 2741 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2742 | static int proc_do_cad_pid(struct ctl_table *table, int write, |
Cedric Le Goater | 9ec5209 | 2006-10-02 02:19:00 -0700 | [diff] [blame] | 2743 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2744 | { |
| 2745 | struct pid *new_pid; |
| 2746 | pid_t tmp; |
| 2747 | int r; |
| 2748 | |
Pavel Emelyanov | 6c5f3e7 | 2008-02-08 04:19:20 -0800 | [diff] [blame] | 2749 | tmp = pid_vnr(cad_pid); |
Cedric Le Goater | 9ec5209 | 2006-10-02 02:19:00 -0700 | [diff] [blame] | 2750 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2751 | r = __do_proc_dointvec(&tmp, table, write, buffer, |
Cedric Le Goater | 9ec5209 | 2006-10-02 02:19:00 -0700 | [diff] [blame] | 2752 | lenp, ppos, NULL, NULL); |
| 2753 | if (r || !write) |
| 2754 | return r; |
| 2755 | |
| 2756 | new_pid = find_get_pid(tmp); |
| 2757 | if (!new_pid) |
| 2758 | return -ESRCH; |
| 2759 | |
| 2760 | put_pid(xchg(&cad_pid, new_pid)); |
| 2761 | return 0; |
| 2762 | } |
| 2763 | |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2764 | /** |
| 2765 | * proc_do_large_bitmap - read/write from/to a large bitmap |
| 2766 | * @table: the sysctl table |
| 2767 | * @write: %TRUE if this is a write to the sysctl file |
| 2768 | * @buffer: the user buffer |
| 2769 | * @lenp: the size of the user buffer |
| 2770 | * @ppos: file position |
| 2771 | * |
| 2772 | * The bitmap is stored at table->data and the bitmap length (in bits) |
| 2773 | * in table->maxlen. |
| 2774 | * |
| 2775 | * We use a range comma separated format (e.g. 1,3-4,10-10) so that |
| 2776 | * large bitmaps may be represented in a compact manner. Writing into |
| 2777 | * the file will clear the bitmap then update it with the given input. |
| 2778 | * |
| 2779 | * Returns 0 on success. |
| 2780 | */ |
| 2781 | int proc_do_large_bitmap(struct ctl_table *table, int write, |
| 2782 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2783 | { |
| 2784 | int err = 0; |
| 2785 | bool first = 1; |
| 2786 | size_t left = *lenp; |
| 2787 | unsigned long bitmap_len = table->maxlen; |
WANG Cong | 122ff24 | 2014-05-12 16:04:53 -0700 | [diff] [blame] | 2788 | unsigned long *bitmap = *(unsigned long **) table->data; |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2789 | unsigned long *tmp_bitmap = NULL; |
| 2790 | char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c; |
| 2791 | |
WANG Cong | 122ff24 | 2014-05-12 16:04:53 -0700 | [diff] [blame] | 2792 | if (!bitmap || !bitmap_len || !left || (*ppos && !write)) { |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2793 | *lenp = 0; |
| 2794 | return 0; |
| 2795 | } |
| 2796 | |
| 2797 | if (write) { |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2798 | char *kbuf, *p; |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2799 | |
| 2800 | if (left > PAGE_SIZE - 1) |
| 2801 | left = PAGE_SIZE - 1; |
| 2802 | |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2803 | p = kbuf = memdup_user_nul(buffer, left); |
| 2804 | if (IS_ERR(kbuf)) |
| 2805 | return PTR_ERR(kbuf); |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2806 | |
| 2807 | tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long), |
| 2808 | GFP_KERNEL); |
| 2809 | if (!tmp_bitmap) { |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2810 | kfree(kbuf); |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2811 | return -ENOMEM; |
| 2812 | } |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2813 | proc_skip_char(&p, &left, '\n'); |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2814 | while (!err && left) { |
| 2815 | unsigned long val_a, val_b; |
| 2816 | bool neg; |
| 2817 | |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2818 | err = proc_get_long(&p, &left, &val_a, &neg, tr_a, |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2819 | sizeof(tr_a), &c); |
| 2820 | if (err) |
| 2821 | break; |
| 2822 | if (val_a >= bitmap_len || neg) { |
| 2823 | err = -EINVAL; |
| 2824 | break; |
| 2825 | } |
| 2826 | |
| 2827 | val_b = val_a; |
| 2828 | if (left) { |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2829 | p++; |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2830 | left--; |
| 2831 | } |
| 2832 | |
| 2833 | if (c == '-') { |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2834 | err = proc_get_long(&p, &left, &val_b, |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2835 | &neg, tr_b, sizeof(tr_b), |
| 2836 | &c); |
| 2837 | if (err) |
| 2838 | break; |
| 2839 | if (val_b >= bitmap_len || neg || |
| 2840 | val_a > val_b) { |
| 2841 | err = -EINVAL; |
| 2842 | break; |
| 2843 | } |
| 2844 | if (left) { |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2845 | p++; |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2846 | left--; |
| 2847 | } |
| 2848 | } |
| 2849 | |
Akinobu Mita | 5a04cca | 2012-03-28 14:42:50 -0700 | [diff] [blame] | 2850 | bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1); |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2851 | first = 0; |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2852 | proc_skip_char(&p, &left, '\n'); |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2853 | } |
Al Viro | 70f6cbb | 2015-12-24 00:13:10 -0500 | [diff] [blame] | 2854 | kfree(kbuf); |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2855 | } else { |
| 2856 | unsigned long bit_a, bit_b = 0; |
| 2857 | |
| 2858 | while (left) { |
| 2859 | bit_a = find_next_bit(bitmap, bitmap_len, bit_b); |
| 2860 | if (bit_a >= bitmap_len) |
| 2861 | break; |
| 2862 | bit_b = find_next_zero_bit(bitmap, bitmap_len, |
| 2863 | bit_a + 1) - 1; |
| 2864 | |
| 2865 | if (!first) { |
| 2866 | err = proc_put_char(&buffer, &left, ','); |
| 2867 | if (err) |
| 2868 | break; |
| 2869 | } |
| 2870 | err = proc_put_long(&buffer, &left, bit_a, false); |
| 2871 | if (err) |
| 2872 | break; |
| 2873 | if (bit_a != bit_b) { |
| 2874 | err = proc_put_char(&buffer, &left, '-'); |
| 2875 | if (err) |
| 2876 | break; |
| 2877 | err = proc_put_long(&buffer, &left, bit_b, false); |
| 2878 | if (err) |
| 2879 | break; |
| 2880 | } |
| 2881 | |
| 2882 | first = 0; bit_b++; |
| 2883 | } |
| 2884 | if (!err) |
| 2885 | err = proc_put_char(&buffer, &left, '\n'); |
| 2886 | } |
| 2887 | |
| 2888 | if (!err) { |
| 2889 | if (write) { |
| 2890 | if (*ppos) |
| 2891 | bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len); |
| 2892 | else |
Akinobu Mita | 5a04cca | 2012-03-28 14:42:50 -0700 | [diff] [blame] | 2893 | bitmap_copy(bitmap, tmp_bitmap, bitmap_len); |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2894 | } |
| 2895 | kfree(tmp_bitmap); |
| 2896 | *lenp -= left; |
| 2897 | *ppos += *lenp; |
| 2898 | return 0; |
| 2899 | } else { |
| 2900 | kfree(tmp_bitmap); |
| 2901 | return err; |
| 2902 | } |
| 2903 | } |
| 2904 | |
Jovi Zhang | 5561050 | 2011-01-12 17:00:45 -0800 | [diff] [blame] | 2905 | #else /* CONFIG_PROC_SYSCTL */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2906 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2907 | int proc_dostring(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2908 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2909 | { |
| 2910 | return -ENOSYS; |
| 2911 | } |
| 2912 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2913 | int proc_dointvec(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2914 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2915 | { |
| 2916 | return -ENOSYS; |
| 2917 | } |
| 2918 | |
Subash Abhinov Kasiviswanathan | e7d316a | 2016-08-25 15:16:51 -0700 | [diff] [blame] | 2919 | int proc_douintvec(struct ctl_table *table, int write, |
| 2920 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2921 | { |
| 2922 | return -ENOSYS; |
| 2923 | } |
| 2924 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2925 | int proc_dointvec_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2926 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2927 | { |
| 2928 | return -ENOSYS; |
| 2929 | } |
| 2930 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2931 | int proc_dointvec_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2932 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2933 | { |
| 2934 | return -ENOSYS; |
| 2935 | } |
| 2936 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2937 | int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2938 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2939 | { |
| 2940 | return -ENOSYS; |
| 2941 | } |
| 2942 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2943 | int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2944 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2945 | { |
| 2946 | return -ENOSYS; |
| 2947 | } |
| 2948 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2949 | int proc_doulongvec_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2950 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2951 | { |
| 2952 | return -ENOSYS; |
| 2953 | } |
| 2954 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 2955 | int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2956 | void __user *buffer, |
| 2957 | size_t *lenp, loff_t *ppos) |
| 2958 | { |
| 2959 | return -ENOSYS; |
| 2960 | } |
| 2961 | |
| 2962 | |
Jovi Zhang | 5561050 | 2011-01-12 17:00:45 -0800 | [diff] [blame] | 2963 | #endif /* CONFIG_PROC_SYSCTL */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2964 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2965 | /* |
| 2966 | * No sense putting this after each symbol definition, twice, |
| 2967 | * exception granted :-) |
| 2968 | */ |
| 2969 | EXPORT_SYMBOL(proc_dointvec); |
Subash Abhinov Kasiviswanathan | e7d316a | 2016-08-25 15:16:51 -0700 | [diff] [blame] | 2970 | EXPORT_SYMBOL(proc_douintvec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2971 | EXPORT_SYMBOL(proc_dointvec_jiffies); |
| 2972 | EXPORT_SYMBOL(proc_dointvec_minmax); |
| 2973 | EXPORT_SYMBOL(proc_dointvec_userhz_jiffies); |
| 2974 | EXPORT_SYMBOL(proc_dointvec_ms_jiffies); |
| 2975 | EXPORT_SYMBOL(proc_dostring); |
| 2976 | EXPORT_SYMBOL(proc_doulongvec_minmax); |
| 2977 | EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax); |