Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[deliverable/linux.git] / kernel / sysctl.c
1 /*
2 * sysctl.c: General linux system control interface
3 *
4 * Begun 24 March 1995, Stephen Tweedie
5 * Added /proc support, Dec 1995
6 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
7 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
8 * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
9 * Dynamic registration fixes, Stephen Tweedie.
10 * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
11 * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
12 * Horn.
13 * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
14 * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
15 * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
16 * Wendling.
17 * The list_for_each() macro wasn't appropriate for the sysctl loop.
18 * Removed it and replaced it with older style, 03/23/00, Bill Wendling
19 */
20
21 #include <linux/module.h>
22 #include <linux/mm.h>
23 #include <linux/swap.h>
24 #include <linux/slab.h>
25 #include <linux/sysctl.h>
26 #include <linux/signal.h>
27 #include <linux/printk.h>
28 #include <linux/proc_fs.h>
29 #include <linux/security.h>
30 #include <linux/ctype.h>
31 #include <linux/kmemcheck.h>
32 #include <linux/fs.h>
33 #include <linux/init.h>
34 #include <linux/kernel.h>
35 #include <linux/kobject.h>
36 #include <linux/net.h>
37 #include <linux/sysrq.h>
38 #include <linux/highuid.h>
39 #include <linux/writeback.h>
40 #include <linux/ratelimit.h>
41 #include <linux/compaction.h>
42 #include <linux/hugetlb.h>
43 #include <linux/initrd.h>
44 #include <linux/key.h>
45 #include <linux/times.h>
46 #include <linux/limits.h>
47 #include <linux/dcache.h>
48 #include <linux/dnotify.h>
49 #include <linux/syscalls.h>
50 #include <linux/vmstat.h>
51 #include <linux/nfs_fs.h>
52 #include <linux/acpi.h>
53 #include <linux/reboot.h>
54 #include <linux/ftrace.h>
55 #include <linux/perf_event.h>
56 #include <linux/kprobes.h>
57 #include <linux/pipe_fs_i.h>
58 #include <linux/oom.h>
59
60 #include <asm/uaccess.h>
61 #include <asm/processor.h>
62
63 #ifdef CONFIG_X86
64 #include <asm/nmi.h>
65 #include <asm/stacktrace.h>
66 #include <asm/io.h>
67 #endif
68 #ifdef CONFIG_BSD_PROCESS_ACCT
69 #include <linux/acct.h>
70 #endif
71 #ifdef CONFIG_RT_MUTEXES
72 #include <linux/rtmutex.h>
73 #endif
74 #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
75 #include <linux/lockdep.h>
76 #endif
77 #ifdef CONFIG_CHR_DEV_SG
78 #include <scsi/sg.h>
79 #endif
80
81 #ifdef CONFIG_LOCKUP_DETECTOR
82 #include <linux/nmi.h>
83 #endif
84
85
86 #if defined(CONFIG_SYSCTL)
87
88 /* External variables not in a header file. */
89 extern int sysctl_overcommit_memory;
90 extern int sysctl_overcommit_ratio;
91 extern int max_threads;
92 extern int core_uses_pid;
93 extern int suid_dumpable;
94 extern char core_pattern[];
95 extern unsigned int core_pipe_limit;
96 extern int pid_max;
97 extern int min_free_kbytes;
98 extern int pid_max_min, pid_max_max;
99 extern int sysctl_drop_caches;
100 extern int percpu_pagelist_fraction;
101 extern int compat_log;
102 extern int latencytop_enabled;
103 extern int sysctl_nr_open_min, sysctl_nr_open_max;
104 #ifndef CONFIG_MMU
105 extern int sysctl_nr_trim_pages;
106 #endif
107 #ifdef CONFIG_BLOCK
108 extern int blk_iopoll_enabled;
109 #endif
110
111 /* Constants used for minimum and maximum */
112 #ifdef CONFIG_LOCKUP_DETECTOR
113 static int sixty = 60;
114 static int neg_one = -1;
115 #endif
116
117 static int zero;
118 static int __maybe_unused one = 1;
119 static int __maybe_unused two = 2;
120 static unsigned long one_ul = 1;
121 static int one_hundred = 100;
122 #ifdef CONFIG_PRINTK
123 static int ten_thousand = 10000;
124 #endif
125
126 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
127 static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
128
129 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
130 static int maxolduid = 65535;
131 static int minolduid;
132 static int min_percpu_pagelist_fract = 8;
133
134 static int ngroups_max = NGROUPS_MAX;
135
136 #ifdef CONFIG_INOTIFY_USER
137 #include <linux/inotify.h>
138 #endif
139 #ifdef CONFIG_SPARC
140 #include <asm/system.h>
141 #endif
142
143 #ifdef CONFIG_SPARC64
144 extern int sysctl_tsb_ratio;
145 #endif
146
147 #ifdef __hppa__
148 extern int pwrsw_enabled;
149 extern int unaligned_enabled;
150 #endif
151
152 #ifdef CONFIG_S390
153 #ifdef CONFIG_MATHEMU
154 extern int sysctl_ieee_emulation_warnings;
155 #endif
156 extern int sysctl_userprocess_debug;
157 extern int spin_retry;
158 #endif
159
160 #ifdef CONFIG_IA64
161 extern int no_unaligned_warning;
162 extern int unaligned_dump_stack;
163 #endif
164
165 #ifdef CONFIG_PROC_SYSCTL
166 static int proc_do_cad_pid(struct ctl_table *table, int write,
167 void __user *buffer, size_t *lenp, loff_t *ppos);
168 static int proc_taint(struct ctl_table *table, int write,
169 void __user *buffer, size_t *lenp, loff_t *ppos);
170 #endif
171
172 #ifdef CONFIG_MAGIC_SYSRQ
173 /* Note: sysrq code uses it's own private copy */
174 static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
175
176 static int sysrq_sysctl_handler(ctl_table *table, int write,
177 void __user *buffer, size_t *lenp,
178 loff_t *ppos)
179 {
180 int error;
181
182 error = proc_dointvec(table, write, buffer, lenp, ppos);
183 if (error)
184 return error;
185
186 if (write)
187 sysrq_toggle_support(__sysrq_enabled);
188
189 return 0;
190 }
191
192 #endif
193
194 static struct ctl_table root_table[];
195 static struct ctl_table_root sysctl_table_root;
196 static struct ctl_table_header root_table_header = {
197 {{.count = 1,
198 .ctl_table = root_table,
199 .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),}},
200 .root = &sysctl_table_root,
201 .set = &sysctl_table_root.default_set,
202 };
203 static struct ctl_table_root sysctl_table_root = {
204 .root_list = LIST_HEAD_INIT(sysctl_table_root.root_list),
205 .default_set.list = LIST_HEAD_INIT(root_table_header.ctl_entry),
206 };
207
208 static struct ctl_table kern_table[];
209 static struct ctl_table vm_table[];
210 static struct ctl_table fs_table[];
211 static struct ctl_table debug_table[];
212 static struct ctl_table dev_table[];
213 extern struct ctl_table random_table[];
214 #ifdef CONFIG_EPOLL
215 extern struct ctl_table epoll_table[];
216 #endif
217
218 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
219 int sysctl_legacy_va_layout;
220 #endif
221
222 /* The default sysctl tables: */
223
224 static struct ctl_table root_table[] = {
225 {
226 .procname = "kernel",
227 .mode = 0555,
228 .child = kern_table,
229 },
230 {
231 .procname = "vm",
232 .mode = 0555,
233 .child = vm_table,
234 },
235 {
236 .procname = "fs",
237 .mode = 0555,
238 .child = fs_table,
239 },
240 {
241 .procname = "debug",
242 .mode = 0555,
243 .child = debug_table,
244 },
245 {
246 .procname = "dev",
247 .mode = 0555,
248 .child = dev_table,
249 },
250 { }
251 };
252
253 #ifdef CONFIG_SCHED_DEBUG
254 static int min_sched_granularity_ns = 100000; /* 100 usecs */
255 static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
256 static int min_wakeup_granularity_ns; /* 0 usecs */
257 static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
258 static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
259 static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
260 #endif
261
262 #ifdef CONFIG_COMPACTION
263 static int min_extfrag_threshold;
264 static int max_extfrag_threshold = 1000;
265 #endif
266
267 static struct ctl_table kern_table[] = {
268 {
269 .procname = "sched_child_runs_first",
270 .data = &sysctl_sched_child_runs_first,
271 .maxlen = sizeof(unsigned int),
272 .mode = 0644,
273 .proc_handler = proc_dointvec,
274 },
275 #ifdef CONFIG_SCHED_DEBUG
276 {
277 .procname = "sched_min_granularity_ns",
278 .data = &sysctl_sched_min_granularity,
279 .maxlen = sizeof(unsigned int),
280 .mode = 0644,
281 .proc_handler = sched_proc_update_handler,
282 .extra1 = &min_sched_granularity_ns,
283 .extra2 = &max_sched_granularity_ns,
284 },
285 {
286 .procname = "sched_latency_ns",
287 .data = &sysctl_sched_latency,
288 .maxlen = sizeof(unsigned int),
289 .mode = 0644,
290 .proc_handler = sched_proc_update_handler,
291 .extra1 = &min_sched_granularity_ns,
292 .extra2 = &max_sched_granularity_ns,
293 },
294 {
295 .procname = "sched_wakeup_granularity_ns",
296 .data = &sysctl_sched_wakeup_granularity,
297 .maxlen = sizeof(unsigned int),
298 .mode = 0644,
299 .proc_handler = sched_proc_update_handler,
300 .extra1 = &min_wakeup_granularity_ns,
301 .extra2 = &max_wakeup_granularity_ns,
302 },
303 {
304 .procname = "sched_tunable_scaling",
305 .data = &sysctl_sched_tunable_scaling,
306 .maxlen = sizeof(enum sched_tunable_scaling),
307 .mode = 0644,
308 .proc_handler = sched_proc_update_handler,
309 .extra1 = &min_sched_tunable_scaling,
310 .extra2 = &max_sched_tunable_scaling,
311 },
312 {
313 .procname = "sched_migration_cost",
314 .data = &sysctl_sched_migration_cost,
315 .maxlen = sizeof(unsigned int),
316 .mode = 0644,
317 .proc_handler = proc_dointvec,
318 },
319 {
320 .procname = "sched_nr_migrate",
321 .data = &sysctl_sched_nr_migrate,
322 .maxlen = sizeof(unsigned int),
323 .mode = 0644,
324 .proc_handler = proc_dointvec,
325 },
326 {
327 .procname = "sched_time_avg",
328 .data = &sysctl_sched_time_avg,
329 .maxlen = sizeof(unsigned int),
330 .mode = 0644,
331 .proc_handler = proc_dointvec,
332 },
333 {
334 .procname = "sched_shares_window",
335 .data = &sysctl_sched_shares_window,
336 .maxlen = sizeof(unsigned int),
337 .mode = 0644,
338 .proc_handler = proc_dointvec,
339 },
340 {
341 .procname = "timer_migration",
342 .data = &sysctl_timer_migration,
343 .maxlen = sizeof(unsigned int),
344 .mode = 0644,
345 .proc_handler = proc_dointvec_minmax,
346 .extra1 = &zero,
347 .extra2 = &one,
348 },
349 #endif
350 {
351 .procname = "sched_rt_period_us",
352 .data = &sysctl_sched_rt_period,
353 .maxlen = sizeof(unsigned int),
354 .mode = 0644,
355 .proc_handler = sched_rt_handler,
356 },
357 {
358 .procname = "sched_rt_runtime_us",
359 .data = &sysctl_sched_rt_runtime,
360 .maxlen = sizeof(int),
361 .mode = 0644,
362 .proc_handler = sched_rt_handler,
363 },
364 #ifdef CONFIG_SCHED_AUTOGROUP
365 {
366 .procname = "sched_autogroup_enabled",
367 .data = &sysctl_sched_autogroup_enabled,
368 .maxlen = sizeof(unsigned int),
369 .mode = 0644,
370 .proc_handler = proc_dointvec_minmax,
371 .extra1 = &zero,
372 .extra2 = &one,
373 },
374 #endif
375 #ifdef CONFIG_PROVE_LOCKING
376 {
377 .procname = "prove_locking",
378 .data = &prove_locking,
379 .maxlen = sizeof(int),
380 .mode = 0644,
381 .proc_handler = proc_dointvec,
382 },
383 #endif
384 #ifdef CONFIG_LOCK_STAT
385 {
386 .procname = "lock_stat",
387 .data = &lock_stat,
388 .maxlen = sizeof(int),
389 .mode = 0644,
390 .proc_handler = proc_dointvec,
391 },
392 #endif
393 {
394 .procname = "panic",
395 .data = &panic_timeout,
396 .maxlen = sizeof(int),
397 .mode = 0644,
398 .proc_handler = proc_dointvec,
399 },
400 {
401 .procname = "core_uses_pid",
402 .data = &core_uses_pid,
403 .maxlen = sizeof(int),
404 .mode = 0644,
405 .proc_handler = proc_dointvec,
406 },
407 {
408 .procname = "core_pattern",
409 .data = core_pattern,
410 .maxlen = CORENAME_MAX_SIZE,
411 .mode = 0644,
412 .proc_handler = proc_dostring,
413 },
414 {
415 .procname = "core_pipe_limit",
416 .data = &core_pipe_limit,
417 .maxlen = sizeof(unsigned int),
418 .mode = 0644,
419 .proc_handler = proc_dointvec,
420 },
421 #ifdef CONFIG_PROC_SYSCTL
422 {
423 .procname = "tainted",
424 .maxlen = sizeof(long),
425 .mode = 0644,
426 .proc_handler = proc_taint,
427 },
428 #endif
429 #ifdef CONFIG_LATENCYTOP
430 {
431 .procname = "latencytop",
432 .data = &latencytop_enabled,
433 .maxlen = sizeof(int),
434 .mode = 0644,
435 .proc_handler = proc_dointvec,
436 },
437 #endif
438 #ifdef CONFIG_BLK_DEV_INITRD
439 {
440 .procname = "real-root-dev",
441 .data = &real_root_dev,
442 .maxlen = sizeof(int),
443 .mode = 0644,
444 .proc_handler = proc_dointvec,
445 },
446 #endif
447 {
448 .procname = "print-fatal-signals",
449 .data = &print_fatal_signals,
450 .maxlen = sizeof(int),
451 .mode = 0644,
452 .proc_handler = proc_dointvec,
453 },
454 #ifdef CONFIG_SPARC
455 {
456 .procname = "reboot-cmd",
457 .data = reboot_command,
458 .maxlen = 256,
459 .mode = 0644,
460 .proc_handler = proc_dostring,
461 },
462 {
463 .procname = "stop-a",
464 .data = &stop_a_enabled,
465 .maxlen = sizeof (int),
466 .mode = 0644,
467 .proc_handler = proc_dointvec,
468 },
469 {
470 .procname = "scons-poweroff",
471 .data = &scons_pwroff,
472 .maxlen = sizeof (int),
473 .mode = 0644,
474 .proc_handler = proc_dointvec,
475 },
476 #endif
477 #ifdef CONFIG_SPARC64
478 {
479 .procname = "tsb-ratio",
480 .data = &sysctl_tsb_ratio,
481 .maxlen = sizeof (int),
482 .mode = 0644,
483 .proc_handler = proc_dointvec,
484 },
485 #endif
486 #ifdef __hppa__
487 {
488 .procname = "soft-power",
489 .data = &pwrsw_enabled,
490 .maxlen = sizeof (int),
491 .mode = 0644,
492 .proc_handler = proc_dointvec,
493 },
494 {
495 .procname = "unaligned-trap",
496 .data = &unaligned_enabled,
497 .maxlen = sizeof (int),
498 .mode = 0644,
499 .proc_handler = proc_dointvec,
500 },
501 #endif
502 {
503 .procname = "ctrl-alt-del",
504 .data = &C_A_D,
505 .maxlen = sizeof(int),
506 .mode = 0644,
507 .proc_handler = proc_dointvec,
508 },
509 #ifdef CONFIG_FUNCTION_TRACER
510 {
511 .procname = "ftrace_enabled",
512 .data = &ftrace_enabled,
513 .maxlen = sizeof(int),
514 .mode = 0644,
515 .proc_handler = ftrace_enable_sysctl,
516 },
517 #endif
518 #ifdef CONFIG_STACK_TRACER
519 {
520 .procname = "stack_tracer_enabled",
521 .data = &stack_tracer_enabled,
522 .maxlen = sizeof(int),
523 .mode = 0644,
524 .proc_handler = stack_trace_sysctl,
525 },
526 #endif
527 #ifdef CONFIG_TRACING
528 {
529 .procname = "ftrace_dump_on_oops",
530 .data = &ftrace_dump_on_oops,
531 .maxlen = sizeof(int),
532 .mode = 0644,
533 .proc_handler = proc_dointvec,
534 },
535 #endif
536 #ifdef CONFIG_MODULES
537 {
538 .procname = "modprobe",
539 .data = &modprobe_path,
540 .maxlen = KMOD_PATH_LEN,
541 .mode = 0644,
542 .proc_handler = proc_dostring,
543 },
544 {
545 .procname = "modules_disabled",
546 .data = &modules_disabled,
547 .maxlen = sizeof(int),
548 .mode = 0644,
549 /* only handle a transition from default "0" to "1" */
550 .proc_handler = proc_dointvec_minmax,
551 .extra1 = &one,
552 .extra2 = &one,
553 },
554 #endif
555 #ifdef CONFIG_HOTPLUG
556 {
557 .procname = "hotplug",
558 .data = &uevent_helper,
559 .maxlen = UEVENT_HELPER_PATH_LEN,
560 .mode = 0644,
561 .proc_handler = proc_dostring,
562 },
563 #endif
564 #ifdef CONFIG_CHR_DEV_SG
565 {
566 .procname = "sg-big-buff",
567 .data = &sg_big_buff,
568 .maxlen = sizeof (int),
569 .mode = 0444,
570 .proc_handler = proc_dointvec,
571 },
572 #endif
573 #ifdef CONFIG_BSD_PROCESS_ACCT
574 {
575 .procname = "acct",
576 .data = &acct_parm,
577 .maxlen = 3*sizeof(int),
578 .mode = 0644,
579 .proc_handler = proc_dointvec,
580 },
581 #endif
582 #ifdef CONFIG_MAGIC_SYSRQ
583 {
584 .procname = "sysrq",
585 .data = &__sysrq_enabled,
586 .maxlen = sizeof (int),
587 .mode = 0644,
588 .proc_handler = sysrq_sysctl_handler,
589 },
590 #endif
591 #ifdef CONFIG_PROC_SYSCTL
592 {
593 .procname = "cad_pid",
594 .data = NULL,
595 .maxlen = sizeof (int),
596 .mode = 0600,
597 .proc_handler = proc_do_cad_pid,
598 },
599 #endif
600 {
601 .procname = "threads-max",
602 .data = &max_threads,
603 .maxlen = sizeof(int),
604 .mode = 0644,
605 .proc_handler = proc_dointvec,
606 },
607 {
608 .procname = "random",
609 .mode = 0555,
610 .child = random_table,
611 },
612 {
613 .procname = "overflowuid",
614 .data = &overflowuid,
615 .maxlen = sizeof(int),
616 .mode = 0644,
617 .proc_handler = proc_dointvec_minmax,
618 .extra1 = &minolduid,
619 .extra2 = &maxolduid,
620 },
621 {
622 .procname = "overflowgid",
623 .data = &overflowgid,
624 .maxlen = sizeof(int),
625 .mode = 0644,
626 .proc_handler = proc_dointvec_minmax,
627 .extra1 = &minolduid,
628 .extra2 = &maxolduid,
629 },
630 #ifdef CONFIG_S390
631 #ifdef CONFIG_MATHEMU
632 {
633 .procname = "ieee_emulation_warnings",
634 .data = &sysctl_ieee_emulation_warnings,
635 .maxlen = sizeof(int),
636 .mode = 0644,
637 .proc_handler = proc_dointvec,
638 },
639 #endif
640 {
641 .procname = "userprocess_debug",
642 .data = &show_unhandled_signals,
643 .maxlen = sizeof(int),
644 .mode = 0644,
645 .proc_handler = proc_dointvec,
646 },
647 #endif
648 {
649 .procname = "pid_max",
650 .data = &pid_max,
651 .maxlen = sizeof (int),
652 .mode = 0644,
653 .proc_handler = proc_dointvec_minmax,
654 .extra1 = &pid_max_min,
655 .extra2 = &pid_max_max,
656 },
657 {
658 .procname = "panic_on_oops",
659 .data = &panic_on_oops,
660 .maxlen = sizeof(int),
661 .mode = 0644,
662 .proc_handler = proc_dointvec,
663 },
664 #if defined CONFIG_PRINTK
665 {
666 .procname = "printk",
667 .data = &console_loglevel,
668 .maxlen = 4*sizeof(int),
669 .mode = 0644,
670 .proc_handler = proc_dointvec,
671 },
672 {
673 .procname = "printk_ratelimit",
674 .data = &printk_ratelimit_state.interval,
675 .maxlen = sizeof(int),
676 .mode = 0644,
677 .proc_handler = proc_dointvec_jiffies,
678 },
679 {
680 .procname = "printk_ratelimit_burst",
681 .data = &printk_ratelimit_state.burst,
682 .maxlen = sizeof(int),
683 .mode = 0644,
684 .proc_handler = proc_dointvec,
685 },
686 {
687 .procname = "printk_delay",
688 .data = &printk_delay_msec,
689 .maxlen = sizeof(int),
690 .mode = 0644,
691 .proc_handler = proc_dointvec_minmax,
692 .extra1 = &zero,
693 .extra2 = &ten_thousand,
694 },
695 {
696 .procname = "dmesg_restrict",
697 .data = &dmesg_restrict,
698 .maxlen = sizeof(int),
699 .mode = 0644,
700 .proc_handler = proc_dointvec_minmax,
701 .extra1 = &zero,
702 .extra2 = &one,
703 },
704 {
705 .procname = "kptr_restrict",
706 .data = &kptr_restrict,
707 .maxlen = sizeof(int),
708 .mode = 0644,
709 .proc_handler = proc_dointvec_minmax,
710 .extra1 = &zero,
711 .extra2 = &two,
712 },
713 #endif
714 {
715 .procname = "ngroups_max",
716 .data = &ngroups_max,
717 .maxlen = sizeof (int),
718 .mode = 0444,
719 .proc_handler = proc_dointvec,
720 },
721 #if defined(CONFIG_LOCKUP_DETECTOR)
722 {
723 .procname = "watchdog",
724 .data = &watchdog_enabled,
725 .maxlen = sizeof (int),
726 .mode = 0644,
727 .proc_handler = proc_dowatchdog_enabled,
728 },
729 {
730 .procname = "watchdog_thresh",
731 .data = &softlockup_thresh,
732 .maxlen = sizeof(int),
733 .mode = 0644,
734 .proc_handler = proc_dowatchdog_thresh,
735 .extra1 = &neg_one,
736 .extra2 = &sixty,
737 },
738 {
739 .procname = "softlockup_panic",
740 .data = &softlockup_panic,
741 .maxlen = sizeof(int),
742 .mode = 0644,
743 .proc_handler = proc_dointvec_minmax,
744 .extra1 = &zero,
745 .extra2 = &one,
746 },
747 {
748 .procname = "nmi_watchdog",
749 .data = &watchdog_enabled,
750 .maxlen = sizeof (int),
751 .mode = 0644,
752 .proc_handler = proc_dowatchdog_enabled,
753 },
754 #endif
755 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
756 {
757 .procname = "unknown_nmi_panic",
758 .data = &unknown_nmi_panic,
759 .maxlen = sizeof (int),
760 .mode = 0644,
761 .proc_handler = proc_dointvec,
762 },
763 #endif
764 #if defined(CONFIG_X86)
765 {
766 .procname = "panic_on_unrecovered_nmi",
767 .data = &panic_on_unrecovered_nmi,
768 .maxlen = sizeof(int),
769 .mode = 0644,
770 .proc_handler = proc_dointvec,
771 },
772 {
773 .procname = "panic_on_io_nmi",
774 .data = &panic_on_io_nmi,
775 .maxlen = sizeof(int),
776 .mode = 0644,
777 .proc_handler = proc_dointvec,
778 },
779 {
780 .procname = "bootloader_type",
781 .data = &bootloader_type,
782 .maxlen = sizeof (int),
783 .mode = 0444,
784 .proc_handler = proc_dointvec,
785 },
786 {
787 .procname = "bootloader_version",
788 .data = &bootloader_version,
789 .maxlen = sizeof (int),
790 .mode = 0444,
791 .proc_handler = proc_dointvec,
792 },
793 {
794 .procname = "kstack_depth_to_print",
795 .data = &kstack_depth_to_print,
796 .maxlen = sizeof(int),
797 .mode = 0644,
798 .proc_handler = proc_dointvec,
799 },
800 {
801 .procname = "io_delay_type",
802 .data = &io_delay_type,
803 .maxlen = sizeof(int),
804 .mode = 0644,
805 .proc_handler = proc_dointvec,
806 },
807 #endif
808 #if defined(CONFIG_MMU)
809 {
810 .procname = "randomize_va_space",
811 .data = &randomize_va_space,
812 .maxlen = sizeof(int),
813 .mode = 0644,
814 .proc_handler = proc_dointvec,
815 },
816 #endif
817 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
818 {
819 .procname = "spin_retry",
820 .data = &spin_retry,
821 .maxlen = sizeof (int),
822 .mode = 0644,
823 .proc_handler = proc_dointvec,
824 },
825 #endif
826 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
827 {
828 .procname = "acpi_video_flags",
829 .data = &acpi_realmode_flags,
830 .maxlen = sizeof (unsigned long),
831 .mode = 0644,
832 .proc_handler = proc_doulongvec_minmax,
833 },
834 #endif
835 #ifdef CONFIG_IA64
836 {
837 .procname = "ignore-unaligned-usertrap",
838 .data = &no_unaligned_warning,
839 .maxlen = sizeof (int),
840 .mode = 0644,
841 .proc_handler = proc_dointvec,
842 },
843 {
844 .procname = "unaligned-dump-stack",
845 .data = &unaligned_dump_stack,
846 .maxlen = sizeof (int),
847 .mode = 0644,
848 .proc_handler = proc_dointvec,
849 },
850 #endif
851 #ifdef CONFIG_DETECT_HUNG_TASK
852 {
853 .procname = "hung_task_panic",
854 .data = &sysctl_hung_task_panic,
855 .maxlen = sizeof(int),
856 .mode = 0644,
857 .proc_handler = proc_dointvec_minmax,
858 .extra1 = &zero,
859 .extra2 = &one,
860 },
861 {
862 .procname = "hung_task_check_count",
863 .data = &sysctl_hung_task_check_count,
864 .maxlen = sizeof(unsigned long),
865 .mode = 0644,
866 .proc_handler = proc_doulongvec_minmax,
867 },
868 {
869 .procname = "hung_task_timeout_secs",
870 .data = &sysctl_hung_task_timeout_secs,
871 .maxlen = sizeof(unsigned long),
872 .mode = 0644,
873 .proc_handler = proc_dohung_task_timeout_secs,
874 },
875 {
876 .procname = "hung_task_warnings",
877 .data = &sysctl_hung_task_warnings,
878 .maxlen = sizeof(unsigned long),
879 .mode = 0644,
880 .proc_handler = proc_doulongvec_minmax,
881 },
882 #endif
883 #ifdef CONFIG_COMPAT
884 {
885 .procname = "compat-log",
886 .data = &compat_log,
887 .maxlen = sizeof (int),
888 .mode = 0644,
889 .proc_handler = proc_dointvec,
890 },
891 #endif
892 #ifdef CONFIG_RT_MUTEXES
893 {
894 .procname = "max_lock_depth",
895 .data = &max_lock_depth,
896 .maxlen = sizeof(int),
897 .mode = 0644,
898 .proc_handler = proc_dointvec,
899 },
900 #endif
901 {
902 .procname = "poweroff_cmd",
903 .data = &poweroff_cmd,
904 .maxlen = POWEROFF_CMD_PATH_LEN,
905 .mode = 0644,
906 .proc_handler = proc_dostring,
907 },
908 #ifdef CONFIG_KEYS
909 {
910 .procname = "keys",
911 .mode = 0555,
912 .child = key_sysctls,
913 },
914 #endif
915 #ifdef CONFIG_RCU_TORTURE_TEST
916 {
917 .procname = "rcutorture_runnable",
918 .data = &rcutorture_runnable,
919 .maxlen = sizeof(int),
920 .mode = 0644,
921 .proc_handler = proc_dointvec,
922 },
923 #endif
924 #ifdef CONFIG_PERF_EVENTS
925 {
926 .procname = "perf_event_paranoid",
927 .data = &sysctl_perf_event_paranoid,
928 .maxlen = sizeof(sysctl_perf_event_paranoid),
929 .mode = 0644,
930 .proc_handler = proc_dointvec,
931 },
932 {
933 .procname = "perf_event_mlock_kb",
934 .data = &sysctl_perf_event_mlock,
935 .maxlen = sizeof(sysctl_perf_event_mlock),
936 .mode = 0644,
937 .proc_handler = proc_dointvec,
938 },
939 {
940 .procname = "perf_event_max_sample_rate",
941 .data = &sysctl_perf_event_sample_rate,
942 .maxlen = sizeof(sysctl_perf_event_sample_rate),
943 .mode = 0644,
944 .proc_handler = perf_proc_update_handler,
945 },
946 #endif
947 #ifdef CONFIG_KMEMCHECK
948 {
949 .procname = "kmemcheck",
950 .data = &kmemcheck_enabled,
951 .maxlen = sizeof(int),
952 .mode = 0644,
953 .proc_handler = proc_dointvec,
954 },
955 #endif
956 #ifdef CONFIG_BLOCK
957 {
958 .procname = "blk_iopoll",
959 .data = &blk_iopoll_enabled,
960 .maxlen = sizeof(int),
961 .mode = 0644,
962 .proc_handler = proc_dointvec,
963 },
964 #endif
965 { }
966 };
967
968 static struct ctl_table vm_table[] = {
969 {
970 .procname = "overcommit_memory",
971 .data = &sysctl_overcommit_memory,
972 .maxlen = sizeof(sysctl_overcommit_memory),
973 .mode = 0644,
974 .proc_handler = proc_dointvec,
975 },
976 {
977 .procname = "panic_on_oom",
978 .data = &sysctl_panic_on_oom,
979 .maxlen = sizeof(sysctl_panic_on_oom),
980 .mode = 0644,
981 .proc_handler = proc_dointvec,
982 },
983 {
984 .procname = "oom_kill_allocating_task",
985 .data = &sysctl_oom_kill_allocating_task,
986 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
987 .mode = 0644,
988 .proc_handler = proc_dointvec,
989 },
990 {
991 .procname = "oom_dump_tasks",
992 .data = &sysctl_oom_dump_tasks,
993 .maxlen = sizeof(sysctl_oom_dump_tasks),
994 .mode = 0644,
995 .proc_handler = proc_dointvec,
996 },
997 {
998 .procname = "overcommit_ratio",
999 .data = &sysctl_overcommit_ratio,
1000 .maxlen = sizeof(sysctl_overcommit_ratio),
1001 .mode = 0644,
1002 .proc_handler = proc_dointvec,
1003 },
1004 {
1005 .procname = "page-cluster",
1006 .data = &page_cluster,
1007 .maxlen = sizeof(int),
1008 .mode = 0644,
1009 .proc_handler = proc_dointvec,
1010 },
1011 {
1012 .procname = "dirty_background_ratio",
1013 .data = &dirty_background_ratio,
1014 .maxlen = sizeof(dirty_background_ratio),
1015 .mode = 0644,
1016 .proc_handler = dirty_background_ratio_handler,
1017 .extra1 = &zero,
1018 .extra2 = &one_hundred,
1019 },
1020 {
1021 .procname = "dirty_background_bytes",
1022 .data = &dirty_background_bytes,
1023 .maxlen = sizeof(dirty_background_bytes),
1024 .mode = 0644,
1025 .proc_handler = dirty_background_bytes_handler,
1026 .extra1 = &one_ul,
1027 },
1028 {
1029 .procname = "dirty_ratio",
1030 .data = &vm_dirty_ratio,
1031 .maxlen = sizeof(vm_dirty_ratio),
1032 .mode = 0644,
1033 .proc_handler = dirty_ratio_handler,
1034 .extra1 = &zero,
1035 .extra2 = &one_hundred,
1036 },
1037 {
1038 .procname = "dirty_bytes",
1039 .data = &vm_dirty_bytes,
1040 .maxlen = sizeof(vm_dirty_bytes),
1041 .mode = 0644,
1042 .proc_handler = dirty_bytes_handler,
1043 .extra1 = &dirty_bytes_min,
1044 },
1045 {
1046 .procname = "dirty_writeback_centisecs",
1047 .data = &dirty_writeback_interval,
1048 .maxlen = sizeof(dirty_writeback_interval),
1049 .mode = 0644,
1050 .proc_handler = dirty_writeback_centisecs_handler,
1051 },
1052 {
1053 .procname = "dirty_expire_centisecs",
1054 .data = &dirty_expire_interval,
1055 .maxlen = sizeof(dirty_expire_interval),
1056 .mode = 0644,
1057 .proc_handler = proc_dointvec,
1058 },
1059 {
1060 .procname = "nr_pdflush_threads",
1061 .data = &nr_pdflush_threads,
1062 .maxlen = sizeof nr_pdflush_threads,
1063 .mode = 0444 /* read-only*/,
1064 .proc_handler = proc_dointvec,
1065 },
1066 {
1067 .procname = "swappiness",
1068 .data = &vm_swappiness,
1069 .maxlen = sizeof(vm_swappiness),
1070 .mode = 0644,
1071 .proc_handler = proc_dointvec_minmax,
1072 .extra1 = &zero,
1073 .extra2 = &one_hundred,
1074 },
1075 #ifdef CONFIG_HUGETLB_PAGE
1076 {
1077 .procname = "nr_hugepages",
1078 .data = NULL,
1079 .maxlen = sizeof(unsigned long),
1080 .mode = 0644,
1081 .proc_handler = hugetlb_sysctl_handler,
1082 .extra1 = (void *)&hugetlb_zero,
1083 .extra2 = (void *)&hugetlb_infinity,
1084 },
1085 #ifdef CONFIG_NUMA
1086 {
1087 .procname = "nr_hugepages_mempolicy",
1088 .data = NULL,
1089 .maxlen = sizeof(unsigned long),
1090 .mode = 0644,
1091 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1092 .extra1 = (void *)&hugetlb_zero,
1093 .extra2 = (void *)&hugetlb_infinity,
1094 },
1095 #endif
1096 {
1097 .procname = "hugetlb_shm_group",
1098 .data = &sysctl_hugetlb_shm_group,
1099 .maxlen = sizeof(gid_t),
1100 .mode = 0644,
1101 .proc_handler = proc_dointvec,
1102 },
1103 {
1104 .procname = "hugepages_treat_as_movable",
1105 .data = &hugepages_treat_as_movable,
1106 .maxlen = sizeof(int),
1107 .mode = 0644,
1108 .proc_handler = hugetlb_treat_movable_handler,
1109 },
1110 {
1111 .procname = "nr_overcommit_hugepages",
1112 .data = NULL,
1113 .maxlen = sizeof(unsigned long),
1114 .mode = 0644,
1115 .proc_handler = hugetlb_overcommit_handler,
1116 .extra1 = (void *)&hugetlb_zero,
1117 .extra2 = (void *)&hugetlb_infinity,
1118 },
1119 #endif
1120 {
1121 .procname = "lowmem_reserve_ratio",
1122 .data = &sysctl_lowmem_reserve_ratio,
1123 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1124 .mode = 0644,
1125 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
1126 },
1127 {
1128 .procname = "drop_caches",
1129 .data = &sysctl_drop_caches,
1130 .maxlen = sizeof(int),
1131 .mode = 0644,
1132 .proc_handler = drop_caches_sysctl_handler,
1133 },
1134 #ifdef CONFIG_COMPACTION
1135 {
1136 .procname = "compact_memory",
1137 .data = &sysctl_compact_memory,
1138 .maxlen = sizeof(int),
1139 .mode = 0200,
1140 .proc_handler = sysctl_compaction_handler,
1141 },
1142 {
1143 .procname = "extfrag_threshold",
1144 .data = &sysctl_extfrag_threshold,
1145 .maxlen = sizeof(int),
1146 .mode = 0644,
1147 .proc_handler = sysctl_extfrag_handler,
1148 .extra1 = &min_extfrag_threshold,
1149 .extra2 = &max_extfrag_threshold,
1150 },
1151
1152 #endif /* CONFIG_COMPACTION */
1153 {
1154 .procname = "min_free_kbytes",
1155 .data = &min_free_kbytes,
1156 .maxlen = sizeof(min_free_kbytes),
1157 .mode = 0644,
1158 .proc_handler = min_free_kbytes_sysctl_handler,
1159 .extra1 = &zero,
1160 },
1161 {
1162 .procname = "percpu_pagelist_fraction",
1163 .data = &percpu_pagelist_fraction,
1164 .maxlen = sizeof(percpu_pagelist_fraction),
1165 .mode = 0644,
1166 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
1167 .extra1 = &min_percpu_pagelist_fract,
1168 },
1169 #ifdef CONFIG_MMU
1170 {
1171 .procname = "max_map_count",
1172 .data = &sysctl_max_map_count,
1173 .maxlen = sizeof(sysctl_max_map_count),
1174 .mode = 0644,
1175 .proc_handler = proc_dointvec_minmax,
1176 .extra1 = &zero,
1177 },
1178 #else
1179 {
1180 .procname = "nr_trim_pages",
1181 .data = &sysctl_nr_trim_pages,
1182 .maxlen = sizeof(sysctl_nr_trim_pages),
1183 .mode = 0644,
1184 .proc_handler = proc_dointvec_minmax,
1185 .extra1 = &zero,
1186 },
1187 #endif
1188 {
1189 .procname = "laptop_mode",
1190 .data = &laptop_mode,
1191 .maxlen = sizeof(laptop_mode),
1192 .mode = 0644,
1193 .proc_handler = proc_dointvec_jiffies,
1194 },
1195 {
1196 .procname = "block_dump",
1197 .data = &block_dump,
1198 .maxlen = sizeof(block_dump),
1199 .mode = 0644,
1200 .proc_handler = proc_dointvec,
1201 .extra1 = &zero,
1202 },
1203 {
1204 .procname = "vfs_cache_pressure",
1205 .data = &sysctl_vfs_cache_pressure,
1206 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1207 .mode = 0644,
1208 .proc_handler = proc_dointvec,
1209 .extra1 = &zero,
1210 },
1211 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1212 {
1213 .procname = "legacy_va_layout",
1214 .data = &sysctl_legacy_va_layout,
1215 .maxlen = sizeof(sysctl_legacy_va_layout),
1216 .mode = 0644,
1217 .proc_handler = proc_dointvec,
1218 .extra1 = &zero,
1219 },
1220 #endif
1221 #ifdef CONFIG_NUMA
1222 {
1223 .procname = "zone_reclaim_mode",
1224 .data = &zone_reclaim_mode,
1225 .maxlen = sizeof(zone_reclaim_mode),
1226 .mode = 0644,
1227 .proc_handler = proc_dointvec,
1228 .extra1 = &zero,
1229 },
1230 {
1231 .procname = "min_unmapped_ratio",
1232 .data = &sysctl_min_unmapped_ratio,
1233 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1234 .mode = 0644,
1235 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
1236 .extra1 = &zero,
1237 .extra2 = &one_hundred,
1238 },
1239 {
1240 .procname = "min_slab_ratio",
1241 .data = &sysctl_min_slab_ratio,
1242 .maxlen = sizeof(sysctl_min_slab_ratio),
1243 .mode = 0644,
1244 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
1245 .extra1 = &zero,
1246 .extra2 = &one_hundred,
1247 },
1248 #endif
1249 #ifdef CONFIG_SMP
1250 {
1251 .procname = "stat_interval",
1252 .data = &sysctl_stat_interval,
1253 .maxlen = sizeof(sysctl_stat_interval),
1254 .mode = 0644,
1255 .proc_handler = proc_dointvec_jiffies,
1256 },
1257 #endif
1258 #ifdef CONFIG_MMU
1259 {
1260 .procname = "mmap_min_addr",
1261 .data = &dac_mmap_min_addr,
1262 .maxlen = sizeof(unsigned long),
1263 .mode = 0644,
1264 .proc_handler = mmap_min_addr_handler,
1265 },
1266 #endif
1267 #ifdef CONFIG_NUMA
1268 {
1269 .procname = "numa_zonelist_order",
1270 .data = &numa_zonelist_order,
1271 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1272 .mode = 0644,
1273 .proc_handler = numa_zonelist_order_handler,
1274 },
1275 #endif
1276 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1277 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1278 {
1279 .procname = "vdso_enabled",
1280 .data = &vdso_enabled,
1281 .maxlen = sizeof(vdso_enabled),
1282 .mode = 0644,
1283 .proc_handler = proc_dointvec,
1284 .extra1 = &zero,
1285 },
1286 #endif
1287 #ifdef CONFIG_HIGHMEM
1288 {
1289 .procname = "highmem_is_dirtyable",
1290 .data = &vm_highmem_is_dirtyable,
1291 .maxlen = sizeof(vm_highmem_is_dirtyable),
1292 .mode = 0644,
1293 .proc_handler = proc_dointvec_minmax,
1294 .extra1 = &zero,
1295 .extra2 = &one,
1296 },
1297 #endif
1298 {
1299 .procname = "scan_unevictable_pages",
1300 .data = &scan_unevictable_pages,
1301 .maxlen = sizeof(scan_unevictable_pages),
1302 .mode = 0644,
1303 .proc_handler = scan_unevictable_handler,
1304 },
1305 #ifdef CONFIG_MEMORY_FAILURE
1306 {
1307 .procname = "memory_failure_early_kill",
1308 .data = &sysctl_memory_failure_early_kill,
1309 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1310 .mode = 0644,
1311 .proc_handler = proc_dointvec_minmax,
1312 .extra1 = &zero,
1313 .extra2 = &one,
1314 },
1315 {
1316 .procname = "memory_failure_recovery",
1317 .data = &sysctl_memory_failure_recovery,
1318 .maxlen = sizeof(sysctl_memory_failure_recovery),
1319 .mode = 0644,
1320 .proc_handler = proc_dointvec_minmax,
1321 .extra1 = &zero,
1322 .extra2 = &one,
1323 },
1324 #endif
1325 { }
1326 };
1327
1328 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1329 static struct ctl_table binfmt_misc_table[] = {
1330 { }
1331 };
1332 #endif
1333
1334 static struct ctl_table fs_table[] = {
1335 {
1336 .procname = "inode-nr",
1337 .data = &inodes_stat,
1338 .maxlen = 2*sizeof(int),
1339 .mode = 0444,
1340 .proc_handler = proc_nr_inodes,
1341 },
1342 {
1343 .procname = "inode-state",
1344 .data = &inodes_stat,
1345 .maxlen = 7*sizeof(int),
1346 .mode = 0444,
1347 .proc_handler = proc_nr_inodes,
1348 },
1349 {
1350 .procname = "file-nr",
1351 .data = &files_stat,
1352 .maxlen = sizeof(files_stat),
1353 .mode = 0444,
1354 .proc_handler = proc_nr_files,
1355 },
1356 {
1357 .procname = "file-max",
1358 .data = &files_stat.max_files,
1359 .maxlen = sizeof(files_stat.max_files),
1360 .mode = 0644,
1361 .proc_handler = proc_doulongvec_minmax,
1362 },
1363 {
1364 .procname = "nr_open",
1365 .data = &sysctl_nr_open,
1366 .maxlen = sizeof(int),
1367 .mode = 0644,
1368 .proc_handler = proc_dointvec_minmax,
1369 .extra1 = &sysctl_nr_open_min,
1370 .extra2 = &sysctl_nr_open_max,
1371 },
1372 {
1373 .procname = "dentry-state",
1374 .data = &dentry_stat,
1375 .maxlen = 6*sizeof(int),
1376 .mode = 0444,
1377 .proc_handler = proc_nr_dentry,
1378 },
1379 {
1380 .procname = "overflowuid",
1381 .data = &fs_overflowuid,
1382 .maxlen = sizeof(int),
1383 .mode = 0644,
1384 .proc_handler = proc_dointvec_minmax,
1385 .extra1 = &minolduid,
1386 .extra2 = &maxolduid,
1387 },
1388 {
1389 .procname = "overflowgid",
1390 .data = &fs_overflowgid,
1391 .maxlen = sizeof(int),
1392 .mode = 0644,
1393 .proc_handler = proc_dointvec_minmax,
1394 .extra1 = &minolduid,
1395 .extra2 = &maxolduid,
1396 },
1397 #ifdef CONFIG_FILE_LOCKING
1398 {
1399 .procname = "leases-enable",
1400 .data = &leases_enable,
1401 .maxlen = sizeof(int),
1402 .mode = 0644,
1403 .proc_handler = proc_dointvec,
1404 },
1405 #endif
1406 #ifdef CONFIG_DNOTIFY
1407 {
1408 .procname = "dir-notify-enable",
1409 .data = &dir_notify_enable,
1410 .maxlen = sizeof(int),
1411 .mode = 0644,
1412 .proc_handler = proc_dointvec,
1413 },
1414 #endif
1415 #ifdef CONFIG_MMU
1416 #ifdef CONFIG_FILE_LOCKING
1417 {
1418 .procname = "lease-break-time",
1419 .data = &lease_break_time,
1420 .maxlen = sizeof(int),
1421 .mode = 0644,
1422 .proc_handler = proc_dointvec,
1423 },
1424 #endif
1425 #ifdef CONFIG_AIO
1426 {
1427 .procname = "aio-nr",
1428 .data = &aio_nr,
1429 .maxlen = sizeof(aio_nr),
1430 .mode = 0444,
1431 .proc_handler = proc_doulongvec_minmax,
1432 },
1433 {
1434 .procname = "aio-max-nr",
1435 .data = &aio_max_nr,
1436 .maxlen = sizeof(aio_max_nr),
1437 .mode = 0644,
1438 .proc_handler = proc_doulongvec_minmax,
1439 },
1440 #endif /* CONFIG_AIO */
1441 #ifdef CONFIG_INOTIFY_USER
1442 {
1443 .procname = "inotify",
1444 .mode = 0555,
1445 .child = inotify_table,
1446 },
1447 #endif
1448 #ifdef CONFIG_EPOLL
1449 {
1450 .procname = "epoll",
1451 .mode = 0555,
1452 .child = epoll_table,
1453 },
1454 #endif
1455 #endif
1456 {
1457 .procname = "suid_dumpable",
1458 .data = &suid_dumpable,
1459 .maxlen = sizeof(int),
1460 .mode = 0644,
1461 .proc_handler = proc_dointvec_minmax,
1462 .extra1 = &zero,
1463 .extra2 = &two,
1464 },
1465 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1466 {
1467 .procname = "binfmt_misc",
1468 .mode = 0555,
1469 .child = binfmt_misc_table,
1470 },
1471 #endif
1472 {
1473 .procname = "pipe-max-size",
1474 .data = &pipe_max_size,
1475 .maxlen = sizeof(int),
1476 .mode = 0644,
1477 .proc_handler = &pipe_proc_fn,
1478 .extra1 = &pipe_min_size,
1479 },
1480 { }
1481 };
1482
1483 static struct ctl_table debug_table[] = {
1484 #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
1485 defined(CONFIG_S390)
1486 {
1487 .procname = "exception-trace",
1488 .data = &show_unhandled_signals,
1489 .maxlen = sizeof(int),
1490 .mode = 0644,
1491 .proc_handler = proc_dointvec
1492 },
1493 #endif
1494 #if defined(CONFIG_OPTPROBES)
1495 {
1496 .procname = "kprobes-optimization",
1497 .data = &sysctl_kprobes_optimization,
1498 .maxlen = sizeof(int),
1499 .mode = 0644,
1500 .proc_handler = proc_kprobes_optimization_handler,
1501 .extra1 = &zero,
1502 .extra2 = &one,
1503 },
1504 #endif
1505 { }
1506 };
1507
1508 static struct ctl_table dev_table[] = {
1509 { }
1510 };
1511
1512 static DEFINE_SPINLOCK(sysctl_lock);
1513
1514 /* called under sysctl_lock */
1515 static int use_table(struct ctl_table_header *p)
1516 {
1517 if (unlikely(p->unregistering))
1518 return 0;
1519 p->used++;
1520 return 1;
1521 }
1522
1523 /* called under sysctl_lock */
1524 static void unuse_table(struct ctl_table_header *p)
1525 {
1526 if (!--p->used)
1527 if (unlikely(p->unregistering))
1528 complete(p->unregistering);
1529 }
1530
1531 /* called under sysctl_lock, will reacquire if has to wait */
1532 static void start_unregistering(struct ctl_table_header *p)
1533 {
1534 /*
1535 * if p->used is 0, nobody will ever touch that entry again;
1536 * we'll eliminate all paths to it before dropping sysctl_lock
1537 */
1538 if (unlikely(p->used)) {
1539 struct completion wait;
1540 init_completion(&wait);
1541 p->unregistering = &wait;
1542 spin_unlock(&sysctl_lock);
1543 wait_for_completion(&wait);
1544 spin_lock(&sysctl_lock);
1545 } else {
1546 /* anything non-NULL; we'll never dereference it */
1547 p->unregistering = ERR_PTR(-EINVAL);
1548 }
1549 /*
1550 * do not remove from the list until nobody holds it; walking the
1551 * list in do_sysctl() relies on that.
1552 */
1553 list_del_init(&p->ctl_entry);
1554 }
1555
1556 void sysctl_head_get(struct ctl_table_header *head)
1557 {
1558 spin_lock(&sysctl_lock);
1559 head->count++;
1560 spin_unlock(&sysctl_lock);
1561 }
1562
1563 static void free_head(struct rcu_head *rcu)
1564 {
1565 kfree(container_of(rcu, struct ctl_table_header, rcu));
1566 }
1567
1568 void sysctl_head_put(struct ctl_table_header *head)
1569 {
1570 spin_lock(&sysctl_lock);
1571 if (!--head->count)
1572 call_rcu(&head->rcu, free_head);
1573 spin_unlock(&sysctl_lock);
1574 }
1575
1576 struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head)
1577 {
1578 if (!head)
1579 BUG();
1580 spin_lock(&sysctl_lock);
1581 if (!use_table(head))
1582 head = ERR_PTR(-ENOENT);
1583 spin_unlock(&sysctl_lock);
1584 return head;
1585 }
1586
1587 void sysctl_head_finish(struct ctl_table_header *head)
1588 {
1589 if (!head)
1590 return;
1591 spin_lock(&sysctl_lock);
1592 unuse_table(head);
1593 spin_unlock(&sysctl_lock);
1594 }
1595
1596 static struct ctl_table_set *
1597 lookup_header_set(struct ctl_table_root *root, struct nsproxy *namespaces)
1598 {
1599 struct ctl_table_set *set = &root->default_set;
1600 if (root->lookup)
1601 set = root->lookup(root, namespaces);
1602 return set;
1603 }
1604
1605 static struct list_head *
1606 lookup_header_list(struct ctl_table_root *root, struct nsproxy *namespaces)
1607 {
1608 struct ctl_table_set *set = lookup_header_set(root, namespaces);
1609 return &set->list;
1610 }
1611
1612 struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
1613 struct ctl_table_header *prev)
1614 {
1615 struct ctl_table_root *root;
1616 struct list_head *header_list;
1617 struct ctl_table_header *head;
1618 struct list_head *tmp;
1619
1620 spin_lock(&sysctl_lock);
1621 if (prev) {
1622 head = prev;
1623 tmp = &prev->ctl_entry;
1624 unuse_table(prev);
1625 goto next;
1626 }
1627 tmp = &root_table_header.ctl_entry;
1628 for (;;) {
1629 head = list_entry(tmp, struct ctl_table_header, ctl_entry);
1630
1631 if (!use_table(head))
1632 goto next;
1633 spin_unlock(&sysctl_lock);
1634 return head;
1635 next:
1636 root = head->root;
1637 tmp = tmp->next;
1638 header_list = lookup_header_list(root, namespaces);
1639 if (tmp != header_list)
1640 continue;
1641
1642 do {
1643 root = list_entry(root->root_list.next,
1644 struct ctl_table_root, root_list);
1645 if (root == &sysctl_table_root)
1646 goto out;
1647 header_list = lookup_header_list(root, namespaces);
1648 } while (list_empty(header_list));
1649 tmp = header_list->next;
1650 }
1651 out:
1652 spin_unlock(&sysctl_lock);
1653 return NULL;
1654 }
1655
1656 struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
1657 {
1658 return __sysctl_head_next(current->nsproxy, prev);
1659 }
1660
1661 void register_sysctl_root(struct ctl_table_root *root)
1662 {
1663 spin_lock(&sysctl_lock);
1664 list_add_tail(&root->root_list, &sysctl_table_root.root_list);
1665 spin_unlock(&sysctl_lock);
1666 }
1667
1668 /*
1669 * sysctl_perm does NOT grant the superuser all rights automatically, because
1670 * some sysctl variables are readonly even to root.
1671 */
1672
1673 static int test_perm(int mode, int op)
1674 {
1675 if (!current_euid())
1676 mode >>= 6;
1677 else if (in_egroup_p(0))
1678 mode >>= 3;
1679 if ((op & ~mode & (MAY_READ|MAY_WRITE|MAY_EXEC)) == 0)
1680 return 0;
1681 return -EACCES;
1682 }
1683
1684 int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
1685 {
1686 int error;
1687 int mode;
1688
1689 error = security_sysctl(table, op & (MAY_READ | MAY_WRITE | MAY_EXEC));
1690 if (error)
1691 return error;
1692
1693 if (root->permissions)
1694 mode = root->permissions(root, current->nsproxy, table);
1695 else
1696 mode = table->mode;
1697
1698 return test_perm(mode, op);
1699 }
1700
1701 static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1702 {
1703 for (; table->procname; table++) {
1704 table->parent = parent;
1705 if (table->child)
1706 sysctl_set_parent(table, table->child);
1707 }
1708 }
1709
1710 static __init int sysctl_init(void)
1711 {
1712 sysctl_set_parent(NULL, root_table);
1713 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1714 sysctl_check_table(current->nsproxy, root_table);
1715 #endif
1716 return 0;
1717 }
1718
1719 core_initcall(sysctl_init);
1720
1721 static struct ctl_table *is_branch_in(struct ctl_table *branch,
1722 struct ctl_table *table)
1723 {
1724 struct ctl_table *p;
1725 const char *s = branch->procname;
1726
1727 /* branch should have named subdirectory as its first element */
1728 if (!s || !branch->child)
1729 return NULL;
1730
1731 /* ... and nothing else */
1732 if (branch[1].procname)
1733 return NULL;
1734
1735 /* table should contain subdirectory with the same name */
1736 for (p = table; p->procname; p++) {
1737 if (!p->child)
1738 continue;
1739 if (p->procname && strcmp(p->procname, s) == 0)
1740 return p;
1741 }
1742 return NULL;
1743 }
1744
1745 /* see if attaching q to p would be an improvement */
1746 static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
1747 {
1748 struct ctl_table *to = p->ctl_table, *by = q->ctl_table;
1749 struct ctl_table *next;
1750 int is_better = 0;
1751 int not_in_parent = !p->attached_by;
1752
1753 while ((next = is_branch_in(by, to)) != NULL) {
1754 if (by == q->attached_by)
1755 is_better = 1;
1756 if (to == p->attached_by)
1757 not_in_parent = 1;
1758 by = by->child;
1759 to = next->child;
1760 }
1761
1762 if (is_better && not_in_parent) {
1763 q->attached_by = by;
1764 q->attached_to = to;
1765 q->parent = p;
1766 }
1767 }
1768
1769 /**
1770 * __register_sysctl_paths - register a sysctl hierarchy
1771 * @root: List of sysctl headers to register on
1772 * @namespaces: Data to compute which lists of sysctl entries are visible
1773 * @path: The path to the directory the sysctl table is in.
1774 * @table: the top-level table structure
1775 *
1776 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1777 * array. A completely 0 filled entry terminates the table.
1778 *
1779 * The members of the &struct ctl_table structure are used as follows:
1780 *
1781 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1782 * enter a sysctl file
1783 *
1784 * data - a pointer to data for use by proc_handler
1785 *
1786 * maxlen - the maximum size in bytes of the data
1787 *
1788 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1789 *
1790 * child - a pointer to the child sysctl table if this entry is a directory, or
1791 * %NULL.
1792 *
1793 * proc_handler - the text handler routine (described below)
1794 *
1795 * de - for internal use by the sysctl routines
1796 *
1797 * extra1, extra2 - extra pointers usable by the proc handler routines
1798 *
1799 * Leaf nodes in the sysctl tree will be represented by a single file
1800 * under /proc; non-leaf nodes will be represented by directories.
1801 *
1802 * sysctl(2) can automatically manage read and write requests through
1803 * the sysctl table. The data and maxlen fields of the ctl_table
1804 * struct enable minimal validation of the values being written to be
1805 * performed, and the mode field allows minimal authentication.
1806 *
1807 * There must be a proc_handler routine for any terminal nodes
1808 * mirrored under /proc/sys (non-terminals are handled by a built-in
1809 * directory handler). Several default handlers are available to
1810 * cover common cases -
1811 *
1812 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1813 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1814 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1815 *
1816 * It is the handler's job to read the input buffer from user memory
1817 * and process it. The handler should return 0 on success.
1818 *
1819 * This routine returns %NULL on a failure to register, and a pointer
1820 * to the table header on success.
1821 */
1822 struct ctl_table_header *__register_sysctl_paths(
1823 struct ctl_table_root *root,
1824 struct nsproxy *namespaces,
1825 const struct ctl_path *path, struct ctl_table *table)
1826 {
1827 struct ctl_table_header *header;
1828 struct ctl_table *new, **prevp;
1829 unsigned int n, npath;
1830 struct ctl_table_set *set;
1831
1832 /* Count the path components */
1833 for (npath = 0; path[npath].procname; ++npath)
1834 ;
1835
1836 /*
1837 * For each path component, allocate a 2-element ctl_table array.
1838 * The first array element will be filled with the sysctl entry
1839 * for this, the second will be the sentinel (procname == 0).
1840 *
1841 * We allocate everything in one go so that we don't have to
1842 * worry about freeing additional memory in unregister_sysctl_table.
1843 */
1844 header = kzalloc(sizeof(struct ctl_table_header) +
1845 (2 * npath * sizeof(struct ctl_table)), GFP_KERNEL);
1846 if (!header)
1847 return NULL;
1848
1849 new = (struct ctl_table *) (header + 1);
1850
1851 /* Now connect the dots */
1852 prevp = &header->ctl_table;
1853 for (n = 0; n < npath; ++n, ++path) {
1854 /* Copy the procname */
1855 new->procname = path->procname;
1856 new->mode = 0555;
1857
1858 *prevp = new;
1859 prevp = &new->child;
1860
1861 new += 2;
1862 }
1863 *prevp = table;
1864 header->ctl_table_arg = table;
1865
1866 INIT_LIST_HEAD(&header->ctl_entry);
1867 header->used = 0;
1868 header->unregistering = NULL;
1869 header->root = root;
1870 sysctl_set_parent(NULL, header->ctl_table);
1871 header->count = 1;
1872 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1873 if (sysctl_check_table(namespaces, header->ctl_table)) {
1874 kfree(header);
1875 return NULL;
1876 }
1877 #endif
1878 spin_lock(&sysctl_lock);
1879 header->set = lookup_header_set(root, namespaces);
1880 header->attached_by = header->ctl_table;
1881 header->attached_to = root_table;
1882 header->parent = &root_table_header;
1883 for (set = header->set; set; set = set->parent) {
1884 struct ctl_table_header *p;
1885 list_for_each_entry(p, &set->list, ctl_entry) {
1886 if (p->unregistering)
1887 continue;
1888 try_attach(p, header);
1889 }
1890 }
1891 header->parent->count++;
1892 list_add_tail(&header->ctl_entry, &header->set->list);
1893 spin_unlock(&sysctl_lock);
1894
1895 return header;
1896 }
1897
1898 /**
1899 * register_sysctl_table_path - register a sysctl table hierarchy
1900 * @path: The path to the directory the sysctl table is in.
1901 * @table: the top-level table structure
1902 *
1903 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1904 * array. A completely 0 filled entry terminates the table.
1905 *
1906 * See __register_sysctl_paths for more details.
1907 */
1908 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1909 struct ctl_table *table)
1910 {
1911 return __register_sysctl_paths(&sysctl_table_root, current->nsproxy,
1912 path, table);
1913 }
1914
1915 /**
1916 * register_sysctl_table - register a sysctl table hierarchy
1917 * @table: the top-level table structure
1918 *
1919 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1920 * array. A completely 0 filled entry terminates the table.
1921 *
1922 * See register_sysctl_paths for more details.
1923 */
1924 struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
1925 {
1926 static const struct ctl_path null_path[] = { {} };
1927
1928 return register_sysctl_paths(null_path, table);
1929 }
1930
1931 /**
1932 * unregister_sysctl_table - unregister a sysctl table hierarchy
1933 * @header: the header returned from register_sysctl_table
1934 *
1935 * Unregisters the sysctl table and all children. proc entries may not
1936 * actually be removed until they are no longer used by anyone.
1937 */
1938 void unregister_sysctl_table(struct ctl_table_header * header)
1939 {
1940 might_sleep();
1941
1942 if (header == NULL)
1943 return;
1944
1945 spin_lock(&sysctl_lock);
1946 start_unregistering(header);
1947 if (!--header->parent->count) {
1948 WARN_ON(1);
1949 call_rcu(&header->parent->rcu, free_head);
1950 }
1951 if (!--header->count)
1952 call_rcu(&header->rcu, free_head);
1953 spin_unlock(&sysctl_lock);
1954 }
1955
1956 int sysctl_is_seen(struct ctl_table_header *p)
1957 {
1958 struct ctl_table_set *set = p->set;
1959 int res;
1960 spin_lock(&sysctl_lock);
1961 if (p->unregistering)
1962 res = 0;
1963 else if (!set->is_seen)
1964 res = 1;
1965 else
1966 res = set->is_seen(set);
1967 spin_unlock(&sysctl_lock);
1968 return res;
1969 }
1970
1971 void setup_sysctl_set(struct ctl_table_set *p,
1972 struct ctl_table_set *parent,
1973 int (*is_seen)(struct ctl_table_set *))
1974 {
1975 INIT_LIST_HEAD(&p->list);
1976 p->parent = parent ? parent : &sysctl_table_root.default_set;
1977 p->is_seen = is_seen;
1978 }
1979
1980 #else /* !CONFIG_SYSCTL */
1981 struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
1982 {
1983 return NULL;
1984 }
1985
1986 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1987 struct ctl_table *table)
1988 {
1989 return NULL;
1990 }
1991
1992 void unregister_sysctl_table(struct ctl_table_header * table)
1993 {
1994 }
1995
1996 void setup_sysctl_set(struct ctl_table_set *p,
1997 struct ctl_table_set *parent,
1998 int (*is_seen)(struct ctl_table_set *))
1999 {
2000 }
2001
2002 void sysctl_head_put(struct ctl_table_header *head)
2003 {
2004 }
2005
2006 #endif /* CONFIG_SYSCTL */
2007
2008 /*
2009 * /proc/sys support
2010 */
2011
2012 #ifdef CONFIG_PROC_SYSCTL
2013
2014 static int _proc_do_string(void* data, int maxlen, int write,
2015 void __user *buffer,
2016 size_t *lenp, loff_t *ppos)
2017 {
2018 size_t len;
2019 char __user *p;
2020 char c;
2021
2022 if (!data || !maxlen || !*lenp) {
2023 *lenp = 0;
2024 return 0;
2025 }
2026
2027 if (write) {
2028 len = 0;
2029 p = buffer;
2030 while (len < *lenp) {
2031 if (get_user(c, p++))
2032 return -EFAULT;
2033 if (c == 0 || c == '\n')
2034 break;
2035 len++;
2036 }
2037 if (len >= maxlen)
2038 len = maxlen-1;
2039 if(copy_from_user(data, buffer, len))
2040 return -EFAULT;
2041 ((char *) data)[len] = 0;
2042 *ppos += *lenp;
2043 } else {
2044 len = strlen(data);
2045 if (len > maxlen)
2046 len = maxlen;
2047
2048 if (*ppos > len) {
2049 *lenp = 0;
2050 return 0;
2051 }
2052
2053 data += *ppos;
2054 len -= *ppos;
2055
2056 if (len > *lenp)
2057 len = *lenp;
2058 if (len)
2059 if(copy_to_user(buffer, data, len))
2060 return -EFAULT;
2061 if (len < *lenp) {
2062 if(put_user('\n', ((char __user *) buffer) + len))
2063 return -EFAULT;
2064 len++;
2065 }
2066 *lenp = len;
2067 *ppos += len;
2068 }
2069 return 0;
2070 }
2071
2072 /**
2073 * proc_dostring - read a string sysctl
2074 * @table: the sysctl table
2075 * @write: %TRUE if this is a write to the sysctl file
2076 * @buffer: the user buffer
2077 * @lenp: the size of the user buffer
2078 * @ppos: file position
2079 *
2080 * Reads/writes a string from/to the user buffer. If the kernel
2081 * buffer provided is not large enough to hold the string, the
2082 * string is truncated. The copied string is %NULL-terminated.
2083 * If the string is being read by the user process, it is copied
2084 * and a newline '\n' is added. It is truncated if the buffer is
2085 * not large enough.
2086 *
2087 * Returns 0 on success.
2088 */
2089 int proc_dostring(struct ctl_table *table, int write,
2090 void __user *buffer, size_t *lenp, loff_t *ppos)
2091 {
2092 return _proc_do_string(table->data, table->maxlen, write,
2093 buffer, lenp, ppos);
2094 }
2095
2096 static size_t proc_skip_spaces(char **buf)
2097 {
2098 size_t ret;
2099 char *tmp = skip_spaces(*buf);
2100 ret = tmp - *buf;
2101 *buf = tmp;
2102 return ret;
2103 }
2104
2105 static void proc_skip_char(char **buf, size_t *size, const char v)
2106 {
2107 while (*size) {
2108 if (**buf != v)
2109 break;
2110 (*size)--;
2111 (*buf)++;
2112 }
2113 }
2114
2115 #define TMPBUFLEN 22
2116 /**
2117 * proc_get_long - reads an ASCII formatted integer from a user buffer
2118 *
2119 * @buf: a kernel buffer
2120 * @size: size of the kernel buffer
2121 * @val: this is where the number will be stored
2122 * @neg: set to %TRUE if number is negative
2123 * @perm_tr: a vector which contains the allowed trailers
2124 * @perm_tr_len: size of the perm_tr vector
2125 * @tr: pointer to store the trailer character
2126 *
2127 * In case of success %0 is returned and @buf and @size are updated with
2128 * the amount of bytes read. If @tr is non-NULL and a trailing
2129 * character exists (size is non-zero after returning from this
2130 * function), @tr is updated with the trailing character.
2131 */
2132 static int proc_get_long(char **buf, size_t *size,
2133 unsigned long *val, bool *neg,
2134 const char *perm_tr, unsigned perm_tr_len, char *tr)
2135 {
2136 int len;
2137 char *p, tmp[TMPBUFLEN];
2138
2139 if (!*size)
2140 return -EINVAL;
2141
2142 len = *size;
2143 if (len > TMPBUFLEN - 1)
2144 len = TMPBUFLEN - 1;
2145
2146 memcpy(tmp, *buf, len);
2147
2148 tmp[len] = 0;
2149 p = tmp;
2150 if (*p == '-' && *size > 1) {
2151 *neg = true;
2152 p++;
2153 } else
2154 *neg = false;
2155 if (!isdigit(*p))
2156 return -EINVAL;
2157
2158 *val = simple_strtoul(p, &p, 0);
2159
2160 len = p - tmp;
2161
2162 /* We don't know if the next char is whitespace thus we may accept
2163 * invalid integers (e.g. 1234...a) or two integers instead of one
2164 * (e.g. 123...1). So lets not allow such large numbers. */
2165 if (len == TMPBUFLEN - 1)
2166 return -EINVAL;
2167
2168 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
2169 return -EINVAL;
2170
2171 if (tr && (len < *size))
2172 *tr = *p;
2173
2174 *buf += len;
2175 *size -= len;
2176
2177 return 0;
2178 }
2179
2180 /**
2181 * proc_put_long - converts an integer to a decimal ASCII formatted string
2182 *
2183 * @buf: the user buffer
2184 * @size: the size of the user buffer
2185 * @val: the integer to be converted
2186 * @neg: sign of the number, %TRUE for negative
2187 *
2188 * In case of success %0 is returned and @buf and @size are updated with
2189 * the amount of bytes written.
2190 */
2191 static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
2192 bool neg)
2193 {
2194 int len;
2195 char tmp[TMPBUFLEN], *p = tmp;
2196
2197 sprintf(p, "%s%lu", neg ? "-" : "", val);
2198 len = strlen(tmp);
2199 if (len > *size)
2200 len = *size;
2201 if (copy_to_user(*buf, tmp, len))
2202 return -EFAULT;
2203 *size -= len;
2204 *buf += len;
2205 return 0;
2206 }
2207 #undef TMPBUFLEN
2208
2209 static int proc_put_char(void __user **buf, size_t *size, char c)
2210 {
2211 if (*size) {
2212 char __user **buffer = (char __user **)buf;
2213 if (put_user(c, *buffer))
2214 return -EFAULT;
2215 (*size)--, (*buffer)++;
2216 *buf = *buffer;
2217 }
2218 return 0;
2219 }
2220
2221 static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
2222 int *valp,
2223 int write, void *data)
2224 {
2225 if (write) {
2226 *valp = *negp ? -*lvalp : *lvalp;
2227 } else {
2228 int val = *valp;
2229 if (val < 0) {
2230 *negp = true;
2231 *lvalp = (unsigned long)-val;
2232 } else {
2233 *negp = false;
2234 *lvalp = (unsigned long)val;
2235 }
2236 }
2237 return 0;
2238 }
2239
2240 static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
2241
2242 static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2243 int write, void __user *buffer,
2244 size_t *lenp, loff_t *ppos,
2245 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2246 int write, void *data),
2247 void *data)
2248 {
2249 int *i, vleft, first = 1, err = 0;
2250 unsigned long page = 0;
2251 size_t left;
2252 char *kbuf;
2253
2254 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
2255 *lenp = 0;
2256 return 0;
2257 }
2258
2259 i = (int *) tbl_data;
2260 vleft = table->maxlen / sizeof(*i);
2261 left = *lenp;
2262
2263 if (!conv)
2264 conv = do_proc_dointvec_conv;
2265
2266 if (write) {
2267 if (left > PAGE_SIZE - 1)
2268 left = PAGE_SIZE - 1;
2269 page = __get_free_page(GFP_TEMPORARY);
2270 kbuf = (char *) page;
2271 if (!kbuf)
2272 return -ENOMEM;
2273 if (copy_from_user(kbuf, buffer, left)) {
2274 err = -EFAULT;
2275 goto free;
2276 }
2277 kbuf[left] = 0;
2278 }
2279
2280 for (; left && vleft--; i++, first=0) {
2281 unsigned long lval;
2282 bool neg;
2283
2284 if (write) {
2285 left -= proc_skip_spaces(&kbuf);
2286
2287 if (!left)
2288 break;
2289 err = proc_get_long(&kbuf, &left, &lval, &neg,
2290 proc_wspace_sep,
2291 sizeof(proc_wspace_sep), NULL);
2292 if (err)
2293 break;
2294 if (conv(&neg, &lval, i, 1, data)) {
2295 err = -EINVAL;
2296 break;
2297 }
2298 } else {
2299 if (conv(&neg, &lval, i, 0, data)) {
2300 err = -EINVAL;
2301 break;
2302 }
2303 if (!first)
2304 err = proc_put_char(&buffer, &left, '\t');
2305 if (err)
2306 break;
2307 err = proc_put_long(&buffer, &left, lval, neg);
2308 if (err)
2309 break;
2310 }
2311 }
2312
2313 if (!write && !first && left && !err)
2314 err = proc_put_char(&buffer, &left, '\n');
2315 if (write && !err && left)
2316 left -= proc_skip_spaces(&kbuf);
2317 free:
2318 if (write) {
2319 free_page(page);
2320 if (first)
2321 return err ? : -EINVAL;
2322 }
2323 *lenp -= left;
2324 *ppos += *lenp;
2325 return err;
2326 }
2327
2328 static int do_proc_dointvec(struct ctl_table *table, int write,
2329 void __user *buffer, size_t *lenp, loff_t *ppos,
2330 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2331 int write, void *data),
2332 void *data)
2333 {
2334 return __do_proc_dointvec(table->data, table, write,
2335 buffer, lenp, ppos, conv, data);
2336 }
2337
2338 /**
2339 * proc_dointvec - read a vector of integers
2340 * @table: the sysctl table
2341 * @write: %TRUE if this is a write to the sysctl file
2342 * @buffer: the user buffer
2343 * @lenp: the size of the user buffer
2344 * @ppos: file position
2345 *
2346 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2347 * values from/to the user buffer, treated as an ASCII string.
2348 *
2349 * Returns 0 on success.
2350 */
2351 int proc_dointvec(struct ctl_table *table, int write,
2352 void __user *buffer, size_t *lenp, loff_t *ppos)
2353 {
2354 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2355 NULL,NULL);
2356 }
2357
2358 /*
2359 * Taint values can only be increased
2360 * This means we can safely use a temporary.
2361 */
2362 static int proc_taint(struct ctl_table *table, int write,
2363 void __user *buffer, size_t *lenp, loff_t *ppos)
2364 {
2365 struct ctl_table t;
2366 unsigned long tmptaint = get_taint();
2367 int err;
2368
2369 if (write && !capable(CAP_SYS_ADMIN))
2370 return -EPERM;
2371
2372 t = *table;
2373 t.data = &tmptaint;
2374 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
2375 if (err < 0)
2376 return err;
2377
2378 if (write) {
2379 /*
2380 * Poor man's atomic or. Not worth adding a primitive
2381 * to everyone's atomic.h for this
2382 */
2383 int i;
2384 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
2385 if ((tmptaint >> i) & 1)
2386 add_taint(i);
2387 }
2388 }
2389
2390 return err;
2391 }
2392
2393 struct do_proc_dointvec_minmax_conv_param {
2394 int *min;
2395 int *max;
2396 };
2397
2398 static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
2399 int *valp,
2400 int write, void *data)
2401 {
2402 struct do_proc_dointvec_minmax_conv_param *param = data;
2403 if (write) {
2404 int val = *negp ? -*lvalp : *lvalp;
2405 if ((param->min && *param->min > val) ||
2406 (param->max && *param->max < val))
2407 return -EINVAL;
2408 *valp = val;
2409 } else {
2410 int val = *valp;
2411 if (val < 0) {
2412 *negp = true;
2413 *lvalp = (unsigned long)-val;
2414 } else {
2415 *negp = false;
2416 *lvalp = (unsigned long)val;
2417 }
2418 }
2419 return 0;
2420 }
2421
2422 /**
2423 * proc_dointvec_minmax - read a vector of integers with min/max values
2424 * @table: the sysctl table
2425 * @write: %TRUE if this is a write to the sysctl file
2426 * @buffer: the user buffer
2427 * @lenp: the size of the user buffer
2428 * @ppos: file position
2429 *
2430 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2431 * values from/to the user buffer, treated as an ASCII string.
2432 *
2433 * This routine will ensure the values are within the range specified by
2434 * table->extra1 (min) and table->extra2 (max).
2435 *
2436 * Returns 0 on success.
2437 */
2438 int proc_dointvec_minmax(struct ctl_table *table, int write,
2439 void __user *buffer, size_t *lenp, loff_t *ppos)
2440 {
2441 struct do_proc_dointvec_minmax_conv_param param = {
2442 .min = (int *) table->extra1,
2443 .max = (int *) table->extra2,
2444 };
2445 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2446 do_proc_dointvec_minmax_conv, &param);
2447 }
2448
2449 static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2450 void __user *buffer,
2451 size_t *lenp, loff_t *ppos,
2452 unsigned long convmul,
2453 unsigned long convdiv)
2454 {
2455 unsigned long *i, *min, *max;
2456 int vleft, first = 1, err = 0;
2457 unsigned long page = 0;
2458 size_t left;
2459 char *kbuf;
2460
2461 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
2462 *lenp = 0;
2463 return 0;
2464 }
2465
2466 i = (unsigned long *) data;
2467 min = (unsigned long *) table->extra1;
2468 max = (unsigned long *) table->extra2;
2469 vleft = table->maxlen / sizeof(unsigned long);
2470 left = *lenp;
2471
2472 if (write) {
2473 if (left > PAGE_SIZE - 1)
2474 left = PAGE_SIZE - 1;
2475 page = __get_free_page(GFP_TEMPORARY);
2476 kbuf = (char *) page;
2477 if (!kbuf)
2478 return -ENOMEM;
2479 if (copy_from_user(kbuf, buffer, left)) {
2480 err = -EFAULT;
2481 goto free;
2482 }
2483 kbuf[left] = 0;
2484 }
2485
2486 for (; left && vleft--; i++, first = 0) {
2487 unsigned long val;
2488
2489 if (write) {
2490 bool neg;
2491
2492 left -= proc_skip_spaces(&kbuf);
2493
2494 err = proc_get_long(&kbuf, &left, &val, &neg,
2495 proc_wspace_sep,
2496 sizeof(proc_wspace_sep), NULL);
2497 if (err)
2498 break;
2499 if (neg)
2500 continue;
2501 if ((min && val < *min) || (max && val > *max))
2502 continue;
2503 *i = val;
2504 } else {
2505 val = convdiv * (*i) / convmul;
2506 if (!first)
2507 err = proc_put_char(&buffer, &left, '\t');
2508 err = proc_put_long(&buffer, &left, val, false);
2509 if (err)
2510 break;
2511 }
2512 }
2513
2514 if (!write && !first && left && !err)
2515 err = proc_put_char(&buffer, &left, '\n');
2516 if (write && !err)
2517 left -= proc_skip_spaces(&kbuf);
2518 free:
2519 if (write) {
2520 free_page(page);
2521 if (first)
2522 return err ? : -EINVAL;
2523 }
2524 *lenp -= left;
2525 *ppos += *lenp;
2526 return err;
2527 }
2528
2529 static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2530 void __user *buffer,
2531 size_t *lenp, loff_t *ppos,
2532 unsigned long convmul,
2533 unsigned long convdiv)
2534 {
2535 return __do_proc_doulongvec_minmax(table->data, table, write,
2536 buffer, lenp, ppos, convmul, convdiv);
2537 }
2538
2539 /**
2540 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2541 * @table: the sysctl table
2542 * @write: %TRUE if this is a write to the sysctl file
2543 * @buffer: the user buffer
2544 * @lenp: the size of the user buffer
2545 * @ppos: file position
2546 *
2547 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2548 * values from/to the user buffer, treated as an ASCII string.
2549 *
2550 * This routine will ensure the values are within the range specified by
2551 * table->extra1 (min) and table->extra2 (max).
2552 *
2553 * Returns 0 on success.
2554 */
2555 int proc_doulongvec_minmax(struct ctl_table *table, int write,
2556 void __user *buffer, size_t *lenp, loff_t *ppos)
2557 {
2558 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
2559 }
2560
2561 /**
2562 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2563 * @table: the sysctl table
2564 * @write: %TRUE if this is a write to the sysctl file
2565 * @buffer: the user buffer
2566 * @lenp: the size of the user buffer
2567 * @ppos: file position
2568 *
2569 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2570 * values from/to the user buffer, treated as an ASCII string. The values
2571 * are treated as milliseconds, and converted to jiffies when they are stored.
2572 *
2573 * This routine will ensure the values are within the range specified by
2574 * table->extra1 (min) and table->extra2 (max).
2575 *
2576 * Returns 0 on success.
2577 */
2578 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2579 void __user *buffer,
2580 size_t *lenp, loff_t *ppos)
2581 {
2582 return do_proc_doulongvec_minmax(table, write, buffer,
2583 lenp, ppos, HZ, 1000l);
2584 }
2585
2586
2587 static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
2588 int *valp,
2589 int write, void *data)
2590 {
2591 if (write) {
2592 if (*lvalp > LONG_MAX / HZ)
2593 return 1;
2594 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2595 } else {
2596 int val = *valp;
2597 unsigned long lval;
2598 if (val < 0) {
2599 *negp = true;
2600 lval = (unsigned long)-val;
2601 } else {
2602 *negp = false;
2603 lval = (unsigned long)val;
2604 }
2605 *lvalp = lval / HZ;
2606 }
2607 return 0;
2608 }
2609
2610 static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
2611 int *valp,
2612 int write, void *data)
2613 {
2614 if (write) {
2615 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2616 return 1;
2617 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2618 } else {
2619 int val = *valp;
2620 unsigned long lval;
2621 if (val < 0) {
2622 *negp = true;
2623 lval = (unsigned long)-val;
2624 } else {
2625 *negp = false;
2626 lval = (unsigned long)val;
2627 }
2628 *lvalp = jiffies_to_clock_t(lval);
2629 }
2630 return 0;
2631 }
2632
2633 static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
2634 int *valp,
2635 int write, void *data)
2636 {
2637 if (write) {
2638 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2639 } else {
2640 int val = *valp;
2641 unsigned long lval;
2642 if (val < 0) {
2643 *negp = true;
2644 lval = (unsigned long)-val;
2645 } else {
2646 *negp = false;
2647 lval = (unsigned long)val;
2648 }
2649 *lvalp = jiffies_to_msecs(lval);
2650 }
2651 return 0;
2652 }
2653
2654 /**
2655 * proc_dointvec_jiffies - read a vector of integers as seconds
2656 * @table: the sysctl table
2657 * @write: %TRUE if this is a write to the sysctl file
2658 * @buffer: the user buffer
2659 * @lenp: the size of the user buffer
2660 * @ppos: file position
2661 *
2662 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2663 * values from/to the user buffer, treated as an ASCII string.
2664 * The values read are assumed to be in seconds, and are converted into
2665 * jiffies.
2666 *
2667 * Returns 0 on success.
2668 */
2669 int proc_dointvec_jiffies(struct ctl_table *table, int write,
2670 void __user *buffer, size_t *lenp, loff_t *ppos)
2671 {
2672 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2673 do_proc_dointvec_jiffies_conv,NULL);
2674 }
2675
2676 /**
2677 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2678 * @table: the sysctl table
2679 * @write: %TRUE if this is a write to the sysctl file
2680 * @buffer: the user buffer
2681 * @lenp: the size of the user buffer
2682 * @ppos: pointer to the file position
2683 *
2684 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2685 * values from/to the user buffer, treated as an ASCII string.
2686 * The values read are assumed to be in 1/USER_HZ seconds, and
2687 * are converted into jiffies.
2688 *
2689 * Returns 0 on success.
2690 */
2691 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2692 void __user *buffer, size_t *lenp, loff_t *ppos)
2693 {
2694 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2695 do_proc_dointvec_userhz_jiffies_conv,NULL);
2696 }
2697
2698 /**
2699 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2700 * @table: the sysctl table
2701 * @write: %TRUE if this is a write to the sysctl file
2702 * @buffer: the user buffer
2703 * @lenp: the size of the user buffer
2704 * @ppos: file position
2705 * @ppos: the current position in the file
2706 *
2707 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2708 * values from/to the user buffer, treated as an ASCII string.
2709 * The values read are assumed to be in 1/1000 seconds, and
2710 * are converted into jiffies.
2711 *
2712 * Returns 0 on success.
2713 */
2714 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
2715 void __user *buffer, size_t *lenp, loff_t *ppos)
2716 {
2717 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2718 do_proc_dointvec_ms_jiffies_conv, NULL);
2719 }
2720
2721 static int proc_do_cad_pid(struct ctl_table *table, int write,
2722 void __user *buffer, size_t *lenp, loff_t *ppos)
2723 {
2724 struct pid *new_pid;
2725 pid_t tmp;
2726 int r;
2727
2728 tmp = pid_vnr(cad_pid);
2729
2730 r = __do_proc_dointvec(&tmp, table, write, buffer,
2731 lenp, ppos, NULL, NULL);
2732 if (r || !write)
2733 return r;
2734
2735 new_pid = find_get_pid(tmp);
2736 if (!new_pid)
2737 return -ESRCH;
2738
2739 put_pid(xchg(&cad_pid, new_pid));
2740 return 0;
2741 }
2742
2743 /**
2744 * proc_do_large_bitmap - read/write from/to a large bitmap
2745 * @table: the sysctl table
2746 * @write: %TRUE if this is a write to the sysctl file
2747 * @buffer: the user buffer
2748 * @lenp: the size of the user buffer
2749 * @ppos: file position
2750 *
2751 * The bitmap is stored at table->data and the bitmap length (in bits)
2752 * in table->maxlen.
2753 *
2754 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2755 * large bitmaps may be represented in a compact manner. Writing into
2756 * the file will clear the bitmap then update it with the given input.
2757 *
2758 * Returns 0 on success.
2759 */
2760 int proc_do_large_bitmap(struct ctl_table *table, int write,
2761 void __user *buffer, size_t *lenp, loff_t *ppos)
2762 {
2763 int err = 0;
2764 bool first = 1;
2765 size_t left = *lenp;
2766 unsigned long bitmap_len = table->maxlen;
2767 unsigned long *bitmap = (unsigned long *) table->data;
2768 unsigned long *tmp_bitmap = NULL;
2769 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2770
2771 if (!bitmap_len || !left || (*ppos && !write)) {
2772 *lenp = 0;
2773 return 0;
2774 }
2775
2776 if (write) {
2777 unsigned long page = 0;
2778 char *kbuf;
2779
2780 if (left > PAGE_SIZE - 1)
2781 left = PAGE_SIZE - 1;
2782
2783 page = __get_free_page(GFP_TEMPORARY);
2784 kbuf = (char *) page;
2785 if (!kbuf)
2786 return -ENOMEM;
2787 if (copy_from_user(kbuf, buffer, left)) {
2788 free_page(page);
2789 return -EFAULT;
2790 }
2791 kbuf[left] = 0;
2792
2793 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2794 GFP_KERNEL);
2795 if (!tmp_bitmap) {
2796 free_page(page);
2797 return -ENOMEM;
2798 }
2799 proc_skip_char(&kbuf, &left, '\n');
2800 while (!err && left) {
2801 unsigned long val_a, val_b;
2802 bool neg;
2803
2804 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2805 sizeof(tr_a), &c);
2806 if (err)
2807 break;
2808 if (val_a >= bitmap_len || neg) {
2809 err = -EINVAL;
2810 break;
2811 }
2812
2813 val_b = val_a;
2814 if (left) {
2815 kbuf++;
2816 left--;
2817 }
2818
2819 if (c == '-') {
2820 err = proc_get_long(&kbuf, &left, &val_b,
2821 &neg, tr_b, sizeof(tr_b),
2822 &c);
2823 if (err)
2824 break;
2825 if (val_b >= bitmap_len || neg ||
2826 val_a > val_b) {
2827 err = -EINVAL;
2828 break;
2829 }
2830 if (left) {
2831 kbuf++;
2832 left--;
2833 }
2834 }
2835
2836 while (val_a <= val_b)
2837 set_bit(val_a++, tmp_bitmap);
2838
2839 first = 0;
2840 proc_skip_char(&kbuf, &left, '\n');
2841 }
2842 free_page(page);
2843 } else {
2844 unsigned long bit_a, bit_b = 0;
2845
2846 while (left) {
2847 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2848 if (bit_a >= bitmap_len)
2849 break;
2850 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2851 bit_a + 1) - 1;
2852
2853 if (!first) {
2854 err = proc_put_char(&buffer, &left, ',');
2855 if (err)
2856 break;
2857 }
2858 err = proc_put_long(&buffer, &left, bit_a, false);
2859 if (err)
2860 break;
2861 if (bit_a != bit_b) {
2862 err = proc_put_char(&buffer, &left, '-');
2863 if (err)
2864 break;
2865 err = proc_put_long(&buffer, &left, bit_b, false);
2866 if (err)
2867 break;
2868 }
2869
2870 first = 0; bit_b++;
2871 }
2872 if (!err)
2873 err = proc_put_char(&buffer, &left, '\n');
2874 }
2875
2876 if (!err) {
2877 if (write) {
2878 if (*ppos)
2879 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2880 else
2881 memcpy(bitmap, tmp_bitmap,
2882 BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long));
2883 }
2884 kfree(tmp_bitmap);
2885 *lenp -= left;
2886 *ppos += *lenp;
2887 return 0;
2888 } else {
2889 kfree(tmp_bitmap);
2890 return err;
2891 }
2892 }
2893
2894 #else /* CONFIG_PROC_SYSCTL */
2895
2896 int proc_dostring(struct ctl_table *table, int write,
2897 void __user *buffer, size_t *lenp, loff_t *ppos)
2898 {
2899 return -ENOSYS;
2900 }
2901
2902 int proc_dointvec(struct ctl_table *table, int write,
2903 void __user *buffer, size_t *lenp, loff_t *ppos)
2904 {
2905 return -ENOSYS;
2906 }
2907
2908 int proc_dointvec_minmax(struct ctl_table *table, int write,
2909 void __user *buffer, size_t *lenp, loff_t *ppos)
2910 {
2911 return -ENOSYS;
2912 }
2913
2914 int proc_dointvec_jiffies(struct ctl_table *table, int write,
2915 void __user *buffer, size_t *lenp, loff_t *ppos)
2916 {
2917 return -ENOSYS;
2918 }
2919
2920 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2921 void __user *buffer, size_t *lenp, loff_t *ppos)
2922 {
2923 return -ENOSYS;
2924 }
2925
2926 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
2927 void __user *buffer, size_t *lenp, loff_t *ppos)
2928 {
2929 return -ENOSYS;
2930 }
2931
2932 int proc_doulongvec_minmax(struct ctl_table *table, int write,
2933 void __user *buffer, size_t *lenp, loff_t *ppos)
2934 {
2935 return -ENOSYS;
2936 }
2937
2938 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2939 void __user *buffer,
2940 size_t *lenp, loff_t *ppos)
2941 {
2942 return -ENOSYS;
2943 }
2944
2945
2946 #endif /* CONFIG_PROC_SYSCTL */
2947
2948 /*
2949 * No sense putting this after each symbol definition, twice,
2950 * exception granted :-)
2951 */
2952 EXPORT_SYMBOL(proc_dointvec);
2953 EXPORT_SYMBOL(proc_dointvec_jiffies);
2954 EXPORT_SYMBOL(proc_dointvec_minmax);
2955 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2956 EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2957 EXPORT_SYMBOL(proc_dostring);
2958 EXPORT_SYMBOL(proc_doulongvec_minmax);
2959 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
2960 EXPORT_SYMBOL(register_sysctl_table);
2961 EXPORT_SYMBOL(register_sysctl_paths);
2962 EXPORT_SYMBOL(unregister_sysctl_table);
This page took 0.154035 seconds and 6 git commands to generate.