1 // SPDX-License-Identifier: GPL-2.0-only
3 * sysctl.c: General linux system control interface
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
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
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
22 #include <linux/module.h>
24 #include <linux/swap.h>
25 #include <linux/slab.h>
26 #include <linux/sysctl.h>
27 #include <linux/bitmap.h>
28 #include <linux/signal.h>
29 #include <linux/panic.h>
30 #include <linux/printk.h>
31 #include <linux/proc_fs.h>
32 #include <linux/security.h>
33 #include <linux/ctype.h>
34 #include <linux/kmemleak.h>
35 #include <linux/filter.h>
37 #include <linux/init.h>
38 #include <linux/kernel.h>
39 #include <linux/kobject.h>
40 #include <linux/net.h>
41 #include <linux/sysrq.h>
42 #include <linux/highuid.h>
43 #include <linux/writeback.h>
44 #include <linux/ratelimit.h>
45 #include <linux/compaction.h>
46 #include <linux/hugetlb.h>
47 #include <linux/initrd.h>
48 #include <linux/key.h>
49 #include <linux/times.h>
50 #include <linux/limits.h>
51 #include <linux/dcache.h>
52 #include <linux/syscalls.h>
53 #include <linux/vmstat.h>
54 #include <linux/nfs_fs.h>
55 #include <linux/acpi.h>
56 #include <linux/reboot.h>
57 #include <linux/ftrace.h>
58 #include <linux/perf_event.h>
59 #include <linux/oom.h>
60 #include <linux/kmod.h>
61 #include <linux/capability.h>
62 #include <linux/binfmts.h>
63 #include <linux/sched/sysctl.h>
64 #include <linux/kexec.h>
65 #include <linux/bpf.h>
66 #include <linux/mount.h>
67 #include <linux/userfaultfd_k.h>
68 #include <linux/latencytop.h>
69 #include <linux/pid.h>
70 #include <linux/delayacct.h>
72 #include "../lib/kstrtox.h"
74 #include <linux/uaccess.h>
75 #include <asm/processor.h>
79 #include <asm/stacktrace.h>
83 #include <asm/setup.h>
85 #ifdef CONFIG_BSD_PROCESS_ACCT
86 #include <linux/acct.h>
88 #ifdef CONFIG_RT_MUTEXES
89 #include <linux/rtmutex.h>
91 #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
92 #include <linux/lockdep.h>
95 #if defined(CONFIG_SYSCTL)
97 /* Constants used for minimum and maximum */
99 #ifdef CONFIG_PERF_EVENTS
100 static const int six_hundred_forty_kb = 640 * 1024;
103 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
104 static const unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
106 static const int ngroups_max = NGROUPS_MAX;
107 static const int cap_last_cap = CAP_LAST_CAP;
109 #ifdef CONFIG_PROC_SYSCTL
112 * enum sysctl_writes_mode - supported sysctl write modes
114 * @SYSCTL_WRITES_LEGACY: each write syscall must fully contain the sysctl value
115 * to be written, and multiple writes on the same sysctl file descriptor
116 * will rewrite the sysctl value, regardless of file position. No warning
117 * is issued when the initial position is not 0.
118 * @SYSCTL_WRITES_WARN: same as above but warn when the initial file position is
120 * @SYSCTL_WRITES_STRICT: writes to numeric sysctl entries must always be at
121 * file position 0 and the value must be fully contained in the buffer
122 * sent to the write syscall. If dealing with strings respect the file
123 * position, but restrict this to the max length of the buffer, anything
124 * passed the max length will be ignored. Multiple writes will append
127 * These write modes control how current file position affects the behavior of
128 * updating sysctl values through the proc interface on each write.
130 enum sysctl_writes_mode {
131 SYSCTL_WRITES_LEGACY = -1,
132 SYSCTL_WRITES_WARN = 0,
133 SYSCTL_WRITES_STRICT = 1,
136 static enum sysctl_writes_mode sysctl_writes_strict = SYSCTL_WRITES_STRICT;
137 #endif /* CONFIG_PROC_SYSCTL */
139 #if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \
140 defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT)
141 int sysctl_legacy_va_layout;
144 #ifdef CONFIG_COMPACTION
145 /* min_extfrag_threshold is SYSCTL_ZERO */;
146 static const int max_extfrag_threshold = 1000;
149 #endif /* CONFIG_SYSCTL */
151 #if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_SYSCTL)
152 static int bpf_stats_handler(struct ctl_table *table, int write,
153 void *buffer, size_t *lenp, loff_t *ppos)
155 struct static_key *key = (struct static_key *)table->data;
156 static int saved_val;
158 struct ctl_table tmp = {
160 .maxlen = sizeof(val),
162 .extra1 = SYSCTL_ZERO,
163 .extra2 = SYSCTL_ONE,
166 if (write && !capable(CAP_SYS_ADMIN))
169 mutex_lock(&bpf_stats_enabled_mutex);
171 ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
172 if (write && !ret && val != saved_val) {
174 static_key_slow_inc(key);
176 static_key_slow_dec(key);
179 mutex_unlock(&bpf_stats_enabled_mutex);
183 static int bpf_unpriv_handler(struct ctl_table *table, int write,
184 void *buffer, size_t *lenp, loff_t *ppos)
186 int ret, unpriv_enable = *(int *)table->data;
187 bool locked_state = unpriv_enable == 1;
188 struct ctl_table tmp = *table;
190 if (write && !capable(CAP_SYS_ADMIN))
193 tmp.data = &unpriv_enable;
194 ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
196 if (locked_state && unpriv_enable != 1)
198 *(int *)table->data = unpriv_enable;
202 #endif /* CONFIG_BPF_SYSCALL && CONFIG_SYSCTL */
208 #ifdef CONFIG_PROC_SYSCTL
210 static int _proc_do_string(char *data, int maxlen, int write,
211 char *buffer, size_t *lenp, loff_t *ppos)
216 if (!data || !maxlen || !*lenp) {
222 if (sysctl_writes_strict == SYSCTL_WRITES_STRICT) {
223 /* Only continue writes not past the end of buffer. */
225 if (len > maxlen - 1)
232 /* Start writing from beginning of buffer. */
238 while ((p - buffer) < *lenp && len < maxlen - 1) {
240 if (c == 0 || c == '\n')
261 memcpy(buffer, data, len);
272 static void warn_sysctl_write(struct ctl_table *table)
274 pr_warn_once("%s wrote to %s when file position was not 0!\n"
275 "This will not be supported in the future. To silence this\n"
276 "warning, set kernel.sysctl_writes_strict = -1\n",
277 current->comm, table->procname);
281 * proc_first_pos_non_zero_ignore - check if first position is allowed
282 * @ppos: file position
283 * @table: the sysctl table
285 * Returns true if the first position is non-zero and the sysctl_writes_strict
286 * mode indicates this is not allowed for numeric input types. String proc
287 * handlers can ignore the return value.
289 static bool proc_first_pos_non_zero_ignore(loff_t *ppos,
290 struct ctl_table *table)
295 switch (sysctl_writes_strict) {
296 case SYSCTL_WRITES_STRICT:
298 case SYSCTL_WRITES_WARN:
299 warn_sysctl_write(table);
307 * proc_dostring - read a string sysctl
308 * @table: the sysctl table
309 * @write: %TRUE if this is a write to the sysctl file
310 * @buffer: the user buffer
311 * @lenp: the size of the user buffer
312 * @ppos: file position
314 * Reads/writes a string from/to the user buffer. If the kernel
315 * buffer provided is not large enough to hold the string, the
316 * string is truncated. The copied string is %NULL-terminated.
317 * If the string is being read by the user process, it is copied
318 * and a newline '\n' is added. It is truncated if the buffer is
321 * Returns 0 on success.
323 int proc_dostring(struct ctl_table *table, int write,
324 void *buffer, size_t *lenp, loff_t *ppos)
327 proc_first_pos_non_zero_ignore(ppos, table);
329 return _proc_do_string(table->data, table->maxlen, write, buffer, lenp,
333 static size_t proc_skip_spaces(char **buf)
336 char *tmp = skip_spaces(*buf);
342 static void proc_skip_char(char **buf, size_t *size, const char v)
353 * strtoul_lenient - parse an ASCII formatted integer from a buffer and only
356 * @cp: kernel buffer containing the string to parse
357 * @endp: pointer to store the trailing characters
358 * @base: the base to use
359 * @res: where the parsed integer will be stored
361 * In case of success 0 is returned and @res will contain the parsed integer,
362 * @endp will hold any trailing characters.
363 * This function will fail the parse on overflow. If there wasn't an overflow
364 * the function will defer the decision what characters count as invalid to the
367 static int strtoul_lenient(const char *cp, char **endp, unsigned int base,
370 unsigned long long result;
373 cp = _parse_integer_fixup_radix(cp, &base);
374 rv = _parse_integer(cp, base, &result);
375 if ((rv & KSTRTOX_OVERFLOW) || (result != (unsigned long)result))
383 *res = (unsigned long)result;
389 * proc_get_long - reads an ASCII formatted integer from a user buffer
391 * @buf: a kernel buffer
392 * @size: size of the kernel buffer
393 * @val: this is where the number will be stored
394 * @neg: set to %TRUE if number is negative
395 * @perm_tr: a vector which contains the allowed trailers
396 * @perm_tr_len: size of the perm_tr vector
397 * @tr: pointer to store the trailer character
399 * In case of success %0 is returned and @buf and @size are updated with
400 * the amount of bytes read. If @tr is non-NULL and a trailing
401 * character exists (size is non-zero after returning from this
402 * function), @tr is updated with the trailing character.
404 static int proc_get_long(char **buf, size_t *size,
405 unsigned long *val, bool *neg,
406 const char *perm_tr, unsigned perm_tr_len, char *tr)
409 char *p, tmp[TMPBUFLEN];
415 if (len > TMPBUFLEN - 1)
418 memcpy(tmp, *buf, len);
422 if (*p == '-' && *size > 1) {
430 if (strtoul_lenient(p, &p, 0, val))
435 /* We don't know if the next char is whitespace thus we may accept
436 * invalid integers (e.g. 1234...a) or two integers instead of one
437 * (e.g. 123...1). So lets not allow such large numbers. */
438 if (len == TMPBUFLEN - 1)
441 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
444 if (tr && (len < *size))
454 * proc_put_long - converts an integer to a decimal ASCII formatted string
456 * @buf: the user buffer
457 * @size: the size of the user buffer
458 * @val: the integer to be converted
459 * @neg: sign of the number, %TRUE for negative
461 * In case of success @buf and @size are updated with the amount of bytes
464 static void proc_put_long(void **buf, size_t *size, unsigned long val, bool neg)
467 char tmp[TMPBUFLEN], *p = tmp;
469 sprintf(p, "%s%lu", neg ? "-" : "", val);
473 memcpy(*buf, tmp, len);
479 static void proc_put_char(void **buf, size_t *size, char c)
482 char **buffer = (char **)buf;
491 static int do_proc_dobool_conv(bool *negp, unsigned long *lvalp,
493 int write, void *data)
496 *(bool *)valp = *lvalp;
498 int val = *(bool *)valp;
500 *lvalp = (unsigned long)val;
506 static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
508 int write, void *data)
512 if (*lvalp > (unsigned long) INT_MAX + 1)
516 if (*lvalp > (unsigned long) INT_MAX)
524 *lvalp = -(unsigned long)val;
527 *lvalp = (unsigned long)val;
533 static int do_proc_douintvec_conv(unsigned long *lvalp,
535 int write, void *data)
538 if (*lvalp > UINT_MAX)
542 unsigned int val = *valp;
543 *lvalp = (unsigned long)val;
548 static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
550 static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
551 int write, void *buffer,
552 size_t *lenp, loff_t *ppos,
553 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
554 int write, void *data),
557 int *i, vleft, first = 1, err = 0;
561 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
566 i = (int *) tbl_data;
567 vleft = table->maxlen / sizeof(*i);
571 conv = do_proc_dointvec_conv;
574 if (proc_first_pos_non_zero_ignore(ppos, table))
577 if (left > PAGE_SIZE - 1)
578 left = PAGE_SIZE - 1;
582 for (; left && vleft--; i++, first=0) {
587 left -= proc_skip_spaces(&p);
591 err = proc_get_long(&p, &left, &lval, &neg,
593 sizeof(proc_wspace_sep), NULL);
596 if (conv(&neg, &lval, i, 1, data)) {
601 if (conv(&neg, &lval, i, 0, data)) {
606 proc_put_char(&buffer, &left, '\t');
607 proc_put_long(&buffer, &left, lval, neg);
611 if (!write && !first && left && !err)
612 proc_put_char(&buffer, &left, '\n');
613 if (write && !err && left)
614 left -= proc_skip_spaces(&p);
616 return err ? : -EINVAL;
623 static int do_proc_dointvec(struct ctl_table *table, int write,
624 void *buffer, size_t *lenp, loff_t *ppos,
625 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
626 int write, void *data),
629 return __do_proc_dointvec(table->data, table, write,
630 buffer, lenp, ppos, conv, data);
633 static int do_proc_douintvec_w(unsigned int *tbl_data,
634 struct ctl_table *table,
636 size_t *lenp, loff_t *ppos,
637 int (*conv)(unsigned long *lvalp,
639 int write, void *data),
650 if (proc_first_pos_non_zero_ignore(ppos, table))
653 if (left > PAGE_SIZE - 1)
654 left = PAGE_SIZE - 1;
656 left -= proc_skip_spaces(&p);
662 err = proc_get_long(&p, &left, &lval, &neg,
664 sizeof(proc_wspace_sep), NULL);
670 if (conv(&lval, tbl_data, 1, data)) {
676 left -= proc_skip_spaces(&p);
684 /* This is in keeping with old __do_proc_dointvec() */
690 static int do_proc_douintvec_r(unsigned int *tbl_data, void *buffer,
691 size_t *lenp, loff_t *ppos,
692 int (*conv)(unsigned long *lvalp,
694 int write, void *data),
703 if (conv(&lval, tbl_data, 0, data)) {
708 proc_put_long(&buffer, &left, lval, false);
712 proc_put_char(&buffer, &left, '\n');
721 static int __do_proc_douintvec(void *tbl_data, struct ctl_table *table,
722 int write, void *buffer,
723 size_t *lenp, loff_t *ppos,
724 int (*conv)(unsigned long *lvalp,
726 int write, void *data),
729 unsigned int *i, vleft;
731 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
736 i = (unsigned int *) tbl_data;
737 vleft = table->maxlen / sizeof(*i);
740 * Arrays are not supported, keep this simple. *Do not* add
749 conv = do_proc_douintvec_conv;
752 return do_proc_douintvec_w(i, table, buffer, lenp, ppos,
754 return do_proc_douintvec_r(i, buffer, lenp, ppos, conv, data);
757 int do_proc_douintvec(struct ctl_table *table, int write,
758 void *buffer, size_t *lenp, loff_t *ppos,
759 int (*conv)(unsigned long *lvalp,
761 int write, void *data),
764 return __do_proc_douintvec(table->data, table, write,
765 buffer, lenp, ppos, conv, data);
769 * proc_dobool - read/write a bool
770 * @table: the sysctl table
771 * @write: %TRUE if this is a write to the sysctl file
772 * @buffer: the user buffer
773 * @lenp: the size of the user buffer
774 * @ppos: file position
776 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
777 * values from/to the user buffer, treated as an ASCII string.
779 * Returns 0 on success.
781 int proc_dobool(struct ctl_table *table, int write, void *buffer,
782 size_t *lenp, loff_t *ppos)
784 return do_proc_dointvec(table, write, buffer, lenp, ppos,
785 do_proc_dobool_conv, NULL);
789 * proc_dointvec - read a vector of integers
790 * @table: the sysctl table
791 * @write: %TRUE if this is a write to the sysctl file
792 * @buffer: the user buffer
793 * @lenp: the size of the user buffer
794 * @ppos: file position
796 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
797 * values from/to the user buffer, treated as an ASCII string.
799 * Returns 0 on success.
801 int proc_dointvec(struct ctl_table *table, int write, void *buffer,
802 size_t *lenp, loff_t *ppos)
804 return do_proc_dointvec(table, write, buffer, lenp, ppos, NULL, NULL);
807 #ifdef CONFIG_COMPACTION
808 static int proc_dointvec_minmax_warn_RT_change(struct ctl_table *table,
809 int write, void *buffer, size_t *lenp, loff_t *ppos)
813 if (!IS_ENABLED(CONFIG_PREEMPT_RT) || !write)
814 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
816 old = *(int *)table->data;
817 ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
820 if (old != *(int *)table->data)
821 pr_warn_once("sysctl attribute %s changed by %s[%d]\n",
822 table->procname, current->comm,
823 task_pid_nr(current));
829 * proc_douintvec - read a vector of unsigned integers
830 * @table: the sysctl table
831 * @write: %TRUE if this is a write to the sysctl file
832 * @buffer: the user buffer
833 * @lenp: the size of the user buffer
834 * @ppos: file position
836 * Reads/writes up to table->maxlen/sizeof(unsigned int) unsigned integer
837 * values from/to the user buffer, treated as an ASCII string.
839 * Returns 0 on success.
841 int proc_douintvec(struct ctl_table *table, int write, void *buffer,
842 size_t *lenp, loff_t *ppos)
844 return do_proc_douintvec(table, write, buffer, lenp, ppos,
845 do_proc_douintvec_conv, NULL);
849 * Taint values can only be increased
850 * This means we can safely use a temporary.
852 static int proc_taint(struct ctl_table *table, int write,
853 void *buffer, size_t *lenp, loff_t *ppos)
856 unsigned long tmptaint = get_taint();
859 if (write && !capable(CAP_SYS_ADMIN))
864 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
872 * If we are relying on panic_on_taint not producing
873 * false positives due to userspace input, bail out
874 * before setting the requested taint flags.
876 if (panic_on_taint_nousertaint && (tmptaint & panic_on_taint))
880 * Poor man's atomic or. Not worth adding a primitive
881 * to everyone's atomic.h for this
883 for (i = 0; i < TAINT_FLAGS_COUNT; i++)
884 if ((1UL << i) & tmptaint)
885 add_taint(i, LOCKDEP_STILL_OK);
892 * struct do_proc_dointvec_minmax_conv_param - proc_dointvec_minmax() range checking structure
893 * @min: pointer to minimum allowable value
894 * @max: pointer to maximum allowable value
896 * The do_proc_dointvec_minmax_conv_param structure provides the
897 * minimum and maximum values for doing range checking for those sysctl
898 * parameters that use the proc_dointvec_minmax() handler.
900 struct do_proc_dointvec_minmax_conv_param {
905 static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
907 int write, void *data)
910 struct do_proc_dointvec_minmax_conv_param *param = data;
912 * If writing, first do so via a temporary local int so we can
913 * bounds-check it before touching *valp.
915 int *ip = write ? &tmp : valp;
917 ret = do_proc_dointvec_conv(negp, lvalp, ip, write, data);
922 if ((param->min && *param->min > tmp) ||
923 (param->max && *param->max < tmp))
932 * proc_dointvec_minmax - read a vector of integers with min/max values
933 * @table: the sysctl table
934 * @write: %TRUE if this is a write to the sysctl file
935 * @buffer: the user buffer
936 * @lenp: the size of the user buffer
937 * @ppos: file position
939 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
940 * values from/to the user buffer, treated as an ASCII string.
942 * This routine will ensure the values are within the range specified by
943 * table->extra1 (min) and table->extra2 (max).
945 * Returns 0 on success or -EINVAL on write when the range check fails.
947 int proc_dointvec_minmax(struct ctl_table *table, int write,
948 void *buffer, size_t *lenp, loff_t *ppos)
950 struct do_proc_dointvec_minmax_conv_param param = {
951 .min = (int *) table->extra1,
952 .max = (int *) table->extra2,
954 return do_proc_dointvec(table, write, buffer, lenp, ppos,
955 do_proc_dointvec_minmax_conv, ¶m);
959 * struct do_proc_douintvec_minmax_conv_param - proc_douintvec_minmax() range checking structure
960 * @min: pointer to minimum allowable value
961 * @max: pointer to maximum allowable value
963 * The do_proc_douintvec_minmax_conv_param structure provides the
964 * minimum and maximum values for doing range checking for those sysctl
965 * parameters that use the proc_douintvec_minmax() handler.
967 struct do_proc_douintvec_minmax_conv_param {
972 static int do_proc_douintvec_minmax_conv(unsigned long *lvalp,
974 int write, void *data)
978 struct do_proc_douintvec_minmax_conv_param *param = data;
979 /* write via temporary local uint for bounds-checking */
980 unsigned int *up = write ? &tmp : valp;
982 ret = do_proc_douintvec_conv(lvalp, up, write, data);
987 if ((param->min && *param->min > tmp) ||
988 (param->max && *param->max < tmp))
998 * proc_douintvec_minmax - read a vector of unsigned ints with min/max values
999 * @table: the sysctl table
1000 * @write: %TRUE if this is a write to the sysctl file
1001 * @buffer: the user buffer
1002 * @lenp: the size of the user buffer
1003 * @ppos: file position
1005 * Reads/writes up to table->maxlen/sizeof(unsigned int) unsigned integer
1006 * values from/to the user buffer, treated as an ASCII string. Negative
1007 * strings are not allowed.
1009 * This routine will ensure the values are within the range specified by
1010 * table->extra1 (min) and table->extra2 (max). There is a final sanity
1011 * check for UINT_MAX to avoid having to support wrap around uses from
1014 * Returns 0 on success or -ERANGE on write when the range check fails.
1016 int proc_douintvec_minmax(struct ctl_table *table, int write,
1017 void *buffer, size_t *lenp, loff_t *ppos)
1019 struct do_proc_douintvec_minmax_conv_param param = {
1020 .min = (unsigned int *) table->extra1,
1021 .max = (unsigned int *) table->extra2,
1023 return do_proc_douintvec(table, write, buffer, lenp, ppos,
1024 do_proc_douintvec_minmax_conv, ¶m);
1028 * proc_dou8vec_minmax - read a vector of unsigned chars with min/max values
1029 * @table: the sysctl table
1030 * @write: %TRUE if this is a write to the sysctl file
1031 * @buffer: the user buffer
1032 * @lenp: the size of the user buffer
1033 * @ppos: file position
1035 * Reads/writes up to table->maxlen/sizeof(u8) unsigned chars
1036 * values from/to the user buffer, treated as an ASCII string. Negative
1037 * strings are not allowed.
1039 * This routine will ensure the values are within the range specified by
1040 * table->extra1 (min) and table->extra2 (max).
1042 * Returns 0 on success or an error on write when the range check fails.
1044 int proc_dou8vec_minmax(struct ctl_table *table, int write,
1045 void *buffer, size_t *lenp, loff_t *ppos)
1047 struct ctl_table tmp;
1048 unsigned int min = 0, max = 255U, val;
1049 u8 *data = table->data;
1050 struct do_proc_douintvec_minmax_conv_param param = {
1056 /* Do not support arrays yet. */
1057 if (table->maxlen != sizeof(u8))
1060 if (table->extra1) {
1061 min = *(unsigned int *) table->extra1;
1065 if (table->extra2) {
1066 max = *(unsigned int *) table->extra2;
1073 tmp.maxlen = sizeof(val);
1076 res = do_proc_douintvec(&tmp, write, buffer, lenp, ppos,
1077 do_proc_douintvec_minmax_conv, ¶m);
1084 EXPORT_SYMBOL_GPL(proc_dou8vec_minmax);
1086 #ifdef CONFIG_MAGIC_SYSRQ
1087 static int sysrq_sysctl_handler(struct ctl_table *table, int write,
1088 void *buffer, size_t *lenp, loff_t *ppos)
1094 ret = __do_proc_dointvec(&tmp, table, write, buffer,
1095 lenp, ppos, NULL, NULL);
1100 sysrq_toggle_support(tmp);
1106 static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table,
1107 int write, void *buffer, size_t *lenp, loff_t *ppos,
1108 unsigned long convmul, unsigned long convdiv)
1110 unsigned long *i, *min, *max;
1111 int vleft, first = 1, err = 0;
1115 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
1120 i = (unsigned long *) data;
1121 min = (unsigned long *) table->extra1;
1122 max = (unsigned long *) table->extra2;
1123 vleft = table->maxlen / sizeof(unsigned long);
1127 if (proc_first_pos_non_zero_ignore(ppos, table))
1130 if (left > PAGE_SIZE - 1)
1131 left = PAGE_SIZE - 1;
1135 for (; left && vleft--; i++, first = 0) {
1141 left -= proc_skip_spaces(&p);
1145 err = proc_get_long(&p, &left, &val, &neg,
1147 sizeof(proc_wspace_sep), NULL);
1153 val = convmul * val / convdiv;
1154 if ((min && val < *min) || (max && val > *max)) {
1160 val = convdiv * (*i) / convmul;
1162 proc_put_char(&buffer, &left, '\t');
1163 proc_put_long(&buffer, &left, val, false);
1167 if (!write && !first && left && !err)
1168 proc_put_char(&buffer, &left, '\n');
1170 left -= proc_skip_spaces(&p);
1172 return err ? : -EINVAL;
1179 static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
1180 void *buffer, size_t *lenp, loff_t *ppos, unsigned long convmul,
1181 unsigned long convdiv)
1183 return __do_proc_doulongvec_minmax(table->data, table, write,
1184 buffer, lenp, ppos, convmul, convdiv);
1188 * proc_doulongvec_minmax - read a vector of long integers with min/max values
1189 * @table: the sysctl table
1190 * @write: %TRUE if this is a write to the sysctl file
1191 * @buffer: the user buffer
1192 * @lenp: the size of the user buffer
1193 * @ppos: file position
1195 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
1196 * values from/to the user buffer, treated as an ASCII string.
1198 * This routine will ensure the values are within the range specified by
1199 * table->extra1 (min) and table->extra2 (max).
1201 * Returns 0 on success.
1203 int proc_doulongvec_minmax(struct ctl_table *table, int write,
1204 void *buffer, size_t *lenp, loff_t *ppos)
1206 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
1210 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
1211 * @table: the sysctl table
1212 * @write: %TRUE if this is a write to the sysctl file
1213 * @buffer: the user buffer
1214 * @lenp: the size of the user buffer
1215 * @ppos: file position
1217 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
1218 * values from/to the user buffer, treated as an ASCII string. The values
1219 * are treated as milliseconds, and converted to jiffies when they are stored.
1221 * This routine will ensure the values are within the range specified by
1222 * table->extra1 (min) and table->extra2 (max).
1224 * Returns 0 on success.
1226 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
1227 void *buffer, size_t *lenp, loff_t *ppos)
1229 return do_proc_doulongvec_minmax(table, write, buffer,
1230 lenp, ppos, HZ, 1000l);
1234 static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
1236 int write, void *data)
1239 if (*lvalp > INT_MAX / HZ)
1241 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
1247 lval = -(unsigned long)val;
1250 lval = (unsigned long)val;
1257 static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
1259 int write, void *data)
1262 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
1264 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
1270 lval = -(unsigned long)val;
1273 lval = (unsigned long)val;
1275 *lvalp = jiffies_to_clock_t(lval);
1280 static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
1282 int write, void *data)
1285 unsigned long jif = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
1295 lval = -(unsigned long)val;
1298 lval = (unsigned long)val;
1300 *lvalp = jiffies_to_msecs(lval);
1306 * proc_dointvec_jiffies - read a vector of integers as seconds
1307 * @table: the sysctl table
1308 * @write: %TRUE if this is a write to the sysctl file
1309 * @buffer: the user buffer
1310 * @lenp: the size of the user buffer
1311 * @ppos: file position
1313 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1314 * values from/to the user buffer, treated as an ASCII string.
1315 * The values read are assumed to be in seconds, and are converted into
1318 * Returns 0 on success.
1320 int proc_dointvec_jiffies(struct ctl_table *table, int write,
1321 void *buffer, size_t *lenp, loff_t *ppos)
1323 return do_proc_dointvec(table,write,buffer,lenp,ppos,
1324 do_proc_dointvec_jiffies_conv,NULL);
1328 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
1329 * @table: the sysctl table
1330 * @write: %TRUE if this is a write to the sysctl file
1331 * @buffer: the user buffer
1332 * @lenp: the size of the user buffer
1333 * @ppos: pointer to the file position
1335 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1336 * values from/to the user buffer, treated as an ASCII string.
1337 * The values read are assumed to be in 1/USER_HZ seconds, and
1338 * are converted into jiffies.
1340 * Returns 0 on success.
1342 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
1343 void *buffer, size_t *lenp, loff_t *ppos)
1345 return do_proc_dointvec(table,write,buffer,lenp,ppos,
1346 do_proc_dointvec_userhz_jiffies_conv,NULL);
1350 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
1351 * @table: the sysctl table
1352 * @write: %TRUE if this is a write to the sysctl file
1353 * @buffer: the user buffer
1354 * @lenp: the size of the user buffer
1355 * @ppos: file position
1356 * @ppos: the current position in the file
1358 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1359 * values from/to the user buffer, treated as an ASCII string.
1360 * The values read are assumed to be in 1/1000 seconds, and
1361 * are converted into jiffies.
1363 * Returns 0 on success.
1365 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, void *buffer,
1366 size_t *lenp, loff_t *ppos)
1368 return do_proc_dointvec(table, write, buffer, lenp, ppos,
1369 do_proc_dointvec_ms_jiffies_conv, NULL);
1372 static int proc_do_cad_pid(struct ctl_table *table, int write, void *buffer,
1373 size_t *lenp, loff_t *ppos)
1375 struct pid *new_pid;
1379 tmp = pid_vnr(cad_pid);
1381 r = __do_proc_dointvec(&tmp, table, write, buffer,
1382 lenp, ppos, NULL, NULL);
1386 new_pid = find_get_pid(tmp);
1390 put_pid(xchg(&cad_pid, new_pid));
1395 * proc_do_large_bitmap - read/write from/to a large bitmap
1396 * @table: the sysctl table
1397 * @write: %TRUE if this is a write to the sysctl file
1398 * @buffer: the user buffer
1399 * @lenp: the size of the user buffer
1400 * @ppos: file position
1402 * The bitmap is stored at table->data and the bitmap length (in bits)
1405 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
1406 * large bitmaps may be represented in a compact manner. Writing into
1407 * the file will clear the bitmap then update it with the given input.
1409 * Returns 0 on success.
1411 int proc_do_large_bitmap(struct ctl_table *table, int write,
1412 void *buffer, size_t *lenp, loff_t *ppos)
1415 size_t left = *lenp;
1416 unsigned long bitmap_len = table->maxlen;
1417 unsigned long *bitmap = *(unsigned long **) table->data;
1418 unsigned long *tmp_bitmap = NULL;
1419 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
1421 if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
1430 if (left > PAGE_SIZE - 1) {
1431 left = PAGE_SIZE - 1;
1432 /* How much of the buffer we'll skip this pass */
1433 skipped = *lenp - left;
1436 tmp_bitmap = bitmap_zalloc(bitmap_len, GFP_KERNEL);
1439 proc_skip_char(&p, &left, '\n');
1440 while (!err && left) {
1441 unsigned long val_a, val_b;
1445 /* In case we stop parsing mid-number, we can reset */
1447 err = proc_get_long(&p, &left, &val_a, &neg, tr_a,
1450 * If we consumed the entirety of a truncated buffer or
1451 * only one char is left (may be a "-"), then stop here,
1452 * reset, & come back for more.
1454 if ((left <= 1) && skipped) {
1461 if (val_a >= bitmap_len || neg) {
1473 err = proc_get_long(&p, &left, &val_b,
1474 &neg, tr_b, sizeof(tr_b),
1477 * If we consumed all of a truncated buffer or
1478 * then stop here, reset, & come back for more.
1480 if (!left && skipped) {
1487 if (val_b >= bitmap_len || neg ||
1498 bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
1499 proc_skip_char(&p, &left, '\n');
1503 unsigned long bit_a, bit_b = 0;
1507 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
1508 if (bit_a >= bitmap_len)
1510 bit_b = find_next_zero_bit(bitmap, bitmap_len,
1514 proc_put_char(&buffer, &left, ',');
1515 proc_put_long(&buffer, &left, bit_a, false);
1516 if (bit_a != bit_b) {
1517 proc_put_char(&buffer, &left, '-');
1518 proc_put_long(&buffer, &left, bit_b, false);
1523 proc_put_char(&buffer, &left, '\n');
1529 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
1531 bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
1537 bitmap_free(tmp_bitmap);
1541 #else /* CONFIG_PROC_SYSCTL */
1543 int proc_dostring(struct ctl_table *table, int write,
1544 void *buffer, size_t *lenp, loff_t *ppos)
1549 int proc_dobool(struct ctl_table *table, int write,
1550 void *buffer, size_t *lenp, loff_t *ppos)
1555 int proc_dointvec(struct ctl_table *table, int write,
1556 void *buffer, size_t *lenp, loff_t *ppos)
1561 int proc_douintvec(struct ctl_table *table, int write,
1562 void *buffer, size_t *lenp, loff_t *ppos)
1567 int proc_dointvec_minmax(struct ctl_table *table, int write,
1568 void *buffer, size_t *lenp, loff_t *ppos)
1573 int proc_douintvec_minmax(struct ctl_table *table, int write,
1574 void *buffer, size_t *lenp, loff_t *ppos)
1579 int proc_dou8vec_minmax(struct ctl_table *table, int write,
1580 void *buffer, size_t *lenp, loff_t *ppos)
1585 int proc_dointvec_jiffies(struct ctl_table *table, int write,
1586 void *buffer, size_t *lenp, loff_t *ppos)
1591 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
1592 void *buffer, size_t *lenp, loff_t *ppos)
1597 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
1598 void *buffer, size_t *lenp, loff_t *ppos)
1603 int proc_doulongvec_minmax(struct ctl_table *table, int write,
1604 void *buffer, size_t *lenp, loff_t *ppos)
1609 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
1610 void *buffer, size_t *lenp, loff_t *ppos)
1615 int proc_do_large_bitmap(struct ctl_table *table, int write,
1616 void *buffer, size_t *lenp, loff_t *ppos)
1621 #endif /* CONFIG_PROC_SYSCTL */
1623 #if defined(CONFIG_SYSCTL)
1624 int proc_do_static_key(struct ctl_table *table, int write,
1625 void *buffer, size_t *lenp, loff_t *ppos)
1627 struct static_key *key = (struct static_key *)table->data;
1628 static DEFINE_MUTEX(static_key_mutex);
1630 struct ctl_table tmp = {
1632 .maxlen = sizeof(val),
1633 .mode = table->mode,
1634 .extra1 = SYSCTL_ZERO,
1635 .extra2 = SYSCTL_ONE,
1638 if (write && !capable(CAP_SYS_ADMIN))
1641 mutex_lock(&static_key_mutex);
1642 val = static_key_enabled(key);
1643 ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
1644 if (write && !ret) {
1646 static_key_enable(key);
1648 static_key_disable(key);
1650 mutex_unlock(&static_key_mutex);
1654 static struct ctl_table kern_table[] = {
1656 .procname = "sched_child_runs_first",
1657 .data = &sysctl_sched_child_runs_first,
1658 .maxlen = sizeof(unsigned int),
1660 .proc_handler = proc_dointvec,
1662 #ifdef CONFIG_SCHEDSTATS
1664 .procname = "sched_schedstats",
1666 .maxlen = sizeof(unsigned int),
1668 .proc_handler = sysctl_schedstats,
1669 .extra1 = SYSCTL_ZERO,
1670 .extra2 = SYSCTL_ONE,
1672 #endif /* CONFIG_SCHEDSTATS */
1673 #ifdef CONFIG_TASK_DELAY_ACCT
1675 .procname = "task_delayacct",
1677 .maxlen = sizeof(unsigned int),
1679 .proc_handler = sysctl_delayacct,
1680 .extra1 = SYSCTL_ZERO,
1681 .extra2 = SYSCTL_ONE,
1683 #endif /* CONFIG_TASK_DELAY_ACCT */
1684 #ifdef CONFIG_NUMA_BALANCING
1686 .procname = "numa_balancing",
1687 .data = NULL, /* filled in by handler */
1688 .maxlen = sizeof(unsigned int),
1690 .proc_handler = sysctl_numa_balancing,
1691 .extra1 = SYSCTL_ZERO,
1692 .extra2 = SYSCTL_ONE,
1694 #endif /* CONFIG_NUMA_BALANCING */
1696 .procname = "sched_rt_period_us",
1697 .data = &sysctl_sched_rt_period,
1698 .maxlen = sizeof(unsigned int),
1700 .proc_handler = sched_rt_handler,
1703 .procname = "sched_rt_runtime_us",
1704 .data = &sysctl_sched_rt_runtime,
1705 .maxlen = sizeof(int),
1707 .proc_handler = sched_rt_handler,
1710 .procname = "sched_deadline_period_max_us",
1711 .data = &sysctl_sched_dl_period_max,
1712 .maxlen = sizeof(unsigned int),
1714 .proc_handler = proc_dointvec,
1717 .procname = "sched_deadline_period_min_us",
1718 .data = &sysctl_sched_dl_period_min,
1719 .maxlen = sizeof(unsigned int),
1721 .proc_handler = proc_dointvec,
1724 .procname = "sched_rr_timeslice_ms",
1725 .data = &sysctl_sched_rr_timeslice,
1726 .maxlen = sizeof(int),
1728 .proc_handler = sched_rr_handler,
1730 #ifdef CONFIG_UCLAMP_TASK
1732 .procname = "sched_util_clamp_min",
1733 .data = &sysctl_sched_uclamp_util_min,
1734 .maxlen = sizeof(unsigned int),
1736 .proc_handler = sysctl_sched_uclamp_handler,
1739 .procname = "sched_util_clamp_max",
1740 .data = &sysctl_sched_uclamp_util_max,
1741 .maxlen = sizeof(unsigned int),
1743 .proc_handler = sysctl_sched_uclamp_handler,
1746 .procname = "sched_util_clamp_min_rt_default",
1747 .data = &sysctl_sched_uclamp_util_min_rt_default,
1748 .maxlen = sizeof(unsigned int),
1750 .proc_handler = sysctl_sched_uclamp_handler,
1753 #ifdef CONFIG_SCHED_AUTOGROUP
1755 .procname = "sched_autogroup_enabled",
1756 .data = &sysctl_sched_autogroup_enabled,
1757 .maxlen = sizeof(unsigned int),
1759 .proc_handler = proc_dointvec_minmax,
1760 .extra1 = SYSCTL_ZERO,
1761 .extra2 = SYSCTL_ONE,
1764 #ifdef CONFIG_CFS_BANDWIDTH
1766 .procname = "sched_cfs_bandwidth_slice_us",
1767 .data = &sysctl_sched_cfs_bandwidth_slice,
1768 .maxlen = sizeof(unsigned int),
1770 .proc_handler = proc_dointvec_minmax,
1771 .extra1 = SYSCTL_ONE,
1774 #if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
1776 .procname = "sched_energy_aware",
1777 .data = &sysctl_sched_energy_aware,
1778 .maxlen = sizeof(unsigned int),
1780 .proc_handler = sched_energy_aware_handler,
1781 .extra1 = SYSCTL_ZERO,
1782 .extra2 = SYSCTL_ONE,
1785 #ifdef CONFIG_PROVE_LOCKING
1787 .procname = "prove_locking",
1788 .data = &prove_locking,
1789 .maxlen = sizeof(int),
1791 .proc_handler = proc_dointvec,
1794 #ifdef CONFIG_LOCK_STAT
1796 .procname = "lock_stat",
1798 .maxlen = sizeof(int),
1800 .proc_handler = proc_dointvec,
1804 .procname = "panic",
1805 .data = &panic_timeout,
1806 .maxlen = sizeof(int),
1808 .proc_handler = proc_dointvec,
1810 #ifdef CONFIG_PROC_SYSCTL
1812 .procname = "tainted",
1813 .maxlen = sizeof(long),
1815 .proc_handler = proc_taint,
1818 .procname = "sysctl_writes_strict",
1819 .data = &sysctl_writes_strict,
1820 .maxlen = sizeof(int),
1822 .proc_handler = proc_dointvec_minmax,
1823 .extra1 = SYSCTL_NEG_ONE,
1824 .extra2 = SYSCTL_ONE,
1827 #ifdef CONFIG_LATENCYTOP
1829 .procname = "latencytop",
1830 .data = &latencytop_enabled,
1831 .maxlen = sizeof(int),
1833 .proc_handler = sysctl_latencytop,
1836 #ifdef CONFIG_BLK_DEV_INITRD
1838 .procname = "real-root-dev",
1839 .data = &real_root_dev,
1840 .maxlen = sizeof(int),
1842 .proc_handler = proc_dointvec,
1846 .procname = "print-fatal-signals",
1847 .data = &print_fatal_signals,
1848 .maxlen = sizeof(int),
1850 .proc_handler = proc_dointvec,
1854 .procname = "reboot-cmd",
1855 .data = reboot_command,
1858 .proc_handler = proc_dostring,
1861 .procname = "stop-a",
1862 .data = &stop_a_enabled,
1863 .maxlen = sizeof (int),
1865 .proc_handler = proc_dointvec,
1868 .procname = "scons-poweroff",
1869 .data = &scons_pwroff,
1870 .maxlen = sizeof (int),
1872 .proc_handler = proc_dointvec,
1875 #ifdef CONFIG_SPARC64
1877 .procname = "tsb-ratio",
1878 .data = &sysctl_tsb_ratio,
1879 .maxlen = sizeof (int),
1881 .proc_handler = proc_dointvec,
1884 #ifdef CONFIG_PARISC
1886 .procname = "soft-power",
1887 .data = &pwrsw_enabled,
1888 .maxlen = sizeof (int),
1890 .proc_handler = proc_dointvec,
1893 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
1895 .procname = "unaligned-trap",
1896 .data = &unaligned_enabled,
1897 .maxlen = sizeof (int),
1899 .proc_handler = proc_dointvec,
1903 .procname = "ctrl-alt-del",
1905 .maxlen = sizeof(int),
1907 .proc_handler = proc_dointvec,
1909 #ifdef CONFIG_FUNCTION_TRACER
1911 .procname = "ftrace_enabled",
1912 .data = &ftrace_enabled,
1913 .maxlen = sizeof(int),
1915 .proc_handler = ftrace_enable_sysctl,
1918 #ifdef CONFIG_STACK_TRACER
1920 .procname = "stack_tracer_enabled",
1921 .data = &stack_tracer_enabled,
1922 .maxlen = sizeof(int),
1924 .proc_handler = stack_trace_sysctl,
1927 #ifdef CONFIG_TRACING
1929 .procname = "ftrace_dump_on_oops",
1930 .data = &ftrace_dump_on_oops,
1931 .maxlen = sizeof(int),
1933 .proc_handler = proc_dointvec,
1936 .procname = "traceoff_on_warning",
1937 .data = &__disable_trace_on_warning,
1938 .maxlen = sizeof(__disable_trace_on_warning),
1940 .proc_handler = proc_dointvec,
1943 .procname = "tracepoint_printk",
1944 .data = &tracepoint_printk,
1945 .maxlen = sizeof(tracepoint_printk),
1947 .proc_handler = tracepoint_printk_sysctl,
1950 #ifdef CONFIG_KEXEC_CORE
1952 .procname = "kexec_load_disabled",
1953 .data = &kexec_load_disabled,
1954 .maxlen = sizeof(int),
1956 /* only handle a transition from default "0" to "1" */
1957 .proc_handler = proc_dointvec_minmax,
1958 .extra1 = SYSCTL_ONE,
1959 .extra2 = SYSCTL_ONE,
1962 #ifdef CONFIG_MODULES
1964 .procname = "modprobe",
1965 .data = &modprobe_path,
1966 .maxlen = KMOD_PATH_LEN,
1968 .proc_handler = proc_dostring,
1971 .procname = "modules_disabled",
1972 .data = &modules_disabled,
1973 .maxlen = sizeof(int),
1975 /* only handle a transition from default "0" to "1" */
1976 .proc_handler = proc_dointvec_minmax,
1977 .extra1 = SYSCTL_ONE,
1978 .extra2 = SYSCTL_ONE,
1981 #ifdef CONFIG_UEVENT_HELPER
1983 .procname = "hotplug",
1984 .data = &uevent_helper,
1985 .maxlen = UEVENT_HELPER_PATH_LEN,
1987 .proc_handler = proc_dostring,
1990 #ifdef CONFIG_BSD_PROCESS_ACCT
1994 .maxlen = 3*sizeof(int),
1996 .proc_handler = proc_dointvec,
1999 #ifdef CONFIG_MAGIC_SYSRQ
2001 .procname = "sysrq",
2003 .maxlen = sizeof (int),
2005 .proc_handler = sysrq_sysctl_handler,
2008 #ifdef CONFIG_PROC_SYSCTL
2010 .procname = "cad_pid",
2012 .maxlen = sizeof (int),
2014 .proc_handler = proc_do_cad_pid,
2018 .procname = "threads-max",
2020 .maxlen = sizeof(int),
2022 .proc_handler = sysctl_max_threads,
2025 .procname = "usermodehelper",
2027 .child = usermodehelper_table,
2030 .procname = "overflowuid",
2031 .data = &overflowuid,
2032 .maxlen = sizeof(int),
2034 .proc_handler = proc_dointvec_minmax,
2035 .extra1 = SYSCTL_ZERO,
2036 .extra2 = SYSCTL_MAXOLDUID,
2039 .procname = "overflowgid",
2040 .data = &overflowgid,
2041 .maxlen = sizeof(int),
2043 .proc_handler = proc_dointvec_minmax,
2044 .extra1 = SYSCTL_ZERO,
2045 .extra2 = SYSCTL_MAXOLDUID,
2049 .procname = "userprocess_debug",
2050 .data = &show_unhandled_signals,
2051 .maxlen = sizeof(int),
2053 .proc_handler = proc_dointvec,
2058 .procname = "oops_all_cpu_backtrace",
2059 .data = &sysctl_oops_all_cpu_backtrace,
2060 .maxlen = sizeof(int),
2062 .proc_handler = proc_dointvec_minmax,
2063 .extra1 = SYSCTL_ZERO,
2064 .extra2 = SYSCTL_ONE,
2066 #endif /* CONFIG_SMP */
2068 .procname = "pid_max",
2070 .maxlen = sizeof (int),
2072 .proc_handler = proc_dointvec_minmax,
2073 .extra1 = &pid_max_min,
2074 .extra2 = &pid_max_max,
2077 .procname = "panic_on_oops",
2078 .data = &panic_on_oops,
2079 .maxlen = sizeof(int),
2081 .proc_handler = proc_dointvec,
2084 .procname = "panic_print",
2085 .data = &panic_print,
2086 .maxlen = sizeof(unsigned long),
2088 .proc_handler = proc_doulongvec_minmax,
2091 .procname = "ngroups_max",
2092 .data = (void *)&ngroups_max,
2093 .maxlen = sizeof (int),
2095 .proc_handler = proc_dointvec,
2098 .procname = "cap_last_cap",
2099 .data = (void *)&cap_last_cap,
2100 .maxlen = sizeof(int),
2102 .proc_handler = proc_dointvec,
2104 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
2106 .procname = "unknown_nmi_panic",
2107 .data = &unknown_nmi_panic,
2108 .maxlen = sizeof (int),
2110 .proc_handler = proc_dointvec,
2114 #if (defined(CONFIG_X86_32) || defined(CONFIG_PARISC)) && \
2115 defined(CONFIG_DEBUG_STACKOVERFLOW)
2117 .procname = "panic_on_stackoverflow",
2118 .data = &sysctl_panic_on_stackoverflow,
2119 .maxlen = sizeof(int),
2121 .proc_handler = proc_dointvec,
2124 #if defined(CONFIG_X86)
2126 .procname = "panic_on_unrecovered_nmi",
2127 .data = &panic_on_unrecovered_nmi,
2128 .maxlen = sizeof(int),
2130 .proc_handler = proc_dointvec,
2133 .procname = "panic_on_io_nmi",
2134 .data = &panic_on_io_nmi,
2135 .maxlen = sizeof(int),
2137 .proc_handler = proc_dointvec,
2140 .procname = "bootloader_type",
2141 .data = &bootloader_type,
2142 .maxlen = sizeof (int),
2144 .proc_handler = proc_dointvec,
2147 .procname = "bootloader_version",
2148 .data = &bootloader_version,
2149 .maxlen = sizeof (int),
2151 .proc_handler = proc_dointvec,
2154 .procname = "io_delay_type",
2155 .data = &io_delay_type,
2156 .maxlen = sizeof(int),
2158 .proc_handler = proc_dointvec,
2161 #if defined(CONFIG_MMU)
2163 .procname = "randomize_va_space",
2164 .data = &randomize_va_space,
2165 .maxlen = sizeof(int),
2167 .proc_handler = proc_dointvec,
2170 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
2172 .procname = "spin_retry",
2173 .data = &spin_retry,
2174 .maxlen = sizeof (int),
2176 .proc_handler = proc_dointvec,
2179 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
2181 .procname = "acpi_video_flags",
2182 .data = &acpi_realmode_flags,
2183 .maxlen = sizeof (unsigned long),
2185 .proc_handler = proc_doulongvec_minmax,
2188 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
2190 .procname = "ignore-unaligned-usertrap",
2191 .data = &no_unaligned_warning,
2192 .maxlen = sizeof (int),
2194 .proc_handler = proc_dointvec,
2199 .procname = "unaligned-dump-stack",
2200 .data = &unaligned_dump_stack,
2201 .maxlen = sizeof (int),
2203 .proc_handler = proc_dointvec,
2206 #ifdef CONFIG_RT_MUTEXES
2208 .procname = "max_lock_depth",
2209 .data = &max_lock_depth,
2210 .maxlen = sizeof(int),
2212 .proc_handler = proc_dointvec,
2216 .procname = "poweroff_cmd",
2217 .data = &poweroff_cmd,
2218 .maxlen = POWEROFF_CMD_PATH_LEN,
2220 .proc_handler = proc_dostring,
2226 .child = key_sysctls,
2229 #ifdef CONFIG_PERF_EVENTS
2231 * User-space scripts rely on the existence of this file
2232 * as a feature check for perf_events being enabled.
2234 * So it's an ABI, do not remove!
2237 .procname = "perf_event_paranoid",
2238 .data = &sysctl_perf_event_paranoid,
2239 .maxlen = sizeof(sysctl_perf_event_paranoid),
2241 .proc_handler = proc_dointvec,
2244 .procname = "perf_event_mlock_kb",
2245 .data = &sysctl_perf_event_mlock,
2246 .maxlen = sizeof(sysctl_perf_event_mlock),
2248 .proc_handler = proc_dointvec,
2251 .procname = "perf_event_max_sample_rate",
2252 .data = &sysctl_perf_event_sample_rate,
2253 .maxlen = sizeof(sysctl_perf_event_sample_rate),
2255 .proc_handler = perf_proc_update_handler,
2256 .extra1 = SYSCTL_ONE,
2259 .procname = "perf_cpu_time_max_percent",
2260 .data = &sysctl_perf_cpu_time_max_percent,
2261 .maxlen = sizeof(sysctl_perf_cpu_time_max_percent),
2263 .proc_handler = perf_cpu_time_max_percent_handler,
2264 .extra1 = SYSCTL_ZERO,
2265 .extra2 = SYSCTL_ONE_HUNDRED,
2268 .procname = "perf_event_max_stack",
2269 .data = &sysctl_perf_event_max_stack,
2270 .maxlen = sizeof(sysctl_perf_event_max_stack),
2272 .proc_handler = perf_event_max_stack_handler,
2273 .extra1 = SYSCTL_ZERO,
2274 .extra2 = (void *)&six_hundred_forty_kb,
2277 .procname = "perf_event_max_contexts_per_stack",
2278 .data = &sysctl_perf_event_max_contexts_per_stack,
2279 .maxlen = sizeof(sysctl_perf_event_max_contexts_per_stack),
2281 .proc_handler = perf_event_max_stack_handler,
2282 .extra1 = SYSCTL_ZERO,
2283 .extra2 = SYSCTL_ONE_THOUSAND,
2287 .procname = "panic_on_warn",
2288 .data = &panic_on_warn,
2289 .maxlen = sizeof(int),
2291 .proc_handler = proc_dointvec_minmax,
2292 .extra1 = SYSCTL_ZERO,
2293 .extra2 = SYSCTL_ONE,
2295 #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
2297 .procname = "timer_migration",
2298 .data = &sysctl_timer_migration,
2299 .maxlen = sizeof(unsigned int),
2301 .proc_handler = timer_migration_handler,
2302 .extra1 = SYSCTL_ZERO,
2303 .extra2 = SYSCTL_ONE,
2306 #ifdef CONFIG_BPF_SYSCALL
2308 .procname = "unprivileged_bpf_disabled",
2309 .data = &sysctl_unprivileged_bpf_disabled,
2310 .maxlen = sizeof(sysctl_unprivileged_bpf_disabled),
2312 .proc_handler = bpf_unpriv_handler,
2313 .extra1 = SYSCTL_ZERO,
2314 .extra2 = SYSCTL_TWO,
2317 .procname = "bpf_stats_enabled",
2318 .data = &bpf_stats_enabled_key.key,
2319 .maxlen = sizeof(bpf_stats_enabled_key),
2321 .proc_handler = bpf_stats_handler,
2324 #if defined(CONFIG_TREE_RCU)
2326 .procname = "panic_on_rcu_stall",
2327 .data = &sysctl_panic_on_rcu_stall,
2328 .maxlen = sizeof(sysctl_panic_on_rcu_stall),
2330 .proc_handler = proc_dointvec_minmax,
2331 .extra1 = SYSCTL_ZERO,
2332 .extra2 = SYSCTL_ONE,
2335 #if defined(CONFIG_TREE_RCU)
2337 .procname = "max_rcu_stall_to_panic",
2338 .data = &sysctl_max_rcu_stall_to_panic,
2339 .maxlen = sizeof(sysctl_max_rcu_stall_to_panic),
2341 .proc_handler = proc_dointvec_minmax,
2342 .extra1 = SYSCTL_ONE,
2343 .extra2 = SYSCTL_INT_MAX,
2349 static struct ctl_table vm_table[] = {
2351 .procname = "overcommit_memory",
2352 .data = &sysctl_overcommit_memory,
2353 .maxlen = sizeof(sysctl_overcommit_memory),
2355 .proc_handler = overcommit_policy_handler,
2356 .extra1 = SYSCTL_ZERO,
2357 .extra2 = SYSCTL_TWO,
2360 .procname = "panic_on_oom",
2361 .data = &sysctl_panic_on_oom,
2362 .maxlen = sizeof(sysctl_panic_on_oom),
2364 .proc_handler = proc_dointvec_minmax,
2365 .extra1 = SYSCTL_ZERO,
2366 .extra2 = SYSCTL_TWO,
2369 .procname = "oom_kill_allocating_task",
2370 .data = &sysctl_oom_kill_allocating_task,
2371 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
2373 .proc_handler = proc_dointvec,
2376 .procname = "oom_dump_tasks",
2377 .data = &sysctl_oom_dump_tasks,
2378 .maxlen = sizeof(sysctl_oom_dump_tasks),
2380 .proc_handler = proc_dointvec,
2383 .procname = "overcommit_ratio",
2384 .data = &sysctl_overcommit_ratio,
2385 .maxlen = sizeof(sysctl_overcommit_ratio),
2387 .proc_handler = overcommit_ratio_handler,
2390 .procname = "overcommit_kbytes",
2391 .data = &sysctl_overcommit_kbytes,
2392 .maxlen = sizeof(sysctl_overcommit_kbytes),
2394 .proc_handler = overcommit_kbytes_handler,
2397 .procname = "page-cluster",
2398 .data = &page_cluster,
2399 .maxlen = sizeof(int),
2401 .proc_handler = proc_dointvec_minmax,
2402 .extra1 = SYSCTL_ZERO,
2405 .procname = "dirty_background_ratio",
2406 .data = &dirty_background_ratio,
2407 .maxlen = sizeof(dirty_background_ratio),
2409 .proc_handler = dirty_background_ratio_handler,
2410 .extra1 = SYSCTL_ZERO,
2411 .extra2 = SYSCTL_ONE_HUNDRED,
2414 .procname = "dirty_background_bytes",
2415 .data = &dirty_background_bytes,
2416 .maxlen = sizeof(dirty_background_bytes),
2418 .proc_handler = dirty_background_bytes_handler,
2419 .extra1 = SYSCTL_LONG_ONE,
2422 .procname = "dirty_ratio",
2423 .data = &vm_dirty_ratio,
2424 .maxlen = sizeof(vm_dirty_ratio),
2426 .proc_handler = dirty_ratio_handler,
2427 .extra1 = SYSCTL_ZERO,
2428 .extra2 = SYSCTL_ONE_HUNDRED,
2431 .procname = "dirty_bytes",
2432 .data = &vm_dirty_bytes,
2433 .maxlen = sizeof(vm_dirty_bytes),
2435 .proc_handler = dirty_bytes_handler,
2436 .extra1 = (void *)&dirty_bytes_min,
2439 .procname = "dirty_writeback_centisecs",
2440 .data = &dirty_writeback_interval,
2441 .maxlen = sizeof(dirty_writeback_interval),
2443 .proc_handler = dirty_writeback_centisecs_handler,
2446 .procname = "dirty_expire_centisecs",
2447 .data = &dirty_expire_interval,
2448 .maxlen = sizeof(dirty_expire_interval),
2450 .proc_handler = proc_dointvec_minmax,
2451 .extra1 = SYSCTL_ZERO,
2454 .procname = "dirtytime_expire_seconds",
2455 .data = &dirtytime_expire_interval,
2456 .maxlen = sizeof(dirtytime_expire_interval),
2458 .proc_handler = dirtytime_interval_handler,
2459 .extra1 = SYSCTL_ZERO,
2462 .procname = "swappiness",
2463 .data = &vm_swappiness,
2464 .maxlen = sizeof(vm_swappiness),
2466 .proc_handler = proc_dointvec_minmax,
2467 .extra1 = SYSCTL_ZERO,
2468 .extra2 = SYSCTL_TWO_HUNDRED,
2470 #ifdef CONFIG_HUGETLB_PAGE
2472 .procname = "nr_hugepages",
2474 .maxlen = sizeof(unsigned long),
2476 .proc_handler = hugetlb_sysctl_handler,
2480 .procname = "nr_hugepages_mempolicy",
2482 .maxlen = sizeof(unsigned long),
2484 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
2487 .procname = "numa_stat",
2488 .data = &sysctl_vm_numa_stat,
2489 .maxlen = sizeof(int),
2491 .proc_handler = sysctl_vm_numa_stat_handler,
2492 .extra1 = SYSCTL_ZERO,
2493 .extra2 = SYSCTL_ONE,
2497 .procname = "hugetlb_shm_group",
2498 .data = &sysctl_hugetlb_shm_group,
2499 .maxlen = sizeof(gid_t),
2501 .proc_handler = proc_dointvec,
2504 .procname = "nr_overcommit_hugepages",
2506 .maxlen = sizeof(unsigned long),
2508 .proc_handler = hugetlb_overcommit_handler,
2512 .procname = "lowmem_reserve_ratio",
2513 .data = &sysctl_lowmem_reserve_ratio,
2514 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
2516 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
2519 .procname = "drop_caches",
2520 .data = &sysctl_drop_caches,
2521 .maxlen = sizeof(int),
2523 .proc_handler = drop_caches_sysctl_handler,
2524 .extra1 = SYSCTL_ONE,
2525 .extra2 = SYSCTL_FOUR,
2527 #ifdef CONFIG_COMPACTION
2529 .procname = "compact_memory",
2531 .maxlen = sizeof(int),
2533 .proc_handler = sysctl_compaction_handler,
2536 .procname = "compaction_proactiveness",
2537 .data = &sysctl_compaction_proactiveness,
2538 .maxlen = sizeof(sysctl_compaction_proactiveness),
2540 .proc_handler = compaction_proactiveness_sysctl_handler,
2541 .extra1 = SYSCTL_ZERO,
2542 .extra2 = SYSCTL_ONE_HUNDRED,
2545 .procname = "extfrag_threshold",
2546 .data = &sysctl_extfrag_threshold,
2547 .maxlen = sizeof(int),
2549 .proc_handler = proc_dointvec_minmax,
2550 .extra1 = SYSCTL_ZERO,
2551 .extra2 = (void *)&max_extfrag_threshold,
2554 .procname = "compact_unevictable_allowed",
2555 .data = &sysctl_compact_unevictable_allowed,
2556 .maxlen = sizeof(int),
2558 .proc_handler = proc_dointvec_minmax_warn_RT_change,
2559 .extra1 = SYSCTL_ZERO,
2560 .extra2 = SYSCTL_ONE,
2563 #endif /* CONFIG_COMPACTION */
2565 .procname = "min_free_kbytes",
2566 .data = &min_free_kbytes,
2567 .maxlen = sizeof(min_free_kbytes),
2569 .proc_handler = min_free_kbytes_sysctl_handler,
2570 .extra1 = SYSCTL_ZERO,
2573 .procname = "watermark_boost_factor",
2574 .data = &watermark_boost_factor,
2575 .maxlen = sizeof(watermark_boost_factor),
2577 .proc_handler = proc_dointvec_minmax,
2578 .extra1 = SYSCTL_ZERO,
2581 .procname = "watermark_scale_factor",
2582 .data = &watermark_scale_factor,
2583 .maxlen = sizeof(watermark_scale_factor),
2585 .proc_handler = watermark_scale_factor_sysctl_handler,
2586 .extra1 = SYSCTL_ONE,
2587 .extra2 = SYSCTL_THREE_THOUSAND,
2590 .procname = "percpu_pagelist_high_fraction",
2591 .data = &percpu_pagelist_high_fraction,
2592 .maxlen = sizeof(percpu_pagelist_high_fraction),
2594 .proc_handler = percpu_pagelist_high_fraction_sysctl_handler,
2595 .extra1 = SYSCTL_ZERO,
2598 .procname = "page_lock_unfairness",
2599 .data = &sysctl_page_lock_unfairness,
2600 .maxlen = sizeof(sysctl_page_lock_unfairness),
2602 .proc_handler = proc_dointvec_minmax,
2603 .extra1 = SYSCTL_ZERO,
2607 .procname = "max_map_count",
2608 .data = &sysctl_max_map_count,
2609 .maxlen = sizeof(sysctl_max_map_count),
2611 .proc_handler = proc_dointvec_minmax,
2612 .extra1 = SYSCTL_ZERO,
2616 .procname = "nr_trim_pages",
2617 .data = &sysctl_nr_trim_pages,
2618 .maxlen = sizeof(sysctl_nr_trim_pages),
2620 .proc_handler = proc_dointvec_minmax,
2621 .extra1 = SYSCTL_ZERO,
2625 .procname = "laptop_mode",
2626 .data = &laptop_mode,
2627 .maxlen = sizeof(laptop_mode),
2629 .proc_handler = proc_dointvec_jiffies,
2632 .procname = "vfs_cache_pressure",
2633 .data = &sysctl_vfs_cache_pressure,
2634 .maxlen = sizeof(sysctl_vfs_cache_pressure),
2636 .proc_handler = proc_dointvec_minmax,
2637 .extra1 = SYSCTL_ZERO,
2639 #if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \
2640 defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT)
2642 .procname = "legacy_va_layout",
2643 .data = &sysctl_legacy_va_layout,
2644 .maxlen = sizeof(sysctl_legacy_va_layout),
2646 .proc_handler = proc_dointvec_minmax,
2647 .extra1 = SYSCTL_ZERO,
2652 .procname = "zone_reclaim_mode",
2653 .data = &node_reclaim_mode,
2654 .maxlen = sizeof(node_reclaim_mode),
2656 .proc_handler = proc_dointvec_minmax,
2657 .extra1 = SYSCTL_ZERO,
2660 .procname = "min_unmapped_ratio",
2661 .data = &sysctl_min_unmapped_ratio,
2662 .maxlen = sizeof(sysctl_min_unmapped_ratio),
2664 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
2665 .extra1 = SYSCTL_ZERO,
2666 .extra2 = SYSCTL_ONE_HUNDRED,
2669 .procname = "min_slab_ratio",
2670 .data = &sysctl_min_slab_ratio,
2671 .maxlen = sizeof(sysctl_min_slab_ratio),
2673 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
2674 .extra1 = SYSCTL_ZERO,
2675 .extra2 = SYSCTL_ONE_HUNDRED,
2680 .procname = "stat_interval",
2681 .data = &sysctl_stat_interval,
2682 .maxlen = sizeof(sysctl_stat_interval),
2684 .proc_handler = proc_dointvec_jiffies,
2687 .procname = "stat_refresh",
2691 .proc_handler = vmstat_refresh,
2696 .procname = "mmap_min_addr",
2697 .data = &dac_mmap_min_addr,
2698 .maxlen = sizeof(unsigned long),
2700 .proc_handler = mmap_min_addr_handler,
2705 .procname = "numa_zonelist_order",
2706 .data = &numa_zonelist_order,
2707 .maxlen = NUMA_ZONELIST_ORDER_LEN,
2709 .proc_handler = numa_zonelist_order_handler,
2712 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
2713 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
2715 .procname = "vdso_enabled",
2716 #ifdef CONFIG_X86_32
2717 .data = &vdso32_enabled,
2718 .maxlen = sizeof(vdso32_enabled),
2720 .data = &vdso_enabled,
2721 .maxlen = sizeof(vdso_enabled),
2724 .proc_handler = proc_dointvec,
2725 .extra1 = SYSCTL_ZERO,
2728 #ifdef CONFIG_HIGHMEM
2730 .procname = "highmem_is_dirtyable",
2731 .data = &vm_highmem_is_dirtyable,
2732 .maxlen = sizeof(vm_highmem_is_dirtyable),
2734 .proc_handler = proc_dointvec_minmax,
2735 .extra1 = SYSCTL_ZERO,
2736 .extra2 = SYSCTL_ONE,
2739 #ifdef CONFIG_MEMORY_FAILURE
2741 .procname = "memory_failure_early_kill",
2742 .data = &sysctl_memory_failure_early_kill,
2743 .maxlen = sizeof(sysctl_memory_failure_early_kill),
2745 .proc_handler = proc_dointvec_minmax,
2746 .extra1 = SYSCTL_ZERO,
2747 .extra2 = SYSCTL_ONE,
2750 .procname = "memory_failure_recovery",
2751 .data = &sysctl_memory_failure_recovery,
2752 .maxlen = sizeof(sysctl_memory_failure_recovery),
2754 .proc_handler = proc_dointvec_minmax,
2755 .extra1 = SYSCTL_ZERO,
2756 .extra2 = SYSCTL_ONE,
2760 .procname = "user_reserve_kbytes",
2761 .data = &sysctl_user_reserve_kbytes,
2762 .maxlen = sizeof(sysctl_user_reserve_kbytes),
2764 .proc_handler = proc_doulongvec_minmax,
2767 .procname = "admin_reserve_kbytes",
2768 .data = &sysctl_admin_reserve_kbytes,
2769 .maxlen = sizeof(sysctl_admin_reserve_kbytes),
2771 .proc_handler = proc_doulongvec_minmax,
2773 #ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
2775 .procname = "mmap_rnd_bits",
2776 .data = &mmap_rnd_bits,
2777 .maxlen = sizeof(mmap_rnd_bits),
2779 .proc_handler = proc_dointvec_minmax,
2780 .extra1 = (void *)&mmap_rnd_bits_min,
2781 .extra2 = (void *)&mmap_rnd_bits_max,
2784 #ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS
2786 .procname = "mmap_rnd_compat_bits",
2787 .data = &mmap_rnd_compat_bits,
2788 .maxlen = sizeof(mmap_rnd_compat_bits),
2790 .proc_handler = proc_dointvec_minmax,
2791 .extra1 = (void *)&mmap_rnd_compat_bits_min,
2792 .extra2 = (void *)&mmap_rnd_compat_bits_max,
2795 #ifdef CONFIG_USERFAULTFD
2797 .procname = "unprivileged_userfaultfd",
2798 .data = &sysctl_unprivileged_userfaultfd,
2799 .maxlen = sizeof(sysctl_unprivileged_userfaultfd),
2801 .proc_handler = proc_dointvec_minmax,
2802 .extra1 = SYSCTL_ZERO,
2803 .extra2 = SYSCTL_ONE,
2809 static struct ctl_table debug_table[] = {
2810 #ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
2812 .procname = "exception-trace",
2813 .data = &show_unhandled_signals,
2814 .maxlen = sizeof(int),
2816 .proc_handler = proc_dointvec
2822 static struct ctl_table dev_table[] = {
2826 DECLARE_SYSCTL_BASE(kernel, kern_table);
2827 DECLARE_SYSCTL_BASE(vm, vm_table);
2828 DECLARE_SYSCTL_BASE(debug, debug_table);
2829 DECLARE_SYSCTL_BASE(dev, dev_table);
2831 int __init sysctl_init_bases(void)
2833 register_sysctl_base(kernel);
2834 register_sysctl_base(vm);
2835 register_sysctl_base(debug);
2836 register_sysctl_base(dev);
2840 #endif /* CONFIG_SYSCTL */
2842 * No sense putting this after each symbol definition, twice,
2843 * exception granted :-)
2845 EXPORT_SYMBOL(proc_dobool);
2846 EXPORT_SYMBOL(proc_dointvec);
2847 EXPORT_SYMBOL(proc_douintvec);
2848 EXPORT_SYMBOL(proc_dointvec_jiffies);
2849 EXPORT_SYMBOL(proc_dointvec_minmax);
2850 EXPORT_SYMBOL_GPL(proc_douintvec_minmax);
2851 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2852 EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2853 EXPORT_SYMBOL(proc_dostring);
2854 EXPORT_SYMBOL(proc_doulongvec_minmax);
2855 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
2856 EXPORT_SYMBOL(proc_do_large_bitmap);