Revert "rpmsg: core: add support to power domains for devices"
[linux-stable.git] / kernel / sysctl.c
blob069550540a39256cf300a515966097997fdcdfd5
1 /*
2 * sysctl.c: General linux system control interface
4 * Begun 24 March 1995, Stephen Tweedie
5 * Added /proc support, Dec 1995
6 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
7 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
8 * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
9 * Dynamic registration fixes, Stephen Tweedie.
10 * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
11 * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
12 * Horn.
13 * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
14 * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
15 * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
16 * Wendling.
17 * The list_for_each() macro wasn't appropriate for the sysctl loop.
18 * Removed it and replaced it with older style, 03/23/00, Bill Wendling
21 #include <linux/module.h>
22 #include <linux/aio.h>
23 #include <linux/mm.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/printk.h>
30 #include <linux/proc_fs.h>
31 #include <linux/security.h>
32 #include <linux/ctype.h>
33 #include <linux/kmemleak.h>
34 #include <linux/fs.h>
35 #include <linux/init.h>
36 #include <linux/kernel.h>
37 #include <linux/kobject.h>
38 #include <linux/net.h>
39 #include <linux/sysrq.h>
40 #include <linux/highuid.h>
41 #include <linux/writeback.h>
42 #include <linux/ratelimit.h>
43 #include <linux/compaction.h>
44 #include <linux/hugetlb.h>
45 #include <linux/initrd.h>
46 #include <linux/key.h>
47 #include <linux/times.h>
48 #include <linux/limits.h>
49 #include <linux/dcache.h>
50 #include <linux/dnotify.h>
51 #include <linux/syscalls.h>
52 #include <linux/vmstat.h>
53 #include <linux/nfs_fs.h>
54 #include <linux/acpi.h>
55 #include <linux/reboot.h>
56 #include <linux/ftrace.h>
57 #include <linux/perf_event.h>
58 #include <linux/kprobes.h>
59 #include <linux/pipe_fs_i.h>
60 #include <linux/oom.h>
61 #include <linux/kmod.h>
62 #include <linux/capability.h>
63 #include <linux/binfmts.h>
64 #include <linux/sched/sysctl.h>
65 #include <linux/sched/coredump.h>
66 #include <linux/kexec.h>
67 #include <linux/bpf.h>
68 #include <linux/mount.h>
70 #include <linux/uaccess.h>
71 #include <asm/processor.h>
73 #ifdef CONFIG_X86
74 #include <asm/nmi.h>
75 #include <asm/stacktrace.h>
76 #include <asm/io.h>
77 #endif
78 #ifdef CONFIG_SPARC
79 #include <asm/setup.h>
80 #endif
81 #ifdef CONFIG_BSD_PROCESS_ACCT
82 #include <linux/acct.h>
83 #endif
84 #ifdef CONFIG_RT_MUTEXES
85 #include <linux/rtmutex.h>
86 #endif
87 #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
88 #include <linux/lockdep.h>
89 #endif
90 #ifdef CONFIG_CHR_DEV_SG
91 #include <scsi/sg.h>
92 #endif
94 #ifdef CONFIG_LOCKUP_DETECTOR
95 #include <linux/nmi.h>
96 #endif
98 #if defined(CONFIG_SYSCTL)
100 /* External variables not in a header file. */
101 extern int suid_dumpable;
102 #ifdef CONFIG_COREDUMP
103 extern int core_uses_pid;
104 extern char core_pattern[];
105 extern unsigned int core_pipe_limit;
106 #endif
107 extern int pid_max;
108 extern int pid_max_min, pid_max_max;
109 extern int percpu_pagelist_fraction;
110 extern int latencytop_enabled;
111 extern unsigned int sysctl_nr_open_min, sysctl_nr_open_max;
112 #ifndef CONFIG_MMU
113 extern int sysctl_nr_trim_pages;
114 #endif
116 /* Constants used for minimum and maximum */
117 #ifdef CONFIG_LOCKUP_DETECTOR
118 static int sixty = 60;
119 #endif
121 static int __maybe_unused neg_one = -1;
123 static int zero;
124 static int __maybe_unused one = 1;
125 static int __maybe_unused two = 2;
126 static int __maybe_unused four = 4;
127 static unsigned long one_ul = 1;
128 static int one_hundred = 100;
129 static int one_thousand = 1000;
130 #ifdef CONFIG_PRINTK
131 static int ten_thousand = 10000;
132 #endif
133 #ifdef CONFIG_PERF_EVENTS
134 static int six_hundred_forty_kb = 640 * 1024;
135 #endif
137 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
138 static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
140 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
141 static int maxolduid = 65535;
142 static int minolduid;
144 static int ngroups_max = NGROUPS_MAX;
145 static const int cap_last_cap = CAP_LAST_CAP;
147 /*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */
148 #ifdef CONFIG_DETECT_HUNG_TASK
149 static unsigned long hung_task_timeout_max = (LONG_MAX/HZ);
150 #endif
152 #ifdef CONFIG_INOTIFY_USER
153 #include <linux/inotify.h>
154 #endif
155 #ifdef CONFIG_SPARC
156 #endif
158 #ifdef __hppa__
159 extern int pwrsw_enabled;
160 #endif
162 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
163 extern int unaligned_enabled;
164 #endif
166 #ifdef CONFIG_IA64
167 extern int unaligned_dump_stack;
168 #endif
170 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
171 extern int no_unaligned_warning;
172 #endif
174 #ifdef CONFIG_PROC_SYSCTL
177 * enum sysctl_writes_mode - supported sysctl write modes
179 * @SYSCTL_WRITES_LEGACY: each write syscall must fully contain the sysctl value
180 * to be written, and multiple writes on the same sysctl file descriptor
181 * will rewrite the sysctl value, regardless of file position. No warning
182 * is issued when the initial position is not 0.
183 * @SYSCTL_WRITES_WARN: same as above but warn when the initial file position is
184 * not 0.
185 * @SYSCTL_WRITES_STRICT: writes to numeric sysctl entries must always be at
186 * file position 0 and the value must be fully contained in the buffer
187 * sent to the write syscall. If dealing with strings respect the file
188 * position, but restrict this to the max length of the buffer, anything
189 * passed the max lenght will be ignored. Multiple writes will append
190 * to the buffer.
192 * These write modes control how current file position affects the behavior of
193 * updating sysctl values through the proc interface on each write.
195 enum sysctl_writes_mode {
196 SYSCTL_WRITES_LEGACY = -1,
197 SYSCTL_WRITES_WARN = 0,
198 SYSCTL_WRITES_STRICT = 1,
201 static enum sysctl_writes_mode sysctl_writes_strict = SYSCTL_WRITES_STRICT;
203 static int proc_do_cad_pid(struct ctl_table *table, int write,
204 void __user *buffer, size_t *lenp, loff_t *ppos);
205 static int proc_taint(struct ctl_table *table, int write,
206 void __user *buffer, size_t *lenp, loff_t *ppos);
207 #endif
209 #ifdef CONFIG_PRINTK
210 static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
211 void __user *buffer, size_t *lenp, loff_t *ppos);
212 #endif
214 static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
215 void __user *buffer, size_t *lenp, loff_t *ppos);
216 #ifdef CONFIG_COREDUMP
217 static int proc_dostring_coredump(struct ctl_table *table, int write,
218 void __user *buffer, size_t *lenp, loff_t *ppos);
219 #endif
221 #ifdef CONFIG_MAGIC_SYSRQ
222 /* Note: sysrq code uses it's own private copy */
223 static int __sysrq_enabled = CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE;
225 static int sysrq_sysctl_handler(struct ctl_table *table, int write,
226 void __user *buffer, size_t *lenp,
227 loff_t *ppos)
229 int error;
231 error = proc_dointvec(table, write, buffer, lenp, ppos);
232 if (error)
233 return error;
235 if (write)
236 sysrq_toggle_support(__sysrq_enabled);
238 return 0;
241 #endif
243 static struct ctl_table kern_table[];
244 static struct ctl_table vm_table[];
245 static struct ctl_table fs_table[];
246 static struct ctl_table debug_table[];
247 static struct ctl_table dev_table[];
248 extern struct ctl_table random_table[];
249 #ifdef CONFIG_EPOLL
250 extern struct ctl_table epoll_table[];
251 #endif
253 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
254 int sysctl_legacy_va_layout;
255 #endif
257 /* The default sysctl tables: */
259 static struct ctl_table sysctl_base_table[] = {
261 .procname = "kernel",
262 .mode = 0555,
263 .child = kern_table,
266 .procname = "vm",
267 .mode = 0555,
268 .child = vm_table,
271 .procname = "fs",
272 .mode = 0555,
273 .child = fs_table,
276 .procname = "debug",
277 .mode = 0555,
278 .child = debug_table,
281 .procname = "dev",
282 .mode = 0555,
283 .child = dev_table,
288 #ifdef CONFIG_SCHED_DEBUG
289 static int min_sched_granularity_ns = 100000; /* 100 usecs */
290 static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
291 static int min_wakeup_granularity_ns; /* 0 usecs */
292 static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
293 #ifdef CONFIG_SMP
294 static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
295 static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
296 #endif /* CONFIG_SMP */
297 #endif /* CONFIG_SCHED_DEBUG */
299 #ifdef CONFIG_COMPACTION
300 static int min_extfrag_threshold;
301 static int max_extfrag_threshold = 1000;
302 #endif
304 static struct ctl_table kern_table[] = {
306 .procname = "sched_child_runs_first",
307 .data = &sysctl_sched_child_runs_first,
308 .maxlen = sizeof(unsigned int),
309 .mode = 0644,
310 .proc_handler = proc_dointvec,
312 #ifdef CONFIG_SCHED_DEBUG
314 .procname = "sched_min_granularity_ns",
315 .data = &sysctl_sched_min_granularity,
316 .maxlen = sizeof(unsigned int),
317 .mode = 0644,
318 .proc_handler = sched_proc_update_handler,
319 .extra1 = &min_sched_granularity_ns,
320 .extra2 = &max_sched_granularity_ns,
323 .procname = "sched_latency_ns",
324 .data = &sysctl_sched_latency,
325 .maxlen = sizeof(unsigned int),
326 .mode = 0644,
327 .proc_handler = sched_proc_update_handler,
328 .extra1 = &min_sched_granularity_ns,
329 .extra2 = &max_sched_granularity_ns,
332 .procname = "sched_wakeup_granularity_ns",
333 .data = &sysctl_sched_wakeup_granularity,
334 .maxlen = sizeof(unsigned int),
335 .mode = 0644,
336 .proc_handler = sched_proc_update_handler,
337 .extra1 = &min_wakeup_granularity_ns,
338 .extra2 = &max_wakeup_granularity_ns,
340 #ifdef CONFIG_SMP
342 .procname = "sched_tunable_scaling",
343 .data = &sysctl_sched_tunable_scaling,
344 .maxlen = sizeof(enum sched_tunable_scaling),
345 .mode = 0644,
346 .proc_handler = sched_proc_update_handler,
347 .extra1 = &min_sched_tunable_scaling,
348 .extra2 = &max_sched_tunable_scaling,
351 .procname = "sched_migration_cost_ns",
352 .data = &sysctl_sched_migration_cost,
353 .maxlen = sizeof(unsigned int),
354 .mode = 0644,
355 .proc_handler = proc_dointvec,
358 .procname = "sched_nr_migrate",
359 .data = &sysctl_sched_nr_migrate,
360 .maxlen = sizeof(unsigned int),
361 .mode = 0644,
362 .proc_handler = proc_dointvec,
365 .procname = "sched_time_avg_ms",
366 .data = &sysctl_sched_time_avg,
367 .maxlen = sizeof(unsigned int),
368 .mode = 0644,
369 .proc_handler = proc_dointvec_minmax,
370 .extra1 = &one,
372 #ifdef CONFIG_SCHEDSTATS
374 .procname = "sched_schedstats",
375 .data = NULL,
376 .maxlen = sizeof(unsigned int),
377 .mode = 0644,
378 .proc_handler = sysctl_schedstats,
379 .extra1 = &zero,
380 .extra2 = &one,
382 #endif /* CONFIG_SCHEDSTATS */
383 #endif /* CONFIG_SMP */
384 #ifdef CONFIG_NUMA_BALANCING
386 .procname = "numa_balancing_scan_delay_ms",
387 .data = &sysctl_numa_balancing_scan_delay,
388 .maxlen = sizeof(unsigned int),
389 .mode = 0644,
390 .proc_handler = proc_dointvec,
393 .procname = "numa_balancing_scan_period_min_ms",
394 .data = &sysctl_numa_balancing_scan_period_min,
395 .maxlen = sizeof(unsigned int),
396 .mode = 0644,
397 .proc_handler = proc_dointvec,
400 .procname = "numa_balancing_scan_period_max_ms",
401 .data = &sysctl_numa_balancing_scan_period_max,
402 .maxlen = sizeof(unsigned int),
403 .mode = 0644,
404 .proc_handler = proc_dointvec,
407 .procname = "numa_balancing_scan_size_mb",
408 .data = &sysctl_numa_balancing_scan_size,
409 .maxlen = sizeof(unsigned int),
410 .mode = 0644,
411 .proc_handler = proc_dointvec_minmax,
412 .extra1 = &one,
415 .procname = "numa_balancing",
416 .data = NULL, /* filled in by handler */
417 .maxlen = sizeof(unsigned int),
418 .mode = 0644,
419 .proc_handler = sysctl_numa_balancing,
420 .extra1 = &zero,
421 .extra2 = &one,
423 #endif /* CONFIG_NUMA_BALANCING */
424 #endif /* CONFIG_SCHED_DEBUG */
426 .procname = "sched_rt_period_us",
427 .data = &sysctl_sched_rt_period,
428 .maxlen = sizeof(unsigned int),
429 .mode = 0644,
430 .proc_handler = sched_rt_handler,
433 .procname = "sched_rt_runtime_us",
434 .data = &sysctl_sched_rt_runtime,
435 .maxlen = sizeof(int),
436 .mode = 0644,
437 .proc_handler = sched_rt_handler,
440 .procname = "sched_rr_timeslice_ms",
441 .data = &sysctl_sched_rr_timeslice,
442 .maxlen = sizeof(int),
443 .mode = 0644,
444 .proc_handler = sched_rr_handler,
446 #ifdef CONFIG_SCHED_AUTOGROUP
448 .procname = "sched_autogroup_enabled",
449 .data = &sysctl_sched_autogroup_enabled,
450 .maxlen = sizeof(unsigned int),
451 .mode = 0644,
452 .proc_handler = proc_dointvec_minmax,
453 .extra1 = &zero,
454 .extra2 = &one,
456 #endif
457 #ifdef CONFIG_CFS_BANDWIDTH
459 .procname = "sched_cfs_bandwidth_slice_us",
460 .data = &sysctl_sched_cfs_bandwidth_slice,
461 .maxlen = sizeof(unsigned int),
462 .mode = 0644,
463 .proc_handler = proc_dointvec_minmax,
464 .extra1 = &one,
466 #endif
467 #ifdef CONFIG_PROVE_LOCKING
469 .procname = "prove_locking",
470 .data = &prove_locking,
471 .maxlen = sizeof(int),
472 .mode = 0644,
473 .proc_handler = proc_dointvec,
475 #endif
476 #ifdef CONFIG_LOCK_STAT
478 .procname = "lock_stat",
479 .data = &lock_stat,
480 .maxlen = sizeof(int),
481 .mode = 0644,
482 .proc_handler = proc_dointvec,
484 #endif
486 .procname = "panic",
487 .data = &panic_timeout,
488 .maxlen = sizeof(int),
489 .mode = 0644,
490 .proc_handler = proc_dointvec,
492 #ifdef CONFIG_COREDUMP
494 .procname = "core_uses_pid",
495 .data = &core_uses_pid,
496 .maxlen = sizeof(int),
497 .mode = 0644,
498 .proc_handler = proc_dointvec,
501 .procname = "core_pattern",
502 .data = core_pattern,
503 .maxlen = CORENAME_MAX_SIZE,
504 .mode = 0644,
505 .proc_handler = proc_dostring_coredump,
508 .procname = "core_pipe_limit",
509 .data = &core_pipe_limit,
510 .maxlen = sizeof(unsigned int),
511 .mode = 0644,
512 .proc_handler = proc_dointvec,
514 #endif
515 #ifdef CONFIG_PROC_SYSCTL
517 .procname = "tainted",
518 .maxlen = sizeof(long),
519 .mode = 0644,
520 .proc_handler = proc_taint,
523 .procname = "sysctl_writes_strict",
524 .data = &sysctl_writes_strict,
525 .maxlen = sizeof(int),
526 .mode = 0644,
527 .proc_handler = proc_dointvec_minmax,
528 .extra1 = &neg_one,
529 .extra2 = &one,
531 #endif
532 #ifdef CONFIG_LATENCYTOP
534 .procname = "latencytop",
535 .data = &latencytop_enabled,
536 .maxlen = sizeof(int),
537 .mode = 0644,
538 .proc_handler = sysctl_latencytop,
540 #endif
541 #ifdef CONFIG_BLK_DEV_INITRD
543 .procname = "real-root-dev",
544 .data = &real_root_dev,
545 .maxlen = sizeof(int),
546 .mode = 0644,
547 .proc_handler = proc_dointvec,
549 #endif
551 .procname = "print-fatal-signals",
552 .data = &print_fatal_signals,
553 .maxlen = sizeof(int),
554 .mode = 0644,
555 .proc_handler = proc_dointvec,
557 #ifdef CONFIG_SPARC
559 .procname = "reboot-cmd",
560 .data = reboot_command,
561 .maxlen = 256,
562 .mode = 0644,
563 .proc_handler = proc_dostring,
566 .procname = "stop-a",
567 .data = &stop_a_enabled,
568 .maxlen = sizeof (int),
569 .mode = 0644,
570 .proc_handler = proc_dointvec,
573 .procname = "scons-poweroff",
574 .data = &scons_pwroff,
575 .maxlen = sizeof (int),
576 .mode = 0644,
577 .proc_handler = proc_dointvec,
579 #endif
580 #ifdef CONFIG_SPARC64
582 .procname = "tsb-ratio",
583 .data = &sysctl_tsb_ratio,
584 .maxlen = sizeof (int),
585 .mode = 0644,
586 .proc_handler = proc_dointvec,
588 #endif
589 #ifdef __hppa__
591 .procname = "soft-power",
592 .data = &pwrsw_enabled,
593 .maxlen = sizeof (int),
594 .mode = 0644,
595 .proc_handler = proc_dointvec,
597 #endif
598 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
600 .procname = "unaligned-trap",
601 .data = &unaligned_enabled,
602 .maxlen = sizeof (int),
603 .mode = 0644,
604 .proc_handler = proc_dointvec,
606 #endif
608 .procname = "ctrl-alt-del",
609 .data = &C_A_D,
610 .maxlen = sizeof(int),
611 .mode = 0644,
612 .proc_handler = proc_dointvec,
614 #ifdef CONFIG_FUNCTION_TRACER
616 .procname = "ftrace_enabled",
617 .data = &ftrace_enabled,
618 .maxlen = sizeof(int),
619 .mode = 0644,
620 .proc_handler = ftrace_enable_sysctl,
622 #endif
623 #ifdef CONFIG_STACK_TRACER
625 .procname = "stack_tracer_enabled",
626 .data = &stack_tracer_enabled,
627 .maxlen = sizeof(int),
628 .mode = 0644,
629 .proc_handler = stack_trace_sysctl,
631 #endif
632 #ifdef CONFIG_TRACING
634 .procname = "ftrace_dump_on_oops",
635 .data = &ftrace_dump_on_oops,
636 .maxlen = sizeof(int),
637 .mode = 0644,
638 .proc_handler = proc_dointvec,
641 .procname = "traceoff_on_warning",
642 .data = &__disable_trace_on_warning,
643 .maxlen = sizeof(__disable_trace_on_warning),
644 .mode = 0644,
645 .proc_handler = proc_dointvec,
648 .procname = "tracepoint_printk",
649 .data = &tracepoint_printk,
650 .maxlen = sizeof(tracepoint_printk),
651 .mode = 0644,
652 .proc_handler = tracepoint_printk_sysctl,
654 #endif
655 #ifdef CONFIG_KEXEC_CORE
657 .procname = "kexec_load_disabled",
658 .data = &kexec_load_disabled,
659 .maxlen = sizeof(int),
660 .mode = 0644,
661 /* only handle a transition from default "0" to "1" */
662 .proc_handler = proc_dointvec_minmax,
663 .extra1 = &one,
664 .extra2 = &one,
666 #endif
667 #ifdef CONFIG_MODULES
669 .procname = "modprobe",
670 .data = &modprobe_path,
671 .maxlen = KMOD_PATH_LEN,
672 .mode = 0644,
673 .proc_handler = proc_dostring,
676 .procname = "modules_disabled",
677 .data = &modules_disabled,
678 .maxlen = sizeof(int),
679 .mode = 0644,
680 /* only handle a transition from default "0" to "1" */
681 .proc_handler = proc_dointvec_minmax,
682 .extra1 = &one,
683 .extra2 = &one,
685 #endif
686 #ifdef CONFIG_UEVENT_HELPER
688 .procname = "hotplug",
689 .data = &uevent_helper,
690 .maxlen = UEVENT_HELPER_PATH_LEN,
691 .mode = 0644,
692 .proc_handler = proc_dostring,
694 #endif
695 #ifdef CONFIG_CHR_DEV_SG
697 .procname = "sg-big-buff",
698 .data = &sg_big_buff,
699 .maxlen = sizeof (int),
700 .mode = 0444,
701 .proc_handler = proc_dointvec,
703 #endif
704 #ifdef CONFIG_BSD_PROCESS_ACCT
706 .procname = "acct",
707 .data = &acct_parm,
708 .maxlen = 3*sizeof(int),
709 .mode = 0644,
710 .proc_handler = proc_dointvec,
712 #endif
713 #ifdef CONFIG_MAGIC_SYSRQ
715 .procname = "sysrq",
716 .data = &__sysrq_enabled,
717 .maxlen = sizeof (int),
718 .mode = 0644,
719 .proc_handler = sysrq_sysctl_handler,
721 #endif
722 #ifdef CONFIG_PROC_SYSCTL
724 .procname = "cad_pid",
725 .data = NULL,
726 .maxlen = sizeof (int),
727 .mode = 0600,
728 .proc_handler = proc_do_cad_pid,
730 #endif
732 .procname = "threads-max",
733 .data = NULL,
734 .maxlen = sizeof(int),
735 .mode = 0644,
736 .proc_handler = sysctl_max_threads,
739 .procname = "random",
740 .mode = 0555,
741 .child = random_table,
744 .procname = "usermodehelper",
745 .mode = 0555,
746 .child = usermodehelper_table,
749 .procname = "overflowuid",
750 .data = &overflowuid,
751 .maxlen = sizeof(int),
752 .mode = 0644,
753 .proc_handler = proc_dointvec_minmax,
754 .extra1 = &minolduid,
755 .extra2 = &maxolduid,
758 .procname = "overflowgid",
759 .data = &overflowgid,
760 .maxlen = sizeof(int),
761 .mode = 0644,
762 .proc_handler = proc_dointvec_minmax,
763 .extra1 = &minolduid,
764 .extra2 = &maxolduid,
766 #ifdef CONFIG_S390
767 #ifdef CONFIG_MATHEMU
769 .procname = "ieee_emulation_warnings",
770 .data = &sysctl_ieee_emulation_warnings,
771 .maxlen = sizeof(int),
772 .mode = 0644,
773 .proc_handler = proc_dointvec,
775 #endif
777 .procname = "userprocess_debug",
778 .data = &show_unhandled_signals,
779 .maxlen = sizeof(int),
780 .mode = 0644,
781 .proc_handler = proc_dointvec,
783 #endif
785 .procname = "pid_max",
786 .data = &pid_max,
787 .maxlen = sizeof (int),
788 .mode = 0644,
789 .proc_handler = proc_dointvec_minmax,
790 .extra1 = &pid_max_min,
791 .extra2 = &pid_max_max,
794 .procname = "panic_on_oops",
795 .data = &panic_on_oops,
796 .maxlen = sizeof(int),
797 .mode = 0644,
798 .proc_handler = proc_dointvec,
800 #if defined CONFIG_PRINTK
802 .procname = "printk",
803 .data = &console_loglevel,
804 .maxlen = 4*sizeof(int),
805 .mode = 0644,
806 .proc_handler = proc_dointvec,
809 .procname = "printk_ratelimit",
810 .data = &printk_ratelimit_state.interval,
811 .maxlen = sizeof(int),
812 .mode = 0644,
813 .proc_handler = proc_dointvec_jiffies,
816 .procname = "printk_ratelimit_burst",
817 .data = &printk_ratelimit_state.burst,
818 .maxlen = sizeof(int),
819 .mode = 0644,
820 .proc_handler = proc_dointvec,
823 .procname = "printk_delay",
824 .data = &printk_delay_msec,
825 .maxlen = sizeof(int),
826 .mode = 0644,
827 .proc_handler = proc_dointvec_minmax,
828 .extra1 = &zero,
829 .extra2 = &ten_thousand,
832 .procname = "printk_devkmsg",
833 .data = devkmsg_log_str,
834 .maxlen = DEVKMSG_STR_MAX_SIZE,
835 .mode = 0644,
836 .proc_handler = devkmsg_sysctl_set_loglvl,
839 .procname = "dmesg_restrict",
840 .data = &dmesg_restrict,
841 .maxlen = sizeof(int),
842 .mode = 0644,
843 .proc_handler = proc_dointvec_minmax_sysadmin,
844 .extra1 = &zero,
845 .extra2 = &one,
848 .procname = "kptr_restrict",
849 .data = &kptr_restrict,
850 .maxlen = sizeof(int),
851 .mode = 0644,
852 .proc_handler = proc_dointvec_minmax_sysadmin,
853 .extra1 = &zero,
854 .extra2 = &two,
856 #endif
858 .procname = "ngroups_max",
859 .data = &ngroups_max,
860 .maxlen = sizeof (int),
861 .mode = 0444,
862 .proc_handler = proc_dointvec,
865 .procname = "cap_last_cap",
866 .data = (void *)&cap_last_cap,
867 .maxlen = sizeof(int),
868 .mode = 0444,
869 .proc_handler = proc_dointvec,
871 #if defined(CONFIG_LOCKUP_DETECTOR)
873 .procname = "watchdog",
874 .data = &watchdog_user_enabled,
875 .maxlen = sizeof(int),
876 .mode = 0644,
877 .proc_handler = proc_watchdog,
878 .extra1 = &zero,
879 .extra2 = &one,
882 .procname = "watchdog_thresh",
883 .data = &watchdog_thresh,
884 .maxlen = sizeof(int),
885 .mode = 0644,
886 .proc_handler = proc_watchdog_thresh,
887 .extra1 = &zero,
888 .extra2 = &sixty,
891 .procname = "nmi_watchdog",
892 .data = &nmi_watchdog_user_enabled,
893 .maxlen = sizeof(int),
894 .mode = NMI_WATCHDOG_SYSCTL_PERM,
895 .proc_handler = proc_nmi_watchdog,
896 .extra1 = &zero,
897 .extra2 = &one,
900 .procname = "watchdog_cpumask",
901 .data = &watchdog_cpumask_bits,
902 .maxlen = NR_CPUS,
903 .mode = 0644,
904 .proc_handler = proc_watchdog_cpumask,
906 #ifdef CONFIG_SOFTLOCKUP_DETECTOR
908 .procname = "soft_watchdog",
909 .data = &soft_watchdog_user_enabled,
910 .maxlen = sizeof(int),
911 .mode = 0644,
912 .proc_handler = proc_soft_watchdog,
913 .extra1 = &zero,
914 .extra2 = &one,
917 .procname = "softlockup_panic",
918 .data = &softlockup_panic,
919 .maxlen = sizeof(int),
920 .mode = 0644,
921 .proc_handler = proc_dointvec_minmax,
922 .extra1 = &zero,
923 .extra2 = &one,
925 #ifdef CONFIG_SMP
927 .procname = "softlockup_all_cpu_backtrace",
928 .data = &sysctl_softlockup_all_cpu_backtrace,
929 .maxlen = sizeof(int),
930 .mode = 0644,
931 .proc_handler = proc_dointvec_minmax,
932 .extra1 = &zero,
933 .extra2 = &one,
935 #endif /* CONFIG_SMP */
936 #endif
937 #ifdef CONFIG_HARDLOCKUP_DETECTOR
939 .procname = "hardlockup_panic",
940 .data = &hardlockup_panic,
941 .maxlen = sizeof(int),
942 .mode = 0644,
943 .proc_handler = proc_dointvec_minmax,
944 .extra1 = &zero,
945 .extra2 = &one,
947 #ifdef CONFIG_SMP
949 .procname = "hardlockup_all_cpu_backtrace",
950 .data = &sysctl_hardlockup_all_cpu_backtrace,
951 .maxlen = sizeof(int),
952 .mode = 0644,
953 .proc_handler = proc_dointvec_minmax,
954 .extra1 = &zero,
955 .extra2 = &one,
957 #endif /* CONFIG_SMP */
958 #endif
959 #endif
961 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
963 .procname = "unknown_nmi_panic",
964 .data = &unknown_nmi_panic,
965 .maxlen = sizeof (int),
966 .mode = 0644,
967 .proc_handler = proc_dointvec,
969 #endif
970 #if defined(CONFIG_X86)
972 .procname = "panic_on_unrecovered_nmi",
973 .data = &panic_on_unrecovered_nmi,
974 .maxlen = sizeof(int),
975 .mode = 0644,
976 .proc_handler = proc_dointvec,
979 .procname = "panic_on_io_nmi",
980 .data = &panic_on_io_nmi,
981 .maxlen = sizeof(int),
982 .mode = 0644,
983 .proc_handler = proc_dointvec,
985 #ifdef CONFIG_DEBUG_STACKOVERFLOW
987 .procname = "panic_on_stackoverflow",
988 .data = &sysctl_panic_on_stackoverflow,
989 .maxlen = sizeof(int),
990 .mode = 0644,
991 .proc_handler = proc_dointvec,
993 #endif
995 .procname = "bootloader_type",
996 .data = &bootloader_type,
997 .maxlen = sizeof (int),
998 .mode = 0444,
999 .proc_handler = proc_dointvec,
1002 .procname = "bootloader_version",
1003 .data = &bootloader_version,
1004 .maxlen = sizeof (int),
1005 .mode = 0444,
1006 .proc_handler = proc_dointvec,
1009 .procname = "io_delay_type",
1010 .data = &io_delay_type,
1011 .maxlen = sizeof(int),
1012 .mode = 0644,
1013 .proc_handler = proc_dointvec,
1015 #endif
1016 #if defined(CONFIG_MMU)
1018 .procname = "randomize_va_space",
1019 .data = &randomize_va_space,
1020 .maxlen = sizeof(int),
1021 .mode = 0644,
1022 .proc_handler = proc_dointvec,
1024 #endif
1025 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
1027 .procname = "spin_retry",
1028 .data = &spin_retry,
1029 .maxlen = sizeof (int),
1030 .mode = 0644,
1031 .proc_handler = proc_dointvec,
1033 #endif
1034 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
1036 .procname = "acpi_video_flags",
1037 .data = &acpi_realmode_flags,
1038 .maxlen = sizeof (unsigned long),
1039 .mode = 0644,
1040 .proc_handler = proc_doulongvec_minmax,
1042 #endif
1043 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
1045 .procname = "ignore-unaligned-usertrap",
1046 .data = &no_unaligned_warning,
1047 .maxlen = sizeof (int),
1048 .mode = 0644,
1049 .proc_handler = proc_dointvec,
1051 #endif
1052 #ifdef CONFIG_IA64
1054 .procname = "unaligned-dump-stack",
1055 .data = &unaligned_dump_stack,
1056 .maxlen = sizeof (int),
1057 .mode = 0644,
1058 .proc_handler = proc_dointvec,
1060 #endif
1061 #ifdef CONFIG_DETECT_HUNG_TASK
1063 .procname = "hung_task_panic",
1064 .data = &sysctl_hung_task_panic,
1065 .maxlen = sizeof(int),
1066 .mode = 0644,
1067 .proc_handler = proc_dointvec_minmax,
1068 .extra1 = &zero,
1069 .extra2 = &one,
1072 .procname = "hung_task_check_count",
1073 .data = &sysctl_hung_task_check_count,
1074 .maxlen = sizeof(int),
1075 .mode = 0644,
1076 .proc_handler = proc_dointvec_minmax,
1077 .extra1 = &zero,
1080 .procname = "hung_task_timeout_secs",
1081 .data = &sysctl_hung_task_timeout_secs,
1082 .maxlen = sizeof(unsigned long),
1083 .mode = 0644,
1084 .proc_handler = proc_dohung_task_timeout_secs,
1085 .extra2 = &hung_task_timeout_max,
1088 .procname = "hung_task_warnings",
1089 .data = &sysctl_hung_task_warnings,
1090 .maxlen = sizeof(int),
1091 .mode = 0644,
1092 .proc_handler = proc_dointvec_minmax,
1093 .extra1 = &neg_one,
1095 #endif
1096 #ifdef CONFIG_RT_MUTEXES
1098 .procname = "max_lock_depth",
1099 .data = &max_lock_depth,
1100 .maxlen = sizeof(int),
1101 .mode = 0644,
1102 .proc_handler = proc_dointvec,
1104 #endif
1106 .procname = "poweroff_cmd",
1107 .data = &poweroff_cmd,
1108 .maxlen = POWEROFF_CMD_PATH_LEN,
1109 .mode = 0644,
1110 .proc_handler = proc_dostring,
1112 #ifdef CONFIG_KEYS
1114 .procname = "keys",
1115 .mode = 0555,
1116 .child = key_sysctls,
1118 #endif
1119 #ifdef CONFIG_PERF_EVENTS
1121 * User-space scripts rely on the existence of this file
1122 * as a feature check for perf_events being enabled.
1124 * So it's an ABI, do not remove!
1127 .procname = "perf_event_paranoid",
1128 .data = &sysctl_perf_event_paranoid,
1129 .maxlen = sizeof(sysctl_perf_event_paranoid),
1130 .mode = 0644,
1131 .proc_handler = proc_dointvec,
1134 .procname = "perf_event_mlock_kb",
1135 .data = &sysctl_perf_event_mlock,
1136 .maxlen = sizeof(sysctl_perf_event_mlock),
1137 .mode = 0644,
1138 .proc_handler = proc_dointvec,
1141 .procname = "perf_event_max_sample_rate",
1142 .data = &sysctl_perf_event_sample_rate,
1143 .maxlen = sizeof(sysctl_perf_event_sample_rate),
1144 .mode = 0644,
1145 .proc_handler = perf_proc_update_handler,
1146 .extra1 = &one,
1149 .procname = "perf_cpu_time_max_percent",
1150 .data = &sysctl_perf_cpu_time_max_percent,
1151 .maxlen = sizeof(sysctl_perf_cpu_time_max_percent),
1152 .mode = 0644,
1153 .proc_handler = perf_cpu_time_max_percent_handler,
1154 .extra1 = &zero,
1155 .extra2 = &one_hundred,
1158 .procname = "perf_event_max_stack",
1159 .data = &sysctl_perf_event_max_stack,
1160 .maxlen = sizeof(sysctl_perf_event_max_stack),
1161 .mode = 0644,
1162 .proc_handler = perf_event_max_stack_handler,
1163 .extra1 = &zero,
1164 .extra2 = &six_hundred_forty_kb,
1167 .procname = "perf_event_max_contexts_per_stack",
1168 .data = &sysctl_perf_event_max_contexts_per_stack,
1169 .maxlen = sizeof(sysctl_perf_event_max_contexts_per_stack),
1170 .mode = 0644,
1171 .proc_handler = perf_event_max_stack_handler,
1172 .extra1 = &zero,
1173 .extra2 = &one_thousand,
1175 #endif
1177 .procname = "panic_on_warn",
1178 .data = &panic_on_warn,
1179 .maxlen = sizeof(int),
1180 .mode = 0644,
1181 .proc_handler = proc_dointvec_minmax,
1182 .extra1 = &zero,
1183 .extra2 = &one,
1185 #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
1187 .procname = "timer_migration",
1188 .data = &sysctl_timer_migration,
1189 .maxlen = sizeof(unsigned int),
1190 .mode = 0644,
1191 .proc_handler = timer_migration_handler,
1192 .extra1 = &zero,
1193 .extra2 = &one,
1195 #endif
1196 #ifdef CONFIG_BPF_SYSCALL
1198 .procname = "unprivileged_bpf_disabled",
1199 .data = &sysctl_unprivileged_bpf_disabled,
1200 .maxlen = sizeof(sysctl_unprivileged_bpf_disabled),
1201 .mode = 0644,
1202 /* only handle a transition from default "0" to "1" */
1203 .proc_handler = proc_dointvec_minmax,
1204 .extra1 = &one,
1205 .extra2 = &one,
1207 #endif
1208 #if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU)
1210 .procname = "panic_on_rcu_stall",
1211 .data = &sysctl_panic_on_rcu_stall,
1212 .maxlen = sizeof(sysctl_panic_on_rcu_stall),
1213 .mode = 0644,
1214 .proc_handler = proc_dointvec_minmax,
1215 .extra1 = &zero,
1216 .extra2 = &one,
1218 #endif
1222 static struct ctl_table vm_table[] = {
1224 .procname = "overcommit_memory",
1225 .data = &sysctl_overcommit_memory,
1226 .maxlen = sizeof(sysctl_overcommit_memory),
1227 .mode = 0644,
1228 .proc_handler = proc_dointvec_minmax,
1229 .extra1 = &zero,
1230 .extra2 = &two,
1233 .procname = "panic_on_oom",
1234 .data = &sysctl_panic_on_oom,
1235 .maxlen = sizeof(sysctl_panic_on_oom),
1236 .mode = 0644,
1237 .proc_handler = proc_dointvec_minmax,
1238 .extra1 = &zero,
1239 .extra2 = &two,
1242 .procname = "oom_kill_allocating_task",
1243 .data = &sysctl_oom_kill_allocating_task,
1244 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1245 .mode = 0644,
1246 .proc_handler = proc_dointvec,
1249 .procname = "oom_dump_tasks",
1250 .data = &sysctl_oom_dump_tasks,
1251 .maxlen = sizeof(sysctl_oom_dump_tasks),
1252 .mode = 0644,
1253 .proc_handler = proc_dointvec,
1256 .procname = "overcommit_ratio",
1257 .data = &sysctl_overcommit_ratio,
1258 .maxlen = sizeof(sysctl_overcommit_ratio),
1259 .mode = 0644,
1260 .proc_handler = overcommit_ratio_handler,
1263 .procname = "overcommit_kbytes",
1264 .data = &sysctl_overcommit_kbytes,
1265 .maxlen = sizeof(sysctl_overcommit_kbytes),
1266 .mode = 0644,
1267 .proc_handler = overcommit_kbytes_handler,
1270 .procname = "page-cluster",
1271 .data = &page_cluster,
1272 .maxlen = sizeof(int),
1273 .mode = 0644,
1274 .proc_handler = proc_dointvec_minmax,
1275 .extra1 = &zero,
1278 .procname = "dirty_background_ratio",
1279 .data = &dirty_background_ratio,
1280 .maxlen = sizeof(dirty_background_ratio),
1281 .mode = 0644,
1282 .proc_handler = dirty_background_ratio_handler,
1283 .extra1 = &zero,
1284 .extra2 = &one_hundred,
1287 .procname = "dirty_background_bytes",
1288 .data = &dirty_background_bytes,
1289 .maxlen = sizeof(dirty_background_bytes),
1290 .mode = 0644,
1291 .proc_handler = dirty_background_bytes_handler,
1292 .extra1 = &one_ul,
1295 .procname = "dirty_ratio",
1296 .data = &vm_dirty_ratio,
1297 .maxlen = sizeof(vm_dirty_ratio),
1298 .mode = 0644,
1299 .proc_handler = dirty_ratio_handler,
1300 .extra1 = &zero,
1301 .extra2 = &one_hundred,
1304 .procname = "dirty_bytes",
1305 .data = &vm_dirty_bytes,
1306 .maxlen = sizeof(vm_dirty_bytes),
1307 .mode = 0644,
1308 .proc_handler = dirty_bytes_handler,
1309 .extra1 = &dirty_bytes_min,
1312 .procname = "dirty_writeback_centisecs",
1313 .data = &dirty_writeback_interval,
1314 .maxlen = sizeof(dirty_writeback_interval),
1315 .mode = 0644,
1316 .proc_handler = dirty_writeback_centisecs_handler,
1319 .procname = "dirty_expire_centisecs",
1320 .data = &dirty_expire_interval,
1321 .maxlen = sizeof(dirty_expire_interval),
1322 .mode = 0644,
1323 .proc_handler = proc_dointvec_minmax,
1324 .extra1 = &zero,
1327 .procname = "dirtytime_expire_seconds",
1328 .data = &dirtytime_expire_interval,
1329 .maxlen = sizeof(dirty_expire_interval),
1330 .mode = 0644,
1331 .proc_handler = dirtytime_interval_handler,
1332 .extra1 = &zero,
1335 .procname = "nr_pdflush_threads",
1336 .mode = 0444 /* read-only */,
1337 .proc_handler = pdflush_proc_obsolete,
1340 .procname = "swappiness",
1341 .data = &vm_swappiness,
1342 .maxlen = sizeof(vm_swappiness),
1343 .mode = 0644,
1344 .proc_handler = proc_dointvec_minmax,
1345 .extra1 = &zero,
1346 .extra2 = &one_hundred,
1348 #ifdef CONFIG_HUGETLB_PAGE
1350 .procname = "nr_hugepages",
1351 .data = NULL,
1352 .maxlen = sizeof(unsigned long),
1353 .mode = 0644,
1354 .proc_handler = hugetlb_sysctl_handler,
1356 #ifdef CONFIG_NUMA
1358 .procname = "nr_hugepages_mempolicy",
1359 .data = NULL,
1360 .maxlen = sizeof(unsigned long),
1361 .mode = 0644,
1362 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1364 #endif
1366 .procname = "hugetlb_shm_group",
1367 .data = &sysctl_hugetlb_shm_group,
1368 .maxlen = sizeof(gid_t),
1369 .mode = 0644,
1370 .proc_handler = proc_dointvec,
1373 .procname = "hugepages_treat_as_movable",
1374 .data = &hugepages_treat_as_movable,
1375 .maxlen = sizeof(int),
1376 .mode = 0644,
1377 .proc_handler = proc_dointvec,
1380 .procname = "nr_overcommit_hugepages",
1381 .data = NULL,
1382 .maxlen = sizeof(unsigned long),
1383 .mode = 0644,
1384 .proc_handler = hugetlb_overcommit_handler,
1386 #endif
1388 .procname = "lowmem_reserve_ratio",
1389 .data = &sysctl_lowmem_reserve_ratio,
1390 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1391 .mode = 0644,
1392 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
1395 .procname = "drop_caches",
1396 .data = &sysctl_drop_caches,
1397 .maxlen = sizeof(int),
1398 .mode = 0644,
1399 .proc_handler = drop_caches_sysctl_handler,
1400 .extra1 = &one,
1401 .extra2 = &four,
1403 #ifdef CONFIG_COMPACTION
1405 .procname = "compact_memory",
1406 .data = &sysctl_compact_memory,
1407 .maxlen = sizeof(int),
1408 .mode = 0200,
1409 .proc_handler = sysctl_compaction_handler,
1412 .procname = "extfrag_threshold",
1413 .data = &sysctl_extfrag_threshold,
1414 .maxlen = sizeof(int),
1415 .mode = 0644,
1416 .proc_handler = sysctl_extfrag_handler,
1417 .extra1 = &min_extfrag_threshold,
1418 .extra2 = &max_extfrag_threshold,
1421 .procname = "compact_unevictable_allowed",
1422 .data = &sysctl_compact_unevictable_allowed,
1423 .maxlen = sizeof(int),
1424 .mode = 0644,
1425 .proc_handler = proc_dointvec,
1426 .extra1 = &zero,
1427 .extra2 = &one,
1430 #endif /* CONFIG_COMPACTION */
1432 .procname = "min_free_kbytes",
1433 .data = &min_free_kbytes,
1434 .maxlen = sizeof(min_free_kbytes),
1435 .mode = 0644,
1436 .proc_handler = min_free_kbytes_sysctl_handler,
1437 .extra1 = &zero,
1440 .procname = "watermark_scale_factor",
1441 .data = &watermark_scale_factor,
1442 .maxlen = sizeof(watermark_scale_factor),
1443 .mode = 0644,
1444 .proc_handler = watermark_scale_factor_sysctl_handler,
1445 .extra1 = &one,
1446 .extra2 = &one_thousand,
1449 .procname = "percpu_pagelist_fraction",
1450 .data = &percpu_pagelist_fraction,
1451 .maxlen = sizeof(percpu_pagelist_fraction),
1452 .mode = 0644,
1453 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
1454 .extra1 = &zero,
1456 #ifdef CONFIG_MMU
1458 .procname = "max_map_count",
1459 .data = &sysctl_max_map_count,
1460 .maxlen = sizeof(sysctl_max_map_count),
1461 .mode = 0644,
1462 .proc_handler = proc_dointvec_minmax,
1463 .extra1 = &zero,
1465 #else
1467 .procname = "nr_trim_pages",
1468 .data = &sysctl_nr_trim_pages,
1469 .maxlen = sizeof(sysctl_nr_trim_pages),
1470 .mode = 0644,
1471 .proc_handler = proc_dointvec_minmax,
1472 .extra1 = &zero,
1474 #endif
1476 .procname = "laptop_mode",
1477 .data = &laptop_mode,
1478 .maxlen = sizeof(laptop_mode),
1479 .mode = 0644,
1480 .proc_handler = proc_dointvec_jiffies,
1483 .procname = "block_dump",
1484 .data = &block_dump,
1485 .maxlen = sizeof(block_dump),
1486 .mode = 0644,
1487 .proc_handler = proc_dointvec,
1488 .extra1 = &zero,
1491 .procname = "vfs_cache_pressure",
1492 .data = &sysctl_vfs_cache_pressure,
1493 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1494 .mode = 0644,
1495 .proc_handler = proc_dointvec,
1496 .extra1 = &zero,
1498 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1500 .procname = "legacy_va_layout",
1501 .data = &sysctl_legacy_va_layout,
1502 .maxlen = sizeof(sysctl_legacy_va_layout),
1503 .mode = 0644,
1504 .proc_handler = proc_dointvec,
1505 .extra1 = &zero,
1507 #endif
1508 #ifdef CONFIG_NUMA
1510 .procname = "zone_reclaim_mode",
1511 .data = &node_reclaim_mode,
1512 .maxlen = sizeof(node_reclaim_mode),
1513 .mode = 0644,
1514 .proc_handler = proc_dointvec,
1515 .extra1 = &zero,
1518 .procname = "min_unmapped_ratio",
1519 .data = &sysctl_min_unmapped_ratio,
1520 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1521 .mode = 0644,
1522 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
1523 .extra1 = &zero,
1524 .extra2 = &one_hundred,
1527 .procname = "min_slab_ratio",
1528 .data = &sysctl_min_slab_ratio,
1529 .maxlen = sizeof(sysctl_min_slab_ratio),
1530 .mode = 0644,
1531 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
1532 .extra1 = &zero,
1533 .extra2 = &one_hundred,
1535 #endif
1536 #ifdef CONFIG_SMP
1538 .procname = "stat_interval",
1539 .data = &sysctl_stat_interval,
1540 .maxlen = sizeof(sysctl_stat_interval),
1541 .mode = 0644,
1542 .proc_handler = proc_dointvec_jiffies,
1545 .procname = "stat_refresh",
1546 .data = NULL,
1547 .maxlen = 0,
1548 .mode = 0600,
1549 .proc_handler = vmstat_refresh,
1551 #endif
1552 #ifdef CONFIG_MMU
1554 .procname = "mmap_min_addr",
1555 .data = &dac_mmap_min_addr,
1556 .maxlen = sizeof(unsigned long),
1557 .mode = 0644,
1558 .proc_handler = mmap_min_addr_handler,
1560 #endif
1561 #ifdef CONFIG_NUMA
1563 .procname = "numa_zonelist_order",
1564 .data = &numa_zonelist_order,
1565 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1566 .mode = 0644,
1567 .proc_handler = numa_zonelist_order_handler,
1569 #endif
1570 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1571 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1573 .procname = "vdso_enabled",
1574 #ifdef CONFIG_X86_32
1575 .data = &vdso32_enabled,
1576 .maxlen = sizeof(vdso32_enabled),
1577 #else
1578 .data = &vdso_enabled,
1579 .maxlen = sizeof(vdso_enabled),
1580 #endif
1581 .mode = 0644,
1582 .proc_handler = proc_dointvec,
1583 .extra1 = &zero,
1585 #endif
1586 #ifdef CONFIG_HIGHMEM
1588 .procname = "highmem_is_dirtyable",
1589 .data = &vm_highmem_is_dirtyable,
1590 .maxlen = sizeof(vm_highmem_is_dirtyable),
1591 .mode = 0644,
1592 .proc_handler = proc_dointvec_minmax,
1593 .extra1 = &zero,
1594 .extra2 = &one,
1596 #endif
1597 #ifdef CONFIG_MEMORY_FAILURE
1599 .procname = "memory_failure_early_kill",
1600 .data = &sysctl_memory_failure_early_kill,
1601 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1602 .mode = 0644,
1603 .proc_handler = proc_dointvec_minmax,
1604 .extra1 = &zero,
1605 .extra2 = &one,
1608 .procname = "memory_failure_recovery",
1609 .data = &sysctl_memory_failure_recovery,
1610 .maxlen = sizeof(sysctl_memory_failure_recovery),
1611 .mode = 0644,
1612 .proc_handler = proc_dointvec_minmax,
1613 .extra1 = &zero,
1614 .extra2 = &one,
1616 #endif
1618 .procname = "user_reserve_kbytes",
1619 .data = &sysctl_user_reserve_kbytes,
1620 .maxlen = sizeof(sysctl_user_reserve_kbytes),
1621 .mode = 0644,
1622 .proc_handler = proc_doulongvec_minmax,
1625 .procname = "admin_reserve_kbytes",
1626 .data = &sysctl_admin_reserve_kbytes,
1627 .maxlen = sizeof(sysctl_admin_reserve_kbytes),
1628 .mode = 0644,
1629 .proc_handler = proc_doulongvec_minmax,
1631 #ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
1633 .procname = "mmap_rnd_bits",
1634 .data = &mmap_rnd_bits,
1635 .maxlen = sizeof(mmap_rnd_bits),
1636 .mode = 0600,
1637 .proc_handler = proc_dointvec_minmax,
1638 .extra1 = (void *)&mmap_rnd_bits_min,
1639 .extra2 = (void *)&mmap_rnd_bits_max,
1641 #endif
1642 #ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS
1644 .procname = "mmap_rnd_compat_bits",
1645 .data = &mmap_rnd_compat_bits,
1646 .maxlen = sizeof(mmap_rnd_compat_bits),
1647 .mode = 0600,
1648 .proc_handler = proc_dointvec_minmax,
1649 .extra1 = (void *)&mmap_rnd_compat_bits_min,
1650 .extra2 = (void *)&mmap_rnd_compat_bits_max,
1652 #endif
1656 static struct ctl_table fs_table[] = {
1658 .procname = "inode-nr",
1659 .data = &inodes_stat,
1660 .maxlen = 2*sizeof(long),
1661 .mode = 0444,
1662 .proc_handler = proc_nr_inodes,
1665 .procname = "inode-state",
1666 .data = &inodes_stat,
1667 .maxlen = 7*sizeof(long),
1668 .mode = 0444,
1669 .proc_handler = proc_nr_inodes,
1672 .procname = "file-nr",
1673 .data = &files_stat,
1674 .maxlen = sizeof(files_stat),
1675 .mode = 0444,
1676 .proc_handler = proc_nr_files,
1679 .procname = "file-max",
1680 .data = &files_stat.max_files,
1681 .maxlen = sizeof(files_stat.max_files),
1682 .mode = 0644,
1683 .proc_handler = proc_doulongvec_minmax,
1686 .procname = "nr_open",
1687 .data = &sysctl_nr_open,
1688 .maxlen = sizeof(unsigned int),
1689 .mode = 0644,
1690 .proc_handler = proc_dointvec_minmax,
1691 .extra1 = &sysctl_nr_open_min,
1692 .extra2 = &sysctl_nr_open_max,
1695 .procname = "dentry-state",
1696 .data = &dentry_stat,
1697 .maxlen = 6*sizeof(long),
1698 .mode = 0444,
1699 .proc_handler = proc_nr_dentry,
1702 .procname = "overflowuid",
1703 .data = &fs_overflowuid,
1704 .maxlen = sizeof(int),
1705 .mode = 0644,
1706 .proc_handler = proc_dointvec_minmax,
1707 .extra1 = &minolduid,
1708 .extra2 = &maxolduid,
1711 .procname = "overflowgid",
1712 .data = &fs_overflowgid,
1713 .maxlen = sizeof(int),
1714 .mode = 0644,
1715 .proc_handler = proc_dointvec_minmax,
1716 .extra1 = &minolduid,
1717 .extra2 = &maxolduid,
1719 #ifdef CONFIG_FILE_LOCKING
1721 .procname = "leases-enable",
1722 .data = &leases_enable,
1723 .maxlen = sizeof(int),
1724 .mode = 0644,
1725 .proc_handler = proc_dointvec,
1727 #endif
1728 #ifdef CONFIG_DNOTIFY
1730 .procname = "dir-notify-enable",
1731 .data = &dir_notify_enable,
1732 .maxlen = sizeof(int),
1733 .mode = 0644,
1734 .proc_handler = proc_dointvec,
1736 #endif
1737 #ifdef CONFIG_MMU
1738 #ifdef CONFIG_FILE_LOCKING
1740 .procname = "lease-break-time",
1741 .data = &lease_break_time,
1742 .maxlen = sizeof(int),
1743 .mode = 0644,
1744 .proc_handler = proc_dointvec,
1746 #endif
1747 #ifdef CONFIG_AIO
1749 .procname = "aio-nr",
1750 .data = &aio_nr,
1751 .maxlen = sizeof(aio_nr),
1752 .mode = 0444,
1753 .proc_handler = proc_doulongvec_minmax,
1756 .procname = "aio-max-nr",
1757 .data = &aio_max_nr,
1758 .maxlen = sizeof(aio_max_nr),
1759 .mode = 0644,
1760 .proc_handler = proc_doulongvec_minmax,
1762 #endif /* CONFIG_AIO */
1763 #ifdef CONFIG_INOTIFY_USER
1765 .procname = "inotify",
1766 .mode = 0555,
1767 .child = inotify_table,
1769 #endif
1770 #ifdef CONFIG_EPOLL
1772 .procname = "epoll",
1773 .mode = 0555,
1774 .child = epoll_table,
1776 #endif
1777 #endif
1779 .procname = "protected_symlinks",
1780 .data = &sysctl_protected_symlinks,
1781 .maxlen = sizeof(int),
1782 .mode = 0600,
1783 .proc_handler = proc_dointvec_minmax,
1784 .extra1 = &zero,
1785 .extra2 = &one,
1788 .procname = "protected_hardlinks",
1789 .data = &sysctl_protected_hardlinks,
1790 .maxlen = sizeof(int),
1791 .mode = 0600,
1792 .proc_handler = proc_dointvec_minmax,
1793 .extra1 = &zero,
1794 .extra2 = &one,
1797 .procname = "suid_dumpable",
1798 .data = &suid_dumpable,
1799 .maxlen = sizeof(int),
1800 .mode = 0644,
1801 .proc_handler = proc_dointvec_minmax_coredump,
1802 .extra1 = &zero,
1803 .extra2 = &two,
1805 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1807 .procname = "binfmt_misc",
1808 .mode = 0555,
1809 .child = sysctl_mount_point,
1811 #endif
1813 .procname = "pipe-max-size",
1814 .data = &pipe_max_size,
1815 .maxlen = sizeof(pipe_max_size),
1816 .mode = 0644,
1817 .proc_handler = &pipe_proc_fn,
1818 .extra1 = &pipe_min_size,
1821 .procname = "pipe-user-pages-hard",
1822 .data = &pipe_user_pages_hard,
1823 .maxlen = sizeof(pipe_user_pages_hard),
1824 .mode = 0644,
1825 .proc_handler = proc_doulongvec_minmax,
1828 .procname = "pipe-user-pages-soft",
1829 .data = &pipe_user_pages_soft,
1830 .maxlen = sizeof(pipe_user_pages_soft),
1831 .mode = 0644,
1832 .proc_handler = proc_doulongvec_minmax,
1835 .procname = "mount-max",
1836 .data = &sysctl_mount_max,
1837 .maxlen = sizeof(unsigned int),
1838 .mode = 0644,
1839 .proc_handler = proc_dointvec_minmax,
1840 .extra1 = &one,
1845 static struct ctl_table debug_table[] = {
1846 #ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
1848 .procname = "exception-trace",
1849 .data = &show_unhandled_signals,
1850 .maxlen = sizeof(int),
1851 .mode = 0644,
1852 .proc_handler = proc_dointvec
1854 #endif
1855 #if defined(CONFIG_OPTPROBES)
1857 .procname = "kprobes-optimization",
1858 .data = &sysctl_kprobes_optimization,
1859 .maxlen = sizeof(int),
1860 .mode = 0644,
1861 .proc_handler = proc_kprobes_optimization_handler,
1862 .extra1 = &zero,
1863 .extra2 = &one,
1865 #endif
1869 static struct ctl_table dev_table[] = {
1873 int __init sysctl_init(void)
1875 struct ctl_table_header *hdr;
1877 hdr = register_sysctl_table(sysctl_base_table);
1878 kmemleak_not_leak(hdr);
1879 return 0;
1882 #endif /* CONFIG_SYSCTL */
1885 * /proc/sys support
1888 #ifdef CONFIG_PROC_SYSCTL
1890 static int _proc_do_string(char *data, int maxlen, int write,
1891 char __user *buffer,
1892 size_t *lenp, loff_t *ppos)
1894 size_t len;
1895 char __user *p;
1896 char c;
1898 if (!data || !maxlen || !*lenp) {
1899 *lenp = 0;
1900 return 0;
1903 if (write) {
1904 if (sysctl_writes_strict == SYSCTL_WRITES_STRICT) {
1905 /* Only continue writes not past the end of buffer. */
1906 len = strlen(data);
1907 if (len > maxlen - 1)
1908 len = maxlen - 1;
1910 if (*ppos > len)
1911 return 0;
1912 len = *ppos;
1913 } else {
1914 /* Start writing from beginning of buffer. */
1915 len = 0;
1918 *ppos += *lenp;
1919 p = buffer;
1920 while ((p - buffer) < *lenp && len < maxlen - 1) {
1921 if (get_user(c, p++))
1922 return -EFAULT;
1923 if (c == 0 || c == '\n')
1924 break;
1925 data[len++] = c;
1927 data[len] = 0;
1928 } else {
1929 len = strlen(data);
1930 if (len > maxlen)
1931 len = maxlen;
1933 if (*ppos > len) {
1934 *lenp = 0;
1935 return 0;
1938 data += *ppos;
1939 len -= *ppos;
1941 if (len > *lenp)
1942 len = *lenp;
1943 if (len)
1944 if (copy_to_user(buffer, data, len))
1945 return -EFAULT;
1946 if (len < *lenp) {
1947 if (put_user('\n', buffer + len))
1948 return -EFAULT;
1949 len++;
1951 *lenp = len;
1952 *ppos += len;
1954 return 0;
1957 static void warn_sysctl_write(struct ctl_table *table)
1959 pr_warn_once("%s wrote to %s when file position was not 0!\n"
1960 "This will not be supported in the future. To silence this\n"
1961 "warning, set kernel.sysctl_writes_strict = -1\n",
1962 current->comm, table->procname);
1966 * proc_first_pos_non_zero_ignore - check if firs position is allowed
1967 * @ppos: file position
1968 * @table: the sysctl table
1970 * Returns true if the first position is non-zero and the sysctl_writes_strict
1971 * mode indicates this is not allowed for numeric input types. String proc
1972 * hadlers can ignore the return value.
1974 static bool proc_first_pos_non_zero_ignore(loff_t *ppos,
1975 struct ctl_table *table)
1977 if (!*ppos)
1978 return false;
1980 switch (sysctl_writes_strict) {
1981 case SYSCTL_WRITES_STRICT:
1982 return true;
1983 case SYSCTL_WRITES_WARN:
1984 warn_sysctl_write(table);
1985 return false;
1986 default:
1987 return false;
1992 * proc_dostring - read a string sysctl
1993 * @table: the sysctl table
1994 * @write: %TRUE if this is a write to the sysctl file
1995 * @buffer: the user buffer
1996 * @lenp: the size of the user buffer
1997 * @ppos: file position
1999 * Reads/writes a string from/to the user buffer. If the kernel
2000 * buffer provided is not large enough to hold the string, the
2001 * string is truncated. The copied string is %NULL-terminated.
2002 * If the string is being read by the user process, it is copied
2003 * and a newline '\n' is added. It is truncated if the buffer is
2004 * not large enough.
2006 * Returns 0 on success.
2008 int proc_dostring(struct ctl_table *table, int write,
2009 void __user *buffer, size_t *lenp, loff_t *ppos)
2011 if (write)
2012 proc_first_pos_non_zero_ignore(ppos, table);
2014 return _proc_do_string((char *)(table->data), table->maxlen, write,
2015 (char __user *)buffer, lenp, ppos);
2018 static size_t proc_skip_spaces(char **buf)
2020 size_t ret;
2021 char *tmp = skip_spaces(*buf);
2022 ret = tmp - *buf;
2023 *buf = tmp;
2024 return ret;
2027 static void proc_skip_char(char **buf, size_t *size, const char v)
2029 while (*size) {
2030 if (**buf != v)
2031 break;
2032 (*size)--;
2033 (*buf)++;
2037 #define TMPBUFLEN 22
2039 * proc_get_long - reads an ASCII formatted integer from a user buffer
2041 * @buf: a kernel buffer
2042 * @size: size of the kernel buffer
2043 * @val: this is where the number will be stored
2044 * @neg: set to %TRUE if number is negative
2045 * @perm_tr: a vector which contains the allowed trailers
2046 * @perm_tr_len: size of the perm_tr vector
2047 * @tr: pointer to store the trailer character
2049 * In case of success %0 is returned and @buf and @size are updated with
2050 * the amount of bytes read. If @tr is non-NULL and a trailing
2051 * character exists (size is non-zero after returning from this
2052 * function), @tr is updated with the trailing character.
2054 static int proc_get_long(char **buf, size_t *size,
2055 unsigned long *val, bool *neg,
2056 const char *perm_tr, unsigned perm_tr_len, char *tr)
2058 int len;
2059 char *p, tmp[TMPBUFLEN];
2061 if (!*size)
2062 return -EINVAL;
2064 len = *size;
2065 if (len > TMPBUFLEN - 1)
2066 len = TMPBUFLEN - 1;
2068 memcpy(tmp, *buf, len);
2070 tmp[len] = 0;
2071 p = tmp;
2072 if (*p == '-' && *size > 1) {
2073 *neg = true;
2074 p++;
2075 } else
2076 *neg = false;
2077 if (!isdigit(*p))
2078 return -EINVAL;
2080 *val = simple_strtoul(p, &p, 0);
2082 len = p - tmp;
2084 /* We don't know if the next char is whitespace thus we may accept
2085 * invalid integers (e.g. 1234...a) or two integers instead of one
2086 * (e.g. 123...1). So lets not allow such large numbers. */
2087 if (len == TMPBUFLEN - 1)
2088 return -EINVAL;
2090 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
2091 return -EINVAL;
2093 if (tr && (len < *size))
2094 *tr = *p;
2096 *buf += len;
2097 *size -= len;
2099 return 0;
2103 * proc_put_long - converts an integer to a decimal ASCII formatted string
2105 * @buf: the user buffer
2106 * @size: the size of the user buffer
2107 * @val: the integer to be converted
2108 * @neg: sign of the number, %TRUE for negative
2110 * In case of success %0 is returned and @buf and @size are updated with
2111 * the amount of bytes written.
2113 static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
2114 bool neg)
2116 int len;
2117 char tmp[TMPBUFLEN], *p = tmp;
2119 sprintf(p, "%s%lu", neg ? "-" : "", val);
2120 len = strlen(tmp);
2121 if (len > *size)
2122 len = *size;
2123 if (copy_to_user(*buf, tmp, len))
2124 return -EFAULT;
2125 *size -= len;
2126 *buf += len;
2127 return 0;
2129 #undef TMPBUFLEN
2131 static int proc_put_char(void __user **buf, size_t *size, char c)
2133 if (*size) {
2134 char __user **buffer = (char __user **)buf;
2135 if (put_user(c, *buffer))
2136 return -EFAULT;
2137 (*size)--, (*buffer)++;
2138 *buf = *buffer;
2140 return 0;
2143 static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
2144 int *valp,
2145 int write, void *data)
2147 if (write) {
2148 if (*negp) {
2149 if (*lvalp > (unsigned long) INT_MAX + 1)
2150 return -EINVAL;
2151 *valp = -*lvalp;
2152 } else {
2153 if (*lvalp > (unsigned long) INT_MAX)
2154 return -EINVAL;
2155 *valp = *lvalp;
2157 } else {
2158 int val = *valp;
2159 if (val < 0) {
2160 *negp = true;
2161 *lvalp = -(unsigned long)val;
2162 } else {
2163 *negp = false;
2164 *lvalp = (unsigned long)val;
2167 return 0;
2170 static int do_proc_douintvec_conv(unsigned long *lvalp,
2171 unsigned int *valp,
2172 int write, void *data)
2174 if (write) {
2175 if (*lvalp > UINT_MAX)
2176 return -EINVAL;
2177 *valp = *lvalp;
2178 } else {
2179 unsigned int val = *valp;
2180 *lvalp = (unsigned long)val;
2182 return 0;
2185 static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
2187 static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2188 int write, void __user *buffer,
2189 size_t *lenp, loff_t *ppos,
2190 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2191 int write, void *data),
2192 void *data)
2194 int *i, vleft, first = 1, err = 0;
2195 size_t left;
2196 char *kbuf = NULL, *p;
2198 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
2199 *lenp = 0;
2200 return 0;
2203 i = (int *) tbl_data;
2204 vleft = table->maxlen / sizeof(*i);
2205 left = *lenp;
2207 if (!conv)
2208 conv = do_proc_dointvec_conv;
2210 if (write) {
2211 if (proc_first_pos_non_zero_ignore(ppos, table))
2212 goto out;
2214 if (left > PAGE_SIZE - 1)
2215 left = PAGE_SIZE - 1;
2216 p = kbuf = memdup_user_nul(buffer, left);
2217 if (IS_ERR(kbuf))
2218 return PTR_ERR(kbuf);
2221 for (; left && vleft--; i++, first=0) {
2222 unsigned long lval;
2223 bool neg;
2225 if (write) {
2226 left -= proc_skip_spaces(&p);
2228 if (!left)
2229 break;
2230 err = proc_get_long(&p, &left, &lval, &neg,
2231 proc_wspace_sep,
2232 sizeof(proc_wspace_sep), NULL);
2233 if (err)
2234 break;
2235 if (conv(&neg, &lval, i, 1, data)) {
2236 err = -EINVAL;
2237 break;
2239 } else {
2240 if (conv(&neg, &lval, i, 0, data)) {
2241 err = -EINVAL;
2242 break;
2244 if (!first)
2245 err = proc_put_char(&buffer, &left, '\t');
2246 if (err)
2247 break;
2248 err = proc_put_long(&buffer, &left, lval, neg);
2249 if (err)
2250 break;
2254 if (!write && !first && left && !err)
2255 err = proc_put_char(&buffer, &left, '\n');
2256 if (write && !err && left)
2257 left -= proc_skip_spaces(&p);
2258 if (write) {
2259 kfree(kbuf);
2260 if (first)
2261 return err ? : -EINVAL;
2263 *lenp -= left;
2264 out:
2265 *ppos += *lenp;
2266 return err;
2269 static int do_proc_dointvec(struct ctl_table *table, int write,
2270 void __user *buffer, size_t *lenp, loff_t *ppos,
2271 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2272 int write, void *data),
2273 void *data)
2275 return __do_proc_dointvec(table->data, table, write,
2276 buffer, lenp, ppos, conv, data);
2279 static int do_proc_douintvec_w(unsigned int *tbl_data,
2280 struct ctl_table *table,
2281 void __user *buffer,
2282 size_t *lenp, loff_t *ppos,
2283 int (*conv)(unsigned long *lvalp,
2284 unsigned int *valp,
2285 int write, void *data),
2286 void *data)
2288 unsigned long lval;
2289 int err = 0;
2290 size_t left;
2291 bool neg;
2292 char *kbuf = NULL, *p;
2294 left = *lenp;
2296 if (proc_first_pos_non_zero_ignore(ppos, table))
2297 goto bail_early;
2299 if (left > PAGE_SIZE - 1)
2300 left = PAGE_SIZE - 1;
2302 p = kbuf = memdup_user_nul(buffer, left);
2303 if (IS_ERR(kbuf))
2304 return -EINVAL;
2306 left -= proc_skip_spaces(&p);
2307 if (!left) {
2308 err = -EINVAL;
2309 goto out_free;
2312 err = proc_get_long(&p, &left, &lval, &neg,
2313 proc_wspace_sep,
2314 sizeof(proc_wspace_sep), NULL);
2315 if (err || neg) {
2316 err = -EINVAL;
2317 goto out_free;
2320 if (conv(&lval, tbl_data, 1, data)) {
2321 err = -EINVAL;
2322 goto out_free;
2325 if (!err && left)
2326 left -= proc_skip_spaces(&p);
2328 out_free:
2329 kfree(kbuf);
2330 if (err)
2331 return -EINVAL;
2333 return 0;
2335 /* This is in keeping with old __do_proc_dointvec() */
2336 bail_early:
2337 *ppos += *lenp;
2338 return err;
2341 static int do_proc_douintvec_r(unsigned int *tbl_data, void __user *buffer,
2342 size_t *lenp, loff_t *ppos,
2343 int (*conv)(unsigned long *lvalp,
2344 unsigned int *valp,
2345 int write, void *data),
2346 void *data)
2348 unsigned long lval;
2349 int err = 0;
2350 size_t left;
2352 left = *lenp;
2354 if (conv(&lval, tbl_data, 0, data)) {
2355 err = -EINVAL;
2356 goto out;
2359 err = proc_put_long(&buffer, &left, lval, false);
2360 if (err || !left)
2361 goto out;
2363 err = proc_put_char(&buffer, &left, '\n');
2365 out:
2366 *lenp -= left;
2367 *ppos += *lenp;
2369 return err;
2372 static int __do_proc_douintvec(void *tbl_data, struct ctl_table *table,
2373 int write, void __user *buffer,
2374 size_t *lenp, loff_t *ppos,
2375 int (*conv)(unsigned long *lvalp,
2376 unsigned int *valp,
2377 int write, void *data),
2378 void *data)
2380 unsigned int *i, vleft;
2382 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
2383 *lenp = 0;
2384 return 0;
2387 i = (unsigned int *) tbl_data;
2388 vleft = table->maxlen / sizeof(*i);
2391 * Arrays are not supported, keep this simple. *Do not* add
2392 * support for them.
2394 if (vleft != 1) {
2395 *lenp = 0;
2396 return -EINVAL;
2399 if (!conv)
2400 conv = do_proc_douintvec_conv;
2402 if (write)
2403 return do_proc_douintvec_w(i, table, buffer, lenp, ppos,
2404 conv, data);
2405 return do_proc_douintvec_r(i, buffer, lenp, ppos, conv, data);
2408 static int do_proc_douintvec(struct ctl_table *table, int write,
2409 void __user *buffer, size_t *lenp, loff_t *ppos,
2410 int (*conv)(unsigned long *lvalp,
2411 unsigned int *valp,
2412 int write, void *data),
2413 void *data)
2415 return __do_proc_douintvec(table->data, table, write,
2416 buffer, lenp, ppos, conv, data);
2420 * proc_dointvec - read a vector of integers
2421 * @table: the sysctl table
2422 * @write: %TRUE if this is a write to the sysctl file
2423 * @buffer: the user buffer
2424 * @lenp: the size of the user buffer
2425 * @ppos: file position
2427 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2428 * values from/to the user buffer, treated as an ASCII string.
2430 * Returns 0 on success.
2432 int proc_dointvec(struct ctl_table *table, int write,
2433 void __user *buffer, size_t *lenp, loff_t *ppos)
2435 return do_proc_dointvec(table, write, buffer, lenp, ppos, NULL, NULL);
2439 * proc_douintvec - read a vector of unsigned integers
2440 * @table: the sysctl table
2441 * @write: %TRUE if this is a write to the sysctl file
2442 * @buffer: the user buffer
2443 * @lenp: the size of the user buffer
2444 * @ppos: file position
2446 * Reads/writes up to table->maxlen/sizeof(unsigned int) unsigned integer
2447 * values from/to the user buffer, treated as an ASCII string.
2449 * Returns 0 on success.
2451 int proc_douintvec(struct ctl_table *table, int write,
2452 void __user *buffer, size_t *lenp, loff_t *ppos)
2454 return do_proc_douintvec(table, write, buffer, lenp, ppos,
2455 do_proc_douintvec_conv, NULL);
2459 * Taint values can only be increased
2460 * This means we can safely use a temporary.
2462 static int proc_taint(struct ctl_table *table, int write,
2463 void __user *buffer, size_t *lenp, loff_t *ppos)
2465 struct ctl_table t;
2466 unsigned long tmptaint = get_taint();
2467 int err;
2469 if (write && !capable(CAP_SYS_ADMIN))
2470 return -EPERM;
2472 t = *table;
2473 t.data = &tmptaint;
2474 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
2475 if (err < 0)
2476 return err;
2478 if (write) {
2480 * Poor man's atomic or. Not worth adding a primitive
2481 * to everyone's atomic.h for this
2483 int i;
2484 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
2485 if ((tmptaint >> i) & 1)
2486 add_taint(i, LOCKDEP_STILL_OK);
2490 return err;
2493 #ifdef CONFIG_PRINTK
2494 static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
2495 void __user *buffer, size_t *lenp, loff_t *ppos)
2497 if (write && !capable(CAP_SYS_ADMIN))
2498 return -EPERM;
2500 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
2502 #endif
2504 struct do_proc_dointvec_minmax_conv_param {
2505 int *min;
2506 int *max;
2509 static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
2510 int *valp,
2511 int write, void *data)
2513 struct do_proc_dointvec_minmax_conv_param *param = data;
2514 if (write) {
2515 int val = *negp ? -*lvalp : *lvalp;
2516 if ((param->min && *param->min > val) ||
2517 (param->max && *param->max < val))
2518 return -EINVAL;
2519 *valp = val;
2520 } else {
2521 int val = *valp;
2522 if (val < 0) {
2523 *negp = true;
2524 *lvalp = -(unsigned long)val;
2525 } else {
2526 *negp = false;
2527 *lvalp = (unsigned long)val;
2530 return 0;
2534 * proc_dointvec_minmax - read a vector of integers with min/max values
2535 * @table: the sysctl table
2536 * @write: %TRUE if this is a write to the sysctl file
2537 * @buffer: the user buffer
2538 * @lenp: the size of the user buffer
2539 * @ppos: file position
2541 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2542 * values from/to the user buffer, treated as an ASCII string.
2544 * This routine will ensure the values are within the range specified by
2545 * table->extra1 (min) and table->extra2 (max).
2547 * Returns 0 on success.
2549 int proc_dointvec_minmax(struct ctl_table *table, int write,
2550 void __user *buffer, size_t *lenp, loff_t *ppos)
2552 struct do_proc_dointvec_minmax_conv_param param = {
2553 .min = (int *) table->extra1,
2554 .max = (int *) table->extra2,
2556 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2557 do_proc_dointvec_minmax_conv, &param);
2560 struct do_proc_douintvec_minmax_conv_param {
2561 unsigned int *min;
2562 unsigned int *max;
2565 static int do_proc_douintvec_minmax_conv(unsigned long *lvalp,
2566 unsigned int *valp,
2567 int write, void *data)
2569 struct do_proc_douintvec_minmax_conv_param *param = data;
2571 if (write) {
2572 unsigned int val = *lvalp;
2574 if ((param->min && *param->min > val) ||
2575 (param->max && *param->max < val))
2576 return -ERANGE;
2578 if (*lvalp > UINT_MAX)
2579 return -EINVAL;
2580 *valp = val;
2581 } else {
2582 unsigned int val = *valp;
2583 *lvalp = (unsigned long) val;
2586 return 0;
2590 * proc_douintvec_minmax - read a vector of unsigned ints with min/max values
2591 * @table: the sysctl table
2592 * @write: %TRUE if this is a write to the sysctl file
2593 * @buffer: the user buffer
2594 * @lenp: the size of the user buffer
2595 * @ppos: file position
2597 * Reads/writes up to table->maxlen/sizeof(unsigned int) unsigned integer
2598 * values from/to the user buffer, treated as an ASCII string. Negative
2599 * strings are not allowed.
2601 * This routine will ensure the values are within the range specified by
2602 * table->extra1 (min) and table->extra2 (max). There is a final sanity
2603 * check for UINT_MAX to avoid having to support wrap around uses from
2604 * userspace.
2606 * Returns 0 on success.
2608 int proc_douintvec_minmax(struct ctl_table *table, int write,
2609 void __user *buffer, size_t *lenp, loff_t *ppos)
2611 struct do_proc_douintvec_minmax_conv_param param = {
2612 .min = (unsigned int *) table->extra1,
2613 .max = (unsigned int *) table->extra2,
2615 return do_proc_douintvec(table, write, buffer, lenp, ppos,
2616 do_proc_douintvec_minmax_conv, &param);
2619 static void validate_coredump_safety(void)
2621 #ifdef CONFIG_COREDUMP
2622 if (suid_dumpable == SUID_DUMP_ROOT &&
2623 core_pattern[0] != '/' && core_pattern[0] != '|') {
2624 printk(KERN_WARNING
2625 "Unsafe core_pattern used with fs.suid_dumpable=2.\n"
2626 "Pipe handler or fully qualified core dump path required.\n"
2627 "Set kernel.core_pattern before fs.suid_dumpable.\n"
2630 #endif
2633 static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
2634 void __user *buffer, size_t *lenp, loff_t *ppos)
2636 int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
2637 if (!error)
2638 validate_coredump_safety();
2639 return error;
2642 #ifdef CONFIG_COREDUMP
2643 static int proc_dostring_coredump(struct ctl_table *table, int write,
2644 void __user *buffer, size_t *lenp, loff_t *ppos)
2646 int error = proc_dostring(table, write, buffer, lenp, ppos);
2647 if (!error)
2648 validate_coredump_safety();
2649 return error;
2651 #endif
2653 static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2654 void __user *buffer,
2655 size_t *lenp, loff_t *ppos,
2656 unsigned long convmul,
2657 unsigned long convdiv)
2659 unsigned long *i, *min, *max;
2660 int vleft, first = 1, err = 0;
2661 size_t left;
2662 char *kbuf = NULL, *p;
2664 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
2665 *lenp = 0;
2666 return 0;
2669 i = (unsigned long *) data;
2670 min = (unsigned long *) table->extra1;
2671 max = (unsigned long *) table->extra2;
2672 vleft = table->maxlen / sizeof(unsigned long);
2673 left = *lenp;
2675 if (write) {
2676 if (proc_first_pos_non_zero_ignore(ppos, table))
2677 goto out;
2679 if (left > PAGE_SIZE - 1)
2680 left = PAGE_SIZE - 1;
2681 p = kbuf = memdup_user_nul(buffer, left);
2682 if (IS_ERR(kbuf))
2683 return PTR_ERR(kbuf);
2686 for (; left && vleft--; i++, first = 0) {
2687 unsigned long val;
2689 if (write) {
2690 bool neg;
2692 left -= proc_skip_spaces(&p);
2694 err = proc_get_long(&p, &left, &val, &neg,
2695 proc_wspace_sep,
2696 sizeof(proc_wspace_sep), NULL);
2697 if (err)
2698 break;
2699 if (neg)
2700 continue;
2701 val = convmul * val / convdiv;
2702 if ((min && val < *min) || (max && val > *max))
2703 continue;
2704 *i = val;
2705 } else {
2706 val = convdiv * (*i) / convmul;
2707 if (!first) {
2708 err = proc_put_char(&buffer, &left, '\t');
2709 if (err)
2710 break;
2712 err = proc_put_long(&buffer, &left, val, false);
2713 if (err)
2714 break;
2718 if (!write && !first && left && !err)
2719 err = proc_put_char(&buffer, &left, '\n');
2720 if (write && !err)
2721 left -= proc_skip_spaces(&p);
2722 if (write) {
2723 kfree(kbuf);
2724 if (first)
2725 return err ? : -EINVAL;
2727 *lenp -= left;
2728 out:
2729 *ppos += *lenp;
2730 return err;
2733 static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2734 void __user *buffer,
2735 size_t *lenp, loff_t *ppos,
2736 unsigned long convmul,
2737 unsigned long convdiv)
2739 return __do_proc_doulongvec_minmax(table->data, table, write,
2740 buffer, lenp, ppos, convmul, convdiv);
2744 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2745 * @table: the sysctl table
2746 * @write: %TRUE if this is a write to the sysctl file
2747 * @buffer: the user buffer
2748 * @lenp: the size of the user buffer
2749 * @ppos: file position
2751 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2752 * values from/to the user buffer, treated as an ASCII string.
2754 * This routine will ensure the values are within the range specified by
2755 * table->extra1 (min) and table->extra2 (max).
2757 * Returns 0 on success.
2759 int proc_doulongvec_minmax(struct ctl_table *table, int write,
2760 void __user *buffer, size_t *lenp, loff_t *ppos)
2762 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
2766 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2767 * @table: the sysctl table
2768 * @write: %TRUE if this is a write to the sysctl file
2769 * @buffer: the user buffer
2770 * @lenp: the size of the user buffer
2771 * @ppos: file position
2773 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2774 * values from/to the user buffer, treated as an ASCII string. The values
2775 * are treated as milliseconds, and converted to jiffies when they are stored.
2777 * This routine will ensure the values are within the range specified by
2778 * table->extra1 (min) and table->extra2 (max).
2780 * Returns 0 on success.
2782 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2783 void __user *buffer,
2784 size_t *lenp, loff_t *ppos)
2786 return do_proc_doulongvec_minmax(table, write, buffer,
2787 lenp, ppos, HZ, 1000l);
2791 static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
2792 int *valp,
2793 int write, void *data)
2795 if (write) {
2796 if (*lvalp > INT_MAX / HZ)
2797 return 1;
2798 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2799 } else {
2800 int val = *valp;
2801 unsigned long lval;
2802 if (val < 0) {
2803 *negp = true;
2804 lval = -(unsigned long)val;
2805 } else {
2806 *negp = false;
2807 lval = (unsigned long)val;
2809 *lvalp = lval / HZ;
2811 return 0;
2814 static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
2815 int *valp,
2816 int write, void *data)
2818 if (write) {
2819 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2820 return 1;
2821 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2822 } else {
2823 int val = *valp;
2824 unsigned long lval;
2825 if (val < 0) {
2826 *negp = true;
2827 lval = -(unsigned long)val;
2828 } else {
2829 *negp = false;
2830 lval = (unsigned long)val;
2832 *lvalp = jiffies_to_clock_t(lval);
2834 return 0;
2837 static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
2838 int *valp,
2839 int write, void *data)
2841 if (write) {
2842 unsigned long jif = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2844 if (jif > INT_MAX)
2845 return 1;
2846 *valp = (int)jif;
2847 } else {
2848 int val = *valp;
2849 unsigned long lval;
2850 if (val < 0) {
2851 *negp = true;
2852 lval = -(unsigned long)val;
2853 } else {
2854 *negp = false;
2855 lval = (unsigned long)val;
2857 *lvalp = jiffies_to_msecs(lval);
2859 return 0;
2863 * proc_dointvec_jiffies - read a vector of integers as seconds
2864 * @table: the sysctl table
2865 * @write: %TRUE if this is a write to the sysctl file
2866 * @buffer: the user buffer
2867 * @lenp: the size of the user buffer
2868 * @ppos: file position
2870 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2871 * values from/to the user buffer, treated as an ASCII string.
2872 * The values read are assumed to be in seconds, and are converted into
2873 * jiffies.
2875 * Returns 0 on success.
2877 int proc_dointvec_jiffies(struct ctl_table *table, int write,
2878 void __user *buffer, size_t *lenp, loff_t *ppos)
2880 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2881 do_proc_dointvec_jiffies_conv,NULL);
2885 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2886 * @table: the sysctl table
2887 * @write: %TRUE if this is a write to the sysctl file
2888 * @buffer: the user buffer
2889 * @lenp: the size of the user buffer
2890 * @ppos: pointer to the file position
2892 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2893 * values from/to the user buffer, treated as an ASCII string.
2894 * The values read are assumed to be in 1/USER_HZ seconds, and
2895 * are converted into jiffies.
2897 * Returns 0 on success.
2899 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2900 void __user *buffer, size_t *lenp, loff_t *ppos)
2902 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2903 do_proc_dointvec_userhz_jiffies_conv,NULL);
2907 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2908 * @table: the sysctl table
2909 * @write: %TRUE if this is a write to the sysctl file
2910 * @buffer: the user buffer
2911 * @lenp: the size of the user buffer
2912 * @ppos: file position
2913 * @ppos: the current position in the file
2915 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2916 * values from/to the user buffer, treated as an ASCII string.
2917 * The values read are assumed to be in 1/1000 seconds, and
2918 * are converted into jiffies.
2920 * Returns 0 on success.
2922 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
2923 void __user *buffer, size_t *lenp, loff_t *ppos)
2925 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2926 do_proc_dointvec_ms_jiffies_conv, NULL);
2929 static int proc_do_cad_pid(struct ctl_table *table, int write,
2930 void __user *buffer, size_t *lenp, loff_t *ppos)
2932 struct pid *new_pid;
2933 pid_t tmp;
2934 int r;
2936 tmp = pid_vnr(cad_pid);
2938 r = __do_proc_dointvec(&tmp, table, write, buffer,
2939 lenp, ppos, NULL, NULL);
2940 if (r || !write)
2941 return r;
2943 new_pid = find_get_pid(tmp);
2944 if (!new_pid)
2945 return -ESRCH;
2947 put_pid(xchg(&cad_pid, new_pid));
2948 return 0;
2952 * proc_do_large_bitmap - read/write from/to a large bitmap
2953 * @table: the sysctl table
2954 * @write: %TRUE if this is a write to the sysctl file
2955 * @buffer: the user buffer
2956 * @lenp: the size of the user buffer
2957 * @ppos: file position
2959 * The bitmap is stored at table->data and the bitmap length (in bits)
2960 * in table->maxlen.
2962 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2963 * large bitmaps may be represented in a compact manner. Writing into
2964 * the file will clear the bitmap then update it with the given input.
2966 * Returns 0 on success.
2968 int proc_do_large_bitmap(struct ctl_table *table, int write,
2969 void __user *buffer, size_t *lenp, loff_t *ppos)
2971 int err = 0;
2972 bool first = 1;
2973 size_t left = *lenp;
2974 unsigned long bitmap_len = table->maxlen;
2975 unsigned long *bitmap = *(unsigned long **) table->data;
2976 unsigned long *tmp_bitmap = NULL;
2977 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2979 if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
2980 *lenp = 0;
2981 return 0;
2984 if (write) {
2985 char *kbuf, *p;
2987 if (left > PAGE_SIZE - 1)
2988 left = PAGE_SIZE - 1;
2990 p = kbuf = memdup_user_nul(buffer, left);
2991 if (IS_ERR(kbuf))
2992 return PTR_ERR(kbuf);
2994 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2995 GFP_KERNEL);
2996 if (!tmp_bitmap) {
2997 kfree(kbuf);
2998 return -ENOMEM;
3000 proc_skip_char(&p, &left, '\n');
3001 while (!err && left) {
3002 unsigned long val_a, val_b;
3003 bool neg;
3005 err = proc_get_long(&p, &left, &val_a, &neg, tr_a,
3006 sizeof(tr_a), &c);
3007 if (err)
3008 break;
3009 if (val_a >= bitmap_len || neg) {
3010 err = -EINVAL;
3011 break;
3014 val_b = val_a;
3015 if (left) {
3016 p++;
3017 left--;
3020 if (c == '-') {
3021 err = proc_get_long(&p, &left, &val_b,
3022 &neg, tr_b, sizeof(tr_b),
3023 &c);
3024 if (err)
3025 break;
3026 if (val_b >= bitmap_len || neg ||
3027 val_a > val_b) {
3028 err = -EINVAL;
3029 break;
3031 if (left) {
3032 p++;
3033 left--;
3037 bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
3038 first = 0;
3039 proc_skip_char(&p, &left, '\n');
3041 kfree(kbuf);
3042 } else {
3043 unsigned long bit_a, bit_b = 0;
3045 while (left) {
3046 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
3047 if (bit_a >= bitmap_len)
3048 break;
3049 bit_b = find_next_zero_bit(bitmap, bitmap_len,
3050 bit_a + 1) - 1;
3052 if (!first) {
3053 err = proc_put_char(&buffer, &left, ',');
3054 if (err)
3055 break;
3057 err = proc_put_long(&buffer, &left, bit_a, false);
3058 if (err)
3059 break;
3060 if (bit_a != bit_b) {
3061 err = proc_put_char(&buffer, &left, '-');
3062 if (err)
3063 break;
3064 err = proc_put_long(&buffer, &left, bit_b, false);
3065 if (err)
3066 break;
3069 first = 0; bit_b++;
3071 if (!err)
3072 err = proc_put_char(&buffer, &left, '\n');
3075 if (!err) {
3076 if (write) {
3077 if (*ppos)
3078 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
3079 else
3080 bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
3082 kfree(tmp_bitmap);
3083 *lenp -= left;
3084 *ppos += *lenp;
3085 return 0;
3086 } else {
3087 kfree(tmp_bitmap);
3088 return err;
3092 #else /* CONFIG_PROC_SYSCTL */
3094 int proc_dostring(struct ctl_table *table, int write,
3095 void __user *buffer, size_t *lenp, loff_t *ppos)
3097 return -ENOSYS;
3100 int proc_dointvec(struct ctl_table *table, int write,
3101 void __user *buffer, size_t *lenp, loff_t *ppos)
3103 return -ENOSYS;
3106 int proc_douintvec(struct ctl_table *table, int write,
3107 void __user *buffer, size_t *lenp, loff_t *ppos)
3109 return -ENOSYS;
3112 int proc_dointvec_minmax(struct ctl_table *table, int write,
3113 void __user *buffer, size_t *lenp, loff_t *ppos)
3115 return -ENOSYS;
3118 int proc_douintvec_minmax(struct ctl_table *table, int write,
3119 void __user *buffer, size_t *lenp, loff_t *ppos)
3121 return -ENOSYS;
3124 int proc_dointvec_jiffies(struct ctl_table *table, int write,
3125 void __user *buffer, size_t *lenp, loff_t *ppos)
3127 return -ENOSYS;
3130 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
3131 void __user *buffer, size_t *lenp, loff_t *ppos)
3133 return -ENOSYS;
3136 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
3137 void __user *buffer, size_t *lenp, loff_t *ppos)
3139 return -ENOSYS;
3142 int proc_doulongvec_minmax(struct ctl_table *table, int write,
3143 void __user *buffer, size_t *lenp, loff_t *ppos)
3145 return -ENOSYS;
3148 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
3149 void __user *buffer,
3150 size_t *lenp, loff_t *ppos)
3152 return -ENOSYS;
3156 #endif /* CONFIG_PROC_SYSCTL */
3159 * No sense putting this after each symbol definition, twice,
3160 * exception granted :-)
3162 EXPORT_SYMBOL(proc_dointvec);
3163 EXPORT_SYMBOL(proc_douintvec);
3164 EXPORT_SYMBOL(proc_dointvec_jiffies);
3165 EXPORT_SYMBOL(proc_dointvec_minmax);
3166 EXPORT_SYMBOL_GPL(proc_douintvec_minmax);
3167 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
3168 EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
3169 EXPORT_SYMBOL(proc_dostring);
3170 EXPORT_SYMBOL(proc_doulongvec_minmax);
3171 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);