aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sysctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r--kernel/sysctl.c147
1 files changed, 121 insertions, 26 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index c5ef44ff850f..58be76017fd0 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -27,6 +27,7 @@
27#include <linux/security.h> 27#include <linux/security.h>
28#include <linux/ctype.h> 28#include <linux/ctype.h>
29#include <linux/utsname.h> 29#include <linux/utsname.h>
30#include <linux/kmemcheck.h>
30#include <linux/smp_lock.h> 31#include <linux/smp_lock.h>
31#include <linux/fs.h> 32#include <linux/fs.h>
32#include <linux/init.h> 33#include <linux/init.h>
@@ -48,6 +49,9 @@
48#include <linux/acpi.h> 49#include <linux/acpi.h>
49#include <linux/reboot.h> 50#include <linux/reboot.h>
50#include <linux/ftrace.h> 51#include <linux/ftrace.h>
52#include <linux/security.h>
53#include <linux/slow-work.h>
54#include <linux/perf_counter.h>
51 55
52#include <asm/uaccess.h> 56#include <asm/uaccess.h>
53#include <asm/processor.h> 57#include <asm/processor.h>
@@ -95,15 +99,15 @@ static int sixty = 60;
95static int neg_one = -1; 99static int neg_one = -1;
96#endif 100#endif
97 101
98#if defined(CONFIG_MMU) && defined(CONFIG_FILE_LOCKING)
99static int two = 2;
100#endif
101
102static int zero; 102static int zero;
103static int one = 1; 103static int __maybe_unused one = 1;
104static int __maybe_unused two = 2;
104static unsigned long one_ul = 1; 105static unsigned long one_ul = 1;
105static int one_hundred = 100; 106static int one_hundred = 100;
106 107
108/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
109static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
110
107/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ 111/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
108static int maxolduid = 65535; 112static int maxolduid = 65535;
109static int minolduid; 113static int minolduid;
@@ -113,6 +117,7 @@ static int ngroups_max = NGROUPS_MAX;
113 117
114#ifdef CONFIG_MODULES 118#ifdef CONFIG_MODULES
115extern char modprobe_path[]; 119extern char modprobe_path[];
120extern int modules_disabled;
116#endif 121#endif
117#ifdef CONFIG_CHR_DEV_SG 122#ifdef CONFIG_CHR_DEV_SG
118extern int sg_big_buff; 123extern int sg_big_buff;
@@ -325,6 +330,17 @@ static struct ctl_table kern_table[] = {
325 .mode = 0644, 330 .mode = 0644,
326 .proc_handler = &proc_dointvec, 331 .proc_handler = &proc_dointvec,
327 }, 332 },
333 {
334 .ctl_name = CTL_UNNUMBERED,
335 .procname = "timer_migration",
336 .data = &sysctl_timer_migration,
337 .maxlen = sizeof(unsigned int),
338 .mode = 0644,
339 .proc_handler = &proc_dointvec_minmax,
340 .strategy = &sysctl_intvec,
341 .extra1 = &zero,
342 .extra2 = &one,
343 },
328#endif 344#endif
329 { 345 {
330 .ctl_name = CTL_UNNUMBERED, 346 .ctl_name = CTL_UNNUMBERED,
@@ -533,6 +549,17 @@ static struct ctl_table kern_table[] = {
533 .proc_handler = &proc_dostring, 549 .proc_handler = &proc_dostring,
534 .strategy = &sysctl_string, 550 .strategy = &sysctl_string,
535 }, 551 },
552 {
553 .ctl_name = CTL_UNNUMBERED,
554 .procname = "modules_disabled",
555 .data = &modules_disabled,
556 .maxlen = sizeof(int),
557 .mode = 0644,
558 /* only handle a transition from default "0" to "1" */
559 .proc_handler = &proc_dointvec_minmax,
560 .extra1 = &one,
561 .extra2 = &one,
562 },
536#endif 563#endif
537#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) 564#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
538 { 565 {
@@ -721,6 +748,14 @@ static struct ctl_table kern_table[] = {
721 .proc_handler = &proc_dointvec, 748 .proc_handler = &proc_dointvec,
722 }, 749 },
723 { 750 {
751 .ctl_name = CTL_UNNUMBERED,
752 .procname = "panic_on_io_nmi",
753 .data = &panic_on_io_nmi,
754 .maxlen = sizeof(int),
755 .mode = 0644,
756 .proc_handler = &proc_dointvec,
757 },
758 {
724 .ctl_name = KERN_BOOTLOADER_TYPE, 759 .ctl_name = KERN_BOOTLOADER_TYPE,
725 .procname = "bootloader_type", 760 .procname = "bootloader_type",
726 .data = &bootloader_type, 761 .data = &bootloader_type,
@@ -730,6 +765,14 @@ static struct ctl_table kern_table[] = {
730 }, 765 },
731 { 766 {
732 .ctl_name = CTL_UNNUMBERED, 767 .ctl_name = CTL_UNNUMBERED,
768 .procname = "bootloader_version",
769 .data = &bootloader_version,
770 .maxlen = sizeof (int),
771 .mode = 0444,
772 .proc_handler = &proc_dointvec,
773 },
774 {
775 .ctl_name = CTL_UNNUMBERED,
733 .procname = "kstack_depth_to_print", 776 .procname = "kstack_depth_to_print",
734 .data = &kstack_depth_to_print, 777 .data = &kstack_depth_to_print,
735 .maxlen = sizeof(int), 778 .maxlen = sizeof(int),
@@ -815,6 +858,19 @@ static struct ctl_table kern_table[] = {
815 .extra1 = &neg_one, 858 .extra1 = &neg_one,
816 .extra2 = &sixty, 859 .extra2 = &sixty,
817 }, 860 },
861#endif
862#ifdef CONFIG_DETECT_HUNG_TASK
863 {
864 .ctl_name = CTL_UNNUMBERED,
865 .procname = "hung_task_panic",
866 .data = &sysctl_hung_task_panic,
867 .maxlen = sizeof(int),
868 .mode = 0644,
869 .proc_handler = &proc_dointvec_minmax,
870 .strategy = &sysctl_intvec,
871 .extra1 = &zero,
872 .extra2 = &one,
873 },
818 { 874 {
819 .ctl_name = CTL_UNNUMBERED, 875 .ctl_name = CTL_UNNUMBERED,
820 .procname = "hung_task_check_count", 876 .procname = "hung_task_check_count",
@@ -830,7 +886,7 @@ static struct ctl_table kern_table[] = {
830 .data = &sysctl_hung_task_timeout_secs, 886 .data = &sysctl_hung_task_timeout_secs,
831 .maxlen = sizeof(unsigned long), 887 .maxlen = sizeof(unsigned long),
832 .mode = 0644, 888 .mode = 0644,
833 .proc_handler = &proc_doulongvec_minmax, 889 .proc_handler = &proc_dohung_task_timeout_secs,
834 .strategy = &sysctl_intvec, 890 .strategy = &sysctl_intvec,
835 }, 891 },
836 { 892 {
@@ -890,16 +946,51 @@ static struct ctl_table kern_table[] = {
890 .proc_handler = &proc_dointvec, 946 .proc_handler = &proc_dointvec,
891 }, 947 },
892#endif 948#endif
893#ifdef CONFIG_UNEVICTABLE_LRU 949#ifdef CONFIG_SLOW_WORK
894 { 950 {
895 .ctl_name = CTL_UNNUMBERED, 951 .ctl_name = CTL_UNNUMBERED,
896 .procname = "scan_unevictable_pages", 952 .procname = "slow-work",
897 .data = &scan_unevictable_pages, 953 .mode = 0555,
898 .maxlen = sizeof(scan_unevictable_pages), 954 .child = slow_work_sysctls,
955 },
956#endif
957#ifdef CONFIG_PERF_COUNTERS
958 {
959 .ctl_name = CTL_UNNUMBERED,
960 .procname = "perf_counter_paranoid",
961 .data = &sysctl_perf_counter_paranoid,
962 .maxlen = sizeof(sysctl_perf_counter_paranoid),
899 .mode = 0644, 963 .mode = 0644,
900 .proc_handler = &scan_unevictable_handler, 964 .proc_handler = &proc_dointvec,
965 },
966 {
967 .ctl_name = CTL_UNNUMBERED,
968 .procname = "perf_counter_mlock_kb",
969 .data = &sysctl_perf_counter_mlock,
970 .maxlen = sizeof(sysctl_perf_counter_mlock),
971 .mode = 0644,
972 .proc_handler = &proc_dointvec,
973 },
974 {
975 .ctl_name = CTL_UNNUMBERED,
976 .procname = "perf_counter_max_sample_rate",
977 .data = &sysctl_perf_counter_sample_rate,
978 .maxlen = sizeof(sysctl_perf_counter_sample_rate),
979 .mode = 0644,
980 .proc_handler = &proc_dointvec,
981 },
982#endif
983#ifdef CONFIG_KMEMCHECK
984 {
985 .ctl_name = CTL_UNNUMBERED,
986 .procname = "kmemcheck",
987 .data = &kmemcheck_enabled,
988 .maxlen = sizeof(int),
989 .mode = 0644,
990 .proc_handler = &proc_dointvec,
901 }, 991 },
902#endif 992#endif
993
903/* 994/*
904 * NOTE: do not add new entries to this table unless you have read 995 * NOTE: do not add new entries to this table unless you have read
905 * Documentation/sysctl/ctl_unnumbered.txt 996 * Documentation/sysctl/ctl_unnumbered.txt
@@ -996,7 +1087,7 @@ static struct ctl_table vm_table[] = {
996 .mode = 0644, 1087 .mode = 0644,
997 .proc_handler = &dirty_bytes_handler, 1088 .proc_handler = &dirty_bytes_handler,
998 .strategy = &sysctl_intvec, 1089 .strategy = &sysctl_intvec,
999 .extra1 = &one_ul, 1090 .extra1 = &dirty_bytes_min,
1000 }, 1091 },
1001 { 1092 {
1002 .procname = "dirty_writeback_centisecs", 1093 .procname = "dirty_writeback_centisecs",
@@ -1010,7 +1101,7 @@ static struct ctl_table vm_table[] = {
1010 .data = &dirty_expire_interval, 1101 .data = &dirty_expire_interval,
1011 .maxlen = sizeof(dirty_expire_interval), 1102 .maxlen = sizeof(dirty_expire_interval),
1012 .mode = 0644, 1103 .mode = 0644,
1013 .proc_handler = &proc_dointvec_userhz_jiffies, 1104 .proc_handler = &proc_dointvec,
1014 }, 1105 },
1015 { 1106 {
1016 .ctl_name = VM_NR_PDFLUSH_THREADS, 1107 .ctl_name = VM_NR_PDFLUSH_THREADS,
@@ -1213,16 +1304,14 @@ static struct ctl_table vm_table[] = {
1213 .strategy = &sysctl_jiffies, 1304 .strategy = &sysctl_jiffies,
1214 }, 1305 },
1215#endif 1306#endif
1216#ifdef CONFIG_SECURITY
1217 { 1307 {
1218 .ctl_name = CTL_UNNUMBERED, 1308 .ctl_name = CTL_UNNUMBERED,
1219 .procname = "mmap_min_addr", 1309 .procname = "mmap_min_addr",
1220 .data = &mmap_min_addr, 1310 .data = &dac_mmap_min_addr,
1221 .maxlen = sizeof(unsigned long), 1311 .maxlen = sizeof(unsigned long),
1222 .mode = 0644, 1312 .mode = 0644,
1223 .proc_handler = &proc_doulongvec_minmax, 1313 .proc_handler = &mmap_min_addr_handler,
1224 }, 1314 },
1225#endif
1226#ifdef CONFIG_NUMA 1315#ifdef CONFIG_NUMA
1227 { 1316 {
1228 .ctl_name = CTL_UNNUMBERED, 1317 .ctl_name = CTL_UNNUMBERED,
@@ -1260,6 +1349,14 @@ static struct ctl_table vm_table[] = {
1260 .extra2 = &one, 1349 .extra2 = &one,
1261 }, 1350 },
1262#endif 1351#endif
1352 {
1353 .ctl_name = CTL_UNNUMBERED,
1354 .procname = "scan_unevictable_pages",
1355 .data = &scan_unevictable_pages,
1356 .maxlen = sizeof(scan_unevictable_pages),
1357 .mode = 0644,
1358 .proc_handler = &scan_unevictable_handler,
1359 },
1263/* 1360/*
1264 * NOTE: do not add new entries to this table unless you have read 1361 * NOTE: do not add new entries to this table unless you have read
1265 * Documentation/sysctl/ctl_unnumbered.txt 1362 * Documentation/sysctl/ctl_unnumbered.txt
@@ -1373,10 +1470,7 @@ static struct ctl_table fs_table[] = {
1373 .data = &lease_break_time, 1470 .data = &lease_break_time,
1374 .maxlen = sizeof(int), 1471 .maxlen = sizeof(int),
1375 .mode = 0644, 1472 .mode = 0644,
1376 .proc_handler = &proc_dointvec_minmax, 1473 .proc_handler = &proc_dointvec,
1377 .strategy = &sysctl_intvec,
1378 .extra1 = &zero,
1379 .extra2 = &two,
1380 }, 1474 },
1381#endif 1475#endif
1382#ifdef CONFIG_AIO 1476#ifdef CONFIG_AIO
@@ -1417,7 +1511,10 @@ static struct ctl_table fs_table[] = {
1417 .data = &suid_dumpable, 1511 .data = &suid_dumpable,
1418 .maxlen = sizeof(int), 1512 .maxlen = sizeof(int),
1419 .mode = 0644, 1513 .mode = 0644,
1420 .proc_handler = &proc_dointvec, 1514 .proc_handler = &proc_dointvec_minmax,
1515 .strategy = &sysctl_intvec,
1516 .extra1 = &zero,
1517 .extra2 = &two,
1421 }, 1518 },
1422#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) 1519#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1423 { 1520 {
@@ -2198,7 +2295,7 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2198 void *data) 2295 void *data)
2199{ 2296{
2200#define TMPBUFLEN 21 2297#define TMPBUFLEN 21
2201 int *i, vleft, first=1, neg, val; 2298 int *i, vleft, first = 1, neg;
2202 unsigned long lval; 2299 unsigned long lval;
2203 size_t left, len; 2300 size_t left, len;
2204 2301
@@ -2251,8 +2348,6 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2251 len = p-buf; 2348 len = p-buf;
2252 if ((len < left) && *p && !isspace(*p)) 2349 if ((len < left) && *p && !isspace(*p))
2253 break; 2350 break;
2254 if (neg)
2255 val = -val;
2256 s += len; 2351 s += len;
2257 left -= len; 2352 left -= len;
2258 2353