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