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