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