History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next

Pull networking updates from David Miller: 1) Allow setting bluetooth L2CAP modes via socket option, from Luiz Augusto von Dentz. 2) Add GSO partial support to igc, from Sasha Neftin. 3) Several cleanups and improvements to r8169 from Heiner Kallweit. 4) Add IF_OPER_TESTING link state and use it when ethtool triggers a device self-test. From Andrew Lunn. 5) Start moving away from custom driver versions, use the globally defined kernel version instead, from Leon Romanovsky. 6) Support GRO vis gro_cells in DSA layer, from Alexander Lobakin. 7) Allow hard IRQ deferral during NAPI, from Eric Dumazet. 8) Add sriov and vf support to hinic, from Luo bin. 9) Support Media Redundancy Protocol (MRP) in the bridging code, from Horatiu Vultur. 10) Support netmap in the nft_nat code, from Pablo Neira Ayuso. 11) Allow UDPv6 encapsulation of ESP in the ipsec code, from Sabrina Dubroca. Also add ipv6 support for espintcp. 12) Lots of ReST conversions of the networking documentation, from Mauro Carvalho Chehab. 13) Support configuration of ethtool rxnfc flows in bcmgenet driver, from Doug Berger. 14) Allow to dump cgroup id and filter by it in inet_diag code, from Dmitry Yakunin. 15) Add infrastructure to export netlink attribute policies to userspace, from Johannes Berg. 16) Several optimizations to sch_fq scheduler, from Eric Dumazet. 17) Fallback to the default qdisc if qdisc init fails because otherwise a packet scheduler init failure will make a device inoperative. From Jesper Dangaard Brouer. 18) Several RISCV bpf jit optimizations, from Luke Nelson. 19) Correct the return type of the ->ndo_start_xmit() method in several drivers, it's netdev_tx_t but many drivers were using 'int'. From Yunjian Wang. 20) Add an ethtool interface for PHY master/slave config, from Oleksij Rempel. 21) Add BPF iterators, from Yonghang Song. 22) Add cable test infrastructure, including ethool interfaces, from Andrew Lunn. Marvell PHY driver is the first to support this facility. 23) Remove zero-length arrays all over, from Gustavo A. R. Silva. 24) Calculate and maintain an explicit frame size in XDP, from Jesper Dangaard Brouer. 25) Add CAP_BPF, from Alexei Starovoitov. 26) Support terse dumps in the packet scheduler, from Vlad Buslov. 27) Support XDP_TX bulking in dpaa2 driver, from Ioana Ciornei. 28) Add devm_register_netdev(), from Bartosz Golaszewski. 29) Minimize qdisc resets, from Cong Wang. 30) Get rid of kernel_getsockopt and kernel_setsockopt in order to eliminate set_fs/get_fs calls. From Christoph Hellwig. * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (2517 commits) selftests: net: ip_defrag: ignore EPERM net_failover: fixed rollback in net_failover_open() Revert "tipc: Fix potential tipc_aead refcnt leak in tipc_crypto_rcv" Revert "tipc: Fix potential tipc_node refcnt leak in tipc_rcv" vmxnet3: allow rx flow hash ops only when rss is enabled hinic: add set_channels ethtool_ops support selftests/bpf: Add a default $(CXX) value tools/bpf: Don't use $(COMPILE.c) bpf, selftests: Use bpf_probe_read_kernel s390/bpf: Use bcr 0,%0 as tail call nop filler s390/bpf: Maintain 8-byte stack alignment selftests/bpf: Fix verifier test selftests/bpf: Fix sample_cnt shared between two threads bpf, selftests: Adapt cls_redirect to call csum_level helper bpf: Add csum_level helper for fixing up csum levels bpf: Fix up bpf_skb_adjust_room helper's skb csum setting sfc: add missing annotation for efx_ef10_try_update_nic_stats_vf() crypto/chtls: IPv6 support for inline TLS Crypto/chcr: Fixes a coccinile check error Crypto/chcr: Fixes compilations warnings ...

Linus Torvalds committed 6 years ago

Commit cb8e59c2 parents 2e63f6c 065fcfd2097 files · +151766 −46213Browse files

Showing the changes to kernel/sysctl.c (1 of 2097 files). Show all

Unified · Split

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