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
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
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>
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/kmemcheck.h>
34 #include <linux/kmemleak.h>
36 #include <linux/init.h>
37 #include <linux/kernel.h>
38 #include <linux/kobject.h>
39 #include <linux/net.h>
40 #include <linux/sysrq.h>
41 #include <linux/highuid.h>
42 #include <linux/writeback.h>
43 #include <linux/ratelimit.h>
44 #include <linux/compaction.h>
45 #include <linux/hugetlb.h>
46 #include <linux/initrd.h>
47 #include <linux/key.h>
48 #include <linux/times.h>
49 #include <linux/limits.h>
50 #include <linux/dcache.h>
51 #include <linux/dnotify.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/kprobes.h>
60 #include <linux/pipe_fs_i.h>
61 #include <linux/oom.h>
62 #include <linux/kmod.h>
63 #include <linux/capability.h>
64 #include <linux/binfmts.h>
65 #include <linux/sched/sysctl.h>
66 #include <linux/kexec.h>
67 #include <linux/bpf.h>
68 #include <linux/mount.h>
70 #include <asm/uaccess.h>
71 #include <asm/processor.h>
75 #include <asm/stacktrace.h>
79 #include <asm/setup.h>
81 #ifdef CONFIG_BSD_PROCESS_ACCT
82 #include <linux/acct.h>
84 #ifdef CONFIG_RT_MUTEXES
85 #include <linux/rtmutex.h>
87 #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
88 #include <linux/lockdep.h>
90 #ifdef CONFIG_CHR_DEV_SG
94 #ifdef CONFIG_LOCKUP_DETECTOR
95 #include <linux/nmi.h>
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
;
108 extern int pid_max_min
, pid_max_max
;
109 extern int percpu_pagelist_fraction
;
110 extern int compat_log
;
111 extern int latencytop_enabled
;
112 extern int sysctl_nr_open_min
, sysctl_nr_open_max
;
114 extern int sysctl_nr_trim_pages
;
117 /* Constants used for minimum and maximum */
118 #ifdef CONFIG_LOCKUP_DETECTOR
119 static int sixty
= 60;
122 static int __maybe_unused neg_one
= -1;
125 static int __maybe_unused one
= 1;
126 static int __maybe_unused two
= 2;
127 static int __maybe_unused four
= 4;
128 static unsigned long one_ul
= 1;
129 static int one_hundred
= 100;
131 static int ten_thousand
= 10000;
134 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
135 static unsigned long dirty_bytes_min
= 2 * PAGE_SIZE
;
137 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
138 static int maxolduid
= 65535;
139 static int minolduid
;
141 static int ngroups_max
= NGROUPS_MAX
;
142 static const int cap_last_cap
= CAP_LAST_CAP
;
144 /*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */
145 #ifdef CONFIG_DETECT_HUNG_TASK
146 static unsigned long hung_task_timeout_max
= (LONG_MAX
/HZ
);
149 #ifdef CONFIG_INOTIFY_USER
150 #include <linux/inotify.h>
156 extern int pwrsw_enabled
;
159 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
160 extern int unaligned_enabled
;
164 extern int unaligned_dump_stack
;
167 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
168 extern int no_unaligned_warning
;
171 #ifdef CONFIG_PROC_SYSCTL
173 #define SYSCTL_WRITES_LEGACY -1
174 #define SYSCTL_WRITES_WARN 0
175 #define SYSCTL_WRITES_STRICT 1
177 static int sysctl_writes_strict
= SYSCTL_WRITES_STRICT
;
179 static int proc_do_cad_pid(struct ctl_table
*table
, int write
,
180 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
181 static int proc_taint(struct ctl_table
*table
, int write
,
182 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
186 static int proc_dointvec_minmax_sysadmin(struct ctl_table
*table
, int write
,
187 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
190 static int proc_dointvec_minmax_coredump(struct ctl_table
*table
, int write
,
191 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
192 #ifdef CONFIG_COREDUMP
193 static int proc_dostring_coredump(struct ctl_table
*table
, int write
,
194 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
197 #ifdef CONFIG_MAGIC_SYSRQ
198 /* Note: sysrq code uses it's own private copy */
199 static int __sysrq_enabled
= CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE
;
201 static int sysrq_sysctl_handler(struct ctl_table
*table
, int write
,
202 void __user
*buffer
, size_t *lenp
,
207 error
= proc_dointvec(table
, write
, buffer
, lenp
, ppos
);
212 sysrq_toggle_support(__sysrq_enabled
);
219 static struct ctl_table kern_table
[];
220 static struct ctl_table vm_table
[];
221 static struct ctl_table fs_table
[];
222 static struct ctl_table debug_table
[];
223 static struct ctl_table dev_table
[];
224 extern struct ctl_table random_table
[];
226 extern struct ctl_table epoll_table
[];
229 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
230 int sysctl_legacy_va_layout
;
233 /* The default sysctl tables: */
235 static struct ctl_table sysctl_base_table
[] = {
237 .procname
= "kernel",
254 .child
= debug_table
,
264 #ifdef CONFIG_SCHED_DEBUG
265 static int min_sched_granularity_ns
= 100000; /* 100 usecs */
266 static int max_sched_granularity_ns
= NSEC_PER_SEC
; /* 1 second */
267 static int min_wakeup_granularity_ns
; /* 0 usecs */
268 static int max_wakeup_granularity_ns
= NSEC_PER_SEC
; /* 1 second */
270 static int min_sched_tunable_scaling
= SCHED_TUNABLESCALING_NONE
;
271 static int max_sched_tunable_scaling
= SCHED_TUNABLESCALING_END
-1;
272 #endif /* CONFIG_SMP */
273 #endif /* CONFIG_SCHED_DEBUG */
275 #ifdef CONFIG_COMPACTION
276 static int min_extfrag_threshold
;
277 static int max_extfrag_threshold
= 1000;
280 static struct ctl_table kern_table
[] = {
282 .procname
= "sched_child_runs_first",
283 .data
= &sysctl_sched_child_runs_first
,
284 .maxlen
= sizeof(unsigned int),
286 .proc_handler
= proc_dointvec
,
288 #ifdef CONFIG_SCHED_DEBUG
290 .procname
= "sched_min_granularity_ns",
291 .data
= &sysctl_sched_min_granularity
,
292 .maxlen
= sizeof(unsigned int),
294 .proc_handler
= sched_proc_update_handler
,
295 .extra1
= &min_sched_granularity_ns
,
296 .extra2
= &max_sched_granularity_ns
,
299 .procname
= "sched_latency_ns",
300 .data
= &sysctl_sched_latency
,
301 .maxlen
= sizeof(unsigned int),
303 .proc_handler
= sched_proc_update_handler
,
304 .extra1
= &min_sched_granularity_ns
,
305 .extra2
= &max_sched_granularity_ns
,
308 .procname
= "sched_wakeup_granularity_ns",
309 .data
= &sysctl_sched_wakeup_granularity
,
310 .maxlen
= sizeof(unsigned int),
312 .proc_handler
= sched_proc_update_handler
,
313 .extra1
= &min_wakeup_granularity_ns
,
314 .extra2
= &max_wakeup_granularity_ns
,
318 .procname
= "sched_tunable_scaling",
319 .data
= &sysctl_sched_tunable_scaling
,
320 .maxlen
= sizeof(enum sched_tunable_scaling
),
322 .proc_handler
= sched_proc_update_handler
,
323 .extra1
= &min_sched_tunable_scaling
,
324 .extra2
= &max_sched_tunable_scaling
,
327 .procname
= "sched_migration_cost_ns",
328 .data
= &sysctl_sched_migration_cost
,
329 .maxlen
= sizeof(unsigned int),
331 .proc_handler
= proc_dointvec
,
334 .procname
= "sched_nr_migrate",
335 .data
= &sysctl_sched_nr_migrate
,
336 .maxlen
= sizeof(unsigned int),
338 .proc_handler
= proc_dointvec
,
341 .procname
= "sched_time_avg_ms",
342 .data
= &sysctl_sched_time_avg
,
343 .maxlen
= sizeof(unsigned int),
345 .proc_handler
= proc_dointvec
,
348 .procname
= "sched_shares_window_ns",
349 .data
= &sysctl_sched_shares_window
,
350 .maxlen
= sizeof(unsigned int),
352 .proc_handler
= proc_dointvec
,
354 #endif /* CONFIG_SMP */
355 #ifdef CONFIG_NUMA_BALANCING
357 .procname
= "numa_balancing_scan_delay_ms",
358 .data
= &sysctl_numa_balancing_scan_delay
,
359 .maxlen
= sizeof(unsigned int),
361 .proc_handler
= proc_dointvec
,
364 .procname
= "numa_balancing_scan_period_min_ms",
365 .data
= &sysctl_numa_balancing_scan_period_min
,
366 .maxlen
= sizeof(unsigned int),
368 .proc_handler
= proc_dointvec
,
371 .procname
= "numa_balancing_scan_period_max_ms",
372 .data
= &sysctl_numa_balancing_scan_period_max
,
373 .maxlen
= sizeof(unsigned int),
375 .proc_handler
= proc_dointvec
,
378 .procname
= "numa_balancing_scan_size_mb",
379 .data
= &sysctl_numa_balancing_scan_size
,
380 .maxlen
= sizeof(unsigned int),
382 .proc_handler
= proc_dointvec_minmax
,
386 .procname
= "numa_balancing",
387 .data
= NULL
, /* filled in by handler */
388 .maxlen
= sizeof(unsigned int),
390 .proc_handler
= sysctl_numa_balancing
,
394 #endif /* CONFIG_NUMA_BALANCING */
395 #endif /* CONFIG_SCHED_DEBUG */
397 .procname
= "sched_rt_period_us",
398 .data
= &sysctl_sched_rt_period
,
399 .maxlen
= sizeof(unsigned int),
401 .proc_handler
= sched_rt_handler
,
404 .procname
= "sched_rt_runtime_us",
405 .data
= &sysctl_sched_rt_runtime
,
406 .maxlen
= sizeof(int),
408 .proc_handler
= sched_rt_handler
,
411 .procname
= "sched_rr_timeslice_ms",
412 .data
= &sched_rr_timeslice
,
413 .maxlen
= sizeof(int),
415 .proc_handler
= sched_rr_handler
,
417 #ifdef CONFIG_SCHED_AUTOGROUP
419 .procname
= "sched_autogroup_enabled",
420 .data
= &sysctl_sched_autogroup_enabled
,
421 .maxlen
= sizeof(unsigned int),
423 .proc_handler
= proc_dointvec_minmax
,
428 #ifdef CONFIG_CFS_BANDWIDTH
430 .procname
= "sched_cfs_bandwidth_slice_us",
431 .data
= &sysctl_sched_cfs_bandwidth_slice
,
432 .maxlen
= sizeof(unsigned int),
434 .proc_handler
= proc_dointvec_minmax
,
438 #ifdef CONFIG_PROVE_LOCKING
440 .procname
= "prove_locking",
441 .data
= &prove_locking
,
442 .maxlen
= sizeof(int),
444 .proc_handler
= proc_dointvec
,
447 #ifdef CONFIG_LOCK_STAT
449 .procname
= "lock_stat",
451 .maxlen
= sizeof(int),
453 .proc_handler
= proc_dointvec
,
458 .data
= &panic_timeout
,
459 .maxlen
= sizeof(int),
461 .proc_handler
= proc_dointvec
,
463 #ifdef CONFIG_COREDUMP
465 .procname
= "core_uses_pid",
466 .data
= &core_uses_pid
,
467 .maxlen
= sizeof(int),
469 .proc_handler
= proc_dointvec
,
472 .procname
= "core_pattern",
473 .data
= core_pattern
,
474 .maxlen
= CORENAME_MAX_SIZE
,
476 .proc_handler
= proc_dostring_coredump
,
479 .procname
= "core_pipe_limit",
480 .data
= &core_pipe_limit
,
481 .maxlen
= sizeof(unsigned int),
483 .proc_handler
= proc_dointvec
,
486 #ifdef CONFIG_PROC_SYSCTL
488 .procname
= "tainted",
489 .maxlen
= sizeof(long),
491 .proc_handler
= proc_taint
,
494 .procname
= "sysctl_writes_strict",
495 .data
= &sysctl_writes_strict
,
496 .maxlen
= sizeof(int),
498 .proc_handler
= proc_dointvec_minmax
,
503 #ifdef CONFIG_LATENCYTOP
505 .procname
= "latencytop",
506 .data
= &latencytop_enabled
,
507 .maxlen
= sizeof(int),
509 .proc_handler
= proc_dointvec
,
512 #ifdef CONFIG_BLK_DEV_INITRD
514 .procname
= "real-root-dev",
515 .data
= &real_root_dev
,
516 .maxlen
= sizeof(int),
518 .proc_handler
= proc_dointvec
,
522 .procname
= "print-fatal-signals",
523 .data
= &print_fatal_signals
,
524 .maxlen
= sizeof(int),
526 .proc_handler
= proc_dointvec
,
530 .procname
= "reboot-cmd",
531 .data
= reboot_command
,
534 .proc_handler
= proc_dostring
,
537 .procname
= "stop-a",
538 .data
= &stop_a_enabled
,
539 .maxlen
= sizeof (int),
541 .proc_handler
= proc_dointvec
,
544 .procname
= "scons-poweroff",
545 .data
= &scons_pwroff
,
546 .maxlen
= sizeof (int),
548 .proc_handler
= proc_dointvec
,
551 #ifdef CONFIG_SPARC64
553 .procname
= "tsb-ratio",
554 .data
= &sysctl_tsb_ratio
,
555 .maxlen
= sizeof (int),
557 .proc_handler
= proc_dointvec
,
562 .procname
= "soft-power",
563 .data
= &pwrsw_enabled
,
564 .maxlen
= sizeof (int),
566 .proc_handler
= proc_dointvec
,
569 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
571 .procname
= "unaligned-trap",
572 .data
= &unaligned_enabled
,
573 .maxlen
= sizeof (int),
575 .proc_handler
= proc_dointvec
,
579 .procname
= "ctrl-alt-del",
581 .maxlen
= sizeof(int),
583 .proc_handler
= proc_dointvec
,
585 #ifdef CONFIG_FUNCTION_TRACER
587 .procname
= "ftrace_enabled",
588 .data
= &ftrace_enabled
,
589 .maxlen
= sizeof(int),
591 .proc_handler
= ftrace_enable_sysctl
,
594 #ifdef CONFIG_STACK_TRACER
596 .procname
= "stack_tracer_enabled",
597 .data
= &stack_tracer_enabled
,
598 .maxlen
= sizeof(int),
600 .proc_handler
= stack_trace_sysctl
,
603 #ifdef CONFIG_TRACING
605 .procname
= "ftrace_dump_on_oops",
606 .data
= &ftrace_dump_on_oops
,
607 .maxlen
= sizeof(int),
609 .proc_handler
= proc_dointvec
,
612 .procname
= "traceoff_on_warning",
613 .data
= &__disable_trace_on_warning
,
614 .maxlen
= sizeof(__disable_trace_on_warning
),
616 .proc_handler
= proc_dointvec
,
619 .procname
= "tracepoint_printk",
620 .data
= &tracepoint_printk
,
621 .maxlen
= sizeof(tracepoint_printk
),
623 .proc_handler
= proc_dointvec
,
626 #ifdef CONFIG_KEXEC_CORE
628 .procname
= "kexec_load_disabled",
629 .data
= &kexec_load_disabled
,
630 .maxlen
= sizeof(int),
632 /* only handle a transition from default "0" to "1" */
633 .proc_handler
= proc_dointvec_minmax
,
638 #ifdef CONFIG_MODULES
640 .procname
= "modprobe",
641 .data
= &modprobe_path
,
642 .maxlen
= KMOD_PATH_LEN
,
644 .proc_handler
= proc_dostring
,
647 .procname
= "modules_disabled",
648 .data
= &modules_disabled
,
649 .maxlen
= sizeof(int),
651 /* only handle a transition from default "0" to "1" */
652 .proc_handler
= proc_dointvec_minmax
,
657 #ifdef CONFIG_UEVENT_HELPER
659 .procname
= "hotplug",
660 .data
= &uevent_helper
,
661 .maxlen
= UEVENT_HELPER_PATH_LEN
,
663 .proc_handler
= proc_dostring
,
666 #ifdef CONFIG_CHR_DEV_SG
668 .procname
= "sg-big-buff",
669 .data
= &sg_big_buff
,
670 .maxlen
= sizeof (int),
672 .proc_handler
= proc_dointvec
,
675 #ifdef CONFIG_BSD_PROCESS_ACCT
679 .maxlen
= 3*sizeof(int),
681 .proc_handler
= proc_dointvec
,
684 #ifdef CONFIG_MAGIC_SYSRQ
687 .data
= &__sysrq_enabled
,
688 .maxlen
= sizeof (int),
690 .proc_handler
= sysrq_sysctl_handler
,
693 #ifdef CONFIG_PROC_SYSCTL
695 .procname
= "cad_pid",
697 .maxlen
= sizeof (int),
699 .proc_handler
= proc_do_cad_pid
,
703 .procname
= "threads-max",
705 .maxlen
= sizeof(int),
707 .proc_handler
= sysctl_max_threads
,
710 .procname
= "random",
712 .child
= random_table
,
715 .procname
= "usermodehelper",
717 .child
= usermodehelper_table
,
720 .procname
= "overflowuid",
721 .data
= &overflowuid
,
722 .maxlen
= sizeof(int),
724 .proc_handler
= proc_dointvec_minmax
,
725 .extra1
= &minolduid
,
726 .extra2
= &maxolduid
,
729 .procname
= "overflowgid",
730 .data
= &overflowgid
,
731 .maxlen
= sizeof(int),
733 .proc_handler
= proc_dointvec_minmax
,
734 .extra1
= &minolduid
,
735 .extra2
= &maxolduid
,
738 #ifdef CONFIG_MATHEMU
740 .procname
= "ieee_emulation_warnings",
741 .data
= &sysctl_ieee_emulation_warnings
,
742 .maxlen
= sizeof(int),
744 .proc_handler
= proc_dointvec
,
748 .procname
= "userprocess_debug",
749 .data
= &show_unhandled_signals
,
750 .maxlen
= sizeof(int),
752 .proc_handler
= proc_dointvec
,
756 .procname
= "pid_max",
758 .maxlen
= sizeof (int),
760 .proc_handler
= proc_dointvec_minmax
,
761 .extra1
= &pid_max_min
,
762 .extra2
= &pid_max_max
,
765 .procname
= "panic_on_oops",
766 .data
= &panic_on_oops
,
767 .maxlen
= sizeof(int),
769 .proc_handler
= proc_dointvec
,
771 #if defined CONFIG_PRINTK
773 .procname
= "printk",
774 .data
= &console_loglevel
,
775 .maxlen
= 4*sizeof(int),
777 .proc_handler
= proc_dointvec
,
780 .procname
= "printk_ratelimit",
781 .data
= &printk_ratelimit_state
.interval
,
782 .maxlen
= sizeof(int),
784 .proc_handler
= proc_dointvec_jiffies
,
787 .procname
= "printk_ratelimit_burst",
788 .data
= &printk_ratelimit_state
.burst
,
789 .maxlen
= sizeof(int),
791 .proc_handler
= proc_dointvec
,
794 .procname
= "printk_delay",
795 .data
= &printk_delay_msec
,
796 .maxlen
= sizeof(int),
798 .proc_handler
= proc_dointvec_minmax
,
800 .extra2
= &ten_thousand
,
803 .procname
= "dmesg_restrict",
804 .data
= &dmesg_restrict
,
805 .maxlen
= sizeof(int),
807 .proc_handler
= proc_dointvec_minmax_sysadmin
,
812 .procname
= "kptr_restrict",
813 .data
= &kptr_restrict
,
814 .maxlen
= sizeof(int),
816 .proc_handler
= proc_dointvec_minmax_sysadmin
,
822 .procname
= "ngroups_max",
823 .data
= &ngroups_max
,
824 .maxlen
= sizeof (int),
826 .proc_handler
= proc_dointvec
,
829 .procname
= "cap_last_cap",
830 .data
= (void *)&cap_last_cap
,
831 .maxlen
= sizeof(int),
833 .proc_handler
= proc_dointvec
,
835 #if defined(CONFIG_LOCKUP_DETECTOR)
837 .procname
= "watchdog",
838 .data
= &watchdog_user_enabled
,
839 .maxlen
= sizeof (int),
841 .proc_handler
= proc_watchdog
,
846 .procname
= "watchdog_thresh",
847 .data
= &watchdog_thresh
,
848 .maxlen
= sizeof(int),
850 .proc_handler
= proc_watchdog_thresh
,
855 .procname
= "nmi_watchdog",
856 .data
= &nmi_watchdog_enabled
,
857 .maxlen
= sizeof (int),
859 .proc_handler
= proc_nmi_watchdog
,
861 #if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
868 .procname
= "soft_watchdog",
869 .data
= &soft_watchdog_enabled
,
870 .maxlen
= sizeof (int),
872 .proc_handler
= proc_soft_watchdog
,
877 .procname
= "watchdog_cpumask",
878 .data
= &watchdog_cpumask_bits
,
881 .proc_handler
= proc_watchdog_cpumask
,
884 .procname
= "softlockup_panic",
885 .data
= &softlockup_panic
,
886 .maxlen
= sizeof(int),
888 .proc_handler
= proc_dointvec_minmax
,
892 #ifdef CONFIG_HARDLOCKUP_DETECTOR
894 .procname
= "hardlockup_panic",
895 .data
= &hardlockup_panic
,
896 .maxlen
= sizeof(int),
898 .proc_handler
= proc_dointvec_minmax
,
905 .procname
= "softlockup_all_cpu_backtrace",
906 .data
= &sysctl_softlockup_all_cpu_backtrace
,
907 .maxlen
= sizeof(int),
909 .proc_handler
= proc_dointvec_minmax
,
914 .procname
= "hardlockup_all_cpu_backtrace",
915 .data
= &sysctl_hardlockup_all_cpu_backtrace
,
916 .maxlen
= sizeof(int),
918 .proc_handler
= proc_dointvec_minmax
,
922 #endif /* CONFIG_SMP */
924 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
926 .procname
= "unknown_nmi_panic",
927 .data
= &unknown_nmi_panic
,
928 .maxlen
= sizeof (int),
930 .proc_handler
= proc_dointvec
,
933 #if defined(CONFIG_X86)
935 .procname
= "panic_on_unrecovered_nmi",
936 .data
= &panic_on_unrecovered_nmi
,
937 .maxlen
= sizeof(int),
939 .proc_handler
= proc_dointvec
,
942 .procname
= "panic_on_io_nmi",
943 .data
= &panic_on_io_nmi
,
944 .maxlen
= sizeof(int),
946 .proc_handler
= proc_dointvec
,
948 #ifdef CONFIG_DEBUG_STACKOVERFLOW
950 .procname
= "panic_on_stackoverflow",
951 .data
= &sysctl_panic_on_stackoverflow
,
952 .maxlen
= sizeof(int),
954 .proc_handler
= proc_dointvec
,
958 .procname
= "bootloader_type",
959 .data
= &bootloader_type
,
960 .maxlen
= sizeof (int),
962 .proc_handler
= proc_dointvec
,
965 .procname
= "bootloader_version",
966 .data
= &bootloader_version
,
967 .maxlen
= sizeof (int),
969 .proc_handler
= proc_dointvec
,
972 .procname
= "kstack_depth_to_print",
973 .data
= &kstack_depth_to_print
,
974 .maxlen
= sizeof(int),
976 .proc_handler
= proc_dointvec
,
979 .procname
= "io_delay_type",
980 .data
= &io_delay_type
,
981 .maxlen
= sizeof(int),
983 .proc_handler
= proc_dointvec
,
986 #if defined(CONFIG_MMU)
988 .procname
= "randomize_va_space",
989 .data
= &randomize_va_space
,
990 .maxlen
= sizeof(int),
992 .proc_handler
= proc_dointvec
,
995 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
997 .procname
= "spin_retry",
999 .maxlen
= sizeof (int),
1001 .proc_handler
= proc_dointvec
,
1004 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
1006 .procname
= "acpi_video_flags",
1007 .data
= &acpi_realmode_flags
,
1008 .maxlen
= sizeof (unsigned long),
1010 .proc_handler
= proc_doulongvec_minmax
,
1013 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
1015 .procname
= "ignore-unaligned-usertrap",
1016 .data
= &no_unaligned_warning
,
1017 .maxlen
= sizeof (int),
1019 .proc_handler
= proc_dointvec
,
1024 .procname
= "unaligned-dump-stack",
1025 .data
= &unaligned_dump_stack
,
1026 .maxlen
= sizeof (int),
1028 .proc_handler
= proc_dointvec
,
1031 #ifdef CONFIG_DETECT_HUNG_TASK
1033 .procname
= "hung_task_panic",
1034 .data
= &sysctl_hung_task_panic
,
1035 .maxlen
= sizeof(int),
1037 .proc_handler
= proc_dointvec_minmax
,
1042 .procname
= "hung_task_check_count",
1043 .data
= &sysctl_hung_task_check_count
,
1044 .maxlen
= sizeof(int),
1046 .proc_handler
= proc_dointvec_minmax
,
1050 .procname
= "hung_task_timeout_secs",
1051 .data
= &sysctl_hung_task_timeout_secs
,
1052 .maxlen
= sizeof(unsigned long),
1054 .proc_handler
= proc_dohung_task_timeout_secs
,
1055 .extra2
= &hung_task_timeout_max
,
1058 .procname
= "hung_task_warnings",
1059 .data
= &sysctl_hung_task_warnings
,
1060 .maxlen
= sizeof(int),
1062 .proc_handler
= proc_dointvec_minmax
,
1066 #ifdef CONFIG_COMPAT
1068 .procname
= "compat-log",
1069 .data
= &compat_log
,
1070 .maxlen
= sizeof (int),
1072 .proc_handler
= proc_dointvec
,
1075 #ifdef CONFIG_RT_MUTEXES
1077 .procname
= "max_lock_depth",
1078 .data
= &max_lock_depth
,
1079 .maxlen
= sizeof(int),
1081 .proc_handler
= proc_dointvec
,
1085 .procname
= "poweroff_cmd",
1086 .data
= &poweroff_cmd
,
1087 .maxlen
= POWEROFF_CMD_PATH_LEN
,
1089 .proc_handler
= proc_dostring
,
1095 .child
= key_sysctls
,
1098 #ifdef CONFIG_PERF_EVENTS
1100 * User-space scripts rely on the existence of this file
1101 * as a feature check for perf_events being enabled.
1103 * So it's an ABI, do not remove!
1106 .procname
= "perf_event_paranoid",
1107 .data
= &sysctl_perf_event_paranoid
,
1108 .maxlen
= sizeof(sysctl_perf_event_paranoid
),
1110 .proc_handler
= proc_dointvec
,
1113 .procname
= "perf_event_mlock_kb",
1114 .data
= &sysctl_perf_event_mlock
,
1115 .maxlen
= sizeof(sysctl_perf_event_mlock
),
1117 .proc_handler
= proc_dointvec
,
1120 .procname
= "perf_event_max_sample_rate",
1121 .data
= &sysctl_perf_event_sample_rate
,
1122 .maxlen
= sizeof(sysctl_perf_event_sample_rate
),
1124 .proc_handler
= perf_proc_update_handler
,
1128 .procname
= "perf_cpu_time_max_percent",
1129 .data
= &sysctl_perf_cpu_time_max_percent
,
1130 .maxlen
= sizeof(sysctl_perf_cpu_time_max_percent
),
1132 .proc_handler
= perf_cpu_time_max_percent_handler
,
1134 .extra2
= &one_hundred
,
1137 #ifdef CONFIG_KMEMCHECK
1139 .procname
= "kmemcheck",
1140 .data
= &kmemcheck_enabled
,
1141 .maxlen
= sizeof(int),
1143 .proc_handler
= proc_dointvec
,
1147 .procname
= "panic_on_warn",
1148 .data
= &panic_on_warn
,
1149 .maxlen
= sizeof(int),
1151 .proc_handler
= proc_dointvec_minmax
,
1155 #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
1157 .procname
= "timer_migration",
1158 .data
= &sysctl_timer_migration
,
1159 .maxlen
= sizeof(unsigned int),
1161 .proc_handler
= timer_migration_handler
,
1166 #ifdef CONFIG_BPF_SYSCALL
1168 .procname
= "unprivileged_bpf_disabled",
1169 .data
= &sysctl_unprivileged_bpf_disabled
,
1170 .maxlen
= sizeof(sysctl_unprivileged_bpf_disabled
),
1172 /* only handle a transition from default "0" to "1" */
1173 .proc_handler
= proc_dointvec_minmax
,
1181 static struct ctl_table vm_table
[] = {
1183 .procname
= "overcommit_memory",
1184 .data
= &sysctl_overcommit_memory
,
1185 .maxlen
= sizeof(sysctl_overcommit_memory
),
1187 .proc_handler
= proc_dointvec_minmax
,
1192 .procname
= "panic_on_oom",
1193 .data
= &sysctl_panic_on_oom
,
1194 .maxlen
= sizeof(sysctl_panic_on_oom
),
1196 .proc_handler
= proc_dointvec_minmax
,
1201 .procname
= "oom_kill_allocating_task",
1202 .data
= &sysctl_oom_kill_allocating_task
,
1203 .maxlen
= sizeof(sysctl_oom_kill_allocating_task
),
1205 .proc_handler
= proc_dointvec
,
1208 .procname
= "oom_dump_tasks",
1209 .data
= &sysctl_oom_dump_tasks
,
1210 .maxlen
= sizeof(sysctl_oom_dump_tasks
),
1212 .proc_handler
= proc_dointvec
,
1215 .procname
= "overcommit_ratio",
1216 .data
= &sysctl_overcommit_ratio
,
1217 .maxlen
= sizeof(sysctl_overcommit_ratio
),
1219 .proc_handler
= overcommit_ratio_handler
,
1222 .procname
= "overcommit_kbytes",
1223 .data
= &sysctl_overcommit_kbytes
,
1224 .maxlen
= sizeof(sysctl_overcommit_kbytes
),
1226 .proc_handler
= overcommit_kbytes_handler
,
1229 .procname
= "page-cluster",
1230 .data
= &page_cluster
,
1231 .maxlen
= sizeof(int),
1233 .proc_handler
= proc_dointvec_minmax
,
1237 .procname
= "dirty_background_ratio",
1238 .data
= &dirty_background_ratio
,
1239 .maxlen
= sizeof(dirty_background_ratio
),
1241 .proc_handler
= dirty_background_ratio_handler
,
1243 .extra2
= &one_hundred
,
1246 .procname
= "dirty_background_bytes",
1247 .data
= &dirty_background_bytes
,
1248 .maxlen
= sizeof(dirty_background_bytes
),
1250 .proc_handler
= dirty_background_bytes_handler
,
1254 .procname
= "dirty_ratio",
1255 .data
= &vm_dirty_ratio
,
1256 .maxlen
= sizeof(vm_dirty_ratio
),
1258 .proc_handler
= dirty_ratio_handler
,
1260 .extra2
= &one_hundred
,
1263 .procname
= "dirty_bytes",
1264 .data
= &vm_dirty_bytes
,
1265 .maxlen
= sizeof(vm_dirty_bytes
),
1267 .proc_handler
= dirty_bytes_handler
,
1268 .extra1
= &dirty_bytes_min
,
1271 .procname
= "dirty_writeback_centisecs",
1272 .data
= &dirty_writeback_interval
,
1273 .maxlen
= sizeof(dirty_writeback_interval
),
1275 .proc_handler
= dirty_writeback_centisecs_handler
,
1278 .procname
= "dirty_expire_centisecs",
1279 .data
= &dirty_expire_interval
,
1280 .maxlen
= sizeof(dirty_expire_interval
),
1282 .proc_handler
= proc_dointvec_minmax
,
1286 .procname
= "dirtytime_expire_seconds",
1287 .data
= &dirtytime_expire_interval
,
1288 .maxlen
= sizeof(dirty_expire_interval
),
1290 .proc_handler
= dirtytime_interval_handler
,
1294 .procname
= "nr_pdflush_threads",
1295 .mode
= 0444 /* read-only */,
1296 .proc_handler
= pdflush_proc_obsolete
,
1299 .procname
= "swappiness",
1300 .data
= &vm_swappiness
,
1301 .maxlen
= sizeof(vm_swappiness
),
1303 .proc_handler
= proc_dointvec_minmax
,
1305 .extra2
= &one_hundred
,
1307 #ifdef CONFIG_HUGETLB_PAGE
1309 .procname
= "nr_hugepages",
1311 .maxlen
= sizeof(unsigned long),
1313 .proc_handler
= hugetlb_sysctl_handler
,
1317 .procname
= "nr_hugepages_mempolicy",
1319 .maxlen
= sizeof(unsigned long),
1321 .proc_handler
= &hugetlb_mempolicy_sysctl_handler
,
1325 .procname
= "hugetlb_shm_group",
1326 .data
= &sysctl_hugetlb_shm_group
,
1327 .maxlen
= sizeof(gid_t
),
1329 .proc_handler
= proc_dointvec
,
1332 .procname
= "hugepages_treat_as_movable",
1333 .data
= &hugepages_treat_as_movable
,
1334 .maxlen
= sizeof(int),
1336 .proc_handler
= proc_dointvec
,
1339 .procname
= "nr_overcommit_hugepages",
1341 .maxlen
= sizeof(unsigned long),
1343 .proc_handler
= hugetlb_overcommit_handler
,
1347 .procname
= "lowmem_reserve_ratio",
1348 .data
= &sysctl_lowmem_reserve_ratio
,
1349 .maxlen
= sizeof(sysctl_lowmem_reserve_ratio
),
1351 .proc_handler
= lowmem_reserve_ratio_sysctl_handler
,
1354 .procname
= "drop_caches",
1355 .data
= &sysctl_drop_caches
,
1356 .maxlen
= sizeof(int),
1358 .proc_handler
= drop_caches_sysctl_handler
,
1362 #ifdef CONFIG_COMPACTION
1364 .procname
= "compact_memory",
1365 .data
= &sysctl_compact_memory
,
1366 .maxlen
= sizeof(int),
1368 .proc_handler
= sysctl_compaction_handler
,
1371 .procname
= "extfrag_threshold",
1372 .data
= &sysctl_extfrag_threshold
,
1373 .maxlen
= sizeof(int),
1375 .proc_handler
= sysctl_extfrag_handler
,
1376 .extra1
= &min_extfrag_threshold
,
1377 .extra2
= &max_extfrag_threshold
,
1380 .procname
= "compact_unevictable_allowed",
1381 .data
= &sysctl_compact_unevictable_allowed
,
1382 .maxlen
= sizeof(int),
1384 .proc_handler
= proc_dointvec
,
1389 #endif /* CONFIG_COMPACTION */
1391 .procname
= "min_free_kbytes",
1392 .data
= &min_free_kbytes
,
1393 .maxlen
= sizeof(min_free_kbytes
),
1395 .proc_handler
= min_free_kbytes_sysctl_handler
,
1399 .procname
= "percpu_pagelist_fraction",
1400 .data
= &percpu_pagelist_fraction
,
1401 .maxlen
= sizeof(percpu_pagelist_fraction
),
1403 .proc_handler
= percpu_pagelist_fraction_sysctl_handler
,
1408 .procname
= "max_map_count",
1409 .data
= &sysctl_max_map_count
,
1410 .maxlen
= sizeof(sysctl_max_map_count
),
1412 .proc_handler
= proc_dointvec_minmax
,
1417 .procname
= "nr_trim_pages",
1418 .data
= &sysctl_nr_trim_pages
,
1419 .maxlen
= sizeof(sysctl_nr_trim_pages
),
1421 .proc_handler
= proc_dointvec_minmax
,
1426 .procname
= "laptop_mode",
1427 .data
= &laptop_mode
,
1428 .maxlen
= sizeof(laptop_mode
),
1430 .proc_handler
= proc_dointvec_jiffies
,
1433 .procname
= "block_dump",
1434 .data
= &block_dump
,
1435 .maxlen
= sizeof(block_dump
),
1437 .proc_handler
= proc_dointvec
,
1441 .procname
= "vfs_cache_pressure",
1442 .data
= &sysctl_vfs_cache_pressure
,
1443 .maxlen
= sizeof(sysctl_vfs_cache_pressure
),
1445 .proc_handler
= proc_dointvec
,
1448 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1450 .procname
= "legacy_va_layout",
1451 .data
= &sysctl_legacy_va_layout
,
1452 .maxlen
= sizeof(sysctl_legacy_va_layout
),
1454 .proc_handler
= proc_dointvec
,
1460 .procname
= "zone_reclaim_mode",
1461 .data
= &zone_reclaim_mode
,
1462 .maxlen
= sizeof(zone_reclaim_mode
),
1464 .proc_handler
= proc_dointvec
,
1468 .procname
= "min_unmapped_ratio",
1469 .data
= &sysctl_min_unmapped_ratio
,
1470 .maxlen
= sizeof(sysctl_min_unmapped_ratio
),
1472 .proc_handler
= sysctl_min_unmapped_ratio_sysctl_handler
,
1474 .extra2
= &one_hundred
,
1477 .procname
= "min_slab_ratio",
1478 .data
= &sysctl_min_slab_ratio
,
1479 .maxlen
= sizeof(sysctl_min_slab_ratio
),
1481 .proc_handler
= sysctl_min_slab_ratio_sysctl_handler
,
1483 .extra2
= &one_hundred
,
1488 .procname
= "stat_interval",
1489 .data
= &sysctl_stat_interval
,
1490 .maxlen
= sizeof(sysctl_stat_interval
),
1492 .proc_handler
= proc_dointvec_jiffies
,
1497 .procname
= "mmap_min_addr",
1498 .data
= &dac_mmap_min_addr
,
1499 .maxlen
= sizeof(unsigned long),
1501 .proc_handler
= mmap_min_addr_handler
,
1506 .procname
= "numa_zonelist_order",
1507 .data
= &numa_zonelist_order
,
1508 .maxlen
= NUMA_ZONELIST_ORDER_LEN
,
1510 .proc_handler
= numa_zonelist_order_handler
,
1513 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1514 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1516 .procname
= "vdso_enabled",
1517 #ifdef CONFIG_X86_32
1518 .data
= &vdso32_enabled
,
1519 .maxlen
= sizeof(vdso32_enabled
),
1521 .data
= &vdso_enabled
,
1522 .maxlen
= sizeof(vdso_enabled
),
1525 .proc_handler
= proc_dointvec
,
1529 #ifdef CONFIG_HIGHMEM
1531 .procname
= "highmem_is_dirtyable",
1532 .data
= &vm_highmem_is_dirtyable
,
1533 .maxlen
= sizeof(vm_highmem_is_dirtyable
),
1535 .proc_handler
= proc_dointvec_minmax
,
1540 #ifdef CONFIG_MEMORY_FAILURE
1542 .procname
= "memory_failure_early_kill",
1543 .data
= &sysctl_memory_failure_early_kill
,
1544 .maxlen
= sizeof(sysctl_memory_failure_early_kill
),
1546 .proc_handler
= proc_dointvec_minmax
,
1551 .procname
= "memory_failure_recovery",
1552 .data
= &sysctl_memory_failure_recovery
,
1553 .maxlen
= sizeof(sysctl_memory_failure_recovery
),
1555 .proc_handler
= proc_dointvec_minmax
,
1561 .procname
= "user_reserve_kbytes",
1562 .data
= &sysctl_user_reserve_kbytes
,
1563 .maxlen
= sizeof(sysctl_user_reserve_kbytes
),
1565 .proc_handler
= proc_doulongvec_minmax
,
1568 .procname
= "admin_reserve_kbytes",
1569 .data
= &sysctl_admin_reserve_kbytes
,
1570 .maxlen
= sizeof(sysctl_admin_reserve_kbytes
),
1572 .proc_handler
= proc_doulongvec_minmax
,
1577 static struct ctl_table fs_table
[] = {
1579 .procname
= "inode-nr",
1580 .data
= &inodes_stat
,
1581 .maxlen
= 2*sizeof(long),
1583 .proc_handler
= proc_nr_inodes
,
1586 .procname
= "inode-state",
1587 .data
= &inodes_stat
,
1588 .maxlen
= 7*sizeof(long),
1590 .proc_handler
= proc_nr_inodes
,
1593 .procname
= "file-nr",
1594 .data
= &files_stat
,
1595 .maxlen
= sizeof(files_stat
),
1597 .proc_handler
= proc_nr_files
,
1600 .procname
= "file-max",
1601 .data
= &files_stat
.max_files
,
1602 .maxlen
= sizeof(files_stat
.max_files
),
1604 .proc_handler
= proc_doulongvec_minmax
,
1607 .procname
= "nr_open",
1608 .data
= &sysctl_nr_open
,
1609 .maxlen
= sizeof(int),
1611 .proc_handler
= proc_dointvec_minmax
,
1612 .extra1
= &sysctl_nr_open_min
,
1613 .extra2
= &sysctl_nr_open_max
,
1616 .procname
= "dentry-state",
1617 .data
= &dentry_stat
,
1618 .maxlen
= 6*sizeof(long),
1620 .proc_handler
= proc_nr_dentry
,
1623 .procname
= "overflowuid",
1624 .data
= &fs_overflowuid
,
1625 .maxlen
= sizeof(int),
1627 .proc_handler
= proc_dointvec_minmax
,
1628 .extra1
= &minolduid
,
1629 .extra2
= &maxolduid
,
1632 .procname
= "overflowgid",
1633 .data
= &fs_overflowgid
,
1634 .maxlen
= sizeof(int),
1636 .proc_handler
= proc_dointvec_minmax
,
1637 .extra1
= &minolduid
,
1638 .extra2
= &maxolduid
,
1640 #ifdef CONFIG_FILE_LOCKING
1642 .procname
= "leases-enable",
1643 .data
= &leases_enable
,
1644 .maxlen
= sizeof(int),
1646 .proc_handler
= proc_dointvec
,
1649 #ifdef CONFIG_DNOTIFY
1651 .procname
= "dir-notify-enable",
1652 .data
= &dir_notify_enable
,
1653 .maxlen
= sizeof(int),
1655 .proc_handler
= proc_dointvec
,
1659 #ifdef CONFIG_FILE_LOCKING
1661 .procname
= "lease-break-time",
1662 .data
= &lease_break_time
,
1663 .maxlen
= sizeof(int),
1665 .proc_handler
= proc_dointvec
,
1670 .procname
= "aio-nr",
1672 .maxlen
= sizeof(aio_nr
),
1674 .proc_handler
= proc_doulongvec_minmax
,
1677 .procname
= "aio-max-nr",
1678 .data
= &aio_max_nr
,
1679 .maxlen
= sizeof(aio_max_nr
),
1681 .proc_handler
= proc_doulongvec_minmax
,
1683 #endif /* CONFIG_AIO */
1684 #ifdef CONFIG_INOTIFY_USER
1686 .procname
= "inotify",
1688 .child
= inotify_table
,
1693 .procname
= "epoll",
1695 .child
= epoll_table
,
1700 .procname
= "protected_symlinks",
1701 .data
= &sysctl_protected_symlinks
,
1702 .maxlen
= sizeof(int),
1704 .proc_handler
= proc_dointvec_minmax
,
1709 .procname
= "protected_hardlinks",
1710 .data
= &sysctl_protected_hardlinks
,
1711 .maxlen
= sizeof(int),
1713 .proc_handler
= proc_dointvec_minmax
,
1718 .procname
= "suid_dumpable",
1719 .data
= &suid_dumpable
,
1720 .maxlen
= sizeof(int),
1722 .proc_handler
= proc_dointvec_minmax_coredump
,
1726 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1728 .procname
= "binfmt_misc",
1730 .child
= sysctl_mount_point
,
1734 .procname
= "pipe-max-size",
1735 .data
= &pipe_max_size
,
1736 .maxlen
= sizeof(int),
1738 .proc_handler
= &pipe_proc_fn
,
1739 .extra1
= &pipe_min_size
,
1742 .procname
= "pipe-user-pages-hard",
1743 .data
= &pipe_user_pages_hard
,
1744 .maxlen
= sizeof(pipe_user_pages_hard
),
1746 .proc_handler
= proc_doulongvec_minmax
,
1749 .procname
= "pipe-user-pages-soft",
1750 .data
= &pipe_user_pages_soft
,
1751 .maxlen
= sizeof(pipe_user_pages_soft
),
1753 .proc_handler
= proc_doulongvec_minmax
,
1756 .procname
= "mount-max",
1757 .data
= &sysctl_mount_max
,
1758 .maxlen
= sizeof(unsigned int),
1760 .proc_handler
= proc_dointvec_minmax
,
1766 static struct ctl_table debug_table
[] = {
1767 #ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
1769 .procname
= "exception-trace",
1770 .data
= &show_unhandled_signals
,
1771 .maxlen
= sizeof(int),
1773 .proc_handler
= proc_dointvec
1776 #if defined(CONFIG_OPTPROBES)
1778 .procname
= "kprobes-optimization",
1779 .data
= &sysctl_kprobes_optimization
,
1780 .maxlen
= sizeof(int),
1782 .proc_handler
= proc_kprobes_optimization_handler
,
1790 static struct ctl_table dev_table
[] = {
1794 int __init
sysctl_init(void)
1796 struct ctl_table_header
*hdr
;
1798 hdr
= register_sysctl_table(sysctl_base_table
);
1799 kmemleak_not_leak(hdr
);
1803 #endif /* CONFIG_SYSCTL */
1809 #ifdef CONFIG_PROC_SYSCTL
1811 static int _proc_do_string(char *data
, int maxlen
, int write
,
1812 char __user
*buffer
,
1813 size_t *lenp
, loff_t
*ppos
)
1819 if (!data
|| !maxlen
|| !*lenp
) {
1825 if (sysctl_writes_strict
== SYSCTL_WRITES_STRICT
) {
1826 /* Only continue writes not past the end of buffer. */
1828 if (len
> maxlen
- 1)
1835 /* Start writing from beginning of buffer. */
1841 while ((p
- buffer
) < *lenp
&& len
< maxlen
- 1) {
1842 if (get_user(c
, p
++))
1844 if (c
== 0 || c
== '\n')
1865 if (copy_to_user(buffer
, data
, len
))
1868 if (put_user('\n', buffer
+ len
))
1878 static void warn_sysctl_write(struct ctl_table
*table
)
1880 pr_warn_once("%s wrote to %s when file position was not 0!\n"
1881 "This will not be supported in the future. To silence this\n"
1882 "warning, set kernel.sysctl_writes_strict = -1\n",
1883 current
->comm
, table
->procname
);
1887 * proc_dostring - read a string sysctl
1888 * @table: the sysctl table
1889 * @write: %TRUE if this is a write to the sysctl file
1890 * @buffer: the user buffer
1891 * @lenp: the size of the user buffer
1892 * @ppos: file position
1894 * Reads/writes a string from/to the user buffer. If the kernel
1895 * buffer provided is not large enough to hold the string, the
1896 * string is truncated. The copied string is %NULL-terminated.
1897 * If the string is being read by the user process, it is copied
1898 * and a newline '\n' is added. It is truncated if the buffer is
1901 * Returns 0 on success.
1903 int proc_dostring(struct ctl_table
*table
, int write
,
1904 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
1906 if (write
&& *ppos
&& sysctl_writes_strict
== SYSCTL_WRITES_WARN
)
1907 warn_sysctl_write(table
);
1909 return _proc_do_string((char *)(table
->data
), table
->maxlen
, write
,
1910 (char __user
*)buffer
, lenp
, ppos
);
1913 static size_t proc_skip_spaces(char **buf
)
1916 char *tmp
= skip_spaces(*buf
);
1922 static void proc_skip_char(char **buf
, size_t *size
, const char v
)
1932 #define TMPBUFLEN 22
1934 * proc_get_long - reads an ASCII formatted integer from a user buffer
1936 * @buf: a kernel buffer
1937 * @size: size of the kernel buffer
1938 * @val: this is where the number will be stored
1939 * @neg: set to %TRUE if number is negative
1940 * @perm_tr: a vector which contains the allowed trailers
1941 * @perm_tr_len: size of the perm_tr vector
1942 * @tr: pointer to store the trailer character
1944 * In case of success %0 is returned and @buf and @size are updated with
1945 * the amount of bytes read. If @tr is non-NULL and a trailing
1946 * character exists (size is non-zero after returning from this
1947 * function), @tr is updated with the trailing character.
1949 static int proc_get_long(char **buf
, size_t *size
,
1950 unsigned long *val
, bool *neg
,
1951 const char *perm_tr
, unsigned perm_tr_len
, char *tr
)
1954 char *p
, tmp
[TMPBUFLEN
];
1960 if (len
> TMPBUFLEN
- 1)
1961 len
= TMPBUFLEN
- 1;
1963 memcpy(tmp
, *buf
, len
);
1967 if (*p
== '-' && *size
> 1) {
1975 *val
= simple_strtoul(p
, &p
, 0);
1979 /* We don't know if the next char is whitespace thus we may accept
1980 * invalid integers (e.g. 1234...a) or two integers instead of one
1981 * (e.g. 123...1). So lets not allow such large numbers. */
1982 if (len
== TMPBUFLEN
- 1)
1985 if (len
< *size
&& perm_tr_len
&& !memchr(perm_tr
, *p
, perm_tr_len
))
1988 if (tr
&& (len
< *size
))
1998 * proc_put_long - converts an integer to a decimal ASCII formatted string
2000 * @buf: the user buffer
2001 * @size: the size of the user buffer
2002 * @val: the integer to be converted
2003 * @neg: sign of the number, %TRUE for negative
2005 * In case of success %0 is returned and @buf and @size are updated with
2006 * the amount of bytes written.
2008 static int proc_put_long(void __user
**buf
, size_t *size
, unsigned long val
,
2012 char tmp
[TMPBUFLEN
], *p
= tmp
;
2014 sprintf(p
, "%s%lu", neg
? "-" : "", val
);
2018 if (copy_to_user(*buf
, tmp
, len
))
2026 static int proc_put_char(void __user
**buf
, size_t *size
, char c
)
2029 char __user
**buffer
= (char __user
**)buf
;
2030 if (put_user(c
, *buffer
))
2032 (*size
)--, (*buffer
)++;
2038 static int do_proc_dointvec_conv(bool *negp
, unsigned long *lvalp
,
2040 int write
, void *data
)
2044 if (*lvalp
> (unsigned long) INT_MAX
+ 1)
2048 if (*lvalp
> (unsigned long) INT_MAX
)
2056 *lvalp
= -(unsigned long)val
;
2059 *lvalp
= (unsigned long)val
;
2065 static int do_proc_douintvec_conv(bool *negp
, unsigned long *lvalp
,
2067 int write
, void *data
)
2072 if (*lvalp
> UINT_MAX
)
2076 unsigned int val
= *valp
;
2078 *lvalp
= (unsigned long)val
;
2083 static const char proc_wspace_sep
[] = { ' ', '\t', '\n' };
2085 static int __do_proc_dointvec(void *tbl_data
, struct ctl_table
*table
,
2086 int write
, void __user
*buffer
,
2087 size_t *lenp
, loff_t
*ppos
,
2088 int (*conv
)(bool *negp
, unsigned long *lvalp
, int *valp
,
2089 int write
, void *data
),
2092 int *i
, vleft
, first
= 1, err
= 0;
2093 unsigned long page
= 0;
2097 if (!tbl_data
|| !table
->maxlen
|| !*lenp
|| (*ppos
&& !write
)) {
2102 i
= (int *) tbl_data
;
2103 vleft
= table
->maxlen
/ sizeof(*i
);
2107 conv
= do_proc_dointvec_conv
;
2111 switch (sysctl_writes_strict
) {
2112 case SYSCTL_WRITES_STRICT
:
2114 case SYSCTL_WRITES_WARN
:
2115 warn_sysctl_write(table
);
2122 if (left
> PAGE_SIZE
- 1)
2123 left
= PAGE_SIZE
- 1;
2124 page
= __get_free_page(GFP_TEMPORARY
);
2125 kbuf
= (char *) page
;
2128 if (copy_from_user(kbuf
, buffer
, left
)) {
2135 for (; left
&& vleft
--; i
++, first
=0) {
2140 left
-= proc_skip_spaces(&kbuf
);
2144 err
= proc_get_long(&kbuf
, &left
, &lval
, &neg
,
2146 sizeof(proc_wspace_sep
), NULL
);
2149 if (conv(&neg
, &lval
, i
, 1, data
)) {
2154 if (conv(&neg
, &lval
, i
, 0, data
)) {
2159 err
= proc_put_char(&buffer
, &left
, '\t');
2162 err
= proc_put_long(&buffer
, &left
, lval
, neg
);
2168 if (!write
&& !first
&& left
&& !err
)
2169 err
= proc_put_char(&buffer
, &left
, '\n');
2170 if (write
&& !err
&& left
)
2171 left
-= proc_skip_spaces(&kbuf
);
2176 return err
? : -EINVAL
;
2184 static int do_proc_dointvec(struct ctl_table
*table
, int write
,
2185 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
,
2186 int (*conv
)(bool *negp
, unsigned long *lvalp
, int *valp
,
2187 int write
, void *data
),
2190 return __do_proc_dointvec(table
->data
, table
, write
,
2191 buffer
, lenp
, ppos
, conv
, data
);
2195 * proc_dointvec - read a vector of integers
2196 * @table: the sysctl table
2197 * @write: %TRUE if this is a write to the sysctl file
2198 * @buffer: the user buffer
2199 * @lenp: the size of the user buffer
2200 * @ppos: file position
2202 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2203 * values from/to the user buffer, treated as an ASCII string.
2205 * Returns 0 on success.
2207 int proc_dointvec(struct ctl_table
*table
, int write
,
2208 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2210 return do_proc_dointvec(table
, write
, buffer
, lenp
, ppos
, NULL
, NULL
);
2214 * proc_douintvec - read a vector of unsigned integers
2215 * @table: the sysctl table
2216 * @write: %TRUE if this is a write to the sysctl file
2217 * @buffer: the user buffer
2218 * @lenp: the size of the user buffer
2219 * @ppos: file position
2221 * Reads/writes up to table->maxlen/sizeof(unsigned int) unsigned integer
2222 * values from/to the user buffer, treated as an ASCII string.
2224 * Returns 0 on success.
2226 int proc_douintvec(struct ctl_table
*table
, int write
,
2227 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2229 return do_proc_dointvec(table
, write
, buffer
, lenp
, ppos
,
2230 do_proc_douintvec_conv
, NULL
);
2234 * Taint values can only be increased
2235 * This means we can safely use a temporary.
2237 static int proc_taint(struct ctl_table
*table
, int write
,
2238 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2241 unsigned long tmptaint
= get_taint();
2244 if (write
&& !capable(CAP_SYS_ADMIN
))
2249 err
= proc_doulongvec_minmax(&t
, write
, buffer
, lenp
, ppos
);
2255 * Poor man's atomic or. Not worth adding a primitive
2256 * to everyone's atomic.h for this
2259 for (i
= 0; i
< BITS_PER_LONG
&& tmptaint
>> i
; i
++) {
2260 if ((tmptaint
>> i
) & 1)
2261 add_taint(i
, LOCKDEP_STILL_OK
);
2268 #ifdef CONFIG_PRINTK
2269 static int proc_dointvec_minmax_sysadmin(struct ctl_table
*table
, int write
,
2270 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2272 if (write
&& !capable(CAP_SYS_ADMIN
))
2275 return proc_dointvec_minmax(table
, write
, buffer
, lenp
, ppos
);
2279 struct do_proc_dointvec_minmax_conv_param
{
2284 static int do_proc_dointvec_minmax_conv(bool *negp
, unsigned long *lvalp
,
2286 int write
, void *data
)
2288 struct do_proc_dointvec_minmax_conv_param
*param
= data
;
2290 int val
= *negp
? -*lvalp
: *lvalp
;
2291 if ((param
->min
&& *param
->min
> val
) ||
2292 (param
->max
&& *param
->max
< val
))
2299 *lvalp
= -(unsigned long)val
;
2302 *lvalp
= (unsigned long)val
;
2309 * proc_dointvec_minmax - read a vector of integers with min/max values
2310 * @table: the sysctl table
2311 * @write: %TRUE if this is a write to the sysctl file
2312 * @buffer: the user buffer
2313 * @lenp: the size of the user buffer
2314 * @ppos: file position
2316 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2317 * values from/to the user buffer, treated as an ASCII string.
2319 * This routine will ensure the values are within the range specified by
2320 * table->extra1 (min) and table->extra2 (max).
2322 * Returns 0 on success.
2324 int proc_dointvec_minmax(struct ctl_table
*table
, int write
,
2325 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2327 struct do_proc_dointvec_minmax_conv_param param
= {
2328 .min
= (int *) table
->extra1
,
2329 .max
= (int *) table
->extra2
,
2331 return do_proc_dointvec(table
, write
, buffer
, lenp
, ppos
,
2332 do_proc_dointvec_minmax_conv
, ¶m
);
2335 static void validate_coredump_safety(void)
2337 #ifdef CONFIG_COREDUMP
2338 if (suid_dumpable
== SUID_DUMP_ROOT
&&
2339 core_pattern
[0] != '/' && core_pattern
[0] != '|') {
2340 printk(KERN_WARNING
"Unsafe core_pattern used with "\
2341 "suid_dumpable=2. Pipe handler or fully qualified "\
2342 "core dump path required.\n");
2347 static int proc_dointvec_minmax_coredump(struct ctl_table
*table
, int write
,
2348 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2350 int error
= proc_dointvec_minmax(table
, write
, buffer
, lenp
, ppos
);
2352 validate_coredump_safety();
2356 #ifdef CONFIG_COREDUMP
2357 static int proc_dostring_coredump(struct ctl_table
*table
, int write
,
2358 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2360 int error
= proc_dostring(table
, write
, buffer
, lenp
, ppos
);
2362 validate_coredump_safety();
2367 static int __do_proc_doulongvec_minmax(void *data
, struct ctl_table
*table
, int write
,
2368 void __user
*buffer
,
2369 size_t *lenp
, loff_t
*ppos
,
2370 unsigned long convmul
,
2371 unsigned long convdiv
)
2373 unsigned long *i
, *min
, *max
;
2374 int vleft
, first
= 1, err
= 0;
2375 unsigned long page
= 0;
2379 if (!data
|| !table
->maxlen
|| !*lenp
|| (*ppos
&& !write
)) {
2384 i
= (unsigned long *) data
;
2385 min
= (unsigned long *) table
->extra1
;
2386 max
= (unsigned long *) table
->extra2
;
2387 vleft
= table
->maxlen
/ sizeof(unsigned long);
2392 switch (sysctl_writes_strict
) {
2393 case SYSCTL_WRITES_STRICT
:
2395 case SYSCTL_WRITES_WARN
:
2396 warn_sysctl_write(table
);
2403 if (left
> PAGE_SIZE
- 1)
2404 left
= PAGE_SIZE
- 1;
2405 page
= __get_free_page(GFP_TEMPORARY
);
2406 kbuf
= (char *) page
;
2409 if (copy_from_user(kbuf
, buffer
, left
)) {
2416 for (; left
&& vleft
--; i
++, first
= 0) {
2422 left
-= proc_skip_spaces(&kbuf
);
2424 err
= proc_get_long(&kbuf
, &left
, &val
, &neg
,
2426 sizeof(proc_wspace_sep
), NULL
);
2431 val
= convmul
* val
/ convdiv
;
2432 if ((min
&& val
< *min
) || (max
&& val
> *max
))
2436 val
= convdiv
* (*i
) / convmul
;
2438 err
= proc_put_char(&buffer
, &left
, '\t');
2442 err
= proc_put_long(&buffer
, &left
, val
, false);
2448 if (!write
&& !first
&& left
&& !err
)
2449 err
= proc_put_char(&buffer
, &left
, '\n');
2451 left
-= proc_skip_spaces(&kbuf
);
2456 return err
? : -EINVAL
;
2464 static int do_proc_doulongvec_minmax(struct ctl_table
*table
, int write
,
2465 void __user
*buffer
,
2466 size_t *lenp
, loff_t
*ppos
,
2467 unsigned long convmul
,
2468 unsigned long convdiv
)
2470 return __do_proc_doulongvec_minmax(table
->data
, table
, write
,
2471 buffer
, lenp
, ppos
, convmul
, convdiv
);
2475 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2476 * @table: the sysctl table
2477 * @write: %TRUE if this is a write to the sysctl file
2478 * @buffer: the user buffer
2479 * @lenp: the size of the user buffer
2480 * @ppos: file position
2482 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2483 * values from/to the user buffer, treated as an ASCII string.
2485 * This routine will ensure the values are within the range specified by
2486 * table->extra1 (min) and table->extra2 (max).
2488 * Returns 0 on success.
2490 int proc_doulongvec_minmax(struct ctl_table
*table
, int write
,
2491 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2493 return do_proc_doulongvec_minmax(table
, write
, buffer
, lenp
, ppos
, 1l, 1l);
2497 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2498 * @table: the sysctl table
2499 * @write: %TRUE if this is a write to the sysctl file
2500 * @buffer: the user buffer
2501 * @lenp: the size of the user buffer
2502 * @ppos: file position
2504 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2505 * values from/to the user buffer, treated as an ASCII string. The values
2506 * are treated as milliseconds, and converted to jiffies when they are stored.
2508 * This routine will ensure the values are within the range specified by
2509 * table->extra1 (min) and table->extra2 (max).
2511 * Returns 0 on success.
2513 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table
*table
, int write
,
2514 void __user
*buffer
,
2515 size_t *lenp
, loff_t
*ppos
)
2517 return do_proc_doulongvec_minmax(table
, write
, buffer
,
2518 lenp
, ppos
, HZ
, 1000l);
2522 static int do_proc_dointvec_jiffies_conv(bool *negp
, unsigned long *lvalp
,
2524 int write
, void *data
)
2527 if (*lvalp
> LONG_MAX
/ HZ
)
2529 *valp
= *negp
? -(*lvalp
*HZ
) : (*lvalp
*HZ
);
2535 lval
= -(unsigned long)val
;
2538 lval
= (unsigned long)val
;
2545 static int do_proc_dointvec_userhz_jiffies_conv(bool *negp
, unsigned long *lvalp
,
2547 int write
, void *data
)
2550 if (USER_HZ
< HZ
&& *lvalp
> (LONG_MAX
/ HZ
) * USER_HZ
)
2552 *valp
= clock_t_to_jiffies(*negp
? -*lvalp
: *lvalp
);
2558 lval
= -(unsigned long)val
;
2561 lval
= (unsigned long)val
;
2563 *lvalp
= jiffies_to_clock_t(lval
);
2568 static int do_proc_dointvec_ms_jiffies_conv(bool *negp
, unsigned long *lvalp
,
2570 int write
, void *data
)
2573 unsigned long jif
= msecs_to_jiffies(*negp
? -*lvalp
: *lvalp
);
2583 lval
= -(unsigned long)val
;
2586 lval
= (unsigned long)val
;
2588 *lvalp
= jiffies_to_msecs(lval
);
2594 * proc_dointvec_jiffies - read a vector of integers as seconds
2595 * @table: the sysctl table
2596 * @write: %TRUE if this is a write to the sysctl file
2597 * @buffer: the user buffer
2598 * @lenp: the size of the user buffer
2599 * @ppos: file position
2601 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2602 * values from/to the user buffer, treated as an ASCII string.
2603 * The values read are assumed to be in seconds, and are converted into
2606 * Returns 0 on success.
2608 int proc_dointvec_jiffies(struct ctl_table
*table
, int write
,
2609 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2611 return do_proc_dointvec(table
,write
,buffer
,lenp
,ppos
,
2612 do_proc_dointvec_jiffies_conv
,NULL
);
2616 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2617 * @table: the sysctl table
2618 * @write: %TRUE if this is a write to the sysctl file
2619 * @buffer: the user buffer
2620 * @lenp: the size of the user buffer
2621 * @ppos: pointer to the file position
2623 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2624 * values from/to the user buffer, treated as an ASCII string.
2625 * The values read are assumed to be in 1/USER_HZ seconds, and
2626 * are converted into jiffies.
2628 * Returns 0 on success.
2630 int proc_dointvec_userhz_jiffies(struct ctl_table
*table
, int write
,
2631 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2633 return do_proc_dointvec(table
,write
,buffer
,lenp
,ppos
,
2634 do_proc_dointvec_userhz_jiffies_conv
,NULL
);
2638 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2639 * @table: the sysctl table
2640 * @write: %TRUE if this is a write to the sysctl file
2641 * @buffer: the user buffer
2642 * @lenp: the size of the user buffer
2643 * @ppos: file position
2644 * @ppos: the current position in the file
2646 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2647 * values from/to the user buffer, treated as an ASCII string.
2648 * The values read are assumed to be in 1/1000 seconds, and
2649 * are converted into jiffies.
2651 * Returns 0 on success.
2653 int proc_dointvec_ms_jiffies(struct ctl_table
*table
, int write
,
2654 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2656 return do_proc_dointvec(table
, write
, buffer
, lenp
, ppos
,
2657 do_proc_dointvec_ms_jiffies_conv
, NULL
);
2660 static int proc_do_cad_pid(struct ctl_table
*table
, int write
,
2661 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2663 struct pid
*new_pid
;
2667 tmp
= pid_vnr(cad_pid
);
2669 r
= __do_proc_dointvec(&tmp
, table
, write
, buffer
,
2670 lenp
, ppos
, NULL
, NULL
);
2674 new_pid
= find_get_pid(tmp
);
2678 put_pid(xchg(&cad_pid
, new_pid
));
2683 * proc_do_large_bitmap - read/write from/to a large bitmap
2684 * @table: the sysctl table
2685 * @write: %TRUE if this is a write to the sysctl file
2686 * @buffer: the user buffer
2687 * @lenp: the size of the user buffer
2688 * @ppos: file position
2690 * The bitmap is stored at table->data and the bitmap length (in bits)
2693 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2694 * large bitmaps may be represented in a compact manner. Writing into
2695 * the file will clear the bitmap then update it with the given input.
2697 * Returns 0 on success.
2699 int proc_do_large_bitmap(struct ctl_table
*table
, int write
,
2700 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2704 size_t left
= *lenp
;
2705 unsigned long bitmap_len
= table
->maxlen
;
2706 unsigned long *bitmap
= *(unsigned long **) table
->data
;
2707 unsigned long *tmp_bitmap
= NULL
;
2708 char tr_a
[] = { '-', ',', '\n' }, tr_b
[] = { ',', '\n', 0 }, c
;
2710 if (!bitmap
|| !bitmap_len
|| !left
|| (*ppos
&& !write
)) {
2716 unsigned long page
= 0;
2719 if (left
> PAGE_SIZE
- 1)
2720 left
= PAGE_SIZE
- 1;
2722 page
= __get_free_page(GFP_TEMPORARY
);
2723 kbuf
= (char *) page
;
2726 if (copy_from_user(kbuf
, buffer
, left
)) {
2732 tmp_bitmap
= kzalloc(BITS_TO_LONGS(bitmap_len
) * sizeof(unsigned long),
2738 proc_skip_char(&kbuf
, &left
, '\n');
2739 while (!err
&& left
) {
2740 unsigned long val_a
, val_b
;
2743 err
= proc_get_long(&kbuf
, &left
, &val_a
, &neg
, tr_a
,
2747 if (val_a
>= bitmap_len
|| neg
) {
2759 err
= proc_get_long(&kbuf
, &left
, &val_b
,
2760 &neg
, tr_b
, sizeof(tr_b
),
2764 if (val_b
>= bitmap_len
|| neg
||
2775 bitmap_set(tmp_bitmap
, val_a
, val_b
- val_a
+ 1);
2777 proc_skip_char(&kbuf
, &left
, '\n');
2781 unsigned long bit_a
, bit_b
= 0;
2784 bit_a
= find_next_bit(bitmap
, bitmap_len
, bit_b
);
2785 if (bit_a
>= bitmap_len
)
2787 bit_b
= find_next_zero_bit(bitmap
, bitmap_len
,
2791 err
= proc_put_char(&buffer
, &left
, ',');
2795 err
= proc_put_long(&buffer
, &left
, bit_a
, false);
2798 if (bit_a
!= bit_b
) {
2799 err
= proc_put_char(&buffer
, &left
, '-');
2802 err
= proc_put_long(&buffer
, &left
, bit_b
, false);
2810 err
= proc_put_char(&buffer
, &left
, '\n');
2816 bitmap_or(bitmap
, bitmap
, tmp_bitmap
, bitmap_len
);
2818 bitmap_copy(bitmap
, tmp_bitmap
, bitmap_len
);
2830 #else /* CONFIG_PROC_SYSCTL */
2832 int proc_dostring(struct ctl_table
*table
, int write
,
2833 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2838 int proc_dointvec(struct ctl_table
*table
, int write
,
2839 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2844 int proc_douintvec(struct ctl_table
*table
, int write
,
2845 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2850 int proc_dointvec_minmax(struct ctl_table
*table
, int write
,
2851 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2856 int proc_dointvec_jiffies(struct ctl_table
*table
, int write
,
2857 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2862 int proc_dointvec_userhz_jiffies(struct ctl_table
*table
, int write
,
2863 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2868 int proc_dointvec_ms_jiffies(struct ctl_table
*table
, int write
,
2869 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2874 int proc_doulongvec_minmax(struct ctl_table
*table
, int write
,
2875 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2880 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table
*table
, int write
,
2881 void __user
*buffer
,
2882 size_t *lenp
, loff_t
*ppos
)
2888 #endif /* CONFIG_PROC_SYSCTL */
2891 * No sense putting this after each symbol definition, twice,
2892 * exception granted :-)
2894 EXPORT_SYMBOL(proc_dointvec
);
2895 EXPORT_SYMBOL(proc_douintvec
);
2896 EXPORT_SYMBOL(proc_dointvec_jiffies
);
2897 EXPORT_SYMBOL(proc_dointvec_minmax
);
2898 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies
);
2899 EXPORT_SYMBOL(proc_dointvec_ms_jiffies
);
2900 EXPORT_SYMBOL(proc_dostring
);
2901 EXPORT_SYMBOL(proc_doulongvec_minmax
);
2902 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax
);