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