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
203}203}
204 204
205static int emulation_proc_handler(struct ctl_table *table, int write,205static int emulation_proc_handler(struct ctl_table *table, int write,
206 void __user *buffer, size_t *lenp,206 void *buffer, size_t *lenp,
207 loff_t *ppos)207 loff_t *ppos)
208{208{
209 int ret = 0;209 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
341#ifdef CONFIG_SYSCTL341#ifdef CONFIG_SYSCTL
342 342
343static int sve_proc_do_default_vl(struct ctl_table *table, int write,343static int sve_proc_do_default_vl(struct ctl_table *table, int write,
344 void __user *buffer, size_t *lenp,344 void *buffer, size_t *lenp, loff_t *ppos)
345 loff_t *ppos)
346{345{
347 int ret;346 int ret;
348 int vl = sve_default_vl;347 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
95 len = 0;95 len = 0;
96 p = buffer;96 p = buffer;
97 while (len < *lenp) {97 while (len < *lenp) {
98 if (get_user(c, p++))98 c = *p;
99 return -EFAULT;99 p++;
100 if (c == 0 || c == '\n')100 if (c == 0 || c == '\n')
101 break;101 break;
102 len++;102 len++;
103 }103 }
104 if (len >= sizeof(ipbuf)-1)104 if (len >= sizeof(ipbuf)-1)
105 len = sizeof(ipbuf) - 1;105 len = sizeof(ipbuf) - 1;
106 if (copy_from_user(ipbuf, buffer, len))106 memcpy(ipbuf, buffer, len);
107 return -EFAULT;
108 ipbuf[len] = 0;107 ipbuf[len] = 0;
109 *ppos += *lenp;108 *ppos += *lenp;
110 /* Now see if we can convert it to a valid IP */109 /* 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
122 if (len > *lenp)121 if (len > *lenp)
123 len = *lenp;122 len = *lenp;
124 if (len)123 if (len)
125 if (copy_to_user(buffer, ipbuf, len))124 memcpy(buffer, ipbuf, len);
126 return -EFAULT;
127 if (len < *lenp) {125 if (len < *lenp) {
128 if (put_user('\n', ((char *) buffer) + len))126 *((char *)buffer + len) = '\n';
129 return -EFAULT;
130 len++;127 len++;
131 }128 }
132 *lenp = len;129 *lenp = len;
arch/s390/appldata/appldata_base.c+5−6
@@ -51,10 +51,9 @@ static struct platform_device *appldata_pdev; · 50 unmodified lines
51 */51 */
52static const char appldata_proc_name[APPLDATA_PROC_NAME_LENGTH] = "appldata";52static const char appldata_proc_name[APPLDATA_PROC_NAME_LENGTH] = "appldata";
53static int appldata_timer_handler(struct ctl_table *ctl, int write,53static 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);
55static int appldata_interval_handler(struct ctl_table *ctl, int write,55static int appldata_interval_handler(struct ctl_table *ctl, int write,
56 void __user *buffer,56 void *buffer, size_t *lenp, loff_t *ppos);
57 size_t *lenp, loff_t *ppos);
58 57
59static struct ctl_table_header *appldata_sysctl_header;58static struct ctl_table_header *appldata_sysctl_header;
60static struct ctl_table appldata_table[] = {59static struct ctl_table appldata_table[] = {
@@ -217,7 +216,7 @@ static void __appldata_vtimer_setup(int cmd) · 156 unmodified lines
217 */216 */
218static int217static int
219appldata_timer_handler(struct ctl_table *ctl, int write,218appldata_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)
221{220{
222 int timer_active = appldata_timer_active;221 int timer_active = appldata_timer_active;
223 int rc;222 int rc;
@@ -250,7 +249,7 @@ appldata_timer_handler(struct ctl_table *ctl, int write, · 26 unmodified lines
250 */249 */
251static int250static int
252appldata_interval_handler(struct ctl_table *ctl, int write,251appldata_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)
254{253{
255 int interval = appldata_interval;254 int interval = appldata_interval;
256 int rc;255 int rc;
@@ -280,7 +279,7 @@ appldata_interval_handler(struct ctl_table *ctl, int write, · 23 unmodified lines
280 */279 */
281static int280static int
282appldata_generic_handler(struct ctl_table *ctl, int write,281appldata_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)
284{283{
285 struct appldata_ops *ops = NULL, *tmp_ops;284 struct appldata_ops *ops = NULL, *tmp_ops;
286 struct list_head *lh;285 struct list_head *lh;
arch/s390/kernel/debug.c+1−1
@@ -867,7 +867,7 @@ static int debug_active = 1; · 866 unmodified lines
867 * if debug_active is already off867 * if debug_active is already off
868 */868 */
869static int s390dbf_procactive(struct ctl_table *table, int write,869static 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)
871{871{
872 if (!write || debug_stoppable || !debug_active)872 if (!write || debug_stoppable || !debug_active)
873 return proc_dointvec(table, write, buffer, lenp, ppos);873 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
594early_param("topology", topology_setup);594early_param("topology", topology_setup);
595 595
596static int topology_ctl_handler(struct ctl_table *ctl, int write,596static 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)
598{598{
599 int enabled = topology_is_enabled();599 int enabled = topology_is_enabled();
600 int new_mode;600 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
245}245}
246 246
247static int cmm_pages_handler(struct ctl_table *ctl, int write,247static 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)
249{249{
250 long nr = cmm_get_pages();250 long nr = cmm_get_pages();
251 struct ctl_table ctl_entry = {251 struct ctl_table ctl_entry = {
@@ -264,7 +264,7 @@ static int cmm_pages_handler(struct ctl_table *ctl, int write, · 12 unmodified lines
264}264}
265 265
266static int cmm_timed_pages_handler(struct ctl_table *ctl, int write,266static int cmm_timed_pages_handler(struct ctl_table *ctl, int write,
267 void __user *buffer, size_t *lenp,267 void *buffer, size_t *lenp,
268 loff_t *ppos)268 loff_t *ppos)
269{269{
270 long nr = cmm_get_timed_pages();270 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
284}284}
285 285
286static int cmm_timeout_handler(struct ctl_table *ctl, int write,286static 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)
288{288{
289 char buf[64], *p;289 char buf[64], *p;
290 long nr, seconds;290 long nr, seconds;
@@ -297,8 +297,7 @@ static int cmm_timeout_handler(struct ctl_table *ctl, int write, · 6 unmodified lines
297 297
298 if (write) {298 if (write) {
299 len = min(*lenp, sizeof(buf));299 len = min(*lenp, sizeof(buf));
300 if (copy_from_user(buf, buffer, len))300 memcpy(buf, buffer, len);
301 return -EFAULT;
302 buf[len - 1] = '\0';301 buf[len - 1] = '\0';
303 cmm_skip_blanks(buf, &p);302 cmm_skip_blanks(buf, &p);
304 nr = simple_strtoul(p, &p, 0);303 nr = simple_strtoul(p, &p, 0);
@@ -311,8 +310,7 @@ static int cmm_timeout_handler(struct ctl_table *ctl, int write, · 6 unmodified lines
311 cmm_timeout_pages, cmm_timeout_seconds);310 cmm_timeout_pages, cmm_timeout_seconds);
312 if (len > *lenp)311 if (len > *lenp)
313 len = *lenp;312 len = *lenp;
314 if (copy_to_user(buffer, buf, len))313 memcpy(buffer, buf, len);
315 return -EFAULT;
316 *lenp = len;314 *lenp = len;
317 *ppos += len;315 *ppos += len;
318 }316 }
arch/x86/kernel/itmt.c+1−2
@@ -39,8 +39,7 @@ static bool __read_mostly sched_itmt_capable; · 38 unmodified lines
39unsigned int __read_mostly sysctl_sched_itmt_enabled;39unsigned int __read_mostly sysctl_sched_itmt_enabled;
40 40
41static int sched_itmt_update_handler(struct ctl_table *table, int write,41static int sched_itmt_update_handler(struct ctl_table *table, int write,
42 void __user *buffer, size_t *lenp,42 void *buffer, size_t *lenp, loff_t *ppos)
43 loff_t *ppos)
44{43{
45 unsigned int old_sysctl;44 unsigned int old_sysctl;
46 int ret;45 int ret;
drivers/cdrom/cdrom.c+1−1
@@ -3631,7 +3631,7 @@ static void cdrom_update_settings(void) · 3630 unmodified lines
3631}3631}
3632 3632
3633static int cdrom_sysctl_handler(struct ctl_table *ctl, int write,3633static 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)
3635{3635{
3636 int ret;3636 int ret;
3637 3637
drivers/char/random.c+1−1
@@ -2057,7 +2057,7 @@ static char sysctl_bootid[16]; · 2056 unmodified lines
2057 * sysctl system call, as 16 bytes of binary data.2057 * sysctl system call, as 16 bytes of binary data.
2058 */2058 */
2059static int proc_do_uuid(struct ctl_table *table, int write,2059static 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)
2061{2061{
2062 struct ctl_table fake_table;2062 struct ctl_table fake_table;
2063 unsigned char buf[64], tmp_uuid[16], *uuid;2063 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
183}183}
184 184
185static int mac_hid_toggle_emumouse(struct ctl_table *table, int write,185static int mac_hid_toggle_emumouse(struct ctl_table *table, int write,
186 void __user *buffer, size_t *lenp,186 void *buffer, size_t *lenp, loff_t *ppos)
187 loff_t *ppos)
188{187{
189 int *valp = table->data;188 int *valp = table->data;
190 int old_val = *valp;189 int old_val = *valp;
drivers/parport/procfs.c+18−21
@@ -34,7 +34,7 @@ · 33 unmodified lines
34#define PARPORT_MAX_SPINTIME_VALUE 100034#define PARPORT_MAX_SPINTIME_VALUE 1000
35 35
36static int do_active_device(struct ctl_table *table, int write,36static 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)
38{38{
39 struct parport *port = (struct parport *)table->extra1;39 struct parport *port = (struct parport *)table->extra1;
40 char buffer[256];40 char buffer[256];
@@ -65,13 +65,13 @@ static int do_active_device(struct ctl_table *table, int write, · 24 unmodified lines
65 *lenp = len;65 *lenp = len;
66 66
67 *ppos += len;67 *ppos += len;
68 68 memcpy(result, buffer, len);
69 return copy_to_user(result, buffer, len) ? -EFAULT : 0;69 return 0;
70}70}
71 71
72#ifdef CONFIG_PARPORT_128472#ifdef CONFIG_PARPORT_1284
73static int do_autoprobe(struct ctl_table *table, int write,73static 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)
75{75{
76 struct parport_device_info *info = table->extra2;76 struct parport_device_info *info = table->extra2;
77 const char *str;77 const char *str;
@@ -108,13 +108,13 @@ static int do_autoprobe(struct ctl_table *table, int write, · 30 unmodified lines
108 108
109 *ppos += len;109 *ppos += len;
110 110
111 return copy_to_user (result, buffer, len) ? -EFAULT : 0;111 memcpy(result, buffer, len);
112 return 0;
112}113}
113#endif /* IEEE1284.3 support. */114#endif /* IEEE1284.3 support. */
114 115
115static int do_hardware_base_addr(struct ctl_table *table, int write,116static int do_hardware_base_addr(struct ctl_table *table, int write,
116 void __user *result,117 void *result, size_t *lenp, loff_t *ppos)
117 size_t *lenp, loff_t *ppos)
118{118{
119 struct parport *port = (struct parport *)table->extra1;119 struct parport *port = (struct parport *)table->extra1;
120 char buffer[20];120 char buffer[20];
@@ -136,13 +136,12 @@ static int do_hardware_base_addr(struct ctl_table *table, int write, · 15 unmodified lines
136 *lenp = len;136 *lenp = len;
137 137
138 *ppos += len;138 *ppos += len;
139 139 memcpy(result, buffer, len);
140 return copy_to_user(result, buffer, len) ? -EFAULT : 0;140 return 0;
141}141}
142 142
143static int do_hardware_irq(struct ctl_table *table, int write,143static int do_hardware_irq(struct ctl_table *table, int write,
144 void __user *result,144 void *result, size_t *lenp, loff_t *ppos)
145 size_t *lenp, loff_t *ppos)
146{145{
147 struct parport *port = (struct parport *)table->extra1;146 struct parport *port = (struct parport *)table->extra1;
148 char buffer[20];147 char buffer[20];
@@ -164,13 +163,12 @@ static int do_hardware_irq(struct ctl_table *table, int write, · 15 unmodified lines
164 *lenp = len;163 *lenp = len;
165 164
166 *ppos += len;165 *ppos += len;
167 166 memcpy(result, buffer, len);
168 return copy_to_user(result, buffer, len) ? -EFAULT : 0;167 return 0;
169}168}
170 169
171static int do_hardware_dma(struct ctl_table *table, int write,170static int do_hardware_dma(struct ctl_table *table, int write,
172 void __user *result,171 void *result, size_t *lenp, loff_t *ppos)
173 size_t *lenp, loff_t *ppos)
174{172{
175 struct parport *port = (struct parport *)table->extra1;173 struct parport *port = (struct parport *)table->extra1;
176 char buffer[20];174 char buffer[20];
@@ -192,13 +190,12 @@ static int do_hardware_dma(struct ctl_table *table, int write, · 15 unmodified lines
192 *lenp = len;190 *lenp = len;
193 191
194 *ppos += len;192 *ppos += len;
195 193 memcpy(result, buffer, len);
196 return copy_to_user(result, buffer, len) ? -EFAULT : 0;194 return 0;
197}195}
198 196
199static int do_hardware_modes(struct ctl_table *table, int write,197static int do_hardware_modes(struct ctl_table *table, int write,
200 void __user *result,198 void *result, size_t *lenp, loff_t *ppos)
201 size_t *lenp, loff_t *ppos)
202{199{
203 struct parport *port = (struct parport *)table->extra1;200 struct parport *port = (struct parport *)table->extra1;
204 char buffer[40];201 char buffer[40];
@@ -231,8 +228,8 @@ static int do_hardware_modes(struct ctl_table *table, int write, · 26 unmodified lines
231 *lenp = len;228 *lenp = len;
232 229
233 *ppos += len;230 *ppos += len;
234 231 memcpy(result, buffer, len);
235 return copy_to_user(result, buffer, len) ? -EFAULT : 0;232 return 0;
236}233}
237 234
238#define PARPORT_PORT_DIR(CHILD) { .procname = NULL, .mode = 0555, .child = CHILD }235#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
165 return sum < 0 ? 0 : sum;165 return sum < 0 ? 0 : sum;
166}166}
167 167
168int proc_nr_dentry(struct ctl_table *table, int write, void __user *buffer,168int proc_nr_dentry(struct ctl_table *table, int write, void *buffer,
169 size_t *lenp, loff_t *ppos)169 size_t *lenp, loff_t *ppos)
170{170{
171 dentry_stat.nr_dentry = get_nr_dentry();171 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
47}47}
48 48
49int drop_caches_sysctl_handler(struct ctl_table *table, int write,49int 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)
51{51{
52 int ret;52 int ret;
53 53
fs/file_table.c+2−2
@@ -80,14 +80,14 @@ EXPORT_SYMBOL_GPL(get_max_files); · 79 unmodified lines
80 */80 */
81#if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS)81#if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS)
82int proc_nr_files(struct ctl_table *table, int write,82int 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)
84{84{
85 files_stat.nr_files = get_nr_files();85 files_stat.nr_files = get_nr_files();
86 return proc_doulongvec_minmax(table, write, buffer, lenp, ppos);86 return proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
87}87}
88#else88#else
89int proc_nr_files(struct ctl_table *table, int write,89int 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)
91{91{
92 return -ENOSYS;92 return -ENOSYS;
93}93}
fs/fscache/main.c+1−2
@@ -51,8 +51,7 @@ static unsigned fscache_op_max_active = 2; · 50 unmodified lines
51static struct ctl_table_header *fscache_sysctl_header;51static struct ctl_table_header *fscache_sysctl_header;
52 52
53static int fscache_max_active_sysctl(struct ctl_table *table, int write,53static int fscache_max_active_sysctl(struct ctl_table *table, int write,
54 void __user *buffer,54 void *buffer, size_t *lenp, loff_t *ppos)
55 size_t *lenp, loff_t *ppos)
56{55{
57 struct workqueue_struct **wqp = table->extra1;56 struct workqueue_struct **wqp = table->extra1;
58 unsigned int *datap = table->data;57 unsigned int *datap = table->data;
fs/inode.c+1−1
@@ -108,7 +108,7 @@ long get_nr_dirty_inodes(void) · 107 unmodified lines
108 */108 */
109#ifdef CONFIG_SYSCTL109#ifdef CONFIG_SYSCTL
110int proc_nr_inodes(struct ctl_table *table, int write,110int 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)
112{112{
113 inodes_stat.nr_inodes = get_nr_inodes();113 inodes_stat.nr_inodes = get_nr_inodes();
114 inodes_stat.nr_unused = get_nr_inodes_unused();114 inodes_stat.nr_unused = get_nr_inodes_unused();
fs/proc/proc_sysctl.c+29−18
@@ -539,13 +539,13 @@ out: · 538 unmodified lines
539 return err;539 return err;
540}540}
541 541
542static ssize_t proc_sys_call_handler(struct file *filp, void __user *buf,542static ssize_t proc_sys_call_handler(struct file *filp, void __user *ubuf,
543 size_t count, loff_t *ppos, int write)543 size_t count, loff_t *ppos, int write)
544{544{
545 struct inode *inode = file_inode(filp);545 struct inode *inode = file_inode(filp);
546 struct ctl_table_header *head = grab_header(inode);546 struct ctl_table_header *head = grab_header(inode);
547 struct ctl_table *table = PROC_I(inode)->sysctl_entry;547 struct ctl_table *table = PROC_I(inode)->sysctl_entry;
548 void *new_buf = NULL;548 void *kbuf;
549 ssize_t error;549 ssize_t error;
550 550
551 if (IS_ERR(head))551 if (IS_ERR(head))
@@ -564,27 +564,38 @@ static ssize_t proc_sys_call_handler(struct file *filp, void __user *buf, · 12 unmodified lines
564 if (!table->proc_handler)564 if (!table->proc_handler)
565 goto out;565 goto out;
566 566
567 error = BPF_CGROUP_RUN_PROG_SYSCTL(head, table, write, buf, &count,567 if (write) {
568 ppos, &new_buf);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);
569 if (error)582 if (error)
570 goto out;583 goto out_free_buf;
571 584
572 /* careful: calling conventions are nasty here */585 /* careful: calling conventions are nasty here */
573 if (new_buf) {586 error = table->proc_handler(table, write, kbuf, &count, ppos);
574 mm_segment_t old_fs;587 if (error)
575 588 goto out_free_buf;
576 old_fs = get_fs();589
577 set_fs(KERNEL_DS);590 if (!write) {
578 error = table->proc_handler(table, write, (void __user *)new_buf,591 error = -EFAULT;
579 &count, ppos);592 if (copy_to_user(ubuf, kbuf, count))
580 set_fs(old_fs);593 goto out_free_buf;
581 kfree(new_buf);
582 } else {
583 error = table->proc_handler(table, write, buf, &count, ppos);
584 }594 }
585 595
586 if (!error)596 error = count;
587 error = count;597out_free_buf:
598 kfree(kbuf);
588out:599out:
589 sysctl_head_finish(head);600 sysctl_head_finish(head);
590 601
fs/quota/dquot.c+1−1
@@ -2841,7 +2841,7 @@ const struct quotactl_ops dquot_quotactl_sysfile_ops = { · 2840 unmodified lines
2841EXPORT_SYMBOL(dquot_quotactl_sysfile_ops);2841EXPORT_SYMBOL(dquot_quotactl_sysfile_ops);
2842 2842
2843static int do_proc_dqstats(struct ctl_table *table, int write,2843static 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)
2845{2845{
2846 unsigned int type = (unsigned long *)table->data - dqstats.stat;2846 unsigned int type = (unsigned long *)table->data - dqstats.stat;
2847 s64 value = percpu_counter_sum(&dqstats.counter[type]);2847 s64 value = percpu_counter_sum(&dqstats.counter[type]);
fs/xfs/xfs_sysctl.c+2−2
@@ -13,7 +13,7 @@ STATIC int · 12 unmodified lines
13xfs_stats_clear_proc_handler(13xfs_stats_clear_proc_handler(
14 struct ctl_table *ctl,14 struct ctl_table *ctl,
15 int write,15 int write,
16 void __user *buffer,16 void *buffer,
17 size_t *lenp,17 size_t *lenp,
18 loff_t *ppos)18 loff_t *ppos)
19{19{
@@ -33,7 +33,7 @@ STATIC int · 13 unmodified lines
33xfs_panic_mask_proc_handler(33xfs_panic_mask_proc_handler(
34 struct ctl_table *ctl,34 struct ctl_table *ctl,
35 int write,35 int write,
36 void __user *buffer,36 void *buffer,
37 size_t *lenp,37 size_t *lenp,
38 loff_t *ppos)38 loff_t *ppos)
39{39{
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
138 138
139int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head,139int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head,
140 struct ctl_table *table, int write,140 struct ctl_table *table, int write,
141 void __user *buf, size_t *pcount,141 void **buf, size_t *pcount, loff_t *ppos,
142 loff_t *ppos, void **new_buf,
143 enum bpf_attach_type type);142 enum bpf_attach_type type);
144 143
145int __cgroup_bpf_run_filter_setsockopt(struct sock *sock, int *level,144int __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
302})301})
303 302
304 303
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) \
306({ \305({ \
307 int __ret = 0; \306 int __ret = 0; \
308 if (cgroup_bpf_enabled) \307 if (cgroup_bpf_enabled) \
309 __ret = __cgroup_bpf_run_filter_sysctl(head, table, write, \308 __ret = __cgroup_bpf_run_filter_sysctl(head, table, write, \
310 buf, count, pos, nbuf, \309 buf, count, pos, \
311 BPF_CGROUP_SYSCTL); \310 BPF_CGROUP_SYSCTL); \
312 __ret; \311 __ret; \
313})312})
@@ -429,7 +428,7 @@ static inline int bpf_percpu_cgroup_storage_update(struct bpf_map *map, · 115 unmodified lines
429#define BPF_CGROUP_RUN_PROG_UDP6_RECVMSG_LOCK(sk, uaddr) ({ 0; })428#define BPF_CGROUP_RUN_PROG_UDP6_RECVMSG_LOCK(sk, uaddr) ({ 0; })
430#define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; })429#define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; })
431#define BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type,major,minor,access) ({ 0; })430#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; })
433#define BPF_CGROUP_GETSOCKOPT_MAX_OPTLEN(optlen) ({ 0; })432#define BPF_CGROUP_GETSOCKOPT_MAX_OPTLEN(optlen) ({ 0; })
434#define BPF_CGROUP_RUN_PROG_GETSOCKOPT(sock, level, optname, optval, \433#define BPF_CGROUP_RUN_PROG_GETSOCKOPT(sock, level, optname, optval, \
435 optlen, max_optlen, retval) ({ retval; })434 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
86#ifdef CONFIG_COMPACTION86#ifdef CONFIG_COMPACTION
87extern int sysctl_compact_memory;87extern int sysctl_compact_memory;
88extern int sysctl_compaction_handler(struct ctl_table *table, int write,88extern 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);
90extern int sysctl_extfrag_threshold;90extern int sysctl_extfrag_threshold;
91extern int sysctl_compact_unevictable_allowed;91extern int sysctl_compact_unevictable_allowed;
92 92
include/linux/coredump.h+4−0
@@ -22,4 +22,8 @@ extern void do_coredump(const kernel_siginfo_t *siginfo); · 21 unmodified lines
22static inline void do_coredump(const kernel_siginfo_t *siginfo) {}22static inline void do_coredump(const kernel_siginfo_t *siginfo) {}
23#endif23#endif
24 24
25extern int core_uses_pid;
26extern char core_pattern[];
27extern unsigned int core_pipe_limit;
28
25#endif /* _LINUX_COREDUMP_H */29#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
94extern void flush_delayed_fput(void);94extern void flush_delayed_fput(void);
95extern void __fput_sync(struct file *);95extern void __fput_sync(struct file *);
96 96
97extern unsigned int sysctl_nr_open_min, sysctl_nr_open_max;
98
97#endif /* __LINUX_FILE_H */99#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
3536 3536
3537struct ctl_table;3537struct ctl_table;
3538int proc_nr_files(struct ctl_table *table, int write,3538int 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);
3540int proc_nr_dentry(struct ctl_table *table, int write,3540int 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);
3542int proc_nr_inodes(struct ctl_table *table, int write,3542int 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);
3544int __init get_filesystem_list(char *buf);3544int __init get_filesystem_list(char *buf);
3545 3545
3546#define __FMODE_EXEC ((__force int) FMODE_EXEC)3546#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
1005extern int __disable_trace_on_warning;1005extern int __disable_trace_on_warning;
1006 1006
1007int tracepoint_printk_sysctl(struct ctl_table *table, int write,1007int tracepoint_printk_sysctl(struct ctl_table *table, int write,
1008 void __user *buffer, size_t *lenp,1008 void *buffer, size_t *lenp, loff_t *ppos);
1009 loff_t *ppos);
1010 1009
1011#else /* CONFIG_TRACING */1010#else /* CONFIG_TRACING */
1012static inline void disable_trace_on_warning(void) { }1011static 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
105void hugepage_put_subpool(struct hugepage_subpool *spool);105void hugepage_put_subpool(struct hugepage_subpool *spool);
106 106
107void reset_vma_resv_huge_pages(struct vm_area_struct *vma);107void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
108int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);108int hugetlb_sysctl_handler(struct ctl_table *, int, void *, size_t *, loff_t *);
109int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);109int hugetlb_overcommit_handler(struct ctl_table *, int, void *, size_t *,
110int hugetlb_treat_movable_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);110 loff_t *);
111 111int hugetlb_treat_movable_handler(struct ctl_table *, int, void *, size_t *,
112#ifdef CONFIG_NUMA112 loff_t *);
113int hugetlb_mempolicy_sysctl_handler(struct ctl_table *, int,113int hugetlb_mempolicy_sysctl_handler(struct ctl_table *, int, void *, size_t *,
114 void __user *, size_t *, loff_t *);114 loff_t *);
115#endif
116 115
117int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);116int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
118long follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *,117long 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
312#ifdef CONFIG_SYSCTL312#ifdef CONFIG_SYSCTL
313extern int sysctl_kprobes_optimization;313extern int sysctl_kprobes_optimization;
314extern int proc_kprobes_optimization_handler(struct ctl_table *table,314extern int proc_kprobes_optimization_handler(struct ctl_table *table,
315 int write, void __user *buffer,315 int write, void *buffer,
316 size_t *length, loff_t *ppos);316 size_t *length, loff_t *ppos);
317#endif317#endif
318extern void wait_for_kprobe_optimizer(void);318extern 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
38 38
39void clear_tsk_latency_tracing(struct task_struct *p);39void clear_tsk_latency_tracing(struct task_struct *p);
40 40
41extern int sysctl_latencytop(struct ctl_table *table, int write,41int sysctl_latencytop(struct ctl_table *table, int write, void *buffer,
42 void __user *buffer, size_t *lenp, loff_t *ppos);42 size_t *lenp, loff_t *ppos);
43 43
44#else44#else
45 45
include/linux/mm.h+8−6
@@ -201,10 +201,10 @@ extern int sysctl_overcommit_memory; · 200 unmodified lines
201extern int sysctl_overcommit_ratio;201extern int sysctl_overcommit_ratio;
202extern unsigned long sysctl_overcommit_kbytes;202extern unsigned long sysctl_overcommit_kbytes;
203 203
204extern int overcommit_ratio_handler(struct ctl_table *, int, void __user *,204int overcommit_ratio_handler(struct ctl_table *, int, void *, size_t *,
205 size_t *, loff_t *);205 loff_t *);
206extern int overcommit_kbytes_handler(struct ctl_table *, int, void __user *,206int overcommit_kbytes_handler(struct ctl_table *, int, void *, size_t *,
207 size_t *, loff_t *);207 loff_t *);
208 208
209#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))209#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
210 210
@@ -2957,8 +2957,8 @@ extern bool process_shares_mm(struct task_struct *p, struct mm_struct *mm); · 2746 unmodified lines
2957 2957
2958#ifdef CONFIG_SYSCTL2958#ifdef CONFIG_SYSCTL
2959extern int sysctl_drop_caches;2959extern int sysctl_drop_caches;
2960int drop_caches_sysctl_handler(struct ctl_table *, int,2960int drop_caches_sysctl_handler(struct ctl_table *, int, void *, size_t *,
2961 void __user *, size_t *, loff_t *);2961 loff_t *);
2962#endif2962#endif
2963 2963
2964void drop_slab(void);2964void drop_slab(void);
@@ -3140,5 +3140,7 @@ unsigned long wp_shared_mapping_range(struct address_space *mapping, · 175 unmodified lines
3140 pgoff_t first_index, pgoff_t nr);3140 pgoff_t first_index, pgoff_t nr);
3141#endif3141#endif
3142 3142
3143extern int sysctl_nr_trim_pages;
3144
3143#endif /* __KERNEL__ */3145#endif /* __KERNEL__ */
3144#endif /* _LINUX_MM_H */3146#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
909 909
910/* These two functions are used to setup the per zone pages min values */910/* These two functions are used to setup the per zone pages min values */
911struct ctl_table;911struct ctl_table;
912int min_free_kbytes_sysctl_handler(struct ctl_table *, int,912
913 void __user *, size_t *, loff_t *);913int min_free_kbytes_sysctl_handler(struct ctl_table *, int, void *, size_t *,
914int watermark_boost_factor_sysctl_handler(struct ctl_table *, int,914 loff_t *);
915 void __user *, size_t *, loff_t *);915int watermark_scale_factor_sysctl_handler(struct ctl_table *, int, void *,
916int watermark_scale_factor_sysctl_handler(struct ctl_table *, int,916 size_t *, loff_t *);
917 void __user *, size_t *, loff_t *);
918extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES];917extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES];
919int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int,918int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, void *,
920 void __user *, size_t *, loff_t *);919 size_t *, loff_t *);
921int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int,920int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int,
922 void __user *, size_t *, loff_t *);921 void *, size_t *, loff_t *);
923int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int,922int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int,
924 void __user *, size_t *, loff_t *);923 void *, size_t *, loff_t *);
925int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int,924int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int,
926 void __user *, size_t *, loff_t *);925 void *, size_t *, loff_t *);
927 926int numa_zonelist_order_handler(struct ctl_table *, int,
928extern int numa_zonelist_order_handler(struct ctl_table *, int,927 void *, size_t *, loff_t *);
929 void __user *, size_t *, loff_t *);928extern int percpu_pagelist_fraction;
930extern char numa_zonelist_order[];929extern char numa_zonelist_order[];
931#define NUMA_ZONELIST_ORDER_LEN 16930#define NUMA_ZONELIST_ORDER_LEN 16
932 931
include/linux/nmi.h+5−10
@@ -202,16 +202,11 @@ static inline void watchdog_update_hrtimer_threshold(u64 period) { } · 201 unmodified lines
202#endif202#endif
203 203
204struct ctl_table;204struct ctl_table;
205extern int proc_watchdog(struct ctl_table *, int ,205int proc_watchdog(struct ctl_table *, int, void *, size_t *, loff_t *);
206 void __user *, size_t *, loff_t *);206int proc_nmi_watchdog(struct ctl_table *, int , void *, size_t *, loff_t *);
207extern int proc_nmi_watchdog(struct ctl_table *, int ,207int proc_soft_watchdog(struct ctl_table *, int , void *, size_t *, loff_t *);
208 void __user *, size_t *, loff_t *);208int proc_watchdog_thresh(struct ctl_table *, int , void *, size_t *, loff_t *);
209extern int proc_soft_watchdog(struct ctl_table *, int ,209int proc_watchdog_cpumask(struct ctl_table *, int, void *, size_t *, loff_t *);
210 void __user *, size_t *, loff_t *);
211extern int proc_watchdog_thresh(struct ctl_table *, int ,
212 void __user *, size_t *, loff_t *);
213extern int proc_watchdog_cpumask(struct ctl_table *, int,
214 void __user *, size_t *, loff_t *);
215 210
216#ifdef CONFIG_HAVE_ACPI_APEI_NMI211#ifdef CONFIG_HAVE_ACPI_APEI_NMI
217#include <asm/nmi.h>212#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
1280 1280
1281extern void perf_sample_event_took(u64 sample_len_ns);1281extern void perf_sample_event_took(u64 sample_len_ns);
1282 1282
1283extern int perf_proc_update_handler(struct ctl_table *table, int write,1283int perf_proc_update_handler(struct ctl_table *table, int write,
1284 void __user *buffer, size_t *lenp,1284 void *buffer, size_t *lenp, loff_t *ppos);
1285 loff_t *ppos);1285int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,
1286extern int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,1286 void *buffer, size_t *lenp, loff_t *ppos);
1287 void __user *buffer, size_t *lenp,
1288 loff_t *ppos);
1289
1290int perf_event_max_stack_handler(struct ctl_table *table, int write,1287int 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);
1292 1289
1293/* Access to perf_event_open(2) syscall. */1290/* Access to perf_event_open(2) syscall. */
1294#define PERF_SECURITY_OPEN 01291#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
108struct pid_namespace;108struct pid_namespace;
109extern struct pid_namespace init_pid_ns;109extern struct pid_namespace init_pid_ns;
110 110
111extern int pid_max;
112extern int pid_max_min, pid_max_max;
113
111/*114/*
112 * look up a PID in the hash table. Must be called with the tasklist_lock115 * look up a PID in the hash table. Must be called with the tasklist_lock
113 * or rcu_read_lock() held.116 * or rcu_read_lock() held.
include/linux/printk.h+1−1
@@ -189,7 +189,7 @@ extern int printk_delay_msec; · 188 unmodified lines
189extern int dmesg_restrict;189extern int dmesg_restrict;
190 190
191extern int191extern int
192devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, void __user *buf,192devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, void *buf,
193 size_t *lenp, loff_t *ppos);193 size_t *lenp, loff_t *ppos);
194 194
195extern void wake_up_klogd(void);195extern 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
12extern unsigned long sysctl_hung_task_timeout_secs;12extern unsigned long sysctl_hung_task_timeout_secs;
13extern unsigned long sysctl_hung_task_check_interval_secs;13extern unsigned long sysctl_hung_task_check_interval_secs;
14extern int sysctl_hung_task_warnings;14extern int sysctl_hung_task_warnings;
15extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,15int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
16 void __user *buffer,16 void *buffer, size_t *lenp, loff_t *ppos);
17 size_t *lenp, loff_t *ppos);
18#else17#else
19/* Avoid need for ifdefs elsewhere in the code */18/* Avoid need for ifdefs elsewhere in the code */
20enum { sysctl_hung_task_timeout_secs = 0 };19enum { sysctl_hung_task_timeout_secs = 0 };
@@ -43,8 +42,7 @@ extern __read_mostly unsigned int sysctl_sched_migration_cost; · 22 unmodified lines
43extern __read_mostly unsigned int sysctl_sched_nr_migrate;42extern __read_mostly unsigned int sysctl_sched_nr_migrate;
44 43
45int sched_proc_update_handler(struct ctl_table *table, int write,44int sched_proc_update_handler(struct ctl_table *table, int write,
46 void __user *buffer, size_t *length,45 void *buffer, size_t *length, loff_t *ppos);
47 loff_t *ppos);
48#endif46#endif
49 47
50/*48/*
@@ -72,33 +70,21 @@ extern unsigned int sysctl_sched_autogroup_enabled; · 21 unmodified lines
72extern int sysctl_sched_rr_timeslice;70extern int sysctl_sched_rr_timeslice;
73extern int sched_rr_timeslice;71extern int sched_rr_timeslice;
74 72
75extern int sched_rr_handler(struct ctl_table *table, int write,73int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
76 void __user *buffer, size_t *lenp,74 size_t *lenp, loff_t *ppos);
77 loff_t *ppos);75int sched_rt_handler(struct ctl_table *table, int write, void *buffer,
78 76 size_t *lenp, loff_t *ppos);
79extern int sched_rt_handler(struct ctl_table *table, int write,77int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
80 void __user *buffer, size_t *lenp,78 void *buffer, size_t *lenp, loff_t *ppos);
81 loff_t *ppos);79int sysctl_numa_balancing(struct ctl_table *table, int write, void *buffer,
82 80 size_t *lenp, loff_t *ppos);
83#ifdef CONFIG_UCLAMP_TASK81int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
84extern int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,82 size_t *lenp, loff_t *ppos);
85 void __user *buffer, size_t *lenp,
86 loff_t *ppos);
87#endif
88
89extern int sysctl_numa_balancing(struct ctl_table *table, int write,
90 void __user *buffer, size_t *lenp,
91 loff_t *ppos);
92
93extern int sysctl_schedstats(struct ctl_table *table, int write,
94 void __user *buffer, size_t *lenp,
95 loff_t *ppos);
96 83
97#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)84#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
98extern unsigned int sysctl_sched_energy_aware;85extern unsigned int sysctl_sched_energy_aware;
99extern int sched_energy_aware_handler(struct ctl_table *table, int write,86int sched_energy_aware_handler(struct ctl_table *table, int write,
100 void __user *buffer, size_t *lenp,87 void *buffer, size_t *lenp, loff_t *ppos);
101 loff_t *ppos);
102#endif88#endif
103 89
104#endif /* _LINUX_SCHED_SYSCTL_H */90#endif /* _LINUX_SCHED_SYSCTL_H */
include/linux/security.h+1−1
@@ -211,7 +211,7 @@ struct request_sock; · 210 unmodified lines
211 211
212#ifdef CONFIG_MMU212#ifdef CONFIG_MMU
213extern int mmap_min_addr_handler(struct ctl_table *table, int write,213extern 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);
215#endif215#endif
216 216
217/* security_inode_init_security callback function to write xattrs */217/* 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
44 44
45extern const int sysctl_vals[];45extern const int sysctl_vals[];
46 46
47typedef int proc_handler (struct ctl_table *ctl, int write,47typedef int proc_handler(struct ctl_table *ctl, int write, void *buffer,
48 void __user *buffer, size_t *lenp, loff_t *ppos);48 size_t *lenp, loff_t *ppos);
49 49
50extern int proc_dostring(struct ctl_table *, int,50int proc_dostring(struct ctl_table *, int, void *, size_t *, loff_t *);
51 void __user *, size_t *, loff_t *);51int proc_dointvec(struct ctl_table *, int, void *, size_t *, loff_t *);
52extern int proc_dointvec(struct ctl_table *, int,52int proc_douintvec(struct ctl_table *, int, void *, size_t *, loff_t *);
53 void __user *, size_t *, loff_t *);53int proc_dointvec_minmax(struct ctl_table *, int, void *, size_t *, loff_t *);
54extern int proc_douintvec(struct ctl_table *, int,54int proc_douintvec_minmax(struct ctl_table *table, int write, void *buffer,
55 void __user *, size_t *, loff_t *);55 size_t *lenp, loff_t *ppos);
56extern int proc_dointvec_minmax(struct ctl_table *, int,56int proc_dointvec_jiffies(struct ctl_table *, int, void *, size_t *, loff_t *);
57 void __user *, size_t *, loff_t *);57int proc_dointvec_userhz_jiffies(struct ctl_table *, int, void *, size_t *,
58extern int proc_douintvec_minmax(struct ctl_table *table, int write,58 loff_t *);
59 void __user *buffer, size_t *lenp,59int proc_dointvec_ms_jiffies(struct ctl_table *, int, void *, size_t *,
60 loff_t *ppos);60 loff_t *);
61extern int proc_dointvec_jiffies(struct ctl_table *, int,61int proc_doulongvec_minmax(struct ctl_table *, int, void *, size_t *, loff_t *);
62 void __user *, size_t *, loff_t *);62int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int, void *,
63extern int proc_dointvec_userhz_jiffies(struct ctl_table *, int,63 size_t *, loff_t *);
64 void __user *, size_t *, loff_t *);64int proc_do_large_bitmap(struct ctl_table *, int, void *, size_t *, loff_t *);
65extern int proc_dointvec_ms_jiffies(struct ctl_table *, int,65int proc_do_static_key(struct ctl_table *table, int write, void *buffer,
66 void __user *, size_t *, loff_t *);66 size_t *lenp, loff_t *ppos);
67extern int proc_doulongvec_minmax(struct ctl_table *, int,
68 void __user *, size_t *, loff_t *);
69extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int,
70 void __user *, size_t *, loff_t *);
71extern int proc_do_large_bitmap(struct ctl_table *, int,
72 void __user *, size_t *, loff_t *);
73extern int proc_do_static_key(struct ctl_table *table, int write,
74 void __user *buffer, size_t *lenp,
75 loff_t *ppos);
76 67
77/*68/*
78 * Register a set of sysctl names by calling register_sysctl_table69 * 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
207 198
208extern int sysctl_init(void);199extern int sysctl_init(void);
209 200
201extern int pwrsw_enabled;
202extern int unaligned_enabled;
203extern int unaligned_dump_stack;
204extern int no_unaligned_warning;
205
210extern struct ctl_table sysctl_mount_point[];206extern struct ctl_table sysctl_mount_point[];
207extern struct ctl_table random_table[];
208extern struct ctl_table firmware_config_table[];
209extern struct ctl_table epoll_table[];
211 210
212#else /* CONFIG_SYSCTL */211#else /* CONFIG_SYSCTL */
213static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * table)212static 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
238 237
239#endif /* CONFIG_SYSCTL */238#endif /* CONFIG_SYSCTL */
240 239
241int sysctl_max_threads(struct ctl_table *table, int write,240int sysctl_max_threads(struct ctl_table *table, int write, void *buffer,
242 void __user *buffer, size_t *lenp, loff_t *ppos);241 size_t *lenp, loff_t *ppos);
243 242
244#endif /* _LINUX_SYSCTL_H */243#endif /* _LINUX_SYSCTL_H */
include/linux/timer.h+1−2
@@ -201,8 +201,7 @@ struct ctl_table; · 200 unmodified lines
201 201
202extern unsigned int sysctl_timer_migration;202extern unsigned int sysctl_timer_migration;
203int timer_migration_handler(struct ctl_table *table, int write,203int timer_migration_handler(struct ctl_table *table, int write,
204 void __user *buffer, size_t *lenp,204 void *buffer, size_t *lenp, loff_t *ppos);
205 loff_t *ppos);
206#endif205#endif
207 206
208unsigned long __round_jiffies(unsigned long j, int cpu);207unsigned 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
16#define DISABLE_NUMA_STAT 016#define DISABLE_NUMA_STAT 0
17extern int sysctl_vm_numa_stat;17extern int sysctl_vm_numa_stat;
18DECLARE_STATIC_KEY_TRUE(vm_numa_stat_key);18DECLARE_STATIC_KEY_TRUE(vm_numa_stat_key);
19extern int sysctl_vm_numa_stat_handler(struct ctl_table *table,19int sysctl_vm_numa_stat_handler(struct ctl_table *table, int write,
20 int write, void __user *buffer, size_t *length, loff_t *ppos);20 void *buffer, size_t *length, loff_t *ppos);
21#endif21#endif
22 22
23struct reclaim_stat {23struct reclaim_stat {
@@ -274,8 +274,8 @@ void cpu_vm_stats_fold(int cpu); · 250 unmodified lines
274void refresh_zone_stat_thresholds(void);274void refresh_zone_stat_thresholds(void);
275 275
276struct ctl_table;276struct ctl_table;
277int vmstat_refresh(struct ctl_table *, int write,277int vmstat_refresh(struct ctl_table *, int write, void *buffer, size_t *lenp,
278 void __user *buffer, size_t *lenp, loff_t *ppos);278 loff_t *ppos);
279 279
280void drain_zonestat(struct zone *zone, struct per_cpu_pageset *);280void drain_zonestat(struct zone *zone, struct per_cpu_pageset *);
281 281
include/linux/writeback.h+11−17
@@ -362,24 +362,18 @@ extern int vm_highmem_is_dirtyable; · 361 unmodified lines
362extern int block_dump;362extern int block_dump;
363extern int laptop_mode;363extern int laptop_mode;
364 364
365extern int dirty_background_ratio_handler(struct ctl_table *table, int write,365int dirty_background_ratio_handler(struct ctl_table *table, int write,
366 void __user *buffer, size_t *lenp,366 void *buffer, size_t *lenp, loff_t *ppos);
367 loff_t *ppos);367int dirty_background_bytes_handler(struct ctl_table *table, int write,
368extern int dirty_background_bytes_handler(struct ctl_table *table, int write,368 void *buffer, size_t *lenp, loff_t *ppos);
369 void __user *buffer, size_t *lenp,369int dirty_ratio_handler(struct ctl_table *table, int write,
370 loff_t *ppos);370 void *buffer, size_t *lenp, loff_t *ppos);
371extern int dirty_ratio_handler(struct ctl_table *table, int write,371int dirty_bytes_handler(struct ctl_table *table, int write,
372 void __user *buffer, size_t *lenp,372 void *buffer, size_t *lenp, loff_t *ppos);
373 loff_t *ppos);
374extern int dirty_bytes_handler(struct ctl_table *table, int write,
375 void __user *buffer, size_t *lenp,
376 loff_t *ppos);
377int dirtytime_interval_handler(struct ctl_table *table, int write,373int dirtytime_interval_handler(struct ctl_table *table, int write,
378 void __user *buffer, size_t *lenp, loff_t *ppos);374 void *buffer, size_t *lenp, loff_t *ppos);
379 375int dirty_writeback_centisecs_handler(struct ctl_table *table, int write,
380struct ctl_table;376 void *buffer, size_t *lenp, loff_t *ppos);
381int dirty_writeback_centisecs_handler(struct ctl_table *, int,
382 void __user *, size_t *, loff_t *);
383 377
384void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty);378void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty);
385unsigned long wb_calc_thresh(struct bdi_writeback *wb, unsigned long thresh);379unsigned 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
24 24
25#ifdef CONFIG_PROC_SYSCTL25#ifdef CONFIG_PROC_SYSCTL
26static int proc_ipc_dointvec(struct ctl_table *table, int write,26static 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)
28{28{
29 struct ctl_table ipc_table;29 struct ctl_table ipc_table;
30 30
@@ -35,7 +35,7 @@ static int proc_ipc_dointvec(struct ctl_table *table, int write, · 4 unmodified lines
35}35}
36 36
37static int proc_ipc_dointvec_minmax(struct ctl_table *table, int write,37static 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)
39{39{
40 struct ctl_table ipc_table;40 struct ctl_table ipc_table;
41 41
@@ -46,7 +46,7 @@ static int proc_ipc_dointvec_minmax(struct ctl_table *table, int write, · 4 unmodified lines
46}46}
47 47
48static int proc_ipc_dointvec_minmax_orphans(struct ctl_table *table, int write,48static 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)
50{50{
51 struct ipc_namespace *ns = current->nsproxy->ipc_ns;51 struct ipc_namespace *ns = current->nsproxy->ipc_ns;
52 int err = proc_ipc_dointvec_minmax(table, write, buffer, lenp, ppos);52 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
59}59}
60 60
61static int proc_ipc_doulongvec_minmax(struct ctl_table *table, int write,61static 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)
63{63{
64 struct ctl_table ipc_table;64 struct ctl_table ipc_table;
65 memcpy(&ipc_table, table, sizeof(ipc_table));65 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
70}70}
71 71
72static int proc_ipc_auto_msgmni(struct ctl_table *table, int write,72static 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)
74{74{
75 struct ctl_table ipc_table;75 struct ctl_table ipc_table;
76 int dummy = 0;76 int dummy = 0;
ipc/mq_sysctl.c+2−2
@@ -19,7 +19,7 @@ static void *get_mq(struct ctl_table *table) · 18 unmodified lines
19}19}
20 20
21static int proc_mq_dointvec(struct ctl_table *table, int write,21static 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)
23{23{
24 struct ctl_table mq_table;24 struct ctl_table mq_table;
25 memcpy(&mq_table, table, sizeof(mq_table));25 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
29}29}
30 30
31static int proc_mq_dointvec_minmax(struct ctl_table *table, int write,31static 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)
33{33{
34 struct ctl_table mq_table;34 struct ctl_table mq_table;
35 memcpy(&mq_table, table, sizeof(mq_table));35 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
1122 * @head: sysctl table header1122 * @head: sysctl table header
1123 * @table: sysctl table1123 * @table: sysctl table
1124 * @write: sysctl is being read (= 0) or written (= 1)1124 * @write: sysctl is being read (= 0) or written (= 1)
1125 * @buf: pointer to buffer passed by user space1125 * @buf: pointer to buffer (in and out)
1126 * @pcount: value-result argument: value is size of buffer pointed to by @buf,1126 * @pcount: value-result argument: value is size of buffer pointed to by @buf,
1127 * result is size of @new_buf if program set new value, initial value1127 * result is size of @new_buf if program set new value, initial value
1128 * otherwise1128 * otherwise
1129 * @ppos: value-result argument: value is position at which read from or write1129 * @ppos: value-result argument: value is position at which read from or write
1130 * to sysctl is happening, result is new position if program overrode it,1130 * to sysctl is happening, result is new position if program overrode it,
1131 * initial value otherwise1131 * 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
1135 * @type: type of program to be executed1132 * @type: type of program to be executed
1136 *1133 *
1137 * Program is run when sysctl is being accessed, either read or written, and1134 * 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
1142 */1139 */
1143int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head,1140int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head,
1144 struct ctl_table *table, int write,1141 struct ctl_table *table, int write,
1145 void __user *buf, size_t *pcount,1142 void **buf, size_t *pcount, loff_t *ppos,
1146 loff_t *ppos, void **new_buf,
1147 enum bpf_attach_type type)1143 enum bpf_attach_type type)
1148{1144{
1149 struct bpf_sysctl_kern ctx = {1145 struct bpf_sysctl_kern ctx = {
@@ -1158,36 +1154,28 @@ int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head, · 8 unmodified lines
1158 .new_updated = 0,1154 .new_updated = 0,
1159 };1155 };
1160 struct cgroup *cgrp;1156 struct cgroup *cgrp;
1157 loff_t pos = 0;
1161 int ret;1158 int ret;
1162 1159
1163 ctx.cur_val = kmalloc_track_caller(ctx.cur_len, GFP_KERNEL);1160 ctx.cur_val = kmalloc_track_caller(ctx.cur_len, GFP_KERNEL);
1164 if (ctx.cur_val) {1161 if (!ctx.cur_val ||
1165 mm_segment_t old_fs;1162 table->proc_handler(table, 0, ctx.cur_val, &ctx.cur_len, &pos)) {
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 {
1177 /* Let BPF program decide how to proceed. */1163 /* Let BPF program decide how to proceed. */
1178 ctx.cur_len = 0;1164 ctx.cur_len = 0;
1179 }1165 }
1180 1166
1181 if (write && buf && *pcount) {1167 if (write && *buf && *pcount) {
1182 /* BPF program should be able to override new value with a1168 /* BPF program should be able to override new value with a
1183 * buffer bigger than provided by user.1169 * buffer bigger than provided by user.
1184 */1170 */
1185 ctx.new_val = kmalloc_track_caller(PAGE_SIZE, GFP_KERNEL);1171 ctx.new_val = kmalloc_track_caller(PAGE_SIZE, GFP_KERNEL);
1186 ctx.new_len = min_t(size_t, PAGE_SIZE, *pcount);1172 ctx.new_len = min_t(size_t, PAGE_SIZE, *pcount);
1187 if (!ctx.new_val ||1173 if (ctx.new_val) {
1188 copy_from_user(ctx.new_val, buf, ctx.new_len))1174 memcpy(ctx.new_val, *buf, ctx.new_len);
1175 } else {
1189 /* Let BPF program decide how to proceed. */1176 /* Let BPF program decide how to proceed. */
1190 ctx.new_len = 0;1177 ctx.new_len = 0;
1178 }
1191 }1179 }
1192 1180
1193 rcu_read_lock();1181 rcu_read_lock();
@@ -1198,7 +1186,8 @@ int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head, · 4 unmodified lines
1198 kfree(ctx.cur_val);1186 kfree(ctx.cur_val);
1199 1187
1200 if (ret == 1 && ctx.new_updated) {1188 if (ret == 1 && ctx.new_updated) {
1201 *new_buf = ctx.new_val;1189 kfree(*buf);
1190 *buf = ctx.new_val;
1202 *pcount = ctx.new_len;1191 *pcount = ctx.new_len;
1203 } else {1192 } else {
1204 kfree(ctx.new_val);1193 kfree(ctx.new_val);
kernel/events/callchain.c+1−1
@@ -236,7 +236,7 @@ exit_put: · 235 unmodified lines
236 * sysctl_perf_event_max_contexts_per_stack.236 * sysctl_perf_event_max_contexts_per_stack.
237 */237 */
238int perf_event_max_stack_handler(struct ctl_table *table, int write,238int 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)
240{240{
241 int *value = table->data;241 int *value = table->data;
242 int new_value = *value, ret;242 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
437static bool perf_rotate_context(struct perf_cpu_context *cpuctx);437static bool perf_rotate_context(struct perf_cpu_context *cpuctx);
438 438
439int perf_proc_update_handler(struct ctl_table *table, int write,439int perf_proc_update_handler(struct ctl_table *table, int write,
440 void __user *buffer, size_t *lenp,440 void *buffer, size_t *lenp, loff_t *ppos)
441 loff_t *ppos)
442{441{
443 int ret;442 int ret;
444 int perf_cpu = sysctl_perf_cpu_time_max_percent;443 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
462int sysctl_perf_cpu_time_max_percent __read_mostly = DEFAULT_CPU_TIME_MAX_PERCENT;461int sysctl_perf_cpu_time_max_percent __read_mostly = DEFAULT_CPU_TIME_MAX_PERCENT;
463 462
464int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,463int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,
465 void __user *buffer, size_t *lenp,464 void *buffer, size_t *lenp, loff_t *ppos)
466 loff_t *ppos)
467{465{
468 int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);466 int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
469 467
kernel/kprobes.c+1−1
@@ -892,7 +892,7 @@ static void unoptimize_all_kprobes(void) · 891 unmodified lines
892static DEFINE_MUTEX(kprobe_sysctl_mutex);892static DEFINE_MUTEX(kprobe_sysctl_mutex);
893int sysctl_kprobes_optimization;893int sysctl_kprobes_optimization;
894int proc_kprobes_optimization_handler(struct ctl_table *table, int write,894int proc_kprobes_optimization_handler(struct ctl_table *table, int write,
895 void __user *buffer, size_t *length,895 void *buffer, size_t *length,
896 loff_t *ppos)896 loff_t *ppos)
897{897{
898 int ret;898 int ret;
kernel/latencytop.c+2−2
@@ -269,8 +269,8 @@ static int __init init_lstats_procfs(void) · 268 unmodified lines
269 return 0;269 return 0;
270}270}
271 271
272int sysctl_latencytop(struct ctl_table *table, int write,272int sysctl_latencytop(struct ctl_table *table, int write, void *buffer,
273 void __user *buffer, size_t *lenp, loff_t *ppos)273 size_t *lenp, loff_t *ppos)
274{274{
275 int err;275 int err;
276 276
kernel/pid_namespace.c+1−1
@@ -263,7 +263,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns) · 262 unmodified lines
263 263
264#ifdef CONFIG_CHECKPOINT_RESTORE264#ifdef CONFIG_CHECKPOINT_RESTORE
265static int pid_ns_ctl_handler(struct ctl_table *table, int write,265static 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)
267{267{
268 struct pid_namespace *pid_ns = task_active_pid_ns(current);268 struct pid_namespace *pid_ns = task_active_pid_ns(current);
269 struct ctl_table tmp = *table;269 struct ctl_table tmp = *table;
kernel/printk/printk.c+1−1
@@ -173,7 +173,7 @@ __setup("printk.devkmsg=", control_devkmsg); · 172 unmodified lines
173char devkmsg_log_str[DEVKMSG_STR_MAX_SIZE] = "ratelimit";173char devkmsg_log_str[DEVKMSG_STR_MAX_SIZE] = "ratelimit";
174 174
175int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write,175int 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)
177{177{
178 char old_str[DEVKMSG_STR_MAX_SIZE];178 char old_str[DEVKMSG_STR_MAX_SIZE];
179 unsigned int old;179 unsigned int old;
kernel/sched/core.c+4−5
@@ -1110,8 +1110,7 @@ static void uclamp_update_root_tg(void) { } · 1109 unmodified lines
1110#endif1110#endif
1111 1111
1112int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,1112int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
1113 void __user *buffer, size_t *lenp,1113 void *buffer, size_t *lenp, loff_t *ppos)
1114 loff_t *ppos)
1115{1114{
1116 bool update_root_tg = false;1115 bool update_root_tg = false;
1117 int old_min, old_max;1116 int old_min, old_max;
@@ -2718,7 +2717,7 @@ void set_numabalancing_state(bool enabled) · 1600 unmodified lines
2718 2717
2719#ifdef CONFIG_PROC_SYSCTL2718#ifdef CONFIG_PROC_SYSCTL
2720int sysctl_numa_balancing(struct ctl_table *table, int write,2719int 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)
2722{2721{
2723 struct ctl_table t;2722 struct ctl_table t;
2724 int err;2723 int err;
@@ -2792,8 +2791,8 @@ static void __init init_schedstats(void) · 67 unmodified lines
2792}2791}
2793 2792
2794#ifdef CONFIG_PROC_SYSCTL2793#ifdef CONFIG_PROC_SYSCTL
2795int sysctl_schedstats(struct ctl_table *table, int write,2794int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
2796 void __user *buffer, size_t *lenp, loff_t *ppos)2795 size_t *lenp, loff_t *ppos)
2797{2796{
2798 struct ctl_table t;2797 struct ctl_table t;
2799 int err;2798 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
645 */645 */
646 646
647int sched_proc_update_handler(struct ctl_table *table, int write,647int sched_proc_update_handler(struct ctl_table *table, int write,
648 void __user *buffer, size_t *lenp,648 void *buffer, size_t *lenp, loff_t *ppos)
649 loff_t *ppos)
650{649{
651 int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);650 int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
652 unsigned int factor = get_update_sysctl_factor();651 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
2714 def_rt_bandwidth.rt_period = ns_to_ktime(global_rt_period());2714 def_rt_bandwidth.rt_period = ns_to_ktime(global_rt_period());
2715}2715}
2716 2716
2717int sched_rt_handler(struct ctl_table *table, int write,2717int sched_rt_handler(struct ctl_table *table, int write, void *buffer,
2718 void __user *buffer, size_t *lenp,2718 size_t *lenp, loff_t *ppos)
2719 loff_t *ppos)
2720{2719{
2721 int old_period, old_runtime;2720 int old_period, old_runtime;
2722 static DEFINE_MUTEX(mutex);2721 static DEFINE_MUTEX(mutex);
@@ -2754,9 +2753,8 @@ undo: · 31 unmodified lines
2754 return ret;2753 return ret;
2755}2754}
2756 2755
2757int sched_rr_handler(struct ctl_table *table, int write,2756int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
2758 void __user *buffer, size_t *lenp,2757 size_t *lenp, loff_t *ppos)
2759 loff_t *ppos)
2760{2758{
2761 int ret;2759 int ret;
2762 static DEFINE_MUTEX(mutex);2760 static DEFINE_MUTEX(mutex);
kernel/sched/topology.c+1−1
@@ -209,7 +209,7 @@ bool sched_energy_update; · 208 unmodified lines
209 209
210#ifdef CONFIG_PROC_SYSCTL210#ifdef CONFIG_PROC_SYSCTL
211int sched_energy_aware_handler(struct ctl_table *table, int write,211int 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)
213{213{
214 int ret, state;214 int ret, state;
215 215
kernel/seccomp.c+1−1
@@ -1776,7 +1776,7 @@ static void audit_actions_logged(u32 actions_logged, u32 old_actions_logged, · 1775 unmodified lines
1776}1776}
1777 1777
1778static int seccomp_actions_logged_handler(struct ctl_table *ro_table, int write,1778static 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,
1780 loff_t *ppos)1780 loff_t *ppos)
1781{1781{
1782 int ret;1782 int ret;
kernel/sysctl.c+1853−1986
@@ -68,6 +68,9 @@ · 67 unmodified lines
68#include <linux/bpf.h>68#include <linux/bpf.h>
69#include <linux/mount.h>69#include <linux/mount.h>
70#include <linux/userfaultfd_k.h>70#include <linux/userfaultfd_k.h>
71#include <linux/coredump.h>
72#include <linux/latencytop.h>
73#include <linux/pid.h>
71 74
72#include "../lib/kstrtox.h"75#include "../lib/kstrtox.h"
73 76
@@ -103,22 +106,6 @@ · 29 unmodified lines
103 106
104#if defined(CONFIG_SYSCTL)107#if defined(CONFIG_SYSCTL)
105 108
106/* External variables not in a header file. */
107extern int suid_dumpable;
108#ifdef CONFIG_COREDUMP
109extern int core_uses_pid;
110extern char core_pattern[];
111extern unsigned int core_pipe_limit;
112#endif
113extern int pid_max;
114extern int pid_max_min, pid_max_max;
115extern int percpu_pagelist_fraction;
116extern int latencytop_enabled;
117extern unsigned int sysctl_nr_open_min, sysctl_nr_open_max;
118#ifndef CONFIG_MMU
119extern int sysctl_nr_trim_pages;
120#endif
121
122/* Constants used for minimum and maximum */109/* Constants used for minimum and maximum */
123#ifdef CONFIG_LOCKUP_DETECTOR110#ifdef CONFIG_LOCKUP_DETECTOR
124static int sixty = 60;111static int sixty = 60;
@@ -160,24 +147,6 @@ static unsigned long hung_task_timeout_max = (LONG_MAX/HZ); · 35 unmodified lines
160#ifdef CONFIG_INOTIFY_USER147#ifdef CONFIG_INOTIFY_USER
161#include <linux/inotify.h>148#include <linux/inotify.h>
162#endif149#endif
163#ifdef CONFIG_SPARC
164#endif
165
166#ifdef CONFIG_PARISC
167extern int pwrsw_enabled;
168#endif
169
170#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
171extern int unaligned_enabled;
172#endif
173
174#ifdef CONFIG_IA64
175extern int unaligned_dump_stack;
176#endif
177
178#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
179extern int no_unaligned_warning;
180#endif
181 150
182#ifdef CONFIG_PROC_SYSCTL151#ifdef CONFIG_PROC_SYSCTL
183 152
@@ -207,87 +176,13 @@ enum sysctl_writes_mode { · 23 unmodified lines
207};176};
208 177
209static enum sysctl_writes_mode sysctl_writes_strict = SYSCTL_WRITES_STRICT;178static enum sysctl_writes_mode sysctl_writes_strict = SYSCTL_WRITES_STRICT;
210 179#endif /* CONFIG_PROC_SYSCTL */
211static int proc_do_cad_pid(struct ctl_table *table, int write,
212 void __user *buffer, size_t *lenp, loff_t *ppos);
213static int proc_taint(struct ctl_table *table, int write,
214 void __user *buffer, size_t *lenp, loff_t *ppos);
215#ifdef CONFIG_COMPACTION
216static 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
223static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
224 void __user *buffer, size_t *lenp, loff_t *ppos);
225#endif
226
227static 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
230static int proc_dostring_coredump(struct ctl_table *table, int write,
231 void __user *buffer, size_t *lenp, loff_t *ppos);
232#endif
233static 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
237static int sysrq_sysctl_handler(struct ctl_table *table, int write,
238 void __user *buffer, size_t *lenp, loff_t *ppos);
239#endif
240
241static struct ctl_table kern_table[];
242static struct ctl_table vm_table[];
243static struct ctl_table fs_table[];
244static struct ctl_table debug_table[];
245static struct ctl_table dev_table[];
246extern struct ctl_table random_table[];
247#ifdef CONFIG_EPOLL
248extern struct ctl_table epoll_table[];
249#endif
250
251#ifdef CONFIG_FW_LOADER_USER_HELPER
252extern struct ctl_table firmware_config_table[];
253#endif
254 180
255#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \181#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \
256 defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT)182 defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT)
257int sysctl_legacy_va_layout;183int sysctl_legacy_va_layout;
258#endif184#endif
259 185
260/* The default sysctl tables: */
261
262static 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
291#ifdef CONFIG_SCHED_DEBUG186#ifdef CONFIG_SCHED_DEBUG
292static int min_sched_granularity_ns = 100000; /* 100 usecs */187static int min_sched_granularity_ns = 100000; /* 100 usecs */
293static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */188static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
@@ -304,1685 +199,19 @@ static int min_extfrag_threshold; · 10 unmodified lines
304static int max_extfrag_threshold = 1000;199static int max_extfrag_threshold = 1000;
305#endif200#endif
306 201
307static struct ctl_table kern_table[] = {202#endif /* CONFIG_SYSCTL */
308 {203
309 .procname = "sched_child_runs_first",204/*
310 .data = &sysctl_sched_child_runs_first,205 * /proc/sys support
311 .maxlen = sizeof(unsigned int),206 */
312 .mode = 0644,207
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
1275static 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
1726static 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
1934static 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
1958static struct ctl_table dev_table[] = {
1959 { }
1960};
1961
1962int __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
1977#ifdef CONFIG_PROC_SYSCTL208#ifdef CONFIG_PROC_SYSCTL
1978 209
1979static int _proc_do_string(char *data, int maxlen, int write,210static int _proc_do_string(char *data, int maxlen, int write,
1980 char __user *buffer,211 char *buffer, size_t *lenp, loff_t *ppos)
1981 size_t *lenp, loff_t *ppos)
1982{212{
1983 size_t len;213 size_t len;
1984 char __user *p;214 char c, *p;
1985 char c;
1986 215
1987 if (!data || !maxlen || !*lenp) {216 if (!data || !maxlen || !*lenp) {
1988 *lenp = 0;217 *lenp = 0;
@@ -2007,8 +236,7 @@ static int _proc_do_string(char *data, int maxlen, int write, · 18 unmodified lines
2007 *ppos += *lenp;236 *ppos += *lenp;
2008 p = buffer;237 p = buffer;
2009 while ((p - buffer) < *lenp && len < maxlen - 1) {238 while ((p - buffer) < *lenp && len < maxlen - 1) {
2010 if (get_user(c, p++))239 c = *(p++);
2011 return -EFAULT;
2012 if (c == 0 || c == '\n')240 if (c == 0 || c == '\n')
2013 break;241 break;
2014 data[len++] = c;242 data[len++] = c;
@@ -2030,11 +258,9 @@ static int _proc_do_string(char *data, int maxlen, int write, · 15 unmodified lines
2030 if (len > *lenp)258 if (len > *lenp)
2031 len = *lenp;259 len = *lenp;
2032 if (len)260 if (len)
2033 if (copy_to_user(buffer, data, len))261 memcpy(buffer, data, len);
2034 return -EFAULT;
2035 if (len < *lenp) {262 if (len < *lenp) {
2036 if (put_user('\n', buffer + len))263 buffer[len] = '\n';
2037 return -EFAULT;
2038 len++;264 len++;
2039 }265 }
2040 *lenp = len;266 *lenp = len;
@@ -2095,13 +321,13 @@ static bool proc_first_pos_non_zero_ignore(loff_t *ppos, · 54 unmodified lines
2095 * Returns 0 on success.321 * Returns 0 on success.
2096 */322 */
2097int proc_dostring(struct ctl_table *table, int write,323int 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)
2099{325{
2100 if (write)326 if (write)
2101 proc_first_pos_non_zero_ignore(ppos, table);327 proc_first_pos_non_zero_ignore(ppos, table);
2102 328
2103 return _proc_do_string((char *)(table->data), table->maxlen, write,329 return _proc_do_string(table->data, table->maxlen, write, buffer, lenp,
2104 (char __user *)buffer, lenp, ppos);330 ppos);
2105}331}
2106 332
2107static size_t proc_skip_spaces(char **buf)333static size_t proc_skip_spaces(char **buf)
@@ -2232,11 +458,10 @@ static int proc_get_long(char **buf, size_t *size, · 124 unmodified lines
2232 * @val: the integer to be converted458 * @val: the integer to be converted
2233 * @neg: sign of the number, %TRUE for negative459 * @neg: sign of the number, %TRUE for negative
2234 *460 *
2235 * In case of success %0 is returned and @buf and @size are updated with461 * In case of success @buf and @size are updated with the amount of bytes
2236 * the amount of bytes written.462 * written.
2237 */463 */
2238static int proc_put_long(void __user **buf, size_t *size, unsigned long val,464static void proc_put_long(void **buf, size_t *size, unsigned long val, bool neg)
2239 bool neg)
2240{465{
2241 int len;466 int len;
2242 char tmp[TMPBUFLEN], *p = tmp;467 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
2245 len = strlen(tmp);470 len = strlen(tmp);
2246 if (len > *size)471 if (len > *size)
2247 len = *size;472 len = *size;
2248 if (copy_to_user(*buf, tmp, len))473 memcpy(*buf, tmp, len);
2249 return -EFAULT;
2250 *size -= len;474 *size -= len;
2251 *buf += len;475 *buf += len;
2252 return 0;
2253}476}
2254#undef TMPBUFLEN477#undef TMPBUFLEN
2255 478
2256static int proc_put_char(void __user **buf, size_t *size, char c)479static void proc_put_char(void **buf, size_t *size, char c)
2257{480{
2258 if (*size) {481 if (*size) {
2259 char __user **buffer = (char __user **)buf;482 char **buffer = (char **)buf;
2260 if (put_user(c, *buffer))483 **buffer = c;
2261 return -EFAULT;484
2262 (*size)--, (*buffer)++;485 (*size)--;
486 (*buffer)++;
2263 *buf = *buffer;487 *buf = *buffer;
2264 }488 }
2265 return 0;
2266}489}
2267 490
2268static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,491static 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
2310static const char proc_wspace_sep[] = { ' ', '\t', '\n' };533static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
2311 534
2312static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,535static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2313 int write, void __user *buffer,536 int write, void *buffer,
2314 size_t *lenp, loff_t *ppos,537 size_t *lenp, loff_t *ppos,
2315 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,538 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2316 int write, void *data),539 int write, void *data),
@@ -2318,7 +541,7 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, · 1 unmodified line
2318{541{
2319 int *i, vleft, first = 1, err = 0;542 int *i, vleft, first = 1, err = 0;
2320 size_t left;543 size_t left;
2321 char *kbuf = NULL, *p;544 char *p;
2322 545
2323 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {546 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
2324 *lenp = 0;547 *lenp = 0;
@@ -2338,9 +561,7 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, · 13 unmodified lines
2338 561
2339 if (left > PAGE_SIZE - 1)562 if (left > PAGE_SIZE - 1)
2340 left = PAGE_SIZE - 1;563 left = PAGE_SIZE - 1;
2341 p = kbuf = memdup_user_nul(buffer, left);564 p = buffer;
2342 if (IS_ERR(kbuf))
2343 return PTR_ERR(kbuf);
2344 }565 }
2345 566
2346 for (; left && vleft--; i++, first=0) {567 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
2367 break;588 break;
2368 }589 }
2369 if (!first)590 if (!first)
2370 err = proc_put_char(&buffer, &left, '\t');591 proc_put_char(&buffer, &left, '\t');
2371 if (err)592 proc_put_long(&buffer, &left, lval, neg);
2372 break;
2373 err = proc_put_long(&buffer, &left, lval, neg);
2374 if (err)
2375 break;
2376 }593 }
2377 }594 }
2378 595
2379 if (!write && !first && left && !err)596 if (!write && !first && left && !err)
2380 err = proc_put_char(&buffer, &left, '\n');597 proc_put_char(&buffer, &left, '\n');
2381 if (write && !err && left)598 if (write && !err && left)
2382 left -= proc_skip_spaces(&p);599 left -= proc_skip_spaces(&p);
2383 if (write) {600 if (write && first)
2384 kfree(kbuf);601 return err ? : -EINVAL;
2385 if (first)
2386 return err ? : -EINVAL;
2387 }
2388 *lenp -= left;602 *lenp -= left;
2389out:603out:
2390 *ppos += *lenp;604 *ppos += *lenp;
@@ -2392,7 +606,7 @@ out: · 1 unmodified line
2392}606}
2393 607
2394static int do_proc_dointvec(struct ctl_table *table, int write,608static 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,
2396 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,610 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2397 int write, void *data),611 int write, void *data),
2398 void *data)612 void *data)
@@ -2403,7 +617,7 @@ static int do_proc_dointvec(struct ctl_table *table, int write, · 4 unmodified lines
2403 617
2404static int do_proc_douintvec_w(unsigned int *tbl_data,618static int do_proc_douintvec_w(unsigned int *tbl_data,
2405 struct ctl_table *table,619 struct ctl_table *table,
2406 void __user *buffer,620 void *buffer,
2407 size_t *lenp, loff_t *ppos,621 size_t *lenp, loff_t *ppos,
2408 int (*conv)(unsigned long *lvalp,622 int (*conv)(unsigned long *lvalp,
2409 unsigned int *valp,623 unsigned int *valp,
@@ -2414,7 +628,7 @@ static int do_proc_douintvec_w(unsigned int *tbl_data, · 4 unmodified lines
2414 int err = 0;628 int err = 0;
2415 size_t left;629 size_t left;
2416 bool neg;630 bool neg;
2417 char *kbuf = NULL, *p;631 char *p = buffer;
2418 632
2419 left = *lenp;633 left = *lenp;
2420 634
@@ -2424,10 +638,6 @@ static int do_proc_douintvec_w(unsigned int *tbl_data, · 3 unmodified lines
2424 if (left > PAGE_SIZE - 1)638 if (left > PAGE_SIZE - 1)
2425 left = PAGE_SIZE - 1;639 left = PAGE_SIZE - 1;
2426 640
2427 p = kbuf = memdup_user_nul(buffer, left);
2428 if (IS_ERR(kbuf))
2429 return -EINVAL;
2430
2431 left -= proc_skip_spaces(&p);641 left -= proc_skip_spaces(&p);
2432 if (!left) {642 if (!left) {
2433 err = -EINVAL;643 err = -EINVAL;
@@ -2451,7 +661,6 @@ static int do_proc_douintvec_w(unsigned int *tbl_data, · 17 unmodified lines
2451 left -= proc_skip_spaces(&p);661 left -= proc_skip_spaces(&p);
2452 662
2453out_free:663out_free:
2454 kfree(kbuf);
2455 if (err)664 if (err)
2456 return -EINVAL;665 return -EINVAL;
2457 666
@@ -2463,7 +672,7 @@ bail_early: · 5 unmodified lines
2463 return err;672 return err;
2464}673}
2465 674
2466static int do_proc_douintvec_r(unsigned int *tbl_data, void __user *buffer,675static int do_proc_douintvec_r(unsigned int *tbl_data, void *buffer,
2467 size_t *lenp, loff_t *ppos,676 size_t *lenp, loff_t *ppos,
2468 int (*conv)(unsigned long *lvalp,677 int (*conv)(unsigned long *lvalp,
2469 unsigned int *valp,678 unsigned int *valp,
@@ -2481,11 +690,11 @@ static int do_proc_douintvec_r(unsigned int *tbl_data, void __user *buffer, · 11 unmodified lines
2481 goto out;690 goto out;
2482 }691 }
2483 692
2484 err = proc_put_long(&buffer, &left, lval, false);693 proc_put_long(&buffer, &left, lval, false);
2485 if (err || !left)694 if (!left)
2486 goto out;695 goto out;
2487 696
2488 err = proc_put_char(&buffer, &left, '\n');697 proc_put_char(&buffer, &left, '\n');
2489 698
2490out:699out:
2491 *lenp -= left;700 *lenp -= left;
@@ -2495,7 +704,7 @@ out: · 3 unmodified lines
2495}704}
2496 705
2497static int __do_proc_douintvec(void *tbl_data, struct ctl_table *table,706static int __do_proc_douintvec(void *tbl_data, struct ctl_table *table,
2498 int write, void __user *buffer,707 int write, void *buffer,
2499 size_t *lenp, loff_t *ppos,708 size_t *lenp, loff_t *ppos,
2500 int (*conv)(unsigned long *lvalp,709 int (*conv)(unsigned long *lvalp,
2501 unsigned int *valp,710 unsigned int *valp,
@@ -2531,7 +740,7 @@ static int __do_proc_douintvec(void *tbl_data, struct ctl_table *table, · 29 unmodified lines
2531}740}
2532 741
2533static int do_proc_douintvec(struct ctl_table *table, int write,742static 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,
2535 int (*conv)(unsigned long *lvalp,744 int (*conv)(unsigned long *lvalp,
2536 unsigned int *valp,745 unsigned int *valp,
2537 int write, void *data),746 int write, void *data),
@@ -2554,16 +763,15 @@ static int do_proc_douintvec(struct ctl_table *table, int write, · 16 unmodified lines
2554 *763 *
2555 * Returns 0 on success.764 * Returns 0 on success.
2556 */765 */
2557int proc_dointvec(struct ctl_table *table, int write,766int proc_dointvec(struct ctl_table *table, int write, void *buffer,
2558 void __user *buffer, size_t *lenp, loff_t *ppos)767 size_t *lenp, loff_t *ppos)
2559{768{
2560 return do_proc_dointvec(table, write, buffer, lenp, ppos, NULL, NULL);769 return do_proc_dointvec(table, write, buffer, lenp, ppos, NULL, NULL);
2561}770}
2562 771
2563#ifdef CONFIG_COMPACTION772#ifdef CONFIG_COMPACTION
2564static int proc_dointvec_minmax_warn_RT_change(struct ctl_table *table,773static int proc_dointvec_minmax_warn_RT_change(struct ctl_table *table,
2565 int write, void __user *buffer,774 int write, void *buffer, size_t *lenp, loff_t *ppos)
2566 size_t *lenp, loff_t *ppos)
2567{775{
2568 int ret, old;776 int ret, old;
2569 777
@@ -2595,8 +803,8 @@ static int proc_dointvec_minmax_warn_RT_change(struct ctl_table *table, · 25 unmodified lines
2595 *803 *
2596 * Returns 0 on success.804 * Returns 0 on success.
2597 */805 */
2598int proc_douintvec(struct ctl_table *table, int write,806int proc_douintvec(struct ctl_table *table, int write, void *buffer,
2599 void __user *buffer, size_t *lenp, loff_t *ppos)807 size_t *lenp, loff_t *ppos)
2600{808{
2601 return do_proc_douintvec(table, write, buffer, lenp, ppos,809 return do_proc_douintvec(table, write, buffer, lenp, ppos,
2602 do_proc_douintvec_conv, NULL);810 do_proc_douintvec_conv, NULL);
@@ -2607,7 +815,7 @@ int proc_douintvec(struct ctl_table *table, int write, · 4 unmodified lines
2607 * This means we can safely use a temporary.815 * This means we can safely use a temporary.
2608 */816 */
2609static int proc_taint(struct ctl_table *table, int write,817static 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)
2611{819{
2612 struct ctl_table t;820 struct ctl_table t;
2613 unsigned long tmptaint = get_taint();821 unsigned long tmptaint = get_taint();
@@ -2639,7 +847,7 @@ static int proc_taint(struct ctl_table *table, int write, · 25 unmodified lines
2639 847
2640#ifdef CONFIG_PRINTK848#ifdef CONFIG_PRINTK
2641static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,849static 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)
2643{851{
2644 if (write && !capable(CAP_SYS_ADMIN))852 if (write && !capable(CAP_SYS_ADMIN))
2645 return -EPERM;853 return -EPERM;
@@ -2705,7 +913,7 @@ static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp, · 59 unmodified lines
2705 * Returns 0 on success or -EINVAL on write when the range check fails.913 * Returns 0 on success or -EINVAL on write when the range check fails.
2706 */914 */
2707int proc_dointvec_minmax(struct ctl_table *table, int write,915int 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)
2709{917{
2710 struct do_proc_dointvec_minmax_conv_param param = {918 struct do_proc_dointvec_minmax_conv_param param = {
2711 .min = (int *) table->extra1,919 .min = (int *) table->extra1,
@@ -2774,7 +982,7 @@ static int do_proc_douintvec_minmax_conv(unsigned long *lvalp, · 62 unmodified lines
2774 * Returns 0 on success or -ERANGE on write when the range check fails.982 * Returns 0 on success or -ERANGE on write when the range check fails.
2775 */983 */
2776int proc_douintvec_minmax(struct ctl_table *table, int write,984int 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)
2778{986{
2779 struct do_proc_douintvec_minmax_conv_param param = {987 struct do_proc_douintvec_minmax_conv_param param = {
2780 .min = (unsigned int *) table->extra1,988 .min = (unsigned int *) table->extra1,
@@ -2805,7 +1013,7 @@ static int do_proc_dopipe_max_size_conv(unsigned long *lvalp, · 24 unmodified lines
2805}1013}
2806 1014
2807static int proc_dopipe_max_size(struct ctl_table *table, int write,1015static 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)
2809{1017{
2810 return do_proc_douintvec(table, write, buffer, lenp, ppos,1018 return do_proc_douintvec(table, write, buffer, lenp, ppos,
2811 do_proc_dopipe_max_size_conv, NULL);1019 do_proc_dopipe_max_size_conv, NULL);
@@ -2826,7 +1034,7 @@ static void validate_coredump_safety(void) · 14 unmodified lines
2826}1034}
2827 1035
2828static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,1036static 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)
2830{1038{
2831 int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos);1039 int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
2832 if (!error)1040 if (!error)
@@ -2836,7 +1044,7 @@ static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write, · 3 unmodified lines
2836 1044
2837#ifdef CONFIG_COREDUMP1045#ifdef CONFIG_COREDUMP
2838static int proc_dostring_coredump(struct ctl_table *table, int write,1046static 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)
2840{1048{
2841 int error = proc_dostring(table, write, buffer, lenp, ppos);1049 int error = proc_dostring(table, write, buffer, lenp, ppos);
2842 if (!error)1050 if (!error)
@@ -2847,7 +1055,7 @@ static int proc_dostring_coredump(struct ctl_table *table, int write, · 4 unmodified lines
2847 1055
2848#ifdef CONFIG_MAGIC_SYSRQ1056#ifdef CONFIG_MAGIC_SYSRQ
2849static int sysrq_sysctl_handler(struct ctl_table *table, int write,1057static 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)
2851{1059{
2852 int tmp, ret;1060 int tmp, ret;
2853 1061
@@ -2865,16 +1073,14 @@ static int sysrq_sysctl_handler(struct ctl_table *table, int write, · 11 unmodified lines
2865}1073}
2866#endif1074#endif
2867 1075
2868static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,1076static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table,
2869 void __user *buffer,1077 int write, void *buffer, size_t *lenp, loff_t *ppos,
2870 size_t *lenp, loff_t *ppos,1078 unsigned long convmul, unsigned long convdiv)
2871 unsigned long convmul,
2872 unsigned long convdiv)
2873{1079{
2874 unsigned long *i, *min, *max;1080 unsigned long *i, *min, *max;
2875 int vleft, first = 1, err = 0;1081 int vleft, first = 1, err = 0;
2876 size_t left;1082 size_t left;
2877 char *kbuf = NULL, *p;1083 char *p;
2878 1084
2879 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {1085 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
2880 *lenp = 0;1086 *lenp = 0;
@@ -2893,9 +1099,7 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int · 12 unmodified lines
2893 1099
2894 if (left > PAGE_SIZE - 1)1100 if (left > PAGE_SIZE - 1)
2895 left = PAGE_SIZE - 1;1101 left = PAGE_SIZE - 1;
2896 p = kbuf = memdup_user_nul(buffer, left);1102 p = buffer;
2897 if (IS_ERR(kbuf))
2898 return PTR_ERR(kbuf);
2899 }1103 }
2900 1104
2901 for (; left && vleft--; i++, first = 0) {1105 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
2923 *i = val;1127 *i = val;
2924 } else {1128 } else {
2925 val = convdiv * (*i) / convmul;1129 val = convdiv * (*i) / convmul;
2926 if (!first) {1130 if (!first)
2927 err = proc_put_char(&buffer, &left, '\t');1131 proc_put_char(&buffer, &left, '\t');
2928 if (err)1132 proc_put_long(&buffer, &left, val, false);
2929 break;
2930 }
2931 err = proc_put_long(&buffer, &left, val, false);
2932 if (err)
2933 break;
2934 }1133 }
2935 }1134 }
2936 1135
2937 if (!write && !first && left && !err)1136 if (!write && !first && left && !err)
2938 err = proc_put_char(&buffer, &left, '\n');1137 proc_put_char(&buffer, &left, '\n');
2939 if (write && !err)1138 if (write && !err)
2940 left -= proc_skip_spaces(&p);1139 left -= proc_skip_spaces(&p);
2941 if (write) {1140 if (write && first)
2942 kfree(kbuf);1141 return err ? : -EINVAL;
2943 if (first)
2944 return err ? : -EINVAL;
2945 }
2946 *lenp -= left;1142 *lenp -= left;
2947out:1143out:
2948 *ppos += *lenp;1144 *ppos += *lenp;
@@ -2950,10 +1146,8 @@ out: · 1 unmodified line
2950}1146}
2951 1147
2952static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,1148static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2953 void __user *buffer,1149 void *buffer, size_t *lenp, loff_t *ppos, unsigned long convmul,
2954 size_t *lenp, loff_t *ppos,1150 unsigned long convdiv)
2955 unsigned long convmul,
2956 unsigned long convdiv)
2957{1151{
2958 return __do_proc_doulongvec_minmax(table->data, table, write,1152 return __do_proc_doulongvec_minmax(table->data, table, write,
2959 buffer, lenp, ppos, convmul, convdiv);1153 buffer, lenp, ppos, convmul, convdiv);
@@ -2976,7 +1170,7 @@ static int do_proc_doulongvec_minmax(struct ctl_table *table, int write, · 16 unmodified lines
2976 * Returns 0 on success.1170 * Returns 0 on success.
2977 */1171 */
2978int proc_doulongvec_minmax(struct ctl_table *table, int write,1172int 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)
2980{1174{
2981 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);1175 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
2982}1176}
@@ -2999,8 +1193,7 @@ int proc_doulongvec_minmax(struct ctl_table *table, int write, · 16 unmodified lines
2999 * Returns 0 on success.1193 * Returns 0 on success.
3000 */1194 */
3001int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,1195int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
3002 void __user *buffer,1196 void *buffer, size_t *lenp, loff_t *ppos)
3003 size_t *lenp, loff_t *ppos)
3004{1197{
3005 return do_proc_doulongvec_minmax(table, write, buffer,1198 return do_proc_doulongvec_minmax(table, write, buffer,
3006 lenp, ppos, HZ, 1000l);1199 lenp, ppos, HZ, 1000l);
@@ -3094,7 +1287,7 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp, · 87 unmodified lines
3094 * Returns 0 on success.1287 * Returns 0 on success.
3095 */1288 */
3096int proc_dointvec_jiffies(struct ctl_table *table, int write,1289int 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)
3098{1291{
3099 return do_proc_dointvec(table,write,buffer,lenp,ppos,1292 return do_proc_dointvec(table,write,buffer,lenp,ppos,
3100 do_proc_dointvec_jiffies_conv,NULL);1293 do_proc_dointvec_jiffies_conv,NULL);
@@ -3116,7 +1309,7 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write, · 15 unmodified lines
3116 * Returns 0 on success.1309 * Returns 0 on success.
3117 */1310 */
3118int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,1311int 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)
3120{1313{
3121 return do_proc_dointvec(table,write,buffer,lenp,ppos,1314 return do_proc_dointvec(table,write,buffer,lenp,ppos,
3122 do_proc_dointvec_userhz_jiffies_conv,NULL);1315 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
3138 *1331 *
3139 * Returns 0 on success.1332 * Returns 0 on success.
3140 */1333 */
3141int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,1334int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, void *buffer,
3142 void __user *buffer, size_t *lenp, loff_t *ppos)1335 size_t *lenp, loff_t *ppos)
3143{1336{
3144 return do_proc_dointvec(table, write, buffer, lenp, ppos,1337 return do_proc_dointvec(table, write, buffer, lenp, ppos,
3145 do_proc_dointvec_ms_jiffies_conv, NULL);1338 do_proc_dointvec_ms_jiffies_conv, NULL);
3146}1339}
3147 1340
3148static int proc_do_cad_pid(struct ctl_table *table, int write,1341static int proc_do_cad_pid(struct ctl_table *table, int write, void *buffer,
3149 void __user *buffer, size_t *lenp, loff_t *ppos)1342 size_t *lenp, loff_t *ppos)
3150{1343{
3151 struct pid *new_pid;1344 struct pid *new_pid;
3152 pid_t tmp;1345 pid_t tmp;
@@ -3185,7 +1378,7 @@ static int proc_do_cad_pid(struct ctl_table *table, int write, · 32 unmodified lines
3185 * Returns 0 on success.1378 * Returns 0 on success.
3186 */1379 */
3187int proc_do_large_bitmap(struct ctl_table *table, int write,1380int 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)
3189{1382{
3190 int err = 0;1383 int err = 0;
3191 bool first = 1;1384 bool first = 1;
@@ -3201,7 +1394,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, · 9 unmodified lines
3201 }1394 }
3202 1395
3203 if (write) {1396 if (write) {
3204 char *kbuf, *p;1397 char *p = buffer;
3205 size_t skipped = 0;1398 size_t skipped = 0;
3206 1399
3207 if (left > PAGE_SIZE - 1) {1400 if (left > PAGE_SIZE - 1) {
@@ -3210,15 +1403,9 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, · 2 unmodified lines
3210 skipped = *lenp - left;1403 skipped = *lenp - left;
3211 }1404 }
3212 1405
3213 p = kbuf = memdup_user_nul(buffer, left);
3214 if (IS_ERR(kbuf))
3215 return PTR_ERR(kbuf);
3216
3217 tmp_bitmap = bitmap_zalloc(bitmap_len, GFP_KERNEL);1406 tmp_bitmap = bitmap_zalloc(bitmap_len, GFP_KERNEL);
3218 if (!tmp_bitmap) {1407 if (!tmp_bitmap)
3219 kfree(kbuf);
3220 return -ENOMEM;1408 return -ENOMEM;
3221 }
3222 proc_skip_char(&p, &left, '\n');1409 proc_skip_char(&p, &left, '\n');
3223 while (!err && left) {1410 while (!err && left) {
3224 unsigned long val_a, val_b;1411 unsigned long val_a, val_b;
@@ -3282,7 +1469,6 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, · 57 unmodified lines
3282 first = 0;1469 first = 0;
3283 proc_skip_char(&p, &left, '\n');1470 proc_skip_char(&p, &left, '\n');
3284 }1471 }
3285 kfree(kbuf);
3286 left += skipped;1472 left += skipped;
3287 } else {1473 } else {
3288 unsigned long bit_a, bit_b = 0;1474 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
3294 bit_b = find_next_zero_bit(bitmap, bitmap_len,1480 bit_b = find_next_zero_bit(bitmap, bitmap_len,
3295 bit_a + 1) - 1;1481 bit_a + 1) - 1;
3296 1482
3297 if (!first) {1483 if (!first)
3298 err = proc_put_char(&buffer, &left, ',');1484 proc_put_char(&buffer, &left, ',');
3299 if (err)1485 proc_put_long(&buffer, &left, bit_a, false);
3300 break;
3301 }
3302 err = proc_put_long(&buffer, &left, bit_a, false);
3303 if (err)
3304 break;
3305 if (bit_a != bit_b) {1486 if (bit_a != bit_b) {
3306 err = proc_put_char(&buffer, &left, '-');1487 proc_put_char(&buffer, &left, '-');
3307 if (err)1488 proc_put_long(&buffer, &left, bit_b, false);
3308 break;
3309 err = proc_put_long(&buffer, &left, bit_b, false);
3310 if (err)
3311 break;
3312 }1489 }
3313 1490
3314 first = 0; bit_b++;1491 first = 0; bit_b++;
3315 }1492 }
3316 if (!err)1493 proc_put_char(&buffer, &left, '\n');
3317 err = proc_put_char(&buffer, &left, '\n');
3318 }1494 }
3319 1495
3320 if (!err) {1496 if (!err) {
@@ -3328,113 +1504,1804 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, · 7 unmodified lines
3328 *ppos += *lenp;1504 *ppos += *lenp;
3329 }1505 }
3330 1506
3331 bitmap_free(tmp_bitmap);1507 bitmap_free(tmp_bitmap);
3332 return err;1508 return err;
1509}
1510
1511#else /* CONFIG_PROC_SYSCTL */
1512
1513int proc_dostring(struct ctl_table *table, int write,
1514 void *buffer, size_t *lenp, loff_t *ppos)
1515{
1516 return -ENOSYS;
1517}
1518
1519int proc_dointvec(struct ctl_table *table, int write,
1520 void *buffer, size_t *lenp, loff_t *ppos)
1521{
1522 return -ENOSYS;
1523}
1524
1525int proc_douintvec(struct ctl_table *table, int write,
1526 void *buffer, size_t *lenp, loff_t *ppos)
1527{
1528 return -ENOSYS;
1529}
1530
1531int proc_dointvec_minmax(struct ctl_table *table, int write,
1532 void *buffer, size_t *lenp, loff_t *ppos)
1533{
1534 return -ENOSYS;
3333}1535}
3334 1536
3335#else /* CONFIG_PROC_SYSCTL */1537int proc_douintvec_minmax(struct ctl_table *table, int write,
1538 void *buffer, size_t *lenp, loff_t *ppos)
1539{
1540 return -ENOSYS;
1541}
3336 1542
3337int proc_dostring(struct ctl_table *table, int write,1543int proc_dointvec_jiffies(struct ctl_table *table, int write,
3338 void __user *buffer, size_t *lenp, loff_t *ppos)1544 void *buffer, size_t *lenp, loff_t *ppos)
3339{1545{
3340 return -ENOSYS;1546 return -ENOSYS;
3341}1547}
3342 1548
3343int proc_dointvec(struct ctl_table *table, int write,1549int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
3344 void __user *buffer, size_t *lenp, loff_t *ppos)1550 void *buffer, size_t *lenp, loff_t *ppos)
3345{1551{
3346 return -ENOSYS;1552 return -ENOSYS;
3347}1553}
3348 1554
3349int proc_douintvec(struct ctl_table *table, int write,1555int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
3350 void __user *buffer, size_t *lenp, loff_t *ppos)1556 void *buffer, size_t *lenp, loff_t *ppos)
3351{1557{
3352 return -ENOSYS;1558 return -ENOSYS;
3353}1559}
3354 1560
3355int proc_dointvec_minmax(struct ctl_table *table, int write,1561int proc_doulongvec_minmax(struct ctl_table *table, int write,
3356 void __user *buffer, size_t *lenp, loff_t *ppos)1562 void *buffer, size_t *lenp, loff_t *ppos)
3357{1563{
3358 return -ENOSYS;1564 return -ENOSYS;
3359}1565}
3360 1566
3361int proc_douintvec_minmax(struct ctl_table *table, int write,1567int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
3362 void __user *buffer, size_t *lenp, loff_t *ppos)1568 void *buffer, size_t *lenp, loff_t *ppos)
1569{
1570 return -ENOSYS;
1571}
1572
1573int proc_do_large_bitmap(struct ctl_table *table, int write,
1574 void *buffer, size_t *lenp, loff_t *ppos)
3363{1575{
3364 return -ENOSYS;1576 return -ENOSYS;
3365}1577}
3366 1578
3367int proc_dointvec_jiffies(struct ctl_table *table, int write,1579#endif /* CONFIG_PROC_SYSCTL */
3368 void __user *buffer, size_t *lenp, loff_t *ppos)1580
3369{1581#if defined(CONFIG_SYSCTL)
3370 return -ENOSYS;1582int proc_do_static_key(struct ctl_table *table, int write,
3371}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
1612static 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};
3372 2579
3373int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,2580static struct ctl_table vm_table[] = {
3374 void __user *buffer, size_t *lenp, loff_t *ppos)2581 {
3375{2582 .procname = "overcommit_memory",
3376 return -ENOSYS;2583 .data = &sysctl_overcommit_memory,
3377}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 },
3378 2784
3379int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,2785#endif /* CONFIG_COMPACTION */
3380 void __user *buffer, size_t *lenp, loff_t *ppos)2786 {
3381{2787 .procname = "min_free_kbytes",
3382 return -ENOSYS;2788 .data = &min_free_kbytes,
3383}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};
3384 3030
3385int proc_doulongvec_minmax(struct ctl_table *table, int write,3031static struct ctl_table fs_table[] = {
3386 void __user *buffer, size_t *lenp, loff_t *ppos)3032 {
3387{3033 .procname = "inode-nr",
3388 return -ENOSYS;3034 .data = &inodes_stat,
3389}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};
3390 3238
3391int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,3239static struct ctl_table debug_table[] = {
3392 void __user *buffer,3240#ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
3393 size_t *lenp, loff_t *ppos)3241 {
3394{3242 .procname = "exception-trace",
3395 return -ENOSYS;3243 .data = &show_unhandled_signals,
3396}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};
3397 3262
3398int proc_do_large_bitmap(struct ctl_table *table, int write,3263static struct ctl_table dev_table[] = {
3399 void __user *buffer, size_t *lenp, loff_t *ppos)3264 { }
3400{3265};
3401 return -ENOSYS;
3402}
3403 3266
3404#endif /* CONFIG_PROC_SYSCTL */3267static 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};
3405 3295
3406#if defined(CONFIG_SYSCTL)3296int __init sysctl_init(void)
3407int proc_do_static_key(struct ctl_table *table, int write,
3408 void __user *buffer, size_t *lenp,
3409 loff_t *ppos)
3410{3297{
3411 struct static_key *key = (struct static_key *)table->data;3298 struct ctl_table_header *hdr;
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;
3424 3299
3425 mutex_lock(&static_key_mutex);3300 hdr = register_sysctl_table(sysctl_base_table);
3426 val = static_key_enabled(key);3301 kmemleak_not_leak(hdr);
3427 ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);3302 return 0;
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;
3436}3303}
3437#endif3304#endif /* CONFIG_SYSCTL */
3438/*3305/*
3439 * No sense putting this after each symbol definition, twice,3306 * No sense putting this after each symbol definition, twice,
3440 * exception granted :-)3307 * exception granted :-)
kernel/time/timer.c+1−2
@@ -249,8 +249,7 @@ void timers_update_nohz(void) · 248 unmodified lines
249}249}
250 250
251int timer_migration_handler(struct ctl_table *table, int write,251int timer_migration_handler(struct ctl_table *table, int write,
252 void __user *buffer, size_t *lenp,252 void *buffer, size_t *lenp, loff_t *ppos)
253 loff_t *ppos)
254{253{
255 int ret;254 int ret;
256 255
kernel/trace/trace.c+1−1
@@ -2661,7 +2661,7 @@ static void output_printk(struct trace_event_buffer *fbuffer) · 2660 unmodified lines
2661}2661}
2662 2662
2663int tracepoint_printk_sysctl(struct ctl_table *table, int write,2663int tracepoint_printk_sysctl(struct ctl_table *table, int write,
2664 void __user *buffer, size_t *lenp,2664 void *buffer, size_t *lenp,
2665 loff_t *ppos)2665 loff_t *ppos)
2666{2666{
2667 int save_tracepoint_printk;2667 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
630EXPORT_SYMBOL(call_usermodehelper);630EXPORT_SYMBOL(call_usermodehelper);
631 631
632static int proc_cap_handler(struct ctl_table *table, int write,632static 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)
634{634{
635 struct ctl_table t;635 struct ctl_table t;
636 unsigned long cap_array[_KERNEL_CAPABILITY_U32S];636 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
30 * to observe. Should this be in kernel/sys.c ????30 * to observe. Should this be in kernel/sys.c ????
31 */31 */
32static int proc_do_uts_string(struct ctl_table *table, int write,32static 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)
34{34{
35 struct ctl_table uts_table;35 struct ctl_table uts_table;
36 int r;36 int r;
kernel/watchdog.c+6−6
@@ -661,7 +661,7 @@ static void proc_watchdog_update(void) · 660 unmodified lines
661 * proc_soft_watchdog | soft_watchdog_user_enabled | SOFT_WATCHDOG_ENABLED661 * proc_soft_watchdog | soft_watchdog_user_enabled | SOFT_WATCHDOG_ENABLED
662 */662 */
663static int proc_watchdog_common(int which, struct ctl_table *table, int write,663static 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)
665{665{
666 int err, old, *param = table->data;666 int err, old, *param = table->data;
667 667
@@ -688,7 +688,7 @@ static int proc_watchdog_common(int which, struct ctl_table *table, int write, · 20 unmodified lines
688 * /proc/sys/kernel/watchdog688 * /proc/sys/kernel/watchdog
689 */689 */
690int proc_watchdog(struct ctl_table *table, int write,690int 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)
692{692{
693 return proc_watchdog_common(NMI_WATCHDOG_ENABLED|SOFT_WATCHDOG_ENABLED,693 return proc_watchdog_common(NMI_WATCHDOG_ENABLED|SOFT_WATCHDOG_ENABLED,
694 table, write, buffer, lenp, ppos);694 table, write, buffer, lenp, ppos);
@@ -698,7 +698,7 @@ int proc_watchdog(struct ctl_table *table, int write, · 3 unmodified lines
698 * /proc/sys/kernel/nmi_watchdog698 * /proc/sys/kernel/nmi_watchdog
699 */699 */
700int proc_nmi_watchdog(struct ctl_table *table, int write,700int 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)
702{702{
703 if (!nmi_watchdog_available && write)703 if (!nmi_watchdog_available && write)
704 return -ENOTSUPP;704 return -ENOTSUPP;
@@ -710,7 +710,7 @@ int proc_nmi_watchdog(struct ctl_table *table, int write, · 5 unmodified lines
710 * /proc/sys/kernel/soft_watchdog710 * /proc/sys/kernel/soft_watchdog
711 */711 */
712int proc_soft_watchdog(struct ctl_table *table, int write,712int 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)
714{714{
715 return proc_watchdog_common(SOFT_WATCHDOG_ENABLED,715 return proc_watchdog_common(SOFT_WATCHDOG_ENABLED,
716 table, write, buffer, lenp, ppos);716 table, write, buffer, lenp, ppos);
@@ -720,7 +720,7 @@ int proc_soft_watchdog(struct ctl_table *table, int write, · 3 unmodified lines
720 * /proc/sys/kernel/watchdog_thresh720 * /proc/sys/kernel/watchdog_thresh
721 */721 */
722int proc_watchdog_thresh(struct ctl_table *table, int write,722int 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)
724{724{
725 int err, old;725 int err, old;
726 726
@@ -743,7 +743,7 @@ int proc_watchdog_thresh(struct ctl_table *table, int write, · 16 unmodified lines
743 * been brought online, if desired.743 * been brought online, if desired.
744 */744 */
745int proc_watchdog_cpumask(struct ctl_table *table, int write,745int 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)
747{747{
748 int err;748 int err;
749 749
mm/compaction.c+1−1
@@ -2463,7 +2463,7 @@ int sysctl_compact_memory; · 2462 unmodified lines
2463 * /proc/sys/vm/compact_memory2463 * /proc/sys/vm/compact_memory
2464 */2464 */
2465int sysctl_compaction_handler(struct ctl_table *table, int write,2465int 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)
2467{2467{
2468 if (write)2468 if (write)
2469 compact_nodes();2469 compact_nodes();
mm/hugetlb.c+4−5
@@ -3352,7 +3352,7 @@ static unsigned int cpuset_mems_nr(unsigned int *array) · 3351 unmodified lines
3352#ifdef CONFIG_SYSCTL3352#ifdef CONFIG_SYSCTL
3353static int hugetlb_sysctl_handler_common(bool obey_mempolicy,3353static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
3354 struct ctl_table *table, int write,3354 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)
3356{3356{
3357 struct hstate *h = &default_hstate;3357 struct hstate *h = &default_hstate;
3358 unsigned long tmp = h->max_huge_pages;3358 unsigned long tmp = h->max_huge_pages;
@@ -3375,7 +3375,7 @@ out: · 16 unmodified lines
3375}3375}
3376 3376
3377int hugetlb_sysctl_handler(struct ctl_table *table, int write,3377int 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)
3379{3379{
3380 3380
3381 return hugetlb_sysctl_handler_common(false, table, write,3381 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
3384 3384
3385#ifdef CONFIG_NUMA3385#ifdef CONFIG_NUMA
3386int hugetlb_mempolicy_sysctl_handler(struct ctl_table *table, int write,3386int 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)
3388{3388{
3389 return hugetlb_sysctl_handler_common(true, table, write,3389 return hugetlb_sysctl_handler_common(true, table, write,
3390 buffer, length, ppos);3390 buffer, length, ppos);
@@ -3392,8 +3392,7 @@ int hugetlb_mempolicy_sysctl_handler(struct ctl_table *table, int write, · 1 unmodified line
3392#endif /* CONFIG_NUMA */3392#endif /* CONFIG_NUMA */
3393 3393
3394int hugetlb_overcommit_handler(struct ctl_table *table, int write,3394int hugetlb_overcommit_handler(struct ctl_table *table, int write,
3395 void __user *buffer,3395 void *buffer, size_t *length, loff_t *ppos)
3396 size_t *length, loff_t *ppos)
3397{3396{
3398 struct hstate *h = &default_hstate;3397 struct hstate *h = &default_hstate;
3399 unsigned long tmp;3398 unsigned long tmp;
mm/page-writeback.c+6−10
@@ -512,8 +512,7 @@ bool node_dirty_ok(struct pglist_data *pgdat) · 511 unmodified lines
512}512}
513 513
514int dirty_background_ratio_handler(struct ctl_table *table, int write,514int dirty_background_ratio_handler(struct ctl_table *table, int write,
515 void __user *buffer, size_t *lenp,515 void *buffer, size_t *lenp, loff_t *ppos)
516 loff_t *ppos)
517{516{
518 int ret;517 int ret;
519 518
@@ -524,8 +523,7 @@ int dirty_background_ratio_handler(struct ctl_table *table, int write, · 4 unmodified lines
524}523}
525 524
526int dirty_background_bytes_handler(struct ctl_table *table, int write,525int dirty_background_bytes_handler(struct ctl_table *table, int write,
527 void __user *buffer, size_t *lenp,526 void *buffer, size_t *lenp, loff_t *ppos)
528 loff_t *ppos)
529{527{
530 int ret;528 int ret;
531 529
@@ -535,9 +533,8 @@ int dirty_background_bytes_handler(struct ctl_table *table, int write, · 3 unmodified lines
535 return ret;533 return ret;
536}534}
537 535
538int dirty_ratio_handler(struct ctl_table *table, int write,536int dirty_ratio_handler(struct ctl_table *table, int write, void *buffer,
539 void __user *buffer, size_t *lenp,537 size_t *lenp, loff_t *ppos)
540 loff_t *ppos)
541{538{
542 int old_ratio = vm_dirty_ratio;539 int old_ratio = vm_dirty_ratio;
543 int ret;540 int ret;
@@ -551,8 +548,7 @@ int dirty_ratio_handler(struct ctl_table *table, int write, · 7 unmodified lines
551}548}
552 549
553int dirty_bytes_handler(struct ctl_table *table, int write,550int dirty_bytes_handler(struct ctl_table *table, int write,
554 void __user *buffer, size_t *lenp,551 void *buffer, size_t *lenp, loff_t *ppos)
555 loff_t *ppos)
556{552{
557 unsigned long old_bytes = vm_dirty_bytes;553 unsigned long old_bytes = vm_dirty_bytes;
558 int ret;554 int ret;
@@ -1972,7 +1968,7 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb) · 1413 unmodified lines
1972 * sysctl handler for /proc/sys/vm/dirty_writeback_centisecs1968 * sysctl handler for /proc/sys/vm/dirty_writeback_centisecs
1973 */1969 */
1974int dirty_writeback_centisecs_handler(struct ctl_table *table, int write,1970int 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)
1976{1972{
1977 unsigned int old_interval = dirty_writeback_interval;1973 unsigned int old_interval = dirty_writeback_interval;
1978 int ret;1974 int ret;
mm/page_alloc.c+10−32
@@ -5546,21 +5546,11 @@ char numa_zonelist_order[] = "Node"; · 5545 unmodified lines
5546 * sysctl handler for numa_zonelist_order5546 * sysctl handler for numa_zonelist_order
5547 */5547 */
5548int numa_zonelist_order_handler(struct ctl_table *table, int write,5548int numa_zonelist_order_handler(struct ctl_table *table, int write,
5549 void __user *buffer, size_t *length,5549 void *buffer, size_t *length, loff_t *ppos)
5550 loff_t *ppos)
5551{5550{
5552 char *str;5551 if (write)
5553 int ret;5552 return __parse_numa_zonelist_order(buffer);
5554 5553 return proc_dostring(table, write, buffer, length, ppos);
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;
5564}5554}
5565 5555
5566 5556
@@ -7963,7 +7953,7 @@ core_initcall(init_per_zone_wmark_min) · 2396 unmodified lines
7963 * changes.7953 * changes.
7964 */7954 */
7965int min_free_kbytes_sysctl_handler(struct ctl_table *table, int write,7955int 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)
7967{7957{
7968 int rc;7958 int rc;
7969 7959
@@ -7978,20 +7968,8 @@ int min_free_kbytes_sysctl_handler(struct ctl_table *table, int write, · 8 unmodified lines
7978 return 0;7968 return 0;
7979}7969}
7980 7970
7981int 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
7993int watermark_scale_factor_sysctl_handler(struct ctl_table *table, int write,7971int 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)
7995{7973{
7996 int rc;7974 int rc;
7997 7975
@@ -8021,7 +7999,7 @@ static void setup_min_unmapped_ratio(void) · 23 unmodified lines
8021 7999
8022 8000
8023int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *table, int write,8001int 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)
8025{8003{
8026 int rc;8004 int rc;
8027 8005
@@ -8048,7 +8026,7 @@ static void setup_min_slab_ratio(void) · 20 unmodified lines
8048}8026}
8049 8027
8050int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *table, int write,8028int 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)
8052{8030{
8053 int rc;8031 int rc;
8054 8032
@@ -8072,7 +8050,7 @@ int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *table, int write, · 17 unmodified lines
8072 * if in function of the boot time zone sizes.8050 * if in function of the boot time zone sizes.
8073 */8051 */
8074int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *table, int write,8052int 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)
8076{8054{
8077 proc_dointvec_minmax(table, write, buffer, length, ppos);8055 proc_dointvec_minmax(table, write, buffer, length, ppos);
8078 setup_per_zone_lowmem_reserve();8056 setup_per_zone_lowmem_reserve();
@@ -8094,7 +8072,7 @@ static void __zone_pcp_update(struct zone *zone) · 15 unmodified lines
8094 * pagelist can have before it gets flushed back to buddy allocator.8072 * pagelist can have before it gets flushed back to buddy allocator.
8095 */8073 */
8096int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *table, int write,8074int 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)
8098{8076{
8099 struct zone *zone;8077 struct zone *zone;
8100 int old_percpu_pagelist_fraction;8078 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
717unsigned long sysctl_user_reserve_kbytes __read_mostly = 1UL << 17; /* 128MB */717unsigned long sysctl_user_reserve_kbytes __read_mostly = 1UL << 17; /* 128MB */
718unsigned long sysctl_admin_reserve_kbytes __read_mostly = 1UL << 13; /* 8MB */718unsigned long sysctl_admin_reserve_kbytes __read_mostly = 1UL << 13; /* 8MB */
719 719
720int overcommit_ratio_handler(struct ctl_table *table, int write,720int overcommit_ratio_handler(struct ctl_table *table, int write, void *buffer,
721 void __user *buffer, size_t *lenp,721 size_t *lenp, loff_t *ppos)
722 loff_t *ppos)
723{722{
724 int ret;723 int ret;
725 724
@@ -729,9 +728,8 @@ int overcommit_ratio_handler(struct ctl_table *table, int write, · 3 unmodified lines
729 return ret;728 return ret;
730}729}
731 730
732int overcommit_kbytes_handler(struct ctl_table *table, int write,731int overcommit_kbytes_handler(struct ctl_table *table, int write, void *buffer,
733 void __user *buffer, size_t *lenp,732 size_t *lenp, loff_t *ppos)
734 loff_t *ppos)
735{733{
736 int ret;734 int ret;
737 735
mm/vmstat.c+2−2
@@ -76,7 +76,7 @@ static void invalid_numa_statistics(void) · 75 unmodified lines
76static DEFINE_MUTEX(vm_numa_stat_lock);76static DEFINE_MUTEX(vm_numa_stat_lock);
77 77
78int sysctl_vm_numa_stat_handler(struct ctl_table *table, int write,78int 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)
80{80{
81 int ret, oldval;81 int ret, oldval;
82 82
@@ -1751,7 +1751,7 @@ static void refresh_vm_stats(struct work_struct *work) · 1668 unmodified lines
1751}1751}
1752 1752
1753int vmstat_refresh(struct ctl_table *table, int write,1753int 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)
1755{1755{
1756 long val;1756 long val;
1757 int err;1757 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
1027#ifdef CONFIG_SYSCTL1027#ifdef CONFIG_SYSCTL
1028static1028static
1029int brnf_sysctl_call_tables(struct ctl_table *ctl, int write,1029int 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)
1031{1031{
1032 int ret;1032 int ret;
1033 1033
net/core/neighbour.c+13−15
@@ -3379,7 +3379,7 @@ EXPORT_SYMBOL(neigh_app_ns); · 3378 unmodified lines
3379static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN);3379static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN);
3380 3380
3381static int proc_unres_qlen(struct ctl_table *ctl, int write,3381static 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)
3383{3383{
3384 int size, ret;3384 int size, ret;
3385 struct ctl_table tmp = *ctl;3385 struct ctl_table tmp = *ctl;
@@ -3443,8 +3443,8 @@ static void neigh_proc_update(struct ctl_table *ctl, int write) · 57 unmodified lines
3443}3443}
3444 3444
3445static int neigh_proc_dointvec_zero_intmax(struct ctl_table *ctl, int write,3445static int neigh_proc_dointvec_zero_intmax(struct ctl_table *ctl, int write,
3446 void __user *buffer,3446 void *buffer, size_t *lenp,
3447 size_t *lenp, loff_t *ppos)3447 loff_t *ppos)
3448{3448{
3449 struct ctl_table tmp = *ctl;3449 struct ctl_table tmp = *ctl;
3450 int ret;3450 int ret;
@@ -3457,8 +3457,8 @@ static int neigh_proc_dointvec_zero_intmax(struct ctl_table *ctl, int write, · 6 unmodified lines
3457 return ret;3457 return ret;
3458}3458}
3459 3459
3460int neigh_proc_dointvec(struct ctl_table *ctl, int write,3460int neigh_proc_dointvec(struct ctl_table *ctl, int write, void *buffer,
3461 void __user *buffer, size_t *lenp, loff_t *ppos)3461 size_t *lenp, loff_t *ppos)
3462{3462{
3463 int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);3463 int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
3464 3464
@@ -3467,8 +3467,7 @@ int neigh_proc_dointvec(struct ctl_table *ctl, int write, · 2 unmodified lines
3467}3467}
3468EXPORT_SYMBOL(neigh_proc_dointvec);3468EXPORT_SYMBOL(neigh_proc_dointvec);
3469 3469
3470int neigh_proc_dointvec_jiffies(struct ctl_table *ctl, int write,3470int neigh_proc_dointvec_jiffies(struct ctl_table *ctl, int write, void *buffer,
3471 void __user *buffer,
3472 size_t *lenp, loff_t *ppos)3471 size_t *lenp, loff_t *ppos)
3473{3472{
3474 int ret = proc_dointvec_jiffies(ctl, write, buffer, lenp, ppos);3473 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
3479EXPORT_SYMBOL(neigh_proc_dointvec_jiffies);3478EXPORT_SYMBOL(neigh_proc_dointvec_jiffies);
3480 3479
3481static int neigh_proc_dointvec_userhz_jiffies(struct ctl_table *ctl, int write,3480static int neigh_proc_dointvec_userhz_jiffies(struct ctl_table *ctl, int write,
3482 void __user *buffer,3481 void *buffer, size_t *lenp,
3483 size_t *lenp, loff_t *ppos)3482 loff_t *ppos)
3484{3483{
3485 int ret = proc_dointvec_userhz_jiffies(ctl, write, buffer, lenp, ppos);3484 int ret = proc_dointvec_userhz_jiffies(ctl, write, buffer, lenp, ppos);
3486 3485
@@ -3489,8 +3488,7 @@ static int neigh_proc_dointvec_userhz_jiffies(struct ctl_table *ctl, int write, · 2 unmodified lines
3489}3488}
3490 3489
3491int neigh_proc_dointvec_ms_jiffies(struct ctl_table *ctl, int write,3490int neigh_proc_dointvec_ms_jiffies(struct ctl_table *ctl, int write,
3492 void __user *buffer,3491 void *buffer, size_t *lenp, loff_t *ppos)
3493 size_t *lenp, loff_t *ppos)
3494{3492{
3495 int ret = proc_dointvec_ms_jiffies(ctl, write, buffer, lenp, ppos);3493 int ret = proc_dointvec_ms_jiffies(ctl, write, buffer, lenp, ppos);
3496 3494
@@ -3500,8 +3498,8 @@ int neigh_proc_dointvec_ms_jiffies(struct ctl_table *ctl, int write, · 3 unmodified lines
3500EXPORT_SYMBOL(neigh_proc_dointvec_ms_jiffies);3498EXPORT_SYMBOL(neigh_proc_dointvec_ms_jiffies);
3501 3499
3502static int neigh_proc_dointvec_unres_qlen(struct ctl_table *ctl, int write,3500static int neigh_proc_dointvec_unres_qlen(struct ctl_table *ctl, int write,
3503 void __user *buffer,3501 void *buffer, size_t *lenp,
3504 size_t *lenp, loff_t *ppos)3502 loff_t *ppos)
3505{3503{
3506 int ret = proc_unres_qlen(ctl, write, buffer, lenp, ppos);3504 int ret = proc_unres_qlen(ctl, write, buffer, lenp, ppos);
3507 3505
@@ -3510,8 +3508,8 @@ static int neigh_proc_dointvec_unres_qlen(struct ctl_table *ctl, int write, · 2 unmodified lines
3510}3508}
3511 3509
3512static int neigh_proc_base_reachable_time(struct ctl_table *ctl, int write,3510static int neigh_proc_base_reachable_time(struct ctl_table *ctl, int write,
3513 void __user *buffer,3511 void *buffer, size_t *lenp,
3514 size_t *lenp, loff_t *ppos)3512 loff_t *ppos)
3515{3513{
3516 struct neigh_parms *p = ctl->extra2;3514 struct neigh_parms *p = ctl->extra2;
3517 int ret;3515 int ret;
net/core/sysctl_net_core.c+10−17
@@ -45,7 +45,7 @@ EXPORT_SYMBOL(sysctl_devconf_inherit_init_net); · 44 unmodified lines
45 45
46#ifdef CONFIG_RPS46#ifdef CONFIG_RPS
47static int rps_sock_flow_sysctl(struct ctl_table *table, int write,47static 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)
49{49{
50 unsigned int orig_size, size;50 unsigned int orig_size, size;
51 int ret, i;51 int ret, i;
@@ -115,8 +115,7 @@ static int rps_sock_flow_sysctl(struct ctl_table *table, int write, · 63 unmodified lines
115static DEFINE_MUTEX(flow_limit_update_mutex);115static DEFINE_MUTEX(flow_limit_update_mutex);
116 116
117static int flow_limit_cpu_sysctl(struct ctl_table *table, int write,117static int flow_limit_cpu_sysctl(struct ctl_table *table, int write,
118 void __user *buffer, size_t *lenp,118 void *buffer, size_t *lenp, loff_t *ppos)
119 loff_t *ppos)
120{119{
121 struct sd_flow_limit *cur;120 struct sd_flow_limit *cur;
122 struct softnet_data *sd;121 struct softnet_data *sd;
@@ -180,10 +179,7 @@ write_unlock: · 57 unmodified lines
180 }179 }
181 if (len < *lenp)180 if (len < *lenp)
182 kbuf[len++] = '\n';181 kbuf[len++] = '\n';
183 if (copy_to_user(buffer, kbuf, len)) {182 memcpy(buffer, kbuf, len);
184 ret = -EFAULT;
185 goto done;
186 }
187 *lenp = len;183 *lenp = len;
188 *ppos += len;184 *ppos += len;
189 }185 }
@@ -194,8 +190,7 @@ done: · 4 unmodified lines
194}190}
195 191
196static int flow_limit_table_len_sysctl(struct ctl_table *table, int write,192static int flow_limit_table_len_sysctl(struct ctl_table *table, int write,
197 void __user *buffer, size_t *lenp,193 void *buffer, size_t *lenp, loff_t *ppos)
198 loff_t *ppos)
199{194{
200 unsigned int old, *ptr;195 unsigned int old, *ptr;
201 int ret;196 int ret;
@@ -217,7 +212,7 @@ static int flow_limit_table_len_sysctl(struct ctl_table *table, int write, · 15 unmodified lines
217 212
218#ifdef CONFIG_NET_SCHED213#ifdef CONFIG_NET_SCHED
219static int set_default_qdisc(struct ctl_table *table, int write,214static 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)
221{216{
222 char id[IFNAMSIZ];217 char id[IFNAMSIZ];
223 struct ctl_table tbl = {218 struct ctl_table tbl = {
@@ -236,7 +231,7 @@ static int set_default_qdisc(struct ctl_table *table, int write, · 12 unmodified lines
236#endif231#endif
237 232
238static int proc_do_dev_weight(struct ctl_table *table, int write,233static 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)
240{235{
241 int ret;236 int ret;
242 237
@@ -251,7 +246,7 @@ static int proc_do_dev_weight(struct ctl_table *table, int write, · 8 unmodified lines
251}246}
252 247
253static int proc_do_rss_key(struct ctl_table *table, int write,248static 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)
255{250{
256 struct ctl_table fake_table;251 struct ctl_table fake_table;
257 char buf[NETDEV_RSS_KEY_LEN * 3];252 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
264 259
265#ifdef CONFIG_BPF_JIT260#ifdef CONFIG_BPF_JIT
266static int proc_dointvec_minmax_bpf_enable(struct ctl_table *table, int write,261static 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,
268 loff_t *ppos)263 loff_t *ppos)
269{264{
270 int ret, jit_enable = *(int *)table->data;265 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
291# ifdef CONFIG_HAVE_EBPF_JIT286# ifdef CONFIG_HAVE_EBPF_JIT
292static int287static int
293proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write,288proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write,
294 void __user *buffer, size_t *lenp,289 void *buffer, size_t *lenp, loff_t *ppos)
295 loff_t *ppos)
296{290{
297 if (!capable(CAP_SYS_ADMIN))291 if (!capable(CAP_SYS_ADMIN))
298 return -EPERM;292 return -EPERM;
@@ -303,8 +297,7 @@ proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write, · 4 unmodified lines
303 297
304static int298static int
305proc_dolongvec_minmax_bpf_restricted(struct ctl_table *table, int write,299proc_dolongvec_minmax_bpf_restricted(struct ctl_table *table, int write,
306 void __user *buffer, size_t *lenp,300 void *buffer, size_t *lenp, loff_t *ppos)
307 loff_t *ppos)
308{301{
309 if (!capable(CAP_SYS_ADMIN))302 if (!capable(CAP_SYS_ADMIN))
310 return -EPERM;303 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
160static int min_priority[1];160static int min_priority[1];
161static int max_priority[] = { 127 }; /* From DECnet spec */161static int max_priority[] = { 127 }; /* From DECnet spec */
162 162
163static int dn_forwarding_proc(struct ctl_table *, int,163static int dn_forwarding_proc(struct ctl_table *, int, void *, size_t *,
164 void __user *, size_t *, loff_t *);164 loff_t *);
165static struct dn_dev_sysctl_table {165static struct dn_dev_sysctl_table {
166 struct ctl_table_header *sysctl_header;166 struct ctl_table_header *sysctl_header;
167 struct ctl_table dn_dev_vars[5];167 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
245}245}
246 246
247static int dn_forwarding_proc(struct ctl_table *table, int write,247static int dn_forwarding_proc(struct ctl_table *table, int write,
248 void __user *buffer,248 void *buffer, size_t *lenp, loff_t *ppos)
249 size_t *lenp, loff_t *ppos)
250{249{
251#ifdef CONFIG_DECNET_ROUTER250#ifdef CONFIG_DECNET_ROUTER
252 struct net_device *dev = table->extra1;251 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
134}134}
135 135
136static int dn_node_address_handler(struct ctl_table *table, int write,136static int dn_node_address_handler(struct ctl_table *table, int write,
137 void __user *buffer,137 void *buffer, size_t *lenp, loff_t *ppos)
138 size_t *lenp, loff_t *ppos)
139{138{
140 char addr[DN_ASCBUF_LEN];139 char addr[DN_ASCBUF_LEN];
141 size_t len;140 size_t len;
@@ -148,10 +147,7 @@ static int dn_node_address_handler(struct ctl_table *table, int write, · 6 unmodified lines
148 147
149 if (write) {148 if (write) {
150 len = (*lenp < DN_ASCBUF_LEN) ? *lenp : (DN_ASCBUF_LEN-1);149 len = (*lenp < DN_ASCBUF_LEN) ? *lenp : (DN_ASCBUF_LEN-1);
151 150 memcpy(addr, buffer, len);
152 if (copy_from_user(addr, buffer, len))
153 return -EFAULT;
154
155 addr[len] = 0;151 addr[len] = 0;
156 strip_it(addr);152 strip_it(addr);
157 153
@@ -173,11 +169,9 @@ static int dn_node_address_handler(struct ctl_table *table, int write, · 15 unmodified lines
173 len = strlen(addr);169 len = strlen(addr);
174 addr[len++] = '\n';170 addr[len++] = '\n';
175 171
176 if (len > *lenp) len = *lenp;172 if (len > *lenp)
177 173 len = *lenp;
178 if (copy_to_user(buffer, addr, len))174 memcpy(buffer, addr, len);
179 return -EFAULT;
180
181 *lenp = len;175 *lenp = len;
182 *ppos += len;176 *ppos += len;
183 177
@@ -185,8 +179,7 @@ static int dn_node_address_handler(struct ctl_table *table, int write, · 1 unmodified line
185}179}
186 180
187static int dn_def_dev_handler(struct ctl_table *table, int write,181static int dn_def_dev_handler(struct ctl_table *table, int write,
188 void __user *buffer,182 void *buffer, size_t *lenp, loff_t *ppos)
189 size_t *lenp, loff_t *ppos)
190{183{
191 size_t len;184 size_t len;
192 struct net_device *dev;185 struct net_device *dev;
@@ -201,9 +194,7 @@ static int dn_def_dev_handler(struct ctl_table *table, int write, · 8 unmodified lines
201 if (*lenp > 16)194 if (*lenp > 16)
202 return -E2BIG;195 return -E2BIG;
203 196
204 if (copy_from_user(devname, buffer, *lenp))197 memcpy(devname, buffer, *lenp);
205 return -EFAULT;
206
207 devname[*lenp] = 0;198 devname[*lenp] = 0;
208 strip_it(devname);199 strip_it(devname);
209 200
@@ -238,9 +229,7 @@ static int dn_def_dev_handler(struct ctl_table *table, int write, · 28 unmodified lines
238 229
239 if (len > *lenp) len = *lenp;230 if (len > *lenp) len = *lenp;
240 231
241 if (copy_to_user(buffer, devname, len))232 memcpy(buffer, devname, len);
242 return -EFAULT;
243
244 *lenp = len;233 *lenp = len;
245 *ppos += len;234 *ppos += len;
246 235
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
2366}2366}
2367 2367
2368static int devinet_conf_proc(struct ctl_table *ctl, int write,2368static int devinet_conf_proc(struct ctl_table *ctl, int write,
2369 void __user *buffer,2369 void *buffer, size_t *lenp, loff_t *ppos)
2370 size_t *lenp, loff_t *ppos)
2371{2370{
2372 int old_value = *(int *)ctl->data;2371 int old_value = *(int *)ctl->data;
2373 int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);2372 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
2419}2418}
2420 2419
2421static int devinet_sysctl_forward(struct ctl_table *ctl, int write,2420static int devinet_sysctl_forward(struct ctl_table *ctl, int write,
2422 void __user *buffer,2421 void *buffer, size_t *lenp, loff_t *ppos)
2423 size_t *lenp, loff_t *ppos)
2424{2422{
2425 int *valp = ctl->data;2423 int *valp = ctl->data;
2426 int val = *valp;2424 int val = *valp;
@@ -2463,8 +2461,7 @@ static int devinet_sysctl_forward(struct ctl_table *ctl, int write, · 36 unmodified lines
2463}2461}
2464 2462
2465static int ipv4_doint_and_flush(struct ctl_table *ctl, int write,2463static int ipv4_doint_and_flush(struct ctl_table *ctl, int write,
2466 void __user *buffer,2464 void *buffer, size_t *lenp, loff_t *ppos)
2467 size_t *lenp, loff_t *ppos)
2468{2465{
2469 int *valp = ctl->data;2466 int *valp = ctl->data;
2470 int val = *valp;2467 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
3336static int ip_min_valid_pmtu __read_mostly = IPV4_MIN_MTU;3336static int ip_min_valid_pmtu __read_mostly = IPV4_MIN_MTU;
3337 3337
3338static int ipv4_sysctl_rtcache_flush(struct ctl_table *__ctl, int write,3338static int ipv4_sysctl_rtcache_flush(struct ctl_table *__ctl, int write,
3339 void __user *buffer,3339 void *buffer, size_t *lenp, loff_t *ppos)
3340 size_t *lenp, loff_t *ppos)
3341{3340{
3342 struct net *net = (struct net *)__ctl->extra1;3341 struct net *net = (struct net *)__ctl->extra1;
3343 3342
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
71 71
72/* Validate changes from /proc interface. */72/* Validate changes from /proc interface. */
73static int ipv4_local_port_range(struct ctl_table *table, int write,73static int ipv4_local_port_range(struct ctl_table *table, int write,
74 void __user *buffer,74 void *buffer, size_t *lenp, loff_t *ppos)
75 size_t *lenp, loff_t *ppos)
76{75{
77 struct net *net =76 struct net *net =
78 container_of(table->data, struct net, ipv4.ip_local_ports.range);77 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
107 106
108/* Validate changes from /proc interface. */107/* Validate changes from /proc interface. */
109static int ipv4_privileged_ports(struct ctl_table *table, int write,108static 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)
111{110{
112 struct net *net = container_of(table->data, struct net,111 struct net *net = container_of(table->data, struct net,
113 ipv4.sysctl_ip_prot_sock);112 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
168 167
169/* Validate changes from /proc interface. */168/* Validate changes from /proc interface. */
170static int ipv4_ping_group_range(struct ctl_table *table, int write,169static int ipv4_ping_group_range(struct ctl_table *table, int write,
171 void __user *buffer,170 void *buffer, size_t *lenp, loff_t *ppos)
172 size_t *lenp, loff_t *ppos)
173{171{
174 struct user_namespace *user_ns = current_user_ns();172 struct user_namespace *user_ns = current_user_ns();
175 int ret;173 int ret;
@@ -204,8 +202,7 @@ static int ipv4_ping_group_range(struct ctl_table *table, int write, · 28 unmodified lines
204}202}
205 203
206static int ipv4_fwd_update_priority(struct ctl_table *table, int write,204static int ipv4_fwd_update_priority(struct ctl_table *table, int write,
207 void __user *buffer,205 void *buffer, size_t *lenp, loff_t *ppos)
208 size_t *lenp, loff_t *ppos)
209{206{
210 struct net *net;207 struct net *net;
211 int ret;208 int ret;
@@ -221,7 +218,7 @@ static int ipv4_fwd_update_priority(struct ctl_table *table, int write, · 9 unmodified lines
221}218}
222 219
223static int proc_tcp_congestion_control(struct ctl_table *ctl, int write,220static 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)
225{222{
226 struct net *net = container_of(ctl->data, struct net,223 struct net *net = container_of(ctl->data, struct net,
227 ipv4.tcp_congestion_control);224 ipv4.tcp_congestion_control);
@@ -241,9 +238,8 @@ static int proc_tcp_congestion_control(struct ctl_table *ctl, int write, · 13 unmodified lines
241}238}
242 239
243static int proc_tcp_available_congestion_control(struct ctl_table *ctl,240static int proc_tcp_available_congestion_control(struct ctl_table *ctl,
244 int write,241 int write, void *buffer,
245 void __user *buffer, size_t *lenp,242 size_t *lenp, loff_t *ppos)
246 loff_t *ppos)
247{243{
248 struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX, };244 struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX, };
249 int ret;245 int ret;
@@ -258,9 +254,8 @@ static int proc_tcp_available_congestion_control(struct ctl_table *ctl, · 8 unmodified lines
258}254}
259 255
260static int proc_allowed_congestion_control(struct ctl_table *ctl,256static int proc_allowed_congestion_control(struct ctl_table *ctl,
261 int write,257 int write, void *buffer,
262 void __user *buffer, size_t *lenp,258 size_t *lenp, loff_t *ppos)
263 loff_t *ppos)
264{259{
265 struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX };260 struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX };
266 int ret;261 int ret;
@@ -296,8 +291,7 @@ static int sscanf_key(char *buf, __le32 *key) · 29 unmodified lines
296}291}
297 292
298static int proc_tcp_fastopen_key(struct ctl_table *table, int write,293static int proc_tcp_fastopen_key(struct ctl_table *table, int write,
299 void __user *buffer, size_t *lenp,294 void *buffer, size_t *lenp, loff_t *ppos)
300 loff_t *ppos)
301{295{
302 struct net *net = container_of(table->data, struct net,296 struct net *net = container_of(table->data, struct net,
303 ipv4.sysctl_tcp_fastopen);297 ipv4.sysctl_tcp_fastopen);
@@ -399,7 +393,7 @@ static void proc_configure_early_demux(int enabled, int protocol) · 95 unmodified lines
399}393}
400 394
401static int proc_tcp_early_demux(struct ctl_table *table, int write,395static 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)
403{397{
404 int ret = 0;398 int ret = 0;
405 399
@@ -415,7 +409,7 @@ static int proc_tcp_early_demux(struct ctl_table *table, int write, · 9 unmodified lines
415}409}
416 410
417static int proc_udp_early_demux(struct ctl_table *table, int write,411static 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)
419{413{
420 int ret = 0;414 int ret = 0;
421 415
@@ -431,8 +425,7 @@ static int proc_udp_early_demux(struct ctl_table *table, int write, · 9 unmodified lines
431}425}
432 426
433static int proc_tfo_blackhole_detect_timeout(struct ctl_table *table,427static int proc_tfo_blackhole_detect_timeout(struct ctl_table *table,
434 int write,428 int write, void *buffer,
435 void __user *buffer,
436 size_t *lenp, loff_t *ppos)429 size_t *lenp, loff_t *ppos)
437{430{
438 struct net *net = container_of(table->data, struct net,431 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
447}440}
448 441
449static int proc_tcp_available_ulp(struct ctl_table *ctl,442static int proc_tcp_available_ulp(struct ctl_table *ctl,
450 int write,443 int write, void *buffer, size_t *lenp,
451 void __user *buffer, size_t *lenp,
452 loff_t *ppos)444 loff_t *ppos)
453{445{
454 struct ctl_table tbl = { .maxlen = TCP_ULP_BUF_MAX, };446 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
466 458
467#ifdef CONFIG_IP_ROUTE_MULTIPATH459#ifdef CONFIG_IP_ROUTE_MULTIPATH
468static int proc_fib_multipath_hash_policy(struct ctl_table *table, int write,460static 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,
470 loff_t *ppos)462 loff_t *ppos)
471{463{
472 struct net *net = container_of(table->data, struct net,464 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
6095 6095
6096#ifdef CONFIG_SYSCTL6096#ifdef CONFIG_SYSCTL
6097 6097
6098static6098static int addrconf_sysctl_forward(struct ctl_table *ctl, int write,
6099int addrconf_sysctl_forward(struct ctl_table *ctl, int write,6099 void *buffer, size_t *lenp, loff_t *ppos)
6100 void __user *buffer, size_t *lenp, loff_t *ppos)
6101{6100{
6102 int *valp = ctl->data;6101 int *valp = ctl->data;
6103 int val = *valp;6102 int val = *valp;
@@ -6121,9 +6120,8 @@ int addrconf_sysctl_forward(struct ctl_table *ctl, int write, · 17 unmodified lines
6121 return ret;6120 return ret;
6122}6121}
6123 6122
6124static6123static int addrconf_sysctl_mtu(struct ctl_table *ctl, int write,
6125int addrconf_sysctl_mtu(struct ctl_table *ctl, int write,6124 void *buffer, size_t *lenp, loff_t *ppos)
6126 void __user *buffer, size_t *lenp, loff_t *ppos)
6127{6125{
6128 struct inet6_dev *idev = ctl->extra1;6126 struct inet6_dev *idev = ctl->extra1;
6129 int min_mtu = IPV6_MIN_MTU;6127 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
6193 return 0;6191 return 0;
6194}6192}
6195 6193
6196static6194static int addrconf_sysctl_disable(struct ctl_table *ctl, int write,
6197int addrconf_sysctl_disable(struct ctl_table *ctl, int write,6195 void *buffer, size_t *lenp, loff_t *ppos)
6198 void __user *buffer, size_t *lenp, loff_t *ppos)
6199{6196{
6200 int *valp = ctl->data;6197 int *valp = ctl->data;
6201 int val = *valp;6198 int val = *valp;
@@ -6219,9 +6216,8 @@ int addrconf_sysctl_disable(struct ctl_table *ctl, int write, · 17 unmodified lines
6219 return ret;6216 return ret;
6220}6217}
6221 6218
6222static6219static int addrconf_sysctl_proxy_ndp(struct ctl_table *ctl, int write,
6223int addrconf_sysctl_proxy_ndp(struct ctl_table *ctl, int write,6220 void *buffer, size_t *lenp, loff_t *ppos)
6224 void __user *buffer, size_t *lenp, loff_t *ppos)
6225{6221{
6226 int *valp = ctl->data;6222 int *valp = ctl->data;
6227 int ret;6223 int ret;
@@ -6262,7 +6258,7 @@ int addrconf_sysctl_proxy_ndp(struct ctl_table *ctl, int write, · 34 unmodified lines
6262}6258}
6263 6259
6264static int addrconf_sysctl_addr_gen_mode(struct ctl_table *ctl, int write,6260static 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,
6266 loff_t *ppos)6262 loff_t *ppos)
6267{6263{
6268 int ret = 0;6264 int ret = 0;
@@ -6324,7 +6320,7 @@ out: · 55 unmodified lines
6324}6320}
6325 6321
6326static int addrconf_sysctl_stable_secret(struct ctl_table *ctl, int write,6322static int addrconf_sysctl_stable_secret(struct ctl_table *ctl, int write,
6327 void __user *buffer, size_t *lenp,6323 void *buffer, size_t *lenp,
6328 loff_t *ppos)6324 loff_t *ppos)
6329{6325{
6330 int err;6326 int err;
@@ -6391,8 +6387,7 @@ out: · 60 unmodified lines
6391 6387
6392static6388static
6393int addrconf_sysctl_ignore_routes_with_linkdown(struct ctl_table *ctl,6389int addrconf_sysctl_ignore_routes_with_linkdown(struct ctl_table *ctl,
6394 int write,6390 int write, void *buffer,
6395 void __user *buffer,
6396 size_t *lenp,6391 size_t *lenp,
6397 loff_t *ppos)6392 loff_t *ppos)
6398{6393{
@@ -6492,10 +6487,8 @@ int addrconf_disable_policy(struct ctl_table *ctl, int *valp, int val) · 93 unmodified lines
6492 return 0;6487 return 0;
6493}6488}
6494 6489
6495static6490static int addrconf_sysctl_disable_policy(struct ctl_table *ctl, int write,
6496int addrconf_sysctl_disable_policy(struct ctl_table *ctl, int write,6491 void *buffer, size_t *lenp, loff_t *ppos)
6497 void __user *buffer, size_t *lenp,
6498 loff_t *ppos)
6499{6492{
6500 int *valp = ctl->data;6493 int *valp = ctl->data;
6501 int val = *valp;6494 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
1835 }1835 }
1836}1836}
1837 1837
1838int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)1838int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, void *buffer,
1839 size_t *lenp, loff_t *ppos)
1839{1840{
1840 struct net_device *dev = ctl->extra1;1841 struct net_device *dev = ctl->extra1;
1841 struct inet6_dev *idev;1842 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
6088 6088
6089#ifdef CONFIG_SYSCTL6089#ifdef CONFIG_SYSCTL
6090 6090
6091static6091static int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write,
6092int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write,6092 void *buffer, size_t *lenp, loff_t *ppos)
6093 void __user *buffer, size_t *lenp, loff_t *ppos)
6094{6093{
6095 struct net *net;6094 struct net *net;
6096 int delay;6095 int delay;
net/ipv6/sysctl_net_ipv6.c+1−2
@@ -26,8 +26,7 @@ static int auto_flowlabels_min; · 25 unmodified lines
26static int auto_flowlabels_max = IP6_AUTO_FLOW_LABEL_MAX;26static int auto_flowlabels_max = IP6_AUTO_FLOW_LABEL_MAX;
27 27
28static int proc_rt6_multipath_hash_policy(struct ctl_table *table, int write,28static int proc_rt6_multipath_hash_policy(struct ctl_table *table, int write,
29 void __user *buffer, size_t *lenp,29 void *buffer, size_t *lenp, loff_t *ppos)
30 loff_t *ppos)
31{30{
32 struct net *net;31 struct net *net;
33 int ret;32 int ret;
net/mpls/af_mpls.c+2−3
@@ -1362,8 +1362,7 @@ done: · 1361 unmodified lines
1362 (&((struct mpls_dev *)0)->field)1362 (&((struct mpls_dev *)0)->field)
1363 1363
1364static int mpls_conf_proc(struct ctl_table *ctl, int write,1364static int mpls_conf_proc(struct ctl_table *ctl, int write,
1365 void __user *buffer,1365 void *buffer, size_t *lenp, loff_t *ppos)
1366 size_t *lenp, loff_t *ppos)
1367{1366{
1368 int oval = *(int *)ctl->data;1367 int oval = *(int *)ctl->data;
1369 int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);1368 int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
@@ -2594,7 +2593,7 @@ nolabels: · 1224 unmodified lines
2594}2593}
2595 2594
2596static int mpls_platform_labels(struct ctl_table *table, int write,2595static 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)
2598{2597{
2599 struct net *net = table->data;2598 struct net *net = table->data;
2600 int platform_labels = net->mpls.platform_labels;2599 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
1736 1736
1737static int1737static int
1738proc_do_defense_mode(struct ctl_table *table, int write,1738proc_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)
1740{1740{
1741 struct netns_ipvs *ipvs = table->extra2;1741 struct netns_ipvs *ipvs = table->extra2;
1742 int *valp = table->data;1742 int *valp = table->data;
@@ -1763,7 +1763,7 @@ proc_do_defense_mode(struct ctl_table *table, int write, · 20 unmodified lines
1763 1763
1764static int1764static int
1765proc_do_sync_threshold(struct ctl_table *table, int write,1765proc_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)
1767{1767{
1768 int *valp = table->data;1768 int *valp = table->data;
1769 int val[2];1769 int val[2];
@@ -1788,7 +1788,7 @@ proc_do_sync_threshold(struct ctl_table *table, int write, · 18 unmodified lines
1788 1788
1789static int1789static int
1790proc_do_sync_ports(struct ctl_table *table, int write,1790proc_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)
1792{1792{
1793 int *valp = table->data;1793 int *valp = table->data;
1794 int val = *valp;1794 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
517 517
518static int518static int
519nf_conntrack_hash_sysctl(struct ctl_table *table, int write,519nf_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)
521{521{
522 int ret;522 int ret;
523 523
net/netfilter/nf_log.c+1−1
@@ -414,7 +414,7 @@ static struct ctl_table nf_log_sysctl_ftable[] = { · 413 unmodified lines
414};414};
415 415
416static int nf_log_proc_dostring(struct ctl_table *table, int write,416static 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)
418{418{
419 const struct nf_logger *logger;419 const struct nf_logger *logger;
420 char buf[NFLOGGER_NAME_LEN];420 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
49}49}
50 50
51static int proc_local_port_range(struct ctl_table *table, int write,51static int proc_local_port_range(struct ctl_table *table, int write,
52 void __user *buffer,52 void *buffer, size_t *lenp, loff_t *ppos)
53 size_t *lenp, loff_t *ppos)
54{53{
55 int ret;54 int ret;
56 int range[2] = {local_port_range[0], local_port_range[1]};55 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
62static struct kmem_cache *rds_tcp_conn_slab;62static struct kmem_cache *rds_tcp_conn_slab;
63 63
64static int rds_tcp_skbuf_handler(struct ctl_table *ctl, int write,64static int rds_tcp_skbuf_handler(struct ctl_table *ctl, int write,
65 void __user *buffer, size_t *lenp,65 void *buffer, size_t *lenp, loff_t *fpos);
66 loff_t *fpos);
67 66
68static int rds_tcp_min_sndbuf = SOCK_MIN_SNDBUF;67static int rds_tcp_min_sndbuf = SOCK_MIN_SNDBUF;
69static int rds_tcp_min_rcvbuf = SOCK_MIN_RCVBUF;68static int rds_tcp_min_rcvbuf = SOCK_MIN_RCVBUF;
@@ -676,8 +675,7 @@ static void rds_tcp_sysctl_reset(struct net *net) · 606 unmodified lines
676}675}
677 676
678static int rds_tcp_skbuf_handler(struct ctl_table *ctl, int write,677static int rds_tcp_skbuf_handler(struct ctl_table *ctl, int write,
679 void __user *buffer, size_t *lenp,678 void *buffer, size_t *lenp, loff_t *fpos)
680 loff_t *fpos)
681{679{
682 struct net *net = current->nsproxy->net_ns;680 struct net *net = current->nsproxy->net_ns;
683 int err;681 int err;
net/sctp/sysctl.c+11−21
@@ -43,20 +43,15 @@ static unsigned long max_autoclose_max = · 42 unmodified lines
43 ? UINT_MAX : MAX_SCHEDULE_TIMEOUT / HZ;43 ? UINT_MAX : MAX_SCHEDULE_TIMEOUT / HZ;
44 44
45static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write,45static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write,
46 void __user *buffer, size_t *lenp,46 void *buffer, size_t *lenp, loff_t *ppos);
47 loff_t *ppos);
48static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write,47static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write,
49 void __user *buffer, size_t *lenp,48 void *buffer, size_t *lenp, loff_t *ppos);
50 loff_t *ppos);49static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, void *buffer,
51static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write,50 size_t *lenp, loff_t *ppos);
52 void __user *buffer, size_t *lenp,
53 loff_t *ppos);
54static int proc_sctp_do_alpha_beta(struct ctl_table *ctl, int write,51static int proc_sctp_do_alpha_beta(struct ctl_table *ctl, int write,
55 void __user *buffer, size_t *lenp,52 void *buffer, size_t *lenp, loff_t *ppos);
56 loff_t *ppos);
57static int proc_sctp_do_auth(struct ctl_table *ctl, int write,53static int proc_sctp_do_auth(struct ctl_table *ctl, int write,
58 void __user *buffer, size_t *lenp,54 void *buffer, size_t *lenp, loff_t *ppos);
59 loff_t *ppos);
60 55
61static struct ctl_table sctp_table[] = {56static struct ctl_table sctp_table[] = {
62 {57 {
@@ -343,8 +338,7 @@ static struct ctl_table sctp_net_table[] = { · 280 unmodified lines
343};338};
344 339
345static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write,340static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write,
346 void __user *buffer, size_t *lenp,341 void *buffer, size_t *lenp, loff_t *ppos)
347 loff_t *ppos)
348{342{
349 struct net *net = current->nsproxy->net_ns;343 struct net *net = current->nsproxy->net_ns;
350 struct ctl_table tbl;344 struct ctl_table tbl;
@@ -389,8 +383,7 @@ static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write, · 38 unmodified lines
389}383}
390 384
391static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write,385static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write,
392 void __user *buffer, size_t *lenp,386 void *buffer, size_t *lenp, loff_t *ppos)
393 loff_t *ppos)
394{387{
395 struct net *net = current->nsproxy->net_ns;388 struct net *net = current->nsproxy->net_ns;
396 unsigned int min = *(unsigned int *) ctl->extra1;389 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
418}411}
419 412
420static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write,413static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write,
421 void __user *buffer, size_t *lenp,414 void *buffer, size_t *lenp, loff_t *ppos)
422 loff_t *ppos)
423{415{
424 struct net *net = current->nsproxy->net_ns;416 struct net *net = current->nsproxy->net_ns;
425 unsigned int min = *(unsigned int *) ctl->extra1;417 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
447}439}
448 440
449static int proc_sctp_do_alpha_beta(struct ctl_table *ctl, int write,441static int proc_sctp_do_alpha_beta(struct ctl_table *ctl, int write,
450 void __user *buffer, size_t *lenp,442 void *buffer, size_t *lenp, loff_t *ppos)
451 loff_t *ppos)
452{443{
453 if (write)444 if (write)
454 pr_warn_once("Changing rto_alpha or rto_beta may lead to "445 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
458}449}
459 450
460static int proc_sctp_do_auth(struct ctl_table *ctl, int write,451static int proc_sctp_do_auth(struct ctl_table *ctl, int write,
461 void __user *buffer, size_t *lenp,452 void *buffer, size_t *lenp, loff_t *ppos)
462 loff_t *ppos)
463{453{
464 struct net *net = current->nsproxy->net_ns;454 struct net *net = current->nsproxy->net_ns;
465 struct ctl_table tbl;455 struct ctl_table tbl;
net/sunrpc/sysctl.c+13−16
@@ -60,7 +60,7 @@ rpc_unregister_sysctl(void) · 59 unmodified lines
60}60}
61 61
62static int proc_do_xprt(struct ctl_table *table, int write,62static 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)
64{64{
65 char tmpbuf[256];65 char tmpbuf[256];
66 size_t len;66 size_t len;
@@ -70,15 +70,15 @@ static int proc_do_xprt(struct ctl_table *table, int write, · 3 unmodified lines
70 return 0;70 return 0;
71 }71 }
72 len = svc_print_xprts(tmpbuf, sizeof(tmpbuf));72 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);
74}74}
75 75
76static int76static int
77proc_dodebug(struct ctl_table *table, int write,77proc_dodebug(struct ctl_table *table, int write, void *buffer, size_t *lenp,
78 void __user *buffer, size_t *lenp, loff_t *ppos)78 loff_t *ppos)
79{79{
80 char tmpbuf[20], c, *s = NULL;80 char tmpbuf[20], *s = NULL;
81 char __user *p;81 char *p;
82 unsigned int value;82 unsigned int value;
83 size_t left, len;83 size_t left, len;
84 84
@@ -90,18 +90,17 @@ proc_dodebug(struct ctl_table *table, int write, · 5 unmodified lines
90 left = *lenp;90 left = *lenp;
91 91
92 if (write) {92 if (write) {
93 if (!access_ok(buffer, left))
94 return -EFAULT;
95 p = buffer;93 p = buffer;
96 while (left && __get_user(c, p) >= 0 && isspace(c))94 while (left && isspace(*p)) {
97 left--, p++;95 left--;
96 p++;
97 }
98 if (!left)98 if (!left)
99 goto done;99 goto done;
100 100
101 if (left > sizeof(tmpbuf) - 1)101 if (left > sizeof(tmpbuf) - 1)
102 return -EINVAL;102 return -EINVAL;
103 if (copy_from_user(tmpbuf, p, left))103 memcpy(tmpbuf, p, left);
104 return -EFAULT;
105 tmpbuf[left] = '\0';104 tmpbuf[left] = '\0';
106 105
107 value = simple_strtol(tmpbuf, &s, 0);106 value = simple_strtol(tmpbuf, &s, 0);
@@ -121,11 +120,9 @@ proc_dodebug(struct ctl_table *table, int write, · 13 unmodified lines
121 len = sprintf(tmpbuf, "0x%04x", *(unsigned int *) table->data);120 len = sprintf(tmpbuf, "0x%04x", *(unsigned int *) table->data);
122 if (len > left)121 if (len > left)
123 len = left;122 len = left;
124 if (copy_to_user(buffer, tmpbuf, len))123 memcpy(buffer, tmpbuf, len);
125 return -EFAULT;
126 if ((left -= len) > 0) {124 if ((left -= len) > 0) {
127 if (put_user('\n', (char __user *)buffer + len))125 *((char *)buffer + len) = '\n';
128 return -EFAULT;
129 left--;126 left--;
130 }127 }
131 }128 }
net/sunrpc/xprtrdma/svc_rdma.c+3−4
@@ -80,8 +80,7 @@ atomic_t rdma_stat_sq_prod; · 79 unmodified lines
80 * current value.80 * current value.
81 */81 */
82static int read_reset_stat(struct ctl_table *table, int write,82static int read_reset_stat(struct ctl_table *table, int write,
83 void __user *buffer, size_t *lenp,83 void *buffer, size_t *lenp, loff_t *ppos)
84 loff_t *ppos)
85{84{
86 atomic_t *stat = (atomic_t *)table->data;85 atomic_t *stat = (atomic_t *)table->data;
87 86
@@ -103,8 +102,8 @@ static int read_reset_stat(struct ctl_table *table, int write, · 15 unmodified lines
103 len -= *ppos;102 len -= *ppos;
104 if (len > *lenp)103 if (len > *lenp)
105 len = *lenp;104 len = *lenp;
106 if (len && copy_to_user(buffer, str_buf, len))105 if (len)
107 return -EFAULT;106 memcpy(buffer, str_buf, len);
108 *lenp = len;107 *lenp = len;
109 *ppos += len;108 *ppos += len;
110 }109 }
security/apparmor/lsm.c+1−1
@@ -1696,7 +1696,7 @@ static int __init alloc_buffers(void) · 1695 unmodified lines
1696 1696
1697#ifdef CONFIG_SYSCTL1697#ifdef CONFIG_SYSCTL
1698static int apparmor_dointvec(struct ctl_table *table, int write,1698static 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)
1700{1700{
1701 if (!policy_admin_capable(NULL))1701 if (!policy_admin_capable(NULL))
1702 return -EPERM;1702 return -EPERM;
security/min_addr.c+1−1
@@ -30,7 +30,7 @@ static void update_mmap_min_addr(void) · 29 unmodified lines
30 * calls update_mmap_min_addr() so non MAP_FIXED hints get rounded properly30 * calls update_mmap_min_addr() so non MAP_FIXED hints get rounded properly
31 */31 */
32int mmap_min_addr_handler(struct ctl_table *table, int write,32int 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)
34{34{
35 int ret;35 int ret;
36 36
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
430 430
431#ifdef CONFIG_SYSCTL431#ifdef CONFIG_SYSCTL
432static int yama_dointvec_minmax(struct ctl_table *table, int write,432static 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)
434{434{
435 struct ctl_table table_copy;435 struct ctl_table table_copy;
436 436

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