History

sysctl: avoid forward declarations

Move the sysctl tables to the end of the file to avoid lots of pointless forward declarations.

Christoph Hellwig committed 6 years ago

Commit f461d2d1 parent 2374c091 file · +1768 −1805Browse files

Unified · Split

kernel/sysctl.c+1768−1805
@@ -176,79 +176,13 @@ enum sysctl_writes_mode { · 175 unmodified lines
176};176};
177 177
178static enum sysctl_writes_mode sysctl_writes_strict = SYSCTL_WRITES_STRICT;178static enum sysctl_writes_mode sysctl_writes_strict = SYSCTL_WRITES_STRICT;
179 179#endif /* CONFIG_PROC_SYSCTL */
180static int proc_do_cad_pid(struct ctl_table *table, int write,
181 void __user *buffer, size_t *lenp, loff_t *ppos);
182static int proc_taint(struct ctl_table *table, int write,
183 void __user *buffer, size_t *lenp, loff_t *ppos);
184#ifdef CONFIG_COMPACTION
185static int proc_dointvec_minmax_warn_RT_change(struct ctl_table *table,
186 int write, void __user *buffer,
187 size_t *lenp, loff_t *ppos);
188#endif
189#endif
190
191#ifdef CONFIG_PRINTK
192static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
193 void __user *buffer, size_t *lenp, loff_t *ppos);
194#endif
195
196static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
197 void __user *buffer, size_t *lenp, loff_t *ppos);
198#ifdef CONFIG_COREDUMP
199static int proc_dostring_coredump(struct ctl_table *table, int write,
200 void __user *buffer, size_t *lenp, loff_t *ppos);
201#endif
202static int proc_dopipe_max_size(struct ctl_table *table, int write,
203 void __user *buffer, size_t *lenp, loff_t *ppos);
204
205#ifdef CONFIG_MAGIC_SYSRQ
206static int sysrq_sysctl_handler(struct ctl_table *table, int write,
207 void __user *buffer, size_t *lenp, loff_t *ppos);
208#endif
209
210static struct ctl_table kern_table[];
211static struct ctl_table vm_table[];
212static struct ctl_table fs_table[];
213static struct ctl_table debug_table[];
214static struct ctl_table dev_table[];
215 180
216#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \181#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \
217 defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT)182 defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT)
218int sysctl_legacy_va_layout;183int sysctl_legacy_va_layout;
219#endif184#endif
220 185
221/* The default sysctl tables: */
222
223static struct ctl_table sysctl_base_table[] = {
224 {
225 .procname = "kernel",
226 .mode = 0555,
227 .child = kern_table,
228 },
229 {
230 .procname = "vm",
231 .mode = 0555,
232 .child = vm_table,
233 },
234 {
235 .procname = "fs",
236 .mode = 0555,
237 .child = fs_table,
238 },
239 {
240 .procname = "debug",
241 .mode = 0555,
242 .child = debug_table,
243 },
244 {
245 .procname = "dev",
246 .mode = 0555,
247 .child = dev_table,
248 },
249 { }
250};
251
252#ifdef CONFIG_SCHED_DEBUG186#ifdef CONFIG_SCHED_DEBUG
253static int min_sched_granularity_ns = 100000; /* 100 usecs */187static int min_sched_granularity_ns = 100000; /* 100 usecs */
254static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */188static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
@@ -265,1676 +199,12 @@ static int min_extfrag_threshold; · 10 unmodified lines
265static int max_extfrag_threshold = 1000;199static int max_extfrag_threshold = 1000;
266#endif200#endif
267 201
268static struct ctl_table kern_table[] = {202#endif /* CONFIG_SYSCTL */
269 {203
270 .procname = "sched_child_runs_first",204/*
271 .data = &sysctl_sched_child_runs_first,205 * /proc/sys support
272 .maxlen = sizeof(unsigned int),206 */
273 .mode = 0644,207
274 .proc_handler = proc_dointvec,
275 },
276#ifdef CONFIG_SCHED_DEBUG
277 {
278 .procname = "sched_min_granularity_ns",
279 .data = &sysctl_sched_min_granularity,
280 .maxlen = sizeof(unsigned int),
281 .mode = 0644,
282 .proc_handler = sched_proc_update_handler,
283 .extra1 = &min_sched_granularity_ns,
284 .extra2 = &max_sched_granularity_ns,
285 },
286 {
287 .procname = "sched_latency_ns",
288 .data = &sysctl_sched_latency,
289 .maxlen = sizeof(unsigned int),
290 .mode = 0644,
291 .proc_handler = sched_proc_update_handler,
292 .extra1 = &min_sched_granularity_ns,
293 .extra2 = &max_sched_granularity_ns,
294 },
295 {
296 .procname = "sched_wakeup_granularity_ns",
297 .data = &sysctl_sched_wakeup_granularity,
298 .maxlen = sizeof(unsigned int),
299 .mode = 0644,
300 .proc_handler = sched_proc_update_handler,
301 .extra1 = &min_wakeup_granularity_ns,
302 .extra2 = &max_wakeup_granularity_ns,
303 },
304#ifdef CONFIG_SMP
305 {
306 .procname = "sched_tunable_scaling",
307 .data = &sysctl_sched_tunable_scaling,
308 .maxlen = sizeof(enum sched_tunable_scaling),
309 .mode = 0644,
310 .proc_handler = sched_proc_update_handler,
311 .extra1 = &min_sched_tunable_scaling,
312 .extra2 = &max_sched_tunable_scaling,
313 },
314 {
315 .procname = "sched_migration_cost_ns",
316 .data = &sysctl_sched_migration_cost,
317 .maxlen = sizeof(unsigned int),
318 .mode = 0644,
319 .proc_handler = proc_dointvec,
320 },
321 {
322 .procname = "sched_nr_migrate",
323 .data = &sysctl_sched_nr_migrate,
324 .maxlen = sizeof(unsigned int),
325 .mode = 0644,
326 .proc_handler = proc_dointvec,
327 },
328#ifdef CONFIG_SCHEDSTATS
329 {
330 .procname = "sched_schedstats",
331 .data = NULL,
332 .maxlen = sizeof(unsigned int),
333 .mode = 0644,
334 .proc_handler = sysctl_schedstats,
335 .extra1 = SYSCTL_ZERO,
336 .extra2 = SYSCTL_ONE,
337 },
338#endif /* CONFIG_SCHEDSTATS */
339#endif /* CONFIG_SMP */
340#ifdef CONFIG_NUMA_BALANCING
341 {
342 .procname = "numa_balancing_scan_delay_ms",
343 .data = &sysctl_numa_balancing_scan_delay,
344 .maxlen = sizeof(unsigned int),
345 .mode = 0644,
346 .proc_handler = proc_dointvec,
347 },
348 {
349 .procname = "numa_balancing_scan_period_min_ms",
350 .data = &sysctl_numa_balancing_scan_period_min,
351 .maxlen = sizeof(unsigned int),
352 .mode = 0644,
353 .proc_handler = proc_dointvec,
354 },
355 {
356 .procname = "numa_balancing_scan_period_max_ms",
357 .data = &sysctl_numa_balancing_scan_period_max,
358 .maxlen = sizeof(unsigned int),
359 .mode = 0644,
360 .proc_handler = proc_dointvec,
361 },
362 {
363 .procname = "numa_balancing_scan_size_mb",
364 .data = &sysctl_numa_balancing_scan_size,
365 .maxlen = sizeof(unsigned int),
366 .mode = 0644,
367 .proc_handler = proc_dointvec_minmax,
368 .extra1 = SYSCTL_ONE,
369 },
370 {
371 .procname = "numa_balancing",
372 .data = NULL, /* filled in by handler */
373 .maxlen = sizeof(unsigned int),
374 .mode = 0644,
375 .proc_handler = sysctl_numa_balancing,
376 .extra1 = SYSCTL_ZERO,
377 .extra2 = SYSCTL_ONE,
378 },
379#endif /* CONFIG_NUMA_BALANCING */
380#endif /* CONFIG_SCHED_DEBUG */
381 {
382 .procname = "sched_rt_period_us",
383 .data = &sysctl_sched_rt_period,
384 .maxlen = sizeof(unsigned int),
385 .mode = 0644,
386 .proc_handler = sched_rt_handler,
387 },
388 {
389 .procname = "sched_rt_runtime_us",
390 .data = &sysctl_sched_rt_runtime,
391 .maxlen = sizeof(int),
392 .mode = 0644,
393 .proc_handler = sched_rt_handler,
394 },
395 {
396 .procname = "sched_rr_timeslice_ms",
397 .data = &sysctl_sched_rr_timeslice,
398 .maxlen = sizeof(int),
399 .mode = 0644,
400 .proc_handler = sched_rr_handler,
401 },
402#ifdef CONFIG_UCLAMP_TASK
403 {
404 .procname = "sched_util_clamp_min",
405 .data = &sysctl_sched_uclamp_util_min,
406 .maxlen = sizeof(unsigned int),
407 .mode = 0644,
408 .proc_handler = sysctl_sched_uclamp_handler,
409 },
410 {
411 .procname = "sched_util_clamp_max",
412 .data = &sysctl_sched_uclamp_util_max,
413 .maxlen = sizeof(unsigned int),
414 .mode = 0644,
415 .proc_handler = sysctl_sched_uclamp_handler,
416 },
417#endif
418#ifdef CONFIG_SCHED_AUTOGROUP
419 {
420 .procname = "sched_autogroup_enabled",
421 .data = &sysctl_sched_autogroup_enabled,
422 .maxlen = sizeof(unsigned int),
423 .mode = 0644,
424 .proc_handler = proc_dointvec_minmax,
425 .extra1 = SYSCTL_ZERO,
426 .extra2 = SYSCTL_ONE,
427 },
428#endif
429#ifdef CONFIG_CFS_BANDWIDTH
430 {
431 .procname = "sched_cfs_bandwidth_slice_us",
432 .data = &sysctl_sched_cfs_bandwidth_slice,
433 .maxlen = sizeof(unsigned int),
434 .mode = 0644,
435 .proc_handler = proc_dointvec_minmax,
436 .extra1 = SYSCTL_ONE,
437 },
438#endif
439#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
440 {
441 .procname = "sched_energy_aware",
442 .data = &sysctl_sched_energy_aware,
443 .maxlen = sizeof(unsigned int),
444 .mode = 0644,
445 .proc_handler = sched_energy_aware_handler,
446 .extra1 = SYSCTL_ZERO,
447 .extra2 = SYSCTL_ONE,
448 },
449#endif
450#ifdef CONFIG_PROVE_LOCKING
451 {
452 .procname = "prove_locking",
453 .data = &prove_locking,
454 .maxlen = sizeof(int),
455 .mode = 0644,
456 .proc_handler = proc_dointvec,
457 },
458#endif
459#ifdef CONFIG_LOCK_STAT
460 {
461 .procname = "lock_stat",
462 .data = &lock_stat,
463 .maxlen = sizeof(int),
464 .mode = 0644,
465 .proc_handler = proc_dointvec,
466 },
467#endif
468 {
469 .procname = "panic",
470 .data = &panic_timeout,
471 .maxlen = sizeof(int),
472 .mode = 0644,
473 .proc_handler = proc_dointvec,
474 },
475#ifdef CONFIG_COREDUMP
476 {
477 .procname = "core_uses_pid",
478 .data = &core_uses_pid,
479 .maxlen = sizeof(int),
480 .mode = 0644,
481 .proc_handler = proc_dointvec,
482 },
483 {
484 .procname = "core_pattern",
485 .data = core_pattern,
486 .maxlen = CORENAME_MAX_SIZE,
487 .mode = 0644,
488 .proc_handler = proc_dostring_coredump,
489 },
490 {
491 .procname = "core_pipe_limit",
492 .data = &core_pipe_limit,
493 .maxlen = sizeof(unsigned int),
494 .mode = 0644,
495 .proc_handler = proc_dointvec,
496 },
497#endif
498#ifdef CONFIG_PROC_SYSCTL
499 {
500 .procname = "tainted",
501 .maxlen = sizeof(long),
502 .mode = 0644,
503 .proc_handler = proc_taint,
504 },
505 {
506 .procname = "sysctl_writes_strict",
507 .data = &sysctl_writes_strict,
508 .maxlen = sizeof(int),
509 .mode = 0644,
510 .proc_handler = proc_dointvec_minmax,
511 .extra1 = &neg_one,
512 .extra2 = SYSCTL_ONE,
513 },
514#endif
515#ifdef CONFIG_LATENCYTOP
516 {
517 .procname = "latencytop",
518 .data = &latencytop_enabled,
519 .maxlen = sizeof(int),
520 .mode = 0644,
521 .proc_handler = sysctl_latencytop,
522 },
523#endif
524#ifdef CONFIG_BLK_DEV_INITRD
525 {
526 .procname = "real-root-dev",
527 .data = &real_root_dev,
528 .maxlen = sizeof(int),
529 .mode = 0644,
530 .proc_handler = proc_dointvec,
531 },
532#endif
533 {
534 .procname = "print-fatal-signals",
535 .data = &print_fatal_signals,
536 .maxlen = sizeof(int),
537 .mode = 0644,
538 .proc_handler = proc_dointvec,
539 },
540#ifdef CONFIG_SPARC
541 {
542 .procname = "reboot-cmd",
543 .data = reboot_command,
544 .maxlen = 256,
545 .mode = 0644,
546 .proc_handler = proc_dostring,
547 },
548 {
549 .procname = "stop-a",
550 .data = &stop_a_enabled,
551 .maxlen = sizeof (int),
552 .mode = 0644,
553 .proc_handler = proc_dointvec,
554 },
555 {
556 .procname = "scons-poweroff",
557 .data = &scons_pwroff,
558 .maxlen = sizeof (int),
559 .mode = 0644,
560 .proc_handler = proc_dointvec,
561 },
562#endif
563#ifdef CONFIG_SPARC64
564 {
565 .procname = "tsb-ratio",
566 .data = &sysctl_tsb_ratio,
567 .maxlen = sizeof (int),
568 .mode = 0644,
569 .proc_handler = proc_dointvec,
570 },
571#endif
572#ifdef CONFIG_PARISC
573 {
574 .procname = "soft-power",
575 .data = &pwrsw_enabled,
576 .maxlen = sizeof (int),
577 .mode = 0644,
578 .proc_handler = proc_dointvec,
579 },
580#endif
581#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
582 {
583 .procname = "unaligned-trap",
584 .data = &unaligned_enabled,
585 .maxlen = sizeof (int),
586 .mode = 0644,
587 .proc_handler = proc_dointvec,
588 },
589#endif
590 {
591 .procname = "ctrl-alt-del",
592 .data = &C_A_D,
593 .maxlen = sizeof(int),
594 .mode = 0644,
595 .proc_handler = proc_dointvec,
596 },
597#ifdef CONFIG_FUNCTION_TRACER
598 {
599 .procname = "ftrace_enabled",
600 .data = &ftrace_enabled,
601 .maxlen = sizeof(int),
602 .mode = 0644,
603 .proc_handler = ftrace_enable_sysctl,
604 },
605#endif
606#ifdef CONFIG_STACK_TRACER
607 {
608 .procname = "stack_tracer_enabled",
609 .data = &stack_tracer_enabled,
610 .maxlen = sizeof(int),
611 .mode = 0644,
612 .proc_handler = stack_trace_sysctl,
613 },
614#endif
615#ifdef CONFIG_TRACING
616 {
617 .procname = "ftrace_dump_on_oops",
618 .data = &ftrace_dump_on_oops,
619 .maxlen = sizeof(int),
620 .mode = 0644,
621 .proc_handler = proc_dointvec,
622 },
623 {
624 .procname = "traceoff_on_warning",
625 .data = &__disable_trace_on_warning,
626 .maxlen = sizeof(__disable_trace_on_warning),
627 .mode = 0644,
628 .proc_handler = proc_dointvec,
629 },
630 {
631 .procname = "tracepoint_printk",
632 .data = &tracepoint_printk,
633 .maxlen = sizeof(tracepoint_printk),
634 .mode = 0644,
635 .proc_handler = tracepoint_printk_sysctl,
636 },
637#endif
638#ifdef CONFIG_KEXEC_CORE
639 {
640 .procname = "kexec_load_disabled",
641 .data = &kexec_load_disabled,
642 .maxlen = sizeof(int),
643 .mode = 0644,
644 /* only handle a transition from default "0" to "1" */
645 .proc_handler = proc_dointvec_minmax,
646 .extra1 = SYSCTL_ONE,
647 .extra2 = SYSCTL_ONE,
648 },
649#endif
650#ifdef CONFIG_MODULES
651 {
652 .procname = "modprobe",
653 .data = &modprobe_path,
654 .maxlen = KMOD_PATH_LEN,
655 .mode = 0644,
656 .proc_handler = proc_dostring,
657 },
658 {
659 .procname = "modules_disabled",
660 .data = &modules_disabled,
661 .maxlen = sizeof(int),
662 .mode = 0644,
663 /* only handle a transition from default "0" to "1" */
664 .proc_handler = proc_dointvec_minmax,
665 .extra1 = SYSCTL_ONE,
666 .extra2 = SYSCTL_ONE,
667 },
668#endif
669#ifdef CONFIG_UEVENT_HELPER
670 {
671 .procname = "hotplug",
672 .data = &uevent_helper,
673 .maxlen = UEVENT_HELPER_PATH_LEN,
674 .mode = 0644,
675 .proc_handler = proc_dostring,
676 },
677#endif
678#ifdef CONFIG_CHR_DEV_SG
679 {
680 .procname = "sg-big-buff",
681 .data = &sg_big_buff,
682 .maxlen = sizeof (int),
683 .mode = 0444,
684 .proc_handler = proc_dointvec,
685 },
686#endif
687#ifdef CONFIG_BSD_PROCESS_ACCT
688 {
689 .procname = "acct",
690 .data = &acct_parm,
691 .maxlen = 3*sizeof(int),
692 .mode = 0644,
693 .proc_handler = proc_dointvec,
694 },
695#endif
696#ifdef CONFIG_MAGIC_SYSRQ
697 {
698 .procname = "sysrq",
699 .data = NULL,
700 .maxlen = sizeof (int),
701 .mode = 0644,
702 .proc_handler = sysrq_sysctl_handler,
703 },
704#endif
705#ifdef CONFIG_PROC_SYSCTL
706 {
707 .procname = "cad_pid",
708 .data = NULL,
709 .maxlen = sizeof (int),
710 .mode = 0600,
711 .proc_handler = proc_do_cad_pid,
712 },
713#endif
714 {
715 .procname = "threads-max",
716 .data = NULL,
717 .maxlen = sizeof(int),
718 .mode = 0644,
719 .proc_handler = sysctl_max_threads,
720 },
721 {
722 .procname = "random",
723 .mode = 0555,
724 .child = random_table,
725 },
726 {
727 .procname = "usermodehelper",
728 .mode = 0555,
729 .child = usermodehelper_table,
730 },
731#ifdef CONFIG_FW_LOADER_USER_HELPER
732 {
733 .procname = "firmware_config",
734 .mode = 0555,
735 .child = firmware_config_table,
736 },
737#endif
738 {
739 .procname = "overflowuid",
740 .data = &overflowuid,
741 .maxlen = sizeof(int),
742 .mode = 0644,
743 .proc_handler = proc_dointvec_minmax,
744 .extra1 = &minolduid,
745 .extra2 = &maxolduid,
746 },
747 {
748 .procname = "overflowgid",
749 .data = &overflowgid,
750 .maxlen = sizeof(int),
751 .mode = 0644,
752 .proc_handler = proc_dointvec_minmax,
753 .extra1 = &minolduid,
754 .extra2 = &maxolduid,
755 },
756#ifdef CONFIG_S390
757 {
758 .procname = "userprocess_debug",
759 .data = &show_unhandled_signals,
760 .maxlen = sizeof(int),
761 .mode = 0644,
762 .proc_handler = proc_dointvec,
763 },
764#endif
765 {
766 .procname = "pid_max",
767 .data = &pid_max,
768 .maxlen = sizeof (int),
769 .mode = 0644,
770 .proc_handler = proc_dointvec_minmax,
771 .extra1 = &pid_max_min,
772 .extra2 = &pid_max_max,
773 },
774 {
775 .procname = "panic_on_oops",
776 .data = &panic_on_oops,
777 .maxlen = sizeof(int),
778 .mode = 0644,
779 .proc_handler = proc_dointvec,
780 },
781 {
782 .procname = "panic_print",
783 .data = &panic_print,
784 .maxlen = sizeof(unsigned long),
785 .mode = 0644,
786 .proc_handler = proc_doulongvec_minmax,
787 },
788#if defined CONFIG_PRINTK
789 {
790 .procname = "printk",
791 .data = &console_loglevel,
792 .maxlen = 4*sizeof(int),
793 .mode = 0644,
794 .proc_handler = proc_dointvec,
795 },
796 {
797 .procname = "printk_ratelimit",
798 .data = &printk_ratelimit_state.interval,
799 .maxlen = sizeof(int),
800 .mode = 0644,
801 .proc_handler = proc_dointvec_jiffies,
802 },
803 {
804 .procname = "printk_ratelimit_burst",
805 .data = &printk_ratelimit_state.burst,
806 .maxlen = sizeof(int),
807 .mode = 0644,
808 .proc_handler = proc_dointvec,
809 },
810 {
811 .procname = "printk_delay",
812 .data = &printk_delay_msec,
813 .maxlen = sizeof(int),
814 .mode = 0644,
815 .proc_handler = proc_dointvec_minmax,
816 .extra1 = SYSCTL_ZERO,
817 .extra2 = &ten_thousand,
818 },
819 {
820 .procname = "printk_devkmsg",
821 .data = devkmsg_log_str,
822 .maxlen = DEVKMSG_STR_MAX_SIZE,
823 .mode = 0644,
824 .proc_handler = devkmsg_sysctl_set_loglvl,
825 },
826 {
827 .procname = "dmesg_restrict",
828 .data = &dmesg_restrict,
829 .maxlen = sizeof(int),
830 .mode = 0644,
831 .proc_handler = proc_dointvec_minmax_sysadmin,
832 .extra1 = SYSCTL_ZERO,
833 .extra2 = SYSCTL_ONE,
834 },
835 {
836 .procname = "kptr_restrict",
837 .data = &kptr_restrict,
838 .maxlen = sizeof(int),
839 .mode = 0644,
840 .proc_handler = proc_dointvec_minmax_sysadmin,
841 .extra1 = SYSCTL_ZERO,
842 .extra2 = &two,
843 },
844#endif
845 {
846 .procname = "ngroups_max",
847 .data = &ngroups_max,
848 .maxlen = sizeof (int),
849 .mode = 0444,
850 .proc_handler = proc_dointvec,
851 },
852 {
853 .procname = "cap_last_cap",
854 .data = (void *)&cap_last_cap,
855 .maxlen = sizeof(int),
856 .mode = 0444,
857 .proc_handler = proc_dointvec,
858 },
859#if defined(CONFIG_LOCKUP_DETECTOR)
860 {
861 .procname = "watchdog",
862 .data = &watchdog_user_enabled,
863 .maxlen = sizeof(int),
864 .mode = 0644,
865 .proc_handler = proc_watchdog,
866 .extra1 = SYSCTL_ZERO,
867 .extra2 = SYSCTL_ONE,
868 },
869 {
870 .procname = "watchdog_thresh",
871 .data = &watchdog_thresh,
872 .maxlen = sizeof(int),
873 .mode = 0644,
874 .proc_handler = proc_watchdog_thresh,
875 .extra1 = SYSCTL_ZERO,
876 .extra2 = &sixty,
877 },
878 {
879 .procname = "nmi_watchdog",
880 .data = &nmi_watchdog_user_enabled,
881 .maxlen = sizeof(int),
882 .mode = NMI_WATCHDOG_SYSCTL_PERM,
883 .proc_handler = proc_nmi_watchdog,
884 .extra1 = SYSCTL_ZERO,
885 .extra2 = SYSCTL_ONE,
886 },
887 {
888 .procname = "watchdog_cpumask",
889 .data = &watchdog_cpumask_bits,
890 .maxlen = NR_CPUS,
891 .mode = 0644,
892 .proc_handler = proc_watchdog_cpumask,
893 },
894#ifdef CONFIG_SOFTLOCKUP_DETECTOR
895 {
896 .procname = "soft_watchdog",
897 .data = &soft_watchdog_user_enabled,
898 .maxlen = sizeof(int),
899 .mode = 0644,
900 .proc_handler = proc_soft_watchdog,
901 .extra1 = SYSCTL_ZERO,
902 .extra2 = SYSCTL_ONE,
903 },
904 {
905 .procname = "softlockup_panic",
906 .data = &softlockup_panic,
907 .maxlen = sizeof(int),
908 .mode = 0644,
909 .proc_handler = proc_dointvec_minmax,
910 .extra1 = SYSCTL_ZERO,
911 .extra2 = SYSCTL_ONE,
912 },
913#ifdef CONFIG_SMP
914 {
915 .procname = "softlockup_all_cpu_backtrace",
916 .data = &sysctl_softlockup_all_cpu_backtrace,
917 .maxlen = sizeof(int),
918 .mode = 0644,
919 .proc_handler = proc_dointvec_minmax,
920 .extra1 = SYSCTL_ZERO,
921 .extra2 = SYSCTL_ONE,
922 },
923#endif /* CONFIG_SMP */
924#endif
925#ifdef CONFIG_HARDLOCKUP_DETECTOR
926 {
927 .procname = "hardlockup_panic",
928 .data = &hardlockup_panic,
929 .maxlen = sizeof(int),
930 .mode = 0644,
931 .proc_handler = proc_dointvec_minmax,
932 .extra1 = SYSCTL_ZERO,
933 .extra2 = SYSCTL_ONE,
934 },
935#ifdef CONFIG_SMP
936 {
937 .procname = "hardlockup_all_cpu_backtrace",
938 .data = &sysctl_hardlockup_all_cpu_backtrace,
939 .maxlen = sizeof(int),
940 .mode = 0644,
941 .proc_handler = proc_dointvec_minmax,
942 .extra1 = SYSCTL_ZERO,
943 .extra2 = SYSCTL_ONE,
944 },
945#endif /* CONFIG_SMP */
946#endif
947#endif
948
949#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
950 {
951 .procname = "unknown_nmi_panic",
952 .data = &unknown_nmi_panic,
953 .maxlen = sizeof (int),
954 .mode = 0644,
955 .proc_handler = proc_dointvec,
956 },
957#endif
958#if defined(CONFIG_X86)
959 {
960 .procname = "panic_on_unrecovered_nmi",
961 .data = &panic_on_unrecovered_nmi,
962 .maxlen = sizeof(int),
963 .mode = 0644,
964 .proc_handler = proc_dointvec,
965 },
966 {
967 .procname = "panic_on_io_nmi",
968 .data = &panic_on_io_nmi,
969 .maxlen = sizeof(int),
970 .mode = 0644,
971 .proc_handler = proc_dointvec,
972 },
973#ifdef CONFIG_DEBUG_STACKOVERFLOW
974 {
975 .procname = "panic_on_stackoverflow",
976 .data = &sysctl_panic_on_stackoverflow,
977 .maxlen = sizeof(int),
978 .mode = 0644,
979 .proc_handler = proc_dointvec,
980 },
981#endif
982 {
983 .procname = "bootloader_type",
984 .data = &bootloader_type,
985 .maxlen = sizeof (int),
986 .mode = 0444,
987 .proc_handler = proc_dointvec,
988 },
989 {
990 .procname = "bootloader_version",
991 .data = &bootloader_version,
992 .maxlen = sizeof (int),
993 .mode = 0444,
994 .proc_handler = proc_dointvec,
995 },
996 {
997 .procname = "io_delay_type",
998 .data = &io_delay_type,
999 .maxlen = sizeof(int),
1000 .mode = 0644,
1001 .proc_handler = proc_dointvec,
1002 },
1003#endif
1004#if defined(CONFIG_MMU)
1005 {
1006 .procname = "randomize_va_space",
1007 .data = &randomize_va_space,
1008 .maxlen = sizeof(int),
1009 .mode = 0644,
1010 .proc_handler = proc_dointvec,
1011 },
1012#endif
1013#if defined(CONFIG_S390) && defined(CONFIG_SMP)
1014 {
1015 .procname = "spin_retry",
1016 .data = &spin_retry,
1017 .maxlen = sizeof (int),
1018 .mode = 0644,
1019 .proc_handler = proc_dointvec,
1020 },
1021#endif
1022#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
1023 {
1024 .procname = "acpi_video_flags",
1025 .data = &acpi_realmode_flags,
1026 .maxlen = sizeof (unsigned long),
1027 .mode = 0644,
1028 .proc_handler = proc_doulongvec_minmax,
1029 },
1030#endif
1031#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
1032 {
1033 .procname = "ignore-unaligned-usertrap",
1034 .data = &no_unaligned_warning,
1035 .maxlen = sizeof (int),
1036 .mode = 0644,
1037 .proc_handler = proc_dointvec,
1038 },
1039#endif
1040#ifdef CONFIG_IA64
1041 {
1042 .procname = "unaligned-dump-stack",
1043 .data = &unaligned_dump_stack,
1044 .maxlen = sizeof (int),
1045 .mode = 0644,
1046 .proc_handler = proc_dointvec,
1047 },
1048#endif
1049#ifdef CONFIG_DETECT_HUNG_TASK
1050 {
1051 .procname = "hung_task_panic",
1052 .data = &sysctl_hung_task_panic,
1053 .maxlen = sizeof(int),
1054 .mode = 0644,
1055 .proc_handler = proc_dointvec_minmax,
1056 .extra1 = SYSCTL_ZERO,
1057 .extra2 = SYSCTL_ONE,
1058 },
1059 {
1060 .procname = "hung_task_check_count",
1061 .data = &sysctl_hung_task_check_count,
1062 .maxlen = sizeof(int),
1063 .mode = 0644,
1064 .proc_handler = proc_dointvec_minmax,
1065 .extra1 = SYSCTL_ZERO,
1066 },
1067 {
1068 .procname = "hung_task_timeout_secs",
1069 .data = &sysctl_hung_task_timeout_secs,
1070 .maxlen = sizeof(unsigned long),
1071 .mode = 0644,
1072 .proc_handler = proc_dohung_task_timeout_secs,
1073 .extra2 = &hung_task_timeout_max,
1074 },
1075 {
1076 .procname = "hung_task_check_interval_secs",
1077 .data = &sysctl_hung_task_check_interval_secs,
1078 .maxlen = sizeof(unsigned long),
1079 .mode = 0644,
1080 .proc_handler = proc_dohung_task_timeout_secs,
1081 .extra2 = &hung_task_timeout_max,
1082 },
1083 {
1084 .procname = "hung_task_warnings",
1085 .data = &sysctl_hung_task_warnings,
1086 .maxlen = sizeof(int),
1087 .mode = 0644,
1088 .proc_handler = proc_dointvec_minmax,
1089 .extra1 = &neg_one,
1090 },
1091#endif
1092#ifdef CONFIG_RT_MUTEXES
1093 {
1094 .procname = "max_lock_depth",
1095 .data = &max_lock_depth,
1096 .maxlen = sizeof(int),
1097 .mode = 0644,
1098 .proc_handler = proc_dointvec,
1099 },
1100#endif
1101 {
1102 .procname = "poweroff_cmd",
1103 .data = &poweroff_cmd,
1104 .maxlen = POWEROFF_CMD_PATH_LEN,
1105 .mode = 0644,
1106 .proc_handler = proc_dostring,
1107 },
1108#ifdef CONFIG_KEYS
1109 {
1110 .procname = "keys",
1111 .mode = 0555,
1112 .child = key_sysctls,
1113 },
1114#endif
1115#ifdef CONFIG_PERF_EVENTS
1116 /*
1117 * User-space scripts rely on the existence of this file
1118 * as a feature check for perf_events being enabled.
1119 *
1120 * So it's an ABI, do not remove!
1121 */
1122 {
1123 .procname = "perf_event_paranoid",
1124 .data = &sysctl_perf_event_paranoid,
1125 .maxlen = sizeof(sysctl_perf_event_paranoid),
1126 .mode = 0644,
1127 .proc_handler = proc_dointvec,
1128 },
1129 {
1130 .procname = "perf_event_mlock_kb",
1131 .data = &sysctl_perf_event_mlock,
1132 .maxlen = sizeof(sysctl_perf_event_mlock),
1133 .mode = 0644,
1134 .proc_handler = proc_dointvec,
1135 },
1136 {
1137 .procname = "perf_event_max_sample_rate",
1138 .data = &sysctl_perf_event_sample_rate,
1139 .maxlen = sizeof(sysctl_perf_event_sample_rate),
1140 .mode = 0644,
1141 .proc_handler = perf_proc_update_handler,
1142 .extra1 = SYSCTL_ONE,
1143 },
1144 {
1145 .procname = "perf_cpu_time_max_percent",
1146 .data = &sysctl_perf_cpu_time_max_percent,
1147 .maxlen = sizeof(sysctl_perf_cpu_time_max_percent),
1148 .mode = 0644,
1149 .proc_handler = perf_cpu_time_max_percent_handler,
1150 .extra1 = SYSCTL_ZERO,
1151 .extra2 = &one_hundred,
1152 },
1153 {
1154 .procname = "perf_event_max_stack",
1155 .data = &sysctl_perf_event_max_stack,
1156 .maxlen = sizeof(sysctl_perf_event_max_stack),
1157 .mode = 0644,
1158 .proc_handler = perf_event_max_stack_handler,
1159 .extra1 = SYSCTL_ZERO,
1160 .extra2 = &six_hundred_forty_kb,
1161 },
1162 {
1163 .procname = "perf_event_max_contexts_per_stack",
1164 .data = &sysctl_perf_event_max_contexts_per_stack,
1165 .maxlen = sizeof(sysctl_perf_event_max_contexts_per_stack),
1166 .mode = 0644,
1167 .proc_handler = perf_event_max_stack_handler,
1168 .extra1 = SYSCTL_ZERO,
1169 .extra2 = &one_thousand,
1170 },
1171#endif
1172 {
1173 .procname = "panic_on_warn",
1174 .data = &panic_on_warn,
1175 .maxlen = sizeof(int),
1176 .mode = 0644,
1177 .proc_handler = proc_dointvec_minmax,
1178 .extra1 = SYSCTL_ZERO,
1179 .extra2 = SYSCTL_ONE,
1180 },
1181#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
1182 {
1183 .procname = "timer_migration",
1184 .data = &sysctl_timer_migration,
1185 .maxlen = sizeof(unsigned int),
1186 .mode = 0644,
1187 .proc_handler = timer_migration_handler,
1188 .extra1 = SYSCTL_ZERO,
1189 .extra2 = SYSCTL_ONE,
1190 },
1191#endif
1192#ifdef CONFIG_BPF_SYSCALL
1193 {
1194 .procname = "unprivileged_bpf_disabled",
1195 .data = &sysctl_unprivileged_bpf_disabled,
1196 .maxlen = sizeof(sysctl_unprivileged_bpf_disabled),
1197 .mode = 0644,
1198 /* only handle a transition from default "0" to "1" */
1199 .proc_handler = proc_dointvec_minmax,
1200 .extra1 = SYSCTL_ONE,
1201 .extra2 = SYSCTL_ONE,
1202 },
1203 {
1204 .procname = "bpf_stats_enabled",
1205 .data = &bpf_stats_enabled_key.key,
1206 .maxlen = sizeof(bpf_stats_enabled_key),
1207 .mode = 0644,
1208 .proc_handler = proc_do_static_key,
1209 },
1210#endif
1211#if defined(CONFIG_TREE_RCU)
1212 {
1213 .procname = "panic_on_rcu_stall",
1214 .data = &sysctl_panic_on_rcu_stall,
1215 .maxlen = sizeof(sysctl_panic_on_rcu_stall),
1216 .mode = 0644,
1217 .proc_handler = proc_dointvec_minmax,
1218 .extra1 = SYSCTL_ZERO,
1219 .extra2 = SYSCTL_ONE,
1220 },
1221#endif
1222#ifdef CONFIG_STACKLEAK_RUNTIME_DISABLE
1223 {
1224 .procname = "stack_erasing",
1225 .data = NULL,
1226 .maxlen = sizeof(int),
1227 .mode = 0600,
1228 .proc_handler = stack_erasing_sysctl,
1229 .extra1 = SYSCTL_ZERO,
1230 .extra2 = SYSCTL_ONE,
1231 },
1232#endif
1233 { }
1234};
1235
1236static struct ctl_table vm_table[] = {
1237 {
1238 .procname = "overcommit_memory",
1239 .data = &sysctl_overcommit_memory,
1240 .maxlen = sizeof(sysctl_overcommit_memory),
1241 .mode = 0644,
1242 .proc_handler = proc_dointvec_minmax,
1243 .extra1 = SYSCTL_ZERO,
1244 .extra2 = &two,
1245 },
1246 {
1247 .procname = "panic_on_oom",
1248 .data = &sysctl_panic_on_oom,
1249 .maxlen = sizeof(sysctl_panic_on_oom),
1250 .mode = 0644,
1251 .proc_handler = proc_dointvec_minmax,
1252 .extra1 = SYSCTL_ZERO,
1253 .extra2 = &two,
1254 },
1255 {
1256 .procname = "oom_kill_allocating_task",
1257 .data = &sysctl_oom_kill_allocating_task,
1258 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1259 .mode = 0644,
1260 .proc_handler = proc_dointvec,
1261 },
1262 {
1263 .procname = "oom_dump_tasks",
1264 .data = &sysctl_oom_dump_tasks,
1265 .maxlen = sizeof(sysctl_oom_dump_tasks),
1266 .mode = 0644,
1267 .proc_handler = proc_dointvec,
1268 },
1269 {
1270 .procname = "overcommit_ratio",
1271 .data = &sysctl_overcommit_ratio,
1272 .maxlen = sizeof(sysctl_overcommit_ratio),
1273 .mode = 0644,
1274 .proc_handler = overcommit_ratio_handler,
1275 },
1276 {
1277 .procname = "overcommit_kbytes",
1278 .data = &sysctl_overcommit_kbytes,
1279 .maxlen = sizeof(sysctl_overcommit_kbytes),
1280 .mode = 0644,
1281 .proc_handler = overcommit_kbytes_handler,
1282 },
1283 {
1284 .procname = "page-cluster",
1285 .data = &page_cluster,
1286 .maxlen = sizeof(int),
1287 .mode = 0644,
1288 .proc_handler = proc_dointvec_minmax,
1289 .extra1 = SYSCTL_ZERO,
1290 },
1291 {
1292 .procname = "dirty_background_ratio",
1293 .data = &dirty_background_ratio,
1294 .maxlen = sizeof(dirty_background_ratio),
1295 .mode = 0644,
1296 .proc_handler = dirty_background_ratio_handler,
1297 .extra1 = SYSCTL_ZERO,
1298 .extra2 = &one_hundred,
1299 },
1300 {
1301 .procname = "dirty_background_bytes",
1302 .data = &dirty_background_bytes,
1303 .maxlen = sizeof(dirty_background_bytes),
1304 .mode = 0644,
1305 .proc_handler = dirty_background_bytes_handler,
1306 .extra1 = &one_ul,
1307 },
1308 {
1309 .procname = "dirty_ratio",
1310 .data = &vm_dirty_ratio,
1311 .maxlen = sizeof(vm_dirty_ratio),
1312 .mode = 0644,
1313 .proc_handler = dirty_ratio_handler,
1314 .extra1 = SYSCTL_ZERO,
1315 .extra2 = &one_hundred,
1316 },
1317 {
1318 .procname = "dirty_bytes",
1319 .data = &vm_dirty_bytes,
1320 .maxlen = sizeof(vm_dirty_bytes),
1321 .mode = 0644,
1322 .proc_handler = dirty_bytes_handler,
1323 .extra1 = &dirty_bytes_min,
1324 },
1325 {
1326 .procname = "dirty_writeback_centisecs",
1327 .data = &dirty_writeback_interval,
1328 .maxlen = sizeof(dirty_writeback_interval),
1329 .mode = 0644,
1330 .proc_handler = dirty_writeback_centisecs_handler,
1331 },
1332 {
1333 .procname = "dirty_expire_centisecs",
1334 .data = &dirty_expire_interval,
1335 .maxlen = sizeof(dirty_expire_interval),
1336 .mode = 0644,
1337 .proc_handler = proc_dointvec_minmax,
1338 .extra1 = SYSCTL_ZERO,
1339 },
1340 {
1341 .procname = "dirtytime_expire_seconds",
1342 .data = &dirtytime_expire_interval,
1343 .maxlen = sizeof(dirtytime_expire_interval),
1344 .mode = 0644,
1345 .proc_handler = dirtytime_interval_handler,
1346 .extra1 = SYSCTL_ZERO,
1347 },
1348 {
1349 .procname = "swappiness",
1350 .data = &vm_swappiness,
1351 .maxlen = sizeof(vm_swappiness),
1352 .mode = 0644,
1353 .proc_handler = proc_dointvec_minmax,
1354 .extra1 = SYSCTL_ZERO,
1355 .extra2 = &one_hundred,
1356 },
1357#ifdef CONFIG_HUGETLB_PAGE
1358 {
1359 .procname = "nr_hugepages",
1360 .data = NULL,
1361 .maxlen = sizeof(unsigned long),
1362 .mode = 0644,
1363 .proc_handler = hugetlb_sysctl_handler,
1364 },
1365#ifdef CONFIG_NUMA
1366 {
1367 .procname = "nr_hugepages_mempolicy",
1368 .data = NULL,
1369 .maxlen = sizeof(unsigned long),
1370 .mode = 0644,
1371 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1372 },
1373 {
1374 .procname = "numa_stat",
1375 .data = &sysctl_vm_numa_stat,
1376 .maxlen = sizeof(int),
1377 .mode = 0644,
1378 .proc_handler = sysctl_vm_numa_stat_handler,
1379 .extra1 = SYSCTL_ZERO,
1380 .extra2 = SYSCTL_ONE,
1381 },
1382#endif
1383 {
1384 .procname = "hugetlb_shm_group",
1385 .data = &sysctl_hugetlb_shm_group,
1386 .maxlen = sizeof(gid_t),
1387 .mode = 0644,
1388 .proc_handler = proc_dointvec,
1389 },
1390 {
1391 .procname = "nr_overcommit_hugepages",
1392 .data = NULL,
1393 .maxlen = sizeof(unsigned long),
1394 .mode = 0644,
1395 .proc_handler = hugetlb_overcommit_handler,
1396 },
1397#endif
1398 {
1399 .procname = "lowmem_reserve_ratio",
1400 .data = &sysctl_lowmem_reserve_ratio,
1401 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1402 .mode = 0644,
1403 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
1404 },
1405 {
1406 .procname = "drop_caches",
1407 .data = &sysctl_drop_caches,
1408 .maxlen = sizeof(int),
1409 .mode = 0200,
1410 .proc_handler = drop_caches_sysctl_handler,
1411 .extra1 = SYSCTL_ONE,
1412 .extra2 = &four,
1413 },
1414#ifdef CONFIG_COMPACTION
1415 {
1416 .procname = "compact_memory",
1417 .data = &sysctl_compact_memory,
1418 .maxlen = sizeof(int),
1419 .mode = 0200,
1420 .proc_handler = sysctl_compaction_handler,
1421 },
1422 {
1423 .procname = "extfrag_threshold",
1424 .data = &sysctl_extfrag_threshold,
1425 .maxlen = sizeof(int),
1426 .mode = 0644,
1427 .proc_handler = proc_dointvec_minmax,
1428 .extra1 = &min_extfrag_threshold,
1429 .extra2 = &max_extfrag_threshold,
1430 },
1431 {
1432 .procname = "compact_unevictable_allowed",
1433 .data = &sysctl_compact_unevictable_allowed,
1434 .maxlen = sizeof(int),
1435 .mode = 0644,
1436 .proc_handler = proc_dointvec_minmax_warn_RT_change,
1437 .extra1 = SYSCTL_ZERO,
1438 .extra2 = SYSCTL_ONE,
1439 },
1440
1441#endif /* CONFIG_COMPACTION */
1442 {
1443 .procname = "min_free_kbytes",
1444 .data = &min_free_kbytes,
1445 .maxlen = sizeof(min_free_kbytes),
1446 .mode = 0644,
1447 .proc_handler = min_free_kbytes_sysctl_handler,
1448 .extra1 = SYSCTL_ZERO,
1449 },
1450 {
1451 .procname = "watermark_boost_factor",
1452 .data = &watermark_boost_factor,
1453 .maxlen = sizeof(watermark_boost_factor),
1454 .mode = 0644,
1455 .proc_handler = proc_dointvec_minmax,
1456 .extra1 = SYSCTL_ZERO,
1457 },
1458 {
1459 .procname = "watermark_scale_factor",
1460 .data = &watermark_scale_factor,
1461 .maxlen = sizeof(watermark_scale_factor),
1462 .mode = 0644,
1463 .proc_handler = watermark_scale_factor_sysctl_handler,
1464 .extra1 = SYSCTL_ONE,
1465 .extra2 = &one_thousand,
1466 },
1467 {
1468 .procname = "percpu_pagelist_fraction",
1469 .data = &percpu_pagelist_fraction,
1470 .maxlen = sizeof(percpu_pagelist_fraction),
1471 .mode = 0644,
1472 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
1473 .extra1 = SYSCTL_ZERO,
1474 },
1475#ifdef CONFIG_MMU
1476 {
1477 .procname = "max_map_count",
1478 .data = &sysctl_max_map_count,
1479 .maxlen = sizeof(sysctl_max_map_count),
1480 .mode = 0644,
1481 .proc_handler = proc_dointvec_minmax,
1482 .extra1 = SYSCTL_ZERO,
1483 },
1484#else
1485 {
1486 .procname = "nr_trim_pages",
1487 .data = &sysctl_nr_trim_pages,
1488 .maxlen = sizeof(sysctl_nr_trim_pages),
1489 .mode = 0644,
1490 .proc_handler = proc_dointvec_minmax,
1491 .extra1 = SYSCTL_ZERO,
1492 },
1493#endif
1494 {
1495 .procname = "laptop_mode",
1496 .data = &laptop_mode,
1497 .maxlen = sizeof(laptop_mode),
1498 .mode = 0644,
1499 .proc_handler = proc_dointvec_jiffies,
1500 },
1501 {
1502 .procname = "block_dump",
1503 .data = &block_dump,
1504 .maxlen = sizeof(block_dump),
1505 .mode = 0644,
1506 .proc_handler = proc_dointvec,
1507 .extra1 = SYSCTL_ZERO,
1508 },
1509 {
1510 .procname = "vfs_cache_pressure",
1511 .data = &sysctl_vfs_cache_pressure,
1512 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1513 .mode = 0644,
1514 .proc_handler = proc_dointvec,
1515 .extra1 = SYSCTL_ZERO,
1516 },
1517#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \
1518 defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT)
1519 {
1520 .procname = "legacy_va_layout",
1521 .data = &sysctl_legacy_va_layout,
1522 .maxlen = sizeof(sysctl_legacy_va_layout),
1523 .mode = 0644,
1524 .proc_handler = proc_dointvec,
1525 .extra1 = SYSCTL_ZERO,
1526 },
1527#endif
1528#ifdef CONFIG_NUMA
1529 {
1530 .procname = "zone_reclaim_mode",
1531 .data = &node_reclaim_mode,
1532 .maxlen = sizeof(node_reclaim_mode),
1533 .mode = 0644,
1534 .proc_handler = proc_dointvec,
1535 .extra1 = SYSCTL_ZERO,
1536 },
1537 {
1538 .procname = "min_unmapped_ratio",
1539 .data = &sysctl_min_unmapped_ratio,
1540 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1541 .mode = 0644,
1542 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
1543 .extra1 = SYSCTL_ZERO,
1544 .extra2 = &one_hundred,
1545 },
1546 {
1547 .procname = "min_slab_ratio",
1548 .data = &sysctl_min_slab_ratio,
1549 .maxlen = sizeof(sysctl_min_slab_ratio),
1550 .mode = 0644,
1551 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
1552 .extra1 = SYSCTL_ZERO,
1553 .extra2 = &one_hundred,
1554 },
1555#endif
1556#ifdef CONFIG_SMP
1557 {
1558 .procname = "stat_interval",
1559 .data = &sysctl_stat_interval,
1560 .maxlen = sizeof(sysctl_stat_interval),
1561 .mode = 0644,
1562 .proc_handler = proc_dointvec_jiffies,
1563 },
1564 {
1565 .procname = "stat_refresh",
1566 .data = NULL,
1567 .maxlen = 0,
1568 .mode = 0600,
1569 .proc_handler = vmstat_refresh,
1570 },
1571#endif
1572#ifdef CONFIG_MMU
1573 {
1574 .procname = "mmap_min_addr",
1575 .data = &dac_mmap_min_addr,
1576 .maxlen = sizeof(unsigned long),
1577 .mode = 0644,
1578 .proc_handler = mmap_min_addr_handler,
1579 },
1580#endif
1581#ifdef CONFIG_NUMA
1582 {
1583 .procname = "numa_zonelist_order",
1584 .data = &numa_zonelist_order,
1585 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1586 .mode = 0644,
1587 .proc_handler = numa_zonelist_order_handler,
1588 },
1589#endif
1590#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1591 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1592 {
1593 .procname = "vdso_enabled",
1594#ifdef CONFIG_X86_32
1595 .data = &vdso32_enabled,
1596 .maxlen = sizeof(vdso32_enabled),
1597#else
1598 .data = &vdso_enabled,
1599 .maxlen = sizeof(vdso_enabled),
1600#endif
1601 .mode = 0644,
1602 .proc_handler = proc_dointvec,
1603 .extra1 = SYSCTL_ZERO,
1604 },
1605#endif
1606#ifdef CONFIG_HIGHMEM
1607 {
1608 .procname = "highmem_is_dirtyable",
1609 .data = &vm_highmem_is_dirtyable,
1610 .maxlen = sizeof(vm_highmem_is_dirtyable),
1611 .mode = 0644,
1612 .proc_handler = proc_dointvec_minmax,
1613 .extra1 = SYSCTL_ZERO,
1614 .extra2 = SYSCTL_ONE,
1615 },
1616#endif
1617#ifdef CONFIG_MEMORY_FAILURE
1618 {
1619 .procname = "memory_failure_early_kill",
1620 .data = &sysctl_memory_failure_early_kill,
1621 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1622 .mode = 0644,
1623 .proc_handler = proc_dointvec_minmax,
1624 .extra1 = SYSCTL_ZERO,
1625 .extra2 = SYSCTL_ONE,
1626 },
1627 {
1628 .procname = "memory_failure_recovery",
1629 .data = &sysctl_memory_failure_recovery,
1630 .maxlen = sizeof(sysctl_memory_failure_recovery),
1631 .mode = 0644,
1632 .proc_handler = proc_dointvec_minmax,
1633 .extra1 = SYSCTL_ZERO,
1634 .extra2 = SYSCTL_ONE,
1635 },
1636#endif
1637 {
1638 .procname = "user_reserve_kbytes",
1639 .data = &sysctl_user_reserve_kbytes,
1640 .maxlen = sizeof(sysctl_user_reserve_kbytes),
1641 .mode = 0644,
1642 .proc_handler = proc_doulongvec_minmax,
1643 },
1644 {
1645 .procname = "admin_reserve_kbytes",
1646 .data = &sysctl_admin_reserve_kbytes,
1647 .maxlen = sizeof(sysctl_admin_reserve_kbytes),
1648 .mode = 0644,
1649 .proc_handler = proc_doulongvec_minmax,
1650 },
1651#ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
1652 {
1653 .procname = "mmap_rnd_bits",
1654 .data = &mmap_rnd_bits,
1655 .maxlen = sizeof(mmap_rnd_bits),
1656 .mode = 0600,
1657 .proc_handler = proc_dointvec_minmax,
1658 .extra1 = (void *)&mmap_rnd_bits_min,
1659 .extra2 = (void *)&mmap_rnd_bits_max,
1660 },
1661#endif
1662#ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS
1663 {
1664 .procname = "mmap_rnd_compat_bits",
1665 .data = &mmap_rnd_compat_bits,
1666 .maxlen = sizeof(mmap_rnd_compat_bits),
1667 .mode = 0600,
1668 .proc_handler = proc_dointvec_minmax,
1669 .extra1 = (void *)&mmap_rnd_compat_bits_min,
1670 .extra2 = (void *)&mmap_rnd_compat_bits_max,
1671 },
1672#endif
1673#ifdef CONFIG_USERFAULTFD
1674 {
1675 .procname = "unprivileged_userfaultfd",
1676 .data = &sysctl_unprivileged_userfaultfd,
1677 .maxlen = sizeof(sysctl_unprivileged_userfaultfd),
1678 .mode = 0644,
1679 .proc_handler = proc_dointvec_minmax,
1680 .extra1 = SYSCTL_ZERO,
1681 .extra2 = SYSCTL_ONE,
1682 },
1683#endif
1684 { }
1685};
1686
1687static struct ctl_table fs_table[] = {
1688 {
1689 .procname = "inode-nr",
1690 .data = &inodes_stat,
1691 .maxlen = 2*sizeof(long),
1692 .mode = 0444,
1693 .proc_handler = proc_nr_inodes,
1694 },
1695 {
1696 .procname = "inode-state",
1697 .data = &inodes_stat,
1698 .maxlen = 7*sizeof(long),
1699 .mode = 0444,
1700 .proc_handler = proc_nr_inodes,
1701 },
1702 {
1703 .procname = "file-nr",
1704 .data = &files_stat,
1705 .maxlen = sizeof(files_stat),
1706 .mode = 0444,
1707 .proc_handler = proc_nr_files,
1708 },
1709 {
1710 .procname = "file-max",
1711 .data = &files_stat.max_files,
1712 .maxlen = sizeof(files_stat.max_files),
1713 .mode = 0644,
1714 .proc_handler = proc_doulongvec_minmax,
1715 .extra1 = &zero_ul,
1716 .extra2 = &long_max,
1717 },
1718 {
1719 .procname = "nr_open",
1720 .data = &sysctl_nr_open,
1721 .maxlen = sizeof(unsigned int),
1722 .mode = 0644,
1723 .proc_handler = proc_dointvec_minmax,
1724 .extra1 = &sysctl_nr_open_min,
1725 .extra2 = &sysctl_nr_open_max,
1726 },
1727 {
1728 .procname = "dentry-state",
1729 .data = &dentry_stat,
1730 .maxlen = 6*sizeof(long),
1731 .mode = 0444,
1732 .proc_handler = proc_nr_dentry,
1733 },
1734 {
1735 .procname = "overflowuid",
1736 .data = &fs_overflowuid,
1737 .maxlen = sizeof(int),
1738 .mode = 0644,
1739 .proc_handler = proc_dointvec_minmax,
1740 .extra1 = &minolduid,
1741 .extra2 = &maxolduid,
1742 },
1743 {
1744 .procname = "overflowgid",
1745 .data = &fs_overflowgid,
1746 .maxlen = sizeof(int),
1747 .mode = 0644,
1748 .proc_handler = proc_dointvec_minmax,
1749 .extra1 = &minolduid,
1750 .extra2 = &maxolduid,
1751 },
1752#ifdef CONFIG_FILE_LOCKING
1753 {
1754 .procname = "leases-enable",
1755 .data = &leases_enable,
1756 .maxlen = sizeof(int),
1757 .mode = 0644,
1758 .proc_handler = proc_dointvec,
1759 },
1760#endif
1761#ifdef CONFIG_DNOTIFY
1762 {
1763 .procname = "dir-notify-enable",
1764 .data = &dir_notify_enable,
1765 .maxlen = sizeof(int),
1766 .mode = 0644,
1767 .proc_handler = proc_dointvec,
1768 },
1769#endif
1770#ifdef CONFIG_MMU
1771#ifdef CONFIG_FILE_LOCKING
1772 {
1773 .procname = "lease-break-time",
1774 .data = &lease_break_time,
1775 .maxlen = sizeof(int),
1776 .mode = 0644,
1777 .proc_handler = proc_dointvec,
1778 },
1779#endif
1780#ifdef CONFIG_AIO
1781 {
1782 .procname = "aio-nr",
1783 .data = &aio_nr,
1784 .maxlen = sizeof(aio_nr),
1785 .mode = 0444,
1786 .proc_handler = proc_doulongvec_minmax,
1787 },
1788 {
1789 .procname = "aio-max-nr",
1790 .data = &aio_max_nr,
1791 .maxlen = sizeof(aio_max_nr),
1792 .mode = 0644,
1793 .proc_handler = proc_doulongvec_minmax,
1794 },
1795#endif /* CONFIG_AIO */
1796#ifdef CONFIG_INOTIFY_USER
1797 {
1798 .procname = "inotify",
1799 .mode = 0555,
1800 .child = inotify_table,
1801 },
1802#endif
1803#ifdef CONFIG_EPOLL
1804 {
1805 .procname = "epoll",
1806 .mode = 0555,
1807 .child = epoll_table,
1808 },
1809#endif
1810#endif
1811 {
1812 .procname = "protected_symlinks",
1813 .data = &sysctl_protected_symlinks,
1814 .maxlen = sizeof(int),
1815 .mode = 0600,
1816 .proc_handler = proc_dointvec_minmax,
1817 .extra1 = SYSCTL_ZERO,
1818 .extra2 = SYSCTL_ONE,
1819 },
1820 {
1821 .procname = "protected_hardlinks",
1822 .data = &sysctl_protected_hardlinks,
1823 .maxlen = sizeof(int),
1824 .mode = 0600,
1825 .proc_handler = proc_dointvec_minmax,
1826 .extra1 = SYSCTL_ZERO,
1827 .extra2 = SYSCTL_ONE,
1828 },
1829 {
1830 .procname = "protected_fifos",
1831 .data = &sysctl_protected_fifos,
1832 .maxlen = sizeof(int),
1833 .mode = 0600,
1834 .proc_handler = proc_dointvec_minmax,
1835 .extra1 = SYSCTL_ZERO,
1836 .extra2 = &two,
1837 },
1838 {
1839 .procname = "protected_regular",
1840 .data = &sysctl_protected_regular,
1841 .maxlen = sizeof(int),
1842 .mode = 0600,
1843 .proc_handler = proc_dointvec_minmax,
1844 .extra1 = SYSCTL_ZERO,
1845 .extra2 = &two,
1846 },
1847 {
1848 .procname = "suid_dumpable",
1849 .data = &suid_dumpable,
1850 .maxlen = sizeof(int),
1851 .mode = 0644,
1852 .proc_handler = proc_dointvec_minmax_coredump,
1853 .extra1 = SYSCTL_ZERO,
1854 .extra2 = &two,
1855 },
1856#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1857 {
1858 .procname = "binfmt_misc",
1859 .mode = 0555,
1860 .child = sysctl_mount_point,
1861 },
1862#endif
1863 {
1864 .procname = "pipe-max-size",
1865 .data = &pipe_max_size,
1866 .maxlen = sizeof(pipe_max_size),
1867 .mode = 0644,
1868 .proc_handler = proc_dopipe_max_size,
1869 },
1870 {
1871 .procname = "pipe-user-pages-hard",
1872 .data = &pipe_user_pages_hard,
1873 .maxlen = sizeof(pipe_user_pages_hard),
1874 .mode = 0644,
1875 .proc_handler = proc_doulongvec_minmax,
1876 },
1877 {
1878 .procname = "pipe-user-pages-soft",
1879 .data = &pipe_user_pages_soft,
1880 .maxlen = sizeof(pipe_user_pages_soft),
1881 .mode = 0644,
1882 .proc_handler = proc_doulongvec_minmax,
1883 },
1884 {
1885 .procname = "mount-max",
1886 .data = &sysctl_mount_max,
1887 .maxlen = sizeof(unsigned int),
1888 .mode = 0644,
1889 .proc_handler = proc_dointvec_minmax,
1890 .extra1 = SYSCTL_ONE,
1891 },
1892 { }
1893};
1894
1895static struct ctl_table debug_table[] = {
1896#ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
1897 {
1898 .procname = "exception-trace",
1899 .data = &show_unhandled_signals,
1900 .maxlen = sizeof(int),
1901 .mode = 0644,
1902 .proc_handler = proc_dointvec
1903 },
1904#endif
1905#if defined(CONFIG_OPTPROBES)
1906 {
1907 .procname = "kprobes-optimization",
1908 .data = &sysctl_kprobes_optimization,
1909 .maxlen = sizeof(int),
1910 .mode = 0644,
1911 .proc_handler = proc_kprobes_optimization_handler,
1912 .extra1 = SYSCTL_ZERO,
1913 .extra2 = SYSCTL_ONE,
1914 },
1915#endif
1916 { }
1917};
1918
1919static struct ctl_table dev_table[] = {
1920 { }
1921};
1922
1923int __init sysctl_init(void)
1924{
1925 struct ctl_table_header *hdr;
1926
1927 hdr = register_sysctl_table(sysctl_base_table);
1928 kmemleak_not_leak(hdr);
1929 return 0;
1930}
1931
1932#endif /* CONFIG_SYSCTL */
1933
1934/*
1935 * /proc/sys support
1936 */
1937
1938#ifdef CONFIG_PROC_SYSCTL208#ifdef CONFIG_PROC_SYSCTL
1939 209
1940static int _proc_do_string(char *data, int maxlen, int write,210static int _proc_do_string(char *data, int maxlen, int write,
@@ -3301,101 +1571,1794 @@ int proc_dostring(struct ctl_table *table, int write, · 1360 unmodified lines
3301 return -ENOSYS;1571 return -ENOSYS;
3302}1572}
3303 1573
3304int proc_dointvec(struct ctl_table *table, int write,1574int proc_dointvec(struct ctl_table *table, int write,
3305 void __user *buffer, size_t *lenp, loff_t *ppos)1575 void __user *buffer, size_t *lenp, loff_t *ppos)
1576{
1577 return -ENOSYS;
1578}
1579
1580int proc_douintvec(struct ctl_table *table, int write,
1581 void __user *buffer, size_t *lenp, loff_t *ppos)
1582{
1583 return -ENOSYS;
1584}
1585
1586int proc_dointvec_minmax(struct ctl_table *table, int write,
1587 void __user *buffer, size_t *lenp, loff_t *ppos)
1588{
1589 return -ENOSYS;
1590}
1591
1592int proc_douintvec_minmax(struct ctl_table *table, int write,
1593 void __user *buffer, size_t *lenp, loff_t *ppos)
1594{
1595 return -ENOSYS;
1596}
1597
1598int proc_dointvec_jiffies(struct ctl_table *table, int write,
1599 void __user *buffer, size_t *lenp, loff_t *ppos)
1600{
1601 return -ENOSYS;
1602}
1603
1604int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
1605 void __user *buffer, size_t *lenp, loff_t *ppos)
1606{
1607 return -ENOSYS;
1608}
1609
1610int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
1611 void __user *buffer, size_t *lenp, loff_t *ppos)
3306{1612{
3307 return -ENOSYS;1613 return -ENOSYS;
3308}1614}
3309 1615
3310int proc_douintvec(struct ctl_table *table, int write,1616int proc_doulongvec_minmax(struct ctl_table *table, int write,
3311 void __user *buffer, size_t *lenp, loff_t *ppos)1617 void __user *buffer, size_t *lenp, loff_t *ppos)
3312{1618{
3313 return -ENOSYS;1619 return -ENOSYS;
3314}1620}
3315 1621
3316int proc_dointvec_minmax(struct ctl_table *table, int write,1622int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
3317 void __user *buffer, size_t *lenp, loff_t *ppos)1623 void __user *buffer,
1624 size_t *lenp, loff_t *ppos)
3318{1625{
3319 return -ENOSYS;1626 return -ENOSYS;
3320}1627}
3321 1628
3322int proc_douintvec_minmax(struct ctl_table *table, int write,1629int proc_do_large_bitmap(struct ctl_table *table, int write,
3323 void __user *buffer, size_t *lenp, loff_t *ppos)1630 void __user *buffer, size_t *lenp, loff_t *ppos)
3324{1631{
3325 return -ENOSYS;1632 return -ENOSYS;
3326}1633}
3327 1634
3328int proc_dointvec_jiffies(struct ctl_table *table, int write,1635#endif /* CONFIG_PROC_SYSCTL */
3329 void __user *buffer, size_t *lenp, loff_t *ppos)1636
1637#if defined(CONFIG_SYSCTL)
1638int proc_do_static_key(struct ctl_table *table, int write,
1639 void __user *buffer, size_t *lenp,
1640 loff_t *ppos)
3330{1641{
3331 return -ENOSYS;1642 struct static_key *key = (struct static_key *)table->data;
1643 static DEFINE_MUTEX(static_key_mutex);
1644 int val, ret;
1645 struct ctl_table tmp = {
1646 .data = &val,
1647 .maxlen = sizeof(val),
1648 .mode = table->mode,
1649 .extra1 = SYSCTL_ZERO,
1650 .extra2 = SYSCTL_ONE,
1651 };
1652
1653 if (write && !capable(CAP_SYS_ADMIN))
1654 return -EPERM;
1655
1656 mutex_lock(&static_key_mutex);
1657 val = static_key_enabled(key);
1658 ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
1659 if (write && !ret) {
1660 if (val)
1661 static_key_enable(key);
1662 else
1663 static_key_disable(key);
1664 }
1665 mutex_unlock(&static_key_mutex);
1666 return ret;
3332}1667}
3333 1668
3334int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,1669static struct ctl_table kern_table[] = {
3335 void __user *buffer, size_t *lenp, loff_t *ppos)1670 {
3336{1671 .procname = "sched_child_runs_first",
3337 return -ENOSYS;1672 .data = &sysctl_sched_child_runs_first,
3338}1673 .maxlen = sizeof(unsigned int),
1674 .mode = 0644,
1675 .proc_handler = proc_dointvec,
1676 },
1677#ifdef CONFIG_SCHED_DEBUG
1678 {
1679 .procname = "sched_min_granularity_ns",
1680 .data = &sysctl_sched_min_granularity,
1681 .maxlen = sizeof(unsigned int),
1682 .mode = 0644,
1683 .proc_handler = sched_proc_update_handler,
1684 .extra1 = &min_sched_granularity_ns,
1685 .extra2 = &max_sched_granularity_ns,
1686 },
1687 {
1688 .procname = "sched_latency_ns",
1689 .data = &sysctl_sched_latency,
1690 .maxlen = sizeof(unsigned int),
1691 .mode = 0644,
1692 .proc_handler = sched_proc_update_handler,
1693 .extra1 = &min_sched_granularity_ns,
1694 .extra2 = &max_sched_granularity_ns,
1695 },
1696 {
1697 .procname = "sched_wakeup_granularity_ns",
1698 .data = &sysctl_sched_wakeup_granularity,
1699 .maxlen = sizeof(unsigned int),
1700 .mode = 0644,
1701 .proc_handler = sched_proc_update_handler,
1702 .extra1 = &min_wakeup_granularity_ns,
1703 .extra2 = &max_wakeup_granularity_ns,
1704 },
1705#ifdef CONFIG_SMP
1706 {
1707 .procname = "sched_tunable_scaling",
1708 .data = &sysctl_sched_tunable_scaling,
1709 .maxlen = sizeof(enum sched_tunable_scaling),
1710 .mode = 0644,
1711 .proc_handler = sched_proc_update_handler,
1712 .extra1 = &min_sched_tunable_scaling,
1713 .extra2 = &max_sched_tunable_scaling,
1714 },
1715 {
1716 .procname = "sched_migration_cost_ns",
1717 .data = &sysctl_sched_migration_cost,
1718 .maxlen = sizeof(unsigned int),
1719 .mode = 0644,
1720 .proc_handler = proc_dointvec,
1721 },
1722 {
1723 .procname = "sched_nr_migrate",
1724 .data = &sysctl_sched_nr_migrate,
1725 .maxlen = sizeof(unsigned int),
1726 .mode = 0644,
1727 .proc_handler = proc_dointvec,
1728 },
1729#ifdef CONFIG_SCHEDSTATS
1730 {
1731 .procname = "sched_schedstats",
1732 .data = NULL,
1733 .maxlen = sizeof(unsigned int),
1734 .mode = 0644,
1735 .proc_handler = sysctl_schedstats,
1736 .extra1 = SYSCTL_ZERO,
1737 .extra2 = SYSCTL_ONE,
1738 },
1739#endif /* CONFIG_SCHEDSTATS */
1740#endif /* CONFIG_SMP */
1741#ifdef CONFIG_NUMA_BALANCING
1742 {
1743 .procname = "numa_balancing_scan_delay_ms",
1744 .data = &sysctl_numa_balancing_scan_delay,
1745 .maxlen = sizeof(unsigned int),
1746 .mode = 0644,
1747 .proc_handler = proc_dointvec,
1748 },
1749 {
1750 .procname = "numa_balancing_scan_period_min_ms",
1751 .data = &sysctl_numa_balancing_scan_period_min,
1752 .maxlen = sizeof(unsigned int),
1753 .mode = 0644,
1754 .proc_handler = proc_dointvec,
1755 },
1756 {
1757 .procname = "numa_balancing_scan_period_max_ms",
1758 .data = &sysctl_numa_balancing_scan_period_max,
1759 .maxlen = sizeof(unsigned int),
1760 .mode = 0644,
1761 .proc_handler = proc_dointvec,
1762 },
1763 {
1764 .procname = "numa_balancing_scan_size_mb",
1765 .data = &sysctl_numa_balancing_scan_size,
1766 .maxlen = sizeof(unsigned int),
1767 .mode = 0644,
1768 .proc_handler = proc_dointvec_minmax,
1769 .extra1 = SYSCTL_ONE,
1770 },
1771 {
1772 .procname = "numa_balancing",
1773 .data = NULL, /* filled in by handler */
1774 .maxlen = sizeof(unsigned int),
1775 .mode = 0644,
1776 .proc_handler = sysctl_numa_balancing,
1777 .extra1 = SYSCTL_ZERO,
1778 .extra2 = SYSCTL_ONE,
1779 },
1780#endif /* CONFIG_NUMA_BALANCING */
1781#endif /* CONFIG_SCHED_DEBUG */
1782 {
1783 .procname = "sched_rt_period_us",
1784 .data = &sysctl_sched_rt_period,
1785 .maxlen = sizeof(unsigned int),
1786 .mode = 0644,
1787 .proc_handler = sched_rt_handler,
1788 },
1789 {
1790 .procname = "sched_rt_runtime_us",
1791 .data = &sysctl_sched_rt_runtime,
1792 .maxlen = sizeof(int),
1793 .mode = 0644,
1794 .proc_handler = sched_rt_handler,
1795 },
1796 {
1797 .procname = "sched_rr_timeslice_ms",
1798 .data = &sysctl_sched_rr_timeslice,
1799 .maxlen = sizeof(int),
1800 .mode = 0644,
1801 .proc_handler = sched_rr_handler,
1802 },
1803#ifdef CONFIG_UCLAMP_TASK
1804 {
1805 .procname = "sched_util_clamp_min",
1806 .data = &sysctl_sched_uclamp_util_min,
1807 .maxlen = sizeof(unsigned int),
1808 .mode = 0644,
1809 .proc_handler = sysctl_sched_uclamp_handler,
1810 },
1811 {
1812 .procname = "sched_util_clamp_max",
1813 .data = &sysctl_sched_uclamp_util_max,
1814 .maxlen = sizeof(unsigned int),
1815 .mode = 0644,
1816 .proc_handler = sysctl_sched_uclamp_handler,
1817 },
1818#endif
1819#ifdef CONFIG_SCHED_AUTOGROUP
1820 {
1821 .procname = "sched_autogroup_enabled",
1822 .data = &sysctl_sched_autogroup_enabled,
1823 .maxlen = sizeof(unsigned int),
1824 .mode = 0644,
1825 .proc_handler = proc_dointvec_minmax,
1826 .extra1 = SYSCTL_ZERO,
1827 .extra2 = SYSCTL_ONE,
1828 },
1829#endif
1830#ifdef CONFIG_CFS_BANDWIDTH
1831 {
1832 .procname = "sched_cfs_bandwidth_slice_us",
1833 .data = &sysctl_sched_cfs_bandwidth_slice,
1834 .maxlen = sizeof(unsigned int),
1835 .mode = 0644,
1836 .proc_handler = proc_dointvec_minmax,
1837 .extra1 = SYSCTL_ONE,
1838 },
1839#endif
1840#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
1841 {
1842 .procname = "sched_energy_aware",
1843 .data = &sysctl_sched_energy_aware,
1844 .maxlen = sizeof(unsigned int),
1845 .mode = 0644,
1846 .proc_handler = sched_energy_aware_handler,
1847 .extra1 = SYSCTL_ZERO,
1848 .extra2 = SYSCTL_ONE,
1849 },
1850#endif
1851#ifdef CONFIG_PROVE_LOCKING
1852 {
1853 .procname = "prove_locking",
1854 .data = &prove_locking,
1855 .maxlen = sizeof(int),
1856 .mode = 0644,
1857 .proc_handler = proc_dointvec,
1858 },
1859#endif
1860#ifdef CONFIG_LOCK_STAT
1861 {
1862 .procname = "lock_stat",
1863 .data = &lock_stat,
1864 .maxlen = sizeof(int),
1865 .mode = 0644,
1866 .proc_handler = proc_dointvec,
1867 },
1868#endif
1869 {
1870 .procname = "panic",
1871 .data = &panic_timeout,
1872 .maxlen = sizeof(int),
1873 .mode = 0644,
1874 .proc_handler = proc_dointvec,
1875 },
1876#ifdef CONFIG_COREDUMP
1877 {
1878 .procname = "core_uses_pid",
1879 .data = &core_uses_pid,
1880 .maxlen = sizeof(int),
1881 .mode = 0644,
1882 .proc_handler = proc_dointvec,
1883 },
1884 {
1885 .procname = "core_pattern",
1886 .data = core_pattern,
1887 .maxlen = CORENAME_MAX_SIZE,
1888 .mode = 0644,
1889 .proc_handler = proc_dostring_coredump,
1890 },
1891 {
1892 .procname = "core_pipe_limit",
1893 .data = &core_pipe_limit,
1894 .maxlen = sizeof(unsigned int),
1895 .mode = 0644,
1896 .proc_handler = proc_dointvec,
1897 },
1898#endif
1899#ifdef CONFIG_PROC_SYSCTL
1900 {
1901 .procname = "tainted",
1902 .maxlen = sizeof(long),
1903 .mode = 0644,
1904 .proc_handler = proc_taint,
1905 },
1906 {
1907 .procname = "sysctl_writes_strict",
1908 .data = &sysctl_writes_strict,
1909 .maxlen = sizeof(int),
1910 .mode = 0644,
1911 .proc_handler = proc_dointvec_minmax,
1912 .extra1 = &neg_one,
1913 .extra2 = SYSCTL_ONE,
1914 },
1915#endif
1916#ifdef CONFIG_LATENCYTOP
1917 {
1918 .procname = "latencytop",
1919 .data = &latencytop_enabled,
1920 .maxlen = sizeof(int),
1921 .mode = 0644,
1922 .proc_handler = sysctl_latencytop,
1923 },
1924#endif
1925#ifdef CONFIG_BLK_DEV_INITRD
1926 {
1927 .procname = "real-root-dev",
1928 .data = &real_root_dev,
1929 .maxlen = sizeof(int),
1930 .mode = 0644,
1931 .proc_handler = proc_dointvec,
1932 },
1933#endif
1934 {
1935 .procname = "print-fatal-signals",
1936 .data = &print_fatal_signals,
1937 .maxlen = sizeof(int),
1938 .mode = 0644,
1939 .proc_handler = proc_dointvec,
1940 },
1941#ifdef CONFIG_SPARC
1942 {
1943 .procname = "reboot-cmd",
1944 .data = reboot_command,
1945 .maxlen = 256,
1946 .mode = 0644,
1947 .proc_handler = proc_dostring,
1948 },
1949 {
1950 .procname = "stop-a",
1951 .data = &stop_a_enabled,
1952 .maxlen = sizeof (int),
1953 .mode = 0644,
1954 .proc_handler = proc_dointvec,
1955 },
1956 {
1957 .procname = "scons-poweroff",
1958 .data = &scons_pwroff,
1959 .maxlen = sizeof (int),
1960 .mode = 0644,
1961 .proc_handler = proc_dointvec,
1962 },
1963#endif
1964#ifdef CONFIG_SPARC64
1965 {
1966 .procname = "tsb-ratio",
1967 .data = &sysctl_tsb_ratio,
1968 .maxlen = sizeof (int),
1969 .mode = 0644,
1970 .proc_handler = proc_dointvec,
1971 },
1972#endif
1973#ifdef CONFIG_PARISC
1974 {
1975 .procname = "soft-power",
1976 .data = &pwrsw_enabled,
1977 .maxlen = sizeof (int),
1978 .mode = 0644,
1979 .proc_handler = proc_dointvec,
1980 },
1981#endif
1982#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
1983 {
1984 .procname = "unaligned-trap",
1985 .data = &unaligned_enabled,
1986 .maxlen = sizeof (int),
1987 .mode = 0644,
1988 .proc_handler = proc_dointvec,
1989 },
1990#endif
1991 {
1992 .procname = "ctrl-alt-del",
1993 .data = &C_A_D,
1994 .maxlen = sizeof(int),
1995 .mode = 0644,
1996 .proc_handler = proc_dointvec,
1997 },
1998#ifdef CONFIG_FUNCTION_TRACER
1999 {
2000 .procname = "ftrace_enabled",
2001 .data = &ftrace_enabled,
2002 .maxlen = sizeof(int),
2003 .mode = 0644,
2004 .proc_handler = ftrace_enable_sysctl,
2005 },
2006#endif
2007#ifdef CONFIG_STACK_TRACER
2008 {
2009 .procname = "stack_tracer_enabled",
2010 .data = &stack_tracer_enabled,
2011 .maxlen = sizeof(int),
2012 .mode = 0644,
2013 .proc_handler = stack_trace_sysctl,
2014 },
2015#endif
2016#ifdef CONFIG_TRACING
2017 {
2018 .procname = "ftrace_dump_on_oops",
2019 .data = &ftrace_dump_on_oops,
2020 .maxlen = sizeof(int),
2021 .mode = 0644,
2022 .proc_handler = proc_dointvec,
2023 },
2024 {
2025 .procname = "traceoff_on_warning",
2026 .data = &__disable_trace_on_warning,
2027 .maxlen = sizeof(__disable_trace_on_warning),
2028 .mode = 0644,
2029 .proc_handler = proc_dointvec,
2030 },
2031 {
2032 .procname = "tracepoint_printk",
2033 .data = &tracepoint_printk,
2034 .maxlen = sizeof(tracepoint_printk),
2035 .mode = 0644,
2036 .proc_handler = tracepoint_printk_sysctl,
2037 },
2038#endif
2039#ifdef CONFIG_KEXEC_CORE
2040 {
2041 .procname = "kexec_load_disabled",
2042 .data = &kexec_load_disabled,
2043 .maxlen = sizeof(int),
2044 .mode = 0644,
2045 /* only handle a transition from default "0" to "1" */
2046 .proc_handler = proc_dointvec_minmax,
2047 .extra1 = SYSCTL_ONE,
2048 .extra2 = SYSCTL_ONE,
2049 },
2050#endif
2051#ifdef CONFIG_MODULES
2052 {
2053 .procname = "modprobe",
2054 .data = &modprobe_path,
2055 .maxlen = KMOD_PATH_LEN,
2056 .mode = 0644,
2057 .proc_handler = proc_dostring,
2058 },
2059 {
2060 .procname = "modules_disabled",
2061 .data = &modules_disabled,
2062 .maxlen = sizeof(int),
2063 .mode = 0644,
2064 /* only handle a transition from default "0" to "1" */
2065 .proc_handler = proc_dointvec_minmax,
2066 .extra1 = SYSCTL_ONE,
2067 .extra2 = SYSCTL_ONE,
2068 },
2069#endif
2070#ifdef CONFIG_UEVENT_HELPER
2071 {
2072 .procname = "hotplug",
2073 .data = &uevent_helper,
2074 .maxlen = UEVENT_HELPER_PATH_LEN,
2075 .mode = 0644,
2076 .proc_handler = proc_dostring,
2077 },
2078#endif
2079#ifdef CONFIG_CHR_DEV_SG
2080 {
2081 .procname = "sg-big-buff",
2082 .data = &sg_big_buff,
2083 .maxlen = sizeof (int),
2084 .mode = 0444,
2085 .proc_handler = proc_dointvec,
2086 },
2087#endif
2088#ifdef CONFIG_BSD_PROCESS_ACCT
2089 {
2090 .procname = "acct",
2091 .data = &acct_parm,
2092 .maxlen = 3*sizeof(int),
2093 .mode = 0644,
2094 .proc_handler = proc_dointvec,
2095 },
2096#endif
2097#ifdef CONFIG_MAGIC_SYSRQ
2098 {
2099 .procname = "sysrq",
2100 .data = NULL,
2101 .maxlen = sizeof (int),
2102 .mode = 0644,
2103 .proc_handler = sysrq_sysctl_handler,
2104 },
2105#endif
2106#ifdef CONFIG_PROC_SYSCTL
2107 {
2108 .procname = "cad_pid",
2109 .data = NULL,
2110 .maxlen = sizeof (int),
2111 .mode = 0600,
2112 .proc_handler = proc_do_cad_pid,
2113 },
2114#endif
2115 {
2116 .procname = "threads-max",
2117 .data = NULL,
2118 .maxlen = sizeof(int),
2119 .mode = 0644,
2120 .proc_handler = sysctl_max_threads,
2121 },
2122 {
2123 .procname = "random",
2124 .mode = 0555,
2125 .child = random_table,
2126 },
2127 {
2128 .procname = "usermodehelper",
2129 .mode = 0555,
2130 .child = usermodehelper_table,
2131 },
2132#ifdef CONFIG_FW_LOADER_USER_HELPER
2133 {
2134 .procname = "firmware_config",
2135 .mode = 0555,
2136 .child = firmware_config_table,
2137 },
2138#endif
2139 {
2140 .procname = "overflowuid",
2141 .data = &overflowuid,
2142 .maxlen = sizeof(int),
2143 .mode = 0644,
2144 .proc_handler = proc_dointvec_minmax,
2145 .extra1 = &minolduid,
2146 .extra2 = &maxolduid,
2147 },
2148 {
2149 .procname = "overflowgid",
2150 .data = &overflowgid,
2151 .maxlen = sizeof(int),
2152 .mode = 0644,
2153 .proc_handler = proc_dointvec_minmax,
2154 .extra1 = &minolduid,
2155 .extra2 = &maxolduid,
2156 },
2157#ifdef CONFIG_S390
2158 {
2159 .procname = "userprocess_debug",
2160 .data = &show_unhandled_signals,
2161 .maxlen = sizeof(int),
2162 .mode = 0644,
2163 .proc_handler = proc_dointvec,
2164 },
2165#endif
2166 {
2167 .procname = "pid_max",
2168 .data = &pid_max,
2169 .maxlen = sizeof (int),
2170 .mode = 0644,
2171 .proc_handler = proc_dointvec_minmax,
2172 .extra1 = &pid_max_min,
2173 .extra2 = &pid_max_max,
2174 },
2175 {
2176 .procname = "panic_on_oops",
2177 .data = &panic_on_oops,
2178 .maxlen = sizeof(int),
2179 .mode = 0644,
2180 .proc_handler = proc_dointvec,
2181 },
2182 {
2183 .procname = "panic_print",
2184 .data = &panic_print,
2185 .maxlen = sizeof(unsigned long),
2186 .mode = 0644,
2187 .proc_handler = proc_doulongvec_minmax,
2188 },
2189#if defined CONFIG_PRINTK
2190 {
2191 .procname = "printk",
2192 .data = &console_loglevel,
2193 .maxlen = 4*sizeof(int),
2194 .mode = 0644,
2195 .proc_handler = proc_dointvec,
2196 },
2197 {
2198 .procname = "printk_ratelimit",
2199 .data = &printk_ratelimit_state.interval,
2200 .maxlen = sizeof(int),
2201 .mode = 0644,
2202 .proc_handler = proc_dointvec_jiffies,
2203 },
2204 {
2205 .procname = "printk_ratelimit_burst",
2206 .data = &printk_ratelimit_state.burst,
2207 .maxlen = sizeof(int),
2208 .mode = 0644,
2209 .proc_handler = proc_dointvec,
2210 },
2211 {
2212 .procname = "printk_delay",
2213 .data = &printk_delay_msec,
2214 .maxlen = sizeof(int),
2215 .mode = 0644,
2216 .proc_handler = proc_dointvec_minmax,
2217 .extra1 = SYSCTL_ZERO,
2218 .extra2 = &ten_thousand,
2219 },
2220 {
2221 .procname = "printk_devkmsg",
2222 .data = devkmsg_log_str,
2223 .maxlen = DEVKMSG_STR_MAX_SIZE,
2224 .mode = 0644,
2225 .proc_handler = devkmsg_sysctl_set_loglvl,
2226 },
2227 {
2228 .procname = "dmesg_restrict",
2229 .data = &dmesg_restrict,
2230 .maxlen = sizeof(int),
2231 .mode = 0644,
2232 .proc_handler = proc_dointvec_minmax_sysadmin,
2233 .extra1 = SYSCTL_ZERO,
2234 .extra2 = SYSCTL_ONE,
2235 },
2236 {
2237 .procname = "kptr_restrict",
2238 .data = &kptr_restrict,
2239 .maxlen = sizeof(int),
2240 .mode = 0644,
2241 .proc_handler = proc_dointvec_minmax_sysadmin,
2242 .extra1 = SYSCTL_ZERO,
2243 .extra2 = &two,
2244 },
2245#endif
2246 {
2247 .procname = "ngroups_max",
2248 .data = &ngroups_max,
2249 .maxlen = sizeof (int),
2250 .mode = 0444,
2251 .proc_handler = proc_dointvec,
2252 },
2253 {
2254 .procname = "cap_last_cap",
2255 .data = (void *)&cap_last_cap,
2256 .maxlen = sizeof(int),
2257 .mode = 0444,
2258 .proc_handler = proc_dointvec,
2259 },
2260#if defined(CONFIG_LOCKUP_DETECTOR)
2261 {
2262 .procname = "watchdog",
2263 .data = &watchdog_user_enabled,
2264 .maxlen = sizeof(int),
2265 .mode = 0644,
2266 .proc_handler = proc_watchdog,
2267 .extra1 = SYSCTL_ZERO,
2268 .extra2 = SYSCTL_ONE,
2269 },
2270 {
2271 .procname = "watchdog_thresh",
2272 .data = &watchdog_thresh,
2273 .maxlen = sizeof(int),
2274 .mode = 0644,
2275 .proc_handler = proc_watchdog_thresh,
2276 .extra1 = SYSCTL_ZERO,
2277 .extra2 = &sixty,
2278 },
2279 {
2280 .procname = "nmi_watchdog",
2281 .data = &nmi_watchdog_user_enabled,
2282 .maxlen = sizeof(int),
2283 .mode = NMI_WATCHDOG_SYSCTL_PERM,
2284 .proc_handler = proc_nmi_watchdog,
2285 .extra1 = SYSCTL_ZERO,
2286 .extra2 = SYSCTL_ONE,
2287 },
2288 {
2289 .procname = "watchdog_cpumask",
2290 .data = &watchdog_cpumask_bits,
2291 .maxlen = NR_CPUS,
2292 .mode = 0644,
2293 .proc_handler = proc_watchdog_cpumask,
2294 },
2295#ifdef CONFIG_SOFTLOCKUP_DETECTOR
2296 {
2297 .procname = "soft_watchdog",
2298 .data = &soft_watchdog_user_enabled,
2299 .maxlen = sizeof(int),
2300 .mode = 0644,
2301 .proc_handler = proc_soft_watchdog,
2302 .extra1 = SYSCTL_ZERO,
2303 .extra2 = SYSCTL_ONE,
2304 },
2305 {
2306 .procname = "softlockup_panic",
2307 .data = &softlockup_panic,
2308 .maxlen = sizeof(int),
2309 .mode = 0644,
2310 .proc_handler = proc_dointvec_minmax,
2311 .extra1 = SYSCTL_ZERO,
2312 .extra2 = SYSCTL_ONE,
2313 },
2314#ifdef CONFIG_SMP
2315 {
2316 .procname = "softlockup_all_cpu_backtrace",
2317 .data = &sysctl_softlockup_all_cpu_backtrace,
2318 .maxlen = sizeof(int),
2319 .mode = 0644,
2320 .proc_handler = proc_dointvec_minmax,
2321 .extra1 = SYSCTL_ZERO,
2322 .extra2 = SYSCTL_ONE,
2323 },
2324#endif /* CONFIG_SMP */
2325#endif
2326#ifdef CONFIG_HARDLOCKUP_DETECTOR
2327 {
2328 .procname = "hardlockup_panic",
2329 .data = &hardlockup_panic,
2330 .maxlen = sizeof(int),
2331 .mode = 0644,
2332 .proc_handler = proc_dointvec_minmax,
2333 .extra1 = SYSCTL_ZERO,
2334 .extra2 = SYSCTL_ONE,
2335 },
2336#ifdef CONFIG_SMP
2337 {
2338 .procname = "hardlockup_all_cpu_backtrace",
2339 .data = &sysctl_hardlockup_all_cpu_backtrace,
2340 .maxlen = sizeof(int),
2341 .mode = 0644,
2342 .proc_handler = proc_dointvec_minmax,
2343 .extra1 = SYSCTL_ZERO,
2344 .extra2 = SYSCTL_ONE,
2345 },
2346#endif /* CONFIG_SMP */
2347#endif
2348#endif
2349
2350#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
2351 {
2352 .procname = "unknown_nmi_panic",
2353 .data = &unknown_nmi_panic,
2354 .maxlen = sizeof (int),
2355 .mode = 0644,
2356 .proc_handler = proc_dointvec,
2357 },
2358#endif
2359#if defined(CONFIG_X86)
2360 {
2361 .procname = "panic_on_unrecovered_nmi",
2362 .data = &panic_on_unrecovered_nmi,
2363 .maxlen = sizeof(int),
2364 .mode = 0644,
2365 .proc_handler = proc_dointvec,
2366 },
2367 {
2368 .procname = "panic_on_io_nmi",
2369 .data = &panic_on_io_nmi,
2370 .maxlen = sizeof(int),
2371 .mode = 0644,
2372 .proc_handler = proc_dointvec,
2373 },
2374#ifdef CONFIG_DEBUG_STACKOVERFLOW
2375 {
2376 .procname = "panic_on_stackoverflow",
2377 .data = &sysctl_panic_on_stackoverflow,
2378 .maxlen = sizeof(int),
2379 .mode = 0644,
2380 .proc_handler = proc_dointvec,
2381 },
2382#endif
2383 {
2384 .procname = "bootloader_type",
2385 .data = &bootloader_type,
2386 .maxlen = sizeof (int),
2387 .mode = 0444,
2388 .proc_handler = proc_dointvec,
2389 },
2390 {
2391 .procname = "bootloader_version",
2392 .data = &bootloader_version,
2393 .maxlen = sizeof (int),
2394 .mode = 0444,
2395 .proc_handler = proc_dointvec,
2396 },
2397 {
2398 .procname = "io_delay_type",
2399 .data = &io_delay_type,
2400 .maxlen = sizeof(int),
2401 .mode = 0644,
2402 .proc_handler = proc_dointvec,
2403 },
2404#endif
2405#if defined(CONFIG_MMU)
2406 {
2407 .procname = "randomize_va_space",
2408 .data = &randomize_va_space,
2409 .maxlen = sizeof(int),
2410 .mode = 0644,
2411 .proc_handler = proc_dointvec,
2412 },
2413#endif
2414#if defined(CONFIG_S390) && defined(CONFIG_SMP)
2415 {
2416 .procname = "spin_retry",
2417 .data = &spin_retry,
2418 .maxlen = sizeof (int),
2419 .mode = 0644,
2420 .proc_handler = proc_dointvec,
2421 },
2422#endif
2423#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
2424 {
2425 .procname = "acpi_video_flags",
2426 .data = &acpi_realmode_flags,
2427 .maxlen = sizeof (unsigned long),
2428 .mode = 0644,
2429 .proc_handler = proc_doulongvec_minmax,
2430 },
2431#endif
2432#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
2433 {
2434 .procname = "ignore-unaligned-usertrap",
2435 .data = &no_unaligned_warning,
2436 .maxlen = sizeof (int),
2437 .mode = 0644,
2438 .proc_handler = proc_dointvec,
2439 },
2440#endif
2441#ifdef CONFIG_IA64
2442 {
2443 .procname = "unaligned-dump-stack",
2444 .data = &unaligned_dump_stack,
2445 .maxlen = sizeof (int),
2446 .mode = 0644,
2447 .proc_handler = proc_dointvec,
2448 },
2449#endif
2450#ifdef CONFIG_DETECT_HUNG_TASK
2451 {
2452 .procname = "hung_task_panic",
2453 .data = &sysctl_hung_task_panic,
2454 .maxlen = sizeof(int),
2455 .mode = 0644,
2456 .proc_handler = proc_dointvec_minmax,
2457 .extra1 = SYSCTL_ZERO,
2458 .extra2 = SYSCTL_ONE,
2459 },
2460 {
2461 .procname = "hung_task_check_count",
2462 .data = &sysctl_hung_task_check_count,
2463 .maxlen = sizeof(int),
2464 .mode = 0644,
2465 .proc_handler = proc_dointvec_minmax,
2466 .extra1 = SYSCTL_ZERO,
2467 },
2468 {
2469 .procname = "hung_task_timeout_secs",
2470 .data = &sysctl_hung_task_timeout_secs,
2471 .maxlen = sizeof(unsigned long),
2472 .mode = 0644,
2473 .proc_handler = proc_dohung_task_timeout_secs,
2474 .extra2 = &hung_task_timeout_max,
2475 },
2476 {
2477 .procname = "hung_task_check_interval_secs",
2478 .data = &sysctl_hung_task_check_interval_secs,
2479 .maxlen = sizeof(unsigned long),
2480 .mode = 0644,
2481 .proc_handler = proc_dohung_task_timeout_secs,
2482 .extra2 = &hung_task_timeout_max,
2483 },
2484 {
2485 .procname = "hung_task_warnings",
2486 .data = &sysctl_hung_task_warnings,
2487 .maxlen = sizeof(int),
2488 .mode = 0644,
2489 .proc_handler = proc_dointvec_minmax,
2490 .extra1 = &neg_one,
2491 },
2492#endif
2493#ifdef CONFIG_RT_MUTEXES
2494 {
2495 .procname = "max_lock_depth",
2496 .data = &max_lock_depth,
2497 .maxlen = sizeof(int),
2498 .mode = 0644,
2499 .proc_handler = proc_dointvec,
2500 },
2501#endif
2502 {
2503 .procname = "poweroff_cmd",
2504 .data = &poweroff_cmd,
2505 .maxlen = POWEROFF_CMD_PATH_LEN,
2506 .mode = 0644,
2507 .proc_handler = proc_dostring,
2508 },
2509#ifdef CONFIG_KEYS
2510 {
2511 .procname = "keys",
2512 .mode = 0555,
2513 .child = key_sysctls,
2514 },
2515#endif
2516#ifdef CONFIG_PERF_EVENTS
2517 /*
2518 * User-space scripts rely on the existence of this file
2519 * as a feature check for perf_events being enabled.
2520 *
2521 * So it's an ABI, do not remove!
2522 */
2523 {
2524 .procname = "perf_event_paranoid",
2525 .data = &sysctl_perf_event_paranoid,
2526 .maxlen = sizeof(sysctl_perf_event_paranoid),
2527 .mode = 0644,
2528 .proc_handler = proc_dointvec,
2529 },
2530 {
2531 .procname = "perf_event_mlock_kb",
2532 .data = &sysctl_perf_event_mlock,
2533 .maxlen = sizeof(sysctl_perf_event_mlock),
2534 .mode = 0644,
2535 .proc_handler = proc_dointvec,
2536 },
2537 {
2538 .procname = "perf_event_max_sample_rate",
2539 .data = &sysctl_perf_event_sample_rate,
2540 .maxlen = sizeof(sysctl_perf_event_sample_rate),
2541 .mode = 0644,
2542 .proc_handler = perf_proc_update_handler,
2543 .extra1 = SYSCTL_ONE,
2544 },
2545 {
2546 .procname = "perf_cpu_time_max_percent",
2547 .data = &sysctl_perf_cpu_time_max_percent,
2548 .maxlen = sizeof(sysctl_perf_cpu_time_max_percent),
2549 .mode = 0644,
2550 .proc_handler = perf_cpu_time_max_percent_handler,
2551 .extra1 = SYSCTL_ZERO,
2552 .extra2 = &one_hundred,
2553 },
2554 {
2555 .procname = "perf_event_max_stack",
2556 .data = &sysctl_perf_event_max_stack,
2557 .maxlen = sizeof(sysctl_perf_event_max_stack),
2558 .mode = 0644,
2559 .proc_handler = perf_event_max_stack_handler,
2560 .extra1 = SYSCTL_ZERO,
2561 .extra2 = &six_hundred_forty_kb,
2562 },
2563 {
2564 .procname = "perf_event_max_contexts_per_stack",
2565 .data = &sysctl_perf_event_max_contexts_per_stack,
2566 .maxlen = sizeof(sysctl_perf_event_max_contexts_per_stack),
2567 .mode = 0644,
2568 .proc_handler = perf_event_max_stack_handler,
2569 .extra1 = SYSCTL_ZERO,
2570 .extra2 = &one_thousand,
2571 },
2572#endif
2573 {
2574 .procname = "panic_on_warn",
2575 .data = &panic_on_warn,
2576 .maxlen = sizeof(int),
2577 .mode = 0644,
2578 .proc_handler = proc_dointvec_minmax,
2579 .extra1 = SYSCTL_ZERO,
2580 .extra2 = SYSCTL_ONE,
2581 },
2582#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
2583 {
2584 .procname = "timer_migration",
2585 .data = &sysctl_timer_migration,
2586 .maxlen = sizeof(unsigned int),
2587 .mode = 0644,
2588 .proc_handler = timer_migration_handler,
2589 .extra1 = SYSCTL_ZERO,
2590 .extra2 = SYSCTL_ONE,
2591 },
2592#endif
2593#ifdef CONFIG_BPF_SYSCALL
2594 {
2595 .procname = "unprivileged_bpf_disabled",
2596 .data = &sysctl_unprivileged_bpf_disabled,
2597 .maxlen = sizeof(sysctl_unprivileged_bpf_disabled),
2598 .mode = 0644,
2599 /* only handle a transition from default "0" to "1" */
2600 .proc_handler = proc_dointvec_minmax,
2601 .extra1 = SYSCTL_ONE,
2602 .extra2 = SYSCTL_ONE,
2603 },
2604 {
2605 .procname = "bpf_stats_enabled",
2606 .data = &bpf_stats_enabled_key.key,
2607 .maxlen = sizeof(bpf_stats_enabled_key),
2608 .mode = 0644,
2609 .proc_handler = proc_do_static_key,
2610 },
2611#endif
2612#if defined(CONFIG_TREE_RCU)
2613 {
2614 .procname = "panic_on_rcu_stall",
2615 .data = &sysctl_panic_on_rcu_stall,
2616 .maxlen = sizeof(sysctl_panic_on_rcu_stall),
2617 .mode = 0644,
2618 .proc_handler = proc_dointvec_minmax,
2619 .extra1 = SYSCTL_ZERO,
2620 .extra2 = SYSCTL_ONE,
2621 },
2622#endif
2623#ifdef CONFIG_STACKLEAK_RUNTIME_DISABLE
2624 {
2625 .procname = "stack_erasing",
2626 .data = NULL,
2627 .maxlen = sizeof(int),
2628 .mode = 0600,
2629 .proc_handler = stack_erasing_sysctl,
2630 .extra1 = SYSCTL_ZERO,
2631 .extra2 = SYSCTL_ONE,
2632 },
2633#endif
2634 { }
2635};
3339 2636
3340int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,2637static struct ctl_table vm_table[] = {
3341 void __user *buffer, size_t *lenp, loff_t *ppos)2638 {
3342{2639 .procname = "overcommit_memory",
3343 return -ENOSYS;2640 .data = &sysctl_overcommit_memory,
3344}2641 .maxlen = sizeof(sysctl_overcommit_memory),
2642 .mode = 0644,
2643 .proc_handler = proc_dointvec_minmax,
2644 .extra1 = SYSCTL_ZERO,
2645 .extra2 = &two,
2646 },
2647 {
2648 .procname = "panic_on_oom",
2649 .data = &sysctl_panic_on_oom,
2650 .maxlen = sizeof(sysctl_panic_on_oom),
2651 .mode = 0644,
2652 .proc_handler = proc_dointvec_minmax,
2653 .extra1 = SYSCTL_ZERO,
2654 .extra2 = &two,
2655 },
2656 {
2657 .procname = "oom_kill_allocating_task",
2658 .data = &sysctl_oom_kill_allocating_task,
2659 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
2660 .mode = 0644,
2661 .proc_handler = proc_dointvec,
2662 },
2663 {
2664 .procname = "oom_dump_tasks",
2665 .data = &sysctl_oom_dump_tasks,
2666 .maxlen = sizeof(sysctl_oom_dump_tasks),
2667 .mode = 0644,
2668 .proc_handler = proc_dointvec,
2669 },
2670 {
2671 .procname = "overcommit_ratio",
2672 .data = &sysctl_overcommit_ratio,
2673 .maxlen = sizeof(sysctl_overcommit_ratio),
2674 .mode = 0644,
2675 .proc_handler = overcommit_ratio_handler,
2676 },
2677 {
2678 .procname = "overcommit_kbytes",
2679 .data = &sysctl_overcommit_kbytes,
2680 .maxlen = sizeof(sysctl_overcommit_kbytes),
2681 .mode = 0644,
2682 .proc_handler = overcommit_kbytes_handler,
2683 },
2684 {
2685 .procname = "page-cluster",
2686 .data = &page_cluster,
2687 .maxlen = sizeof(int),
2688 .mode = 0644,
2689 .proc_handler = proc_dointvec_minmax,
2690 .extra1 = SYSCTL_ZERO,
2691 },
2692 {
2693 .procname = "dirty_background_ratio",
2694 .data = &dirty_background_ratio,
2695 .maxlen = sizeof(dirty_background_ratio),
2696 .mode = 0644,
2697 .proc_handler = dirty_background_ratio_handler,
2698 .extra1 = SYSCTL_ZERO,
2699 .extra2 = &one_hundred,
2700 },
2701 {
2702 .procname = "dirty_background_bytes",
2703 .data = &dirty_background_bytes,
2704 .maxlen = sizeof(dirty_background_bytes),
2705 .mode = 0644,
2706 .proc_handler = dirty_background_bytes_handler,
2707 .extra1 = &one_ul,
2708 },
2709 {
2710 .procname = "dirty_ratio",
2711 .data = &vm_dirty_ratio,
2712 .maxlen = sizeof(vm_dirty_ratio),
2713 .mode = 0644,
2714 .proc_handler = dirty_ratio_handler,
2715 .extra1 = SYSCTL_ZERO,
2716 .extra2 = &one_hundred,
2717 },
2718 {
2719 .procname = "dirty_bytes",
2720 .data = &vm_dirty_bytes,
2721 .maxlen = sizeof(vm_dirty_bytes),
2722 .mode = 0644,
2723 .proc_handler = dirty_bytes_handler,
2724 .extra1 = &dirty_bytes_min,
2725 },
2726 {
2727 .procname = "dirty_writeback_centisecs",
2728 .data = &dirty_writeback_interval,
2729 .maxlen = sizeof(dirty_writeback_interval),
2730 .mode = 0644,
2731 .proc_handler = dirty_writeback_centisecs_handler,
2732 },
2733 {
2734 .procname = "dirty_expire_centisecs",
2735 .data = &dirty_expire_interval,
2736 .maxlen = sizeof(dirty_expire_interval),
2737 .mode = 0644,
2738 .proc_handler = proc_dointvec_minmax,
2739 .extra1 = SYSCTL_ZERO,
2740 },
2741 {
2742 .procname = "dirtytime_expire_seconds",
2743 .data = &dirtytime_expire_interval,
2744 .maxlen = sizeof(dirtytime_expire_interval),
2745 .mode = 0644,
2746 .proc_handler = dirtytime_interval_handler,
2747 .extra1 = SYSCTL_ZERO,
2748 },
2749 {
2750 .procname = "swappiness",
2751 .data = &vm_swappiness,
2752 .maxlen = sizeof(vm_swappiness),
2753 .mode = 0644,
2754 .proc_handler = proc_dointvec_minmax,
2755 .extra1 = SYSCTL_ZERO,
2756 .extra2 = &one_hundred,
2757 },
2758#ifdef CONFIG_HUGETLB_PAGE
2759 {
2760 .procname = "nr_hugepages",
2761 .data = NULL,
2762 .maxlen = sizeof(unsigned long),
2763 .mode = 0644,
2764 .proc_handler = hugetlb_sysctl_handler,
2765 },
2766#ifdef CONFIG_NUMA
2767 {
2768 .procname = "nr_hugepages_mempolicy",
2769 .data = NULL,
2770 .maxlen = sizeof(unsigned long),
2771 .mode = 0644,
2772 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
2773 },
2774 {
2775 .procname = "numa_stat",
2776 .data = &sysctl_vm_numa_stat,
2777 .maxlen = sizeof(int),
2778 .mode = 0644,
2779 .proc_handler = sysctl_vm_numa_stat_handler,
2780 .extra1 = SYSCTL_ZERO,
2781 .extra2 = SYSCTL_ONE,
2782 },
2783#endif
2784 {
2785 .procname = "hugetlb_shm_group",
2786 .data = &sysctl_hugetlb_shm_group,
2787 .maxlen = sizeof(gid_t),
2788 .mode = 0644,
2789 .proc_handler = proc_dointvec,
2790 },
2791 {
2792 .procname = "nr_overcommit_hugepages",
2793 .data = NULL,
2794 .maxlen = sizeof(unsigned long),
2795 .mode = 0644,
2796 .proc_handler = hugetlb_overcommit_handler,
2797 },
2798#endif
2799 {
2800 .procname = "lowmem_reserve_ratio",
2801 .data = &sysctl_lowmem_reserve_ratio,
2802 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
2803 .mode = 0644,
2804 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
2805 },
2806 {
2807 .procname = "drop_caches",
2808 .data = &sysctl_drop_caches,
2809 .maxlen = sizeof(int),
2810 .mode = 0200,
2811 .proc_handler = drop_caches_sysctl_handler,
2812 .extra1 = SYSCTL_ONE,
2813 .extra2 = &four,
2814 },
2815#ifdef CONFIG_COMPACTION
2816 {
2817 .procname = "compact_memory",
2818 .data = &sysctl_compact_memory,
2819 .maxlen = sizeof(int),
2820 .mode = 0200,
2821 .proc_handler = sysctl_compaction_handler,
2822 },
2823 {
2824 .procname = "extfrag_threshold",
2825 .data = &sysctl_extfrag_threshold,
2826 .maxlen = sizeof(int),
2827 .mode = 0644,
2828 .proc_handler = proc_dointvec_minmax,
2829 .extra1 = &min_extfrag_threshold,
2830 .extra2 = &max_extfrag_threshold,
2831 },
2832 {
2833 .procname = "compact_unevictable_allowed",
2834 .data = &sysctl_compact_unevictable_allowed,
2835 .maxlen = sizeof(int),
2836 .mode = 0644,
2837 .proc_handler = proc_dointvec_minmax_warn_RT_change,
2838 .extra1 = SYSCTL_ZERO,
2839 .extra2 = SYSCTL_ONE,
2840 },
2841
2842#endif /* CONFIG_COMPACTION */
2843 {
2844 .procname = "min_free_kbytes",
2845 .data = &min_free_kbytes,
2846 .maxlen = sizeof(min_free_kbytes),
2847 .mode = 0644,
2848 .proc_handler = min_free_kbytes_sysctl_handler,
2849 .extra1 = SYSCTL_ZERO,
2850 },
2851 {
2852 .procname = "watermark_boost_factor",
2853 .data = &watermark_boost_factor,
2854 .maxlen = sizeof(watermark_boost_factor),
2855 .mode = 0644,
2856 .proc_handler = proc_dointvec_minmax,
2857 .extra1 = SYSCTL_ZERO,
2858 },
2859 {
2860 .procname = "watermark_scale_factor",
2861 .data = &watermark_scale_factor,
2862 .maxlen = sizeof(watermark_scale_factor),
2863 .mode = 0644,
2864 .proc_handler = watermark_scale_factor_sysctl_handler,
2865 .extra1 = SYSCTL_ONE,
2866 .extra2 = &one_thousand,
2867 },
2868 {
2869 .procname = "percpu_pagelist_fraction",
2870 .data = &percpu_pagelist_fraction,
2871 .maxlen = sizeof(percpu_pagelist_fraction),
2872 .mode = 0644,
2873 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
2874 .extra1 = SYSCTL_ZERO,
2875 },
2876#ifdef CONFIG_MMU
2877 {
2878 .procname = "max_map_count",
2879 .data = &sysctl_max_map_count,
2880 .maxlen = sizeof(sysctl_max_map_count),
2881 .mode = 0644,
2882 .proc_handler = proc_dointvec_minmax,
2883 .extra1 = SYSCTL_ZERO,
2884 },
2885#else
2886 {
2887 .procname = "nr_trim_pages",
2888 .data = &sysctl_nr_trim_pages,
2889 .maxlen = sizeof(sysctl_nr_trim_pages),
2890 .mode = 0644,
2891 .proc_handler = proc_dointvec_minmax,
2892 .extra1 = SYSCTL_ZERO,
2893 },
2894#endif
2895 {
2896 .procname = "laptop_mode",
2897 .data = &laptop_mode,
2898 .maxlen = sizeof(laptop_mode),
2899 .mode = 0644,
2900 .proc_handler = proc_dointvec_jiffies,
2901 },
2902 {
2903 .procname = "block_dump",
2904 .data = &block_dump,
2905 .maxlen = sizeof(block_dump),
2906 .mode = 0644,
2907 .proc_handler = proc_dointvec,
2908 .extra1 = SYSCTL_ZERO,
2909 },
2910 {
2911 .procname = "vfs_cache_pressure",
2912 .data = &sysctl_vfs_cache_pressure,
2913 .maxlen = sizeof(sysctl_vfs_cache_pressure),
2914 .mode = 0644,
2915 .proc_handler = proc_dointvec,
2916 .extra1 = SYSCTL_ZERO,
2917 },
2918#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \
2919 defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT)
2920 {
2921 .procname = "legacy_va_layout",
2922 .data = &sysctl_legacy_va_layout,
2923 .maxlen = sizeof(sysctl_legacy_va_layout),
2924 .mode = 0644,
2925 .proc_handler = proc_dointvec,
2926 .extra1 = SYSCTL_ZERO,
2927 },
2928#endif
2929#ifdef CONFIG_NUMA
2930 {
2931 .procname = "zone_reclaim_mode",
2932 .data = &node_reclaim_mode,
2933 .maxlen = sizeof(node_reclaim_mode),
2934 .mode = 0644,
2935 .proc_handler = proc_dointvec,
2936 .extra1 = SYSCTL_ZERO,
2937 },
2938 {
2939 .procname = "min_unmapped_ratio",
2940 .data = &sysctl_min_unmapped_ratio,
2941 .maxlen = sizeof(sysctl_min_unmapped_ratio),
2942 .mode = 0644,
2943 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
2944 .extra1 = SYSCTL_ZERO,
2945 .extra2 = &one_hundred,
2946 },
2947 {
2948 .procname = "min_slab_ratio",
2949 .data = &sysctl_min_slab_ratio,
2950 .maxlen = sizeof(sysctl_min_slab_ratio),
2951 .mode = 0644,
2952 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
2953 .extra1 = SYSCTL_ZERO,
2954 .extra2 = &one_hundred,
2955 },
2956#endif
2957#ifdef CONFIG_SMP
2958 {
2959 .procname = "stat_interval",
2960 .data = &sysctl_stat_interval,
2961 .maxlen = sizeof(sysctl_stat_interval),
2962 .mode = 0644,
2963 .proc_handler = proc_dointvec_jiffies,
2964 },
2965 {
2966 .procname = "stat_refresh",
2967 .data = NULL,
2968 .maxlen = 0,
2969 .mode = 0600,
2970 .proc_handler = vmstat_refresh,
2971 },
2972#endif
2973#ifdef CONFIG_MMU
2974 {
2975 .procname = "mmap_min_addr",
2976 .data = &dac_mmap_min_addr,
2977 .maxlen = sizeof(unsigned long),
2978 .mode = 0644,
2979 .proc_handler = mmap_min_addr_handler,
2980 },
2981#endif
2982#ifdef CONFIG_NUMA
2983 {
2984 .procname = "numa_zonelist_order",
2985 .data = &numa_zonelist_order,
2986 .maxlen = NUMA_ZONELIST_ORDER_LEN,
2987 .mode = 0644,
2988 .proc_handler = numa_zonelist_order_handler,
2989 },
2990#endif
2991#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
2992 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
2993 {
2994 .procname = "vdso_enabled",
2995#ifdef CONFIG_X86_32
2996 .data = &vdso32_enabled,
2997 .maxlen = sizeof(vdso32_enabled),
2998#else
2999 .data = &vdso_enabled,
3000 .maxlen = sizeof(vdso_enabled),
3001#endif
3002 .mode = 0644,
3003 .proc_handler = proc_dointvec,
3004 .extra1 = SYSCTL_ZERO,
3005 },
3006#endif
3007#ifdef CONFIG_HIGHMEM
3008 {
3009 .procname = "highmem_is_dirtyable",
3010 .data = &vm_highmem_is_dirtyable,
3011 .maxlen = sizeof(vm_highmem_is_dirtyable),
3012 .mode = 0644,
3013 .proc_handler = proc_dointvec_minmax,
3014 .extra1 = SYSCTL_ZERO,
3015 .extra2 = SYSCTL_ONE,
3016 },
3017#endif
3018#ifdef CONFIG_MEMORY_FAILURE
3019 {
3020 .procname = "memory_failure_early_kill",
3021 .data = &sysctl_memory_failure_early_kill,
3022 .maxlen = sizeof(sysctl_memory_failure_early_kill),
3023 .mode = 0644,
3024 .proc_handler = proc_dointvec_minmax,
3025 .extra1 = SYSCTL_ZERO,
3026 .extra2 = SYSCTL_ONE,
3027 },
3028 {
3029 .procname = "memory_failure_recovery",
3030 .data = &sysctl_memory_failure_recovery,
3031 .maxlen = sizeof(sysctl_memory_failure_recovery),
3032 .mode = 0644,
3033 .proc_handler = proc_dointvec_minmax,
3034 .extra1 = SYSCTL_ZERO,
3035 .extra2 = SYSCTL_ONE,
3036 },
3037#endif
3038 {
3039 .procname = "user_reserve_kbytes",
3040 .data = &sysctl_user_reserve_kbytes,
3041 .maxlen = sizeof(sysctl_user_reserve_kbytes),
3042 .mode = 0644,
3043 .proc_handler = proc_doulongvec_minmax,
3044 },
3045 {
3046 .procname = "admin_reserve_kbytes",
3047 .data = &sysctl_admin_reserve_kbytes,
3048 .maxlen = sizeof(sysctl_admin_reserve_kbytes),
3049 .mode = 0644,
3050 .proc_handler = proc_doulongvec_minmax,
3051 },
3052#ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
3053 {
3054 .procname = "mmap_rnd_bits",
3055 .data = &mmap_rnd_bits,
3056 .maxlen = sizeof(mmap_rnd_bits),
3057 .mode = 0600,
3058 .proc_handler = proc_dointvec_minmax,
3059 .extra1 = (void *)&mmap_rnd_bits_min,
3060 .extra2 = (void *)&mmap_rnd_bits_max,
3061 },
3062#endif
3063#ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS
3064 {
3065 .procname = "mmap_rnd_compat_bits",
3066 .data = &mmap_rnd_compat_bits,
3067 .maxlen = sizeof(mmap_rnd_compat_bits),
3068 .mode = 0600,
3069 .proc_handler = proc_dointvec_minmax,
3070 .extra1 = (void *)&mmap_rnd_compat_bits_min,
3071 .extra2 = (void *)&mmap_rnd_compat_bits_max,
3072 },
3073#endif
3074#ifdef CONFIG_USERFAULTFD
3075 {
3076 .procname = "unprivileged_userfaultfd",
3077 .data = &sysctl_unprivileged_userfaultfd,
3078 .maxlen = sizeof(sysctl_unprivileged_userfaultfd),
3079 .mode = 0644,
3080 .proc_handler = proc_dointvec_minmax,
3081 .extra1 = SYSCTL_ZERO,
3082 .extra2 = SYSCTL_ONE,
3083 },
3084#endif
3085 { }
3086};
3345 3087
3346int proc_doulongvec_minmax(struct ctl_table *table, int write,3088static struct ctl_table fs_table[] = {
3347 void __user *buffer, size_t *lenp, loff_t *ppos)3089 {
3348{3090 .procname = "inode-nr",
3349 return -ENOSYS;3091 .data = &inodes_stat,
3350}3092 .maxlen = 2*sizeof(long),
3093 .mode = 0444,
3094 .proc_handler = proc_nr_inodes,
3095 },
3096 {
3097 .procname = "inode-state",
3098 .data = &inodes_stat,
3099 .maxlen = 7*sizeof(long),
3100 .mode = 0444,
3101 .proc_handler = proc_nr_inodes,
3102 },
3103 {
3104 .procname = "file-nr",
3105 .data = &files_stat,
3106 .maxlen = sizeof(files_stat),
3107 .mode = 0444,
3108 .proc_handler = proc_nr_files,
3109 },
3110 {
3111 .procname = "file-max",
3112 .data = &files_stat.max_files,
3113 .maxlen = sizeof(files_stat.max_files),
3114 .mode = 0644,
3115 .proc_handler = proc_doulongvec_minmax,
3116 .extra1 = &zero_ul,
3117 .extra2 = &long_max,
3118 },
3119 {
3120 .procname = "nr_open",
3121 .data = &sysctl_nr_open,
3122 .maxlen = sizeof(unsigned int),
3123 .mode = 0644,
3124 .proc_handler = proc_dointvec_minmax,
3125 .extra1 = &sysctl_nr_open_min,
3126 .extra2 = &sysctl_nr_open_max,
3127 },
3128 {
3129 .procname = "dentry-state",
3130 .data = &dentry_stat,
3131 .maxlen = 6*sizeof(long),
3132 .mode = 0444,
3133 .proc_handler = proc_nr_dentry,
3134 },
3135 {
3136 .procname = "overflowuid",
3137 .data = &fs_overflowuid,
3138 .maxlen = sizeof(int),
3139 .mode = 0644,
3140 .proc_handler = proc_dointvec_minmax,
3141 .extra1 = &minolduid,
3142 .extra2 = &maxolduid,
3143 },
3144 {
3145 .procname = "overflowgid",
3146 .data = &fs_overflowgid,
3147 .maxlen = sizeof(int),
3148 .mode = 0644,
3149 .proc_handler = proc_dointvec_minmax,
3150 .extra1 = &minolduid,
3151 .extra2 = &maxolduid,
3152 },
3153#ifdef CONFIG_FILE_LOCKING
3154 {
3155 .procname = "leases-enable",
3156 .data = &leases_enable,
3157 .maxlen = sizeof(int),
3158 .mode = 0644,
3159 .proc_handler = proc_dointvec,
3160 },
3161#endif
3162#ifdef CONFIG_DNOTIFY
3163 {
3164 .procname = "dir-notify-enable",
3165 .data = &dir_notify_enable,
3166 .maxlen = sizeof(int),
3167 .mode = 0644,
3168 .proc_handler = proc_dointvec,
3169 },
3170#endif
3171#ifdef CONFIG_MMU
3172#ifdef CONFIG_FILE_LOCKING
3173 {
3174 .procname = "lease-break-time",
3175 .data = &lease_break_time,
3176 .maxlen = sizeof(int),
3177 .mode = 0644,
3178 .proc_handler = proc_dointvec,
3179 },
3180#endif
3181#ifdef CONFIG_AIO
3182 {
3183 .procname = "aio-nr",
3184 .data = &aio_nr,
3185 .maxlen = sizeof(aio_nr),
3186 .mode = 0444,
3187 .proc_handler = proc_doulongvec_minmax,
3188 },
3189 {
3190 .procname = "aio-max-nr",
3191 .data = &aio_max_nr,
3192 .maxlen = sizeof(aio_max_nr),
3193 .mode = 0644,
3194 .proc_handler = proc_doulongvec_minmax,
3195 },
3196#endif /* CONFIG_AIO */
3197#ifdef CONFIG_INOTIFY_USER
3198 {
3199 .procname = "inotify",
3200 .mode = 0555,
3201 .child = inotify_table,
3202 },
3203#endif
3204#ifdef CONFIG_EPOLL
3205 {
3206 .procname = "epoll",
3207 .mode = 0555,
3208 .child = epoll_table,
3209 },
3210#endif
3211#endif
3212 {
3213 .procname = "protected_symlinks",
3214 .data = &sysctl_protected_symlinks,
3215 .maxlen = sizeof(int),
3216 .mode = 0600,
3217 .proc_handler = proc_dointvec_minmax,
3218 .extra1 = SYSCTL_ZERO,
3219 .extra2 = SYSCTL_ONE,
3220 },
3221 {
3222 .procname = "protected_hardlinks",
3223 .data = &sysctl_protected_hardlinks,
3224 .maxlen = sizeof(int),
3225 .mode = 0600,
3226 .proc_handler = proc_dointvec_minmax,
3227 .extra1 = SYSCTL_ZERO,
3228 .extra2 = SYSCTL_ONE,
3229 },
3230 {
3231 .procname = "protected_fifos",
3232 .data = &sysctl_protected_fifos,
3233 .maxlen = sizeof(int),
3234 .mode = 0600,
3235 .proc_handler = proc_dointvec_minmax,
3236 .extra1 = SYSCTL_ZERO,
3237 .extra2 = &two,
3238 },
3239 {
3240 .procname = "protected_regular",
3241 .data = &sysctl_protected_regular,
3242 .maxlen = sizeof(int),
3243 .mode = 0600,
3244 .proc_handler = proc_dointvec_minmax,
3245 .extra1 = SYSCTL_ZERO,
3246 .extra2 = &two,
3247 },
3248 {
3249 .procname = "suid_dumpable",
3250 .data = &suid_dumpable,
3251 .maxlen = sizeof(int),
3252 .mode = 0644,
3253 .proc_handler = proc_dointvec_minmax_coredump,
3254 .extra1 = SYSCTL_ZERO,
3255 .extra2 = &two,
3256 },
3257#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
3258 {
3259 .procname = "binfmt_misc",
3260 .mode = 0555,
3261 .child = sysctl_mount_point,
3262 },
3263#endif
3264 {
3265 .procname = "pipe-max-size",
3266 .data = &pipe_max_size,
3267 .maxlen = sizeof(pipe_max_size),
3268 .mode = 0644,
3269 .proc_handler = proc_dopipe_max_size,
3270 },
3271 {
3272 .procname = "pipe-user-pages-hard",
3273 .data = &pipe_user_pages_hard,
3274 .maxlen = sizeof(pipe_user_pages_hard),
3275 .mode = 0644,
3276 .proc_handler = proc_doulongvec_minmax,
3277 },
3278 {
3279 .procname = "pipe-user-pages-soft",
3280 .data = &pipe_user_pages_soft,
3281 .maxlen = sizeof(pipe_user_pages_soft),
3282 .mode = 0644,
3283 .proc_handler = proc_doulongvec_minmax,
3284 },
3285 {
3286 .procname = "mount-max",
3287 .data = &sysctl_mount_max,
3288 .maxlen = sizeof(unsigned int),
3289 .mode = 0644,
3290 .proc_handler = proc_dointvec_minmax,
3291 .extra1 = SYSCTL_ONE,
3292 },
3293 { }
3294};
3351 3295
3352int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,3296static struct ctl_table debug_table[] = {
3353 void __user *buffer,3297#ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
3354 size_t *lenp, loff_t *ppos)3298 {
3355{3299 .procname = "exception-trace",
3356 return -ENOSYS;3300 .data = &show_unhandled_signals,
3357}3301 .maxlen = sizeof(int),
3302 .mode = 0644,
3303 .proc_handler = proc_dointvec
3304 },
3305#endif
3306#if defined(CONFIG_OPTPROBES)
3307 {
3308 .procname = "kprobes-optimization",
3309 .data = &sysctl_kprobes_optimization,
3310 .maxlen = sizeof(int),
3311 .mode = 0644,
3312 .proc_handler = proc_kprobes_optimization_handler,
3313 .extra1 = SYSCTL_ZERO,
3314 .extra2 = SYSCTL_ONE,
3315 },
3316#endif
3317 { }
3318};
3358 3319
3359int proc_do_large_bitmap(struct ctl_table *table, int write,3320static struct ctl_table dev_table[] = {
3360 void __user *buffer, size_t *lenp, loff_t *ppos)3321 { }
3361{3322};
3362 return -ENOSYS;
3363}
3364 3323
3365#endif /* CONFIG_PROC_SYSCTL */3324static struct ctl_table sysctl_base_table[] = {
3325 {
3326 .procname = "kernel",
3327 .mode = 0555,
3328 .child = kern_table,
3329 },
3330 {
3331 .procname = "vm",
3332 .mode = 0555,
3333 .child = vm_table,
3334 },
3335 {
3336 .procname = "fs",
3337 .mode = 0555,
3338 .child = fs_table,
3339 },
3340 {
3341 .procname = "debug",
3342 .mode = 0555,
3343 .child = debug_table,
3344 },
3345 {
3346 .procname = "dev",
3347 .mode = 0555,
3348 .child = dev_table,
3349 },
3350 { }
3351};
3366 3352
3367#if defined(CONFIG_SYSCTL)3353int __init sysctl_init(void)
3368int proc_do_static_key(struct ctl_table *table, int write,
3369 void __user *buffer, size_t *lenp,
3370 loff_t *ppos)
3371{3354{
3372 struct static_key *key = (struct static_key *)table->data;3355 struct ctl_table_header *hdr;
3373 static DEFINE_MUTEX(static_key_mutex);
3374 int val, ret;
3375 struct ctl_table tmp = {
3376 .data = &val,
3377 .maxlen = sizeof(val),
3378 .mode = table->mode,
3379 .extra1 = SYSCTL_ZERO,
3380 .extra2 = SYSCTL_ONE,
3381 };
3382
3383 if (write && !capable(CAP_SYS_ADMIN))
3384 return -EPERM;
3385 3356
3386 mutex_lock(&static_key_mutex);3357 hdr = register_sysctl_table(sysctl_base_table);
3387 val = static_key_enabled(key);3358 kmemleak_not_leak(hdr);
3388 ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);3359 return 0;
3389 if (write && !ret) {
3390 if (val)
3391 static_key_enable(key);
3392 else
3393 static_key_disable(key);
3394 }
3395 mutex_unlock(&static_key_mutex);
3396 return ret;
3397}3360}
3398#endif3361#endif /* CONFIG_SYSCTL */
3399/*3362/*
3400 * No sense putting this after each symbol definition, twice,3363 * No sense putting this after each symbol definition, twice,
3401 * exception granted :-)3364 * exception granted :-)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t