~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/kernel/sysctl.c

Version: ~ [ linux-5.13-rc1 ] ~ [ linux-5.12.2 ] ~ [ linux-5.11.19 ] ~ [ linux-5.10.35 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.117 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.190 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.232 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.268 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.268 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp