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 zero_ul
;
129 static unsigned long one_ul
= 1;
130 static unsigned long long_max
= LONG_MAX
;
131 static int one_hundred
= 100;
133 static int ten_thousand
= 10000;
136 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
137 static unsigned long dirty_bytes_min
= 2 * PAGE_SIZE
;
139 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
140 static int maxolduid
= 65535;
141 static int minolduid
;
143 static int ngroups_max
= NGROUPS_MAX
;
144 static const int cap_last_cap
= CAP_LAST_CAP
;
146 /*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */
147 #ifdef CONFIG_DETECT_HUNG_TASK
148 static unsigned long hung_task_timeout_max
= (LONG_MAX
/HZ
);
151 #ifdef CONFIG_INOTIFY_USER
152 #include <linux/inotify.h>
158 extern int pwrsw_enabled
;
161 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
162 extern int unaligned_enabled
;
166 extern int unaligned_dump_stack
;
169 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
170 extern int no_unaligned_warning
;
173 #ifdef CONFIG_PROC_SYSCTL
175 #define SYSCTL_WRITES_LEGACY -1
176 #define SYSCTL_WRITES_WARN 0
177 #define SYSCTL_WRITES_STRICT 1
179 static int sysctl_writes_strict
= SYSCTL_WRITES_STRICT
;
181 static int proc_do_cad_pid(struct ctl_table
*table
, int write
,
182 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
183 static int proc_taint(struct ctl_table
*table
, int write
,
184 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
188 static int proc_dointvec_minmax_sysadmin(struct ctl_table
*table
, int write
,
189 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
192 static int proc_dointvec_minmax_coredump(struct ctl_table
*table
, int write
,
193 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
194 #ifdef CONFIG_COREDUMP
195 static int proc_dostring_coredump(struct ctl_table
*table
, int write
,
196 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
199 #ifdef CONFIG_MAGIC_SYSRQ
200 /* Note: sysrq code uses it's own private copy */
201 static int __sysrq_enabled
= CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE
;
203 static int sysrq_sysctl_handler(struct ctl_table
*table
, int write
,
204 void __user
*buffer
, size_t *lenp
,
209 error
= proc_dointvec(table
, write
, buffer
, lenp
, ppos
);
214 sysrq_toggle_support(__sysrq_enabled
);
221 static struct ctl_table kern_table
[];
222 static struct ctl_table vm_table
[];
223 static struct ctl_table fs_table
[];
224 static struct ctl_table debug_table
[];
225 static struct ctl_table dev_table
[];
226 extern struct ctl_table random_table
[];
228 extern struct ctl_table epoll_table
[];
231 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
232 int sysctl_legacy_va_layout
;
235 /* The default sysctl tables: */
237 static struct ctl_table sysctl_base_table
[] = {
239 .procname
= "kernel",
256 .child
= debug_table
,
266 #ifdef CONFIG_SCHED_DEBUG
267 static int min_sched_granularity_ns
= 100000; /* 100 usecs */
268 static int max_sched_granularity_ns
= NSEC_PER_SEC
; /* 1 second */
269 static int min_wakeup_granularity_ns
; /* 0 usecs */
270 static int max_wakeup_granularity_ns
= NSEC_PER_SEC
; /* 1 second */
272 static int min_sched_tunable_scaling
= SCHED_TUNABLESCALING_NONE
;
273 static int max_sched_tunable_scaling
= SCHED_TUNABLESCALING_END
-1;
274 #endif /* CONFIG_SMP */
275 #endif /* CONFIG_SCHED_DEBUG */
277 #ifdef CONFIG_COMPACTION
278 static int min_extfrag_threshold
;
279 static int max_extfrag_threshold
= 1000;
282 static struct ctl_table kern_table
[] = {
284 .procname
= "sched_child_runs_first",
285 .data
= &sysctl_sched_child_runs_first
,
286 .maxlen
= sizeof(unsigned int),
288 .proc_handler
= proc_dointvec
,
290 #ifdef CONFIG_SCHED_DEBUG
292 .procname
= "sched_min_granularity_ns",
293 .data
= &sysctl_sched_min_granularity
,
294 .maxlen
= sizeof(unsigned int),
296 .proc_handler
= sched_proc_update_handler
,
297 .extra1
= &min_sched_granularity_ns
,
298 .extra2
= &max_sched_granularity_ns
,
301 .procname
= "sched_latency_ns",
302 .data
= &sysctl_sched_latency
,
303 .maxlen
= sizeof(unsigned int),
305 .proc_handler
= sched_proc_update_handler
,
306 .extra1
= &min_sched_granularity_ns
,
307 .extra2
= &max_sched_granularity_ns
,
310 .procname
= "sched_wakeup_granularity_ns",
311 .data
= &sysctl_sched_wakeup_granularity
,
312 .maxlen
= sizeof(unsigned int),
314 .proc_handler
= sched_proc_update_handler
,
315 .extra1
= &min_wakeup_granularity_ns
,
316 .extra2
= &max_wakeup_granularity_ns
,
320 .procname
= "sched_tunable_scaling",
321 .data
= &sysctl_sched_tunable_scaling
,
322 .maxlen
= sizeof(enum sched_tunable_scaling
),
324 .proc_handler
= sched_proc_update_handler
,
325 .extra1
= &min_sched_tunable_scaling
,
326 .extra2
= &max_sched_tunable_scaling
,
329 .procname
= "sched_migration_cost_ns",
330 .data
= &sysctl_sched_migration_cost
,
331 .maxlen
= sizeof(unsigned int),
333 .proc_handler
= proc_dointvec
,
336 .procname
= "sched_nr_migrate",
337 .data
= &sysctl_sched_nr_migrate
,
338 .maxlen
= sizeof(unsigned int),
340 .proc_handler
= proc_dointvec
,
343 .procname
= "sched_time_avg_ms",
344 .data
= &sysctl_sched_time_avg
,
345 .maxlen
= sizeof(unsigned int),
347 .proc_handler
= proc_dointvec_minmax
,
351 .procname
= "sched_shares_window_ns",
352 .data
= &sysctl_sched_shares_window
,
353 .maxlen
= sizeof(unsigned int),
355 .proc_handler
= proc_dointvec
,
357 #endif /* CONFIG_SMP */
358 #ifdef CONFIG_NUMA_BALANCING
360 .procname
= "numa_balancing_scan_delay_ms",
361 .data
= &sysctl_numa_balancing_scan_delay
,
362 .maxlen
= sizeof(unsigned int),
364 .proc_handler
= proc_dointvec
,
367 .procname
= "numa_balancing_scan_period_min_ms",
368 .data
= &sysctl_numa_balancing_scan_period_min
,
369 .maxlen
= sizeof(unsigned int),
371 .proc_handler
= proc_dointvec
,
374 .procname
= "numa_balancing_scan_period_max_ms",
375 .data
= &sysctl_numa_balancing_scan_period_max
,
376 .maxlen
= sizeof(unsigned int),
378 .proc_handler
= proc_dointvec
,
381 .procname
= "numa_balancing_scan_size_mb",
382 .data
= &sysctl_numa_balancing_scan_size
,
383 .maxlen
= sizeof(unsigned int),
385 .proc_handler
= proc_dointvec_minmax
,
389 .procname
= "numa_balancing",
390 .data
= NULL
, /* filled in by handler */
391 .maxlen
= sizeof(unsigned int),
393 .proc_handler
= sysctl_numa_balancing
,
397 #endif /* CONFIG_NUMA_BALANCING */
398 #endif /* CONFIG_SCHED_DEBUG */
400 .procname
= "sched_rt_period_us",
401 .data
= &sysctl_sched_rt_period
,
402 .maxlen
= sizeof(unsigned int),
404 .proc_handler
= sched_rt_handler
,
407 .procname
= "sched_rt_runtime_us",
408 .data
= &sysctl_sched_rt_runtime
,
409 .maxlen
= sizeof(int),
411 .proc_handler
= sched_rt_handler
,
414 .procname
= "sched_rr_timeslice_ms",
415 .data
= &sched_rr_timeslice
,
416 .maxlen
= sizeof(int),
418 .proc_handler
= sched_rr_handler
,
420 #ifdef CONFIG_SCHED_AUTOGROUP
422 .procname
= "sched_autogroup_enabled",
423 .data
= &sysctl_sched_autogroup_enabled
,
424 .maxlen
= sizeof(unsigned int),
426 .proc_handler
= proc_dointvec_minmax
,
431 #ifdef CONFIG_CFS_BANDWIDTH
433 .procname
= "sched_cfs_bandwidth_slice_us",
434 .data
= &sysctl_sched_cfs_bandwidth_slice
,
435 .maxlen
= sizeof(unsigned int),
437 .proc_handler
= proc_dointvec_minmax
,
441 #ifdef CONFIG_PROVE_LOCKING
443 .procname
= "prove_locking",
444 .data
= &prove_locking
,
445 .maxlen
= sizeof(int),
447 .proc_handler
= proc_dointvec
,
450 #ifdef CONFIG_LOCK_STAT
452 .procname
= "lock_stat",
454 .maxlen
= sizeof(int),
456 .proc_handler
= proc_dointvec
,
461 .data
= &panic_timeout
,
462 .maxlen
= sizeof(int),
464 .proc_handler
= proc_dointvec
,
466 #ifdef CONFIG_COREDUMP
468 .procname
= "core_uses_pid",
469 .data
= &core_uses_pid
,
470 .maxlen
= sizeof(int),
472 .proc_handler
= proc_dointvec
,
475 .procname
= "core_pattern",
476 .data
= core_pattern
,
477 .maxlen
= CORENAME_MAX_SIZE
,
479 .proc_handler
= proc_dostring_coredump
,
482 .procname
= "core_pipe_limit",
483 .data
= &core_pipe_limit
,
484 .maxlen
= sizeof(unsigned int),
486 .proc_handler
= proc_dointvec
,
489 #ifdef CONFIG_PROC_SYSCTL
491 .procname
= "tainted",
492 .maxlen
= sizeof(long),
494 .proc_handler
= proc_taint
,
497 .procname
= "sysctl_writes_strict",
498 .data
= &sysctl_writes_strict
,
499 .maxlen
= sizeof(int),
501 .proc_handler
= proc_dointvec_minmax
,
506 #ifdef CONFIG_LATENCYTOP
508 .procname
= "latencytop",
509 .data
= &latencytop_enabled
,
510 .maxlen
= sizeof(int),
512 .proc_handler
= proc_dointvec
,
515 #ifdef CONFIG_BLK_DEV_INITRD
517 .procname
= "real-root-dev",
518 .data
= &real_root_dev
,
519 .maxlen
= sizeof(int),
521 .proc_handler
= proc_dointvec
,
525 .procname
= "print-fatal-signals",
526 .data
= &print_fatal_signals
,
527 .maxlen
= sizeof(int),
529 .proc_handler
= proc_dointvec
,
533 .procname
= "reboot-cmd",
534 .data
= reboot_command
,
537 .proc_handler
= proc_dostring
,
540 .procname
= "stop-a",
541 .data
= &stop_a_enabled
,
542 .maxlen
= sizeof (int),
544 .proc_handler
= proc_dointvec
,
547 .procname
= "scons-poweroff",
548 .data
= &scons_pwroff
,
549 .maxlen
= sizeof (int),
551 .proc_handler
= proc_dointvec
,
554 #ifdef CONFIG_SPARC64
556 .procname
= "tsb-ratio",
557 .data
= &sysctl_tsb_ratio
,
558 .maxlen
= sizeof (int),
560 .proc_handler
= proc_dointvec
,
565 .procname
= "soft-power",
566 .data
= &pwrsw_enabled
,
567 .maxlen
= sizeof (int),
569 .proc_handler
= proc_dointvec
,
572 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
574 .procname
= "unaligned-trap",
575 .data
= &unaligned_enabled
,
576 .maxlen
= sizeof (int),
578 .proc_handler
= proc_dointvec
,
582 .procname
= "ctrl-alt-del",
584 .maxlen
= sizeof(int),
586 .proc_handler
= proc_dointvec
,
588 #ifdef CONFIG_FUNCTION_TRACER
590 .procname
= "ftrace_enabled",
591 .data
= &ftrace_enabled
,
592 .maxlen
= sizeof(int),
594 .proc_handler
= ftrace_enable_sysctl
,
597 #ifdef CONFIG_STACK_TRACER
599 .procname
= "stack_tracer_enabled",
600 .data
= &stack_tracer_enabled
,
601 .maxlen
= sizeof(int),
603 .proc_handler
= stack_trace_sysctl
,
606 #ifdef CONFIG_TRACING
608 .procname
= "ftrace_dump_on_oops",
609 .data
= &ftrace_dump_on_oops
,
610 .maxlen
= sizeof(int),
612 .proc_handler
= proc_dointvec
,
615 .procname
= "traceoff_on_warning",
616 .data
= &__disable_trace_on_warning
,
617 .maxlen
= sizeof(__disable_trace_on_warning
),
619 .proc_handler
= proc_dointvec
,
622 .procname
= "tracepoint_printk",
623 .data
= &tracepoint_printk
,
624 .maxlen
= sizeof(tracepoint_printk
),
626 .proc_handler
= proc_dointvec
,
629 #ifdef CONFIG_KEXEC_CORE
631 .procname
= "kexec_load_disabled",
632 .data
= &kexec_load_disabled
,
633 .maxlen
= sizeof(int),
635 /* only handle a transition from default "0" to "1" */
636 .proc_handler
= proc_dointvec_minmax
,
641 #ifdef CONFIG_MODULES
643 .procname
= "modprobe",
644 .data
= &modprobe_path
,
645 .maxlen
= KMOD_PATH_LEN
,
647 .proc_handler
= proc_dostring
,
650 .procname
= "modules_disabled",
651 .data
= &modules_disabled
,
652 .maxlen
= sizeof(int),
654 /* only handle a transition from default "0" to "1" */
655 .proc_handler
= proc_dointvec_minmax
,
660 #ifdef CONFIG_UEVENT_HELPER
662 .procname
= "hotplug",
663 .data
= &uevent_helper
,
664 .maxlen
= UEVENT_HELPER_PATH_LEN
,
666 .proc_handler
= proc_dostring
,
669 #ifdef CONFIG_CHR_DEV_SG
671 .procname
= "sg-big-buff",
672 .data
= &sg_big_buff
,
673 .maxlen
= sizeof (int),
675 .proc_handler
= proc_dointvec
,
678 #ifdef CONFIG_BSD_PROCESS_ACCT
682 .maxlen
= 3*sizeof(int),
684 .proc_handler
= proc_dointvec
,
687 #ifdef CONFIG_MAGIC_SYSRQ
690 .data
= &__sysrq_enabled
,
691 .maxlen
= sizeof (int),
693 .proc_handler
= sysrq_sysctl_handler
,
696 #ifdef CONFIG_PROC_SYSCTL
698 .procname
= "cad_pid",
700 .maxlen
= sizeof (int),
702 .proc_handler
= proc_do_cad_pid
,
706 .procname
= "threads-max",
708 .maxlen
= sizeof(int),
710 .proc_handler
= sysctl_max_threads
,
713 .procname
= "random",
715 .child
= random_table
,
718 .procname
= "usermodehelper",
720 .child
= usermodehelper_table
,
723 .procname
= "overflowuid",
724 .data
= &overflowuid
,
725 .maxlen
= sizeof(int),
727 .proc_handler
= proc_dointvec_minmax
,
728 .extra1
= &minolduid
,
729 .extra2
= &maxolduid
,
732 .procname
= "overflowgid",
733 .data
= &overflowgid
,
734 .maxlen
= sizeof(int),
736 .proc_handler
= proc_dointvec_minmax
,
737 .extra1
= &minolduid
,
738 .extra2
= &maxolduid
,
741 #ifdef CONFIG_MATHEMU
743 .procname
= "ieee_emulation_warnings",
744 .data
= &sysctl_ieee_emulation_warnings
,
745 .maxlen
= sizeof(int),
747 .proc_handler
= proc_dointvec
,
751 .procname
= "userprocess_debug",
752 .data
= &show_unhandled_signals
,
753 .maxlen
= sizeof(int),
755 .proc_handler
= proc_dointvec
,
759 .procname
= "pid_max",
761 .maxlen
= sizeof (int),
763 .proc_handler
= proc_dointvec_minmax
,
764 .extra1
= &pid_max_min
,
765 .extra2
= &pid_max_max
,
768 .procname
= "panic_on_oops",
769 .data
= &panic_on_oops
,
770 .maxlen
= sizeof(int),
772 .proc_handler
= proc_dointvec
,
774 #if defined CONFIG_PRINTK
776 .procname
= "printk",
777 .data
= &console_loglevel
,
778 .maxlen
= 4*sizeof(int),
780 .proc_handler
= proc_dointvec
,
783 .procname
= "printk_ratelimit",
784 .data
= &printk_ratelimit_state
.interval
,
785 .maxlen
= sizeof(int),
787 .proc_handler
= proc_dointvec_jiffies
,
790 .procname
= "printk_ratelimit_burst",
791 .data
= &printk_ratelimit_state
.burst
,
792 .maxlen
= sizeof(int),
794 .proc_handler
= proc_dointvec
,
797 .procname
= "printk_delay",
798 .data
= &printk_delay_msec
,
799 .maxlen
= sizeof(int),
801 .proc_handler
= proc_dointvec_minmax
,
803 .extra2
= &ten_thousand
,
806 .procname
= "dmesg_restrict",
807 .data
= &dmesg_restrict
,
808 .maxlen
= sizeof(int),
810 .proc_handler
= proc_dointvec_minmax_sysadmin
,
815 .procname
= "kptr_restrict",
816 .data
= &kptr_restrict
,
817 .maxlen
= sizeof(int),
819 .proc_handler
= proc_dointvec_minmax_sysadmin
,
825 .procname
= "ngroups_max",
826 .data
= &ngroups_max
,
827 .maxlen
= sizeof (int),
829 .proc_handler
= proc_dointvec
,
832 .procname
= "cap_last_cap",
833 .data
= (void *)&cap_last_cap
,
834 .maxlen
= sizeof(int),
836 .proc_handler
= proc_dointvec
,
838 #if defined(CONFIG_LOCKUP_DETECTOR)
840 .procname
= "watchdog",
841 .data
= &watchdog_user_enabled
,
842 .maxlen
= sizeof (int),
844 .proc_handler
= proc_watchdog
,
849 .procname
= "watchdog_thresh",
850 .data
= &watchdog_thresh
,
851 .maxlen
= sizeof(int),
853 .proc_handler
= proc_watchdog_thresh
,
858 .procname
= "nmi_watchdog",
859 .data
= &nmi_watchdog_enabled
,
860 .maxlen
= sizeof (int),
862 .proc_handler
= proc_nmi_watchdog
,
864 #if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
871 .procname
= "soft_watchdog",
872 .data
= &soft_watchdog_enabled
,
873 .maxlen
= sizeof (int),
875 .proc_handler
= proc_soft_watchdog
,
880 .procname
= "watchdog_cpumask",
881 .data
= &watchdog_cpumask_bits
,
884 .proc_handler
= proc_watchdog_cpumask
,
887 .procname
= "softlockup_panic",
888 .data
= &softlockup_panic
,
889 .maxlen
= sizeof(int),
891 .proc_handler
= proc_dointvec_minmax
,
895 #ifdef CONFIG_HARDLOCKUP_DETECTOR
897 .procname
= "hardlockup_panic",
898 .data
= &hardlockup_panic
,
899 .maxlen
= sizeof(int),
901 .proc_handler
= proc_dointvec_minmax
,
908 .procname
= "softlockup_all_cpu_backtrace",
909 .data
= &sysctl_softlockup_all_cpu_backtrace
,
910 .maxlen
= sizeof(int),
912 .proc_handler
= proc_dointvec_minmax
,
917 .procname
= "hardlockup_all_cpu_backtrace",
918 .data
= &sysctl_hardlockup_all_cpu_backtrace
,
919 .maxlen
= sizeof(int),
921 .proc_handler
= proc_dointvec_minmax
,
925 #endif /* CONFIG_SMP */
927 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
929 .procname
= "unknown_nmi_panic",
930 .data
= &unknown_nmi_panic
,
931 .maxlen
= sizeof (int),
933 .proc_handler
= proc_dointvec
,
936 #if defined(CONFIG_X86)
938 .procname
= "panic_on_unrecovered_nmi",
939 .data
= &panic_on_unrecovered_nmi
,
940 .maxlen
= sizeof(int),
942 .proc_handler
= proc_dointvec
,
945 .procname
= "panic_on_io_nmi",
946 .data
= &panic_on_io_nmi
,
947 .maxlen
= sizeof(int),
949 .proc_handler
= proc_dointvec
,
951 #ifdef CONFIG_DEBUG_STACKOVERFLOW
953 .procname
= "panic_on_stackoverflow",
954 .data
= &sysctl_panic_on_stackoverflow
,
955 .maxlen
= sizeof(int),
957 .proc_handler
= proc_dointvec
,
961 .procname
= "bootloader_type",
962 .data
= &bootloader_type
,
963 .maxlen
= sizeof (int),
965 .proc_handler
= proc_dointvec
,
968 .procname
= "bootloader_version",
969 .data
= &bootloader_version
,
970 .maxlen
= sizeof (int),
972 .proc_handler
= proc_dointvec
,
975 .procname
= "kstack_depth_to_print",
976 .data
= &kstack_depth_to_print
,
977 .maxlen
= sizeof(int),
979 .proc_handler
= proc_dointvec
,
982 .procname
= "io_delay_type",
983 .data
= &io_delay_type
,
984 .maxlen
= sizeof(int),
986 .proc_handler
= proc_dointvec
,
989 #if defined(CONFIG_MMU)
991 .procname
= "randomize_va_space",
992 .data
= &randomize_va_space
,
993 .maxlen
= sizeof(int),
995 .proc_handler
= proc_dointvec
,
998 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
1000 .procname
= "spin_retry",
1001 .data
= &spin_retry
,
1002 .maxlen
= sizeof (int),
1004 .proc_handler
= proc_dointvec
,
1007 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
1009 .procname
= "acpi_video_flags",
1010 .data
= &acpi_realmode_flags
,
1011 .maxlen
= sizeof (unsigned long),
1013 .proc_handler
= proc_doulongvec_minmax
,
1016 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
1018 .procname
= "ignore-unaligned-usertrap",
1019 .data
= &no_unaligned_warning
,
1020 .maxlen
= sizeof (int),
1022 .proc_handler
= proc_dointvec
,
1027 .procname
= "unaligned-dump-stack",
1028 .data
= &unaligned_dump_stack
,
1029 .maxlen
= sizeof (int),
1031 .proc_handler
= proc_dointvec
,
1034 #ifdef CONFIG_DETECT_HUNG_TASK
1036 .procname
= "hung_task_panic",
1037 .data
= &sysctl_hung_task_panic
,
1038 .maxlen
= sizeof(int),
1040 .proc_handler
= proc_dointvec_minmax
,
1045 .procname
= "hung_task_check_count",
1046 .data
= &sysctl_hung_task_check_count
,
1047 .maxlen
= sizeof(int),
1049 .proc_handler
= proc_dointvec_minmax
,
1053 .procname
= "hung_task_timeout_secs",
1054 .data
= &sysctl_hung_task_timeout_secs
,
1055 .maxlen
= sizeof(unsigned long),
1057 .proc_handler
= proc_dohung_task_timeout_secs
,
1058 .extra2
= &hung_task_timeout_max
,
1061 .procname
= "hung_task_warnings",
1062 .data
= &sysctl_hung_task_warnings
,
1063 .maxlen
= sizeof(int),
1065 .proc_handler
= proc_dointvec_minmax
,
1069 #ifdef CONFIG_COMPAT
1071 .procname
= "compat-log",
1072 .data
= &compat_log
,
1073 .maxlen
= sizeof (int),
1075 .proc_handler
= proc_dointvec
,
1078 #ifdef CONFIG_RT_MUTEXES
1080 .procname
= "max_lock_depth",
1081 .data
= &max_lock_depth
,
1082 .maxlen
= sizeof(int),
1084 .proc_handler
= proc_dointvec
,
1088 .procname
= "poweroff_cmd",
1089 .data
= &poweroff_cmd
,
1090 .maxlen
= POWEROFF_CMD_PATH_LEN
,
1092 .proc_handler
= proc_dostring
,
1098 .child
= key_sysctls
,
1101 #ifdef CONFIG_PERF_EVENTS
1103 * User-space scripts rely on the existence of this file
1104 * as a feature check for perf_events being enabled.
1106 * So it's an ABI, do not remove!
1109 .procname
= "perf_event_paranoid",
1110 .data
= &sysctl_perf_event_paranoid
,
1111 .maxlen
= sizeof(sysctl_perf_event_paranoid
),
1113 .proc_handler
= proc_dointvec
,
1116 .procname
= "perf_event_mlock_kb",
1117 .data
= &sysctl_perf_event_mlock
,
1118 .maxlen
= sizeof(sysctl_perf_event_mlock
),
1120 .proc_handler
= proc_dointvec
,
1123 .procname
= "perf_event_max_sample_rate",
1124 .data
= &sysctl_perf_event_sample_rate
,
1125 .maxlen
= sizeof(sysctl_perf_event_sample_rate
),
1127 .proc_handler
= perf_proc_update_handler
,
1131 .procname
= "perf_cpu_time_max_percent",
1132 .data
= &sysctl_perf_cpu_time_max_percent
,
1133 .maxlen
= sizeof(sysctl_perf_cpu_time_max_percent
),
1135 .proc_handler
= perf_cpu_time_max_percent_handler
,
1137 .extra2
= &one_hundred
,
1140 #ifdef CONFIG_KMEMCHECK
1142 .procname
= "kmemcheck",
1143 .data
= &kmemcheck_enabled
,
1144 .maxlen
= sizeof(int),
1146 .proc_handler
= proc_dointvec
,
1150 .procname
= "panic_on_warn",
1151 .data
= &panic_on_warn
,
1152 .maxlen
= sizeof(int),
1154 .proc_handler
= proc_dointvec_minmax
,
1158 #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
1160 .procname
= "timer_migration",
1161 .data
= &sysctl_timer_migration
,
1162 .maxlen
= sizeof(unsigned int),
1164 .proc_handler
= timer_migration_handler
,
1169 #ifdef CONFIG_BPF_SYSCALL
1171 .procname
= "unprivileged_bpf_disabled",
1172 .data
= &sysctl_unprivileged_bpf_disabled
,
1173 .maxlen
= sizeof(sysctl_unprivileged_bpf_disabled
),
1175 /* only handle a transition from default "0" to "1" */
1176 .proc_handler
= proc_dointvec_minmax
,
1184 static struct ctl_table vm_table
[] = {
1186 .procname
= "overcommit_memory",
1187 .data
= &sysctl_overcommit_memory
,
1188 .maxlen
= sizeof(sysctl_overcommit_memory
),
1190 .proc_handler
= proc_dointvec_minmax
,
1195 .procname
= "panic_on_oom",
1196 .data
= &sysctl_panic_on_oom
,
1197 .maxlen
= sizeof(sysctl_panic_on_oom
),
1199 .proc_handler
= proc_dointvec_minmax
,
1204 .procname
= "oom_kill_allocating_task",
1205 .data
= &sysctl_oom_kill_allocating_task
,
1206 .maxlen
= sizeof(sysctl_oom_kill_allocating_task
),
1208 .proc_handler
= proc_dointvec
,
1211 .procname
= "oom_dump_tasks",
1212 .data
= &sysctl_oom_dump_tasks
,
1213 .maxlen
= sizeof(sysctl_oom_dump_tasks
),
1215 .proc_handler
= proc_dointvec
,
1218 .procname
= "overcommit_ratio",
1219 .data
= &sysctl_overcommit_ratio
,
1220 .maxlen
= sizeof(sysctl_overcommit_ratio
),
1222 .proc_handler
= overcommit_ratio_handler
,
1225 .procname
= "overcommit_kbytes",
1226 .data
= &sysctl_overcommit_kbytes
,
1227 .maxlen
= sizeof(sysctl_overcommit_kbytes
),
1229 .proc_handler
= overcommit_kbytes_handler
,
1232 .procname
= "page-cluster",
1233 .data
= &page_cluster
,
1234 .maxlen
= sizeof(int),
1236 .proc_handler
= proc_dointvec_minmax
,
1240 .procname
= "dirty_background_ratio",
1241 .data
= &dirty_background_ratio
,
1242 .maxlen
= sizeof(dirty_background_ratio
),
1244 .proc_handler
= dirty_background_ratio_handler
,
1246 .extra2
= &one_hundred
,
1249 .procname
= "dirty_background_bytes",
1250 .data
= &dirty_background_bytes
,
1251 .maxlen
= sizeof(dirty_background_bytes
),
1253 .proc_handler
= dirty_background_bytes_handler
,
1257 .procname
= "dirty_ratio",
1258 .data
= &vm_dirty_ratio
,
1259 .maxlen
= sizeof(vm_dirty_ratio
),
1261 .proc_handler
= dirty_ratio_handler
,
1263 .extra2
= &one_hundred
,
1266 .procname
= "dirty_bytes",
1267 .data
= &vm_dirty_bytes
,
1268 .maxlen
= sizeof(vm_dirty_bytes
),
1270 .proc_handler
= dirty_bytes_handler
,
1271 .extra1
= &dirty_bytes_min
,
1274 .procname
= "dirty_writeback_centisecs",
1275 .data
= &dirty_writeback_interval
,
1276 .maxlen
= sizeof(dirty_writeback_interval
),
1278 .proc_handler
= dirty_writeback_centisecs_handler
,
1281 .procname
= "dirty_expire_centisecs",
1282 .data
= &dirty_expire_interval
,
1283 .maxlen
= sizeof(dirty_expire_interval
),
1285 .proc_handler
= proc_dointvec_minmax
,
1289 .procname
= "dirtytime_expire_seconds",
1290 .data
= &dirtytime_expire_interval
,
1291 .maxlen
= sizeof(dirty_expire_interval
),
1293 .proc_handler
= dirtytime_interval_handler
,
1297 .procname
= "nr_pdflush_threads",
1298 .mode
= 0444 /* read-only */,
1299 .proc_handler
= pdflush_proc_obsolete
,
1302 .procname
= "swappiness",
1303 .data
= &vm_swappiness
,
1304 .maxlen
= sizeof(vm_swappiness
),
1306 .proc_handler
= proc_dointvec_minmax
,
1308 .extra2
= &one_hundred
,
1310 #ifdef CONFIG_HUGETLB_PAGE
1312 .procname
= "nr_hugepages",
1314 .maxlen
= sizeof(unsigned long),
1316 .proc_handler
= hugetlb_sysctl_handler
,
1320 .procname
= "nr_hugepages_mempolicy",
1322 .maxlen
= sizeof(unsigned long),
1324 .proc_handler
= &hugetlb_mempolicy_sysctl_handler
,
1328 .procname
= "hugetlb_shm_group",
1329 .data
= &sysctl_hugetlb_shm_group
,
1330 .maxlen
= sizeof(gid_t
),
1332 .proc_handler
= proc_dointvec
,
1335 .procname
= "hugepages_treat_as_movable",
1336 .data
= &hugepages_treat_as_movable
,
1337 .maxlen
= sizeof(int),
1339 .proc_handler
= proc_dointvec
,
1342 .procname
= "nr_overcommit_hugepages",
1344 .maxlen
= sizeof(unsigned long),
1346 .proc_handler
= hugetlb_overcommit_handler
,
1350 .procname
= "lowmem_reserve_ratio",
1351 .data
= &sysctl_lowmem_reserve_ratio
,
1352 .maxlen
= sizeof(sysctl_lowmem_reserve_ratio
),
1354 .proc_handler
= lowmem_reserve_ratio_sysctl_handler
,
1357 .procname
= "drop_caches",
1358 .data
= &sysctl_drop_caches
,
1359 .maxlen
= sizeof(int),
1361 .proc_handler
= drop_caches_sysctl_handler
,
1365 #ifdef CONFIG_COMPACTION
1367 .procname
= "compact_memory",
1368 .data
= &sysctl_compact_memory
,
1369 .maxlen
= sizeof(int),
1371 .proc_handler
= sysctl_compaction_handler
,
1374 .procname
= "extfrag_threshold",
1375 .data
= &sysctl_extfrag_threshold
,
1376 .maxlen
= sizeof(int),
1378 .proc_handler
= sysctl_extfrag_handler
,
1379 .extra1
= &min_extfrag_threshold
,
1380 .extra2
= &max_extfrag_threshold
,
1383 .procname
= "compact_unevictable_allowed",
1384 .data
= &sysctl_compact_unevictable_allowed
,
1385 .maxlen
= sizeof(int),
1387 .proc_handler
= proc_dointvec
,
1392 #endif /* CONFIG_COMPACTION */
1394 .procname
= "min_free_kbytes",
1395 .data
= &min_free_kbytes
,
1396 .maxlen
= sizeof(min_free_kbytes
),
1398 .proc_handler
= min_free_kbytes_sysctl_handler
,
1402 .procname
= "percpu_pagelist_fraction",
1403 .data
= &percpu_pagelist_fraction
,
1404 .maxlen
= sizeof(percpu_pagelist_fraction
),
1406 .proc_handler
= percpu_pagelist_fraction_sysctl_handler
,
1411 .procname
= "max_map_count",
1412 .data
= &sysctl_max_map_count
,
1413 .maxlen
= sizeof(sysctl_max_map_count
),
1415 .proc_handler
= proc_dointvec_minmax
,
1420 .procname
= "nr_trim_pages",
1421 .data
= &sysctl_nr_trim_pages
,
1422 .maxlen
= sizeof(sysctl_nr_trim_pages
),
1424 .proc_handler
= proc_dointvec_minmax
,
1429 .procname
= "laptop_mode",
1430 .data
= &laptop_mode
,
1431 .maxlen
= sizeof(laptop_mode
),
1433 .proc_handler
= proc_dointvec_jiffies
,
1436 .procname
= "block_dump",
1437 .data
= &block_dump
,
1438 .maxlen
= sizeof(block_dump
),
1440 .proc_handler
= proc_dointvec
,
1444 .procname
= "vfs_cache_pressure",
1445 .data
= &sysctl_vfs_cache_pressure
,
1446 .maxlen
= sizeof(sysctl_vfs_cache_pressure
),
1448 .proc_handler
= proc_dointvec
,
1451 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1453 .procname
= "legacy_va_layout",
1454 .data
= &sysctl_legacy_va_layout
,
1455 .maxlen
= sizeof(sysctl_legacy_va_layout
),
1457 .proc_handler
= proc_dointvec
,
1463 .procname
= "zone_reclaim_mode",
1464 .data
= &zone_reclaim_mode
,
1465 .maxlen
= sizeof(zone_reclaim_mode
),
1467 .proc_handler
= proc_dointvec
,
1471 .procname
= "min_unmapped_ratio",
1472 .data
= &sysctl_min_unmapped_ratio
,
1473 .maxlen
= sizeof(sysctl_min_unmapped_ratio
),
1475 .proc_handler
= sysctl_min_unmapped_ratio_sysctl_handler
,
1477 .extra2
= &one_hundred
,
1480 .procname
= "min_slab_ratio",
1481 .data
= &sysctl_min_slab_ratio
,
1482 .maxlen
= sizeof(sysctl_min_slab_ratio
),
1484 .proc_handler
= sysctl_min_slab_ratio_sysctl_handler
,
1486 .extra2
= &one_hundred
,
1491 .procname
= "stat_interval",
1492 .data
= &sysctl_stat_interval
,
1493 .maxlen
= sizeof(sysctl_stat_interval
),
1495 .proc_handler
= proc_dointvec_jiffies
,
1500 .procname
= "mmap_min_addr",
1501 .data
= &dac_mmap_min_addr
,
1502 .maxlen
= sizeof(unsigned long),
1504 .proc_handler
= mmap_min_addr_handler
,
1509 .procname
= "numa_zonelist_order",
1510 .data
= &numa_zonelist_order
,
1511 .maxlen
= NUMA_ZONELIST_ORDER_LEN
,
1513 .proc_handler
= numa_zonelist_order_handler
,
1516 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1517 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1519 .procname
= "vdso_enabled",
1520 #ifdef CONFIG_X86_32
1521 .data
= &vdso32_enabled
,
1522 .maxlen
= sizeof(vdso32_enabled
),
1524 .data
= &vdso_enabled
,
1525 .maxlen
= sizeof(vdso_enabled
),
1528 .proc_handler
= proc_dointvec
,
1532 #ifdef CONFIG_HIGHMEM
1534 .procname
= "highmem_is_dirtyable",
1535 .data
= &vm_highmem_is_dirtyable
,
1536 .maxlen
= sizeof(vm_highmem_is_dirtyable
),
1538 .proc_handler
= proc_dointvec_minmax
,
1543 #ifdef CONFIG_MEMORY_FAILURE
1545 .procname
= "memory_failure_early_kill",
1546 .data
= &sysctl_memory_failure_early_kill
,
1547 .maxlen
= sizeof(sysctl_memory_failure_early_kill
),
1549 .proc_handler
= proc_dointvec_minmax
,
1554 .procname
= "memory_failure_recovery",
1555 .data
= &sysctl_memory_failure_recovery
,
1556 .maxlen
= sizeof(sysctl_memory_failure_recovery
),
1558 .proc_handler
= proc_dointvec_minmax
,
1564 .procname
= "user_reserve_kbytes",
1565 .data
= &sysctl_user_reserve_kbytes
,
1566 .maxlen
= sizeof(sysctl_user_reserve_kbytes
),
1568 .proc_handler
= proc_doulongvec_minmax
,
1571 .procname
= "admin_reserve_kbytes",
1572 .data
= &sysctl_admin_reserve_kbytes
,
1573 .maxlen
= sizeof(sysctl_admin_reserve_kbytes
),
1575 .proc_handler
= proc_doulongvec_minmax
,
1580 static struct ctl_table fs_table
[] = {
1582 .procname
= "inode-nr",
1583 .data
= &inodes_stat
,
1584 .maxlen
= 2*sizeof(long),
1586 .proc_handler
= proc_nr_inodes
,
1589 .procname
= "inode-state",
1590 .data
= &inodes_stat
,
1591 .maxlen
= 7*sizeof(long),
1593 .proc_handler
= proc_nr_inodes
,
1596 .procname
= "file-nr",
1597 .data
= &files_stat
,
1598 .maxlen
= sizeof(files_stat
),
1600 .proc_handler
= proc_nr_files
,
1603 .procname
= "file-max",
1604 .data
= &files_stat
.max_files
,
1605 .maxlen
= sizeof(files_stat
.max_files
),
1607 .proc_handler
= proc_doulongvec_minmax
,
1609 .extra2
= &long_max
,
1612 .procname
= "nr_open",
1613 .data
= &sysctl_nr_open
,
1614 .maxlen
= sizeof(int),
1616 .proc_handler
= proc_dointvec_minmax
,
1617 .extra1
= &sysctl_nr_open_min
,
1618 .extra2
= &sysctl_nr_open_max
,
1621 .procname
= "dentry-state",
1622 .data
= &dentry_stat
,
1623 .maxlen
= 6*sizeof(long),
1625 .proc_handler
= proc_nr_dentry
,
1628 .procname
= "overflowuid",
1629 .data
= &fs_overflowuid
,
1630 .maxlen
= sizeof(int),
1632 .proc_handler
= proc_dointvec_minmax
,
1633 .extra1
= &minolduid
,
1634 .extra2
= &maxolduid
,
1637 .procname
= "overflowgid",
1638 .data
= &fs_overflowgid
,
1639 .maxlen
= sizeof(int),
1641 .proc_handler
= proc_dointvec_minmax
,
1642 .extra1
= &minolduid
,
1643 .extra2
= &maxolduid
,
1645 #ifdef CONFIG_FILE_LOCKING
1647 .procname
= "leases-enable",
1648 .data
= &leases_enable
,
1649 .maxlen
= sizeof(int),
1651 .proc_handler
= proc_dointvec
,
1654 #ifdef CONFIG_DNOTIFY
1656 .procname
= "dir-notify-enable",
1657 .data
= &dir_notify_enable
,
1658 .maxlen
= sizeof(int),
1660 .proc_handler
= proc_dointvec
,
1664 #ifdef CONFIG_FILE_LOCKING
1666 .procname
= "lease-break-time",
1667 .data
= &lease_break_time
,
1668 .maxlen
= sizeof(int),
1670 .proc_handler
= proc_dointvec
,
1675 .procname
= "aio-nr",
1677 .maxlen
= sizeof(aio_nr
),
1679 .proc_handler
= proc_doulongvec_minmax
,
1682 .procname
= "aio-max-nr",
1683 .data
= &aio_max_nr
,
1684 .maxlen
= sizeof(aio_max_nr
),
1686 .proc_handler
= proc_doulongvec_minmax
,
1688 #endif /* CONFIG_AIO */
1689 #ifdef CONFIG_INOTIFY_USER
1691 .procname
= "inotify",
1693 .child
= inotify_table
,
1698 .procname
= "epoll",
1700 .child
= epoll_table
,
1705 .procname
= "protected_symlinks",
1706 .data
= &sysctl_protected_symlinks
,
1707 .maxlen
= sizeof(int),
1709 .proc_handler
= proc_dointvec_minmax
,
1714 .procname
= "protected_hardlinks",
1715 .data
= &sysctl_protected_hardlinks
,
1716 .maxlen
= sizeof(int),
1718 .proc_handler
= proc_dointvec_minmax
,
1723 .procname
= "protected_fifos",
1724 .data
= &sysctl_protected_fifos
,
1725 .maxlen
= sizeof(int),
1727 .proc_handler
= proc_dointvec_minmax
,
1732 .procname
= "protected_regular",
1733 .data
= &sysctl_protected_regular
,
1734 .maxlen
= sizeof(int),
1736 .proc_handler
= proc_dointvec_minmax
,
1741 .procname
= "suid_dumpable",
1742 .data
= &suid_dumpable
,
1743 .maxlen
= sizeof(int),
1745 .proc_handler
= proc_dointvec_minmax_coredump
,
1749 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1751 .procname
= "binfmt_misc",
1753 .child
= sysctl_mount_point
,
1757 .procname
= "pipe-max-size",
1758 .data
= &pipe_max_size
,
1759 .maxlen
= sizeof(int),
1761 .proc_handler
= &pipe_proc_fn
,
1762 .extra1
= &pipe_min_size
,
1765 .procname
= "pipe-user-pages-hard",
1766 .data
= &pipe_user_pages_hard
,
1767 .maxlen
= sizeof(pipe_user_pages_hard
),
1769 .proc_handler
= proc_doulongvec_minmax
,
1772 .procname
= "pipe-user-pages-soft",
1773 .data
= &pipe_user_pages_soft
,
1774 .maxlen
= sizeof(pipe_user_pages_soft
),
1776 .proc_handler
= proc_doulongvec_minmax
,
1779 .procname
= "mount-max",
1780 .data
= &sysctl_mount_max
,
1781 .maxlen
= sizeof(unsigned int),
1783 .proc_handler
= proc_dointvec_minmax
,
1789 static struct ctl_table debug_table
[] = {
1790 #ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
1792 .procname
= "exception-trace",
1793 .data
= &show_unhandled_signals
,
1794 .maxlen
= sizeof(int),
1796 .proc_handler
= proc_dointvec
1799 #if defined(CONFIG_OPTPROBES)
1801 .procname
= "kprobes-optimization",
1802 .data
= &sysctl_kprobes_optimization
,
1803 .maxlen
= sizeof(int),
1805 .proc_handler
= proc_kprobes_optimization_handler
,
1813 static struct ctl_table dev_table
[] = {
1817 int __init
sysctl_init(void)
1819 struct ctl_table_header
*hdr
;
1821 hdr
= register_sysctl_table(sysctl_base_table
);
1822 kmemleak_not_leak(hdr
);
1826 #endif /* CONFIG_SYSCTL */
1832 #ifdef CONFIG_PROC_SYSCTL
1834 static int _proc_do_string(char *data
, int maxlen
, int write
,
1835 char __user
*buffer
,
1836 size_t *lenp
, loff_t
*ppos
)
1842 if (!data
|| !maxlen
|| !*lenp
) {
1848 if (sysctl_writes_strict
== SYSCTL_WRITES_STRICT
) {
1849 /* Only continue writes not past the end of buffer. */
1851 if (len
> maxlen
- 1)
1858 /* Start writing from beginning of buffer. */
1864 while ((p
- buffer
) < *lenp
&& len
< maxlen
- 1) {
1865 if (get_user(c
, p
++))
1867 if (c
== 0 || c
== '\n')
1888 if (copy_to_user(buffer
, data
, len
))
1891 if (put_user('\n', buffer
+ len
))
1901 static void warn_sysctl_write(struct ctl_table
*table
)
1903 pr_warn_once("%s wrote to %s when file position was not 0!\n"
1904 "This will not be supported in the future. To silence this\n"
1905 "warning, set kernel.sysctl_writes_strict = -1\n",
1906 current
->comm
, table
->procname
);
1910 * proc_dostring - read a string sysctl
1911 * @table: the sysctl table
1912 * @write: %TRUE if this is a write to the sysctl file
1913 * @buffer: the user buffer
1914 * @lenp: the size of the user buffer
1915 * @ppos: file position
1917 * Reads/writes a string from/to the user buffer. If the kernel
1918 * buffer provided is not large enough to hold the string, the
1919 * string is truncated. The copied string is %NULL-terminated.
1920 * If the string is being read by the user process, it is copied
1921 * and a newline '\n' is added. It is truncated if the buffer is
1924 * Returns 0 on success.
1926 int proc_dostring(struct ctl_table
*table
, int write
,
1927 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
1929 if (write
&& *ppos
&& sysctl_writes_strict
== SYSCTL_WRITES_WARN
)
1930 warn_sysctl_write(table
);
1932 return _proc_do_string((char *)(table
->data
), table
->maxlen
, write
,
1933 (char __user
*)buffer
, lenp
, ppos
);
1936 static size_t proc_skip_spaces(char **buf
)
1939 char *tmp
= skip_spaces(*buf
);
1945 static void proc_skip_char(char **buf
, size_t *size
, const char v
)
1955 #define TMPBUFLEN 22
1957 * proc_get_long - reads an ASCII formatted integer from a user buffer
1959 * @buf: a kernel buffer
1960 * @size: size of the kernel buffer
1961 * @val: this is where the number will be stored
1962 * @neg: set to %TRUE if number is negative
1963 * @perm_tr: a vector which contains the allowed trailers
1964 * @perm_tr_len: size of the perm_tr vector
1965 * @tr: pointer to store the trailer character
1967 * In case of success %0 is returned and @buf and @size are updated with
1968 * the amount of bytes read. If @tr is non-NULL and a trailing
1969 * character exists (size is non-zero after returning from this
1970 * function), @tr is updated with the trailing character.
1972 static int proc_get_long(char **buf
, size_t *size
,
1973 unsigned long *val
, bool *neg
,
1974 const char *perm_tr
, unsigned perm_tr_len
, char *tr
)
1977 char *p
, tmp
[TMPBUFLEN
];
1983 if (len
> TMPBUFLEN
- 1)
1984 len
= TMPBUFLEN
- 1;
1986 memcpy(tmp
, *buf
, len
);
1990 if (*p
== '-' && *size
> 1) {
1998 *val
= simple_strtoul(p
, &p
, 0);
2002 /* We don't know if the next char is whitespace thus we may accept
2003 * invalid integers (e.g. 1234...a) or two integers instead of one
2004 * (e.g. 123...1). So lets not allow such large numbers. */
2005 if (len
== TMPBUFLEN
- 1)
2008 if (len
< *size
&& perm_tr_len
&& !memchr(perm_tr
, *p
, perm_tr_len
))
2011 if (tr
&& (len
< *size
))
2021 * proc_put_long - converts an integer to a decimal ASCII formatted string
2023 * @buf: the user buffer
2024 * @size: the size of the user buffer
2025 * @val: the integer to be converted
2026 * @neg: sign of the number, %TRUE for negative
2028 * In case of success %0 is returned and @buf and @size are updated with
2029 * the amount of bytes written.
2031 static int proc_put_long(void __user
**buf
, size_t *size
, unsigned long val
,
2035 char tmp
[TMPBUFLEN
], *p
= tmp
;
2037 sprintf(p
, "%s%lu", neg
? "-" : "", val
);
2041 if (copy_to_user(*buf
, tmp
, len
))
2049 static int proc_put_char(void __user
**buf
, size_t *size
, char c
)
2052 char __user
**buffer
= (char __user
**)buf
;
2053 if (put_user(c
, *buffer
))
2055 (*size
)--, (*buffer
)++;
2061 static int do_proc_dointvec_conv(bool *negp
, unsigned long *lvalp
,
2063 int write
, void *data
)
2067 if (*lvalp
> (unsigned long) INT_MAX
+ 1)
2071 if (*lvalp
> (unsigned long) INT_MAX
)
2079 *lvalp
= -(unsigned long)val
;
2082 *lvalp
= (unsigned long)val
;
2088 static int do_proc_douintvec_conv(bool *negp
, unsigned long *lvalp
,
2090 int write
, void *data
)
2095 if (*lvalp
> UINT_MAX
)
2099 unsigned int val
= *valp
;
2101 *lvalp
= (unsigned long)val
;
2106 static const char proc_wspace_sep
[] = { ' ', '\t', '\n' };
2108 static int __do_proc_dointvec(void *tbl_data
, struct ctl_table
*table
,
2109 int write
, void __user
*buffer
,
2110 size_t *lenp
, loff_t
*ppos
,
2111 int (*conv
)(bool *negp
, unsigned long *lvalp
, int *valp
,
2112 int write
, void *data
),
2115 int *i
, vleft
, first
= 1, err
= 0;
2116 unsigned long page
= 0;
2120 if (!tbl_data
|| !table
->maxlen
|| !*lenp
|| (*ppos
&& !write
)) {
2125 i
= (int *) tbl_data
;
2126 vleft
= table
->maxlen
/ sizeof(*i
);
2130 conv
= do_proc_dointvec_conv
;
2134 switch (sysctl_writes_strict
) {
2135 case SYSCTL_WRITES_STRICT
:
2137 case SYSCTL_WRITES_WARN
:
2138 warn_sysctl_write(table
);
2145 if (left
> PAGE_SIZE
- 1)
2146 left
= PAGE_SIZE
- 1;
2147 page
= __get_free_page(GFP_TEMPORARY
);
2148 kbuf
= (char *) page
;
2151 if (copy_from_user(kbuf
, buffer
, left
)) {
2158 for (; left
&& vleft
--; i
++, first
=0) {
2163 left
-= proc_skip_spaces(&kbuf
);
2167 err
= proc_get_long(&kbuf
, &left
, &lval
, &neg
,
2169 sizeof(proc_wspace_sep
), NULL
);
2172 if (conv(&neg
, &lval
, i
, 1, data
)) {
2177 if (conv(&neg
, &lval
, i
, 0, data
)) {
2182 err
= proc_put_char(&buffer
, &left
, '\t');
2185 err
= proc_put_long(&buffer
, &left
, lval
, neg
);
2191 if (!write
&& !first
&& left
&& !err
)
2192 err
= proc_put_char(&buffer
, &left
, '\n');
2193 if (write
&& !err
&& left
)
2194 left
-= proc_skip_spaces(&kbuf
);
2199 return err
? : -EINVAL
;
2207 static int do_proc_dointvec(struct ctl_table
*table
, int write
,
2208 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
,
2209 int (*conv
)(bool *negp
, unsigned long *lvalp
, int *valp
,
2210 int write
, void *data
),
2213 return __do_proc_dointvec(table
->data
, table
, write
,
2214 buffer
, lenp
, ppos
, conv
, data
);
2218 * proc_dointvec - read a vector of integers
2219 * @table: the sysctl table
2220 * @write: %TRUE if this is a write to the sysctl file
2221 * @buffer: the user buffer
2222 * @lenp: the size of the user buffer
2223 * @ppos: file position
2225 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2226 * values from/to the user buffer, treated as an ASCII string.
2228 * Returns 0 on success.
2230 int proc_dointvec(struct ctl_table
*table
, int write
,
2231 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2233 return do_proc_dointvec(table
, write
, buffer
, lenp
, ppos
, NULL
, NULL
);
2237 * proc_douintvec - read a vector of unsigned integers
2238 * @table: the sysctl table
2239 * @write: %TRUE if this is a write to the sysctl file
2240 * @buffer: the user buffer
2241 * @lenp: the size of the user buffer
2242 * @ppos: file position
2244 * Reads/writes up to table->maxlen/sizeof(unsigned int) unsigned integer
2245 * values from/to the user buffer, treated as an ASCII string.
2247 * Returns 0 on success.
2249 int proc_douintvec(struct ctl_table
*table
, int write
,
2250 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2252 return do_proc_dointvec(table
, write
, buffer
, lenp
, ppos
,
2253 do_proc_douintvec_conv
, NULL
);
2257 * Taint values can only be increased
2258 * This means we can safely use a temporary.
2260 static int proc_taint(struct ctl_table
*table
, int write
,
2261 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2264 unsigned long tmptaint
= get_taint();
2267 if (write
&& !capable(CAP_SYS_ADMIN
))
2272 err
= proc_doulongvec_minmax(&t
, write
, buffer
, lenp
, ppos
);
2278 * Poor man's atomic or. Not worth adding a primitive
2279 * to everyone's atomic.h for this
2282 for (i
= 0; i
< BITS_PER_LONG
&& tmptaint
>> i
; i
++) {
2283 if ((tmptaint
>> i
) & 1)
2284 add_taint(i
, LOCKDEP_STILL_OK
);
2291 #ifdef CONFIG_PRINTK
2292 static int proc_dointvec_minmax_sysadmin(struct ctl_table
*table
, int write
,
2293 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2295 if (write
&& !capable(CAP_SYS_ADMIN
))
2298 return proc_dointvec_minmax(table
, write
, buffer
, lenp
, ppos
);
2302 struct do_proc_dointvec_minmax_conv_param
{
2307 static int do_proc_dointvec_minmax_conv(bool *negp
, unsigned long *lvalp
,
2309 int write
, void *data
)
2311 struct do_proc_dointvec_minmax_conv_param
*param
= data
;
2315 if (*lvalp
> (unsigned long) INT_MAX
+ 1)
2319 if (*lvalp
> (unsigned long) INT_MAX
)
2323 if ((param
->min
&& *param
->min
> val
) ||
2324 (param
->max
&& *param
->max
< val
))
2331 *lvalp
= -(unsigned long)val
;
2334 *lvalp
= (unsigned long)val
;
2341 * proc_dointvec_minmax - read a vector of integers with min/max values
2342 * @table: the sysctl table
2343 * @write: %TRUE if this is a write to the sysctl file
2344 * @buffer: the user buffer
2345 * @lenp: the size of the user buffer
2346 * @ppos: file position
2348 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2349 * values from/to the user buffer, treated as an ASCII string.
2351 * This routine will ensure the values are within the range specified by
2352 * table->extra1 (min) and table->extra2 (max).
2354 * Returns 0 on success.
2356 int proc_dointvec_minmax(struct ctl_table
*table
, int write
,
2357 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2359 struct do_proc_dointvec_minmax_conv_param param
= {
2360 .min
= (int *) table
->extra1
,
2361 .max
= (int *) table
->extra2
,
2363 return do_proc_dointvec(table
, write
, buffer
, lenp
, ppos
,
2364 do_proc_dointvec_minmax_conv
, ¶m
);
2367 static void validate_coredump_safety(void)
2369 #ifdef CONFIG_COREDUMP
2370 if (suid_dumpable
== SUID_DUMP_ROOT
&&
2371 core_pattern
[0] != '/' && core_pattern
[0] != '|') {
2372 printk(KERN_WARNING
"Unsafe core_pattern used with "\
2373 "suid_dumpable=2. Pipe handler or fully qualified "\
2374 "core dump path required.\n");
2379 static int proc_dointvec_minmax_coredump(struct ctl_table
*table
, int write
,
2380 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2382 int error
= proc_dointvec_minmax(table
, write
, buffer
, lenp
, ppos
);
2384 validate_coredump_safety();
2388 #ifdef CONFIG_COREDUMP
2389 static int proc_dostring_coredump(struct ctl_table
*table
, int write
,
2390 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2392 int error
= proc_dostring(table
, write
, buffer
, lenp
, ppos
);
2394 validate_coredump_safety();
2399 static int __do_proc_doulongvec_minmax(void *data
, struct ctl_table
*table
, int write
,
2400 void __user
*buffer
,
2401 size_t *lenp
, loff_t
*ppos
,
2402 unsigned long convmul
,
2403 unsigned long convdiv
)
2405 unsigned long *i
, *min
, *max
;
2406 int vleft
, first
= 1, err
= 0;
2407 unsigned long page
= 0;
2411 if (!data
|| !table
->maxlen
|| !*lenp
|| (*ppos
&& !write
)) {
2416 i
= (unsigned long *) data
;
2417 min
= (unsigned long *) table
->extra1
;
2418 max
= (unsigned long *) table
->extra2
;
2419 vleft
= table
->maxlen
/ sizeof(unsigned long);
2424 switch (sysctl_writes_strict
) {
2425 case SYSCTL_WRITES_STRICT
:
2427 case SYSCTL_WRITES_WARN
:
2428 warn_sysctl_write(table
);
2435 if (left
> PAGE_SIZE
- 1)
2436 left
= PAGE_SIZE
- 1;
2437 page
= __get_free_page(GFP_TEMPORARY
);
2438 kbuf
= (char *) page
;
2441 if (copy_from_user(kbuf
, buffer
, left
)) {
2448 for (; left
&& vleft
--; i
++, first
= 0) {
2454 left
-= proc_skip_spaces(&kbuf
);
2456 err
= proc_get_long(&kbuf
, &left
, &val
, &neg
,
2458 sizeof(proc_wspace_sep
), NULL
);
2463 val
= convmul
* val
/ convdiv
;
2464 if ((min
&& val
< *min
) || (max
&& val
> *max
)) {
2470 val
= convdiv
* (*i
) / convmul
;
2472 err
= proc_put_char(&buffer
, &left
, '\t');
2476 err
= proc_put_long(&buffer
, &left
, val
, false);
2482 if (!write
&& !first
&& left
&& !err
)
2483 err
= proc_put_char(&buffer
, &left
, '\n');
2485 left
-= proc_skip_spaces(&kbuf
);
2490 return err
? : -EINVAL
;
2498 static int do_proc_doulongvec_minmax(struct ctl_table
*table
, int write
,
2499 void __user
*buffer
,
2500 size_t *lenp
, loff_t
*ppos
,
2501 unsigned long convmul
,
2502 unsigned long convdiv
)
2504 return __do_proc_doulongvec_minmax(table
->data
, table
, write
,
2505 buffer
, lenp
, ppos
, convmul
, convdiv
);
2509 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2510 * @table: the sysctl table
2511 * @write: %TRUE if this is a write to the sysctl file
2512 * @buffer: the user buffer
2513 * @lenp: the size of the user buffer
2514 * @ppos: file position
2516 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2517 * values from/to the user buffer, treated as an ASCII string.
2519 * This routine will ensure the values are within the range specified by
2520 * table->extra1 (min) and table->extra2 (max).
2522 * Returns 0 on success.
2524 int proc_doulongvec_minmax(struct ctl_table
*table
, int write
,
2525 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2527 return do_proc_doulongvec_minmax(table
, write
, buffer
, lenp
, ppos
, 1l, 1l);
2531 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2532 * @table: the sysctl table
2533 * @write: %TRUE if this is a write to the sysctl file
2534 * @buffer: the user buffer
2535 * @lenp: the size of the user buffer
2536 * @ppos: file position
2538 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2539 * values from/to the user buffer, treated as an ASCII string. The values
2540 * are treated as milliseconds, and converted to jiffies when they are stored.
2542 * This routine will ensure the values are within the range specified by
2543 * table->extra1 (min) and table->extra2 (max).
2545 * Returns 0 on success.
2547 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table
*table
, int write
,
2548 void __user
*buffer
,
2549 size_t *lenp
, loff_t
*ppos
)
2551 return do_proc_doulongvec_minmax(table
, write
, buffer
,
2552 lenp
, ppos
, HZ
, 1000l);
2556 static int do_proc_dointvec_jiffies_conv(bool *negp
, unsigned long *lvalp
,
2558 int write
, void *data
)
2561 if (*lvalp
> LONG_MAX
/ HZ
)
2563 *valp
= *negp
? -(*lvalp
*HZ
) : (*lvalp
*HZ
);
2569 lval
= -(unsigned long)val
;
2572 lval
= (unsigned long)val
;
2579 static int do_proc_dointvec_userhz_jiffies_conv(bool *negp
, unsigned long *lvalp
,
2581 int write
, void *data
)
2584 if (USER_HZ
< HZ
&& *lvalp
> (LONG_MAX
/ HZ
) * USER_HZ
)
2586 *valp
= clock_t_to_jiffies(*negp
? -*lvalp
: *lvalp
);
2592 lval
= -(unsigned long)val
;
2595 lval
= (unsigned long)val
;
2597 *lvalp
= jiffies_to_clock_t(lval
);
2602 static int do_proc_dointvec_ms_jiffies_conv(bool *negp
, unsigned long *lvalp
,
2604 int write
, void *data
)
2607 unsigned long jif
= msecs_to_jiffies(*negp
? -*lvalp
: *lvalp
);
2617 lval
= -(unsigned long)val
;
2620 lval
= (unsigned long)val
;
2622 *lvalp
= jiffies_to_msecs(lval
);
2628 * proc_dointvec_jiffies - read a vector of integers as seconds
2629 * @table: the sysctl table
2630 * @write: %TRUE if this is a write to the sysctl file
2631 * @buffer: the user buffer
2632 * @lenp: the size of the user buffer
2633 * @ppos: file position
2635 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2636 * values from/to the user buffer, treated as an ASCII string.
2637 * The values read are assumed to be in seconds, and are converted into
2640 * Returns 0 on success.
2642 int proc_dointvec_jiffies(struct ctl_table
*table
, int write
,
2643 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2645 return do_proc_dointvec(table
,write
,buffer
,lenp
,ppos
,
2646 do_proc_dointvec_jiffies_conv
,NULL
);
2650 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2651 * @table: the sysctl table
2652 * @write: %TRUE if this is a write to the sysctl file
2653 * @buffer: the user buffer
2654 * @lenp: the size of the user buffer
2655 * @ppos: pointer to the file position
2657 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2658 * values from/to the user buffer, treated as an ASCII string.
2659 * The values read are assumed to be in 1/USER_HZ seconds, and
2660 * are converted into jiffies.
2662 * Returns 0 on success.
2664 int proc_dointvec_userhz_jiffies(struct ctl_table
*table
, int write
,
2665 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2667 return do_proc_dointvec(table
,write
,buffer
,lenp
,ppos
,
2668 do_proc_dointvec_userhz_jiffies_conv
,NULL
);
2672 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2673 * @table: the sysctl table
2674 * @write: %TRUE if this is a write to the sysctl file
2675 * @buffer: the user buffer
2676 * @lenp: the size of the user buffer
2677 * @ppos: file position
2678 * @ppos: the current position in the file
2680 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2681 * values from/to the user buffer, treated as an ASCII string.
2682 * The values read are assumed to be in 1/1000 seconds, and
2683 * are converted into jiffies.
2685 * Returns 0 on success.
2687 int proc_dointvec_ms_jiffies(struct ctl_table
*table
, int write
,
2688 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2690 return do_proc_dointvec(table
, write
, buffer
, lenp
, ppos
,
2691 do_proc_dointvec_ms_jiffies_conv
, NULL
);
2694 static int proc_do_cad_pid(struct ctl_table
*table
, int write
,
2695 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2697 struct pid
*new_pid
;
2701 tmp
= pid_vnr(cad_pid
);
2703 r
= __do_proc_dointvec(&tmp
, table
, write
, buffer
,
2704 lenp
, ppos
, NULL
, NULL
);
2708 new_pid
= find_get_pid(tmp
);
2712 put_pid(xchg(&cad_pid
, new_pid
));
2717 * proc_do_large_bitmap - read/write from/to a large bitmap
2718 * @table: the sysctl table
2719 * @write: %TRUE if this is a write to the sysctl file
2720 * @buffer: the user buffer
2721 * @lenp: the size of the user buffer
2722 * @ppos: file position
2724 * The bitmap is stored at table->data and the bitmap length (in bits)
2727 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2728 * large bitmaps may be represented in a compact manner. Writing into
2729 * the file will clear the bitmap then update it with the given input.
2731 * Returns 0 on success.
2733 int proc_do_large_bitmap(struct ctl_table
*table
, int write
,
2734 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2738 size_t left
= *lenp
;
2739 unsigned long bitmap_len
= table
->maxlen
;
2740 unsigned long *bitmap
= *(unsigned long **) table
->data
;
2741 unsigned long *tmp_bitmap
= NULL
;
2742 char tr_a
[] = { '-', ',', '\n' }, tr_b
[] = { ',', '\n', 0 }, c
;
2744 if (!bitmap
|| !bitmap_len
|| !left
|| (*ppos
&& !write
)) {
2750 unsigned long page
= 0;
2753 if (left
> PAGE_SIZE
- 1)
2754 left
= PAGE_SIZE
- 1;
2756 page
= __get_free_page(GFP_TEMPORARY
);
2757 kbuf
= (char *) page
;
2760 if (copy_from_user(kbuf
, buffer
, left
)) {
2766 tmp_bitmap
= kzalloc(BITS_TO_LONGS(bitmap_len
) * sizeof(unsigned long),
2772 proc_skip_char(&kbuf
, &left
, '\n');
2773 while (!err
&& left
) {
2774 unsigned long val_a
, val_b
;
2777 err
= proc_get_long(&kbuf
, &left
, &val_a
, &neg
, tr_a
,
2781 if (val_a
>= bitmap_len
|| neg
) {
2793 err
= proc_get_long(&kbuf
, &left
, &val_b
,
2794 &neg
, tr_b
, sizeof(tr_b
),
2798 if (val_b
>= bitmap_len
|| neg
||
2809 bitmap_set(tmp_bitmap
, val_a
, val_b
- val_a
+ 1);
2811 proc_skip_char(&kbuf
, &left
, '\n');
2815 unsigned long bit_a
, bit_b
= 0;
2818 bit_a
= find_next_bit(bitmap
, bitmap_len
, bit_b
);
2819 if (bit_a
>= bitmap_len
)
2821 bit_b
= find_next_zero_bit(bitmap
, bitmap_len
,
2825 err
= proc_put_char(&buffer
, &left
, ',');
2829 err
= proc_put_long(&buffer
, &left
, bit_a
, false);
2832 if (bit_a
!= bit_b
) {
2833 err
= proc_put_char(&buffer
, &left
, '-');
2836 err
= proc_put_long(&buffer
, &left
, bit_b
, false);
2844 err
= proc_put_char(&buffer
, &left
, '\n');
2850 bitmap_or(bitmap
, bitmap
, tmp_bitmap
, bitmap_len
);
2852 bitmap_copy(bitmap
, tmp_bitmap
, bitmap_len
);
2864 #else /* CONFIG_PROC_SYSCTL */
2866 int proc_dostring(struct ctl_table
*table
, int write
,
2867 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2872 int proc_dointvec(struct ctl_table
*table
, int write
,
2873 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2878 int proc_douintvec(struct ctl_table
*table
, int write
,
2879 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2884 int proc_dointvec_minmax(struct ctl_table
*table
, int write
,
2885 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2890 int proc_dointvec_jiffies(struct ctl_table
*table
, int write
,
2891 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2896 int proc_dointvec_userhz_jiffies(struct ctl_table
*table
, int write
,
2897 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2902 int proc_dointvec_ms_jiffies(struct ctl_table
*table
, int write
,
2903 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2908 int proc_doulongvec_minmax(struct ctl_table
*table
, int write
,
2909 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2914 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table
*table
, int write
,
2915 void __user
*buffer
,
2916 size_t *lenp
, loff_t
*ppos
)
2922 #endif /* CONFIG_PROC_SYSCTL */
2925 * No sense putting this after each symbol definition, twice,
2926 * exception granted :-)
2928 EXPORT_SYMBOL(proc_dointvec
);
2929 EXPORT_SYMBOL(proc_douintvec
);
2930 EXPORT_SYMBOL(proc_dointvec_jiffies
);
2931 EXPORT_SYMBOL(proc_dointvec_minmax
);
2932 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies
);
2933 EXPORT_SYMBOL(proc_dointvec_ms_jiffies
);
2934 EXPORT_SYMBOL(proc_dostring
);
2935 EXPORT_SYMBOL(proc_doulongvec_minmax
);
2936 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax
);