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>
69 #include <asm/uaccess.h>
70 #include <asm/processor.h>
74 #include <asm/stacktrace.h>
78 #include <asm/setup.h>
80 #ifdef CONFIG_BSD_PROCESS_ACCT
81 #include <linux/acct.h>
83 #ifdef CONFIG_RT_MUTEXES
84 #include <linux/rtmutex.h>
86 #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
87 #include <linux/lockdep.h>
89 #ifdef CONFIG_CHR_DEV_SG
93 #ifdef CONFIG_LOCKUP_DETECTOR
94 #include <linux/nmi.h>
97 #if defined(CONFIG_SYSCTL)
99 /* External variables not in a header file. */
100 extern int suid_dumpable
;
101 #ifdef CONFIG_COREDUMP
102 extern int core_uses_pid
;
103 extern char core_pattern
[];
104 extern unsigned int core_pipe_limit
;
107 extern int pid_max_min
, pid_max_max
;
108 extern int percpu_pagelist_fraction
;
109 extern int compat_log
;
110 extern int latencytop_enabled
;
111 extern int sysctl_nr_open_min
, sysctl_nr_open_max
;
113 extern int sysctl_nr_trim_pages
;
116 /* Constants used for minimum and maximum */
117 #ifdef CONFIG_LOCKUP_DETECTOR
118 static int sixty
= 60;
121 static int __maybe_unused neg_one
= -1;
124 static int __maybe_unused one
= 1;
125 static int __maybe_unused two
= 2;
126 static int __maybe_unused four
= 4;
127 static unsigned long one_ul
= 1;
128 static int one_hundred
= 100;
129 static int one_thousand
= 1000;
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 #ifdef CONFIG_SCHEDSTATS
356 .procname
= "sched_schedstats",
358 .maxlen
= sizeof(unsigned int),
360 .proc_handler
= sysctl_schedstats
,
364 #endif /* CONFIG_SCHEDSTATS */
365 #endif /* CONFIG_SMP */
366 #ifdef CONFIG_NUMA_BALANCING
368 .procname
= "numa_balancing_scan_delay_ms",
369 .data
= &sysctl_numa_balancing_scan_delay
,
370 .maxlen
= sizeof(unsigned int),
372 .proc_handler
= proc_dointvec
,
375 .procname
= "numa_balancing_scan_period_min_ms",
376 .data
= &sysctl_numa_balancing_scan_period_min
,
377 .maxlen
= sizeof(unsigned int),
379 .proc_handler
= proc_dointvec
,
382 .procname
= "numa_balancing_scan_period_max_ms",
383 .data
= &sysctl_numa_balancing_scan_period_max
,
384 .maxlen
= sizeof(unsigned int),
386 .proc_handler
= proc_dointvec
,
389 .procname
= "numa_balancing_scan_size_mb",
390 .data
= &sysctl_numa_balancing_scan_size
,
391 .maxlen
= sizeof(unsigned int),
393 .proc_handler
= proc_dointvec_minmax
,
397 .procname
= "numa_balancing",
398 .data
= NULL
, /* filled in by handler */
399 .maxlen
= sizeof(unsigned int),
401 .proc_handler
= sysctl_numa_balancing
,
405 #endif /* CONFIG_NUMA_BALANCING */
406 #endif /* CONFIG_SCHED_DEBUG */
408 .procname
= "sched_rt_period_us",
409 .data
= &sysctl_sched_rt_period
,
410 .maxlen
= sizeof(unsigned int),
412 .proc_handler
= sched_rt_handler
,
415 .procname
= "sched_rt_runtime_us",
416 .data
= &sysctl_sched_rt_runtime
,
417 .maxlen
= sizeof(int),
419 .proc_handler
= sched_rt_handler
,
422 .procname
= "sched_rr_timeslice_ms",
423 .data
= &sched_rr_timeslice
,
424 .maxlen
= sizeof(int),
426 .proc_handler
= sched_rr_handler
,
428 #ifdef CONFIG_SCHED_AUTOGROUP
430 .procname
= "sched_autogroup_enabled",
431 .data
= &sysctl_sched_autogroup_enabled
,
432 .maxlen
= sizeof(unsigned int),
434 .proc_handler
= proc_dointvec_minmax
,
439 #ifdef CONFIG_CFS_BANDWIDTH
441 .procname
= "sched_cfs_bandwidth_slice_us",
442 .data
= &sysctl_sched_cfs_bandwidth_slice
,
443 .maxlen
= sizeof(unsigned int),
445 .proc_handler
= proc_dointvec_minmax
,
449 #ifdef CONFIG_PROVE_LOCKING
451 .procname
= "prove_locking",
452 .data
= &prove_locking
,
453 .maxlen
= sizeof(int),
455 .proc_handler
= proc_dointvec
,
458 #ifdef CONFIG_LOCK_STAT
460 .procname
= "lock_stat",
462 .maxlen
= sizeof(int),
464 .proc_handler
= proc_dointvec
,
469 .data
= &panic_timeout
,
470 .maxlen
= sizeof(int),
472 .proc_handler
= proc_dointvec
,
474 #ifdef CONFIG_COREDUMP
476 .procname
= "core_uses_pid",
477 .data
= &core_uses_pid
,
478 .maxlen
= sizeof(int),
480 .proc_handler
= proc_dointvec
,
483 .procname
= "core_pattern",
484 .data
= core_pattern
,
485 .maxlen
= CORENAME_MAX_SIZE
,
487 .proc_handler
= proc_dostring_coredump
,
490 .procname
= "core_pipe_limit",
491 .data
= &core_pipe_limit
,
492 .maxlen
= sizeof(unsigned int),
494 .proc_handler
= proc_dointvec
,
497 #ifdef CONFIG_PROC_SYSCTL
499 .procname
= "tainted",
500 .maxlen
= sizeof(long),
502 .proc_handler
= proc_taint
,
505 .procname
= "sysctl_writes_strict",
506 .data
= &sysctl_writes_strict
,
507 .maxlen
= sizeof(int),
509 .proc_handler
= proc_dointvec_minmax
,
514 #ifdef CONFIG_LATENCYTOP
516 .procname
= "latencytop",
517 .data
= &latencytop_enabled
,
518 .maxlen
= sizeof(int),
520 .proc_handler
= sysctl_latencytop
,
523 #ifdef CONFIG_BLK_DEV_INITRD
525 .procname
= "real-root-dev",
526 .data
= &real_root_dev
,
527 .maxlen
= sizeof(int),
529 .proc_handler
= proc_dointvec
,
533 .procname
= "print-fatal-signals",
534 .data
= &print_fatal_signals
,
535 .maxlen
= sizeof(int),
537 .proc_handler
= proc_dointvec
,
541 .procname
= "reboot-cmd",
542 .data
= reboot_command
,
545 .proc_handler
= proc_dostring
,
548 .procname
= "stop-a",
549 .data
= &stop_a_enabled
,
550 .maxlen
= sizeof (int),
552 .proc_handler
= proc_dointvec
,
555 .procname
= "scons-poweroff",
556 .data
= &scons_pwroff
,
557 .maxlen
= sizeof (int),
559 .proc_handler
= proc_dointvec
,
562 #ifdef CONFIG_SPARC64
564 .procname
= "tsb-ratio",
565 .data
= &sysctl_tsb_ratio
,
566 .maxlen
= sizeof (int),
568 .proc_handler
= proc_dointvec
,
573 .procname
= "soft-power",
574 .data
= &pwrsw_enabled
,
575 .maxlen
= sizeof (int),
577 .proc_handler
= proc_dointvec
,
580 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
582 .procname
= "unaligned-trap",
583 .data
= &unaligned_enabled
,
584 .maxlen
= sizeof (int),
586 .proc_handler
= proc_dointvec
,
590 .procname
= "ctrl-alt-del",
592 .maxlen
= sizeof(int),
594 .proc_handler
= proc_dointvec
,
596 #ifdef CONFIG_FUNCTION_TRACER
598 .procname
= "ftrace_enabled",
599 .data
= &ftrace_enabled
,
600 .maxlen
= sizeof(int),
602 .proc_handler
= ftrace_enable_sysctl
,
605 #ifdef CONFIG_STACK_TRACER
607 .procname
= "stack_tracer_enabled",
608 .data
= &stack_tracer_enabled
,
609 .maxlen
= sizeof(int),
611 .proc_handler
= stack_trace_sysctl
,
614 #ifdef CONFIG_TRACING
616 .procname
= "ftrace_dump_on_oops",
617 .data
= &ftrace_dump_on_oops
,
618 .maxlen
= sizeof(int),
620 .proc_handler
= proc_dointvec
,
623 .procname
= "traceoff_on_warning",
624 .data
= &__disable_trace_on_warning
,
625 .maxlen
= sizeof(__disable_trace_on_warning
),
627 .proc_handler
= proc_dointvec
,
630 .procname
= "tracepoint_printk",
631 .data
= &tracepoint_printk
,
632 .maxlen
= sizeof(tracepoint_printk
),
634 .proc_handler
= proc_dointvec
,
637 #ifdef CONFIG_KEXEC_CORE
639 .procname
= "kexec_load_disabled",
640 .data
= &kexec_load_disabled
,
641 .maxlen
= sizeof(int),
643 /* only handle a transition from default "0" to "1" */
644 .proc_handler
= proc_dointvec_minmax
,
649 #ifdef CONFIG_MODULES
651 .procname
= "modprobe",
652 .data
= &modprobe_path
,
653 .maxlen
= KMOD_PATH_LEN
,
655 .proc_handler
= proc_dostring
,
658 .procname
= "modules_disabled",
659 .data
= &modules_disabled
,
660 .maxlen
= sizeof(int),
662 /* only handle a transition from default "0" to "1" */
663 .proc_handler
= proc_dointvec_minmax
,
668 #ifdef CONFIG_UEVENT_HELPER
670 .procname
= "hotplug",
671 .data
= &uevent_helper
,
672 .maxlen
= UEVENT_HELPER_PATH_LEN
,
674 .proc_handler
= proc_dostring
,
677 #ifdef CONFIG_CHR_DEV_SG
679 .procname
= "sg-big-buff",
680 .data
= &sg_big_buff
,
681 .maxlen
= sizeof (int),
683 .proc_handler
= proc_dointvec
,
686 #ifdef CONFIG_BSD_PROCESS_ACCT
690 .maxlen
= 3*sizeof(int),
692 .proc_handler
= proc_dointvec
,
695 #ifdef CONFIG_MAGIC_SYSRQ
698 .data
= &__sysrq_enabled
,
699 .maxlen
= sizeof (int),
701 .proc_handler
= sysrq_sysctl_handler
,
704 #ifdef CONFIG_PROC_SYSCTL
706 .procname
= "cad_pid",
708 .maxlen
= sizeof (int),
710 .proc_handler
= proc_do_cad_pid
,
714 .procname
= "threads-max",
716 .maxlen
= sizeof(int),
718 .proc_handler
= sysctl_max_threads
,
721 .procname
= "random",
723 .child
= random_table
,
726 .procname
= "usermodehelper",
728 .child
= usermodehelper_table
,
731 .procname
= "overflowuid",
732 .data
= &overflowuid
,
733 .maxlen
= sizeof(int),
735 .proc_handler
= proc_dointvec_minmax
,
736 .extra1
= &minolduid
,
737 .extra2
= &maxolduid
,
740 .procname
= "overflowgid",
741 .data
= &overflowgid
,
742 .maxlen
= sizeof(int),
744 .proc_handler
= proc_dointvec_minmax
,
745 .extra1
= &minolduid
,
746 .extra2
= &maxolduid
,
749 #ifdef CONFIG_MATHEMU
751 .procname
= "ieee_emulation_warnings",
752 .data
= &sysctl_ieee_emulation_warnings
,
753 .maxlen
= sizeof(int),
755 .proc_handler
= proc_dointvec
,
759 .procname
= "userprocess_debug",
760 .data
= &show_unhandled_signals
,
761 .maxlen
= sizeof(int),
763 .proc_handler
= proc_dointvec
,
767 .procname
= "pid_max",
769 .maxlen
= sizeof (int),
771 .proc_handler
= proc_dointvec_minmax
,
772 .extra1
= &pid_max_min
,
773 .extra2
= &pid_max_max
,
776 .procname
= "panic_on_oops",
777 .data
= &panic_on_oops
,
778 .maxlen
= sizeof(int),
780 .proc_handler
= proc_dointvec
,
782 #if defined CONFIG_PRINTK
784 .procname
= "printk",
785 .data
= &console_loglevel
,
786 .maxlen
= 4*sizeof(int),
788 .proc_handler
= proc_dointvec
,
791 .procname
= "printk_ratelimit",
792 .data
= &printk_ratelimit_state
.interval
,
793 .maxlen
= sizeof(int),
795 .proc_handler
= proc_dointvec_jiffies
,
798 .procname
= "printk_ratelimit_burst",
799 .data
= &printk_ratelimit_state
.burst
,
800 .maxlen
= sizeof(int),
802 .proc_handler
= proc_dointvec
,
805 .procname
= "printk_delay",
806 .data
= &printk_delay_msec
,
807 .maxlen
= sizeof(int),
809 .proc_handler
= proc_dointvec_minmax
,
811 .extra2
= &ten_thousand
,
814 .procname
= "dmesg_restrict",
815 .data
= &dmesg_restrict
,
816 .maxlen
= sizeof(int),
818 .proc_handler
= proc_dointvec_minmax_sysadmin
,
823 .procname
= "kptr_restrict",
824 .data
= &kptr_restrict
,
825 .maxlen
= sizeof(int),
827 .proc_handler
= proc_dointvec_minmax_sysadmin
,
833 .procname
= "ngroups_max",
834 .data
= &ngroups_max
,
835 .maxlen
= sizeof (int),
837 .proc_handler
= proc_dointvec
,
840 .procname
= "cap_last_cap",
841 .data
= (void *)&cap_last_cap
,
842 .maxlen
= sizeof(int),
844 .proc_handler
= proc_dointvec
,
846 #if defined(CONFIG_LOCKUP_DETECTOR)
848 .procname
= "watchdog",
849 .data
= &watchdog_user_enabled
,
850 .maxlen
= sizeof (int),
852 .proc_handler
= proc_watchdog
,
857 .procname
= "watchdog_thresh",
858 .data
= &watchdog_thresh
,
859 .maxlen
= sizeof(int),
861 .proc_handler
= proc_watchdog_thresh
,
866 .procname
= "nmi_watchdog",
867 .data
= &nmi_watchdog_enabled
,
868 .maxlen
= sizeof (int),
870 .proc_handler
= proc_nmi_watchdog
,
872 #if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
879 .procname
= "soft_watchdog",
880 .data
= &soft_watchdog_enabled
,
881 .maxlen
= sizeof (int),
883 .proc_handler
= proc_soft_watchdog
,
888 .procname
= "watchdog_cpumask",
889 .data
= &watchdog_cpumask_bits
,
892 .proc_handler
= proc_watchdog_cpumask
,
895 .procname
= "softlockup_panic",
896 .data
= &softlockup_panic
,
897 .maxlen
= sizeof(int),
899 .proc_handler
= proc_dointvec_minmax
,
903 #ifdef CONFIG_HARDLOCKUP_DETECTOR
905 .procname
= "hardlockup_panic",
906 .data
= &hardlockup_panic
,
907 .maxlen
= sizeof(int),
909 .proc_handler
= proc_dointvec_minmax
,
916 .procname
= "softlockup_all_cpu_backtrace",
917 .data
= &sysctl_softlockup_all_cpu_backtrace
,
918 .maxlen
= sizeof(int),
920 .proc_handler
= proc_dointvec_minmax
,
925 .procname
= "hardlockup_all_cpu_backtrace",
926 .data
= &sysctl_hardlockup_all_cpu_backtrace
,
927 .maxlen
= sizeof(int),
929 .proc_handler
= proc_dointvec_minmax
,
933 #endif /* CONFIG_SMP */
935 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
937 .procname
= "unknown_nmi_panic",
938 .data
= &unknown_nmi_panic
,
939 .maxlen
= sizeof (int),
941 .proc_handler
= proc_dointvec
,
944 #if defined(CONFIG_X86)
946 .procname
= "panic_on_unrecovered_nmi",
947 .data
= &panic_on_unrecovered_nmi
,
948 .maxlen
= sizeof(int),
950 .proc_handler
= proc_dointvec
,
953 .procname
= "panic_on_io_nmi",
954 .data
= &panic_on_io_nmi
,
955 .maxlen
= sizeof(int),
957 .proc_handler
= proc_dointvec
,
959 #ifdef CONFIG_DEBUG_STACKOVERFLOW
961 .procname
= "panic_on_stackoverflow",
962 .data
= &sysctl_panic_on_stackoverflow
,
963 .maxlen
= sizeof(int),
965 .proc_handler
= proc_dointvec
,
969 .procname
= "bootloader_type",
970 .data
= &bootloader_type
,
971 .maxlen
= sizeof (int),
973 .proc_handler
= proc_dointvec
,
976 .procname
= "bootloader_version",
977 .data
= &bootloader_version
,
978 .maxlen
= sizeof (int),
980 .proc_handler
= proc_dointvec
,
983 .procname
= "kstack_depth_to_print",
984 .data
= &kstack_depth_to_print
,
985 .maxlen
= sizeof(int),
987 .proc_handler
= proc_dointvec
,
990 .procname
= "io_delay_type",
991 .data
= &io_delay_type
,
992 .maxlen
= sizeof(int),
994 .proc_handler
= proc_dointvec
,
997 #if defined(CONFIG_MMU)
999 .procname
= "randomize_va_space",
1000 .data
= &randomize_va_space
,
1001 .maxlen
= sizeof(int),
1003 .proc_handler
= proc_dointvec
,
1006 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
1008 .procname
= "spin_retry",
1009 .data
= &spin_retry
,
1010 .maxlen
= sizeof (int),
1012 .proc_handler
= proc_dointvec
,
1015 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
1017 .procname
= "acpi_video_flags",
1018 .data
= &acpi_realmode_flags
,
1019 .maxlen
= sizeof (unsigned long),
1021 .proc_handler
= proc_doulongvec_minmax
,
1024 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
1026 .procname
= "ignore-unaligned-usertrap",
1027 .data
= &no_unaligned_warning
,
1028 .maxlen
= sizeof (int),
1030 .proc_handler
= proc_dointvec
,
1035 .procname
= "unaligned-dump-stack",
1036 .data
= &unaligned_dump_stack
,
1037 .maxlen
= sizeof (int),
1039 .proc_handler
= proc_dointvec
,
1042 #ifdef CONFIG_DETECT_HUNG_TASK
1044 .procname
= "hung_task_panic",
1045 .data
= &sysctl_hung_task_panic
,
1046 .maxlen
= sizeof(int),
1048 .proc_handler
= proc_dointvec_minmax
,
1053 .procname
= "hung_task_check_count",
1054 .data
= &sysctl_hung_task_check_count
,
1055 .maxlen
= sizeof(int),
1057 .proc_handler
= proc_dointvec_minmax
,
1061 .procname
= "hung_task_timeout_secs",
1062 .data
= &sysctl_hung_task_timeout_secs
,
1063 .maxlen
= sizeof(unsigned long),
1065 .proc_handler
= proc_dohung_task_timeout_secs
,
1066 .extra2
= &hung_task_timeout_max
,
1069 .procname
= "hung_task_warnings",
1070 .data
= &sysctl_hung_task_warnings
,
1071 .maxlen
= sizeof(int),
1073 .proc_handler
= proc_dointvec_minmax
,
1077 #ifdef CONFIG_COMPAT
1079 .procname
= "compat-log",
1080 .data
= &compat_log
,
1081 .maxlen
= sizeof (int),
1083 .proc_handler
= proc_dointvec
,
1086 #ifdef CONFIG_RT_MUTEXES
1088 .procname
= "max_lock_depth",
1089 .data
= &max_lock_depth
,
1090 .maxlen
= sizeof(int),
1092 .proc_handler
= proc_dointvec
,
1096 .procname
= "poweroff_cmd",
1097 .data
= &poweroff_cmd
,
1098 .maxlen
= POWEROFF_CMD_PATH_LEN
,
1100 .proc_handler
= proc_dostring
,
1106 .child
= key_sysctls
,
1109 #ifdef CONFIG_PERF_EVENTS
1111 * User-space scripts rely on the existence of this file
1112 * as a feature check for perf_events being enabled.
1114 * So it's an ABI, do not remove!
1117 .procname
= "perf_event_paranoid",
1118 .data
= &sysctl_perf_event_paranoid
,
1119 .maxlen
= sizeof(sysctl_perf_event_paranoid
),
1121 .proc_handler
= proc_dointvec
,
1124 .procname
= "perf_event_mlock_kb",
1125 .data
= &sysctl_perf_event_mlock
,
1126 .maxlen
= sizeof(sysctl_perf_event_mlock
),
1128 .proc_handler
= proc_dointvec
,
1131 .procname
= "perf_event_max_sample_rate",
1132 .data
= &sysctl_perf_event_sample_rate
,
1133 .maxlen
= sizeof(sysctl_perf_event_sample_rate
),
1135 .proc_handler
= perf_proc_update_handler
,
1139 .procname
= "perf_cpu_time_max_percent",
1140 .data
= &sysctl_perf_cpu_time_max_percent
,
1141 .maxlen
= sizeof(sysctl_perf_cpu_time_max_percent
),
1143 .proc_handler
= perf_cpu_time_max_percent_handler
,
1145 .extra2
= &one_hundred
,
1148 #ifdef CONFIG_KMEMCHECK
1150 .procname
= "kmemcheck",
1151 .data
= &kmemcheck_enabled
,
1152 .maxlen
= sizeof(int),
1154 .proc_handler
= proc_dointvec
,
1158 .procname
= "panic_on_warn",
1159 .data
= &panic_on_warn
,
1160 .maxlen
= sizeof(int),
1162 .proc_handler
= proc_dointvec_minmax
,
1166 #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
1168 .procname
= "timer_migration",
1169 .data
= &sysctl_timer_migration
,
1170 .maxlen
= sizeof(unsigned int),
1172 .proc_handler
= timer_migration_handler
,
1175 #ifdef CONFIG_BPF_SYSCALL
1177 .procname
= "unprivileged_bpf_disabled",
1178 .data
= &sysctl_unprivileged_bpf_disabled
,
1179 .maxlen
= sizeof(sysctl_unprivileged_bpf_disabled
),
1181 /* only handle a transition from default "0" to "1" */
1182 .proc_handler
= proc_dointvec_minmax
,
1190 static struct ctl_table vm_table
[] = {
1192 .procname
= "overcommit_memory",
1193 .data
= &sysctl_overcommit_memory
,
1194 .maxlen
= sizeof(sysctl_overcommit_memory
),
1196 .proc_handler
= proc_dointvec_minmax
,
1201 .procname
= "panic_on_oom",
1202 .data
= &sysctl_panic_on_oom
,
1203 .maxlen
= sizeof(sysctl_panic_on_oom
),
1205 .proc_handler
= proc_dointvec_minmax
,
1210 .procname
= "oom_kill_allocating_task",
1211 .data
= &sysctl_oom_kill_allocating_task
,
1212 .maxlen
= sizeof(sysctl_oom_kill_allocating_task
),
1214 .proc_handler
= proc_dointvec
,
1217 .procname
= "oom_dump_tasks",
1218 .data
= &sysctl_oom_dump_tasks
,
1219 .maxlen
= sizeof(sysctl_oom_dump_tasks
),
1221 .proc_handler
= proc_dointvec
,
1224 .procname
= "overcommit_ratio",
1225 .data
= &sysctl_overcommit_ratio
,
1226 .maxlen
= sizeof(sysctl_overcommit_ratio
),
1228 .proc_handler
= overcommit_ratio_handler
,
1231 .procname
= "overcommit_kbytes",
1232 .data
= &sysctl_overcommit_kbytes
,
1233 .maxlen
= sizeof(sysctl_overcommit_kbytes
),
1235 .proc_handler
= overcommit_kbytes_handler
,
1238 .procname
= "page-cluster",
1239 .data
= &page_cluster
,
1240 .maxlen
= sizeof(int),
1242 .proc_handler
= proc_dointvec_minmax
,
1246 .procname
= "dirty_background_ratio",
1247 .data
= &dirty_background_ratio
,
1248 .maxlen
= sizeof(dirty_background_ratio
),
1250 .proc_handler
= dirty_background_ratio_handler
,
1252 .extra2
= &one_hundred
,
1255 .procname
= "dirty_background_bytes",
1256 .data
= &dirty_background_bytes
,
1257 .maxlen
= sizeof(dirty_background_bytes
),
1259 .proc_handler
= dirty_background_bytes_handler
,
1263 .procname
= "dirty_ratio",
1264 .data
= &vm_dirty_ratio
,
1265 .maxlen
= sizeof(vm_dirty_ratio
),
1267 .proc_handler
= dirty_ratio_handler
,
1269 .extra2
= &one_hundred
,
1272 .procname
= "dirty_bytes",
1273 .data
= &vm_dirty_bytes
,
1274 .maxlen
= sizeof(vm_dirty_bytes
),
1276 .proc_handler
= dirty_bytes_handler
,
1277 .extra1
= &dirty_bytes_min
,
1280 .procname
= "dirty_writeback_centisecs",
1281 .data
= &dirty_writeback_interval
,
1282 .maxlen
= sizeof(dirty_writeback_interval
),
1284 .proc_handler
= dirty_writeback_centisecs_handler
,
1287 .procname
= "dirty_expire_centisecs",
1288 .data
= &dirty_expire_interval
,
1289 .maxlen
= sizeof(dirty_expire_interval
),
1291 .proc_handler
= proc_dointvec_minmax
,
1295 .procname
= "dirtytime_expire_seconds",
1296 .data
= &dirtytime_expire_interval
,
1297 .maxlen
= sizeof(dirty_expire_interval
),
1299 .proc_handler
= dirtytime_interval_handler
,
1303 .procname
= "nr_pdflush_threads",
1304 .mode
= 0444 /* read-only */,
1305 .proc_handler
= pdflush_proc_obsolete
,
1308 .procname
= "swappiness",
1309 .data
= &vm_swappiness
,
1310 .maxlen
= sizeof(vm_swappiness
),
1312 .proc_handler
= proc_dointvec_minmax
,
1314 .extra2
= &one_hundred
,
1316 #ifdef CONFIG_HUGETLB_PAGE
1318 .procname
= "nr_hugepages",
1320 .maxlen
= sizeof(unsigned long),
1322 .proc_handler
= hugetlb_sysctl_handler
,
1326 .procname
= "nr_hugepages_mempolicy",
1328 .maxlen
= sizeof(unsigned long),
1330 .proc_handler
= &hugetlb_mempolicy_sysctl_handler
,
1334 .procname
= "hugetlb_shm_group",
1335 .data
= &sysctl_hugetlb_shm_group
,
1336 .maxlen
= sizeof(gid_t
),
1338 .proc_handler
= proc_dointvec
,
1341 .procname
= "hugepages_treat_as_movable",
1342 .data
= &hugepages_treat_as_movable
,
1343 .maxlen
= sizeof(int),
1345 .proc_handler
= proc_dointvec
,
1348 .procname
= "nr_overcommit_hugepages",
1350 .maxlen
= sizeof(unsigned long),
1352 .proc_handler
= hugetlb_overcommit_handler
,
1356 .procname
= "lowmem_reserve_ratio",
1357 .data
= &sysctl_lowmem_reserve_ratio
,
1358 .maxlen
= sizeof(sysctl_lowmem_reserve_ratio
),
1360 .proc_handler
= lowmem_reserve_ratio_sysctl_handler
,
1363 .procname
= "drop_caches",
1364 .data
= &sysctl_drop_caches
,
1365 .maxlen
= sizeof(int),
1367 .proc_handler
= drop_caches_sysctl_handler
,
1371 #ifdef CONFIG_COMPACTION
1373 .procname
= "compact_memory",
1374 .data
= &sysctl_compact_memory
,
1375 .maxlen
= sizeof(int),
1377 .proc_handler
= sysctl_compaction_handler
,
1380 .procname
= "extfrag_threshold",
1381 .data
= &sysctl_extfrag_threshold
,
1382 .maxlen
= sizeof(int),
1384 .proc_handler
= sysctl_extfrag_handler
,
1385 .extra1
= &min_extfrag_threshold
,
1386 .extra2
= &max_extfrag_threshold
,
1389 .procname
= "compact_unevictable_allowed",
1390 .data
= &sysctl_compact_unevictable_allowed
,
1391 .maxlen
= sizeof(int),
1393 .proc_handler
= proc_dointvec
,
1398 #endif /* CONFIG_COMPACTION */
1400 .procname
= "min_free_kbytes",
1401 .data
= &min_free_kbytes
,
1402 .maxlen
= sizeof(min_free_kbytes
),
1404 .proc_handler
= min_free_kbytes_sysctl_handler
,
1408 .procname
= "watermark_scale_factor",
1409 .data
= &watermark_scale_factor
,
1410 .maxlen
= sizeof(watermark_scale_factor
),
1412 .proc_handler
= watermark_scale_factor_sysctl_handler
,
1414 .extra2
= &one_thousand
,
1417 .procname
= "percpu_pagelist_fraction",
1418 .data
= &percpu_pagelist_fraction
,
1419 .maxlen
= sizeof(percpu_pagelist_fraction
),
1421 .proc_handler
= percpu_pagelist_fraction_sysctl_handler
,
1426 .procname
= "max_map_count",
1427 .data
= &sysctl_max_map_count
,
1428 .maxlen
= sizeof(sysctl_max_map_count
),
1430 .proc_handler
= proc_dointvec_minmax
,
1435 .procname
= "nr_trim_pages",
1436 .data
= &sysctl_nr_trim_pages
,
1437 .maxlen
= sizeof(sysctl_nr_trim_pages
),
1439 .proc_handler
= proc_dointvec_minmax
,
1444 .procname
= "laptop_mode",
1445 .data
= &laptop_mode
,
1446 .maxlen
= sizeof(laptop_mode
),
1448 .proc_handler
= proc_dointvec_jiffies
,
1451 .procname
= "block_dump",
1452 .data
= &block_dump
,
1453 .maxlen
= sizeof(block_dump
),
1455 .proc_handler
= proc_dointvec
,
1459 .procname
= "vfs_cache_pressure",
1460 .data
= &sysctl_vfs_cache_pressure
,
1461 .maxlen
= sizeof(sysctl_vfs_cache_pressure
),
1463 .proc_handler
= proc_dointvec
,
1466 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1468 .procname
= "legacy_va_layout",
1469 .data
= &sysctl_legacy_va_layout
,
1470 .maxlen
= sizeof(sysctl_legacy_va_layout
),
1472 .proc_handler
= proc_dointvec
,
1478 .procname
= "zone_reclaim_mode",
1479 .data
= &zone_reclaim_mode
,
1480 .maxlen
= sizeof(zone_reclaim_mode
),
1482 .proc_handler
= proc_dointvec
,
1486 .procname
= "min_unmapped_ratio",
1487 .data
= &sysctl_min_unmapped_ratio
,
1488 .maxlen
= sizeof(sysctl_min_unmapped_ratio
),
1490 .proc_handler
= sysctl_min_unmapped_ratio_sysctl_handler
,
1492 .extra2
= &one_hundred
,
1495 .procname
= "min_slab_ratio",
1496 .data
= &sysctl_min_slab_ratio
,
1497 .maxlen
= sizeof(sysctl_min_slab_ratio
),
1499 .proc_handler
= sysctl_min_slab_ratio_sysctl_handler
,
1501 .extra2
= &one_hundred
,
1506 .procname
= "stat_interval",
1507 .data
= &sysctl_stat_interval
,
1508 .maxlen
= sizeof(sysctl_stat_interval
),
1510 .proc_handler
= proc_dointvec_jiffies
,
1515 .procname
= "mmap_min_addr",
1516 .data
= &dac_mmap_min_addr
,
1517 .maxlen
= sizeof(unsigned long),
1519 .proc_handler
= mmap_min_addr_handler
,
1524 .procname
= "numa_zonelist_order",
1525 .data
= &numa_zonelist_order
,
1526 .maxlen
= NUMA_ZONELIST_ORDER_LEN
,
1528 .proc_handler
= numa_zonelist_order_handler
,
1531 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1532 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1534 .procname
= "vdso_enabled",
1535 #ifdef CONFIG_X86_32
1536 .data
= &vdso32_enabled
,
1537 .maxlen
= sizeof(vdso32_enabled
),
1539 .data
= &vdso_enabled
,
1540 .maxlen
= sizeof(vdso_enabled
),
1543 .proc_handler
= proc_dointvec
,
1547 #ifdef CONFIG_HIGHMEM
1549 .procname
= "highmem_is_dirtyable",
1550 .data
= &vm_highmem_is_dirtyable
,
1551 .maxlen
= sizeof(vm_highmem_is_dirtyable
),
1553 .proc_handler
= proc_dointvec_minmax
,
1558 #ifdef CONFIG_MEMORY_FAILURE
1560 .procname
= "memory_failure_early_kill",
1561 .data
= &sysctl_memory_failure_early_kill
,
1562 .maxlen
= sizeof(sysctl_memory_failure_early_kill
),
1564 .proc_handler
= proc_dointvec_minmax
,
1569 .procname
= "memory_failure_recovery",
1570 .data
= &sysctl_memory_failure_recovery
,
1571 .maxlen
= sizeof(sysctl_memory_failure_recovery
),
1573 .proc_handler
= proc_dointvec_minmax
,
1579 .procname
= "user_reserve_kbytes",
1580 .data
= &sysctl_user_reserve_kbytes
,
1581 .maxlen
= sizeof(sysctl_user_reserve_kbytes
),
1583 .proc_handler
= proc_doulongvec_minmax
,
1586 .procname
= "admin_reserve_kbytes",
1587 .data
= &sysctl_admin_reserve_kbytes
,
1588 .maxlen
= sizeof(sysctl_admin_reserve_kbytes
),
1590 .proc_handler
= proc_doulongvec_minmax
,
1592 #ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
1594 .procname
= "mmap_rnd_bits",
1595 .data
= &mmap_rnd_bits
,
1596 .maxlen
= sizeof(mmap_rnd_bits
),
1598 .proc_handler
= proc_dointvec_minmax
,
1599 .extra1
= (void *)&mmap_rnd_bits_min
,
1600 .extra2
= (void *)&mmap_rnd_bits_max
,
1603 #ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS
1605 .procname
= "mmap_rnd_compat_bits",
1606 .data
= &mmap_rnd_compat_bits
,
1607 .maxlen
= sizeof(mmap_rnd_compat_bits
),
1609 .proc_handler
= proc_dointvec_minmax
,
1610 .extra1
= (void *)&mmap_rnd_compat_bits_min
,
1611 .extra2
= (void *)&mmap_rnd_compat_bits_max
,
1617 static struct ctl_table fs_table
[] = {
1619 .procname
= "inode-nr",
1620 .data
= &inodes_stat
,
1621 .maxlen
= 2*sizeof(long),
1623 .proc_handler
= proc_nr_inodes
,
1626 .procname
= "inode-state",
1627 .data
= &inodes_stat
,
1628 .maxlen
= 7*sizeof(long),
1630 .proc_handler
= proc_nr_inodes
,
1633 .procname
= "file-nr",
1634 .data
= &files_stat
,
1635 .maxlen
= sizeof(files_stat
),
1637 .proc_handler
= proc_nr_files
,
1640 .procname
= "file-max",
1641 .data
= &files_stat
.max_files
,
1642 .maxlen
= sizeof(files_stat
.max_files
),
1644 .proc_handler
= proc_doulongvec_minmax
,
1647 .procname
= "nr_open",
1648 .data
= &sysctl_nr_open
,
1649 .maxlen
= sizeof(int),
1651 .proc_handler
= proc_dointvec_minmax
,
1652 .extra1
= &sysctl_nr_open_min
,
1653 .extra2
= &sysctl_nr_open_max
,
1656 .procname
= "dentry-state",
1657 .data
= &dentry_stat
,
1658 .maxlen
= 6*sizeof(long),
1660 .proc_handler
= proc_nr_dentry
,
1663 .procname
= "overflowuid",
1664 .data
= &fs_overflowuid
,
1665 .maxlen
= sizeof(int),
1667 .proc_handler
= proc_dointvec_minmax
,
1668 .extra1
= &minolduid
,
1669 .extra2
= &maxolduid
,
1672 .procname
= "overflowgid",
1673 .data
= &fs_overflowgid
,
1674 .maxlen
= sizeof(int),
1676 .proc_handler
= proc_dointvec_minmax
,
1677 .extra1
= &minolduid
,
1678 .extra2
= &maxolduid
,
1680 #ifdef CONFIG_FILE_LOCKING
1682 .procname
= "leases-enable",
1683 .data
= &leases_enable
,
1684 .maxlen
= sizeof(int),
1686 .proc_handler
= proc_dointvec
,
1689 #ifdef CONFIG_DNOTIFY
1691 .procname
= "dir-notify-enable",
1692 .data
= &dir_notify_enable
,
1693 .maxlen
= sizeof(int),
1695 .proc_handler
= proc_dointvec
,
1699 #ifdef CONFIG_FILE_LOCKING
1701 .procname
= "lease-break-time",
1702 .data
= &lease_break_time
,
1703 .maxlen
= sizeof(int),
1705 .proc_handler
= proc_dointvec
,
1710 .procname
= "aio-nr",
1712 .maxlen
= sizeof(aio_nr
),
1714 .proc_handler
= proc_doulongvec_minmax
,
1717 .procname
= "aio-max-nr",
1718 .data
= &aio_max_nr
,
1719 .maxlen
= sizeof(aio_max_nr
),
1721 .proc_handler
= proc_doulongvec_minmax
,
1723 #endif /* CONFIG_AIO */
1724 #ifdef CONFIG_INOTIFY_USER
1726 .procname
= "inotify",
1728 .child
= inotify_table
,
1733 .procname
= "epoll",
1735 .child
= epoll_table
,
1740 .procname
= "protected_symlinks",
1741 .data
= &sysctl_protected_symlinks
,
1742 .maxlen
= sizeof(int),
1744 .proc_handler
= proc_dointvec_minmax
,
1749 .procname
= "protected_hardlinks",
1750 .data
= &sysctl_protected_hardlinks
,
1751 .maxlen
= sizeof(int),
1753 .proc_handler
= proc_dointvec_minmax
,
1758 .procname
= "suid_dumpable",
1759 .data
= &suid_dumpable
,
1760 .maxlen
= sizeof(int),
1762 .proc_handler
= proc_dointvec_minmax_coredump
,
1766 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1768 .procname
= "binfmt_misc",
1770 .child
= sysctl_mount_point
,
1774 .procname
= "pipe-max-size",
1775 .data
= &pipe_max_size
,
1776 .maxlen
= sizeof(int),
1778 .proc_handler
= &pipe_proc_fn
,
1779 .extra1
= &pipe_min_size
,
1782 .procname
= "pipe-user-pages-hard",
1783 .data
= &pipe_user_pages_hard
,
1784 .maxlen
= sizeof(pipe_user_pages_hard
),
1786 .proc_handler
= proc_doulongvec_minmax
,
1789 .procname
= "pipe-user-pages-soft",
1790 .data
= &pipe_user_pages_soft
,
1791 .maxlen
= sizeof(pipe_user_pages_soft
),
1793 .proc_handler
= proc_doulongvec_minmax
,
1798 static struct ctl_table debug_table
[] = {
1799 #ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
1801 .procname
= "exception-trace",
1802 .data
= &show_unhandled_signals
,
1803 .maxlen
= sizeof(int),
1805 .proc_handler
= proc_dointvec
1808 #if defined(CONFIG_OPTPROBES)
1810 .procname
= "kprobes-optimization",
1811 .data
= &sysctl_kprobes_optimization
,
1812 .maxlen
= sizeof(int),
1814 .proc_handler
= proc_kprobes_optimization_handler
,
1822 static struct ctl_table dev_table
[] = {
1826 int __init
sysctl_init(void)
1828 struct ctl_table_header
*hdr
;
1830 hdr
= register_sysctl_table(sysctl_base_table
);
1831 kmemleak_not_leak(hdr
);
1835 #endif /* CONFIG_SYSCTL */
1841 #ifdef CONFIG_PROC_SYSCTL
1843 static int _proc_do_string(char *data
, int maxlen
, int write
,
1844 char __user
*buffer
,
1845 size_t *lenp
, loff_t
*ppos
)
1851 if (!data
|| !maxlen
|| !*lenp
) {
1857 if (sysctl_writes_strict
== SYSCTL_WRITES_STRICT
) {
1858 /* Only continue writes not past the end of buffer. */
1860 if (len
> maxlen
- 1)
1867 /* Start writing from beginning of buffer. */
1873 while ((p
- buffer
) < *lenp
&& len
< maxlen
- 1) {
1874 if (get_user(c
, p
++))
1876 if (c
== 0 || c
== '\n')
1897 if (copy_to_user(buffer
, data
, len
))
1900 if (put_user('\n', buffer
+ len
))
1910 static void warn_sysctl_write(struct ctl_table
*table
)
1912 pr_warn_once("%s wrote to %s when file position was not 0!\n"
1913 "This will not be supported in the future. To silence this\n"
1914 "warning, set kernel.sysctl_writes_strict = -1\n",
1915 current
->comm
, table
->procname
);
1919 * proc_dostring - read a string sysctl
1920 * @table: the sysctl table
1921 * @write: %TRUE if this is a write to the sysctl file
1922 * @buffer: the user buffer
1923 * @lenp: the size of the user buffer
1924 * @ppos: file position
1926 * Reads/writes a string from/to the user buffer. If the kernel
1927 * buffer provided is not large enough to hold the string, the
1928 * string is truncated. The copied string is %NULL-terminated.
1929 * If the string is being read by the user process, it is copied
1930 * and a newline '\n' is added. It is truncated if the buffer is
1933 * Returns 0 on success.
1935 int proc_dostring(struct ctl_table
*table
, int write
,
1936 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
1938 if (write
&& *ppos
&& sysctl_writes_strict
== SYSCTL_WRITES_WARN
)
1939 warn_sysctl_write(table
);
1941 return _proc_do_string((char *)(table
->data
), table
->maxlen
, write
,
1942 (char __user
*)buffer
, lenp
, ppos
);
1945 static size_t proc_skip_spaces(char **buf
)
1948 char *tmp
= skip_spaces(*buf
);
1954 static void proc_skip_char(char **buf
, size_t *size
, const char v
)
1964 #define TMPBUFLEN 22
1966 * proc_get_long - reads an ASCII formatted integer from a user buffer
1968 * @buf: a kernel buffer
1969 * @size: size of the kernel buffer
1970 * @val: this is where the number will be stored
1971 * @neg: set to %TRUE if number is negative
1972 * @perm_tr: a vector which contains the allowed trailers
1973 * @perm_tr_len: size of the perm_tr vector
1974 * @tr: pointer to store the trailer character
1976 * In case of success %0 is returned and @buf and @size are updated with
1977 * the amount of bytes read. If @tr is non-NULL and a trailing
1978 * character exists (size is non-zero after returning from this
1979 * function), @tr is updated with the trailing character.
1981 static int proc_get_long(char **buf
, size_t *size
,
1982 unsigned long *val
, bool *neg
,
1983 const char *perm_tr
, unsigned perm_tr_len
, char *tr
)
1986 char *p
, tmp
[TMPBUFLEN
];
1992 if (len
> TMPBUFLEN
- 1)
1993 len
= TMPBUFLEN
- 1;
1995 memcpy(tmp
, *buf
, len
);
1999 if (*p
== '-' && *size
> 1) {
2007 *val
= simple_strtoul(p
, &p
, 0);
2011 /* We don't know if the next char is whitespace thus we may accept
2012 * invalid integers (e.g. 1234...a) or two integers instead of one
2013 * (e.g. 123...1). So lets not allow such large numbers. */
2014 if (len
== TMPBUFLEN
- 1)
2017 if (len
< *size
&& perm_tr_len
&& !memchr(perm_tr
, *p
, perm_tr_len
))
2020 if (tr
&& (len
< *size
))
2030 * proc_put_long - converts an integer to a decimal ASCII formatted string
2032 * @buf: the user buffer
2033 * @size: the size of the user buffer
2034 * @val: the integer to be converted
2035 * @neg: sign of the number, %TRUE for negative
2037 * In case of success %0 is returned and @buf and @size are updated with
2038 * the amount of bytes written.
2040 static int proc_put_long(void __user
**buf
, size_t *size
, unsigned long val
,
2044 char tmp
[TMPBUFLEN
], *p
= tmp
;
2046 sprintf(p
, "%s%lu", neg
? "-" : "", val
);
2050 if (copy_to_user(*buf
, tmp
, len
))
2058 static int proc_put_char(void __user
**buf
, size_t *size
, char c
)
2061 char __user
**buffer
= (char __user
**)buf
;
2062 if (put_user(c
, *buffer
))
2064 (*size
)--, (*buffer
)++;
2070 static int do_proc_dointvec_conv(bool *negp
, unsigned long *lvalp
,
2072 int write
, void *data
)
2076 if (*lvalp
> (unsigned long) INT_MAX
+ 1)
2080 if (*lvalp
> (unsigned long) INT_MAX
)
2088 *lvalp
= -(unsigned long)val
;
2091 *lvalp
= (unsigned long)val
;
2097 static const char proc_wspace_sep
[] = { ' ', '\t', '\n' };
2099 static int __do_proc_dointvec(void *tbl_data
, struct ctl_table
*table
,
2100 int write
, void __user
*buffer
,
2101 size_t *lenp
, loff_t
*ppos
,
2102 int (*conv
)(bool *negp
, unsigned long *lvalp
, int *valp
,
2103 int write
, void *data
),
2106 int *i
, vleft
, first
= 1, err
= 0;
2108 char *kbuf
= NULL
, *p
;
2110 if (!tbl_data
|| !table
->maxlen
|| !*lenp
|| (*ppos
&& !write
)) {
2115 i
= (int *) tbl_data
;
2116 vleft
= table
->maxlen
/ sizeof(*i
);
2120 conv
= do_proc_dointvec_conv
;
2124 switch (sysctl_writes_strict
) {
2125 case SYSCTL_WRITES_STRICT
:
2127 case SYSCTL_WRITES_WARN
:
2128 warn_sysctl_write(table
);
2135 if (left
> PAGE_SIZE
- 1)
2136 left
= PAGE_SIZE
- 1;
2137 p
= kbuf
= memdup_user_nul(buffer
, left
);
2139 return PTR_ERR(kbuf
);
2142 for (; left
&& vleft
--; i
++, first
=0) {
2147 left
-= proc_skip_spaces(&p
);
2151 err
= proc_get_long(&p
, &left
, &lval
, &neg
,
2153 sizeof(proc_wspace_sep
), NULL
);
2156 if (conv(&neg
, &lval
, i
, 1, data
)) {
2161 if (conv(&neg
, &lval
, i
, 0, data
)) {
2166 err
= proc_put_char(&buffer
, &left
, '\t');
2169 err
= proc_put_long(&buffer
, &left
, lval
, neg
);
2175 if (!write
&& !first
&& left
&& !err
)
2176 err
= proc_put_char(&buffer
, &left
, '\n');
2177 if (write
&& !err
&& left
)
2178 left
-= proc_skip_spaces(&p
);
2182 return err
? : -EINVAL
;
2190 static int do_proc_dointvec(struct ctl_table
*table
, int write
,
2191 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
,
2192 int (*conv
)(bool *negp
, unsigned long *lvalp
, int *valp
,
2193 int write
, void *data
),
2196 return __do_proc_dointvec(table
->data
, table
, write
,
2197 buffer
, lenp
, ppos
, conv
, data
);
2201 * proc_dointvec - read a vector of integers
2202 * @table: the sysctl table
2203 * @write: %TRUE if this is a write to the sysctl file
2204 * @buffer: the user buffer
2205 * @lenp: the size of the user buffer
2206 * @ppos: file position
2208 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2209 * values from/to the user buffer, treated as an ASCII string.
2211 * Returns 0 on success.
2213 int proc_dointvec(struct ctl_table
*table
, int write
,
2214 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2216 return do_proc_dointvec(table
,write
,buffer
,lenp
,ppos
,
2221 * Taint values can only be increased
2222 * This means we can safely use a temporary.
2224 static int proc_taint(struct ctl_table
*table
, int write
,
2225 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2228 unsigned long tmptaint
= get_taint();
2231 if (write
&& !capable(CAP_SYS_ADMIN
))
2236 err
= proc_doulongvec_minmax(&t
, write
, buffer
, lenp
, ppos
);
2242 * Poor man's atomic or. Not worth adding a primitive
2243 * to everyone's atomic.h for this
2246 for (i
= 0; i
< BITS_PER_LONG
&& tmptaint
>> i
; i
++) {
2247 if ((tmptaint
>> i
) & 1)
2248 add_taint(i
, LOCKDEP_STILL_OK
);
2255 #ifdef CONFIG_PRINTK
2256 static int proc_dointvec_minmax_sysadmin(struct ctl_table
*table
, int write
,
2257 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2259 if (write
&& !capable(CAP_SYS_ADMIN
))
2262 return proc_dointvec_minmax(table
, write
, buffer
, lenp
, ppos
);
2266 struct do_proc_dointvec_minmax_conv_param
{
2271 static int do_proc_dointvec_minmax_conv(bool *negp
, unsigned long *lvalp
,
2273 int write
, void *data
)
2275 struct do_proc_dointvec_minmax_conv_param
*param
= data
;
2277 int val
= *negp
? -*lvalp
: *lvalp
;
2278 if ((param
->min
&& *param
->min
> val
) ||
2279 (param
->max
&& *param
->max
< val
))
2286 *lvalp
= -(unsigned long)val
;
2289 *lvalp
= (unsigned long)val
;
2296 * proc_dointvec_minmax - read a vector of integers with min/max values
2297 * @table: the sysctl table
2298 * @write: %TRUE if this is a write to the sysctl file
2299 * @buffer: the user buffer
2300 * @lenp: the size of the user buffer
2301 * @ppos: file position
2303 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2304 * values from/to the user buffer, treated as an ASCII string.
2306 * This routine will ensure the values are within the range specified by
2307 * table->extra1 (min) and table->extra2 (max).
2309 * Returns 0 on success.
2311 int proc_dointvec_minmax(struct ctl_table
*table
, int write
,
2312 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2314 struct do_proc_dointvec_minmax_conv_param param
= {
2315 .min
= (int *) table
->extra1
,
2316 .max
= (int *) table
->extra2
,
2318 return do_proc_dointvec(table
, write
, buffer
, lenp
, ppos
,
2319 do_proc_dointvec_minmax_conv
, ¶m
);
2322 static void validate_coredump_safety(void)
2324 #ifdef CONFIG_COREDUMP
2325 if (suid_dumpable
== SUID_DUMP_ROOT
&&
2326 core_pattern
[0] != '/' && core_pattern
[0] != '|') {
2327 printk(KERN_WARNING
"Unsafe core_pattern used with "\
2328 "suid_dumpable=2. Pipe handler or fully qualified "\
2329 "core dump path required.\n");
2334 static int proc_dointvec_minmax_coredump(struct ctl_table
*table
, int write
,
2335 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2337 int error
= proc_dointvec_minmax(table
, write
, buffer
, lenp
, ppos
);
2339 validate_coredump_safety();
2343 #ifdef CONFIG_COREDUMP
2344 static int proc_dostring_coredump(struct ctl_table
*table
, int write
,
2345 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2347 int error
= proc_dostring(table
, write
, buffer
, lenp
, ppos
);
2349 validate_coredump_safety();
2354 static int __do_proc_doulongvec_minmax(void *data
, struct ctl_table
*table
, int write
,
2355 void __user
*buffer
,
2356 size_t *lenp
, loff_t
*ppos
,
2357 unsigned long convmul
,
2358 unsigned long convdiv
)
2360 unsigned long *i
, *min
, *max
;
2361 int vleft
, first
= 1, err
= 0;
2363 char *kbuf
= NULL
, *p
;
2365 if (!data
|| !table
->maxlen
|| !*lenp
|| (*ppos
&& !write
)) {
2370 i
= (unsigned long *) data
;
2371 min
= (unsigned long *) table
->extra1
;
2372 max
= (unsigned long *) table
->extra2
;
2373 vleft
= table
->maxlen
/ sizeof(unsigned long);
2378 switch (sysctl_writes_strict
) {
2379 case SYSCTL_WRITES_STRICT
:
2381 case SYSCTL_WRITES_WARN
:
2382 warn_sysctl_write(table
);
2389 if (left
> PAGE_SIZE
- 1)
2390 left
= PAGE_SIZE
- 1;
2391 p
= kbuf
= memdup_user_nul(buffer
, left
);
2393 return PTR_ERR(kbuf
);
2396 for (; left
&& vleft
--; i
++, first
= 0) {
2402 left
-= proc_skip_spaces(&p
);
2404 err
= proc_get_long(&p
, &left
, &val
, &neg
,
2406 sizeof(proc_wspace_sep
), NULL
);
2411 if ((min
&& val
< *min
) || (max
&& val
> *max
))
2415 val
= convdiv
* (*i
) / convmul
;
2417 err
= proc_put_char(&buffer
, &left
, '\t');
2421 err
= proc_put_long(&buffer
, &left
, val
, false);
2427 if (!write
&& !first
&& left
&& !err
)
2428 err
= proc_put_char(&buffer
, &left
, '\n');
2430 left
-= proc_skip_spaces(&p
);
2434 return err
? : -EINVAL
;
2442 static int do_proc_doulongvec_minmax(struct ctl_table
*table
, int write
,
2443 void __user
*buffer
,
2444 size_t *lenp
, loff_t
*ppos
,
2445 unsigned long convmul
,
2446 unsigned long convdiv
)
2448 return __do_proc_doulongvec_minmax(table
->data
, table
, write
,
2449 buffer
, lenp
, ppos
, convmul
, convdiv
);
2453 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2454 * @table: the sysctl table
2455 * @write: %TRUE if this is a write to the sysctl file
2456 * @buffer: the user buffer
2457 * @lenp: the size of the user buffer
2458 * @ppos: file position
2460 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2461 * values from/to the user buffer, treated as an ASCII string.
2463 * This routine will ensure the values are within the range specified by
2464 * table->extra1 (min) and table->extra2 (max).
2466 * Returns 0 on success.
2468 int proc_doulongvec_minmax(struct ctl_table
*table
, int write
,
2469 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2471 return do_proc_doulongvec_minmax(table
, write
, buffer
, lenp
, ppos
, 1l, 1l);
2475 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values 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. The values
2484 * are treated as milliseconds, and converted to jiffies when they are stored.
2486 * This routine will ensure the values are within the range specified by
2487 * table->extra1 (min) and table->extra2 (max).
2489 * Returns 0 on success.
2491 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table
*table
, int write
,
2492 void __user
*buffer
,
2493 size_t *lenp
, loff_t
*ppos
)
2495 return do_proc_doulongvec_minmax(table
, write
, buffer
,
2496 lenp
, ppos
, HZ
, 1000l);
2500 static int do_proc_dointvec_jiffies_conv(bool *negp
, unsigned long *lvalp
,
2502 int write
, void *data
)
2505 if (*lvalp
> LONG_MAX
/ HZ
)
2507 *valp
= *negp
? -(*lvalp
*HZ
) : (*lvalp
*HZ
);
2513 lval
= -(unsigned long)val
;
2516 lval
= (unsigned long)val
;
2523 static int do_proc_dointvec_userhz_jiffies_conv(bool *negp
, unsigned long *lvalp
,
2525 int write
, void *data
)
2528 if (USER_HZ
< HZ
&& *lvalp
> (LONG_MAX
/ HZ
) * USER_HZ
)
2530 *valp
= clock_t_to_jiffies(*negp
? -*lvalp
: *lvalp
);
2536 lval
= -(unsigned long)val
;
2539 lval
= (unsigned long)val
;
2541 *lvalp
= jiffies_to_clock_t(lval
);
2546 static int do_proc_dointvec_ms_jiffies_conv(bool *negp
, unsigned long *lvalp
,
2548 int write
, void *data
)
2551 unsigned long jif
= msecs_to_jiffies(*negp
? -*lvalp
: *lvalp
);
2561 lval
= -(unsigned long)val
;
2564 lval
= (unsigned long)val
;
2566 *lvalp
= jiffies_to_msecs(lval
);
2572 * proc_dointvec_jiffies - read a vector of integers as seconds
2573 * @table: the sysctl table
2574 * @write: %TRUE if this is a write to the sysctl file
2575 * @buffer: the user buffer
2576 * @lenp: the size of the user buffer
2577 * @ppos: file position
2579 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2580 * values from/to the user buffer, treated as an ASCII string.
2581 * The values read are assumed to be in seconds, and are converted into
2584 * Returns 0 on success.
2586 int proc_dointvec_jiffies(struct ctl_table
*table
, int write
,
2587 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2589 return do_proc_dointvec(table
,write
,buffer
,lenp
,ppos
,
2590 do_proc_dointvec_jiffies_conv
,NULL
);
2594 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ 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: pointer to the 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 1/USER_HZ seconds, and
2604 * are converted into jiffies.
2606 * Returns 0 on success.
2608 int proc_dointvec_userhz_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_userhz_jiffies_conv
,NULL
);
2616 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
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: file position
2622 * @ppos: the current position in the file
2624 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2625 * values from/to the user buffer, treated as an ASCII string.
2626 * The values read are assumed to be in 1/1000 seconds, and
2627 * are converted into jiffies.
2629 * Returns 0 on success.
2631 int proc_dointvec_ms_jiffies(struct ctl_table
*table
, int write
,
2632 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2634 return do_proc_dointvec(table
, write
, buffer
, lenp
, ppos
,
2635 do_proc_dointvec_ms_jiffies_conv
, NULL
);
2638 static int proc_do_cad_pid(struct ctl_table
*table
, int write
,
2639 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2641 struct pid
*new_pid
;
2645 tmp
= pid_vnr(cad_pid
);
2647 r
= __do_proc_dointvec(&tmp
, table
, write
, buffer
,
2648 lenp
, ppos
, NULL
, NULL
);
2652 new_pid
= find_get_pid(tmp
);
2656 put_pid(xchg(&cad_pid
, new_pid
));
2661 * proc_do_large_bitmap - read/write from/to a large bitmap
2662 * @table: the sysctl table
2663 * @write: %TRUE if this is a write to the sysctl file
2664 * @buffer: the user buffer
2665 * @lenp: the size of the user buffer
2666 * @ppos: file position
2668 * The bitmap is stored at table->data and the bitmap length (in bits)
2671 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2672 * large bitmaps may be represented in a compact manner. Writing into
2673 * the file will clear the bitmap then update it with the given input.
2675 * Returns 0 on success.
2677 int proc_do_large_bitmap(struct ctl_table
*table
, int write
,
2678 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2682 size_t left
= *lenp
;
2683 unsigned long bitmap_len
= table
->maxlen
;
2684 unsigned long *bitmap
= *(unsigned long **) table
->data
;
2685 unsigned long *tmp_bitmap
= NULL
;
2686 char tr_a
[] = { '-', ',', '\n' }, tr_b
[] = { ',', '\n', 0 }, c
;
2688 if (!bitmap
|| !bitmap_len
|| !left
|| (*ppos
&& !write
)) {
2696 if (left
> PAGE_SIZE
- 1)
2697 left
= PAGE_SIZE
- 1;
2699 p
= kbuf
= memdup_user_nul(buffer
, left
);
2701 return PTR_ERR(kbuf
);
2703 tmp_bitmap
= kzalloc(BITS_TO_LONGS(bitmap_len
) * sizeof(unsigned long),
2709 proc_skip_char(&p
, &left
, '\n');
2710 while (!err
&& left
) {
2711 unsigned long val_a
, val_b
;
2714 err
= proc_get_long(&p
, &left
, &val_a
, &neg
, tr_a
,
2718 if (val_a
>= bitmap_len
|| neg
) {
2730 err
= proc_get_long(&p
, &left
, &val_b
,
2731 &neg
, tr_b
, sizeof(tr_b
),
2735 if (val_b
>= bitmap_len
|| neg
||
2746 bitmap_set(tmp_bitmap
, val_a
, val_b
- val_a
+ 1);
2748 proc_skip_char(&p
, &left
, '\n');
2752 unsigned long bit_a
, bit_b
= 0;
2755 bit_a
= find_next_bit(bitmap
, bitmap_len
, bit_b
);
2756 if (bit_a
>= bitmap_len
)
2758 bit_b
= find_next_zero_bit(bitmap
, bitmap_len
,
2762 err
= proc_put_char(&buffer
, &left
, ',');
2766 err
= proc_put_long(&buffer
, &left
, bit_a
, false);
2769 if (bit_a
!= bit_b
) {
2770 err
= proc_put_char(&buffer
, &left
, '-');
2773 err
= proc_put_long(&buffer
, &left
, bit_b
, false);
2781 err
= proc_put_char(&buffer
, &left
, '\n');
2787 bitmap_or(bitmap
, bitmap
, tmp_bitmap
, bitmap_len
);
2789 bitmap_copy(bitmap
, tmp_bitmap
, bitmap_len
);
2801 #else /* CONFIG_PROC_SYSCTL */
2803 int proc_dostring(struct ctl_table
*table
, int write
,
2804 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2809 int proc_dointvec(struct ctl_table
*table
, int write
,
2810 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2815 int proc_dointvec_minmax(struct ctl_table
*table
, int write
,
2816 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2821 int proc_dointvec_jiffies(struct ctl_table
*table
, int write
,
2822 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2827 int proc_dointvec_userhz_jiffies(struct ctl_table
*table
, int write
,
2828 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2833 int proc_dointvec_ms_jiffies(struct ctl_table
*table
, int write
,
2834 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2839 int proc_doulongvec_minmax(struct ctl_table
*table
, int write
,
2840 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2845 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table
*table
, int write
,
2846 void __user
*buffer
,
2847 size_t *lenp
, loff_t
*ppos
)
2853 #endif /* CONFIG_PROC_SYSCTL */
2856 * No sense putting this after each symbol definition, twice,
2857 * exception granted :-)
2859 EXPORT_SYMBOL(proc_dointvec
);
2860 EXPORT_SYMBOL(proc_dointvec_jiffies
);
2861 EXPORT_SYMBOL(proc_dointvec_minmax
);
2862 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies
);
2863 EXPORT_SYMBOL(proc_dointvec_ms_jiffies
);
2864 EXPORT_SYMBOL(proc_dostring
);
2865 EXPORT_SYMBOL(proc_doulongvec_minmax
);
2866 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax
);