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