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