History

Merge branch 'work.sysctl' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull in Christoph Hellwig's series that changes the sysctl's ->proc_handler methods to take kernel pointers instead. It gets rid of the set_fs address space overrides used by BPF. As per discussion, pull in the feature branch into bpf-next as it relates to BPF sysctl progs.

Daniel Borkmann committed 6 years ago

Commit 0b541422 parents 8c1b2bf 329273991 files · +2241 −2505Browse files

Unified · Split

91 files
  1. arch/arm64/kernel/armv8_deprecated.c +1 −1
  2. arch/arm64/kernel/fpsimd.c +1 −2
  3. arch/mips/lasat/sysctl.c +5 −8
  4. arch/s390/appldata/appldata_base.c +5 −6
  5. arch/s390/kernel/debug.c +1 −1
  6. arch/s390/kernel/topology.c +1 −1
  7. arch/s390/mm/cmm.c +5 −7
  8. arch/x86/kernel/itmt.c +1 −2
  9. drivers/cdrom/cdrom.c +1 −1
  10. drivers/char/random.c +1 −1
  11. drivers/macintosh/mac_hid.c +1 −2
  12. drivers/parport/procfs.c +18 −21
  13. fs/dcache.c +1 −1
  14. fs/drop_caches.c +1 −1
  15. fs/file_table.c +2 −2
  16. fs/fscache/main.c +1 −2
  17. fs/inode.c +1 −1
  18. fs/proc/proc_sysctl.c +29 −18
  19. fs/quota/dquot.c +1 −1
  20. fs/xfs/xfs_sysctl.c +2 −2
  21. include/linux/bpf-cgroup.h +4 −5
  22. include/linux/compaction.h +1 −1
  23. include/linux/coredump.h +4 −0
  24. include/linux/file.h +2 −0
  25. include/linux/fs.h +3 −3
  26. include/linux/ftrace.h +1 −2
  27. include/linux/hugetlb.h +7 −8
  28. include/linux/kprobes.h +1 −1
  29. include/linux/latencytop.h +2 −2
  30. include/linux/mm.h +8 −6
  31. include/linux/mmzone.h +13 −14
  32. include/linux/nmi.h +5 −10
  33. include/linux/perf_event.h +5 −8
  34. include/linux/pid.h +3 −0
  35. include/linux/printk.h +1 −1
  36. include/linux/sched/sysctl.h +15 −29
  37. include/linux/security.h +1 −1
  38. include/linux/sysctl.h +30 −31
  39. include/linux/timer.h +1 −2
  40. include/linux/vmstat.h +4 −4
  41. include/linux/writeback.h +11 −17
  42. ipc/ipc_sysctl.c +5 −5
  43. ipc/mq_sysctl.c +2 −2
  44. kernel/bpf/cgroup.c +12 −23
  45. kernel/events/callchain.c +1 −1
  46. kernel/events/core.c +2 −4
  47. kernel/kprobes.c +1 −1
  48. kernel/latencytop.c +2 −2
  49. kernel/pid_namespace.c +1 −1
  50. kernel/printk/printk.c +1 −1
  51. kernel/sched/core.c +4 −5
  52. kernel/sched/fair.c +1 −2
  53. kernel/sched/rt.c +4 −6
  54. kernel/sched/topology.c +1 −1
  55. kernel/seccomp.c +1 −1
  56. kernel/sysctl.c +1853 −1986
  57. kernel/time/timer.c +1 −2
  58. kernel/trace/trace.c +1 −1
  59. kernel/umh.c +1 −1
  60. kernel/utsname_sysctl.c +1 −1
  61. kernel/watchdog.c +6 −6
  62. mm/compaction.c +1 −1
  63. mm/hugetlb.c +4 −5
  64. mm/page-writeback.c +6 −10
  65. mm/page_alloc.c +10 −32
  66. mm/util.c +4 −6
  67. mm/vmstat.c +2 −2
  68. net/bridge/br_netfilter_hooks.c +1 −1
  69. net/core/neighbour.c +13 −15
  70. net/core/sysctl_net_core.c +10 −17
  71. net/decnet/dn_dev.c +3 −4
  72. net/decnet/sysctl_net_decnet.c +8 −19
  73. net/ipv4/devinet.c +3 −6
  74. net/ipv4/route.c +1 −2
  75. net/ipv4/sysctl_net_ipv4.c +15 −23
  76. net/ipv6/addrconf.c +13 −20
  77. net/ipv6/ndisc.c +2 −1
  78. net/ipv6/route.c +2 −3
  79. net/ipv6/sysctl_net_ipv6.c +1 −2
  80. net/mpls/af_mpls.c +2 −3
  81. net/netfilter/ipvs/ip_vs_ctl.c +3 −3
  82. net/netfilter/nf_conntrack_standalone.c +1 −1
  83. net/netfilter/nf_log.c +1 −1
  84. net/phonet/sysctl.c +1 −2
  85. net/rds/tcp.c +2 −4
  86. net/sctp/sysctl.c +11 −21
  87. net/sunrpc/sysctl.c +13 −16
  88. net/sunrpc/xprtrdma/svc_rdma.c +3 −4
  89. security/apparmor/lsm.c +1 −1
  90. security/min_addr.c +1 −1
  91. security/yama/yama_lsm.c +1 −1
arch/arm64/kernel/armv8_deprecated.c+1−1
@@ -203,7 +203,7 @@ static void __init register_insn_emulation(struct insn_emulation_ops *ops) · 202 unmodified lines
203203 }
204204
205205 static int emulation_proc_handler(struct ctl_table *table, int write,
206− void __user *buffer, size_t *lenp,
206+ void *buffer, size_t *lenp,
207207 loff_t *ppos)
208208 {
209209 int ret = 0;
arch/arm64/kernel/fpsimd.c+1−2
@@ -341,8 +341,7 @@ static unsigned int find_supported_vector_length(unsigned int vl) · 340 unmodified lines
341341 #ifdef CONFIG_SYSCTL
342342
343343 static int sve_proc_do_default_vl(struct ctl_table *table, int write,
344− void __user *buffer, size_t *lenp,
345− loff_t *ppos)
344+ void *buffer, size_t *lenp, loff_t *ppos)
346345 {
347346 int ret;
348347 int vl = sve_default_vl;
arch/mips/lasat/sysctl.c+5−8
@@ -95,16 +95,15 @@ int proc_lasat_ip(struct ctl_table *table, int write, · 94 unmodified lines
9595 len = 0;
9696 p = buffer;
9797 while (len < *lenp) {
98− if (get_user(c, p++))
99− return -EFAULT;
98+ c = *p;
99+ p++;
100100 if (c == 0 || c == '\n')
101101 break;
102102 len++;
103103 }
104104 if (len >= sizeof(ipbuf)-1)
105105 len = sizeof(ipbuf) - 1;
106− if (copy_from_user(ipbuf, buffer, len))
107− return -EFAULT;
106+ memcpy(ipbuf, buffer, len);
108107 ipbuf[len] = 0;
109108 *ppos += *lenp;
110109 /* Now see if we can convert it to a valid IP */
@@ -122,11 +121,9 @@ int proc_lasat_ip(struct ctl_table *table, int write, · 11 unmodified lines
122121 if (len > *lenp)
123122 len = *lenp;
124123 if (len)
125− if (copy_to_user(buffer, ipbuf, len))
126− return -EFAULT;
124+ memcpy(buffer, ipbuf, len);
127125 if (len < *lenp) {
128− if (put_user('\n', ((char *) buffer) + len))
129− return -EFAULT;
126+ *((char *)buffer + len) = '\n';
130127 len++;
131128 }
132129 *lenp = len;
arch/s390/appldata/appldata_base.c+5−6
@@ -51,10 +51,9 @@ static struct platform_device *appldata_pdev; · 50 unmodified lines
5151 */
5252 static const char appldata_proc_name[APPLDATA_PROC_NAME_LENGTH] = "appldata";
5353 static int appldata_timer_handler(struct ctl_table *ctl, int write,
54− void __user *buffer, size_t *lenp, loff_t *ppos);
54+ void *buffer, size_t *lenp, loff_t *ppos);
5555 static int appldata_interval_handler(struct ctl_table *ctl, int write,
56− void __user *buffer,
57− size_t *lenp, loff_t *ppos);
56+ void *buffer, size_t *lenp, loff_t *ppos);
5857
5958 static struct ctl_table_header *appldata_sysctl_header;
6059 static struct ctl_table appldata_table[] = {
@@ -217,7 +216,7 @@ static void __appldata_vtimer_setup(int cmd) · 156 unmodified lines
217216 */
218217 static int
219218 appldata_timer_handler(struct ctl_table *ctl, int write,
220− void __user *buffer, size_t *lenp, loff_t *ppos)
219+ void *buffer, size_t *lenp, loff_t *ppos)
221220 {
222221 int timer_active = appldata_timer_active;
223222 int rc;
@@ -250,7 +249,7 @@ appldata_timer_handler(struct ctl_table *ctl, int write, · 26 unmodified lines
250249 */
251250 static int
252251 appldata_interval_handler(struct ctl_table *ctl, int write,
253− void __user *buffer, size_t *lenp, loff_t *ppos)
252+ void *buffer, size_t *lenp, loff_t *ppos)
254253 {
255254 int interval = appldata_interval;
256255 int rc;
@@ -280,7 +279,7 @@ appldata_interval_handler(struct ctl_table *ctl, int write, · 23 unmodified lines
280279 */
281280 static int
282281 appldata_generic_handler(struct ctl_table *ctl, int write,
283− void __user *buffer, size_t *lenp, loff_t *ppos)
282+ void *buffer, size_t *lenp, loff_t *ppos)
284283 {
285284 struct appldata_ops *ops = NULL, *tmp_ops;
286285 struct list_head *lh;
arch/s390/kernel/debug.c+1−1
@@ -867,7 +867,7 @@ static int debug_active = 1; · 866 unmodified lines
867867 * if debug_active is already off
868868 */
869869 static int s390dbf_procactive(struct ctl_table *table, int write,
870− void __user *buffer, size_t *lenp, loff_t *ppos)
870+ void *buffer, size_t *lenp, loff_t *ppos)
871871 {
872872 if (!write || debug_stoppable || !debug_active)
873873 return proc_dointvec(table, write, buffer, lenp, ppos);
arch/s390/kernel/topology.c+1−1
@@ -594,7 +594,7 @@ static int __init topology_setup(char *str) · 593 unmodified lines
594594 early_param("topology", topology_setup);
595595
596596 static int topology_ctl_handler(struct ctl_table *ctl, int write,
597− void __user *buffer, size_t *lenp, loff_t *ppos)
597+ void *buffer, size_t *lenp, loff_t *ppos)
598598 {
599599 int enabled = topology_is_enabled();
600600 int new_mode;
arch/s390/mm/cmm.c+5−7
@@ -245,7 +245,7 @@ static int cmm_skip_blanks(char *cp, char **endp) · 244 unmodified lines
245245 }
246246
247247 static int cmm_pages_handler(struct ctl_table *ctl, int write,
248− void __user *buffer, size_t *lenp, loff_t *ppos)
248+ void *buffer, size_t *lenp, loff_t *ppos)
249249 {
250250 long nr = cmm_get_pages();
251251 struct ctl_table ctl_entry = {
@@ -264,7 +264,7 @@ static int cmm_pages_handler(struct ctl_table *ctl, int write, · 12 unmodified lines
264264 }
265265
266266 static int cmm_timed_pages_handler(struct ctl_table *ctl, int write,
267− void __user *buffer, size_t *lenp,
267+ void *buffer, size_t *lenp,
268268 loff_t *ppos)
269269 {
270270 long nr = cmm_get_timed_pages();
@@ -284,7 +284,7 @@ static int cmm_timed_pages_handler(struct ctl_table *ctl, int write, · 13 unmodified lines
284284 }
285285
286286 static int cmm_timeout_handler(struct ctl_table *ctl, int write,
287− void __user *buffer, size_t *lenp, loff_t *ppos)
287+ void *buffer, size_t *lenp, loff_t *ppos)
288288 {
289289 char buf[64], *p;
290290 long nr, seconds;
@@ -297,8 +297,7 @@ static int cmm_timeout_handler(struct ctl_table *ctl, int write, · 6 unmodified lines
297297
298298 if (write) {
299299 len = min(*lenp, sizeof(buf));
300− if (copy_from_user(buf, buffer, len))
301− return -EFAULT;
300+ memcpy(buf, buffer, len);
302301 buf[len - 1] = '\0';
303302 cmm_skip_blanks(buf, &p);
304303 nr = simple_strtoul(p, &p, 0);
@@ -311,8 +310,7 @@ static int cmm_timeout_handler(struct ctl_table *ctl, int write, · 6 unmodified lines
311310 cmm_timeout_pages, cmm_timeout_seconds);
312311 if (len > *lenp)
313312 len = *lenp;
314− if (copy_to_user(buffer, buf, len))
315− return -EFAULT;
313+ memcpy(buffer, buf, len);
316314 *lenp = len;
317315 *ppos += len;
318316 }
arch/x86/kernel/itmt.c+1−2
@@ -39,8 +39,7 @@ static bool __read_mostly sched_itmt_capable; · 38 unmodified lines
3939 unsigned int __read_mostly sysctl_sched_itmt_enabled;
4040
4141 static int sched_itmt_update_handler(struct ctl_table *table, int write,
42− void __user *buffer, size_t *lenp,
43− loff_t *ppos)
42+ void *buffer, size_t *lenp, loff_t *ppos)
4443 {
4544 unsigned int old_sysctl;
4645 int ret;
drivers/cdrom/cdrom.c+1−1
@@ -3631,7 +3631,7 @@ static void cdrom_update_settings(void) · 3630 unmodified lines
36313631 }
36323632
36333633 static int cdrom_sysctl_handler(struct ctl_table *ctl, int write,
3634− void __user *buffer, size_t *lenp, loff_t *ppos)
3634+ void *buffer, size_t *lenp, loff_t *ppos)
36353635 {
36363636 int ret;
36373637
drivers/char/random.c+1−1
@@ -2057,7 +2057,7 @@ static char sysctl_bootid[16]; · 2056 unmodified lines
20572057 * sysctl system call, as 16 bytes of binary data.
20582058 */
20592059 static int proc_do_uuid(struct ctl_table *table, int write,
2060− void __user *buffer, size_t *lenp, loff_t *ppos)
2060+ void *buffer, size_t *lenp, loff_t *ppos)
20612061 {
20622062 struct ctl_table fake_table;
20632063 unsigned char buf[64], tmp_uuid[16], *uuid;
drivers/macintosh/mac_hid.c+1−2
@@ -183,8 +183,7 @@ static void mac_hid_stop_emulation(void) · 182 unmodified lines
183183 }
184184
185185 static int mac_hid_toggle_emumouse(struct ctl_table *table, int write,
186− void __user *buffer, size_t *lenp,
187− loff_t *ppos)
186+ void *buffer, size_t *lenp, loff_t *ppos)
188187 {
189188 int *valp = table->data;
190189 int old_val = *valp;
drivers/parport/procfs.c+18−21
@@ -34,7 +34,7 @@ · 33 unmodified lines
3434 #define PARPORT_MAX_SPINTIME_VALUE 1000
3535
3636 static int do_active_device(struct ctl_table *table, int write,
37− void __user *result, size_t *lenp, loff_t *ppos)
37+ void *result, size_t *lenp, loff_t *ppos)
3838 {
3939 struct parport *port = (struct parport *)table->extra1;
4040 char buffer[256];
@@ -65,13 +65,13 @@ static int do_active_device(struct ctl_table *table, int write, · 24 unmodified lines
6565 *lenp = len;
6666
6767 *ppos += len;
68−
69− return copy_to_user(result, buffer, len) ? -EFAULT : 0;
68+ memcpy(result, buffer, len);
69+ return 0;
7070 }
7171
7272 #ifdef CONFIG_PARPORT_1284
7373 static int do_autoprobe(struct ctl_table *table, int write,
74− void __user *result, size_t *lenp, loff_t *ppos)
74+ void *result, size_t *lenp, loff_t *ppos)
7575 {
7676 struct parport_device_info *info = table->extra2;
7777 const char *str;
@@ -108,13 +108,13 @@ static int do_autoprobe(struct ctl_table *table, int write, · 30 unmodified lines
108108
109109 *ppos += len;
110110
111− return copy_to_user (result, buffer, len) ? -EFAULT : 0;
111+ memcpy(result, buffer, len);
112+ return 0;
112113 }
113114 #endif /* IEEE1284.3 support. */
114115
115116 static int do_hardware_base_addr(struct ctl_table *table, int write,
116− void __user *result,
117− size_t *lenp, loff_t *ppos)
117+ void *result, size_t *lenp, loff_t *ppos)
118118 {
119119 struct parport *port = (struct parport *)table->extra1;
120120 char buffer[20];
@@ -136,13 +136,12 @@ static int do_hardware_base_addr(struct ctl_table *table, int write, · 15 unmodified lines
136136 *lenp = len;
137137
138138 *ppos += len;
139−
140− return copy_to_user(result, buffer, len) ? -EFAULT : 0;
139+ memcpy(result, buffer, len);
140+ return 0;
141141 }
142142
143143 static int do_hardware_irq(struct ctl_table *table, int write,
144− void __user *result,
145− size_t *lenp, loff_t *ppos)
144+ void *result, size_t *lenp, loff_t *ppos)
146145 {
147146 struct parport *port = (struct parport *)table->extra1;
148147 char buffer[20];
@@ -164,13 +163,12 @@ static int do_hardware_irq(struct ctl_table *table, int write, · 15 unmodified lines
164163 *lenp = len;
165164
166165 *ppos += len;
167−
168− return copy_to_user(result, buffer, len) ? -EFAULT : 0;
166+ memcpy(result, buffer, len);
167+ return 0;
169168 }
170169
171170 static int do_hardware_dma(struct ctl_table *table, int write,
172− void __user *result,
173− size_t *lenp, loff_t *ppos)
171+ void *result, size_t *lenp, loff_t *ppos)
174172 {
175173 struct parport *port = (struct parport *)table->extra1;
176174 char buffer[20];
@@ -192,13 +190,12 @@ static int do_hardware_dma(struct ctl_table *table, int write, · 15 unmodified lines
192190 *lenp = len;
193191
194192 *ppos += len;
195−
196− return copy_to_user(result, buffer, len) ? -EFAULT : 0;
193+ memcpy(result, buffer, len);
194+ return 0;
197195 }
198196
199197 static int do_hardware_modes(struct ctl_table *table, int write,
200− void __user *result,
201− size_t *lenp, loff_t *ppos)
198+ void *result, size_t *lenp, loff_t *ppos)
202199 {
203200 struct parport *port = (struct parport *)table->extra1;
204201 char buffer[40];
@@ -231,8 +228,8 @@ static int do_hardware_modes(struct ctl_table *table, int write, · 26 unmodified lines
231228 *lenp = len;
232229
233230 *ppos += len;
234−
235− return copy_to_user(result, buffer, len) ? -EFAULT : 0;
231+ memcpy(result, buffer, len);
232+ return 0;
236233 }
237234
238235 #define PARPORT_PORT_DIR(CHILD) { .procname = NULL, .mode = 0555, .child = CHILD }
fs/dcache.c+1−1
@@ -165,7 +165,7 @@ static long get_nr_dentry_negative(void) · 164 unmodified lines
165165 return sum < 0 ? 0 : sum;
166166 }
167167
168−int proc_nr_dentry(struct ctl_table *table, int write, void __user *buffer,
168+int proc_nr_dentry(struct ctl_table *table, int write, void *buffer,
169169 size_t *lenp, loff_t *ppos)
170170 {
171171 dentry_stat.nr_dentry = get_nr_dentry();
fs/drop_caches.c+1−1
@@ -47,7 +47,7 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused) · 46 unmodified lines
4747 }
4848
4949 int drop_caches_sysctl_handler(struct ctl_table *table, int write,
50− void __user *buffer, size_t *length, loff_t *ppos)
50+ void *buffer, size_t *length, loff_t *ppos)
5151 {
5252 int ret;
5353
fs/file_table.c+2−2
@@ -80,14 +80,14 @@ EXPORT_SYMBOL_GPL(get_max_files); · 79 unmodified lines
8080 */
8181 #if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS)
8282 int proc_nr_files(struct ctl_table *table, int write,
83− void __user *buffer, size_t *lenp, loff_t *ppos)
83+ void *buffer, size_t *lenp, loff_t *ppos)
8484 {
8585 files_stat.nr_files = get_nr_files();
8686 return proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
8787 }
8888 #else
8989 int proc_nr_files(struct ctl_table *table, int write,
90− void __user *buffer, size_t *lenp, loff_t *ppos)
90+ void *buffer, size_t *lenp, loff_t *ppos)
9191 {
9292 return -ENOSYS;
9393 }
fs/fscache/main.c+1−2
@@ -51,8 +51,7 @@ static unsigned fscache_op_max_active = 2; · 50 unmodified lines
5151 static struct ctl_table_header *fscache_sysctl_header;
5252
5353 static int fscache_max_active_sysctl(struct ctl_table *table, int write,
54− void __user *buffer,
55− size_t *lenp, loff_t *ppos)
54+ void *buffer, size_t *lenp, loff_t *ppos)
5655 {
5756 struct workqueue_struct **wqp = table->extra1;
5857 unsigned int *datap = table->data;
fs/inode.c+1−1
@@ -108,7 +108,7 @@ long get_nr_dirty_inodes(void) · 107 unmodified lines
108108 */
109109 #ifdef CONFIG_SYSCTL
110110 int proc_nr_inodes(struct ctl_table *table, int write,
111− void __user *buffer, size_t *lenp, loff_t *ppos)
111+ void *buffer, size_t *lenp, loff_t *ppos)
112112 {
113113 inodes_stat.nr_inodes = get_nr_inodes();
114114 inodes_stat.nr_unused = get_nr_inodes_unused();
fs/proc/proc_sysctl.c+29−18
@@ -539,13 +539,13 @@ out: · 538 unmodified lines
539539 return err;
540540 }
541541
542−static ssize_t proc_sys_call_handler(struct file *filp, void __user *buf,
542+static ssize_t proc_sys_call_handler(struct file *filp, void __user *ubuf,
543543 size_t count, loff_t *ppos, int write)
544544 {
545545 struct inode *inode = file_inode(filp);
546546 struct ctl_table_header *head = grab_header(inode);
547547 struct ctl_table *table = PROC_I(inode)->sysctl_entry;
548− void *new_buf = NULL;
548+ void *kbuf;
549549 ssize_t error;
550550
551551 if (IS_ERR(head))
@@ -564,27 +564,38 @@ static ssize_t proc_sys_call_handler(struct file *filp, void __user *buf, · 12 unmodified lines
564564 if (!table->proc_handler)
565565 goto out;
566566
567− error = BPF_CGROUP_RUN_PROG_SYSCTL(head, table, write, buf, &count,
568− ppos, &new_buf);
567+ if (write) {
568+ kbuf = memdup_user_nul(ubuf, count);
569+ if (IS_ERR(kbuf)) {
570+ error = PTR_ERR(kbuf);
571+ goto out;
572+ }
573+ } else {
574+ error = -ENOMEM;
575+ kbuf = kzalloc(count, GFP_KERNEL);
576+ if (!kbuf)
577+ goto out;
578+ }
579+
580+ error = BPF_CGROUP_RUN_PROG_SYSCTL(head, table, write, &kbuf, &count,
581+ ppos);
569582 if (error)
570− goto out;
583+ goto out_free_buf;
571584
572585 /* careful: calling conventions are nasty here */
573− if (new_buf) {
574− mm_segment_t old_fs;
575−
576− old_fs = get_fs();
577− set_fs(KERNEL_DS);
578− error = table->proc_handler(table, write, (void __user *)new_buf,
579− &count, ppos);
580− set_fs(old_fs);
581− kfree(new_buf);
582− } else {
583− error = table->proc_handler(table, write, buf, &count, ppos);
586+ error = table->proc_handler(table, write, kbuf, &count, ppos);
587+ if (error)
588+ goto out_free_buf;
589+
590+ if (!write) {
591+ error = -EFAULT;
592+ if (copy_to_user(ubuf, kbuf, count))
593+ goto out_free_buf;
584594 }
585595
586− if (!error)
587− error = count;
596+ error = count;
597+out_free_buf:
598+ kfree(kbuf);
588599 out:
589600 sysctl_head_finish(head);
590601
fs/quota/dquot.c+1−1
@@ -2841,7 +2841,7 @@ const struct quotactl_ops dquot_quotactl_sysfile_ops = { · 2840 unmodified lines
28412841 EXPORT_SYMBOL(dquot_quotactl_sysfile_ops);
28422842
28432843 static int do_proc_dqstats(struct ctl_table *table, int write,
2844− void __user *buffer, size_t *lenp, loff_t *ppos)
2844+ void *buffer, size_t *lenp, loff_t *ppos)
28452845 {
28462846 unsigned int type = (unsigned long *)table->data - dqstats.stat;
28472847 s64 value = percpu_counter_sum(&dqstats.counter[type]);
fs/xfs/xfs_sysctl.c+2−2
@@ -13,7 +13,7 @@ STATIC int · 12 unmodified lines
1313 xfs_stats_clear_proc_handler(
1414 struct ctl_table *ctl,
1515 int write,
16− void __user *buffer,
16+ void *buffer,
1717 size_t *lenp,
1818 loff_t *ppos)
1919 {
@@ -33,7 +33,7 @@ STATIC int · 13 unmodified lines
3333 xfs_panic_mask_proc_handler(
3434 struct ctl_table *ctl,
3535 int write,
36− void __user *buffer,
36+ void *buffer,
3737 size_t *lenp,
3838 loff_t *ppos)
3939 {
include/linux/bpf-cgroup.h+4−5
@@ -138,8 +138,7 @@ int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor, · 137 unmodified lines
138138
139139 int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head,
140140 struct ctl_table *table, int write,
141− void __user *buf, size_t *pcount,
142− loff_t *ppos, void **new_buf,
141+ void **buf, size_t *pcount, loff_t *ppos,
143142 enum bpf_attach_type type);
144143
145144 int __cgroup_bpf_run_filter_setsockopt(struct sock *sock, int *level,
@@ -302,12 +301,12 @@ int bpf_percpu_cgroup_storage_update(struct bpf_map *map, void *key, · 156 unmodified lines
302301 })
303302
304303
305−#define BPF_CGROUP_RUN_PROG_SYSCTL(head, table, write, buf, count, pos, nbuf) \
304+#define BPF_CGROUP_RUN_PROG_SYSCTL(head, table, write, buf, count, pos) \
306305 ({ \
307306 int __ret = 0; \
308307 if (cgroup_bpf_enabled) \
309308 __ret = __cgroup_bpf_run_filter_sysctl(head, table, write, \
310− buf, count, pos, nbuf, \
309+ buf, count, pos, \
311310 BPF_CGROUP_SYSCTL); \
312311 __ret; \
313312 })
@@ -429,7 +428,7 @@ static inline int bpf_percpu_cgroup_storage_update(struct bpf_map *map, · 115 unmodified lines
429428 #define BPF_CGROUP_RUN_PROG_UDP6_RECVMSG_LOCK(sk, uaddr) ({ 0; })
430429 #define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; })
431430 #define BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type,major,minor,access) ({ 0; })
432−#define BPF_CGROUP_RUN_PROG_SYSCTL(head,table,write,buf,count,pos,nbuf) ({ 0; })
431+#define BPF_CGROUP_RUN_PROG_SYSCTL(head,table,write,buf,count,pos) ({ 0; })
433432 #define BPF_CGROUP_GETSOCKOPT_MAX_OPTLEN(optlen) ({ 0; })
434433 #define BPF_CGROUP_RUN_PROG_GETSOCKOPT(sock, level, optname, optval, \
435434 optlen, max_optlen, retval) ({ retval; })
include/linux/compaction.h+1−1
@@ -86,7 +86,7 @@ static inline unsigned long compact_gap(unsigned int order) · 85 unmodified lines
8686 #ifdef CONFIG_COMPACTION
8787 extern int sysctl_compact_memory;
8888 extern int sysctl_compaction_handler(struct ctl_table *table, int write,
89− void __user *buffer, size_t *length, loff_t *ppos);
89+ void *buffer, size_t *length, loff_t *ppos);
9090 extern int sysctl_extfrag_threshold;
9191 extern int sysctl_compact_unevictable_allowed;
9292
include/linux/coredump.h+4−0
@@ -22,4 +22,8 @@ extern void do_coredump(const kernel_siginfo_t *siginfo); · 21 unmodified lines
2222 static inline void do_coredump(const kernel_siginfo_t *siginfo) {}
2323 #endif
2424
25+extern int core_uses_pid;
26+extern char core_pattern[];
27+extern unsigned int core_pipe_limit;
28+
2529 #endif /* _LINUX_COREDUMP_H */
include/linux/file.h+2−0
@@ -94,4 +94,6 @@ extern void fd_install(unsigned int fd, struct file *file); · 93 unmodified lines
9494 extern void flush_delayed_fput(void);
9595 extern void __fput_sync(struct file *);
9696
97+extern unsigned int sysctl_nr_open_min, sysctl_nr_open_max;
98+
9799 #endif /* __LINUX_FILE_H */
include/linux/fs.h+3−3
@@ -3536,11 +3536,11 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf, · 3535 unmodified lines
35363536
35373537 struct ctl_table;
35383538 int proc_nr_files(struct ctl_table *table, int write,
3539− void __user *buffer, size_t *lenp, loff_t *ppos);
3539+ void *buffer, size_t *lenp, loff_t *ppos);
35403540 int proc_nr_dentry(struct ctl_table *table, int write,
3541− void __user *buffer, size_t *lenp, loff_t *ppos);
3541+ void *buffer, size_t *lenp, loff_t *ppos);
35423542 int proc_nr_inodes(struct ctl_table *table, int write,
3543− void __user *buffer, size_t *lenp, loff_t *ppos);
3543+ void *buffer, size_t *lenp, loff_t *ppos);
35443544 int __init get_filesystem_list(char *buf);
35453545
35463546 #define __FMODE_EXEC ((__force int) FMODE_EXEC)
include/linux/ftrace.h+1−2
@@ -1005,8 +1005,7 @@ extern void disable_trace_on_warning(void); · 1004 unmodified lines
10051005 extern int __disable_trace_on_warning;
10061006
10071007 int tracepoint_printk_sysctl(struct ctl_table *table, int write,
1008− void __user *buffer, size_t *lenp,
1009− loff_t *ppos);
1008+ void *buffer, size_t *lenp, loff_t *ppos);
10101009
10111010 #else /* CONFIG_TRACING */
10121011 static inline void disable_trace_on_warning(void) { }
include/linux/hugetlb.h+7−8
@@ -105,14 +105,13 @@ struct hugepage_subpool *hugepage_new_subpool(struct hstate *h, long max_hpages, · 104 unmodified lines
105105 void hugepage_put_subpool(struct hugepage_subpool *spool);
106106
107107 void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
108−int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
109−int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
110−int hugetlb_treat_movable_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
111−
112−#ifdef CONFIG_NUMA
113−int hugetlb_mempolicy_sysctl_handler(struct ctl_table *, int,
114− void __user *, size_t *, loff_t *);
115−#endif
108+int hugetlb_sysctl_handler(struct ctl_table *, int, void *, size_t *, loff_t *);
109+int hugetlb_overcommit_handler(struct ctl_table *, int, void *, size_t *,
110+ loff_t *);
111+int hugetlb_treat_movable_handler(struct ctl_table *, int, void *, size_t *,
112+ loff_t *);
113+int hugetlb_mempolicy_sysctl_handler(struct ctl_table *, int, void *, size_t *,
114+ loff_t *);
116115
117116 int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
118117 long follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *,
include/linux/kprobes.h+1−1
@@ -312,7 +312,7 @@ DEFINE_INSN_CACHE_OPS(optinsn); · 311 unmodified lines
312312 #ifdef CONFIG_SYSCTL
313313 extern int sysctl_kprobes_optimization;
314314 extern int proc_kprobes_optimization_handler(struct ctl_table *table,
315− int write, void __user *buffer,
315+ int write, void *buffer,
316316 size_t *length, loff_t *ppos);
317317 #endif
318318 extern void wait_for_kprobe_optimizer(void);
include/linux/latencytop.h+2−2
@@ -38,8 +38,8 @@ account_scheduler_latency(struct task_struct *task, int usecs, int inter) · 37 unmodified lines
3838
3939 void clear_tsk_latency_tracing(struct task_struct *p);
4040
41−extern int sysctl_latencytop(struct ctl_table *table, int write,
42− void __user *buffer, size_t *lenp, loff_t *ppos);
41+int sysctl_latencytop(struct ctl_table *table, int write, void *buffer,
42+ size_t *lenp, loff_t *ppos);
4343
4444 #else
4545
include/linux/mm.h+8−6
@@ -201,10 +201,10 @@ extern int sysctl_overcommit_memory; · 200 unmodified lines
201201 extern int sysctl_overcommit_ratio;
202202 extern unsigned long sysctl_overcommit_kbytes;
203203
204−extern int overcommit_ratio_handler(struct ctl_table *, int, void __user *,
205− size_t *, loff_t *);
206−extern int overcommit_kbytes_handler(struct ctl_table *, int, void __user *,
207− size_t *, loff_t *);
204+int overcommit_ratio_handler(struct ctl_table *, int, void *, size_t *,
205+ loff_t *);
206+int overcommit_kbytes_handler(struct ctl_table *, int, void *, size_t *,
207+ loff_t *);
208208
209209 #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
210210
@@ -2957,8 +2957,8 @@ extern bool process_shares_mm(struct task_struct *p, struct mm_struct *mm); · 2746 unmodified lines
29572957
29582958 #ifdef CONFIG_SYSCTL
29592959 extern int sysctl_drop_caches;
2960−int drop_caches_sysctl_handler(struct ctl_table *, int,
2961− void __user *, size_t *, loff_t *);
2960+int drop_caches_sysctl_handler(struct ctl_table *, int, void *, size_t *,
2961+ loff_t *);
29622962 #endif
29632963
29642964 void drop_slab(void);
@@ -3140,5 +3140,7 @@ unsigned long wp_shared_mapping_range(struct address_space *mapping, · 175 unmodified lines
31403140 pgoff_t first_index, pgoff_t nr);
31413141 #endif
31423142
3143+extern int sysctl_nr_trim_pages;
3144+
31433145 #endif /* __KERNEL__ */
31443146 #endif /* _LINUX_MM_H */
include/linux/mmzone.h+13−14
@@ -909,24 +909,23 @@ static inline int is_highmem(struct zone *zone) · 908 unmodified lines
909909
910910 /* These two functions are used to setup the per zone pages min values */
911911 struct ctl_table;
912−int min_free_kbytes_sysctl_handler(struct ctl_table *, int,
913− void __user *, size_t *, loff_t *);
914−int watermark_boost_factor_sysctl_handler(struct ctl_table *, int,
915− void __user *, size_t *, loff_t *);
916−int watermark_scale_factor_sysctl_handler(struct ctl_table *, int,
917− void __user *, size_t *, loff_t *);
912+
913+int min_free_kbytes_sysctl_handler(struct ctl_table *, int, void *, size_t *,
914+ loff_t *);
915+int watermark_scale_factor_sysctl_handler(struct ctl_table *, int, void *,
916+ size_t *, loff_t *);
918917 extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES];
919−int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int,
920− void __user *, size_t *, loff_t *);
918+int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, void *,
919+ size_t *, loff_t *);
921920 int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int,
922− void __user *, size_t *, loff_t *);
921+ void *, size_t *, loff_t *);
923922 int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int,
924− void __user *, size_t *, loff_t *);
923+ void *, size_t *, loff_t *);
925924 int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int,
926− void __user *, size_t *, loff_t *);
927−
928−extern int numa_zonelist_order_handler(struct ctl_table *, int,
929− void __user *, size_t *, loff_t *);
925+ void *, size_t *, loff_t *);
926+int numa_zonelist_order_handler(struct ctl_table *, int,
927+ void *, size_t *, loff_t *);
928+extern int percpu_pagelist_fraction;
930929 extern char numa_zonelist_order[];
931930 #define NUMA_ZONELIST_ORDER_LEN 16
932931
include/linux/nmi.h+5−10
@@ -202,16 +202,11 @@ static inline void watchdog_update_hrtimer_threshold(u64 period) { } · 201 unmodified lines
202202 #endif
203203
204204 struct ctl_table;
205−extern int proc_watchdog(struct ctl_table *, int ,
206− void __user *, size_t *, loff_t *);
207−extern int proc_nmi_watchdog(struct ctl_table *, int ,
208− void __user *, size_t *, loff_t *);
209−extern int proc_soft_watchdog(struct ctl_table *, int ,
210− void __user *, size_t *, loff_t *);
211−extern int proc_watchdog_thresh(struct ctl_table *, int ,
212− void __user *, size_t *, loff_t *);
213−extern int proc_watchdog_cpumask(struct ctl_table *, int,
214− void __user *, size_t *, loff_t *);
205+int proc_watchdog(struct ctl_table *, int, void *, size_t *, loff_t *);
206+int proc_nmi_watchdog(struct ctl_table *, int , void *, size_t *, loff_t *);
207+int proc_soft_watchdog(struct ctl_table *, int , void *, size_t *, loff_t *);
208+int proc_watchdog_thresh(struct ctl_table *, int , void *, size_t *, loff_t *);
209+int proc_watchdog_cpumask(struct ctl_table *, int, void *, size_t *, loff_t *);
215210
216211 #ifdef CONFIG_HAVE_ACPI_APEI_NMI
217212 #include <asm/nmi.h>
include/linux/perf_event.h+5−8
@@ -1280,15 +1280,12 @@ extern int sysctl_perf_cpu_time_max_percent; · 1279 unmodified lines
12801280
12811281 extern void perf_sample_event_took(u64 sample_len_ns);
12821282
1283−extern int perf_proc_update_handler(struct ctl_table *table, int write,
1284− void __user *buffer, size_t *lenp,
1285− loff_t *ppos);
1286−extern int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,
1287− void __user *buffer, size_t *lenp,
1288− loff_t *ppos);
1289−
1283+int perf_proc_update_handler(struct ctl_table *table, int write,
1284+ void *buffer, size_t *lenp, loff_t *ppos);
1285+int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,
1286+ void *buffer, size_t *lenp, loff_t *ppos);
12901287 int perf_event_max_stack_handler(struct ctl_table *table, int write,
1291− void __user *buffer, size_t *lenp, loff_t *ppos);
1288+ void *buffer, size_t *lenp, loff_t *ppos);
12921289
12931290 /* Access to perf_event_open(2) syscall. */
12941291 #define PERF_SECURITY_OPEN 0
include/linux/pid.h+3−0
@@ -108,6 +108,9 @@ extern void transfer_pid(struct task_struct *old, struct task_struct *new, · 107 unmodified lines
108108 struct pid_namespace;
109109 extern struct pid_namespace init_pid_ns;
110110
111+extern int pid_max;
112+extern int pid_max_min, pid_max_max;
113+
111114 /*
112115 * look up a PID in the hash table. Must be called with the tasklist_lock
113116 * or rcu_read_lock() held.
include/linux/printk.h+1−1
@@ -189,7 +189,7 @@ extern int printk_delay_msec; · 188 unmodified lines
189189 extern int dmesg_restrict;
190190
191191 extern int
192−devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, void __user *buf,
192+devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, void *buf,
193193 size_t *lenp, loff_t *ppos);
194194
195195 extern void wake_up_klogd(void);
include/linux/sched/sysctl.h+15−29
@@ -12,9 +12,8 @@ extern unsigned int sysctl_hung_task_panic; · 11 unmodified lines
1212 extern unsigned long sysctl_hung_task_timeout_secs;
1313 extern unsigned long sysctl_hung_task_check_interval_secs;
1414 extern int sysctl_hung_task_warnings;
15−extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
16− void __user *buffer,
17− size_t *lenp, loff_t *ppos);
15+int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
16+ void *buffer, size_t *lenp, loff_t *ppos);
1817 #else
1918 /* Avoid need for ifdefs elsewhere in the code */
2019 enum { sysctl_hung_task_timeout_secs = 0 };
@@ -43,8 +42,7 @@ extern __read_mostly unsigned int sysctl_sched_migration_cost; · 22 unmodified lines
4342 extern __read_mostly unsigned int sysctl_sched_nr_migrate;
4443
4544 int sched_proc_update_handler(struct ctl_table *table, int write,
46− void __user *buffer, size_t *length,
47− loff_t *ppos);
45+ void *buffer, size_t *length, loff_t *ppos);
4846 #endif
4947
5048 /*
@@ -72,33 +70,21 @@ extern unsigned int sysctl_sched_autogroup_enabled; · 21 unmodified lines
7270 extern int sysctl_sched_rr_timeslice;
7371 extern int sched_rr_timeslice;
7472
75−extern int sched_rr_handler(struct ctl_table *table, int write,
76− void __user *buffer, size_t *lenp,
77− loff_t *ppos);
78−
79−extern int sched_rt_handler(struct ctl_table *table, int write,
80− void __user *buffer, size_t *lenp,
81− loff_t *ppos);
82−
83−#ifdef CONFIG_UCLAMP_TASK
84−extern int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
85− void __user *buffer, size_t *lenp,
86− loff_t *ppos);
87−#endif
88−
89−extern int sysctl_numa_balancing(struct ctl_table *table, int write,
90− void __user *buffer, size_t *lenp,
91− loff_t *ppos);
92−
93−extern int sysctl_schedstats(struct ctl_table *table, int write,
94− void __user *buffer, size_t *lenp,
95− loff_t *ppos);
73+int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
74+ size_t *lenp, loff_t *ppos);
75+int sched_rt_handler(struct ctl_table *table, int write, void *buffer,
76+ size_t *lenp, loff_t *ppos);
77+int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
78+ void *buffer, size_t *lenp, loff_t *ppos);
79+int sysctl_numa_balancing(struct ctl_table *table, int write, void *buffer,
80+ size_t *lenp, loff_t *ppos);
81+int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
82+ size_t *lenp, loff_t *ppos);
9683
9784 #if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
9885 extern unsigned int sysctl_sched_energy_aware;
99−extern int sched_energy_aware_handler(struct ctl_table *table, int write,
100− void __user *buffer, size_t *lenp,
101− loff_t *ppos);
86+int sched_energy_aware_handler(struct ctl_table *table, int write,
87+ void *buffer, size_t *lenp, loff_t *ppos);
10288 #endif
10389
10490 #endif /* _LINUX_SCHED_SYSCTL_H */
include/linux/security.h+1−1
@@ -211,7 +211,7 @@ struct request_sock; · 210 unmodified lines
211211
212212 #ifdef CONFIG_MMU
213213 extern int mmap_min_addr_handler(struct ctl_table *table, int write,
214− void __user *buffer, size_t *lenp, loff_t *ppos);
214+ void *buffer, size_t *lenp, loff_t *ppos);
215215 #endif
216216
217217 /* security_inode_init_security callback function to write xattrs */
include/linux/sysctl.h+30−31
@@ -44,35 +44,26 @@ struct ctl_dir; · 43 unmodified lines
4444
4545 extern const int sysctl_vals[];
4646
47−typedef int proc_handler (struct ctl_table *ctl, int write,
48− void __user *buffer, size_t *lenp, loff_t *ppos);
49−
50−extern int proc_dostring(struct ctl_table *, int,
51− void __user *, size_t *, loff_t *);
52−extern int proc_dointvec(struct ctl_table *, int,
53− void __user *, size_t *, loff_t *);
54−extern int proc_douintvec(struct ctl_table *, int,
55− void __user *, size_t *, loff_t *);
56−extern int proc_dointvec_minmax(struct ctl_table *, int,
57− void __user *, size_t *, loff_t *);
58−extern int proc_douintvec_minmax(struct ctl_table *table, int write,
59− void __user *buffer, size_t *lenp,
60− loff_t *ppos);
61−extern int proc_dointvec_jiffies(struct ctl_table *, int,
62− void __user *, size_t *, loff_t *);
63−extern int proc_dointvec_userhz_jiffies(struct ctl_table *, int,
64− void __user *, size_t *, loff_t *);
65−extern int proc_dointvec_ms_jiffies(struct ctl_table *, int,
66− void __user *, size_t *, loff_t *);
67−extern int proc_doulongvec_minmax(struct ctl_table *, int,
68− void __user *, size_t *, loff_t *);
69−extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int,
70− void __user *, size_t *, loff_t *);
71−extern int proc_do_large_bitmap(struct ctl_table *, int,
72− void __user *, size_t *, loff_t *);
73−extern int proc_do_static_key(struct ctl_table *table, int write,
74− void __user *buffer, size_t *lenp,
75− loff_t *ppos);
47+typedef int proc_handler(struct ctl_table *ctl, int write, void *buffer,
48+ size_t *lenp, loff_t *ppos);
49+
50+int proc_dostring(struct ctl_table *, int, void *, size_t *, loff_t *);
51+int proc_dointvec(struct ctl_table *, int, void *, size_t *, loff_t *);
52+int proc_douintvec(struct ctl_table *, int, void *, size_t *, loff_t *);
53+int proc_dointvec_minmax(struct ctl_table *, int, void *, size_t *, loff_t *);
54+int proc_douintvec_minmax(struct ctl_table *table, int write, void *buffer,
55+ size_t *lenp, loff_t *ppos);
56+int proc_dointvec_jiffies(struct ctl_table *, int, void *, size_t *, loff_t *);
57+int proc_dointvec_userhz_jiffies(struct ctl_table *, int, void *, size_t *,
58+ loff_t *);
59+int proc_dointvec_ms_jiffies(struct ctl_table *, int, void *, size_t *,
60+ loff_t *);
61+int proc_doulongvec_minmax(struct ctl_table *, int, void *, size_t *, loff_t *);
62+int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int, void *,
63+ size_t *, loff_t *);
64+int proc_do_large_bitmap(struct ctl_table *, int, void *, size_t *, loff_t *);
65+int proc_do_static_key(struct ctl_table *table, int write, void *buffer,
66+ size_t *lenp, loff_t *ppos);
7667
7768 /*
7869 * Register a set of sysctl names by calling register_sysctl_table
@@ -207,7 +198,15 @@ void unregister_sysctl_table(struct ctl_table_header * table); · 128 unmodified lines
207198
208199 extern int sysctl_init(void);
209200
201+extern int pwrsw_enabled;
202+extern int unaligned_enabled;
203+extern int unaligned_dump_stack;
204+extern int no_unaligned_warning;
205+
210206 extern struct ctl_table sysctl_mount_point[];
207+extern struct ctl_table random_table[];
208+extern struct ctl_table firmware_config_table[];
209+extern struct ctl_table epoll_table[];
211210
212211 #else /* CONFIG_SYSCTL */
213212 static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
@@ -238,7 +237,7 @@ static inline void setup_sysctl_set(struct ctl_table_set *p, · 24 unmodified lines
238237
239238 #endif /* CONFIG_SYSCTL */
240239
241−int sysctl_max_threads(struct ctl_table *table, int write,
242− void __user *buffer, size_t *lenp, loff_t *ppos);
240+int sysctl_max_threads(struct ctl_table *table, int write, void *buffer,
241+ size_t *lenp, loff_t *ppos);
243242
244243 #endif /* _LINUX_SYSCTL_H */
include/linux/timer.h+1−2
@@ -201,8 +201,7 @@ struct ctl_table; · 200 unmodified lines
201201
202202 extern unsigned int sysctl_timer_migration;
203203 int timer_migration_handler(struct ctl_table *table, int write,
204− void __user *buffer, size_t *lenp,
205− loff_t *ppos);
204+ void *buffer, size_t *lenp, loff_t *ppos);
206205 #endif
207206
208207 unsigned long __round_jiffies(unsigned long j, int cpu);
include/linux/vmstat.h+4−4
@@ -16,8 +16,8 @@ extern int sysctl_stat_interval; · 15 unmodified lines
1616 #define DISABLE_NUMA_STAT 0
1717 extern int sysctl_vm_numa_stat;
1818 DECLARE_STATIC_KEY_TRUE(vm_numa_stat_key);
19−extern int sysctl_vm_numa_stat_handler(struct ctl_table *table,
20− int write, void __user *buffer, size_t *length, loff_t *ppos);
19+int sysctl_vm_numa_stat_handler(struct ctl_table *table, int write,
20+ void *buffer, size_t *length, loff_t *ppos);
2121 #endif
2222
2323 struct reclaim_stat {
@@ -274,8 +274,8 @@ void cpu_vm_stats_fold(int cpu); · 250 unmodified lines
274274 void refresh_zone_stat_thresholds(void);
275275
276276 struct ctl_table;
277−int vmstat_refresh(struct ctl_table *, int write,
278− void __user *buffer, size_t *lenp, loff_t *ppos);
277+int vmstat_refresh(struct ctl_table *, int write, void *buffer, size_t *lenp,
278+ loff_t *ppos);
279279
280280 void drain_zonestat(struct zone *zone, struct per_cpu_pageset *);
281281
include/linux/writeback.h+11−17
@@ -362,24 +362,18 @@ extern int vm_highmem_is_dirtyable; · 361 unmodified lines
362362 extern int block_dump;
363363 extern int laptop_mode;
364364
365−extern int dirty_background_ratio_handler(struct ctl_table *table, int write,
366− void __user *buffer, size_t *lenp,
367− loff_t *ppos);
368−extern int dirty_background_bytes_handler(struct ctl_table *table, int write,
369− void __user *buffer, size_t *lenp,
370− loff_t *ppos);
371−extern int dirty_ratio_handler(struct ctl_table *table, int write,
372− void __user *buffer, size_t *lenp,
373− loff_t *ppos);
374−extern int dirty_bytes_handler(struct ctl_table *table, int write,
375− void __user *buffer, size_t *lenp,
376− loff_t *ppos);
365+int dirty_background_ratio_handler(struct ctl_table *table, int write,
366+ void *buffer, size_t *lenp, loff_t *ppos);
367+int dirty_background_bytes_handler(struct ctl_table *table, int write,
368+ void *buffer, size_t *lenp, loff_t *ppos);
369+int dirty_ratio_handler(struct ctl_table *table, int write,
370+ void *buffer, size_t *lenp, loff_t *ppos);
371+int dirty_bytes_handler(struct ctl_table *table, int write,
372+ void *buffer, size_t *lenp, loff_t *ppos);
377373 int dirtytime_interval_handler(struct ctl_table *table, int write,
378− void __user *buffer, size_t *lenp, loff_t *ppos);
379−
380−struct ctl_table;
381−int dirty_writeback_centisecs_handler(struct ctl_table *, int,
382− void __user *, size_t *, loff_t *);
374+ void *buffer, size_t *lenp, loff_t *ppos);
375+int dirty_writeback_centisecs_handler(struct ctl_table *table, int write,
376+ void *buffer, size_t *lenp, loff_t *ppos);
383377
384378 void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty);
385379 unsigned long wb_calc_thresh(struct bdi_writeback *wb, unsigned long thresh);
ipc/ipc_sysctl.c+5−5
@@ -24,7 +24,7 @@ static void *get_ipc(struct ctl_table *table) · 23 unmodified lines
2424
2525 #ifdef CONFIG_PROC_SYSCTL
2626 static int proc_ipc_dointvec(struct ctl_table *table, int write,
27− void __user *buffer, size_t *lenp, loff_t *ppos)
27+ void *buffer, size_t *lenp, loff_t *ppos)
2828 {
2929 struct ctl_table ipc_table;
3030
@@ -35,7 +35,7 @@ static int proc_ipc_dointvec(struct ctl_table *table, int write, · 4 unmodified lines
3535 }
3636
3737 static int proc_ipc_dointvec_minmax(struct ctl_table *table, int write,
38− void __user *buffer, size_t *lenp, loff_t *ppos)
38+ void *buffer, size_t *lenp, loff_t *ppos)
3939 {
4040 struct ctl_table ipc_table;
4141
@@ -46,7 +46,7 @@ static int proc_ipc_dointvec_minmax(struct ctl_table *table, int write, · 4 unmodified lines
4646 }
4747
4848 static int proc_ipc_dointvec_minmax_orphans(struct ctl_table *table, int write,
49− void __user *buffer, size_t *lenp, loff_t *ppos)
49+ void *buffer, size_t *lenp, loff_t *ppos)
5050 {
5151 struct ipc_namespace *ns = current->nsproxy->ipc_ns;
5252 int err = proc_ipc_dointvec_minmax(table, write, buffer, lenp, ppos);
@@ -59,7 +59,7 @@ static int proc_ipc_dointvec_minmax_orphans(struct ctl_table *table, int write, · 6 unmodified lines
5959 }
6060
6161 static int proc_ipc_doulongvec_minmax(struct ctl_table *table, int write,
62− void __user *buffer, size_t *lenp, loff_t *ppos)
62+ void *buffer, size_t *lenp, loff_t *ppos)
6363 {
6464 struct ctl_table ipc_table;
6565 memcpy(&ipc_table, table, sizeof(ipc_table));
@@ -70,7 +70,7 @@ static int proc_ipc_doulongvec_minmax(struct ctl_table *table, int write, · 4 unmodified lines
7070 }
7171
7272 static int proc_ipc_auto_msgmni(struct ctl_table *table, int write,
73− void __user *buffer, size_t *lenp, loff_t *ppos)
73+ void *buffer, size_t *lenp, loff_t *ppos)
7474 {
7575 struct ctl_table ipc_table;
7676 int dummy = 0;
ipc/mq_sysctl.c+2−2
@@ -19,7 +19,7 @@ static void *get_mq(struct ctl_table *table) · 18 unmodified lines
1919 }
2020
2121 static int proc_mq_dointvec(struct ctl_table *table, int write,
22− void __user *buffer, size_t *lenp, loff_t *ppos)
22+ void *buffer, size_t *lenp, loff_t *ppos)
2323 {
2424 struct ctl_table mq_table;
2525 memcpy(&mq_table, table, sizeof(mq_table));
@@ -29,7 +29,7 @@ static int proc_mq_dointvec(struct ctl_table *table, int write, · 3 unmodified lines
2929 }
3030
3131 static int proc_mq_dointvec_minmax(struct ctl_table *table, int write,
32− void __user *buffer, size_t *lenp, loff_t *ppos)
32+ void *buffer, size_t *lenp, loff_t *ppos)
3333 {
3434 struct ctl_table mq_table;
3535 memcpy(&mq_table, table, sizeof(mq_table));
kernel/bpf/cgroup.c+12−23
@@ -1122,16 +1122,13 @@ const struct bpf_verifier_ops cg_dev_verifier_ops = { · 1121 unmodified lines
11221122 * @head: sysctl table header
11231123 * @table: sysctl table
11241124 * @write: sysctl is being read (= 0) or written (= 1)
1125− * @buf: pointer to buffer passed by user space
1125+ * @buf: pointer to buffer (in and out)
11261126 * @pcount: value-result argument: value is size of buffer pointed to by @buf,
11271127 * result is size of @new_buf if program set new value, initial value
11281128 * otherwise
11291129 * @ppos: value-result argument: value is position at which read from or write
11301130 * to sysctl is happening, result is new position if program overrode it,
11311131 * initial value otherwise
1132− * @new_buf: pointer to pointer to new buffer that will be allocated if program
1133− * overrides new value provided by user space on sysctl write
1134− * NOTE: it's caller responsibility to free *new_buf if it was set
11351132 * @type: type of program to be executed
11361133 *
11371134 * Program is run when sysctl is being accessed, either read or written, and
@@ -1142,8 +1139,7 @@ const struct bpf_verifier_ops cg_dev_verifier_ops = { · 4 unmodified lines
11421139 */
11431140 int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head,
11441141 struct ctl_table *table, int write,
1145− void __user *buf, size_t *pcount,
1146− loff_t *ppos, void **new_buf,
1142+ void **buf, size_t *pcount, loff_t *ppos,
11471143 enum bpf_attach_type type)
11481144 {
11491145 struct bpf_sysctl_kern ctx = {
@@ -1158,36 +1154,28 @@ int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head, · 8 unmodified lines
11581154 .new_updated = 0,
11591155 };
11601156 struct cgroup *cgrp;
1157+ loff_t pos = 0;
11611158 int ret;
11621159
11631160 ctx.cur_val = kmalloc_track_caller(ctx.cur_len, GFP_KERNEL);
1164− if (ctx.cur_val) {
1165− mm_segment_t old_fs;
1166− loff_t pos = 0;
1167−
1168− old_fs = get_fs();
1169− set_fs(KERNEL_DS);
1170− if (table->proc_handler(table, 0, (void __user *)ctx.cur_val,
1171− &ctx.cur_len, &pos)) {
1172− /* Let BPF program decide how to proceed. */
1173− ctx.cur_len = 0;
1174− }
1175− set_fs(old_fs);
1176− } else {
1161+ if (!ctx.cur_val ||
1162+ table->proc_handler(table, 0, ctx.cur_val, &ctx.cur_len, &pos)) {
11771163 /* Let BPF program decide how to proceed. */
11781164 ctx.cur_len = 0;
11791165 }
11801166
1181− if (write && buf && *pcount) {
1167+ if (write && *buf && *pcount) {
11821168 /* BPF program should be able to override new value with a
11831169 * buffer bigger than provided by user.
11841170 */
11851171 ctx.new_val = kmalloc_track_caller(PAGE_SIZE, GFP_KERNEL);
11861172 ctx.new_len = min_t(size_t, PAGE_SIZE, *pcount);
1187− if (!ctx.new_val ||
1188− copy_from_user(ctx.new_val, buf, ctx.new_len))
1173+ if (ctx.new_val) {
1174+ memcpy(ctx.new_val, *buf, ctx.new_len);
1175+ } else {
11891176 /* Let BPF program decide how to proceed. */
11901177 ctx.new_len = 0;
1178+ }
11911179 }
11921180
11931181 rcu_read_lock();
@@ -1198,7 +1186,8 @@ int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head, · 4 unmodified lines
11981186 kfree(ctx.cur_val);
11991187
12001188 if (ret == 1 && ctx.new_updated) {
1201− *new_buf = ctx.new_val;
1189+ kfree(*buf);
1190+ *buf = ctx.new_val;
12021191 *pcount = ctx.new_len;
12031192 } else {
12041193 kfree(ctx.new_val);
kernel/events/callchain.c+1−1
@@ -236,7 +236,7 @@ exit_put: · 235 unmodified lines
236236 * sysctl_perf_event_max_contexts_per_stack.
237237 */
238238 int perf_event_max_stack_handler(struct ctl_table *table, int write,
239− void __user *buffer, size_t *lenp, loff_t *ppos)
239+ void *buffer, size_t *lenp, loff_t *ppos)
240240 {
241241 int *value = table->data;
242242 int new_value = *value, ret;
kernel/events/core.c+2−4
@@ -437,8 +437,7 @@ static void update_perf_cpu_limits(void) · 436 unmodified lines
437437 static bool perf_rotate_context(struct perf_cpu_context *cpuctx);
438438
439439 int perf_proc_update_handler(struct ctl_table *table, int write,
440− void __user *buffer, size_t *lenp,
441− loff_t *ppos)
440+ void *buffer, size_t *lenp, loff_t *ppos)
442441 {
443442 int ret;
444443 int perf_cpu = sysctl_perf_cpu_time_max_percent;
@@ -462,8 +461,7 @@ int perf_proc_update_handler(struct ctl_table *table, int write, · 17 unmodified lines
462461 int sysctl_perf_cpu_time_max_percent __read_mostly = DEFAULT_CPU_TIME_MAX_PERCENT;
463462
464463 int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,
465− void __user *buffer, size_t *lenp,
466− loff_t *ppos)
464+ void *buffer, size_t *lenp, loff_t *ppos)
467465 {
468466 int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
469467
kernel/kprobes.c+1−1
@@ -892,7 +892,7 @@ static void unoptimize_all_kprobes(void) · 891 unmodified lines
892892 static DEFINE_MUTEX(kprobe_sysctl_mutex);
893893 int sysctl_kprobes_optimization;
894894 int proc_kprobes_optimization_handler(struct ctl_table *table, int write,
895− void __user *buffer, size_t *length,
895+ void *buffer, size_t *length,
896896 loff_t *ppos)
897897 {
898898 int ret;
kernel/latencytop.c+2−2
@@ -269,8 +269,8 @@ static int __init init_lstats_procfs(void) · 268 unmodified lines
269269 return 0;
270270 }
271271
272−int sysctl_latencytop(struct ctl_table *table, int write,
273− void __user *buffer, size_t *lenp, loff_t *ppos)
272+int sysctl_latencytop(struct ctl_table *table, int write, void *buffer,
273+ size_t *lenp, loff_t *ppos)
274274 {
275275 int err;
276276
kernel/pid_namespace.c+1−1
@@ -263,7 +263,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns) · 262 unmodified lines
263263
264264 #ifdef CONFIG_CHECKPOINT_RESTORE
265265 static int pid_ns_ctl_handler(struct ctl_table *table, int write,
266− void __user *buffer, size_t *lenp, loff_t *ppos)
266+ void *buffer, size_t *lenp, loff_t *ppos)
267267 {
268268 struct pid_namespace *pid_ns = task_active_pid_ns(current);
269269 struct ctl_table tmp = *table;
kernel/printk/printk.c+1−1
@@ -173,7 +173,7 @@ __setup("printk.devkmsg=", control_devkmsg); · 172 unmodified lines
173173 char devkmsg_log_str[DEVKMSG_STR_MAX_SIZE] = "ratelimit";
174174
175175 int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write,
176− void __user *buffer, size_t *lenp, loff_t *ppos)
176+ void *buffer, size_t *lenp, loff_t *ppos)
177177 {
178178 char old_str[DEVKMSG_STR_MAX_SIZE];
179179 unsigned int old;
kernel/sched/core.c+4−5
@@ -1110,8 +1110,7 @@ static void uclamp_update_root_tg(void) { } · 1109 unmodified lines
11101110 #endif
11111111
11121112 int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
1113− void __user *buffer, size_t *lenp,
1114− loff_t *ppos)
1113+ void *buffer, size_t *lenp, loff_t *ppos)
11151114 {
11161115 bool update_root_tg = false;
11171116 int old_min, old_max;
@@ -2718,7 +2717,7 @@ void set_numabalancing_state(bool enabled) · 1600 unmodified lines
27182717
27192718 #ifdef CONFIG_PROC_SYSCTL
27202719 int sysctl_numa_balancing(struct ctl_table *table, int write,
2721− void __user *buffer, size_t *lenp, loff_t *ppos)
2720+ void *buffer, size_t *lenp, loff_t *ppos)
27222721 {
27232722 struct ctl_table t;
27242723 int err;
@@ -2792,8 +2791,8 @@ static void __init init_schedstats(void) · 67 unmodified lines
27922791 }
27932792
27942793 #ifdef CONFIG_PROC_SYSCTL
2795−int sysctl_schedstats(struct ctl_table *table, int write,
2796− void __user *buffer, size_t *lenp, loff_t *ppos)
2794+int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
2795+ size_t *lenp, loff_t *ppos)
27972796 {
27982797 struct ctl_table t;
27992798 int err;
kernel/sched/fair.c+1−2
@@ -645,8 +645,7 @@ struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq) · 644 unmodified lines
645645 */
646646
647647 int sched_proc_update_handler(struct ctl_table *table, int write,
648− void __user *buffer, size_t *lenp,
649− loff_t *ppos)
648+ void *buffer, size_t *lenp, loff_t *ppos)
650649 {
651650 int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
652651 unsigned int factor = get_update_sysctl_factor();
kernel/sched/rt.c+4−6
@@ -2714,9 +2714,8 @@ static void sched_rt_do_global(void) · 2713 unmodified lines
27142714 def_rt_bandwidth.rt_period = ns_to_ktime(global_rt_period());
27152715 }
27162716
2717−int sched_rt_handler(struct ctl_table *table, int write,
2718− void __user *buffer, size_t *lenp,
2719− loff_t *ppos)
2717+int sched_rt_handler(struct ctl_table *table, int write, void *buffer,
2718+ size_t *lenp, loff_t *ppos)
27202719 {
27212720 int old_period, old_runtime;
27222721 static DEFINE_MUTEX(mutex);
@@ -2754,9 +2753,8 @@ undo: · 31 unmodified lines
27542753 return ret;
27552754 }
27562755
2757−int sched_rr_handler(struct ctl_table *table, int write,
2758− void __user *buffer, size_t *lenp,
2759− loff_t *ppos)
2756+int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
2757+ size_t *lenp, loff_t *ppos)
27602758 {
27612759 int ret;
27622760 static DEFINE_MUTEX(mutex);
kernel/sched/topology.c+1−1
@@ -209,7 +209,7 @@ bool sched_energy_update; · 208 unmodified lines
209209
210210 #ifdef CONFIG_PROC_SYSCTL
211211 int sched_energy_aware_handler(struct ctl_table *table, int write,
212− void __user *buffer, size_t *lenp, loff_t *ppos)
212+ void *buffer, size_t *lenp, loff_t *ppos)
213213 {
214214 int ret, state;
215215
kernel/seccomp.c+1−1
@@ -1776,7 +1776,7 @@ static void audit_actions_logged(u32 actions_logged, u32 old_actions_logged, · 1775 unmodified lines
17761776 }
17771777
17781778 static int seccomp_actions_logged_handler(struct ctl_table *ro_table, int write,
1779− void __user *buffer, size_t *lenp,
1779+ void *buffer, size_t *lenp,
17801780 loff_t *ppos)
17811781 {
17821782 int ret;
kernel/sysctl.c+1853−1986
@@ -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,1685 +199,19 @@ 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− },
536−#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−#if defined(CONFIG_X86)
998− {
999− .procname = "panic_on_unrecovered_nmi",
1000− .data = &panic_on_unrecovered_nmi,
1001− .maxlen = sizeof(int),
1002− .mode = 0644,
1003− .proc_handler = proc_dointvec,
1004− },
1005− {
1006− .procname = "panic_on_io_nmi",
1007− .data = &panic_on_io_nmi,
1008− .maxlen = sizeof(int),
1009− .mode = 0644,
1010− .proc_handler = proc_dointvec,
1011− },
1012−#ifdef CONFIG_DEBUG_STACKOVERFLOW
1013− {
1014− .procname = "panic_on_stackoverflow",
1015− .data = &sysctl_panic_on_stackoverflow,
1016− .maxlen = sizeof(int),
1017− .mode = 0644,
1018− .proc_handler = proc_dointvec,
1019− },
1020−#endif
1021− {
1022− .procname = "bootloader_type",
1023− .data = &bootloader_type,
1024− .maxlen = sizeof (int),
1025− .mode = 0444,
1026− .proc_handler = proc_dointvec,
1027− },
1028− {
1029− .procname = "bootloader_version",
1030− .data = &bootloader_version,
1031− .maxlen = sizeof (int),
1032− .mode = 0444,
1033− .proc_handler = proc_dointvec,
1034− },
1035− {
1036− .procname = "io_delay_type",
1037− .data = &io_delay_type,
1038− .maxlen = sizeof(int),
1039− .mode = 0644,
1040− .proc_handler = proc_dointvec,
1041− },
1042−#endif
1043−#if defined(CONFIG_MMU)
1044− {
1045− .procname = "randomize_va_space",
1046− .data = &randomize_va_space,
1047− .maxlen = sizeof(int),
1048− .mode = 0644,
1049− .proc_handler = proc_dointvec,
1050− },
1051−#endif
1052−#if defined(CONFIG_S390) && defined(CONFIG_SMP)
1053− {
1054− .procname = "spin_retry",
1055− .data = &spin_retry,
1056− .maxlen = sizeof (int),
1057− .mode = 0644,
1058− .proc_handler = proc_dointvec,
1059− },
1060−#endif
1061−#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
1062− {
1063− .procname = "acpi_video_flags",
1064− .data = &acpi_realmode_flags,
1065− .maxlen = sizeof (unsigned long),
1066− .mode = 0644,
1067− .proc_handler = proc_doulongvec_minmax,
1068− },
1069−#endif
1070−#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
1071− {
1072− .procname = "ignore-unaligned-usertrap",
1073− .data = &no_unaligned_warning,
1074− .maxlen = sizeof (int),
1075− .mode = 0644,
1076− .proc_handler = proc_dointvec,
1077− },
1078−#endif
1079−#ifdef CONFIG_IA64
1080− {
1081− .procname = "unaligned-dump-stack",
1082− .data = &unaligned_dump_stack,
1083− .maxlen = sizeof (int),
1084− .mode = 0644,
1085− .proc_handler = proc_dointvec,
1086− },
1087−#endif
1088−#ifdef CONFIG_DETECT_HUNG_TASK
1089− {
1090− .procname = "hung_task_panic",
1091− .data = &sysctl_hung_task_panic,
1092− .maxlen = sizeof(int),
1093− .mode = 0644,
1094− .proc_handler = proc_dointvec_minmax,
1095− .extra1 = SYSCTL_ZERO,
1096− .extra2 = SYSCTL_ONE,
1097− },
1098− {
1099− .procname = "hung_task_check_count",
1100− .data = &sysctl_hung_task_check_count,
1101− .maxlen = sizeof(int),
1102− .mode = 0644,
1103− .proc_handler = proc_dointvec_minmax,
1104− .extra1 = SYSCTL_ZERO,
1105− },
1106− {
1107− .procname = "hung_task_timeout_secs",
1108− .data = &sysctl_hung_task_timeout_secs,
1109− .maxlen = sizeof(unsigned long),
1110− .mode = 0644,
1111− .proc_handler = proc_dohung_task_timeout_secs,
1112− .extra2 = &hung_task_timeout_max,
1113− },
1114− {
1115− .procname = "hung_task_check_interval_secs",
1116− .data = &sysctl_hung_task_check_interval_secs,
1117− .maxlen = sizeof(unsigned long),
1118− .mode = 0644,
1119− .proc_handler = proc_dohung_task_timeout_secs,
1120− .extra2 = &hung_task_timeout_max,
1121− },
1122− {
1123− .procname = "hung_task_warnings",
1124− .data = &sysctl_hung_task_warnings,
1125− .maxlen = sizeof(int),
1126− .mode = 0644,
1127− .proc_handler = proc_dointvec_minmax,
1128− .extra1 = &neg_one,
1129− },
1130−#endif
1131−#ifdef CONFIG_RT_MUTEXES
1132− {
1133− .procname = "max_lock_depth",
1134− .data = &max_lock_depth,
1135− .maxlen = sizeof(int),
1136− .mode = 0644,
1137− .proc_handler = proc_dointvec,
1138− },
1139−#endif
1140− {
1141− .procname = "poweroff_cmd",
1142− .data = &poweroff_cmd,
1143− .maxlen = POWEROFF_CMD_PATH_LEN,
1144− .mode = 0644,
1145− .proc_handler = proc_dostring,
1146− },
1147−#ifdef CONFIG_KEYS
1148− {
1149− .procname = "keys",
1150− .mode = 0555,
1151− .child = key_sysctls,
1152− },
1153−#endif
1154−#ifdef CONFIG_PERF_EVENTS
1155− /*
1156− * User-space scripts rely on the existence of this file
1157− * as a feature check for perf_events being enabled.
1158− *
1159− * So it's an ABI, do not remove!
1160− */
1161− {
1162− .procname = "perf_event_paranoid",
1163− .data = &sysctl_perf_event_paranoid,
1164− .maxlen = sizeof(sysctl_perf_event_paranoid),
1165− .mode = 0644,
1166− .proc_handler = proc_dointvec,
1167− },
1168− {
1169− .procname = "perf_event_mlock_kb",
1170− .data = &sysctl_perf_event_mlock,
1171− .maxlen = sizeof(sysctl_perf_event_mlock),
1172− .mode = 0644,
1173− .proc_handler = proc_dointvec,
1174− },
1175− {
1176− .procname = "perf_event_max_sample_rate",
1177− .data = &sysctl_perf_event_sample_rate,
1178− .maxlen = sizeof(sysctl_perf_event_sample_rate),
1179− .mode = 0644,
1180− .proc_handler = perf_proc_update_handler,
1181− .extra1 = SYSCTL_ONE,
1182− },
1183− {
1184− .procname = "perf_cpu_time_max_percent",
1185− .data = &sysctl_perf_cpu_time_max_percent,
1186− .maxlen = sizeof(sysctl_perf_cpu_time_max_percent),
1187− .mode = 0644,
1188− .proc_handler = perf_cpu_time_max_percent_handler,
1189− .extra1 = SYSCTL_ZERO,
1190− .extra2 = &one_hundred,
1191− },
1192− {
1193− .procname = "perf_event_max_stack",
1194− .data = &sysctl_perf_event_max_stack,
1195− .maxlen = sizeof(sysctl_perf_event_max_stack),
1196− .mode = 0644,
1197− .proc_handler = perf_event_max_stack_handler,
1198− .extra1 = SYSCTL_ZERO,
1199− .extra2 = &six_hundred_forty_kb,
1200− },
1201− {
1202− .procname = "perf_event_max_contexts_per_stack",
1203− .data = &sysctl_perf_event_max_contexts_per_stack,
1204− .maxlen = sizeof(sysctl_perf_event_max_contexts_per_stack),
1205− .mode = 0644,
1206− .proc_handler = perf_event_max_stack_handler,
1207− .extra1 = SYSCTL_ZERO,
1208− .extra2 = &one_thousand,
1209− },
1210−#endif
1211− {
1212− .procname = "panic_on_warn",
1213− .data = &panic_on_warn,
1214− .maxlen = sizeof(int),
1215− .mode = 0644,
1216− .proc_handler = proc_dointvec_minmax,
1217− .extra1 = SYSCTL_ZERO,
1218− .extra2 = SYSCTL_ONE,
1219− },
1220−#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
1221− {
1222− .procname = "timer_migration",
1223− .data = &sysctl_timer_migration,
1224− .maxlen = sizeof(unsigned int),
1225− .mode = 0644,
1226− .proc_handler = timer_migration_handler,
1227− .extra1 = SYSCTL_ZERO,
1228− .extra2 = SYSCTL_ONE,
1229− },
1230−#endif
1231−#ifdef CONFIG_BPF_SYSCALL
1232− {
1233− .procname = "unprivileged_bpf_disabled",
1234− .data = &sysctl_unprivileged_bpf_disabled,
1235− .maxlen = sizeof(sysctl_unprivileged_bpf_disabled),
1236− .mode = 0644,
1237− /* only handle a transition from default "0" to "1" */
1238− .proc_handler = proc_dointvec_minmax,
1239− .extra1 = SYSCTL_ONE,
1240− .extra2 = SYSCTL_ONE,
1241− },
1242− {
1243− .procname = "bpf_stats_enabled",
1244− .data = &bpf_stats_enabled_key.key,
1245− .maxlen = sizeof(bpf_stats_enabled_key),
1246− .mode = 0644,
1247− .proc_handler = proc_do_static_key,
1248− },
1249−#endif
1250−#if defined(CONFIG_TREE_RCU)
1251− {
1252− .procname = "panic_on_rcu_stall",
1253− .data = &sysctl_panic_on_rcu_stall,
1254− .maxlen = sizeof(sysctl_panic_on_rcu_stall),
1255− .mode = 0644,
1256− .proc_handler = proc_dointvec_minmax,
1257− .extra1 = SYSCTL_ZERO,
1258− .extra2 = SYSCTL_ONE,
1259− },
1260−#endif
1261−#ifdef CONFIG_STACKLEAK_RUNTIME_DISABLE
1262− {
1263− .procname = "stack_erasing",
1264− .data = NULL,
1265− .maxlen = sizeof(int),
1266− .mode = 0600,
1267− .proc_handler = stack_erasing_sysctl,
1268− .extra1 = SYSCTL_ZERO,
1269− .extra2 = SYSCTL_ONE,
1270− },
1271−#endif
1272− { }
1273−};
1274−
1275−static struct ctl_table vm_table[] = {
1276− {
1277− .procname = "overcommit_memory",
1278− .data = &sysctl_overcommit_memory,
1279− .maxlen = sizeof(sysctl_overcommit_memory),
1280− .mode = 0644,
1281− .proc_handler = proc_dointvec_minmax,
1282− .extra1 = SYSCTL_ZERO,
1283− .extra2 = &two,
1284− },
1285− {
1286− .procname = "panic_on_oom",
1287− .data = &sysctl_panic_on_oom,
1288− .maxlen = sizeof(sysctl_panic_on_oom),
1289− .mode = 0644,
1290− .proc_handler = proc_dointvec_minmax,
1291− .extra1 = SYSCTL_ZERO,
1292− .extra2 = &two,
1293− },
1294− {
1295− .procname = "oom_kill_allocating_task",
1296− .data = &sysctl_oom_kill_allocating_task,
1297− .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1298− .mode = 0644,
1299− .proc_handler = proc_dointvec,
1300− },
1301− {
1302− .procname = "oom_dump_tasks",
1303− .data = &sysctl_oom_dump_tasks,
1304− .maxlen = sizeof(sysctl_oom_dump_tasks),
1305− .mode = 0644,
1306− .proc_handler = proc_dointvec,
1307− },
1308− {
1309− .procname = "overcommit_ratio",
1310− .data = &sysctl_overcommit_ratio,
1311− .maxlen = sizeof(sysctl_overcommit_ratio),
1312− .mode = 0644,
1313− .proc_handler = overcommit_ratio_handler,
1314− },
1315− {
1316− .procname = "overcommit_kbytes",
1317− .data = &sysctl_overcommit_kbytes,
1318− .maxlen = sizeof(sysctl_overcommit_kbytes),
1319− .mode = 0644,
1320− .proc_handler = overcommit_kbytes_handler,
1321− },
1322− {
1323− .procname = "page-cluster",
1324− .data = &page_cluster,
1325− .maxlen = sizeof(int),
1326− .mode = 0644,
1327− .proc_handler = proc_dointvec_minmax,
1328− .extra1 = SYSCTL_ZERO,
1329− },
1330− {
1331− .procname = "dirty_background_ratio",
1332− .data = &dirty_background_ratio,
1333− .maxlen = sizeof(dirty_background_ratio),
1334− .mode = 0644,
1335− .proc_handler = dirty_background_ratio_handler,
1336− .extra1 = SYSCTL_ZERO,
1337− .extra2 = &one_hundred,
1338− },
1339− {
1340− .procname = "dirty_background_bytes",
1341− .data = &dirty_background_bytes,
1342− .maxlen = sizeof(dirty_background_bytes),
1343− .mode = 0644,
1344− .proc_handler = dirty_background_bytes_handler,
1345− .extra1 = &one_ul,
1346− },
1347− {
1348− .procname = "dirty_ratio",
1349− .data = &vm_dirty_ratio,
1350− .maxlen = sizeof(vm_dirty_ratio),
1351− .mode = 0644,
1352− .proc_handler = dirty_ratio_handler,
1353− .extra1 = SYSCTL_ZERO,
1354− .extra2 = &one_hundred,
1355− },
1356− {
1357− .procname = "dirty_bytes",
1358− .data = &vm_dirty_bytes,
1359− .maxlen = sizeof(vm_dirty_bytes),
1360− .mode = 0644,
1361− .proc_handler = dirty_bytes_handler,
1362− .extra1 = &dirty_bytes_min,
1363− },
1364− {
1365− .procname = "dirty_writeback_centisecs",
1366− .data = &dirty_writeback_interval,
1367− .maxlen = sizeof(dirty_writeback_interval),
1368− .mode = 0644,
1369− .proc_handler = dirty_writeback_centisecs_handler,
1370− },
1371− {
1372− .procname = "dirty_expire_centisecs",
1373− .data = &dirty_expire_interval,
1374− .maxlen = sizeof(dirty_expire_interval),
1375− .mode = 0644,
1376− .proc_handler = proc_dointvec_minmax,
1377− .extra1 = SYSCTL_ZERO,
1378− },
1379− {
1380− .procname = "dirtytime_expire_seconds",
1381− .data = &dirtytime_expire_interval,
1382− .maxlen = sizeof(dirtytime_expire_interval),
1383− .mode = 0644,
1384− .proc_handler = dirtytime_interval_handler,
1385− .extra1 = SYSCTL_ZERO,
1386− },
1387− {
1388− .procname = "swappiness",
1389− .data = &vm_swappiness,
1390− .maxlen = sizeof(vm_swappiness),
1391− .mode = 0644,
1392− .proc_handler = proc_dointvec_minmax,
1393− .extra1 = SYSCTL_ZERO,
1394− .extra2 = &one_hundred,
1395− },
1396−#ifdef CONFIG_HUGETLB_PAGE
1397− {
1398− .procname = "nr_hugepages",
1399− .data = NULL,
1400− .maxlen = sizeof(unsigned long),
1401− .mode = 0644,
1402− .proc_handler = hugetlb_sysctl_handler,
1403− },
1404−#ifdef CONFIG_NUMA
1405− {
1406− .procname = "nr_hugepages_mempolicy",
1407− .data = NULL,
1408− .maxlen = sizeof(unsigned long),
1409− .mode = 0644,
1410− .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1411− },
1412− {
1413− .procname = "numa_stat",
1414− .data = &sysctl_vm_numa_stat,
1415− .maxlen = sizeof(int),
1416− .mode = 0644,
1417− .proc_handler = sysctl_vm_numa_stat_handler,
1418− .extra1 = SYSCTL_ZERO,
1419− .extra2 = SYSCTL_ONE,
1420− },
1421−#endif
1422− {
1423− .procname = "hugetlb_shm_group",
1424− .data = &sysctl_hugetlb_shm_group,
1425− .maxlen = sizeof(gid_t),
1426− .mode = 0644,
1427− .proc_handler = proc_dointvec,
1428− },
1429− {
1430− .procname = "nr_overcommit_hugepages",
1431− .data = NULL,
1432− .maxlen = sizeof(unsigned long),
1433− .mode = 0644,
1434− .proc_handler = hugetlb_overcommit_handler,
1435− },
1436−#endif
1437− {
1438− .procname = "lowmem_reserve_ratio",
1439− .data = &sysctl_lowmem_reserve_ratio,
1440− .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1441− .mode = 0644,
1442− .proc_handler = lowmem_reserve_ratio_sysctl_handler,
1443− },
1444− {
1445− .procname = "drop_caches",
1446− .data = &sysctl_drop_caches,
1447− .maxlen = sizeof(int),
1448− .mode = 0200,
1449− .proc_handler = drop_caches_sysctl_handler,
1450− .extra1 = SYSCTL_ONE,
1451− .extra2 = &four,
1452− },
1453−#ifdef CONFIG_COMPACTION
1454− {
1455− .procname = "compact_memory",
1456− .data = &sysctl_compact_memory,
1457− .maxlen = sizeof(int),
1458− .mode = 0200,
1459− .proc_handler = sysctl_compaction_handler,
1460− },
1461− {
1462− .procname = "extfrag_threshold",
1463− .data = &sysctl_extfrag_threshold,
1464− .maxlen = sizeof(int),
1465− .mode = 0644,
1466− .proc_handler = proc_dointvec_minmax,
1467− .extra1 = &min_extfrag_threshold,
1468− .extra2 = &max_extfrag_threshold,
1469− },
1470− {
1471− .procname = "compact_unevictable_allowed",
1472− .data = &sysctl_compact_unevictable_allowed,
1473− .maxlen = sizeof(int),
1474− .mode = 0644,
1475− .proc_handler = proc_dointvec_minmax_warn_RT_change,
1476− .extra1 = SYSCTL_ZERO,
1477− .extra2 = SYSCTL_ONE,
1478− },
1479−
1480−#endif /* CONFIG_COMPACTION */
1481− {
1482− .procname = "min_free_kbytes",
1483− .data = &min_free_kbytes,
1484− .maxlen = sizeof(min_free_kbytes),
1485− .mode = 0644,
1486− .proc_handler = min_free_kbytes_sysctl_handler,
1487− .extra1 = SYSCTL_ZERO,
1488− },
1489− {
1490− .procname = "watermark_boost_factor",
1491− .data = &watermark_boost_factor,
1492− .maxlen = sizeof(watermark_boost_factor),
1493− .mode = 0644,
1494− .proc_handler = watermark_boost_factor_sysctl_handler,
1495− .extra1 = SYSCTL_ZERO,
1496− },
1497− {
1498− .procname = "watermark_scale_factor",
1499− .data = &watermark_scale_factor,
1500− .maxlen = sizeof(watermark_scale_factor),
1501− .mode = 0644,
1502− .proc_handler = watermark_scale_factor_sysctl_handler,
1503− .extra1 = SYSCTL_ONE,
1504− .extra2 = &one_thousand,
1505− },
1506− {
1507− .procname = "percpu_pagelist_fraction",
1508− .data = &percpu_pagelist_fraction,
1509− .maxlen = sizeof(percpu_pagelist_fraction),
1510− .mode = 0644,
1511− .proc_handler = percpu_pagelist_fraction_sysctl_handler,
1512− .extra1 = SYSCTL_ZERO,
1513− },
1514−#ifdef CONFIG_MMU
1515− {
1516− .procname = "max_map_count",
1517− .data = &sysctl_max_map_count,
1518− .maxlen = sizeof(sysctl_max_map_count),
1519− .mode = 0644,
1520− .proc_handler = proc_dointvec_minmax,
1521− .extra1 = SYSCTL_ZERO,
1522− },
1523−#else
1524− {
1525− .procname = "nr_trim_pages",
1526− .data = &sysctl_nr_trim_pages,
1527− .maxlen = sizeof(sysctl_nr_trim_pages),
1528− .mode = 0644,
1529− .proc_handler = proc_dointvec_minmax,
1530− .extra1 = SYSCTL_ZERO,
1531− },
1532−#endif
1533− {
1534− .procname = "laptop_mode",
1535− .data = &laptop_mode,
1536− .maxlen = sizeof(laptop_mode),
1537− .mode = 0644,
1538− .proc_handler = proc_dointvec_jiffies,
1539− },
1540− {
1541− .procname = "block_dump",
1542− .data = &block_dump,
1543− .maxlen = sizeof(block_dump),
1544− .mode = 0644,
1545− .proc_handler = proc_dointvec,
1546− .extra1 = SYSCTL_ZERO,
1547− },
1548− {
1549− .procname = "vfs_cache_pressure",
1550− .data = &sysctl_vfs_cache_pressure,
1551− .maxlen = sizeof(sysctl_vfs_cache_pressure),
1552− .mode = 0644,
1553− .proc_handler = proc_dointvec,
1554− .extra1 = SYSCTL_ZERO,
1555− },
1556−#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \
1557− defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT)
1558− {
1559− .procname = "legacy_va_layout",
1560− .data = &sysctl_legacy_va_layout,
1561− .maxlen = sizeof(sysctl_legacy_va_layout),
1562− .mode = 0644,
1563− .proc_handler = proc_dointvec,
1564− .extra1 = SYSCTL_ZERO,
1565− },
1566−#endif
1567−#ifdef CONFIG_NUMA
1568− {
1569− .procname = "zone_reclaim_mode",
1570− .data = &node_reclaim_mode,
1571− .maxlen = sizeof(node_reclaim_mode),
1572− .mode = 0644,
1573− .proc_handler = proc_dointvec,
1574− .extra1 = SYSCTL_ZERO,
1575− },
1576− {
1577− .procname = "min_unmapped_ratio",
1578− .data = &sysctl_min_unmapped_ratio,
1579− .maxlen = sizeof(sysctl_min_unmapped_ratio),
1580− .mode = 0644,
1581− .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
1582− .extra1 = SYSCTL_ZERO,
1583− .extra2 = &one_hundred,
1584− },
1585− {
1586− .procname = "min_slab_ratio",
1587− .data = &sysctl_min_slab_ratio,
1588− .maxlen = sizeof(sysctl_min_slab_ratio),
1589− .mode = 0644,
1590− .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
1591− .extra1 = SYSCTL_ZERO,
1592− .extra2 = &one_hundred,
1593− },
1594−#endif
1595−#ifdef CONFIG_SMP
1596− {
1597− .procname = "stat_interval",
1598− .data = &sysctl_stat_interval,
1599− .maxlen = sizeof(sysctl_stat_interval),
1600− .mode = 0644,
1601− .proc_handler = proc_dointvec_jiffies,
1602− },
1603− {
1604− .procname = "stat_refresh",
1605− .data = NULL,
1606− .maxlen = 0,
1607− .mode = 0600,
1608− .proc_handler = vmstat_refresh,
1609− },
1610−#endif
1611−#ifdef CONFIG_MMU
1612− {
1613− .procname = "mmap_min_addr",
1614− .data = &dac_mmap_min_addr,
1615− .maxlen = sizeof(unsigned long),
1616− .mode = 0644,
1617− .proc_handler = mmap_min_addr_handler,
1618− },
1619−#endif
1620−#ifdef CONFIG_NUMA
1621− {
1622− .procname = "numa_zonelist_order",
1623− .data = &numa_zonelist_order,
1624− .maxlen = NUMA_ZONELIST_ORDER_LEN,
1625− .mode = 0644,
1626− .proc_handler = numa_zonelist_order_handler,
1627− },
1628−#endif
1629−#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1630− (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1631− {
1632− .procname = "vdso_enabled",
1633−#ifdef CONFIG_X86_32
1634− .data = &vdso32_enabled,
1635− .maxlen = sizeof(vdso32_enabled),
1636−#else
1637− .data = &vdso_enabled,
1638− .maxlen = sizeof(vdso_enabled),
1639−#endif
1640− .mode = 0644,
1641− .proc_handler = proc_dointvec,
1642− .extra1 = SYSCTL_ZERO,
1643− },
1644−#endif
1645−#ifdef CONFIG_HIGHMEM
1646− {
1647− .procname = "highmem_is_dirtyable",
1648− .data = &vm_highmem_is_dirtyable,
1649− .maxlen = sizeof(vm_highmem_is_dirtyable),
1650− .mode = 0644,
1651− .proc_handler = proc_dointvec_minmax,
1652− .extra1 = SYSCTL_ZERO,
1653− .extra2 = SYSCTL_ONE,
1654− },
1655−#endif
1656−#ifdef CONFIG_MEMORY_FAILURE
1657− {
1658− .procname = "memory_failure_early_kill",
1659− .data = &sysctl_memory_failure_early_kill,
1660− .maxlen = sizeof(sysctl_memory_failure_early_kill),
1661− .mode = 0644,
1662− .proc_handler = proc_dointvec_minmax,
1663− .extra1 = SYSCTL_ZERO,
1664− .extra2 = SYSCTL_ONE,
1665− },
1666− {
1667− .procname = "memory_failure_recovery",
1668− .data = &sysctl_memory_failure_recovery,
1669− .maxlen = sizeof(sysctl_memory_failure_recovery),
1670− .mode = 0644,
1671− .proc_handler = proc_dointvec_minmax,
1672− .extra1 = SYSCTL_ZERO,
1673− .extra2 = SYSCTL_ONE,
1674− },
1675−#endif
1676− {
1677− .procname = "user_reserve_kbytes",
1678− .data = &sysctl_user_reserve_kbytes,
1679− .maxlen = sizeof(sysctl_user_reserve_kbytes),
1680− .mode = 0644,
1681− .proc_handler = proc_doulongvec_minmax,
1682− },
1683− {
1684− .procname = "admin_reserve_kbytes",
1685− .data = &sysctl_admin_reserve_kbytes,
1686− .maxlen = sizeof(sysctl_admin_reserve_kbytes),
1687− .mode = 0644,
1688− .proc_handler = proc_doulongvec_minmax,
1689− },
1690−#ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
1691− {
1692− .procname = "mmap_rnd_bits",
1693− .data = &mmap_rnd_bits,
1694− .maxlen = sizeof(mmap_rnd_bits),
1695− .mode = 0600,
1696− .proc_handler = proc_dointvec_minmax,
1697− .extra1 = (void *)&mmap_rnd_bits_min,
1698− .extra2 = (void *)&mmap_rnd_bits_max,
1699− },
1700−#endif
1701−#ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS
1702− {
1703− .procname = "mmap_rnd_compat_bits",
1704− .data = &mmap_rnd_compat_bits,
1705− .maxlen = sizeof(mmap_rnd_compat_bits),
1706− .mode = 0600,
1707− .proc_handler = proc_dointvec_minmax,
1708− .extra1 = (void *)&mmap_rnd_compat_bits_min,
1709− .extra2 = (void *)&mmap_rnd_compat_bits_max,
1710− },
1711−#endif
1712−#ifdef CONFIG_USERFAULTFD
1713− {
1714− .procname = "unprivileged_userfaultfd",
1715− .data = &sysctl_unprivileged_userfaultfd,
1716− .maxlen = sizeof(sysctl_unprivileged_userfaultfd),
1717− .mode = 0644,
1718− .proc_handler = proc_dointvec_minmax,
1719− .extra1 = SYSCTL_ZERO,
1720− .extra2 = SYSCTL_ONE,
1721− },
1722−#endif
1723− { }
1724−};
1725−
1726−static struct ctl_table fs_table[] = {
1727− {
1728− .procname = "inode-nr",
1729− .data = &inodes_stat,
1730− .maxlen = 2*sizeof(long),
1731− .mode = 0444,
1732− .proc_handler = proc_nr_inodes,
1733− },
1734− {
1735− .procname = "inode-state",
1736− .data = &inodes_stat,
1737− .maxlen = 7*sizeof(long),
1738− .mode = 0444,
1739− .proc_handler = proc_nr_inodes,
1740− },
1741− {
1742− .procname = "file-nr",
1743− .data = &files_stat,
1744− .maxlen = sizeof(files_stat),
1745− .mode = 0444,
1746− .proc_handler = proc_nr_files,
1747− },
1748− {
1749− .procname = "file-max",
1750− .data = &files_stat.max_files,
1751− .maxlen = sizeof(files_stat.max_files),
1752− .mode = 0644,
1753− .proc_handler = proc_doulongvec_minmax,
1754− .extra1 = &zero_ul,
1755− .extra2 = &long_max,
1756− },
1757− {
1758− .procname = "nr_open",
1759− .data = &sysctl_nr_open,
1760− .maxlen = sizeof(unsigned int),
1761− .mode = 0644,
1762− .proc_handler = proc_dointvec_minmax,
1763− .extra1 = &sysctl_nr_open_min,
1764− .extra2 = &sysctl_nr_open_max,
1765− },
1766− {
1767− .procname = "dentry-state",
1768− .data = &dentry_stat,
1769− .maxlen = 6*sizeof(long),
1770− .mode = 0444,
1771− .proc_handler = proc_nr_dentry,
1772− },
1773− {
1774− .procname = "overflowuid",
1775− .data = &fs_overflowuid,
1776− .maxlen = sizeof(int),
1777− .mode = 0644,
1778− .proc_handler = proc_dointvec_minmax,
1779− .extra1 = &minolduid,
1780− .extra2 = &maxolduid,
1781− },
1782− {
1783− .procname = "overflowgid",
1784− .data = &fs_overflowgid,
1785− .maxlen = sizeof(int),
1786− .mode = 0644,
1787− .proc_handler = proc_dointvec_minmax,
1788− .extra1 = &minolduid,
1789− .extra2 = &maxolduid,
1790− },
1791−#ifdef CONFIG_FILE_LOCKING
1792− {
1793− .procname = "leases-enable",
1794− .data = &leases_enable,
1795− .maxlen = sizeof(int),
1796− .mode = 0644,
1797− .proc_handler = proc_dointvec,
1798− },
1799−#endif
1800−#ifdef CONFIG_DNOTIFY
1801− {
1802− .procname = "dir-notify-enable",
1803− .data = &dir_notify_enable,
1804− .maxlen = sizeof(int),
1805− .mode = 0644,
1806− .proc_handler = proc_dointvec,
1807− },
1808−#endif
1809−#ifdef CONFIG_MMU
1810−#ifdef CONFIG_FILE_LOCKING
1811− {
1812− .procname = "lease-break-time",
1813− .data = &lease_break_time,
1814− .maxlen = sizeof(int),
1815− .mode = 0644,
1816− .proc_handler = proc_dointvec,
1817− },
1818−#endif
1819−#ifdef CONFIG_AIO
1820− {
1821− .procname = "aio-nr",
1822− .data = &aio_nr,
1823− .maxlen = sizeof(aio_nr),
1824− .mode = 0444,
1825− .proc_handler = proc_doulongvec_minmax,
1826− },
1827− {
1828− .procname = "aio-max-nr",
1829− .data = &aio_max_nr,
1830− .maxlen = sizeof(aio_max_nr),
1831− .mode = 0644,
1832− .proc_handler = proc_doulongvec_minmax,
1833− },
1834−#endif /* CONFIG_AIO */
1835−#ifdef CONFIG_INOTIFY_USER
1836− {
1837− .procname = "inotify",
1838− .mode = 0555,
1839− .child = inotify_table,
1840− },
1841−#endif
1842−#ifdef CONFIG_EPOLL
1843− {
1844− .procname = "epoll",
1845− .mode = 0555,
1846− .child = epoll_table,
1847− },
1848−#endif
1849−#endif
1850− {
1851− .procname = "protected_symlinks",
1852− .data = &sysctl_protected_symlinks,
1853− .maxlen = sizeof(int),
1854− .mode = 0600,
1855− .proc_handler = proc_dointvec_minmax,
1856− .extra1 = SYSCTL_ZERO,
1857− .extra2 = SYSCTL_ONE,
1858− },
1859− {
1860− .procname = "protected_hardlinks",
1861− .data = &sysctl_protected_hardlinks,
1862− .maxlen = sizeof(int),
1863− .mode = 0600,
1864− .proc_handler = proc_dointvec_minmax,
1865− .extra1 = SYSCTL_ZERO,
1866− .extra2 = SYSCTL_ONE,
1867− },
1868− {
1869− .procname = "protected_fifos",
1870− .data = &sysctl_protected_fifos,
1871− .maxlen = sizeof(int),
1872− .mode = 0600,
1873− .proc_handler = proc_dointvec_minmax,
1874− .extra1 = SYSCTL_ZERO,
1875− .extra2 = &two,
1876− },
1877− {
1878− .procname = "protected_regular",
1879− .data = &sysctl_protected_regular,
1880− .maxlen = sizeof(int),
1881− .mode = 0600,
1882− .proc_handler = proc_dointvec_minmax,
1883− .extra1 = SYSCTL_ZERO,
1884− .extra2 = &two,
1885− },
1886− {
1887− .procname = "suid_dumpable",
1888− .data = &suid_dumpable,
1889− .maxlen = sizeof(int),
1890− .mode = 0644,
1891− .proc_handler = proc_dointvec_minmax_coredump,
1892− .extra1 = SYSCTL_ZERO,
1893− .extra2 = &two,
1894− },
1895−#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1896− {
1897− .procname = "binfmt_misc",
1898− .mode = 0555,
1899− .child = sysctl_mount_point,
1900− },
1901−#endif
1902− {
1903− .procname = "pipe-max-size",
1904− .data = &pipe_max_size,
1905− .maxlen = sizeof(pipe_max_size),
1906− .mode = 0644,
1907− .proc_handler = proc_dopipe_max_size,
1908− },
1909− {
1910− .procname = "pipe-user-pages-hard",
1911− .data = &pipe_user_pages_hard,
1912− .maxlen = sizeof(pipe_user_pages_hard),
1913− .mode = 0644,
1914− .proc_handler = proc_doulongvec_minmax,
1915− },
1916− {
1917− .procname = "pipe-user-pages-soft",
1918− .data = &pipe_user_pages_soft,
1919− .maxlen = sizeof(pipe_user_pages_soft),
1920− .mode = 0644,
1921− .proc_handler = proc_doulongvec_minmax,
1922− },
1923− {
1924− .procname = "mount-max",
1925− .data = &sysctl_mount_max,
1926− .maxlen = sizeof(unsigned int),
1927− .mode = 0644,
1928− .proc_handler = proc_dointvec_minmax,
1929− .extra1 = SYSCTL_ONE,
1930− },
1931− { }
1932−};
1933−
1934−static struct ctl_table debug_table[] = {
1935−#ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
1936− {
1937− .procname = "exception-trace",
1938− .data = &show_unhandled_signals,
1939− .maxlen = sizeof(int),
1940− .mode = 0644,
1941− .proc_handler = proc_dointvec
1942− },
1943−#endif
1944−#if defined(CONFIG_OPTPROBES)
1945− {
1946− .procname = "kprobes-optimization",
1947− .data = &sysctl_kprobes_optimization,
1948− .maxlen = sizeof(int),
1949− .mode = 0644,
1950− .proc_handler = proc_kprobes_optimization_handler,
1951− .extra1 = SYSCTL_ZERO,
1952− .extra2 = SYSCTL_ONE,
1953− },
1954−#endif
1955− { }
1956−};
1957−
1958−static struct ctl_table dev_table[] = {
1959− { }
1960−};
1961−
1962−int __init sysctl_init(void)
1963−{
1964− struct ctl_table_header *hdr;
1965−
1966− hdr = register_sysctl_table(sysctl_base_table);
1967− kmemleak_not_leak(hdr);
1968− return 0;
1969−}
1970−
1971−#endif /* CONFIG_SYSCTL */
1972−
1973−/*
1974− * /proc/sys support
1975− */
1976−
202+#endif /* CONFIG_SYSCTL */
203+
204+/*
205+ * /proc/sys support
206+ */
207+
1977208 #ifdef CONFIG_PROC_SYSCTL
1978209
1979210 static int _proc_do_string(char *data, int maxlen, int write,
1980− char __user *buffer,
1981− size_t *lenp, loff_t *ppos)
211+ char *buffer, size_t *lenp, loff_t *ppos)
1982212 {
1983213 size_t len;
1984− char __user *p;
1985− char c;
214+ char c, *p;
1986215
1987216 if (!data || !maxlen || !*lenp) {
1988217 *lenp = 0;
@@ -2007,8 +236,7 @@ static int _proc_do_string(char *data, int maxlen, int write, · 18 unmodified lines
2007236 *ppos += *lenp;
2008237 p = buffer;
2009238 while ((p - buffer) < *lenp && len < maxlen - 1) {
2010− if (get_user(c, p++))
2011− return -EFAULT;
239+ c = *(p++);
2012240 if (c == 0 || c == '\n')
2013241 break;
2014242 data[len++] = c;
@@ -2030,11 +258,9 @@ static int _proc_do_string(char *data, int maxlen, int write, · 15 unmodified lines
2030258 if (len > *lenp)
2031259 len = *lenp;
2032260 if (len)
2033− if (copy_to_user(buffer, data, len))
2034− return -EFAULT;
261+ memcpy(buffer, data, len);
2035262 if (len < *lenp) {
2036− if (put_user('\n', buffer + len))
2037− return -EFAULT;
263+ buffer[len] = '\n';
2038264 len++;
2039265 }
2040266 *lenp = len;
@@ -2095,13 +321,13 @@ static bool proc_first_pos_non_zero_ignore(loff_t *ppos, · 54 unmodified lines
2095321 * Returns 0 on success.
2096322 */
2097323 int proc_dostring(struct ctl_table *table, int write,
2098− void __user *buffer, size_t *lenp, loff_t *ppos)
324+ void *buffer, size_t *lenp, loff_t *ppos)
2099325 {
2100326 if (write)
2101327 proc_first_pos_non_zero_ignore(ppos, table);
2102328
2103− return _proc_do_string((char *)(table->data), table->maxlen, write,
2104− (char __user *)buffer, lenp, ppos);
329+ return _proc_do_string(table->data, table->maxlen, write, buffer, lenp,
330+ ppos);
2105331 }
2106332
2107333 static size_t proc_skip_spaces(char **buf)
@@ -2232,11 +458,10 @@ static int proc_get_long(char **buf, size_t *size, · 124 unmodified lines
2232458 * @val: the integer to be converted
2233459 * @neg: sign of the number, %TRUE for negative
2234460 *
2235− * In case of success %0 is returned and @buf and @size are updated with
2236− * the amount of bytes written.
461+ * In case of success @buf and @size are updated with the amount of bytes
462+ * written.
2237463 */
2238−static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
2239− bool neg)
464+static void proc_put_long(void **buf, size_t *size, unsigned long val, bool neg)
2240465 {
2241466 int len;
2242467 char tmp[TMPBUFLEN], *p = tmp;
@@ -2245,24 +470,22 @@ static int proc_put_long(void __user **buf, size_t *size, unsigned long val, · 2 unmodified lines
2245470 len = strlen(tmp);
2246471 if (len > *size)
2247472 len = *size;
2248− if (copy_to_user(*buf, tmp, len))
2249− return -EFAULT;
473+ memcpy(*buf, tmp, len);
2250474 *size -= len;
2251475 *buf += len;
2252− return 0;
2253476 }
2254477 #undef TMPBUFLEN
2255478
2256−static int proc_put_char(void __user **buf, size_t *size, char c)
479+static void proc_put_char(void **buf, size_t *size, char c)
2257480 {
2258481 if (*size) {
2259− char __user **buffer = (char __user **)buf;
2260− if (put_user(c, *buffer))
2261− return -EFAULT;
2262− (*size)--, (*buffer)++;
482+ char **buffer = (char **)buf;
483+ **buffer = c;
484+
485+ (*size)--;
486+ (*buffer)++;
2263487 *buf = *buffer;
2264488 }
2265− return 0;
2266489 }
2267490
2268491 static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
@@ -2310,7 +533,7 @@ static int do_proc_douintvec_conv(unsigned long *lvalp, · 41 unmodified lines
2310533 static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
2311534
2312535 static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2313− int write, void __user *buffer,
536+ int write, void *buffer,
2314537 size_t *lenp, loff_t *ppos,
2315538 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2316539 int write, void *data),
@@ -2318,7 +541,7 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, · 1 unmodified line
2318541 {
2319542 int *i, vleft, first = 1, err = 0;
2320543 size_t left;
2321− char *kbuf = NULL, *p;
544+ char *p;
2322545
2323546 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
2324547 *lenp = 0;
@@ -2338,9 +561,7 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, · 13 unmodified lines
2338561
2339562 if (left > PAGE_SIZE - 1)
2340563 left = PAGE_SIZE - 1;
2341− p = kbuf = memdup_user_nul(buffer, left);
2342− if (IS_ERR(kbuf))
2343− return PTR_ERR(kbuf);
564+ p = buffer;
2344565 }
2345566
2346567 for (; left && vleft--; i++, first=0) {
@@ -2367,24 +588,17 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, · 20 unmodified lines
2367588 break;
2368589 }
2369590 if (!first)
2370− err = proc_put_char(&buffer, &left, '\t');
2371− if (err)
2372− break;
2373− err = proc_put_long(&buffer, &left, lval, neg);
2374− if (err)
2375− break;
591+ proc_put_char(&buffer, &left, '\t');
592+ proc_put_long(&buffer, &left, lval, neg);
2376593 }
2377594 }
2378595
2379596 if (!write && !first && left && !err)
2380− err = proc_put_char(&buffer, &left, '\n');
597+ proc_put_char(&buffer, &left, '\n');
2381598 if (write && !err && left)
2382599 left -= proc_skip_spaces(&p);
2383− if (write) {
2384− kfree(kbuf);
2385− if (first)
2386− return err ? : -EINVAL;
2387− }
600+ if (write && first)
601+ return err ? : -EINVAL;
2388602 *lenp -= left;
2389603 out:
2390604 *ppos += *lenp;
@@ -2392,7 +606,7 @@ out: · 1 unmodified line
2392606 }
2393607
2394608 static int do_proc_dointvec(struct ctl_table *table, int write,
2395− void __user *buffer, size_t *lenp, loff_t *ppos,
609+ void *buffer, size_t *lenp, loff_t *ppos,
2396610 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2397611 int write, void *data),
2398612 void *data)
@@ -2403,7 +617,7 @@ static int do_proc_dointvec(struct ctl_table *table, int write, · 4 unmodified lines
2403617
2404618 static int do_proc_douintvec_w(unsigned int *tbl_data,
2405619 struct ctl_table *table,
2406− void __user *buffer,
620+ void *buffer,
2407621 size_t *lenp, loff_t *ppos,
2408622 int (*conv)(unsigned long *lvalp,
2409623 unsigned int *valp,
@@ -2414,7 +628,7 @@ static int do_proc_douintvec_w(unsigned int *tbl_data, · 4 unmodified lines
2414628 int err = 0;
2415629 size_t left;
2416630 bool neg;
2417− char *kbuf = NULL, *p;
631+ char *p = buffer;
2418632
2419633 left = *lenp;
2420634
@@ -2424,10 +638,6 @@ static int do_proc_douintvec_w(unsigned int *tbl_data, · 3 unmodified lines
2424638 if (left > PAGE_SIZE - 1)
2425639 left = PAGE_SIZE - 1;
2426640
2427− p = kbuf = memdup_user_nul(buffer, left);
2428− if (IS_ERR(kbuf))
2429− return -EINVAL;
2430−
2431641 left -= proc_skip_spaces(&p);
2432642 if (!left) {
2433643 err = -EINVAL;
@@ -2451,7 +661,6 @@ static int do_proc_douintvec_w(unsigned int *tbl_data, · 17 unmodified lines
2451661 left -= proc_skip_spaces(&p);
2452662
2453663 out_free:
2454− kfree(kbuf);
2455664 if (err)
2456665 return -EINVAL;
2457666
@@ -2463,7 +672,7 @@ bail_early: · 5 unmodified lines
2463672 return err;
2464673 }
2465674
2466−static int do_proc_douintvec_r(unsigned int *tbl_data, void __user *buffer,
675+static int do_proc_douintvec_r(unsigned int *tbl_data, void *buffer,
2467676 size_t *lenp, loff_t *ppos,
2468677 int (*conv)(unsigned long *lvalp,
2469678 unsigned int *valp,
@@ -2481,11 +690,11 @@ static int do_proc_douintvec_r(unsigned int *tbl_data, void __user *buffer, · 11 unmodified lines
2481690 goto out;
2482691 }
2483692
2484− err = proc_put_long(&buffer, &left, lval, false);
2485− if (err || !left)
693+ proc_put_long(&buffer, &left, lval, false);
694+ if (!left)
2486695 goto out;
2487696
2488− err = proc_put_char(&buffer, &left, '\n');
697+ proc_put_char(&buffer, &left, '\n');
2489698
2490699 out:
2491700 *lenp -= left;
@@ -2495,7 +704,7 @@ out: · 3 unmodified lines
2495704 }
2496705
2497706 static int __do_proc_douintvec(void *tbl_data, struct ctl_table *table,
2498− int write, void __user *buffer,
707+ int write, void *buffer,
2499708 size_t *lenp, loff_t *ppos,
2500709 int (*conv)(unsigned long *lvalp,
2501710 unsigned int *valp,
@@ -2531,7 +740,7 @@ static int __do_proc_douintvec(void *tbl_data, struct ctl_table *table, · 29 unmodified lines
2531740 }
2532741
2533742 static int do_proc_douintvec(struct ctl_table *table, int write,
2534− void __user *buffer, size_t *lenp, loff_t *ppos,
743+ void *buffer, size_t *lenp, loff_t *ppos,
2535744 int (*conv)(unsigned long *lvalp,
2536745 unsigned int *valp,
2537746 int write, void *data),
@@ -2554,16 +763,15 @@ static int do_proc_douintvec(struct ctl_table *table, int write, · 16 unmodified lines
2554763 *
2555764 * Returns 0 on success.
2556765 */
2557−int proc_dointvec(struct ctl_table *table, int write,
2558− void __user *buffer, size_t *lenp, loff_t *ppos)
766+int proc_dointvec(struct ctl_table *table, int write, void *buffer,
767+ size_t *lenp, loff_t *ppos)
2559768 {
2560769 return do_proc_dointvec(table, write, buffer, lenp, ppos, NULL, NULL);
2561770 }
2562771
2563772 #ifdef CONFIG_COMPACTION
2564773 static int proc_dointvec_minmax_warn_RT_change(struct ctl_table *table,
2565− int write, void __user *buffer,
2566− size_t *lenp, loff_t *ppos)
774+ int write, void *buffer, size_t *lenp, loff_t *ppos)
2567775 {
2568776 int ret, old;
2569777
@@ -2595,8 +803,8 @@ static int proc_dointvec_minmax_warn_RT_change(struct ctl_table *table, · 25 unmodified lines
2595803 *
2596804 * Returns 0 on success.
2597805 */
2598−int proc_douintvec(struct ctl_table *table, int write,
2599− void __user *buffer, size_t *lenp, loff_t *ppos)
806+int proc_douintvec(struct ctl_table *table, int write, void *buffer,
807+ size_t *lenp, loff_t *ppos)
2600808 {
2601809 return do_proc_douintvec(table, write, buffer, lenp, ppos,
2602810 do_proc_douintvec_conv, NULL);
@@ -2607,7 +815,7 @@ int proc_douintvec(struct ctl_table *table, int write, · 4 unmodified lines
2607815 * This means we can safely use a temporary.
2608816 */
2609817 static int proc_taint(struct ctl_table *table, int write,
2610− void __user *buffer, size_t *lenp, loff_t *ppos)
818+ void *buffer, size_t *lenp, loff_t *ppos)
2611819 {
2612820 struct ctl_table t;
2613821 unsigned long tmptaint = get_taint();
@@ -2639,7 +847,7 @@ static int proc_taint(struct ctl_table *table, int write, · 25 unmodified lines
2639847
2640848 #ifdef CONFIG_PRINTK
2641849 static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
2642− void __user *buffer, size_t *lenp, loff_t *ppos)
850+ void *buffer, size_t *lenp, loff_t *ppos)
2643851 {
2644852 if (write && !capable(CAP_SYS_ADMIN))
2645853 return -EPERM;
@@ -2705,7 +913,7 @@ static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp, · 59 unmodified lines
2705913 * Returns 0 on success or -EINVAL on write when the range check fails.
2706914 */
2707915 int proc_dointvec_minmax(struct ctl_table *table, int write,
2708− void __user *buffer, size_t *lenp, loff_t *ppos)
916+ void *buffer, size_t *lenp, loff_t *ppos)
2709917 {
2710918 struct do_proc_dointvec_minmax_conv_param param = {
2711919 .min = (int *) table->extra1,
@@ -2774,7 +982,7 @@ static int do_proc_douintvec_minmax_conv(unsigned long *lvalp, · 62 unmodified lines
2774982 * Returns 0 on success or -ERANGE on write when the range check fails.
2775983 */
2776984 int proc_douintvec_minmax(struct ctl_table *table, int write,
2777− void __user *buffer, size_t *lenp, loff_t *ppos)
985+ void *buffer, size_t *lenp, loff_t *ppos)
2778986 {
2779987 struct do_proc_douintvec_minmax_conv_param param = {
2780988 .min = (unsigned int *) table->extra1,
@@ -2805,7 +1013,7 @@ static int do_proc_dopipe_max_size_conv(unsigned long *lvalp, · 24 unmodified lines
28051013 }
28061014
28071015 static int proc_dopipe_max_size(struct ctl_table *table, int write,
2808− void __user *buffer, size_t *lenp, loff_t *ppos)
1016+ void *buffer, size_t *lenp, loff_t *ppos)
28091017 {
28101018 return do_proc_douintvec(table, write, buffer, lenp, ppos,
28111019 do_proc_dopipe_max_size_conv, NULL);
@@ -2826,7 +1034,7 @@ static void validate_coredump_safety(void) · 14 unmodified lines
28261034 }
28271035
28281036 static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
2829− void __user *buffer, size_t *lenp, loff_t *ppos)
1037+ void *buffer, size_t *lenp, loff_t *ppos)
28301038 {
28311039 int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
28321040 if (!error)
@@ -2836,7 +1044,7 @@ static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write, · 3 unmodified lines
28361044
28371045 #ifdef CONFIG_COREDUMP
28381046 static int proc_dostring_coredump(struct ctl_table *table, int write,
2839− void __user *buffer, size_t *lenp, loff_t *ppos)
1047+ void *buffer, size_t *lenp, loff_t *ppos)
28401048 {
28411049 int error = proc_dostring(table, write, buffer, lenp, ppos);
28421050 if (!error)
@@ -2847,7 +1055,7 @@ static int proc_dostring_coredump(struct ctl_table *table, int write, · 4 unmodified lines
28471055
28481056 #ifdef CONFIG_MAGIC_SYSRQ
28491057 static int sysrq_sysctl_handler(struct ctl_table *table, int write,
2850− void __user *buffer, size_t *lenp, loff_t *ppos)
1058+ void *buffer, size_t *lenp, loff_t *ppos)
28511059 {
28521060 int tmp, ret;
28531061
@@ -2865,16 +1073,14 @@ static int sysrq_sysctl_handler(struct ctl_table *table, int write, · 11 unmodified lines
28651073 }
28661074 #endif
28671075
2868−static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2869− void __user *buffer,
2870− size_t *lenp, loff_t *ppos,
2871− unsigned long convmul,
2872− unsigned long convdiv)
1076+static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table,
1077+ int write, void *buffer, size_t *lenp, loff_t *ppos,
1078+ unsigned long convmul, unsigned long convdiv)
28731079 {
28741080 unsigned long *i, *min, *max;
28751081 int vleft, first = 1, err = 0;
28761082 size_t left;
2877− char *kbuf = NULL, *p;
1083+ char *p;
28781084
28791085 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
28801086 *lenp = 0;
@@ -2893,9 +1099,7 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int · 12 unmodified lines
28931099
28941100 if (left > PAGE_SIZE - 1)
28951101 left = PAGE_SIZE - 1;
2896− p = kbuf = memdup_user_nul(buffer, left);
2897− if (IS_ERR(kbuf))
2898− return PTR_ERR(kbuf);
1102+ p = buffer;
28991103 }
29001104
29011105 for (; left && vleft--; i++, first = 0) {
@@ -2923,26 +1127,18 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int · 21 unmodified lines
29231127 *i = val;
29241128 } else {
29251129 val = convdiv * (*i) / convmul;
2926− if (!first) {
2927− err = proc_put_char(&buffer, &left, '\t');
2928− if (err)
2929− break;
2930− }
2931− err = proc_put_long(&buffer, &left, val, false);
2932− if (err)
2933− break;
1130+ if (!first)
1131+ proc_put_char(&buffer, &left, '\t');
1132+ proc_put_long(&buffer, &left, val, false);
29341133 }
29351134 }
29361135
29371136 if (!write && !first && left && !err)
2938− err = proc_put_char(&buffer, &left, '\n');
1137+ proc_put_char(&buffer, &left, '\n');
29391138 if (write && !err)
29401139 left -= proc_skip_spaces(&p);
2941− if (write) {
2942− kfree(kbuf);
2943− if (first)
2944− return err ? : -EINVAL;
2945− }
1140+ if (write && first)
1141+ return err ? : -EINVAL;
29461142 *lenp -= left;
29471143 out:
29481144 *ppos += *lenp;
@@ -2950,10 +1146,8 @@ out: · 1 unmodified line
29501146 }
29511147
29521148 static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2953− void __user *buffer,
2954− size_t *lenp, loff_t *ppos,
2955− unsigned long convmul,
2956− unsigned long convdiv)
1149+ void *buffer, size_t *lenp, loff_t *ppos, unsigned long convmul,
1150+ unsigned long convdiv)
29571151 {
29581152 return __do_proc_doulongvec_minmax(table->data, table, write,
29591153 buffer, lenp, ppos, convmul, convdiv);
@@ -2976,7 +1170,7 @@ static int do_proc_doulongvec_minmax(struct ctl_table *table, int write, · 16 unmodified lines
29761170 * Returns 0 on success.
29771171 */
29781172 int proc_doulongvec_minmax(struct ctl_table *table, int write,
2979− void __user *buffer, size_t *lenp, loff_t *ppos)
1173+ void *buffer, size_t *lenp, loff_t *ppos)
29801174 {
29811175 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
29821176 }
@@ -2999,8 +1193,7 @@ int proc_doulongvec_minmax(struct ctl_table *table, int write, · 16 unmodified lines
29991193 * Returns 0 on success.
30001194 */
30011195 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
3002− void __user *buffer,
3003− size_t *lenp, loff_t *ppos)
1196+ void *buffer, size_t *lenp, loff_t *ppos)
30041197 {
30051198 return do_proc_doulongvec_minmax(table, write, buffer,
30061199 lenp, ppos, HZ, 1000l);
@@ -3094,7 +1287,7 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp, · 87 unmodified lines
30941287 * Returns 0 on success.
30951288 */
30961289 int proc_dointvec_jiffies(struct ctl_table *table, int write,
3097− void __user *buffer, size_t *lenp, loff_t *ppos)
1290+ void *buffer, size_t *lenp, loff_t *ppos)
30981291 {
30991292 return do_proc_dointvec(table,write,buffer,lenp,ppos,
31001293 do_proc_dointvec_jiffies_conv,NULL);
@@ -3116,7 +1309,7 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write, · 15 unmodified lines
31161309 * Returns 0 on success.
31171310 */
31181311 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
3119− void __user *buffer, size_t *lenp, loff_t *ppos)
1312+ void *buffer, size_t *lenp, loff_t *ppos)
31201313 {
31211314 return do_proc_dointvec(table,write,buffer,lenp,ppos,
31221315 do_proc_dointvec_userhz_jiffies_conv,NULL);
@@ -3138,15 +1331,15 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, · 15 unmodified lines
31381331 *
31391332 * Returns 0 on success.
31401333 */
3141−int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
3142− void __user *buffer, size_t *lenp, loff_t *ppos)
1334+int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, void *buffer,
1335+ size_t *lenp, loff_t *ppos)
31431336 {
31441337 return do_proc_dointvec(table, write, buffer, lenp, ppos,
31451338 do_proc_dointvec_ms_jiffies_conv, NULL);
31461339 }
31471340
3148−static int proc_do_cad_pid(struct ctl_table *table, int write,
3149− void __user *buffer, size_t *lenp, loff_t *ppos)
1341+static int proc_do_cad_pid(struct ctl_table *table, int write, void *buffer,
1342+ size_t *lenp, loff_t *ppos)
31501343 {
31511344 struct pid *new_pid;
31521345 pid_t tmp;
@@ -3185,7 +1378,7 @@ static int proc_do_cad_pid(struct ctl_table *table, int write, · 32 unmodified lines
31851378 * Returns 0 on success.
31861379 */
31871380 int proc_do_large_bitmap(struct ctl_table *table, int write,
3188− void __user *buffer, size_t *lenp, loff_t *ppos)
1381+ void *buffer, size_t *lenp, loff_t *ppos)
31891382 {
31901383 int err = 0;
31911384 bool first = 1;
@@ -3201,7 +1394,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, · 9 unmodified lines
32011394 }
32021395
32031396 if (write) {
3204− char *kbuf, *p;
1397+ char *p = buffer;
32051398 size_t skipped = 0;
32061399
32071400 if (left > PAGE_SIZE - 1) {
@@ -3210,15 +1403,9 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, · 2 unmodified lines
32101403 skipped = *lenp - left;
32111404 }
32121405
3213− p = kbuf = memdup_user_nul(buffer, left);
3214− if (IS_ERR(kbuf))
3215− return PTR_ERR(kbuf);
3216−
32171406 tmp_bitmap = bitmap_zalloc(bitmap_len, GFP_KERNEL);
3218− if (!tmp_bitmap) {
3219− kfree(kbuf);
1407+ if (!tmp_bitmap)
32201408 return -ENOMEM;
3221− }
32221409 proc_skip_char(&p, &left, '\n');
32231410 while (!err && left) {
32241411 unsigned long val_a, val_b;
@@ -3282,7 +1469,6 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, · 57 unmodified lines
32821469 first = 0;
32831470 proc_skip_char(&p, &left, '\n');
32841471 }
3285− kfree(kbuf);
32861472 left += skipped;
32871473 } else {
32881474 unsigned long bit_a, bit_b = 0;
@@ -3294,27 +1480,17 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, · 5 unmodified lines
32941480 bit_b = find_next_zero_bit(bitmap, bitmap_len,
32951481 bit_a + 1) - 1;
32961482
3297− if (!first) {
3298− err = proc_put_char(&buffer, &left, ',');
3299− if (err)
3300− break;
3301− }
3302− err = proc_put_long(&buffer, &left, bit_a, false);
3303− if (err)
3304− break;
1483+ if (!first)
1484+ proc_put_char(&buffer, &left, ',');
1485+ proc_put_long(&buffer, &left, bit_a, false);
33051486 if (bit_a != bit_b) {
3306− err = proc_put_char(&buffer, &left, '-');
3307− if (err)
3308− break;
3309− err = proc_put_long(&buffer, &left, bit_b, false);
3310− if (err)
3311− break;
1487+ proc_put_char(&buffer, &left, '-');
1488+ proc_put_long(&buffer, &left, bit_b, false);
33121489 }
33131490
33141491 first = 0; bit_b++;
33151492 }
3316− if (!err)
3317− err = proc_put_char(&buffer, &left, '\n');
1493+ proc_put_char(&buffer, &left, '\n');
33181494 }
33191495
33201496 if (!err) {
@@ -3328,113 +1504,1804 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, · 7 unmodified lines
33281504 *ppos += *lenp;
33291505 }
33301506
3331− bitmap_free(tmp_bitmap);
3332− return err;
1507+ bitmap_free(tmp_bitmap);
1508+ return err;
1509+}
1510+
1511+#else /* CONFIG_PROC_SYSCTL */
1512+
1513+int proc_dostring(struct ctl_table *table, int write,
1514+ void *buffer, size_t *lenp, loff_t *ppos)
1515+{
1516+ return -ENOSYS;
1517+}
1518+
1519+int proc_dointvec(struct ctl_table *table, int write,
1520+ void *buffer, size_t *lenp, loff_t *ppos)
1521+{
1522+ return -ENOSYS;
1523+}
1524+
1525+int proc_douintvec(struct ctl_table *table, int write,
1526+ void *buffer, size_t *lenp, loff_t *ppos)
1527+{
1528+ return -ENOSYS;
1529+}
1530+
1531+int proc_dointvec_minmax(struct ctl_table *table, int write,
1532+ void *buffer, size_t *lenp, loff_t *ppos)
1533+{
1534+ return -ENOSYS;
33331535 }
33341536
3335−#else /* CONFIG_PROC_SYSCTL */
1537+int proc_douintvec_minmax(struct ctl_table *table, int write,
1538+ void *buffer, size_t *lenp, loff_t *ppos)
1539+{
1540+ return -ENOSYS;
1541+}
33361542
3337−int proc_dostring(struct ctl_table *table, int write,
3338− void __user *buffer, size_t *lenp, loff_t *ppos)
1543+int proc_dointvec_jiffies(struct ctl_table *table, int write,
1544+ void *buffer, size_t *lenp, loff_t *ppos)
33391545 {
33401546 return -ENOSYS;
33411547 }
33421548
3343−int proc_dointvec(struct ctl_table *table, int write,
3344− void __user *buffer, size_t *lenp, loff_t *ppos)
1549+int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
1550+ void *buffer, size_t *lenp, loff_t *ppos)
33451551 {
33461552 return -ENOSYS;
33471553 }
33481554
3349−int proc_douintvec(struct ctl_table *table, int write,
3350− void __user *buffer, size_t *lenp, loff_t *ppos)
1555+int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
1556+ void *buffer, size_t *lenp, loff_t *ppos)
33511557 {
33521558 return -ENOSYS;
33531559 }
33541560
3355−int proc_dointvec_minmax(struct ctl_table *table, int write,
3356− void __user *buffer, size_t *lenp, loff_t *ppos)
1561+int proc_doulongvec_minmax(struct ctl_table *table, int write,
1562+ void *buffer, size_t *lenp, loff_t *ppos)
33571563 {
33581564 return -ENOSYS;
33591565 }
33601566
3361−int proc_douintvec_minmax(struct ctl_table *table, int write,
3362− void __user *buffer, size_t *lenp, loff_t *ppos)
1567+int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
1568+ void *buffer, size_t *lenp, loff_t *ppos)
1569+{
1570+ return -ENOSYS;
1571+}
1572+
1573+int proc_do_large_bitmap(struct ctl_table *table, int write,
1574+ void *buffer, size_t *lenp, loff_t *ppos)
33631575 {
33641576 return -ENOSYS;
33651577 }
33661578
3367−int proc_dointvec_jiffies(struct ctl_table *table, int write,
3368− void __user *buffer, size_t *lenp, loff_t *ppos)
3369−{
3370− return -ENOSYS;
3371−}
1579+#endif /* CONFIG_PROC_SYSCTL */
1580+
1581+#if defined(CONFIG_SYSCTL)
1582+int proc_do_static_key(struct ctl_table *table, int write,
1583+ void *buffer, size_t *lenp, loff_t *ppos)
1584+{
1585+ struct static_key *key = (struct static_key *)table->data;
1586+ static DEFINE_MUTEX(static_key_mutex);
1587+ int val, ret;
1588+ struct ctl_table tmp = {
1589+ .data = &val,
1590+ .maxlen = sizeof(val),
1591+ .mode = table->mode,
1592+ .extra1 = SYSCTL_ZERO,
1593+ .extra2 = SYSCTL_ONE,
1594+ };
1595+
1596+ if (write && !capable(CAP_SYS_ADMIN))
1597+ return -EPERM;
1598+
1599+ mutex_lock(&static_key_mutex);
1600+ val = static_key_enabled(key);
1601+ ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
1602+ if (write && !ret) {
1603+ if (val)
1604+ static_key_enable(key);
1605+ else
1606+ static_key_disable(key);
1607+ }
1608+ mutex_unlock(&static_key_mutex);
1609+ return ret;
1610+}
1611+
1612+static struct ctl_table kern_table[] = {
1613+ {
1614+ .procname = "sched_child_runs_first",
1615+ .data = &sysctl_sched_child_runs_first,
1616+ .maxlen = sizeof(unsigned int),
1617+ .mode = 0644,
1618+ .proc_handler = proc_dointvec,
1619+ },
1620+#ifdef CONFIG_SCHED_DEBUG
1621+ {
1622+ .procname = "sched_min_granularity_ns",
1623+ .data = &sysctl_sched_min_granularity,
1624+ .maxlen = sizeof(unsigned int),
1625+ .mode = 0644,
1626+ .proc_handler = sched_proc_update_handler,
1627+ .extra1 = &min_sched_granularity_ns,
1628+ .extra2 = &max_sched_granularity_ns,
1629+ },
1630+ {
1631+ .procname = "sched_latency_ns",
1632+ .data = &sysctl_sched_latency,
1633+ .maxlen = sizeof(unsigned int),
1634+ .mode = 0644,
1635+ .proc_handler = sched_proc_update_handler,
1636+ .extra1 = &min_sched_granularity_ns,
1637+ .extra2 = &max_sched_granularity_ns,
1638+ },
1639+ {
1640+ .procname = "sched_wakeup_granularity_ns",
1641+ .data = &sysctl_sched_wakeup_granularity,
1642+ .maxlen = sizeof(unsigned int),
1643+ .mode = 0644,
1644+ .proc_handler = sched_proc_update_handler,
1645+ .extra1 = &min_wakeup_granularity_ns,
1646+ .extra2 = &max_wakeup_granularity_ns,
1647+ },
1648+#ifdef CONFIG_SMP
1649+ {
1650+ .procname = "sched_tunable_scaling",
1651+ .data = &sysctl_sched_tunable_scaling,
1652+ .maxlen = sizeof(enum sched_tunable_scaling),
1653+ .mode = 0644,
1654+ .proc_handler = sched_proc_update_handler,
1655+ .extra1 = &min_sched_tunable_scaling,
1656+ .extra2 = &max_sched_tunable_scaling,
1657+ },
1658+ {
1659+ .procname = "sched_migration_cost_ns",
1660+ .data = &sysctl_sched_migration_cost,
1661+ .maxlen = sizeof(unsigned int),
1662+ .mode = 0644,
1663+ .proc_handler = proc_dointvec,
1664+ },
1665+ {
1666+ .procname = "sched_nr_migrate",
1667+ .data = &sysctl_sched_nr_migrate,
1668+ .maxlen = sizeof(unsigned int),
1669+ .mode = 0644,
1670+ .proc_handler = proc_dointvec,
1671+ },
1672+#ifdef CONFIG_SCHEDSTATS
1673+ {
1674+ .procname = "sched_schedstats",
1675+ .data = NULL,
1676+ .maxlen = sizeof(unsigned int),
1677+ .mode = 0644,
1678+ .proc_handler = sysctl_schedstats,
1679+ .extra1 = SYSCTL_ZERO,
1680+ .extra2 = SYSCTL_ONE,
1681+ },
1682+#endif /* CONFIG_SCHEDSTATS */
1683+#endif /* CONFIG_SMP */
1684+#ifdef CONFIG_NUMA_BALANCING
1685+ {
1686+ .procname = "numa_balancing_scan_delay_ms",
1687+ .data = &sysctl_numa_balancing_scan_delay,
1688+ .maxlen = sizeof(unsigned int),
1689+ .mode = 0644,
1690+ .proc_handler = proc_dointvec,
1691+ },
1692+ {
1693+ .procname = "numa_balancing_scan_period_min_ms",
1694+ .data = &sysctl_numa_balancing_scan_period_min,
1695+ .maxlen = sizeof(unsigned int),
1696+ .mode = 0644,
1697+ .proc_handler = proc_dointvec,
1698+ },
1699+ {
1700+ .procname = "numa_balancing_scan_period_max_ms",
1701+ .data = &sysctl_numa_balancing_scan_period_max,
1702+ .maxlen = sizeof(unsigned int),
1703+ .mode = 0644,
1704+ .proc_handler = proc_dointvec,
1705+ },
1706+ {
1707+ .procname = "numa_balancing_scan_size_mb",
1708+ .data = &sysctl_numa_balancing_scan_size,
1709+ .maxlen = sizeof(unsigned int),
1710+ .mode = 0644,
1711+ .proc_handler = proc_dointvec_minmax,
1712+ .extra1 = SYSCTL_ONE,
1713+ },
1714+ {
1715+ .procname = "numa_balancing",
1716+ .data = NULL, /* filled in by handler */
1717+ .maxlen = sizeof(unsigned int),
1718+ .mode = 0644,
1719+ .proc_handler = sysctl_numa_balancing,
1720+ .extra1 = SYSCTL_ZERO,
1721+ .extra2 = SYSCTL_ONE,
1722+ },
1723+#endif /* CONFIG_NUMA_BALANCING */
1724+#endif /* CONFIG_SCHED_DEBUG */
1725+ {
1726+ .procname = "sched_rt_period_us",
1727+ .data = &sysctl_sched_rt_period,
1728+ .maxlen = sizeof(unsigned int),
1729+ .mode = 0644,
1730+ .proc_handler = sched_rt_handler,
1731+ },
1732+ {
1733+ .procname = "sched_rt_runtime_us",
1734+ .data = &sysctl_sched_rt_runtime,
1735+ .maxlen = sizeof(int),
1736+ .mode = 0644,
1737+ .proc_handler = sched_rt_handler,
1738+ },
1739+ {
1740+ .procname = "sched_rr_timeslice_ms",
1741+ .data = &sysctl_sched_rr_timeslice,
1742+ .maxlen = sizeof(int),
1743+ .mode = 0644,
1744+ .proc_handler = sched_rr_handler,
1745+ },
1746+#ifdef CONFIG_UCLAMP_TASK
1747+ {
1748+ .procname = "sched_util_clamp_min",
1749+ .data = &sysctl_sched_uclamp_util_min,
1750+ .maxlen = sizeof(unsigned int),
1751+ .mode = 0644,
1752+ .proc_handler = sysctl_sched_uclamp_handler,
1753+ },
1754+ {
1755+ .procname = "sched_util_clamp_max",
1756+ .data = &sysctl_sched_uclamp_util_max,
1757+ .maxlen = sizeof(unsigned int),
1758+ .mode = 0644,
1759+ .proc_handler = sysctl_sched_uclamp_handler,
1760+ },
1761+#endif
1762+#ifdef CONFIG_SCHED_AUTOGROUP
1763+ {
1764+ .procname = "sched_autogroup_enabled",
1765+ .data = &sysctl_sched_autogroup_enabled,
1766+ .maxlen = sizeof(unsigned int),
1767+ .mode = 0644,
1768+ .proc_handler = proc_dointvec_minmax,
1769+ .extra1 = SYSCTL_ZERO,
1770+ .extra2 = SYSCTL_ONE,
1771+ },
1772+#endif
1773+#ifdef CONFIG_CFS_BANDWIDTH
1774+ {
1775+ .procname = "sched_cfs_bandwidth_slice_us",
1776+ .data = &sysctl_sched_cfs_bandwidth_slice,
1777+ .maxlen = sizeof(unsigned int),
1778+ .mode = 0644,
1779+ .proc_handler = proc_dointvec_minmax,
1780+ .extra1 = SYSCTL_ONE,
1781+ },
1782+#endif
1783+#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
1784+ {
1785+ .procname = "sched_energy_aware",
1786+ .data = &sysctl_sched_energy_aware,
1787+ .maxlen = sizeof(unsigned int),
1788+ .mode = 0644,
1789+ .proc_handler = sched_energy_aware_handler,
1790+ .extra1 = SYSCTL_ZERO,
1791+ .extra2 = SYSCTL_ONE,
1792+ },
1793+#endif
1794+#ifdef CONFIG_PROVE_LOCKING
1795+ {
1796+ .procname = "prove_locking",
1797+ .data = &prove_locking,
1798+ .maxlen = sizeof(int),
1799+ .mode = 0644,
1800+ .proc_handler = proc_dointvec,
1801+ },
1802+#endif
1803+#ifdef CONFIG_LOCK_STAT
1804+ {
1805+ .procname = "lock_stat",
1806+ .data = &lock_stat,
1807+ .maxlen = sizeof(int),
1808+ .mode = 0644,
1809+ .proc_handler = proc_dointvec,
1810+ },
1811+#endif
1812+ {
1813+ .procname = "panic",
1814+ .data = &panic_timeout,
1815+ .maxlen = sizeof(int),
1816+ .mode = 0644,
1817+ .proc_handler = proc_dointvec,
1818+ },
1819+#ifdef CONFIG_COREDUMP
1820+ {
1821+ .procname = "core_uses_pid",
1822+ .data = &core_uses_pid,
1823+ .maxlen = sizeof(int),
1824+ .mode = 0644,
1825+ .proc_handler = proc_dointvec,
1826+ },
1827+ {
1828+ .procname = "core_pattern",
1829+ .data = core_pattern,
1830+ .maxlen = CORENAME_MAX_SIZE,
1831+ .mode = 0644,
1832+ .proc_handler = proc_dostring_coredump,
1833+ },
1834+ {
1835+ .procname = "core_pipe_limit",
1836+ .data = &core_pipe_limit,
1837+ .maxlen = sizeof(unsigned int),
1838+ .mode = 0644,
1839+ .proc_handler = proc_dointvec,
1840+ },
1841+#endif
1842+#ifdef CONFIG_PROC_SYSCTL
1843+ {
1844+ .procname = "tainted",
1845+ .maxlen = sizeof(long),
1846+ .mode = 0644,
1847+ .proc_handler = proc_taint,
1848+ },
1849+ {
1850+ .procname = "sysctl_writes_strict",
1851+ .data = &sysctl_writes_strict,
1852+ .maxlen = sizeof(int),
1853+ .mode = 0644,
1854+ .proc_handler = proc_dointvec_minmax,
1855+ .extra1 = &neg_one,
1856+ .extra2 = SYSCTL_ONE,
1857+ },
1858+#endif
1859+#ifdef CONFIG_LATENCYTOP
1860+ {
1861+ .procname = "latencytop",
1862+ .data = &latencytop_enabled,
1863+ .maxlen = sizeof(int),
1864+ .mode = 0644,
1865+ .proc_handler = sysctl_latencytop,
1866+ },
1867+#endif
1868+#ifdef CONFIG_BLK_DEV_INITRD
1869+ {
1870+ .procname = "real-root-dev",
1871+ .data = &real_root_dev,
1872+ .maxlen = sizeof(int),
1873+ .mode = 0644,
1874+ .proc_handler = proc_dointvec,
1875+ },
1876+#endif
1877+ {
1878+ .procname = "print-fatal-signals",
1879+ .data = &print_fatal_signals,
1880+ .maxlen = sizeof(int),
1881+ .mode = 0644,
1882+ .proc_handler = proc_dointvec,
1883+ },
1884+#ifdef CONFIG_SPARC
1885+ {
1886+ .procname = "reboot-cmd",
1887+ .data = reboot_command,
1888+ .maxlen = 256,
1889+ .mode = 0644,
1890+ .proc_handler = proc_dostring,
1891+ },
1892+ {
1893+ .procname = "stop-a",
1894+ .data = &stop_a_enabled,
1895+ .maxlen = sizeof (int),
1896+ .mode = 0644,
1897+ .proc_handler = proc_dointvec,
1898+ },
1899+ {
1900+ .procname = "scons-poweroff",
1901+ .data = &scons_pwroff,
1902+ .maxlen = sizeof (int),
1903+ .mode = 0644,
1904+ .proc_handler = proc_dointvec,
1905+ },
1906+#endif
1907+#ifdef CONFIG_SPARC64
1908+ {
1909+ .procname = "tsb-ratio",
1910+ .data = &sysctl_tsb_ratio,
1911+ .maxlen = sizeof (int),
1912+ .mode = 0644,
1913+ .proc_handler = proc_dointvec,
1914+ },
1915+#endif
1916+#ifdef CONFIG_PARISC
1917+ {
1918+ .procname = "soft-power",
1919+ .data = &pwrsw_enabled,
1920+ .maxlen = sizeof (int),
1921+ .mode = 0644,
1922+ .proc_handler = proc_dointvec,
1923+ },
1924+#endif
1925+#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
1926+ {
1927+ .procname = "unaligned-trap",
1928+ .data = &unaligned_enabled,
1929+ .maxlen = sizeof (int),
1930+ .mode = 0644,
1931+ .proc_handler = proc_dointvec,
1932+ },
1933+#endif
1934+ {
1935+ .procname = "ctrl-alt-del",
1936+ .data = &C_A_D,
1937+ .maxlen = sizeof(int),
1938+ .mode = 0644,
1939+ .proc_handler = proc_dointvec,
1940+ },
1941+#ifdef CONFIG_FUNCTION_TRACER
1942+ {
1943+ .procname = "ftrace_enabled",
1944+ .data = &ftrace_enabled,
1945+ .maxlen = sizeof(int),
1946+ .mode = 0644,
1947+ .proc_handler = ftrace_enable_sysctl,
1948+ },
1949+#endif
1950+#ifdef CONFIG_STACK_TRACER
1951+ {
1952+ .procname = "stack_tracer_enabled",
1953+ .data = &stack_tracer_enabled,
1954+ .maxlen = sizeof(int),
1955+ .mode = 0644,
1956+ .proc_handler = stack_trace_sysctl,
1957+ },
1958+#endif
1959+#ifdef CONFIG_TRACING
1960+ {
1961+ .procname = "ftrace_dump_on_oops",
1962+ .data = &ftrace_dump_on_oops,
1963+ .maxlen = sizeof(int),
1964+ .mode = 0644,
1965+ .proc_handler = proc_dointvec,
1966+ },
1967+ {
1968+ .procname = "traceoff_on_warning",
1969+ .data = &__disable_trace_on_warning,
1970+ .maxlen = sizeof(__disable_trace_on_warning),
1971+ .mode = 0644,
1972+ .proc_handler = proc_dointvec,
1973+ },
1974+ {
1975+ .procname = "tracepoint_printk",
1976+ .data = &tracepoint_printk,
1977+ .maxlen = sizeof(tracepoint_printk),
1978+ .mode = 0644,
1979+ .proc_handler = tracepoint_printk_sysctl,
1980+ },
1981+#endif
1982+#ifdef CONFIG_KEXEC_CORE
1983+ {
1984+ .procname = "kexec_load_disabled",
1985+ .data = &kexec_load_disabled,
1986+ .maxlen = sizeof(int),
1987+ .mode = 0644,
1988+ /* only handle a transition from default "0" to "1" */
1989+ .proc_handler = proc_dointvec_minmax,
1990+ .extra1 = SYSCTL_ONE,
1991+ .extra2 = SYSCTL_ONE,
1992+ },
1993+#endif
1994+#ifdef CONFIG_MODULES
1995+ {
1996+ .procname = "modprobe",
1997+ .data = &modprobe_path,
1998+ .maxlen = KMOD_PATH_LEN,
1999+ .mode = 0644,
2000+ .proc_handler = proc_dostring,
2001+ },
2002+ {
2003+ .procname = "modules_disabled",
2004+ .data = &modules_disabled,
2005+ .maxlen = sizeof(int),
2006+ .mode = 0644,
2007+ /* only handle a transition from default "0" to "1" */
2008+ .proc_handler = proc_dointvec_minmax,
2009+ .extra1 = SYSCTL_ONE,
2010+ .extra2 = SYSCTL_ONE,
2011+ },
2012+#endif
2013+#ifdef CONFIG_UEVENT_HELPER
2014+ {
2015+ .procname = "hotplug",
2016+ .data = &uevent_helper,
2017+ .maxlen = UEVENT_HELPER_PATH_LEN,
2018+ .mode = 0644,
2019+ .proc_handler = proc_dostring,
2020+ },
2021+#endif
2022+#ifdef CONFIG_CHR_DEV_SG
2023+ {
2024+ .procname = "sg-big-buff",
2025+ .data = &sg_big_buff,
2026+ .maxlen = sizeof (int),
2027+ .mode = 0444,
2028+ .proc_handler = proc_dointvec,
2029+ },
2030+#endif
2031+#ifdef CONFIG_BSD_PROCESS_ACCT
2032+ {
2033+ .procname = "acct",
2034+ .data = &acct_parm,
2035+ .maxlen = 3*sizeof(int),
2036+ .mode = 0644,
2037+ .proc_handler = proc_dointvec,
2038+ },
2039+#endif
2040+#ifdef CONFIG_MAGIC_SYSRQ
2041+ {
2042+ .procname = "sysrq",
2043+ .data = NULL,
2044+ .maxlen = sizeof (int),
2045+ .mode = 0644,
2046+ .proc_handler = sysrq_sysctl_handler,
2047+ },
2048+#endif
2049+#ifdef CONFIG_PROC_SYSCTL
2050+ {
2051+ .procname = "cad_pid",
2052+ .data = NULL,
2053+ .maxlen = sizeof (int),
2054+ .mode = 0600,
2055+ .proc_handler = proc_do_cad_pid,
2056+ },
2057+#endif
2058+ {
2059+ .procname = "threads-max",
2060+ .data = NULL,
2061+ .maxlen = sizeof(int),
2062+ .mode = 0644,
2063+ .proc_handler = sysctl_max_threads,
2064+ },
2065+ {
2066+ .procname = "random",
2067+ .mode = 0555,
2068+ .child = random_table,
2069+ },
2070+ {
2071+ .procname = "usermodehelper",
2072+ .mode = 0555,
2073+ .child = usermodehelper_table,
2074+ },
2075+#ifdef CONFIG_FW_LOADER_USER_HELPER
2076+ {
2077+ .procname = "firmware_config",
2078+ .mode = 0555,
2079+ .child = firmware_config_table,
2080+ },
2081+#endif
2082+ {
2083+ .procname = "overflowuid",
2084+ .data = &overflowuid,
2085+ .maxlen = sizeof(int),
2086+ .mode = 0644,
2087+ .proc_handler = proc_dointvec_minmax,
2088+ .extra1 = &minolduid,
2089+ .extra2 = &maxolduid,
2090+ },
2091+ {
2092+ .procname = "overflowgid",
2093+ .data = &overflowgid,
2094+ .maxlen = sizeof(int),
2095+ .mode = 0644,
2096+ .proc_handler = proc_dointvec_minmax,
2097+ .extra1 = &minolduid,
2098+ .extra2 = &maxolduid,
2099+ },
2100+#ifdef CONFIG_S390
2101+ {
2102+ .procname = "userprocess_debug",
2103+ .data = &show_unhandled_signals,
2104+ .maxlen = sizeof(int),
2105+ .mode = 0644,
2106+ .proc_handler = proc_dointvec,
2107+ },
2108+#endif
2109+ {
2110+ .procname = "pid_max",
2111+ .data = &pid_max,
2112+ .maxlen = sizeof (int),
2113+ .mode = 0644,
2114+ .proc_handler = proc_dointvec_minmax,
2115+ .extra1 = &pid_max_min,
2116+ .extra2 = &pid_max_max,
2117+ },
2118+ {
2119+ .procname = "panic_on_oops",
2120+ .data = &panic_on_oops,
2121+ .maxlen = sizeof(int),
2122+ .mode = 0644,
2123+ .proc_handler = proc_dointvec,
2124+ },
2125+ {
2126+ .procname = "panic_print",
2127+ .data = &panic_print,
2128+ .maxlen = sizeof(unsigned long),
2129+ .mode = 0644,
2130+ .proc_handler = proc_doulongvec_minmax,
2131+ },
2132+#if defined CONFIG_PRINTK
2133+ {
2134+ .procname = "printk",
2135+ .data = &console_loglevel,
2136+ .maxlen = 4*sizeof(int),
2137+ .mode = 0644,
2138+ .proc_handler = proc_dointvec,
2139+ },
2140+ {
2141+ .procname = "printk_ratelimit",
2142+ .data = &printk_ratelimit_state.interval,
2143+ .maxlen = sizeof(int),
2144+ .mode = 0644,
2145+ .proc_handler = proc_dointvec_jiffies,
2146+ },
2147+ {
2148+ .procname = "printk_ratelimit_burst",
2149+ .data = &printk_ratelimit_state.burst,
2150+ .maxlen = sizeof(int),
2151+ .mode = 0644,
2152+ .proc_handler = proc_dointvec,
2153+ },
2154+ {
2155+ .procname = "printk_delay",
2156+ .data = &printk_delay_msec,
2157+ .maxlen = sizeof(int),
2158+ .mode = 0644,
2159+ .proc_handler = proc_dointvec_minmax,
2160+ .extra1 = SYSCTL_ZERO,
2161+ .extra2 = &ten_thousand,
2162+ },
2163+ {
2164+ .procname = "printk_devkmsg",
2165+ .data = devkmsg_log_str,
2166+ .maxlen = DEVKMSG_STR_MAX_SIZE,
2167+ .mode = 0644,
2168+ .proc_handler = devkmsg_sysctl_set_loglvl,
2169+ },
2170+ {
2171+ .procname = "dmesg_restrict",
2172+ .data = &dmesg_restrict,
2173+ .maxlen = sizeof(int),
2174+ .mode = 0644,
2175+ .proc_handler = proc_dointvec_minmax_sysadmin,
2176+ .extra1 = SYSCTL_ZERO,
2177+ .extra2 = SYSCTL_ONE,
2178+ },
2179+ {
2180+ .procname = "kptr_restrict",
2181+ .data = &kptr_restrict,
2182+ .maxlen = sizeof(int),
2183+ .mode = 0644,
2184+ .proc_handler = proc_dointvec_minmax_sysadmin,
2185+ .extra1 = SYSCTL_ZERO,
2186+ .extra2 = &two,
2187+ },
2188+#endif
2189+ {
2190+ .procname = "ngroups_max",
2191+ .data = &ngroups_max,
2192+ .maxlen = sizeof (int),
2193+ .mode = 0444,
2194+ .proc_handler = proc_dointvec,
2195+ },
2196+ {
2197+ .procname = "cap_last_cap",
2198+ .data = (void *)&cap_last_cap,
2199+ .maxlen = sizeof(int),
2200+ .mode = 0444,
2201+ .proc_handler = proc_dointvec,
2202+ },
2203+#if defined(CONFIG_LOCKUP_DETECTOR)
2204+ {
2205+ .procname = "watchdog",
2206+ .data = &watchdog_user_enabled,
2207+ .maxlen = sizeof(int),
2208+ .mode = 0644,
2209+ .proc_handler = proc_watchdog,
2210+ .extra1 = SYSCTL_ZERO,
2211+ .extra2 = SYSCTL_ONE,
2212+ },
2213+ {
2214+ .procname = "watchdog_thresh",
2215+ .data = &watchdog_thresh,
2216+ .maxlen = sizeof(int),
2217+ .mode = 0644,
2218+ .proc_handler = proc_watchdog_thresh,
2219+ .extra1 = SYSCTL_ZERO,
2220+ .extra2 = &sixty,
2221+ },
2222+ {
2223+ .procname = "nmi_watchdog",
2224+ .data = &nmi_watchdog_user_enabled,
2225+ .maxlen = sizeof(int),
2226+ .mode = NMI_WATCHDOG_SYSCTL_PERM,
2227+ .proc_handler = proc_nmi_watchdog,
2228+ .extra1 = SYSCTL_ZERO,
2229+ .extra2 = SYSCTL_ONE,
2230+ },
2231+ {
2232+ .procname = "watchdog_cpumask",
2233+ .data = &watchdog_cpumask_bits,
2234+ .maxlen = NR_CPUS,
2235+ .mode = 0644,
2236+ .proc_handler = proc_watchdog_cpumask,
2237+ },
2238+#ifdef CONFIG_SOFTLOCKUP_DETECTOR
2239+ {
2240+ .procname = "soft_watchdog",
2241+ .data = &soft_watchdog_user_enabled,
2242+ .maxlen = sizeof(int),
2243+ .mode = 0644,
2244+ .proc_handler = proc_soft_watchdog,
2245+ .extra1 = SYSCTL_ZERO,
2246+ .extra2 = SYSCTL_ONE,
2247+ },
2248+ {
2249+ .procname = "softlockup_panic",
2250+ .data = &softlockup_panic,
2251+ .maxlen = sizeof(int),
2252+ .mode = 0644,
2253+ .proc_handler = proc_dointvec_minmax,
2254+ .extra1 = SYSCTL_ZERO,
2255+ .extra2 = SYSCTL_ONE,
2256+ },
2257+#ifdef CONFIG_SMP
2258+ {
2259+ .procname = "softlockup_all_cpu_backtrace",
2260+ .data = &sysctl_softlockup_all_cpu_backtrace,
2261+ .maxlen = sizeof(int),
2262+ .mode = 0644,
2263+ .proc_handler = proc_dointvec_minmax,
2264+ .extra1 = SYSCTL_ZERO,
2265+ .extra2 = SYSCTL_ONE,
2266+ },
2267+#endif /* CONFIG_SMP */
2268+#endif
2269+#ifdef CONFIG_HARDLOCKUP_DETECTOR
2270+ {
2271+ .procname = "hardlockup_panic",
2272+ .data = &hardlockup_panic,
2273+ .maxlen = sizeof(int),
2274+ .mode = 0644,
2275+ .proc_handler = proc_dointvec_minmax,
2276+ .extra1 = SYSCTL_ZERO,
2277+ .extra2 = SYSCTL_ONE,
2278+ },
2279+#ifdef CONFIG_SMP
2280+ {
2281+ .procname = "hardlockup_all_cpu_backtrace",
2282+ .data = &sysctl_hardlockup_all_cpu_backtrace,
2283+ .maxlen = sizeof(int),
2284+ .mode = 0644,
2285+ .proc_handler = proc_dointvec_minmax,
2286+ .extra1 = SYSCTL_ZERO,
2287+ .extra2 = SYSCTL_ONE,
2288+ },
2289+#endif /* CONFIG_SMP */
2290+#endif
2291+#endif
2292+
2293+#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
2294+ {
2295+ .procname = "unknown_nmi_panic",
2296+ .data = &unknown_nmi_panic,
2297+ .maxlen = sizeof (int),
2298+ .mode = 0644,
2299+ .proc_handler = proc_dointvec,
2300+ },
2301+#endif
2302+#if defined(CONFIG_X86)
2303+ {
2304+ .procname = "panic_on_unrecovered_nmi",
2305+ .data = &panic_on_unrecovered_nmi,
2306+ .maxlen = sizeof(int),
2307+ .mode = 0644,
2308+ .proc_handler = proc_dointvec,
2309+ },
2310+ {
2311+ .procname = "panic_on_io_nmi",
2312+ .data = &panic_on_io_nmi,
2313+ .maxlen = sizeof(int),
2314+ .mode = 0644,
2315+ .proc_handler = proc_dointvec,
2316+ },
2317+#ifdef CONFIG_DEBUG_STACKOVERFLOW
2318+ {
2319+ .procname = "panic_on_stackoverflow",
2320+ .data = &sysctl_panic_on_stackoverflow,
2321+ .maxlen = sizeof(int),
2322+ .mode = 0644,
2323+ .proc_handler = proc_dointvec,
2324+ },
2325+#endif
2326+ {
2327+ .procname = "bootloader_type",
2328+ .data = &bootloader_type,
2329+ .maxlen = sizeof (int),
2330+ .mode = 0444,
2331+ .proc_handler = proc_dointvec,
2332+ },
2333+ {
2334+ .procname = "bootloader_version",
2335+ .data = &bootloader_version,
2336+ .maxlen = sizeof (int),
2337+ .mode = 0444,
2338+ .proc_handler = proc_dointvec,
2339+ },
2340+ {
2341+ .procname = "io_delay_type",
2342+ .data = &io_delay_type,
2343+ .maxlen = sizeof(int),
2344+ .mode = 0644,
2345+ .proc_handler = proc_dointvec,
2346+ },
2347+#endif
2348+#if defined(CONFIG_MMU)
2349+ {
2350+ .procname = "randomize_va_space",
2351+ .data = &randomize_va_space,
2352+ .maxlen = sizeof(int),
2353+ .mode = 0644,
2354+ .proc_handler = proc_dointvec,
2355+ },
2356+#endif
2357+#if defined(CONFIG_S390) && defined(CONFIG_SMP)
2358+ {
2359+ .procname = "spin_retry",
2360+ .data = &spin_retry,
2361+ .maxlen = sizeof (int),
2362+ .mode = 0644,
2363+ .proc_handler = proc_dointvec,
2364+ },
2365+#endif
2366+#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
2367+ {
2368+ .procname = "acpi_video_flags",
2369+ .data = &acpi_realmode_flags,
2370+ .maxlen = sizeof (unsigned long),
2371+ .mode = 0644,
2372+ .proc_handler = proc_doulongvec_minmax,
2373+ },
2374+#endif
2375+#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
2376+ {
2377+ .procname = "ignore-unaligned-usertrap",
2378+ .data = &no_unaligned_warning,
2379+ .maxlen = sizeof (int),
2380+ .mode = 0644,
2381+ .proc_handler = proc_dointvec,
2382+ },
2383+#endif
2384+#ifdef CONFIG_IA64
2385+ {
2386+ .procname = "unaligned-dump-stack",
2387+ .data = &unaligned_dump_stack,
2388+ .maxlen = sizeof (int),
2389+ .mode = 0644,
2390+ .proc_handler = proc_dointvec,
2391+ },
2392+#endif
2393+#ifdef CONFIG_DETECT_HUNG_TASK
2394+ {
2395+ .procname = "hung_task_panic",
2396+ .data = &sysctl_hung_task_panic,
2397+ .maxlen = sizeof(int),
2398+ .mode = 0644,
2399+ .proc_handler = proc_dointvec_minmax,
2400+ .extra1 = SYSCTL_ZERO,
2401+ .extra2 = SYSCTL_ONE,
2402+ },
2403+ {
2404+ .procname = "hung_task_check_count",
2405+ .data = &sysctl_hung_task_check_count,
2406+ .maxlen = sizeof(int),
2407+ .mode = 0644,
2408+ .proc_handler = proc_dointvec_minmax,
2409+ .extra1 = SYSCTL_ZERO,
2410+ },
2411+ {
2412+ .procname = "hung_task_timeout_secs",
2413+ .data = &sysctl_hung_task_timeout_secs,
2414+ .maxlen = sizeof(unsigned long),
2415+ .mode = 0644,
2416+ .proc_handler = proc_dohung_task_timeout_secs,
2417+ .extra2 = &hung_task_timeout_max,
2418+ },
2419+ {
2420+ .procname = "hung_task_check_interval_secs",
2421+ .data = &sysctl_hung_task_check_interval_secs,
2422+ .maxlen = sizeof(unsigned long),
2423+ .mode = 0644,
2424+ .proc_handler = proc_dohung_task_timeout_secs,
2425+ .extra2 = &hung_task_timeout_max,
2426+ },
2427+ {
2428+ .procname = "hung_task_warnings",
2429+ .data = &sysctl_hung_task_warnings,
2430+ .maxlen = sizeof(int),
2431+ .mode = 0644,
2432+ .proc_handler = proc_dointvec_minmax,
2433+ .extra1 = &neg_one,
2434+ },
2435+#endif
2436+#ifdef CONFIG_RT_MUTEXES
2437+ {
2438+ .procname = "max_lock_depth",
2439+ .data = &max_lock_depth,
2440+ .maxlen = sizeof(int),
2441+ .mode = 0644,
2442+ .proc_handler = proc_dointvec,
2443+ },
2444+#endif
2445+ {
2446+ .procname = "poweroff_cmd",
2447+ .data = &poweroff_cmd,
2448+ .maxlen = POWEROFF_CMD_PATH_LEN,
2449+ .mode = 0644,
2450+ .proc_handler = proc_dostring,
2451+ },
2452+#ifdef CONFIG_KEYS
2453+ {
2454+ .procname = "keys",
2455+ .mode = 0555,
2456+ .child = key_sysctls,
2457+ },
2458+#endif
2459+#ifdef CONFIG_PERF_EVENTS
2460+ /*
2461+ * User-space scripts rely on the existence of this file
2462+ * as a feature check for perf_events being enabled.
2463+ *
2464+ * So it's an ABI, do not remove!
2465+ */
2466+ {
2467+ .procname = "perf_event_paranoid",
2468+ .data = &sysctl_perf_event_paranoid,
2469+ .maxlen = sizeof(sysctl_perf_event_paranoid),
2470+ .mode = 0644,
2471+ .proc_handler = proc_dointvec,
2472+ },
2473+ {
2474+ .procname = "perf_event_mlock_kb",
2475+ .data = &sysctl_perf_event_mlock,
2476+ .maxlen = sizeof(sysctl_perf_event_mlock),
2477+ .mode = 0644,
2478+ .proc_handler = proc_dointvec,
2479+ },
2480+ {
2481+ .procname = "perf_event_max_sample_rate",
2482+ .data = &sysctl_perf_event_sample_rate,
2483+ .maxlen = sizeof(sysctl_perf_event_sample_rate),
2484+ .mode = 0644,
2485+ .proc_handler = perf_proc_update_handler,
2486+ .extra1 = SYSCTL_ONE,
2487+ },
2488+ {
2489+ .procname = "perf_cpu_time_max_percent",
2490+ .data = &sysctl_perf_cpu_time_max_percent,
2491+ .maxlen = sizeof(sysctl_perf_cpu_time_max_percent),
2492+ .mode = 0644,
2493+ .proc_handler = perf_cpu_time_max_percent_handler,
2494+ .extra1 = SYSCTL_ZERO,
2495+ .extra2 = &one_hundred,
2496+ },
2497+ {
2498+ .procname = "perf_event_max_stack",
2499+ .data = &sysctl_perf_event_max_stack,
2500+ .maxlen = sizeof(sysctl_perf_event_max_stack),
2501+ .mode = 0644,
2502+ .proc_handler = perf_event_max_stack_handler,
2503+ .extra1 = SYSCTL_ZERO,
2504+ .extra2 = &six_hundred_forty_kb,
2505+ },
2506+ {
2507+ .procname = "perf_event_max_contexts_per_stack",
2508+ .data = &sysctl_perf_event_max_contexts_per_stack,
2509+ .maxlen = sizeof(sysctl_perf_event_max_contexts_per_stack),
2510+ .mode = 0644,
2511+ .proc_handler = perf_event_max_stack_handler,
2512+ .extra1 = SYSCTL_ZERO,
2513+ .extra2 = &one_thousand,
2514+ },
2515+#endif
2516+ {
2517+ .procname = "panic_on_warn",
2518+ .data = &panic_on_warn,
2519+ .maxlen = sizeof(int),
2520+ .mode = 0644,
2521+ .proc_handler = proc_dointvec_minmax,
2522+ .extra1 = SYSCTL_ZERO,
2523+ .extra2 = SYSCTL_ONE,
2524+ },
2525+#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
2526+ {
2527+ .procname = "timer_migration",
2528+ .data = &sysctl_timer_migration,
2529+ .maxlen = sizeof(unsigned int),
2530+ .mode = 0644,
2531+ .proc_handler = timer_migration_handler,
2532+ .extra1 = SYSCTL_ZERO,
2533+ .extra2 = SYSCTL_ONE,
2534+ },
2535+#endif
2536+#ifdef CONFIG_BPF_SYSCALL
2537+ {
2538+ .procname = "unprivileged_bpf_disabled",
2539+ .data = &sysctl_unprivileged_bpf_disabled,
2540+ .maxlen = sizeof(sysctl_unprivileged_bpf_disabled),
2541+ .mode = 0644,
2542+ /* only handle a transition from default "0" to "1" */
2543+ .proc_handler = proc_dointvec_minmax,
2544+ .extra1 = SYSCTL_ONE,
2545+ .extra2 = SYSCTL_ONE,
2546+ },
2547+ {
2548+ .procname = "bpf_stats_enabled",
2549+ .data = &bpf_stats_enabled_key.key,
2550+ .maxlen = sizeof(bpf_stats_enabled_key),
2551+ .mode = 0644,
2552+ .proc_handler = proc_do_static_key,
2553+ },
2554+#endif
2555+#if defined(CONFIG_TREE_RCU)
2556+ {
2557+ .procname = "panic_on_rcu_stall",
2558+ .data = &sysctl_panic_on_rcu_stall,
2559+ .maxlen = sizeof(sysctl_panic_on_rcu_stall),
2560+ .mode = 0644,
2561+ .proc_handler = proc_dointvec_minmax,
2562+ .extra1 = SYSCTL_ZERO,
2563+ .extra2 = SYSCTL_ONE,
2564+ },
2565+#endif
2566+#ifdef CONFIG_STACKLEAK_RUNTIME_DISABLE
2567+ {
2568+ .procname = "stack_erasing",
2569+ .data = NULL,
2570+ .maxlen = sizeof(int),
2571+ .mode = 0600,
2572+ .proc_handler = stack_erasing_sysctl,
2573+ .extra1 = SYSCTL_ZERO,
2574+ .extra2 = SYSCTL_ONE,
2575+ },
2576+#endif
2577+ { }
2578+};
33722579
3373−int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
3374− void __user *buffer, size_t *lenp, loff_t *ppos)
3375−{
3376− return -ENOSYS;
3377−}
2580+static struct ctl_table vm_table[] = {
2581+ {
2582+ .procname = "overcommit_memory",
2583+ .data = &sysctl_overcommit_memory,
2584+ .maxlen = sizeof(sysctl_overcommit_memory),
2585+ .mode = 0644,
2586+ .proc_handler = proc_dointvec_minmax,
2587+ .extra1 = SYSCTL_ZERO,
2588+ .extra2 = &two,
2589+ },
2590+ {
2591+ .procname = "panic_on_oom",
2592+ .data = &sysctl_panic_on_oom,
2593+ .maxlen = sizeof(sysctl_panic_on_oom),
2594+ .mode = 0644,
2595+ .proc_handler = proc_dointvec_minmax,
2596+ .extra1 = SYSCTL_ZERO,
2597+ .extra2 = &two,
2598+ },
2599+ {
2600+ .procname = "oom_kill_allocating_task",
2601+ .data = &sysctl_oom_kill_allocating_task,
2602+ .maxlen = sizeof(sysctl_oom_kill_allocating_task),
2603+ .mode = 0644,
2604+ .proc_handler = proc_dointvec,
2605+ },
2606+ {
2607+ .procname = "oom_dump_tasks",
2608+ .data = &sysctl_oom_dump_tasks,
2609+ .maxlen = sizeof(sysctl_oom_dump_tasks),
2610+ .mode = 0644,
2611+ .proc_handler = proc_dointvec,
2612+ },
2613+ {
2614+ .procname = "overcommit_ratio",
2615+ .data = &sysctl_overcommit_ratio,
2616+ .maxlen = sizeof(sysctl_overcommit_ratio),
2617+ .mode = 0644,
2618+ .proc_handler = overcommit_ratio_handler,
2619+ },
2620+ {
2621+ .procname = "overcommit_kbytes",
2622+ .data = &sysctl_overcommit_kbytes,
2623+ .maxlen = sizeof(sysctl_overcommit_kbytes),
2624+ .mode = 0644,
2625+ .proc_handler = overcommit_kbytes_handler,
2626+ },
2627+ {
2628+ .procname = "page-cluster",
2629+ .data = &page_cluster,
2630+ .maxlen = sizeof(int),
2631+ .mode = 0644,
2632+ .proc_handler = proc_dointvec_minmax,
2633+ .extra1 = SYSCTL_ZERO,
2634+ },
2635+ {
2636+ .procname = "dirty_background_ratio",
2637+ .data = &dirty_background_ratio,
2638+ .maxlen = sizeof(dirty_background_ratio),
2639+ .mode = 0644,
2640+ .proc_handler = dirty_background_ratio_handler,
2641+ .extra1 = SYSCTL_ZERO,
2642+ .extra2 = &one_hundred,
2643+ },
2644+ {
2645+ .procname = "dirty_background_bytes",
2646+ .data = &dirty_background_bytes,
2647+ .maxlen = sizeof(dirty_background_bytes),
2648+ .mode = 0644,
2649+ .proc_handler = dirty_background_bytes_handler,
2650+ .extra1 = &one_ul,
2651+ },
2652+ {
2653+ .procname = "dirty_ratio",
2654+ .data = &vm_dirty_ratio,
2655+ .maxlen = sizeof(vm_dirty_ratio),
2656+ .mode = 0644,
2657+ .proc_handler = dirty_ratio_handler,
2658+ .extra1 = SYSCTL_ZERO,
2659+ .extra2 = &one_hundred,
2660+ },
2661+ {
2662+ .procname = "dirty_bytes",
2663+ .data = &vm_dirty_bytes,
2664+ .maxlen = sizeof(vm_dirty_bytes),
2665+ .mode = 0644,
2666+ .proc_handler = dirty_bytes_handler,
2667+ .extra1 = &dirty_bytes_min,
2668+ },
2669+ {
2670+ .procname = "dirty_writeback_centisecs",
2671+ .data = &dirty_writeback_interval,
2672+ .maxlen = sizeof(dirty_writeback_interval),
2673+ .mode = 0644,
2674+ .proc_handler = dirty_writeback_centisecs_handler,
2675+ },
2676+ {
2677+ .procname = "dirty_expire_centisecs",
2678+ .data = &dirty_expire_interval,
2679+ .maxlen = sizeof(dirty_expire_interval),
2680+ .mode = 0644,
2681+ .proc_handler = proc_dointvec_minmax,
2682+ .extra1 = SYSCTL_ZERO,
2683+ },
2684+ {
2685+ .procname = "dirtytime_expire_seconds",
2686+ .data = &dirtytime_expire_interval,
2687+ .maxlen = sizeof(dirtytime_expire_interval),
2688+ .mode = 0644,
2689+ .proc_handler = dirtytime_interval_handler,
2690+ .extra1 = SYSCTL_ZERO,
2691+ },
2692+ {
2693+ .procname = "swappiness",
2694+ .data = &vm_swappiness,
2695+ .maxlen = sizeof(vm_swappiness),
2696+ .mode = 0644,
2697+ .proc_handler = proc_dointvec_minmax,
2698+ .extra1 = SYSCTL_ZERO,
2699+ .extra2 = &one_hundred,
2700+ },
2701+#ifdef CONFIG_HUGETLB_PAGE
2702+ {
2703+ .procname = "nr_hugepages",
2704+ .data = NULL,
2705+ .maxlen = sizeof(unsigned long),
2706+ .mode = 0644,
2707+ .proc_handler = hugetlb_sysctl_handler,
2708+ },
2709+#ifdef CONFIG_NUMA
2710+ {
2711+ .procname = "nr_hugepages_mempolicy",
2712+ .data = NULL,
2713+ .maxlen = sizeof(unsigned long),
2714+ .mode = 0644,
2715+ .proc_handler = &hugetlb_mempolicy_sysctl_handler,
2716+ },
2717+ {
2718+ .procname = "numa_stat",
2719+ .data = &sysctl_vm_numa_stat,
2720+ .maxlen = sizeof(int),
2721+ .mode = 0644,
2722+ .proc_handler = sysctl_vm_numa_stat_handler,
2723+ .extra1 = SYSCTL_ZERO,
2724+ .extra2 = SYSCTL_ONE,
2725+ },
2726+#endif
2727+ {
2728+ .procname = "hugetlb_shm_group",
2729+ .data = &sysctl_hugetlb_shm_group,
2730+ .maxlen = sizeof(gid_t),
2731+ .mode = 0644,
2732+ .proc_handler = proc_dointvec,
2733+ },
2734+ {
2735+ .procname = "nr_overcommit_hugepages",
2736+ .data = NULL,
2737+ .maxlen = sizeof(unsigned long),
2738+ .mode = 0644,
2739+ .proc_handler = hugetlb_overcommit_handler,
2740+ },
2741+#endif
2742+ {
2743+ .procname = "lowmem_reserve_ratio",
2744+ .data = &sysctl_lowmem_reserve_ratio,
2745+ .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
2746+ .mode = 0644,
2747+ .proc_handler = lowmem_reserve_ratio_sysctl_handler,
2748+ },
2749+ {
2750+ .procname = "drop_caches",
2751+ .data = &sysctl_drop_caches,
2752+ .maxlen = sizeof(int),
2753+ .mode = 0200,
2754+ .proc_handler = drop_caches_sysctl_handler,
2755+ .extra1 = SYSCTL_ONE,
2756+ .extra2 = &four,
2757+ },
2758+#ifdef CONFIG_COMPACTION
2759+ {
2760+ .procname = "compact_memory",
2761+ .data = &sysctl_compact_memory,
2762+ .maxlen = sizeof(int),
2763+ .mode = 0200,
2764+ .proc_handler = sysctl_compaction_handler,
2765+ },
2766+ {
2767+ .procname = "extfrag_threshold",
2768+ .data = &sysctl_extfrag_threshold,
2769+ .maxlen = sizeof(int),
2770+ .mode = 0644,
2771+ .proc_handler = proc_dointvec_minmax,
2772+ .extra1 = &min_extfrag_threshold,
2773+ .extra2 = &max_extfrag_threshold,
2774+ },
2775+ {
2776+ .procname = "compact_unevictable_allowed",
2777+ .data = &sysctl_compact_unevictable_allowed,
2778+ .maxlen = sizeof(int),
2779+ .mode = 0644,
2780+ .proc_handler = proc_dointvec_minmax_warn_RT_change,
2781+ .extra1 = SYSCTL_ZERO,
2782+ .extra2 = SYSCTL_ONE,
2783+ },
33782784
3379−int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
3380− void __user *buffer, size_t *lenp, loff_t *ppos)
3381−{
3382− return -ENOSYS;
3383−}
2785+#endif /* CONFIG_COMPACTION */
2786+ {
2787+ .procname = "min_free_kbytes",
2788+ .data = &min_free_kbytes,
2789+ .maxlen = sizeof(min_free_kbytes),
2790+ .mode = 0644,
2791+ .proc_handler = min_free_kbytes_sysctl_handler,
2792+ .extra1 = SYSCTL_ZERO,
2793+ },
2794+ {
2795+ .procname = "watermark_boost_factor",
2796+ .data = &watermark_boost_factor,
2797+ .maxlen = sizeof(watermark_boost_factor),
2798+ .mode = 0644,
2799+ .proc_handler = proc_dointvec_minmax,
2800+ .extra1 = SYSCTL_ZERO,
2801+ },
2802+ {
2803+ .procname = "watermark_scale_factor",
2804+ .data = &watermark_scale_factor,
2805+ .maxlen = sizeof(watermark_scale_factor),
2806+ .mode = 0644,
2807+ .proc_handler = watermark_scale_factor_sysctl_handler,
2808+ .extra1 = SYSCTL_ONE,
2809+ .extra2 = &one_thousand,
2810+ },
2811+ {
2812+ .procname = "percpu_pagelist_fraction",
2813+ .data = &percpu_pagelist_fraction,
2814+ .maxlen = sizeof(percpu_pagelist_fraction),
2815+ .mode = 0644,
2816+ .proc_handler = percpu_pagelist_fraction_sysctl_handler,
2817+ .extra1 = SYSCTL_ZERO,
2818+ },
2819+#ifdef CONFIG_MMU
2820+ {
2821+ .procname = "max_map_count",
2822+ .data = &sysctl_max_map_count,
2823+ .maxlen = sizeof(sysctl_max_map_count),
2824+ .mode = 0644,
2825+ .proc_handler = proc_dointvec_minmax,
2826+ .extra1 = SYSCTL_ZERO,
2827+ },
2828+#else
2829+ {
2830+ .procname = "nr_trim_pages",
2831+ .data = &sysctl_nr_trim_pages,
2832+ .maxlen = sizeof(sysctl_nr_trim_pages),
2833+ .mode = 0644,
2834+ .proc_handler = proc_dointvec_minmax,
2835+ .extra1 = SYSCTL_ZERO,
2836+ },
2837+#endif
2838+ {
2839+ .procname = "laptop_mode",
2840+ .data = &laptop_mode,
2841+ .maxlen = sizeof(laptop_mode),
2842+ .mode = 0644,
2843+ .proc_handler = proc_dointvec_jiffies,
2844+ },
2845+ {
2846+ .procname = "block_dump",
2847+ .data = &block_dump,
2848+ .maxlen = sizeof(block_dump),
2849+ .mode = 0644,
2850+ .proc_handler = proc_dointvec,
2851+ .extra1 = SYSCTL_ZERO,
2852+ },
2853+ {
2854+ .procname = "vfs_cache_pressure",
2855+ .data = &sysctl_vfs_cache_pressure,
2856+ .maxlen = sizeof(sysctl_vfs_cache_pressure),
2857+ .mode = 0644,
2858+ .proc_handler = proc_dointvec,
2859+ .extra1 = SYSCTL_ZERO,
2860+ },
2861+#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \
2862+ defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT)
2863+ {
2864+ .procname = "legacy_va_layout",
2865+ .data = &sysctl_legacy_va_layout,
2866+ .maxlen = sizeof(sysctl_legacy_va_layout),
2867+ .mode = 0644,
2868+ .proc_handler = proc_dointvec,
2869+ .extra1 = SYSCTL_ZERO,
2870+ },
2871+#endif
2872+#ifdef CONFIG_NUMA
2873+ {
2874+ .procname = "zone_reclaim_mode",
2875+ .data = &node_reclaim_mode,
2876+ .maxlen = sizeof(node_reclaim_mode),
2877+ .mode = 0644,
2878+ .proc_handler = proc_dointvec,
2879+ .extra1 = SYSCTL_ZERO,
2880+ },
2881+ {
2882+ .procname = "min_unmapped_ratio",
2883+ .data = &sysctl_min_unmapped_ratio,
2884+ .maxlen = sizeof(sysctl_min_unmapped_ratio),
2885+ .mode = 0644,
2886+ .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
2887+ .extra1 = SYSCTL_ZERO,
2888+ .extra2 = &one_hundred,
2889+ },
2890+ {
2891+ .procname = "min_slab_ratio",
2892+ .data = &sysctl_min_slab_ratio,
2893+ .maxlen = sizeof(sysctl_min_slab_ratio),
2894+ .mode = 0644,
2895+ .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
2896+ .extra1 = SYSCTL_ZERO,
2897+ .extra2 = &one_hundred,
2898+ },
2899+#endif
2900+#ifdef CONFIG_SMP
2901+ {
2902+ .procname = "stat_interval",
2903+ .data = &sysctl_stat_interval,
2904+ .maxlen = sizeof(sysctl_stat_interval),
2905+ .mode = 0644,
2906+ .proc_handler = proc_dointvec_jiffies,
2907+ },
2908+ {
2909+ .procname = "stat_refresh",
2910+ .data = NULL,
2911+ .maxlen = 0,
2912+ .mode = 0600,
2913+ .proc_handler = vmstat_refresh,
2914+ },
2915+#endif
2916+#ifdef CONFIG_MMU
2917+ {
2918+ .procname = "mmap_min_addr",
2919+ .data = &dac_mmap_min_addr,
2920+ .maxlen = sizeof(unsigned long),
2921+ .mode = 0644,
2922+ .proc_handler = mmap_min_addr_handler,
2923+ },
2924+#endif
2925+#ifdef CONFIG_NUMA
2926+ {
2927+ .procname = "numa_zonelist_order",
2928+ .data = &numa_zonelist_order,
2929+ .maxlen = NUMA_ZONELIST_ORDER_LEN,
2930+ .mode = 0644,
2931+ .proc_handler = numa_zonelist_order_handler,
2932+ },
2933+#endif
2934+#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
2935+ (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
2936+ {
2937+ .procname = "vdso_enabled",
2938+#ifdef CONFIG_X86_32
2939+ .data = &vdso32_enabled,
2940+ .maxlen = sizeof(vdso32_enabled),
2941+#else
2942+ .data = &vdso_enabled,
2943+ .maxlen = sizeof(vdso_enabled),
2944+#endif
2945+ .mode = 0644,
2946+ .proc_handler = proc_dointvec,
2947+ .extra1 = SYSCTL_ZERO,
2948+ },
2949+#endif
2950+#ifdef CONFIG_HIGHMEM
2951+ {
2952+ .procname = "highmem_is_dirtyable",
2953+ .data = &vm_highmem_is_dirtyable,
2954+ .maxlen = sizeof(vm_highmem_is_dirtyable),
2955+ .mode = 0644,
2956+ .proc_handler = proc_dointvec_minmax,
2957+ .extra1 = SYSCTL_ZERO,
2958+ .extra2 = SYSCTL_ONE,
2959+ },
2960+#endif
2961+#ifdef CONFIG_MEMORY_FAILURE
2962+ {
2963+ .procname = "memory_failure_early_kill",
2964+ .data = &sysctl_memory_failure_early_kill,
2965+ .maxlen = sizeof(sysctl_memory_failure_early_kill),
2966+ .mode = 0644,
2967+ .proc_handler = proc_dointvec_minmax,
2968+ .extra1 = SYSCTL_ZERO,
2969+ .extra2 = SYSCTL_ONE,
2970+ },
2971+ {
2972+ .procname = "memory_failure_recovery",
2973+ .data = &sysctl_memory_failure_recovery,
2974+ .maxlen = sizeof(sysctl_memory_failure_recovery),
2975+ .mode = 0644,
2976+ .proc_handler = proc_dointvec_minmax,
2977+ .extra1 = SYSCTL_ZERO,
2978+ .extra2 = SYSCTL_ONE,
2979+ },
2980+#endif
2981+ {
2982+ .procname = "user_reserve_kbytes",
2983+ .data = &sysctl_user_reserve_kbytes,
2984+ .maxlen = sizeof(sysctl_user_reserve_kbytes),
2985+ .mode = 0644,
2986+ .proc_handler = proc_doulongvec_minmax,
2987+ },
2988+ {
2989+ .procname = "admin_reserve_kbytes",
2990+ .data = &sysctl_admin_reserve_kbytes,
2991+ .maxlen = sizeof(sysctl_admin_reserve_kbytes),
2992+ .mode = 0644,
2993+ .proc_handler = proc_doulongvec_minmax,
2994+ },
2995+#ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
2996+ {
2997+ .procname = "mmap_rnd_bits",
2998+ .data = &mmap_rnd_bits,
2999+ .maxlen = sizeof(mmap_rnd_bits),
3000+ .mode = 0600,
3001+ .proc_handler = proc_dointvec_minmax,
3002+ .extra1 = (void *)&mmap_rnd_bits_min,
3003+ .extra2 = (void *)&mmap_rnd_bits_max,
3004+ },
3005+#endif
3006+#ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS
3007+ {
3008+ .procname = "mmap_rnd_compat_bits",
3009+ .data = &mmap_rnd_compat_bits,
3010+ .maxlen = sizeof(mmap_rnd_compat_bits),
3011+ .mode = 0600,
3012+ .proc_handler = proc_dointvec_minmax,
3013+ .extra1 = (void *)&mmap_rnd_compat_bits_min,
3014+ .extra2 = (void *)&mmap_rnd_compat_bits_max,
3015+ },
3016+#endif
3017+#ifdef CONFIG_USERFAULTFD
3018+ {
3019+ .procname = "unprivileged_userfaultfd",
3020+ .data = &sysctl_unprivileged_userfaultfd,
3021+ .maxlen = sizeof(sysctl_unprivileged_userfaultfd),
3022+ .mode = 0644,
3023+ .proc_handler = proc_dointvec_minmax,
3024+ .extra1 = SYSCTL_ZERO,
3025+ .extra2 = SYSCTL_ONE,
3026+ },
3027+#endif
3028+ { }
3029+};
33843030
3385−int proc_doulongvec_minmax(struct ctl_table *table, int write,
3386− void __user *buffer, size_t *lenp, loff_t *ppos)
3387−{
3388− return -ENOSYS;
3389−}
3031+static struct ctl_table fs_table[] = {
3032+ {
3033+ .procname = "inode-nr",
3034+ .data = &inodes_stat,
3035+ .maxlen = 2*sizeof(long),
3036+ .mode = 0444,
3037+ .proc_handler = proc_nr_inodes,
3038+ },
3039+ {
3040+ .procname = "inode-state",
3041+ .data = &inodes_stat,
3042+ .maxlen = 7*sizeof(long),
3043+ .mode = 0444,
3044+ .proc_handler = proc_nr_inodes,
3045+ },
3046+ {
3047+ .procname = "file-nr",
3048+ .data = &files_stat,
3049+ .maxlen = sizeof(files_stat),
3050+ .mode = 0444,
3051+ .proc_handler = proc_nr_files,
3052+ },
3053+ {
3054+ .procname = "file-max",
3055+ .data = &files_stat.max_files,
3056+ .maxlen = sizeof(files_stat.max_files),
3057+ .mode = 0644,
3058+ .proc_handler = proc_doulongvec_minmax,
3059+ .extra1 = &zero_ul,
3060+ .extra2 = &long_max,
3061+ },
3062+ {
3063+ .procname = "nr_open",
3064+ .data = &sysctl_nr_open,
3065+ .maxlen = sizeof(unsigned int),
3066+ .mode = 0644,
3067+ .proc_handler = proc_dointvec_minmax,
3068+ .extra1 = &sysctl_nr_open_min,
3069+ .extra2 = &sysctl_nr_open_max,
3070+ },
3071+ {
3072+ .procname = "dentry-state",
3073+ .data = &dentry_stat,
3074+ .maxlen = 6*sizeof(long),
3075+ .mode = 0444,
3076+ .proc_handler = proc_nr_dentry,
3077+ },
3078+ {
3079+ .procname = "overflowuid",
3080+ .data = &fs_overflowuid,
3081+ .maxlen = sizeof(int),
3082+ .mode = 0644,
3083+ .proc_handler = proc_dointvec_minmax,
3084+ .extra1 = &minolduid,
3085+ .extra2 = &maxolduid,
3086+ },
3087+ {
3088+ .procname = "overflowgid",
3089+ .data = &fs_overflowgid,
3090+ .maxlen = sizeof(int),
3091+ .mode = 0644,
3092+ .proc_handler = proc_dointvec_minmax,
3093+ .extra1 = &minolduid,
3094+ .extra2 = &maxolduid,
3095+ },
3096+#ifdef CONFIG_FILE_LOCKING
3097+ {
3098+ .procname = "leases-enable",
3099+ .data = &leases_enable,
3100+ .maxlen = sizeof(int),
3101+ .mode = 0644,
3102+ .proc_handler = proc_dointvec,
3103+ },
3104+#endif
3105+#ifdef CONFIG_DNOTIFY
3106+ {
3107+ .procname = "dir-notify-enable",
3108+ .data = &dir_notify_enable,
3109+ .maxlen = sizeof(int),
3110+ .mode = 0644,
3111+ .proc_handler = proc_dointvec,
3112+ },
3113+#endif
3114+#ifdef CONFIG_MMU
3115+#ifdef CONFIG_FILE_LOCKING
3116+ {
3117+ .procname = "lease-break-time",
3118+ .data = &lease_break_time,
3119+ .maxlen = sizeof(int),
3120+ .mode = 0644,
3121+ .proc_handler = proc_dointvec,
3122+ },
3123+#endif
3124+#ifdef CONFIG_AIO
3125+ {
3126+ .procname = "aio-nr",
3127+ .data = &aio_nr,
3128+ .maxlen = sizeof(aio_nr),
3129+ .mode = 0444,
3130+ .proc_handler = proc_doulongvec_minmax,
3131+ },
3132+ {
3133+ .procname = "aio-max-nr",
3134+ .data = &aio_max_nr,
3135+ .maxlen = sizeof(aio_max_nr),
3136+ .mode = 0644,
3137+ .proc_handler = proc_doulongvec_minmax,
3138+ },
3139+#endif /* CONFIG_AIO */
3140+#ifdef CONFIG_INOTIFY_USER
3141+ {
3142+ .procname = "inotify",
3143+ .mode = 0555,
3144+ .child = inotify_table,
3145+ },
3146+#endif
3147+#ifdef CONFIG_EPOLL
3148+ {
3149+ .procname = "epoll",
3150+ .mode = 0555,
3151+ .child = epoll_table,
3152+ },
3153+#endif
3154+#endif
3155+ {
3156+ .procname = "protected_symlinks",
3157+ .data = &sysctl_protected_symlinks,
3158+ .maxlen = sizeof(int),
3159+ .mode = 0600,
3160+ .proc_handler = proc_dointvec_minmax,
3161+ .extra1 = SYSCTL_ZERO,
3162+ .extra2 = SYSCTL_ONE,
3163+ },
3164+ {
3165+ .procname = "protected_hardlinks",
3166+ .data = &sysctl_protected_hardlinks,
3167+ .maxlen = sizeof(int),
3168+ .mode = 0600,
3169+ .proc_handler = proc_dointvec_minmax,
3170+ .extra1 = SYSCTL_ZERO,
3171+ .extra2 = SYSCTL_ONE,
3172+ },
3173+ {
3174+ .procname = "protected_fifos",
3175+ .data = &sysctl_protected_fifos,
3176+ .maxlen = sizeof(int),
3177+ .mode = 0600,
3178+ .proc_handler = proc_dointvec_minmax,
3179+ .extra1 = SYSCTL_ZERO,
3180+ .extra2 = &two,
3181+ },
3182+ {
3183+ .procname = "protected_regular",
3184+ .data = &sysctl_protected_regular,
3185+ .maxlen = sizeof(int),
3186+ .mode = 0600,
3187+ .proc_handler = proc_dointvec_minmax,
3188+ .extra1 = SYSCTL_ZERO,
3189+ .extra2 = &two,
3190+ },
3191+ {
3192+ .procname = "suid_dumpable",
3193+ .data = &suid_dumpable,
3194+ .maxlen = sizeof(int),
3195+ .mode = 0644,
3196+ .proc_handler = proc_dointvec_minmax_coredump,
3197+ .extra1 = SYSCTL_ZERO,
3198+ .extra2 = &two,
3199+ },
3200+#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
3201+ {
3202+ .procname = "binfmt_misc",
3203+ .mode = 0555,
3204+ .child = sysctl_mount_point,
3205+ },
3206+#endif
3207+ {
3208+ .procname = "pipe-max-size",
3209+ .data = &pipe_max_size,
3210+ .maxlen = sizeof(pipe_max_size),
3211+ .mode = 0644,
3212+ .proc_handler = proc_dopipe_max_size,
3213+ },
3214+ {
3215+ .procname = "pipe-user-pages-hard",
3216+ .data = &pipe_user_pages_hard,
3217+ .maxlen = sizeof(pipe_user_pages_hard),
3218+ .mode = 0644,
3219+ .proc_handler = proc_doulongvec_minmax,
3220+ },
3221+ {
3222+ .procname = "pipe-user-pages-soft",
3223+ .data = &pipe_user_pages_soft,
3224+ .maxlen = sizeof(pipe_user_pages_soft),
3225+ .mode = 0644,
3226+ .proc_handler = proc_doulongvec_minmax,
3227+ },
3228+ {
3229+ .procname = "mount-max",
3230+ .data = &sysctl_mount_max,
3231+ .maxlen = sizeof(unsigned int),
3232+ .mode = 0644,
3233+ .proc_handler = proc_dointvec_minmax,
3234+ .extra1 = SYSCTL_ONE,
3235+ },
3236+ { }
3237+};
33903238
3391−int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
3392− void __user *buffer,
3393− size_t *lenp, loff_t *ppos)
3394−{
3395− return -ENOSYS;
3396−}
3239+static struct ctl_table debug_table[] = {
3240+#ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
3241+ {
3242+ .procname = "exception-trace",
3243+ .data = &show_unhandled_signals,
3244+ .maxlen = sizeof(int),
3245+ .mode = 0644,
3246+ .proc_handler = proc_dointvec
3247+ },
3248+#endif
3249+#if defined(CONFIG_OPTPROBES)
3250+ {
3251+ .procname = "kprobes-optimization",
3252+ .data = &sysctl_kprobes_optimization,
3253+ .maxlen = sizeof(int),
3254+ .mode = 0644,
3255+ .proc_handler = proc_kprobes_optimization_handler,
3256+ .extra1 = SYSCTL_ZERO,
3257+ .extra2 = SYSCTL_ONE,
3258+ },
3259+#endif
3260+ { }
3261+};
33973262
3398−int proc_do_large_bitmap(struct ctl_table *table, int write,
3399− void __user *buffer, size_t *lenp, loff_t *ppos)
3400−{
3401− return -ENOSYS;
3402−}
3263+static struct ctl_table dev_table[] = {
3264+ { }
3265+};
34033266
3404−#endif /* CONFIG_PROC_SYSCTL */
3267+static struct ctl_table sysctl_base_table[] = {
3268+ {
3269+ .procname = "kernel",
3270+ .mode = 0555,
3271+ .child = kern_table,
3272+ },
3273+ {
3274+ .procname = "vm",
3275+ .mode = 0555,
3276+ .child = vm_table,
3277+ },
3278+ {
3279+ .procname = "fs",
3280+ .mode = 0555,
3281+ .child = fs_table,
3282+ },
3283+ {
3284+ .procname = "debug",
3285+ .mode = 0555,
3286+ .child = debug_table,
3287+ },
3288+ {
3289+ .procname = "dev",
3290+ .mode = 0555,
3291+ .child = dev_table,
3292+ },
3293+ { }
3294+};
34053295
3406−#if defined(CONFIG_SYSCTL)
3407−int proc_do_static_key(struct ctl_table *table, int write,
3408− void __user *buffer, size_t *lenp,
3409− loff_t *ppos)
3296+int __init sysctl_init(void)
34103297 {
3411− struct static_key *key = (struct static_key *)table->data;
3412− static DEFINE_MUTEX(static_key_mutex);
3413− int val, ret;
3414− struct ctl_table tmp = {
3415− .data = &val,
3416− .maxlen = sizeof(val),
3417− .mode = table->mode,
3418− .extra1 = SYSCTL_ZERO,
3419− .extra2 = SYSCTL_ONE,
3420− };
3421−
3422− if (write && !capable(CAP_SYS_ADMIN))
3423− return -EPERM;
3298+ struct ctl_table_header *hdr;
34243299
3425− mutex_lock(&static_key_mutex);
3426− val = static_key_enabled(key);
3427− ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
3428− if (write && !ret) {
3429− if (val)
3430− static_key_enable(key);
3431− else
3432− static_key_disable(key);
3433− }
3434− mutex_unlock(&static_key_mutex);
3435− return ret;
3300+ hdr = register_sysctl_table(sysctl_base_table);
3301+ kmemleak_not_leak(hdr);
3302+ return 0;
34363303 }
3437−#endif
3304+#endif /* CONFIG_SYSCTL */
34383305 /*
34393306 * No sense putting this after each symbol definition, twice,
34403307 * exception granted :-)
kernel/time/timer.c+1−2
@@ -249,8 +249,7 @@ void timers_update_nohz(void) · 248 unmodified lines
249249 }
250250
251251 int timer_migration_handler(struct ctl_table *table, int write,
252− void __user *buffer, size_t *lenp,
253− loff_t *ppos)
252+ void *buffer, size_t *lenp, loff_t *ppos)
254253 {
255254 int ret;
256255
kernel/trace/trace.c+1−1
@@ -2661,7 +2661,7 @@ static void output_printk(struct trace_event_buffer *fbuffer) · 2660 unmodified lines
26612661 }
26622662
26632663 int tracepoint_printk_sysctl(struct ctl_table *table, int write,
2664− void __user *buffer, size_t *lenp,
2664+ void *buffer, size_t *lenp,
26652665 loff_t *ppos)
26662666 {
26672667 int save_tracepoint_printk;
kernel/umh.c+1−1
@@ -630,7 +630,7 @@ int call_usermodehelper(const char *path, char **argv, char **envp, int wait) · 629 unmodified lines
630630 EXPORT_SYMBOL(call_usermodehelper);
631631
632632 static int proc_cap_handler(struct ctl_table *table, int write,
633− void __user *buffer, size_t *lenp, loff_t *ppos)
633+ void *buffer, size_t *lenp, loff_t *ppos)
634634 {
635635 struct ctl_table t;
636636 unsigned long cap_array[_KERNEL_CAPABILITY_U32S];
kernel/utsname_sysctl.c+1−1
@@ -30,7 +30,7 @@ static void *get_uts(struct ctl_table *table) · 29 unmodified lines
3030 * to observe. Should this be in kernel/sys.c ????
3131 */
3232 static int proc_do_uts_string(struct ctl_table *table, int write,
33− void __user *buffer, size_t *lenp, loff_t *ppos)
33+ void *buffer, size_t *lenp, loff_t *ppos)
3434 {
3535 struct ctl_table uts_table;
3636 int r;
kernel/watchdog.c+6−6
@@ -661,7 +661,7 @@ static void proc_watchdog_update(void) · 660 unmodified lines
661661 * proc_soft_watchdog | soft_watchdog_user_enabled | SOFT_WATCHDOG_ENABLED
662662 */
663663 static int proc_watchdog_common(int which, struct ctl_table *table, int write,
664− void __user *buffer, size_t *lenp, loff_t *ppos)
664+ void *buffer, size_t *lenp, loff_t *ppos)
665665 {
666666 int err, old, *param = table->data;
667667
@@ -688,7 +688,7 @@ static int proc_watchdog_common(int which, struct ctl_table *table, int write, · 20 unmodified lines
688688 * /proc/sys/kernel/watchdog
689689 */
690690 int proc_watchdog(struct ctl_table *table, int write,
691− void __user *buffer, size_t *lenp, loff_t *ppos)
691+ void *buffer, size_t *lenp, loff_t *ppos)
692692 {
693693 return proc_watchdog_common(NMI_WATCHDOG_ENABLED|SOFT_WATCHDOG_ENABLED,
694694 table, write, buffer, lenp, ppos);
@@ -698,7 +698,7 @@ int proc_watchdog(struct ctl_table *table, int write, · 3 unmodified lines
698698 * /proc/sys/kernel/nmi_watchdog
699699 */
700700 int proc_nmi_watchdog(struct ctl_table *table, int write,
701− void __user *buffer, size_t *lenp, loff_t *ppos)
701+ void *buffer, size_t *lenp, loff_t *ppos)
702702 {
703703 if (!nmi_watchdog_available && write)
704704 return -ENOTSUPP;
@@ -710,7 +710,7 @@ int proc_nmi_watchdog(struct ctl_table *table, int write, · 5 unmodified lines
710710 * /proc/sys/kernel/soft_watchdog
711711 */
712712 int proc_soft_watchdog(struct ctl_table *table, int write,
713− void __user *buffer, size_t *lenp, loff_t *ppos)
713+ void *buffer, size_t *lenp, loff_t *ppos)
714714 {
715715 return proc_watchdog_common(SOFT_WATCHDOG_ENABLED,
716716 table, write, buffer, lenp, ppos);
@@ -720,7 +720,7 @@ int proc_soft_watchdog(struct ctl_table *table, int write, · 3 unmodified lines
720720 * /proc/sys/kernel/watchdog_thresh
721721 */
722722 int proc_watchdog_thresh(struct ctl_table *table, int write,
723− void __user *buffer, size_t *lenp, loff_t *ppos)
723+ void *buffer, size_t *lenp, loff_t *ppos)
724724 {
725725 int err, old;
726726
@@ -743,7 +743,7 @@ int proc_watchdog_thresh(struct ctl_table *table, int write, · 16 unmodified lines
743743 * been brought online, if desired.
744744 */
745745 int proc_watchdog_cpumask(struct ctl_table *table, int write,
746− void __user *buffer, size_t *lenp, loff_t *ppos)
746+ void *buffer, size_t *lenp, loff_t *ppos)
747747 {
748748 int err;
749749
mm/compaction.c+1−1
@@ -2463,7 +2463,7 @@ int sysctl_compact_memory; · 2462 unmodified lines
24632463 * /proc/sys/vm/compact_memory
24642464 */
24652465 int sysctl_compaction_handler(struct ctl_table *table, int write,
2466− void __user *buffer, size_t *length, loff_t *ppos)
2466+ void *buffer, size_t *length, loff_t *ppos)
24672467 {
24682468 if (write)
24692469 compact_nodes();
mm/hugetlb.c+4−5
@@ -3352,7 +3352,7 @@ static unsigned int cpuset_mems_nr(unsigned int *array) · 3351 unmodified lines
33523352 #ifdef CONFIG_SYSCTL
33533353 static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
33543354 struct ctl_table *table, int write,
3355− void __user *buffer, size_t *length, loff_t *ppos)
3355+ void *buffer, size_t *length, loff_t *ppos)
33563356 {
33573357 struct hstate *h = &default_hstate;
33583358 unsigned long tmp = h->max_huge_pages;
@@ -3375,7 +3375,7 @@ out: · 16 unmodified lines
33753375 }
33763376
33773377 int hugetlb_sysctl_handler(struct ctl_table *table, int write,
3378− void __user *buffer, size_t *length, loff_t *ppos)
3378+ void *buffer, size_t *length, loff_t *ppos)
33793379 {
33803380
33813381 return hugetlb_sysctl_handler_common(false, table, write,
@@ -3384,7 +3384,7 @@ int hugetlb_sysctl_handler(struct ctl_table *table, int write, · 2 unmodified lines
33843384
33853385 #ifdef CONFIG_NUMA
33863386 int hugetlb_mempolicy_sysctl_handler(struct ctl_table *table, int write,
3387− void __user *buffer, size_t *length, loff_t *ppos)
3387+ void *buffer, size_t *length, loff_t *ppos)
33883388 {
33893389 return hugetlb_sysctl_handler_common(true, table, write,
33903390 buffer, length, ppos);
@@ -3392,8 +3392,7 @@ int hugetlb_mempolicy_sysctl_handler(struct ctl_table *table, int write, · 1 unmodified line
33923392 #endif /* CONFIG_NUMA */
33933393
33943394 int hugetlb_overcommit_handler(struct ctl_table *table, int write,
3395− void __user *buffer,
3396− size_t *length, loff_t *ppos)
3395+ void *buffer, size_t *length, loff_t *ppos)
33973396 {
33983397 struct hstate *h = &default_hstate;
33993398 unsigned long tmp;
mm/page-writeback.c+6−10
@@ -512,8 +512,7 @@ bool node_dirty_ok(struct pglist_data *pgdat) · 511 unmodified lines
512512 }
513513
514514 int dirty_background_ratio_handler(struct ctl_table *table, int write,
515− void __user *buffer, size_t *lenp,
516− loff_t *ppos)
515+ void *buffer, size_t *lenp, loff_t *ppos)
517516 {
518517 int ret;
519518
@@ -524,8 +523,7 @@ int dirty_background_ratio_handler(struct ctl_table *table, int write, · 4 unmodified lines
524523 }
525524
526525 int dirty_background_bytes_handler(struct ctl_table *table, int write,
527− void __user *buffer, size_t *lenp,
528− loff_t *ppos)
526+ void *buffer, size_t *lenp, loff_t *ppos)
529527 {
530528 int ret;
531529
@@ -535,9 +533,8 @@ int dirty_background_bytes_handler(struct ctl_table *table, int write, · 3 unmodified lines
535533 return ret;
536534 }
537535
538−int dirty_ratio_handler(struct ctl_table *table, int write,
539− void __user *buffer, size_t *lenp,
540− loff_t *ppos)
536+int dirty_ratio_handler(struct ctl_table *table, int write, void *buffer,
537+ size_t *lenp, loff_t *ppos)
541538 {
542539 int old_ratio = vm_dirty_ratio;
543540 int ret;
@@ -551,8 +548,7 @@ int dirty_ratio_handler(struct ctl_table *table, int write, · 7 unmodified lines
551548 }
552549
553550 int dirty_bytes_handler(struct ctl_table *table, int write,
554− void __user *buffer, size_t *lenp,
555− loff_t *ppos)
551+ void *buffer, size_t *lenp, loff_t *ppos)
556552 {
557553 unsigned long old_bytes = vm_dirty_bytes;
558554 int ret;
@@ -1972,7 +1968,7 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb) · 1413 unmodified lines
19721968 * sysctl handler for /proc/sys/vm/dirty_writeback_centisecs
19731969 */
19741970 int dirty_writeback_centisecs_handler(struct ctl_table *table, int write,
1975− void __user *buffer, size_t *length, loff_t *ppos)
1971+ void *buffer, size_t *length, loff_t *ppos)
19761972 {
19771973 unsigned int old_interval = dirty_writeback_interval;
19781974 int ret;
mm/page_alloc.c+10−32
@@ -5546,21 +5546,11 @@ char numa_zonelist_order[] = "Node"; · 5545 unmodified lines
55465546 * sysctl handler for numa_zonelist_order
55475547 */
55485548 int numa_zonelist_order_handler(struct ctl_table *table, int write,
5549− void __user *buffer, size_t *length,
5550− loff_t *ppos)
5549+ void *buffer, size_t *length, loff_t *ppos)
55515550 {
5552− char *str;
5553− int ret;
5554−
5555− if (!write)
5556− return proc_dostring(table, write, buffer, length, ppos);
5557− str = memdup_user_nul(buffer, 16);
5558− if (IS_ERR(str))
5559− return PTR_ERR(str);
5560−
5561− ret = __parse_numa_zonelist_order(str);
5562− kfree(str);
5563− return ret;
5551+ if (write)
5552+ return __parse_numa_zonelist_order(buffer);
5553+ return proc_dostring(table, write, buffer, length, ppos);
55645554 }
55655555
55665556
@@ -7963,7 +7953,7 @@ core_initcall(init_per_zone_wmark_min) · 2396 unmodified lines
79637953 * changes.
79647954 */
79657955 int min_free_kbytes_sysctl_handler(struct ctl_table *table, int write,
7966− void __user *buffer, size_t *length, loff_t *ppos)
7956+ void *buffer, size_t *length, loff_t *ppos)
79677957 {
79687958 int rc;
79697959
@@ -7978,20 +7968,8 @@ int min_free_kbytes_sysctl_handler(struct ctl_table *table, int write, · 8 unmodified lines
79787968 return 0;
79797969 }
79807970
7981−int watermark_boost_factor_sysctl_handler(struct ctl_table *table, int write,
7982− void __user *buffer, size_t *length, loff_t *ppos)
7983−{
7984− int rc;
7985−
7986− rc = proc_dointvec_minmax(table, write, buffer, length, ppos);
7987− if (rc)
7988− return rc;
7989−
7990− return 0;
7991−}
7992−
79937971 int watermark_scale_factor_sysctl_handler(struct ctl_table *table, int write,
7994− void __user *buffer, size_t *length, loff_t *ppos)
7972+ void *buffer, size_t *length, loff_t *ppos)
79957973 {
79967974 int rc;
79977975
@@ -8021,7 +7999,7 @@ static void setup_min_unmapped_ratio(void) · 23 unmodified lines
80217999
80228000
80238001 int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *table, int write,
8024− void __user *buffer, size_t *length, loff_t *ppos)
8002+ void *buffer, size_t *length, loff_t *ppos)
80258003 {
80268004 int rc;
80278005
@@ -8048,7 +8026,7 @@ static void setup_min_slab_ratio(void) · 20 unmodified lines
80488026 }
80498027
80508028 int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *table, int write,
8051− void __user *buffer, size_t *length, loff_t *ppos)
8029+ void *buffer, size_t *length, loff_t *ppos)
80528030 {
80538031 int rc;
80548032
@@ -8072,7 +8050,7 @@ int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *table, int write, · 17 unmodified lines
80728050 * if in function of the boot time zone sizes.
80738051 */
80748052 int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *table, int write,
8075− void __user *buffer, size_t *length, loff_t *ppos)
8053+ void *buffer, size_t *length, loff_t *ppos)
80768054 {
80778055 proc_dointvec_minmax(table, write, buffer, length, ppos);
80788056 setup_per_zone_lowmem_reserve();
@@ -8094,7 +8072,7 @@ static void __zone_pcp_update(struct zone *zone) · 15 unmodified lines
80948072 * pagelist can have before it gets flushed back to buddy allocator.
80958073 */
80968074 int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *table, int write,
8097− void __user *buffer, size_t *length, loff_t *ppos)
8075+ void *buffer, size_t *length, loff_t *ppos)
80988076 {
80998077 struct zone *zone;
81008078 int old_percpu_pagelist_fraction;
mm/util.c+4−6
@@ -717,9 +717,8 @@ int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; · 716 unmodified lines
717717 unsigned long sysctl_user_reserve_kbytes __read_mostly = 1UL << 17; /* 128MB */
718718 unsigned long sysctl_admin_reserve_kbytes __read_mostly = 1UL << 13; /* 8MB */
719719
720−int overcommit_ratio_handler(struct ctl_table *table, int write,
721− void __user *buffer, size_t *lenp,
722− loff_t *ppos)
720+int overcommit_ratio_handler(struct ctl_table *table, int write, void *buffer,
721+ size_t *lenp, loff_t *ppos)
723722 {
724723 int ret;
725724
@@ -729,9 +728,8 @@ int overcommit_ratio_handler(struct ctl_table *table, int write, · 3 unmodified lines
729728 return ret;
730729 }
731730
732−int overcommit_kbytes_handler(struct ctl_table *table, int write,
733− void __user *buffer, size_t *lenp,
734− loff_t *ppos)
731+int overcommit_kbytes_handler(struct ctl_table *table, int write, void *buffer,
732+ size_t *lenp, loff_t *ppos)
735733 {
736734 int ret;
737735
mm/vmstat.c+2−2
@@ -76,7 +76,7 @@ static void invalid_numa_statistics(void) · 75 unmodified lines
7676 static DEFINE_MUTEX(vm_numa_stat_lock);
7777
7878 int sysctl_vm_numa_stat_handler(struct ctl_table *table, int write,
79− void __user *buffer, size_t *length, loff_t *ppos)
79+ void *buffer, size_t *length, loff_t *ppos)
8080 {
8181 int ret, oldval;
8282
@@ -1751,7 +1751,7 @@ static void refresh_vm_stats(struct work_struct *work) · 1668 unmodified lines
17511751 }
17521752
17531753 int vmstat_refresh(struct ctl_table *table, int write,
1754− void __user *buffer, size_t *lenp, loff_t *ppos)
1754+ void *buffer, size_t *lenp, loff_t *ppos)
17551755 {
17561756 long val;
17571757 int err;
net/bridge/br_netfilter_hooks.c+1−1
@@ -1027,7 +1027,7 @@ int br_nf_hook_thresh(unsigned int hook, struct net *net, · 1026 unmodified lines
10271027 #ifdef CONFIG_SYSCTL
10281028 static
10291029 int brnf_sysctl_call_tables(struct ctl_table *ctl, int write,
1030− void __user *buffer, size_t *lenp, loff_t *ppos)
1030+ void *buffer, size_t *lenp, loff_t *ppos)
10311031 {
10321032 int ret;
10331033
net/core/neighbour.c+13−15
@@ -3379,7 +3379,7 @@ EXPORT_SYMBOL(neigh_app_ns); · 3378 unmodified lines
33793379 static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN);
33803380
33813381 static int proc_unres_qlen(struct ctl_table *ctl, int write,
3382− void __user *buffer, size_t *lenp, loff_t *ppos)
3382+ void *buffer, size_t *lenp, loff_t *ppos)
33833383 {
33843384 int size, ret;
33853385 struct ctl_table tmp = *ctl;
@@ -3443,8 +3443,8 @@ static void neigh_proc_update(struct ctl_table *ctl, int write) · 57 unmodified lines
34433443 }
34443444
34453445 static int neigh_proc_dointvec_zero_intmax(struct ctl_table *ctl, int write,
3446− void __user *buffer,
3447− size_t *lenp, loff_t *ppos)
3446+ void *buffer, size_t *lenp,
3447+ loff_t *ppos)
34483448 {
34493449 struct ctl_table tmp = *ctl;
34503450 int ret;
@@ -3457,8 +3457,8 @@ static int neigh_proc_dointvec_zero_intmax(struct ctl_table *ctl, int write, · 6 unmodified lines
34573457 return ret;
34583458 }
34593459
3460−int neigh_proc_dointvec(struct ctl_table *ctl, int write,
3461− void __user *buffer, size_t *lenp, loff_t *ppos)
3460+int neigh_proc_dointvec(struct ctl_table *ctl, int write, void *buffer,
3461+ size_t *lenp, loff_t *ppos)
34623462 {
34633463 int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
34643464
@@ -3467,8 +3467,7 @@ int neigh_proc_dointvec(struct ctl_table *ctl, int write, · 2 unmodified lines
34673467 }
34683468 EXPORT_SYMBOL(neigh_proc_dointvec);
34693469
3470−int neigh_proc_dointvec_jiffies(struct ctl_table *ctl, int write,
3471− void __user *buffer,
3470+int neigh_proc_dointvec_jiffies(struct ctl_table *ctl, int write, void *buffer,
34723471 size_t *lenp, loff_t *ppos)
34733472 {
34743473 int ret = proc_dointvec_jiffies(ctl, write, buffer, lenp, ppos);
@@ -3479,8 +3478,8 @@ int neigh_proc_dointvec_jiffies(struct ctl_table *ctl, int write, · 4 unmodified lines
34793478 EXPORT_SYMBOL(neigh_proc_dointvec_jiffies);
34803479
34813480 static int neigh_proc_dointvec_userhz_jiffies(struct ctl_table *ctl, int write,
3482− void __user *buffer,
3483− size_t *lenp, loff_t *ppos)
3481+ void *buffer, size_t *lenp,
3482+ loff_t *ppos)
34843483 {
34853484 int ret = proc_dointvec_userhz_jiffies(ctl, write, buffer, lenp, ppos);
34863485
@@ -3489,8 +3488,7 @@ static int neigh_proc_dointvec_userhz_jiffies(struct ctl_table *ctl, int write, · 2 unmodified lines
34893488 }
34903489
34913490 int neigh_proc_dointvec_ms_jiffies(struct ctl_table *ctl, int write,
3492− void __user *buffer,
3493− size_t *lenp, loff_t *ppos)
3491+ void *buffer, size_t *lenp, loff_t *ppos)
34943492 {
34953493 int ret = proc_dointvec_ms_jiffies(ctl, write, buffer, lenp, ppos);
34963494
@@ -3500,8 +3498,8 @@ int neigh_proc_dointvec_ms_jiffies(struct ctl_table *ctl, int write, · 3 unmodified lines
35003498 EXPORT_SYMBOL(neigh_proc_dointvec_ms_jiffies);
35013499
35023500 static int neigh_proc_dointvec_unres_qlen(struct ctl_table *ctl, int write,
3503− void __user *buffer,
3504− size_t *lenp, loff_t *ppos)
3501+ void *buffer, size_t *lenp,
3502+ loff_t *ppos)
35053503 {
35063504 int ret = proc_unres_qlen(ctl, write, buffer, lenp, ppos);
35073505
@@ -3510,8 +3508,8 @@ static int neigh_proc_dointvec_unres_qlen(struct ctl_table *ctl, int write, · 2 unmodified lines
35103508 }
35113509
35123510 static int neigh_proc_base_reachable_time(struct ctl_table *ctl, int write,
3513− void __user *buffer,
3514− size_t *lenp, loff_t *ppos)
3511+ void *buffer, size_t *lenp,
3512+ loff_t *ppos)
35153513 {
35163514 struct neigh_parms *p = ctl->extra2;
35173515 int ret;
net/core/sysctl_net_core.c+10−17
@@ -45,7 +45,7 @@ EXPORT_SYMBOL(sysctl_devconf_inherit_init_net); · 44 unmodified lines
4545
4646 #ifdef CONFIG_RPS
4747 static int rps_sock_flow_sysctl(struct ctl_table *table, int write,
48− void __user *buffer, size_t *lenp, loff_t *ppos)
48+ void *buffer, size_t *lenp, loff_t *ppos)
4949 {
5050 unsigned int orig_size, size;
5151 int ret, i;
@@ -115,8 +115,7 @@ static int rps_sock_flow_sysctl(struct ctl_table *table, int write, · 63 unmodified lines
115115 static DEFINE_MUTEX(flow_limit_update_mutex);
116116
117117 static int flow_limit_cpu_sysctl(struct ctl_table *table, int write,
118− void __user *buffer, size_t *lenp,
119− loff_t *ppos)
118+ void *buffer, size_t *lenp, loff_t *ppos)
120119 {
121120 struct sd_flow_limit *cur;
122121 struct softnet_data *sd;
@@ -180,10 +179,7 @@ write_unlock: · 57 unmodified lines
180179 }
181180 if (len < *lenp)
182181 kbuf[len++] = '\n';
183− if (copy_to_user(buffer, kbuf, len)) {
184− ret = -EFAULT;
185− goto done;
186− }
182+ memcpy(buffer, kbuf, len);
187183 *lenp = len;
188184 *ppos += len;
189185 }
@@ -194,8 +190,7 @@ done: · 4 unmodified lines
194190 }
195191
196192 static int flow_limit_table_len_sysctl(struct ctl_table *table, int write,
197− void __user *buffer, size_t *lenp,
198− loff_t *ppos)
193+ void *buffer, size_t *lenp, loff_t *ppos)
199194 {
200195 unsigned int old, *ptr;
201196 int ret;
@@ -217,7 +212,7 @@ static int flow_limit_table_len_sysctl(struct ctl_table *table, int write, · 15 unmodified lines
217212
218213 #ifdef CONFIG_NET_SCHED
219214 static int set_default_qdisc(struct ctl_table *table, int write,
220− void __user *buffer, size_t *lenp, loff_t *ppos)
215+ void *buffer, size_t *lenp, loff_t *ppos)
221216 {
222217 char id[IFNAMSIZ];
223218 struct ctl_table tbl = {
@@ -236,7 +231,7 @@ static int set_default_qdisc(struct ctl_table *table, int write, · 12 unmodified lines
236231 #endif
237232
238233 static int proc_do_dev_weight(struct ctl_table *table, int write,
239− void __user *buffer, size_t *lenp, loff_t *ppos)
234+ void *buffer, size_t *lenp, loff_t *ppos)
240235 {
241236 int ret;
242237
@@ -251,7 +246,7 @@ static int proc_do_dev_weight(struct ctl_table *table, int write, · 8 unmodified lines
251246 }
252247
253248 static int proc_do_rss_key(struct ctl_table *table, int write,
254− void __user *buffer, size_t *lenp, loff_t *ppos)
249+ void *buffer, size_t *lenp, loff_t *ppos)
255250 {
256251 struct ctl_table fake_table;
257252 char buf[NETDEV_RSS_KEY_LEN * 3];
@@ -264,7 +259,7 @@ static int proc_do_rss_key(struct ctl_table *table, int write, · 6 unmodified lines
264259
265260 #ifdef CONFIG_BPF_JIT
266261 static int proc_dointvec_minmax_bpf_enable(struct ctl_table *table, int write,
267− void __user *buffer, size_t *lenp,
262+ void *buffer, size_t *lenp,
268263 loff_t *ppos)
269264 {
270265 int ret, jit_enable = *(int *)table->data;
@@ -291,8 +286,7 @@ static int proc_dointvec_minmax_bpf_enable(struct ctl_table *table, int write, · 20 unmodified lines
291286 # ifdef CONFIG_HAVE_EBPF_JIT
292287 static int
293288 proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write,
294− void __user *buffer, size_t *lenp,
295− loff_t *ppos)
289+ void *buffer, size_t *lenp, loff_t *ppos)
296290 {
297291 if (!capable(CAP_SYS_ADMIN))
298292 return -EPERM;
@@ -303,8 +297,7 @@ proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write, · 4 unmodified lines
303297
304298 static int
305299 proc_dolongvec_minmax_bpf_restricted(struct ctl_table *table, int write,
306− void __user *buffer, size_t *lenp,
307− loff_t *ppos)
300+ void *buffer, size_t *lenp, loff_t *ppos)
308301 {
309302 if (!capable(CAP_SYS_ADMIN))
310303 return -EPERM;
net/decnet/dn_dev.c+3−4
@@ -160,8 +160,8 @@ static int max_t3[] = { 8191 }; /* Must fit in 16 bits when multiplied by BCT3MU · 159 unmodified lines
160160 static int min_priority[1];
161161 static int max_priority[] = { 127 }; /* From DECnet spec */
162162
163−static int dn_forwarding_proc(struct ctl_table *, int,
164− void __user *, size_t *, loff_t *);
163+static int dn_forwarding_proc(struct ctl_table *, int, void *, size_t *,
164+ loff_t *);
165165 static struct dn_dev_sysctl_table {
166166 struct ctl_table_header *sysctl_header;
167167 struct ctl_table dn_dev_vars[5];
@@ -245,8 +245,7 @@ static void dn_dev_sysctl_unregister(struct dn_dev_parms *parms) · 77 unmodified lines
245245 }
246246
247247 static int dn_forwarding_proc(struct ctl_table *table, int write,
248− void __user *buffer,
249− size_t *lenp, loff_t *ppos)
248+ void *buffer, size_t *lenp, loff_t *ppos)
250249 {
251250 #ifdef CONFIG_DECNET_ROUTER
252251 struct net_device *dev = table->extra1;
net/decnet/sysctl_net_decnet.c+8−19
@@ -134,8 +134,7 @@ static int parse_addr(__le16 *addr, char *str) · 133 unmodified lines
134134 }
135135
136136 static int dn_node_address_handler(struct ctl_table *table, int write,
137− void __user *buffer,
138− size_t *lenp, loff_t *ppos)
137+ void *buffer, size_t *lenp, loff_t *ppos)
139138 {
140139 char addr[DN_ASCBUF_LEN];
141140 size_t len;
@@ -148,10 +147,7 @@ static int dn_node_address_handler(struct ctl_table *table, int write, · 6 unmodified lines
148147
149148 if (write) {
150149 len = (*lenp < DN_ASCBUF_LEN) ? *lenp : (DN_ASCBUF_LEN-1);
151−
152− if (copy_from_user(addr, buffer, len))
153− return -EFAULT;
154−
150+ memcpy(addr, buffer, len);
155151 addr[len] = 0;
156152 strip_it(addr);
157153
@@ -173,11 +169,9 @@ static int dn_node_address_handler(struct ctl_table *table, int write, · 15 unmodified lines
173169 len = strlen(addr);
174170 addr[len++] = '\n';
175171
176− if (len > *lenp) len = *lenp;
177−
178− if (copy_to_user(buffer, addr, len))
179− return -EFAULT;
180−
172+ if (len > *lenp)
173+ len = *lenp;
174+ memcpy(buffer, addr, len);
181175 *lenp = len;
182176 *ppos += len;
183177
@@ -185,8 +179,7 @@ static int dn_node_address_handler(struct ctl_table *table, int write, · 1 unmodified line
185179 }
186180
187181 static int dn_def_dev_handler(struct ctl_table *table, int write,
188− void __user *buffer,
189− size_t *lenp, loff_t *ppos)
182+ void *buffer, size_t *lenp, loff_t *ppos)
190183 {
191184 size_t len;
192185 struct net_device *dev;
@@ -201,9 +194,7 @@ static int dn_def_dev_handler(struct ctl_table *table, int write, · 8 unmodified lines
201194 if (*lenp > 16)
202195 return -E2BIG;
203196
204− if (copy_from_user(devname, buffer, *lenp))
205− return -EFAULT;
206−
197+ memcpy(devname, buffer, *lenp);
207198 devname[*lenp] = 0;
208199 strip_it(devname);
209200
@@ -238,9 +229,7 @@ static int dn_def_dev_handler(struct ctl_table *table, int write, · 28 unmodified lines
238229
239230 if (len > *lenp) len = *lenp;
240231
241− if (copy_to_user(buffer, devname, len))
242− return -EFAULT;
243−
232+ memcpy(buffer, devname, len);
244233 *lenp = len;
245234 *ppos += len;
246235
net/ipv4/devinet.c+3−6
@@ -2366,8 +2366,7 @@ static int devinet_conf_ifindex(struct net *net, struct ipv4_devconf *cnf) · 2365 unmodified lines
23662366 }
23672367
23682368 static int devinet_conf_proc(struct ctl_table *ctl, int write,
2369− void __user *buffer,
2370− size_t *lenp, loff_t *ppos)
2369+ void *buffer, size_t *lenp, loff_t *ppos)
23712370 {
23722371 int old_value = *(int *)ctl->data;
23732372 int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
@@ -2419,8 +2418,7 @@ static int devinet_conf_proc(struct ctl_table *ctl, int write, · 45 unmodified lines
24192418 }
24202419
24212420 static int devinet_sysctl_forward(struct ctl_table *ctl, int write,
2422− void __user *buffer,
2423− size_t *lenp, loff_t *ppos)
2421+ void *buffer, size_t *lenp, loff_t *ppos)
24242422 {
24252423 int *valp = ctl->data;
24262424 int val = *valp;
@@ -2463,8 +2461,7 @@ static int devinet_sysctl_forward(struct ctl_table *ctl, int write, · 36 unmodified lines
24632461 }
24642462
24652463 static int ipv4_doint_and_flush(struct ctl_table *ctl, int write,
2466− void __user *buffer,
2467− size_t *lenp, loff_t *ppos)
2464+ void *buffer, size_t *lenp, loff_t *ppos)
24682465 {
24692466 int *valp = ctl->data;
24702467 int val = *valp;
net/ipv4/route.c+1−2
@@ -3336,8 +3336,7 @@ static int ip_rt_gc_elasticity __read_mostly = 8; · 3335 unmodified lines
33363336 static int ip_min_valid_pmtu __read_mostly = IPV4_MIN_MTU;
33373337
33383338 static int ipv4_sysctl_rtcache_flush(struct ctl_table *__ctl, int write,
3339− void __user *buffer,
3340− size_t *lenp, loff_t *ppos)
3339+ void *buffer, size_t *lenp, loff_t *ppos)
33413340 {
33423341 struct net *net = (struct net *)__ctl->extra1;
33433342
net/ipv4/sysctl_net_ipv4.c+15−23
@@ -71,8 +71,7 @@ static void set_local_port_range(struct net *net, int range[2]) · 70 unmodified lines
7171
7272 /* Validate changes from /proc interface. */
7373 static int ipv4_local_port_range(struct ctl_table *table, int write,
74− void __user *buffer,
75− size_t *lenp, loff_t *ppos)
74+ void *buffer, size_t *lenp, loff_t *ppos)
7675 {
7776 struct net *net =
7877 container_of(table->data, struct net, ipv4.ip_local_ports.range);
@@ -107,7 +106,7 @@ static int ipv4_local_port_range(struct ctl_table *table, int write, · 28 unmodified lines
107106
108107 /* Validate changes from /proc interface. */
109108 static int ipv4_privileged_ports(struct ctl_table *table, int write,
110− void __user *buffer, size_t *lenp, loff_t *ppos)
109+ void *buffer, size_t *lenp, loff_t *ppos)
111110 {
112111 struct net *net = container_of(table->data, struct net,
113112 ipv4.sysctl_ip_prot_sock);
@@ -168,8 +167,7 @@ static void set_ping_group_range(struct ctl_table *table, kgid_t low, kgid_t hig · 54 unmodified lines
168167
169168 /* Validate changes from /proc interface. */
170169 static int ipv4_ping_group_range(struct ctl_table *table, int write,
171− void __user *buffer,
172− size_t *lenp, loff_t *ppos)
170+ void *buffer, size_t *lenp, loff_t *ppos)
173171 {
174172 struct user_namespace *user_ns = current_user_ns();
175173 int ret;
@@ -204,8 +202,7 @@ static int ipv4_ping_group_range(struct ctl_table *table, int write, · 28 unmodified lines
204202 }
205203
206204 static int ipv4_fwd_update_priority(struct ctl_table *table, int write,
207− void __user *buffer,
208− size_t *lenp, loff_t *ppos)
205+ void *buffer, size_t *lenp, loff_t *ppos)
209206 {
210207 struct net *net;
211208 int ret;
@@ -221,7 +218,7 @@ static int ipv4_fwd_update_priority(struct ctl_table *table, int write, · 9 unmodified lines
221218 }
222219
223220 static int proc_tcp_congestion_control(struct ctl_table *ctl, int write,
224− void __user *buffer, size_t *lenp, loff_t *ppos)
221+ void *buffer, size_t *lenp, loff_t *ppos)
225222 {
226223 struct net *net = container_of(ctl->data, struct net,
227224 ipv4.tcp_congestion_control);
@@ -241,9 +238,8 @@ static int proc_tcp_congestion_control(struct ctl_table *ctl, int write, · 13 unmodified lines
241238 }
242239
243240 static int proc_tcp_available_congestion_control(struct ctl_table *ctl,
244− int write,
245− void __user *buffer, size_t *lenp,
246− loff_t *ppos)
241+ int write, void *buffer,
242+ size_t *lenp, loff_t *ppos)
247243 {
248244 struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX, };
249245 int ret;
@@ -258,9 +254,8 @@ static int proc_tcp_available_congestion_control(struct ctl_table *ctl, · 8 unmodified lines
258254 }
259255
260256 static int proc_allowed_congestion_control(struct ctl_table *ctl,
261− int write,
262− void __user *buffer, size_t *lenp,
263− loff_t *ppos)
257+ int write, void *buffer,
258+ size_t *lenp, loff_t *ppos)
264259 {
265260 struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX };
266261 int ret;
@@ -296,8 +291,7 @@ static int sscanf_key(char *buf, __le32 *key) · 29 unmodified lines
296291 }
297292
298293 static int proc_tcp_fastopen_key(struct ctl_table *table, int write,
299− void __user *buffer, size_t *lenp,
300− loff_t *ppos)
294+ void *buffer, size_t *lenp, loff_t *ppos)
301295 {
302296 struct net *net = container_of(table->data, struct net,
303297 ipv4.sysctl_tcp_fastopen);
@@ -399,7 +393,7 @@ static void proc_configure_early_demux(int enabled, int protocol) · 95 unmodified lines
399393 }
400394
401395 static int proc_tcp_early_demux(struct ctl_table *table, int write,
402− void __user *buffer, size_t *lenp, loff_t *ppos)
396+ void *buffer, size_t *lenp, loff_t *ppos)
403397 {
404398 int ret = 0;
405399
@@ -415,7 +409,7 @@ static int proc_tcp_early_demux(struct ctl_table *table, int write, · 9 unmodified lines
415409 }
416410
417411 static int proc_udp_early_demux(struct ctl_table *table, int write,
418− void __user *buffer, size_t *lenp, loff_t *ppos)
412+ void *buffer, size_t *lenp, loff_t *ppos)
419413 {
420414 int ret = 0;
421415
@@ -431,8 +425,7 @@ static int proc_udp_early_demux(struct ctl_table *table, int write, · 9 unmodified lines
431425 }
432426
433427 static int proc_tfo_blackhole_detect_timeout(struct ctl_table *table,
434− int write,
435− void __user *buffer,
428+ int write, void *buffer,
436429 size_t *lenp, loff_t *ppos)
437430 {
438431 struct net *net = container_of(table->data, struct net,
@@ -447,8 +440,7 @@ static int proc_tfo_blackhole_detect_timeout(struct ctl_table *table, · 8 unmodified lines
447440 }
448441
449442 static int proc_tcp_available_ulp(struct ctl_table *ctl,
450− int write,
451− void __user *buffer, size_t *lenp,
443+ int write, void *buffer, size_t *lenp,
452444 loff_t *ppos)
453445 {
454446 struct ctl_table tbl = { .maxlen = TCP_ULP_BUF_MAX, };
@@ -466,7 +458,7 @@ static int proc_tcp_available_ulp(struct ctl_table *ctl, · 11 unmodified lines
466458
467459 #ifdef CONFIG_IP_ROUTE_MULTIPATH
468460 static int proc_fib_multipath_hash_policy(struct ctl_table *table, int write,
469− void __user *buffer, size_t *lenp,
461+ void *buffer, size_t *lenp,
470462 loff_t *ppos)
471463 {
472464 struct net *net = container_of(table->data, struct net,
net/ipv6/addrconf.c+13−20
@@ -6095,9 +6095,8 @@ static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) · 6094 unmodified lines
60956095
60966096 #ifdef CONFIG_SYSCTL
60976097
6098−static
6099−int addrconf_sysctl_forward(struct ctl_table *ctl, int write,
6100− void __user *buffer, size_t *lenp, loff_t *ppos)
6098+static int addrconf_sysctl_forward(struct ctl_table *ctl, int write,
6099+ void *buffer, size_t *lenp, loff_t *ppos)
61016100 {
61026101 int *valp = ctl->data;
61036102 int val = *valp;
@@ -6121,9 +6120,8 @@ int addrconf_sysctl_forward(struct ctl_table *ctl, int write, · 17 unmodified lines
61216120 return ret;
61226121 }
61236122
6124−static
6125−int addrconf_sysctl_mtu(struct ctl_table *ctl, int write,
6126− void __user *buffer, size_t *lenp, loff_t *ppos)
6123+static int addrconf_sysctl_mtu(struct ctl_table *ctl, int write,
6124+ void *buffer, size_t *lenp, loff_t *ppos)
61276125 {
61286126 struct inet6_dev *idev = ctl->extra1;
61296127 int min_mtu = IPV6_MIN_MTU;
@@ -6193,9 +6191,8 @@ static int addrconf_disable_ipv6(struct ctl_table *table, int *p, int newf) · 63 unmodified lines
61936191 return 0;
61946192 }
61956193
6196−static
6197−int addrconf_sysctl_disable(struct ctl_table *ctl, int write,
6198− void __user *buffer, size_t *lenp, loff_t *ppos)
6194+static int addrconf_sysctl_disable(struct ctl_table *ctl, int write,
6195+ void *buffer, size_t *lenp, loff_t *ppos)
61996196 {
62006197 int *valp = ctl->data;
62016198 int val = *valp;
@@ -6219,9 +6216,8 @@ int addrconf_sysctl_disable(struct ctl_table *ctl, int write, · 17 unmodified lines
62196216 return ret;
62206217 }
62216218
6222−static
6223−int addrconf_sysctl_proxy_ndp(struct ctl_table *ctl, int write,
6224− void __user *buffer, size_t *lenp, loff_t *ppos)
6219+static int addrconf_sysctl_proxy_ndp(struct ctl_table *ctl, int write,
6220+ void *buffer, size_t *lenp, loff_t *ppos)
62256221 {
62266222 int *valp = ctl->data;
62276223 int ret;
@@ -6262,7 +6258,7 @@ int addrconf_sysctl_proxy_ndp(struct ctl_table *ctl, int write, · 34 unmodified lines
62626258 }
62636259
62646260 static int addrconf_sysctl_addr_gen_mode(struct ctl_table *ctl, int write,
6265− void __user *buffer, size_t *lenp,
6261+ void *buffer, size_t *lenp,
62666262 loff_t *ppos)
62676263 {
62686264 int ret = 0;
@@ -6324,7 +6320,7 @@ out: · 55 unmodified lines
63246320 }
63256321
63266322 static int addrconf_sysctl_stable_secret(struct ctl_table *ctl, int write,
6327− void __user *buffer, size_t *lenp,
6323+ void *buffer, size_t *lenp,
63286324 loff_t *ppos)
63296325 {
63306326 int err;
@@ -6391,8 +6387,7 @@ out: · 60 unmodified lines
63916387
63926388 static
63936389 int addrconf_sysctl_ignore_routes_with_linkdown(struct ctl_table *ctl,
6394− int write,
6395− void __user *buffer,
6390+ int write, void *buffer,
63966391 size_t *lenp,
63976392 loff_t *ppos)
63986393 {
@@ -6492,10 +6487,8 @@ int addrconf_disable_policy(struct ctl_table *ctl, int *valp, int val) · 93 unmodified lines
64926487 return 0;
64936488 }
64946489
6495−static
6496−int addrconf_sysctl_disable_policy(struct ctl_table *ctl, int write,
6497− void __user *buffer, size_t *lenp,
6498− loff_t *ppos)
6490+static int addrconf_sysctl_disable_policy(struct ctl_table *ctl, int write,
6491+ void *buffer, size_t *lenp, loff_t *ppos)
64996492 {
65006493 int *valp = ctl->data;
65016494 int val = *valp;
net/ipv6/ndisc.c+2−1
@@ -1835,7 +1835,8 @@ static void ndisc_warn_deprecated_sysctl(struct ctl_table *ctl, · 1834 unmodified lines
18351835 }
18361836 }
18371837
1838−int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
1838+int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, void *buffer,
1839+ size_t *lenp, loff_t *ppos)
18391840 {
18401841 struct net_device *dev = ctl->extra1;
18411842 struct inet6_dev *idev;
net/ipv6/route.c+2−3
@@ -6088,9 +6088,8 @@ static int rt6_stats_seq_show(struct seq_file *seq, void *v) · 6087 unmodified lines
60886088
60896089 #ifdef CONFIG_SYSCTL
60906090
6091−static
6092−int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write,
6093− void __user *buffer, size_t *lenp, loff_t *ppos)
6091+static int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write,
6092+ void *buffer, size_t *lenp, loff_t *ppos)
60946093 {
60956094 struct net *net;
60966095 int delay;
net/ipv6/sysctl_net_ipv6.c+1−2
@@ -26,8 +26,7 @@ static int auto_flowlabels_min; · 25 unmodified lines
2626 static int auto_flowlabels_max = IP6_AUTO_FLOW_LABEL_MAX;
2727
2828 static int proc_rt6_multipath_hash_policy(struct ctl_table *table, int write,
29− void __user *buffer, size_t *lenp,
30− loff_t *ppos)
29+ void *buffer, size_t *lenp, loff_t *ppos)
3130 {
3231 struct net *net;
3332 int ret;
net/mpls/af_mpls.c+2−3
@@ -1362,8 +1362,7 @@ done: · 1361 unmodified lines
13621362 (&((struct mpls_dev *)0)->field)
13631363
13641364 static int mpls_conf_proc(struct ctl_table *ctl, int write,
1365− void __user *buffer,
1366− size_t *lenp, loff_t *ppos)
1365+ void *buffer, size_t *lenp, loff_t *ppos)
13671366 {
13681367 int oval = *(int *)ctl->data;
13691368 int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
@@ -2594,7 +2593,7 @@ nolabels: · 1224 unmodified lines
25942593 }
25952594
25962595 static int mpls_platform_labels(struct ctl_table *table, int write,
2597− void __user *buffer, size_t *lenp, loff_t *ppos)
2596+ void *buffer, size_t *lenp, loff_t *ppos)
25982597 {
25992598 struct net *net = table->data;
26002599 int platform_labels = net->mpls.platform_labels;
net/netfilter/ipvs/ip_vs_ctl.c+3−3
@@ -1736,7 +1736,7 @@ static int three = 3; · 1735 unmodified lines
17361736
17371737 static int
17381738 proc_do_defense_mode(struct ctl_table *table, int write,
1739− void __user *buffer, size_t *lenp, loff_t *ppos)
1739+ void *buffer, size_t *lenp, loff_t *ppos)
17401740 {
17411741 struct netns_ipvs *ipvs = table->extra2;
17421742 int *valp = table->data;
@@ -1763,7 +1763,7 @@ proc_do_defense_mode(struct ctl_table *table, int write, · 20 unmodified lines
17631763
17641764 static int
17651765 proc_do_sync_threshold(struct ctl_table *table, int write,
1766− void __user *buffer, size_t *lenp, loff_t *ppos)
1766+ void *buffer, size_t *lenp, loff_t *ppos)
17671767 {
17681768 int *valp = table->data;
17691769 int val[2];
@@ -1788,7 +1788,7 @@ proc_do_sync_threshold(struct ctl_table *table, int write, · 18 unmodified lines
17881788
17891789 static int
17901790 proc_do_sync_ports(struct ctl_table *table, int write,
1791− void __user *buffer, size_t *lenp, loff_t *ppos)
1791+ void *buffer, size_t *lenp, loff_t *ppos)
17921792 {
17931793 int *valp = table->data;
17941794 int val = *valp;
net/netfilter/nf_conntrack_standalone.c+1−1
@@ -517,7 +517,7 @@ static unsigned int nf_conntrack_htable_size_user __read_mostly; · 516 unmodified lines
517517
518518 static int
519519 nf_conntrack_hash_sysctl(struct ctl_table *table, int write,
520− void __user *buffer, size_t *lenp, loff_t *ppos)
520+ void *buffer, size_t *lenp, loff_t *ppos)
521521 {
522522 int ret;
523523
net/netfilter/nf_log.c+1−1
@@ -414,7 +414,7 @@ static struct ctl_table nf_log_sysctl_ftable[] = { · 413 unmodified lines
414414 };
415415
416416 static int nf_log_proc_dostring(struct ctl_table *table, int write,
417− void __user *buffer, size_t *lenp, loff_t *ppos)
417+ void *buffer, size_t *lenp, loff_t *ppos)
418418 {
419419 const struct nf_logger *logger;
420420 char buf[NFLOGGER_NAME_LEN];
net/phonet/sysctl.c+1−2
@@ -49,8 +49,7 @@ void phonet_get_local_port_range(int *min, int *max) · 48 unmodified lines
4949 }
5050
5151 static int proc_local_port_range(struct ctl_table *table, int write,
52− void __user *buffer,
53− size_t *lenp, loff_t *ppos)
52+ void *buffer, size_t *lenp, loff_t *ppos)
5453 {
5554 int ret;
5655 int range[2] = {local_port_range[0], local_port_range[1]};
net/rds/tcp.c+2−4
@@ -62,8 +62,7 @@ static atomic_t rds_tcp_unloading = ATOMIC_INIT(0); · 61 unmodified lines
6262 static struct kmem_cache *rds_tcp_conn_slab;
6363
6464 static int rds_tcp_skbuf_handler(struct ctl_table *ctl, int write,
65− void __user *buffer, size_t *lenp,
66− loff_t *fpos);
65+ void *buffer, size_t *lenp, loff_t *fpos);
6766
6867 static int rds_tcp_min_sndbuf = SOCK_MIN_SNDBUF;
6968 static int rds_tcp_min_rcvbuf = SOCK_MIN_RCVBUF;
@@ -676,8 +675,7 @@ static void rds_tcp_sysctl_reset(struct net *net) · 606 unmodified lines
676675 }
677676
678677 static int rds_tcp_skbuf_handler(struct ctl_table *ctl, int write,
679− void __user *buffer, size_t *lenp,
680− loff_t *fpos)
678+ void *buffer, size_t *lenp, loff_t *fpos)
681679 {
682680 struct net *net = current->nsproxy->net_ns;
683681 int err;
net/sctp/sysctl.c+11−21
@@ -43,20 +43,15 @@ static unsigned long max_autoclose_max = · 42 unmodified lines
4343 ? UINT_MAX : MAX_SCHEDULE_TIMEOUT / HZ;
4444
4545 static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write,
46− void __user *buffer, size_t *lenp,
47− loff_t *ppos);
46+ void *buffer, size_t *lenp, loff_t *ppos);
4847 static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write,
49− void __user *buffer, size_t *lenp,
50− loff_t *ppos);
51−static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write,
52− void __user *buffer, size_t *lenp,
53− loff_t *ppos);
48+ void *buffer, size_t *lenp, loff_t *ppos);
49+static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, void *buffer,
50+ size_t *lenp, loff_t *ppos);
5451 static int proc_sctp_do_alpha_beta(struct ctl_table *ctl, int write,
55− void __user *buffer, size_t *lenp,
56− loff_t *ppos);
52+ void *buffer, size_t *lenp, loff_t *ppos);
5753 static int proc_sctp_do_auth(struct ctl_table *ctl, int write,
58− void __user *buffer, size_t *lenp,
59− loff_t *ppos);
54+ void *buffer, size_t *lenp, loff_t *ppos);
6055
6156 static struct ctl_table sctp_table[] = {
6257 {
@@ -343,8 +338,7 @@ static struct ctl_table sctp_net_table[] = { · 280 unmodified lines
343338 };
344339
345340 static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write,
346− void __user *buffer, size_t *lenp,
347− loff_t *ppos)
341+ void *buffer, size_t *lenp, loff_t *ppos)
348342 {
349343 struct net *net = current->nsproxy->net_ns;
350344 struct ctl_table tbl;
@@ -389,8 +383,7 @@ static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write, · 38 unmodified lines
389383 }
390384
391385 static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write,
392− void __user *buffer, size_t *lenp,
393− loff_t *ppos)
386+ void *buffer, size_t *lenp, loff_t *ppos)
394387 {
395388 struct net *net = current->nsproxy->net_ns;
396389 unsigned int min = *(unsigned int *) ctl->extra1;
@@ -418,8 +411,7 @@ static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write, · 21 unmodified lines
418411 }
419412
420413 static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write,
421− void __user *buffer, size_t *lenp,
422− loff_t *ppos)
414+ void *buffer, size_t *lenp, loff_t *ppos)
423415 {
424416 struct net *net = current->nsproxy->net_ns;
425417 unsigned int min = *(unsigned int *) ctl->extra1;
@@ -447,8 +439,7 @@ static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, · 21 unmodified lines
447439 }
448440
449441 static int proc_sctp_do_alpha_beta(struct ctl_table *ctl, int write,
450− void __user *buffer, size_t *lenp,
451− loff_t *ppos)
442+ void *buffer, size_t *lenp, loff_t *ppos)
452443 {
453444 if (write)
454445 pr_warn_once("Changing rto_alpha or rto_beta may lead to "
@@ -458,8 +449,7 @@ static int proc_sctp_do_alpha_beta(struct ctl_table *ctl, int write, · 3 unmodified lines
458449 }
459450
460451 static int proc_sctp_do_auth(struct ctl_table *ctl, int write,
461− void __user *buffer, size_t *lenp,
462− loff_t *ppos)
452+ void *buffer, size_t *lenp, loff_t *ppos)
463453 {
464454 struct net *net = current->nsproxy->net_ns;
465455 struct ctl_table tbl;
net/sunrpc/sysctl.c+13−16
@@ -60,7 +60,7 @@ rpc_unregister_sysctl(void) · 59 unmodified lines
6060 }
6161
6262 static int proc_do_xprt(struct ctl_table *table, int write,
63− void __user *buffer, size_t *lenp, loff_t *ppos)
63+ void *buffer, size_t *lenp, loff_t *ppos)
6464 {
6565 char tmpbuf[256];
6666 size_t len;
@@ -70,15 +70,15 @@ static int proc_do_xprt(struct ctl_table *table, int write, · 3 unmodified lines
7070 return 0;
7171 }
7272 len = svc_print_xprts(tmpbuf, sizeof(tmpbuf));
73− return simple_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len);
73+ return memory_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len);
7474 }
7575
7676 static int
77−proc_dodebug(struct ctl_table *table, int write,
78− void __user *buffer, size_t *lenp, loff_t *ppos)
77+proc_dodebug(struct ctl_table *table, int write, void *buffer, size_t *lenp,
78+ loff_t *ppos)
7979 {
80− char tmpbuf[20], c, *s = NULL;
81− char __user *p;
80+ char tmpbuf[20], *s = NULL;
81+ char *p;
8282 unsigned int value;
8383 size_t left, len;
8484
@@ -90,18 +90,17 @@ proc_dodebug(struct ctl_table *table, int write, · 5 unmodified lines
9090 left = *lenp;
9191
9292 if (write) {
93− if (!access_ok(buffer, left))
94− return -EFAULT;
9593 p = buffer;
96− while (left && __get_user(c, p) >= 0 && isspace(c))
97− left--, p++;
94+ while (left && isspace(*p)) {
95+ left--;
96+ p++;
97+ }
9898 if (!left)
9999 goto done;
100100
101101 if (left > sizeof(tmpbuf) - 1)
102102 return -EINVAL;
103− if (copy_from_user(tmpbuf, p, left))
104− return -EFAULT;
103+ memcpy(tmpbuf, p, left);
105104 tmpbuf[left] = '\0';
106105
107106 value = simple_strtol(tmpbuf, &s, 0);
@@ -121,11 +120,9 @@ proc_dodebug(struct ctl_table *table, int write, · 13 unmodified lines
121120 len = sprintf(tmpbuf, "0x%04x", *(unsigned int *) table->data);
122121 if (len > left)
123122 len = left;
124− if (copy_to_user(buffer, tmpbuf, len))
125− return -EFAULT;
123+ memcpy(buffer, tmpbuf, len);
126124 if ((left -= len) > 0) {
127− if (put_user('\n', (char __user *)buffer + len))
128− return -EFAULT;
125+ *((char *)buffer + len) = '\n';
129126 left--;
130127 }
131128 }
net/sunrpc/xprtrdma/svc_rdma.c+3−4
@@ -80,8 +80,7 @@ atomic_t rdma_stat_sq_prod; · 79 unmodified lines
8080 * current value.
8181 */
8282 static int read_reset_stat(struct ctl_table *table, int write,
83− void __user *buffer, size_t *lenp,
84− loff_t *ppos)
83+ void *buffer, size_t *lenp, loff_t *ppos)
8584 {
8685 atomic_t *stat = (atomic_t *)table->data;
8786
@@ -103,8 +102,8 @@ static int read_reset_stat(struct ctl_table *table, int write, · 15 unmodified lines
103102 len -= *ppos;
104103 if (len > *lenp)
105104 len = *lenp;
106− if (len && copy_to_user(buffer, str_buf, len))
107− return -EFAULT;
105+ if (len)
106+ memcpy(buffer, str_buf, len);
108107 *lenp = len;
109108 *ppos += len;
110109 }
security/apparmor/lsm.c+1−1
@@ -1696,7 +1696,7 @@ static int __init alloc_buffers(void) · 1695 unmodified lines
16961696
16971697 #ifdef CONFIG_SYSCTL
16981698 static int apparmor_dointvec(struct ctl_table *table, int write,
1699− void __user *buffer, size_t *lenp, loff_t *ppos)
1699+ void *buffer, size_t *lenp, loff_t *ppos)
17001700 {
17011701 if (!policy_admin_capable(NULL))
17021702 return -EPERM;
security/min_addr.c+1−1
@@ -30,7 +30,7 @@ static void update_mmap_min_addr(void) · 29 unmodified lines
3030 * calls update_mmap_min_addr() so non MAP_FIXED hints get rounded properly
3131 */
3232 int mmap_min_addr_handler(struct ctl_table *table, int write,
33− void __user *buffer, size_t *lenp, loff_t *ppos)
33+ void *buffer, size_t *lenp, loff_t *ppos)
3434 {
3535 int ret;
3636
security/yama/yama_lsm.c+1−1
@@ -430,7 +430,7 @@ static struct security_hook_list yama_hooks[] __lsm_ro_after_init = { · 429 unmodified lines
430430
431431 #ifdef CONFIG_SYSCTL
432432 static int yama_dointvec_minmax(struct ctl_table *table, int write,
433− void __user *buffer, size_t *lenp, loff_t *ppos)
433+ void *buffer, size_t *lenp, loff_t *ppos)
434434 {
435435 struct ctl_table table_copy;
436436

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

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

Repository code

Go to file
t