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