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