diff options
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r-- | kernel/sysctl.c | 188 |
1 files changed, 111 insertions, 77 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 3a45c224770f..f175d98bd355 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/sysctl.h> | 25 | #include <linux/sysctl.h> |
26 | #include <linux/signal.h> | 26 | #include <linux/signal.h> |
27 | #include <linux/printk.h> | ||
27 | #include <linux/proc_fs.h> | 28 | #include <linux/proc_fs.h> |
28 | #include <linux/security.h> | 29 | #include <linux/security.h> |
29 | #include <linux/ctype.h> | 30 | #include <linux/ctype.h> |
@@ -55,6 +56,7 @@ | |||
55 | #include <linux/kprobes.h> | 56 | #include <linux/kprobes.h> |
56 | #include <linux/pipe_fs_i.h> | 57 | #include <linux/pipe_fs_i.h> |
57 | #include <linux/oom.h> | 58 | #include <linux/oom.h> |
59 | #include <linux/kmod.h> | ||
58 | 60 | ||
59 | #include <asm/uaccess.h> | 61 | #include <asm/uaccess.h> |
60 | #include <asm/processor.h> | 62 | #include <asm/processor.h> |
@@ -116,6 +118,7 @@ static int neg_one = -1; | |||
116 | static int zero; | 118 | static int zero; |
117 | static int __maybe_unused one = 1; | 119 | static int __maybe_unused one = 1; |
118 | static int __maybe_unused two = 2; | 120 | static int __maybe_unused two = 2; |
121 | static int __maybe_unused three = 3; | ||
119 | static unsigned long one_ul = 1; | 122 | static unsigned long one_ul = 1; |
120 | static int one_hundred = 100; | 123 | static int one_hundred = 100; |
121 | #ifdef CONFIG_PRINTK | 124 | #ifdef CONFIG_PRINTK |
@@ -161,8 +164,6 @@ extern int no_unaligned_warning; | |||
161 | extern int unaligned_dump_stack; | 164 | extern int unaligned_dump_stack; |
162 | #endif | 165 | #endif |
163 | 166 | ||
164 | extern struct ratelimit_state printk_ratelimit_state; | ||
165 | |||
166 | #ifdef CONFIG_PROC_SYSCTL | 167 | #ifdef CONFIG_PROC_SYSCTL |
167 | static int proc_do_cad_pid(struct ctl_table *table, int write, | 168 | static int proc_do_cad_pid(struct ctl_table *table, int write, |
168 | void __user *buffer, size_t *lenp, loff_t *ppos); | 169 | void __user *buffer, size_t *lenp, loff_t *ppos); |
@@ -170,8 +171,14 @@ static int proc_taint(struct ctl_table *table, int write, | |||
170 | void __user *buffer, size_t *lenp, loff_t *ppos); | 171 | void __user *buffer, size_t *lenp, loff_t *ppos); |
171 | #endif | 172 | #endif |
172 | 173 | ||
174 | #ifdef CONFIG_PRINTK | ||
175 | static int proc_dmesg_restrict(struct ctl_table *table, int write, | ||
176 | void __user *buffer, size_t *lenp, loff_t *ppos); | ||
177 | #endif | ||
178 | |||
173 | #ifdef CONFIG_MAGIC_SYSRQ | 179 | #ifdef CONFIG_MAGIC_SYSRQ |
174 | static int __sysrq_enabled; /* Note: sysrq code ises it's own private copy */ | 180 | /* Note: sysrq code uses it's own private copy */ |
181 | static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE; | ||
175 | 182 | ||
176 | static int sysrq_sysctl_handler(ctl_table *table, int write, | 183 | static int sysrq_sysctl_handler(ctl_table *table, int write, |
177 | void __user *buffer, size_t *lenp, | 184 | void __user *buffer, size_t *lenp, |
@@ -194,9 +201,9 @@ static int sysrq_sysctl_handler(ctl_table *table, int write, | |||
194 | static struct ctl_table root_table[]; | 201 | static struct ctl_table root_table[]; |
195 | static struct ctl_table_root sysctl_table_root; | 202 | static struct ctl_table_root sysctl_table_root; |
196 | static struct ctl_table_header root_table_header = { | 203 | static struct ctl_table_header root_table_header = { |
197 | .count = 1, | 204 | {{.count = 1, |
198 | .ctl_table = root_table, | 205 | .ctl_table = root_table, |
199 | .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list), | 206 | .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),}}, |
200 | .root = &sysctl_table_root, | 207 | .root = &sysctl_table_root, |
201 | .set = &sysctl_table_root.default_set, | 208 | .set = &sysctl_table_root.default_set, |
202 | }; | 209 | }; |
@@ -247,10 +254,6 @@ static struct ctl_table root_table[] = { | |||
247 | .mode = 0555, | 254 | .mode = 0555, |
248 | .child = dev_table, | 255 | .child = dev_table, |
249 | }, | 256 | }, |
250 | /* | ||
251 | * NOTE: do not add new entries to this table unless you have read | ||
252 | * Documentation/sysctl/ctl_unnumbered.txt | ||
253 | */ | ||
254 | { } | 257 | { } |
255 | }; | 258 | }; |
256 | 259 | ||
@@ -261,8 +264,6 @@ static int min_wakeup_granularity_ns; /* 0 usecs */ | |||
261 | static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */ | 264 | static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */ |
262 | static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE; | 265 | static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE; |
263 | static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1; | 266 | static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1; |
264 | static int min_sched_shares_ratelimit = 100000; /* 100 usec */ | ||
265 | static int max_sched_shares_ratelimit = NSEC_PER_SEC; /* 1 second */ | ||
266 | #endif | 267 | #endif |
267 | 268 | ||
268 | #ifdef CONFIG_COMPACTION | 269 | #ifdef CONFIG_COMPACTION |
@@ -307,15 +308,6 @@ static struct ctl_table kern_table[] = { | |||
307 | .extra2 = &max_wakeup_granularity_ns, | 308 | .extra2 = &max_wakeup_granularity_ns, |
308 | }, | 309 | }, |
309 | { | 310 | { |
310 | .procname = "sched_shares_ratelimit", | ||
311 | .data = &sysctl_sched_shares_ratelimit, | ||
312 | .maxlen = sizeof(unsigned int), | ||
313 | .mode = 0644, | ||
314 | .proc_handler = sched_proc_update_handler, | ||
315 | .extra1 = &min_sched_shares_ratelimit, | ||
316 | .extra2 = &max_sched_shares_ratelimit, | ||
317 | }, | ||
318 | { | ||
319 | .procname = "sched_tunable_scaling", | 311 | .procname = "sched_tunable_scaling", |
320 | .data = &sysctl_sched_tunable_scaling, | 312 | .data = &sysctl_sched_tunable_scaling, |
321 | .maxlen = sizeof(enum sched_tunable_scaling), | 313 | .maxlen = sizeof(enum sched_tunable_scaling), |
@@ -325,14 +317,6 @@ static struct ctl_table kern_table[] = { | |||
325 | .extra2 = &max_sched_tunable_scaling, | 317 | .extra2 = &max_sched_tunable_scaling, |
326 | }, | 318 | }, |
327 | { | 319 | { |
328 | .procname = "sched_shares_thresh", | ||
329 | .data = &sysctl_sched_shares_thresh, | ||
330 | .maxlen = sizeof(unsigned int), | ||
331 | .mode = 0644, | ||
332 | .proc_handler = proc_dointvec_minmax, | ||
333 | .extra1 = &zero, | ||
334 | }, | ||
335 | { | ||
336 | .procname = "sched_migration_cost", | 320 | .procname = "sched_migration_cost", |
337 | .data = &sysctl_sched_migration_cost, | 321 | .data = &sysctl_sched_migration_cost, |
338 | .maxlen = sizeof(unsigned int), | 322 | .maxlen = sizeof(unsigned int), |
@@ -354,6 +338,13 @@ static struct ctl_table kern_table[] = { | |||
354 | .proc_handler = proc_dointvec, | 338 | .proc_handler = proc_dointvec, |
355 | }, | 339 | }, |
356 | { | 340 | { |
341 | .procname = "sched_shares_window", | ||
342 | .data = &sysctl_sched_shares_window, | ||
343 | .maxlen = sizeof(unsigned int), | ||
344 | .mode = 0644, | ||
345 | .proc_handler = proc_dointvec, | ||
346 | }, | ||
347 | { | ||
357 | .procname = "timer_migration", | 348 | .procname = "timer_migration", |
358 | .data = &sysctl_timer_migration, | 349 | .data = &sysctl_timer_migration, |
359 | .maxlen = sizeof(unsigned int), | 350 | .maxlen = sizeof(unsigned int), |
@@ -377,13 +368,17 @@ static struct ctl_table kern_table[] = { | |||
377 | .mode = 0644, | 368 | .mode = 0644, |
378 | .proc_handler = sched_rt_handler, | 369 | .proc_handler = sched_rt_handler, |
379 | }, | 370 | }, |
371 | #ifdef CONFIG_SCHED_AUTOGROUP | ||
380 | { | 372 | { |
381 | .procname = "sched_compat_yield", | 373 | .procname = "sched_autogroup_enabled", |
382 | .data = &sysctl_sched_compat_yield, | 374 | .data = &sysctl_sched_autogroup_enabled, |
383 | .maxlen = sizeof(unsigned int), | 375 | .maxlen = sizeof(unsigned int), |
384 | .mode = 0644, | 376 | .mode = 0644, |
385 | .proc_handler = proc_dointvec, | 377 | .proc_handler = proc_dointvec_minmax, |
378 | .extra1 = &zero, | ||
379 | .extra2 = &one, | ||
386 | }, | 380 | }, |
381 | #endif | ||
387 | #ifdef CONFIG_PROVE_LOCKING | 382 | #ifdef CONFIG_PROVE_LOCKING |
388 | { | 383 | { |
389 | .procname = "prove_locking", | 384 | .procname = "prove_locking", |
@@ -622,6 +617,11 @@ static struct ctl_table kern_table[] = { | |||
622 | .child = random_table, | 617 | .child = random_table, |
623 | }, | 618 | }, |
624 | { | 619 | { |
620 | .procname = "usermodehelper", | ||
621 | .mode = 0555, | ||
622 | .child = usermodehelper_table, | ||
623 | }, | ||
624 | { | ||
625 | .procname = "overflowuid", | 625 | .procname = "overflowuid", |
626 | .data = &overflowuid, | 626 | .data = &overflowuid, |
627 | .maxlen = sizeof(int), | 627 | .maxlen = sizeof(int), |
@@ -704,6 +704,24 @@ static struct ctl_table kern_table[] = { | |||
704 | .extra1 = &zero, | 704 | .extra1 = &zero, |
705 | .extra2 = &ten_thousand, | 705 | .extra2 = &ten_thousand, |
706 | }, | 706 | }, |
707 | { | ||
708 | .procname = "dmesg_restrict", | ||
709 | .data = &dmesg_restrict, | ||
710 | .maxlen = sizeof(int), | ||
711 | .mode = 0644, | ||
712 | .proc_handler = proc_dointvec_minmax, | ||
713 | .extra1 = &zero, | ||
714 | .extra2 = &one, | ||
715 | }, | ||
716 | { | ||
717 | .procname = "kptr_restrict", | ||
718 | .data = &kptr_restrict, | ||
719 | .maxlen = sizeof(int), | ||
720 | .mode = 0644, | ||
721 | .proc_handler = proc_dmesg_restrict, | ||
722 | .extra1 = &zero, | ||
723 | .extra2 = &two, | ||
724 | }, | ||
707 | #endif | 725 | #endif |
708 | { | 726 | { |
709 | .procname = "ngroups_max", | 727 | .procname = "ngroups_max", |
@@ -718,14 +736,16 @@ static struct ctl_table kern_table[] = { | |||
718 | .data = &watchdog_enabled, | 736 | .data = &watchdog_enabled, |
719 | .maxlen = sizeof (int), | 737 | .maxlen = sizeof (int), |
720 | .mode = 0644, | 738 | .mode = 0644, |
721 | .proc_handler = proc_dowatchdog_enabled, | 739 | .proc_handler = proc_dowatchdog, |
740 | .extra1 = &zero, | ||
741 | .extra2 = &one, | ||
722 | }, | 742 | }, |
723 | { | 743 | { |
724 | .procname = "watchdog_thresh", | 744 | .procname = "watchdog_thresh", |
725 | .data = &softlockup_thresh, | 745 | .data = &watchdog_thresh, |
726 | .maxlen = sizeof(int), | 746 | .maxlen = sizeof(int), |
727 | .mode = 0644, | 747 | .mode = 0644, |
728 | .proc_handler = proc_dowatchdog_thresh, | 748 | .proc_handler = proc_dowatchdog, |
729 | .extra1 = &neg_one, | 749 | .extra1 = &neg_one, |
730 | .extra2 = &sixty, | 750 | .extra2 = &sixty, |
731 | }, | 751 | }, |
@@ -738,21 +758,23 @@ static struct ctl_table kern_table[] = { | |||
738 | .extra1 = &zero, | 758 | .extra1 = &zero, |
739 | .extra2 = &one, | 759 | .extra2 = &one, |
740 | }, | 760 | }, |
741 | #endif | ||
742 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) && !defined(CONFIG_LOCKUP_DETECTOR) | ||
743 | { | 761 | { |
744 | .procname = "unknown_nmi_panic", | 762 | .procname = "nmi_watchdog", |
745 | .data = &unknown_nmi_panic, | 763 | .data = &watchdog_enabled, |
746 | .maxlen = sizeof (int), | 764 | .maxlen = sizeof (int), |
747 | .mode = 0644, | 765 | .mode = 0644, |
748 | .proc_handler = proc_dointvec, | 766 | .proc_handler = proc_dowatchdog, |
767 | .extra1 = &zero, | ||
768 | .extra2 = &one, | ||
749 | }, | 769 | }, |
770 | #endif | ||
771 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) | ||
750 | { | 772 | { |
751 | .procname = "nmi_watchdog", | 773 | .procname = "unknown_nmi_panic", |
752 | .data = &nmi_watchdog_enabled, | 774 | .data = &unknown_nmi_panic, |
753 | .maxlen = sizeof (int), | 775 | .maxlen = sizeof (int), |
754 | .mode = 0644, | 776 | .mode = 0644, |
755 | .proc_handler = proc_nmi_enabled, | 777 | .proc_handler = proc_dointvec, |
756 | }, | 778 | }, |
757 | #endif | 779 | #endif |
758 | #if defined(CONFIG_X86) | 780 | #if defined(CONFIG_X86) |
@@ -916,6 +938,12 @@ static struct ctl_table kern_table[] = { | |||
916 | }, | 938 | }, |
917 | #endif | 939 | #endif |
918 | #ifdef CONFIG_PERF_EVENTS | 940 | #ifdef CONFIG_PERF_EVENTS |
941 | /* | ||
942 | * User-space scripts rely on the existence of this file | ||
943 | * as a feature check for perf_events being enabled. | ||
944 | * | ||
945 | * So it's an ABI, do not remove! | ||
946 | */ | ||
919 | { | 947 | { |
920 | .procname = "perf_event_paranoid", | 948 | .procname = "perf_event_paranoid", |
921 | .data = &sysctl_perf_event_paranoid, | 949 | .data = &sysctl_perf_event_paranoid, |
@@ -935,7 +963,7 @@ static struct ctl_table kern_table[] = { | |||
935 | .data = &sysctl_perf_event_sample_rate, | 963 | .data = &sysctl_perf_event_sample_rate, |
936 | .maxlen = sizeof(sysctl_perf_event_sample_rate), | 964 | .maxlen = sizeof(sysctl_perf_event_sample_rate), |
937 | .mode = 0644, | 965 | .mode = 0644, |
938 | .proc_handler = proc_dointvec, | 966 | .proc_handler = perf_proc_update_handler, |
939 | }, | 967 | }, |
940 | #endif | 968 | #endif |
941 | #ifdef CONFIG_KMEMCHECK | 969 | #ifdef CONFIG_KMEMCHECK |
@@ -956,10 +984,6 @@ static struct ctl_table kern_table[] = { | |||
956 | .proc_handler = proc_dointvec, | 984 | .proc_handler = proc_dointvec, |
957 | }, | 985 | }, |
958 | #endif | 986 | #endif |
959 | /* | ||
960 | * NOTE: do not add new entries to this table unless you have read | ||
961 | * Documentation/sysctl/ctl_unnumbered.txt | ||
962 | */ | ||
963 | { } | 987 | { } |
964 | }; | 988 | }; |
965 | 989 | ||
@@ -969,14 +993,18 @@ static struct ctl_table vm_table[] = { | |||
969 | .data = &sysctl_overcommit_memory, | 993 | .data = &sysctl_overcommit_memory, |
970 | .maxlen = sizeof(sysctl_overcommit_memory), | 994 | .maxlen = sizeof(sysctl_overcommit_memory), |
971 | .mode = 0644, | 995 | .mode = 0644, |
972 | .proc_handler = proc_dointvec, | 996 | .proc_handler = proc_dointvec_minmax, |
997 | .extra1 = &zero, | ||
998 | .extra2 = &two, | ||
973 | }, | 999 | }, |
974 | { | 1000 | { |
975 | .procname = "panic_on_oom", | 1001 | .procname = "panic_on_oom", |
976 | .data = &sysctl_panic_on_oom, | 1002 | .data = &sysctl_panic_on_oom, |
977 | .maxlen = sizeof(sysctl_panic_on_oom), | 1003 | .maxlen = sizeof(sysctl_panic_on_oom), |
978 | .mode = 0644, | 1004 | .mode = 0644, |
979 | .proc_handler = proc_dointvec, | 1005 | .proc_handler = proc_dointvec_minmax, |
1006 | .extra1 = &zero, | ||
1007 | .extra2 = &two, | ||
980 | }, | 1008 | }, |
981 | { | 1009 | { |
982 | .procname = "oom_kill_allocating_task", | 1010 | .procname = "oom_kill_allocating_task", |
@@ -1004,7 +1032,8 @@ static struct ctl_table vm_table[] = { | |||
1004 | .data = &page_cluster, | 1032 | .data = &page_cluster, |
1005 | .maxlen = sizeof(int), | 1033 | .maxlen = sizeof(int), |
1006 | .mode = 0644, | 1034 | .mode = 0644, |
1007 | .proc_handler = proc_dointvec, | 1035 | .proc_handler = proc_dointvec_minmax, |
1036 | .extra1 = &zero, | ||
1008 | }, | 1037 | }, |
1009 | { | 1038 | { |
1010 | .procname = "dirty_background_ratio", | 1039 | .procname = "dirty_background_ratio", |
@@ -1052,7 +1081,8 @@ static struct ctl_table vm_table[] = { | |||
1052 | .data = &dirty_expire_interval, | 1081 | .data = &dirty_expire_interval, |
1053 | .maxlen = sizeof(dirty_expire_interval), | 1082 | .maxlen = sizeof(dirty_expire_interval), |
1054 | .mode = 0644, | 1083 | .mode = 0644, |
1055 | .proc_handler = proc_dointvec, | 1084 | .proc_handler = proc_dointvec_minmax, |
1085 | .extra1 = &zero, | ||
1056 | }, | 1086 | }, |
1057 | { | 1087 | { |
1058 | .procname = "nr_pdflush_threads", | 1088 | .procname = "nr_pdflush_threads", |
@@ -1128,6 +1158,8 @@ static struct ctl_table vm_table[] = { | |||
1128 | .maxlen = sizeof(int), | 1158 | .maxlen = sizeof(int), |
1129 | .mode = 0644, | 1159 | .mode = 0644, |
1130 | .proc_handler = drop_caches_sysctl_handler, | 1160 | .proc_handler = drop_caches_sysctl_handler, |
1161 | .extra1 = &one, | ||
1162 | .extra2 = &three, | ||
1131 | }, | 1163 | }, |
1132 | #ifdef CONFIG_COMPACTION | 1164 | #ifdef CONFIG_COMPACTION |
1133 | { | 1165 | { |
@@ -1320,11 +1352,6 @@ static struct ctl_table vm_table[] = { | |||
1320 | .extra2 = &one, | 1352 | .extra2 = &one, |
1321 | }, | 1353 | }, |
1322 | #endif | 1354 | #endif |
1323 | |||
1324 | /* | ||
1325 | * NOTE: do not add new entries to this table unless you have read | ||
1326 | * Documentation/sysctl/ctl_unnumbered.txt | ||
1327 | */ | ||
1328 | { } | 1355 | { } |
1329 | }; | 1356 | }; |
1330 | 1357 | ||
@@ -1340,28 +1367,28 @@ static struct ctl_table fs_table[] = { | |||
1340 | .data = &inodes_stat, | 1367 | .data = &inodes_stat, |
1341 | .maxlen = 2*sizeof(int), | 1368 | .maxlen = 2*sizeof(int), |
1342 | .mode = 0444, | 1369 | .mode = 0444, |
1343 | .proc_handler = proc_dointvec, | 1370 | .proc_handler = proc_nr_inodes, |
1344 | }, | 1371 | }, |
1345 | { | 1372 | { |
1346 | .procname = "inode-state", | 1373 | .procname = "inode-state", |
1347 | .data = &inodes_stat, | 1374 | .data = &inodes_stat, |
1348 | .maxlen = 7*sizeof(int), | 1375 | .maxlen = 7*sizeof(int), |
1349 | .mode = 0444, | 1376 | .mode = 0444, |
1350 | .proc_handler = proc_dointvec, | 1377 | .proc_handler = proc_nr_inodes, |
1351 | }, | 1378 | }, |
1352 | { | 1379 | { |
1353 | .procname = "file-nr", | 1380 | .procname = "file-nr", |
1354 | .data = &files_stat, | 1381 | .data = &files_stat, |
1355 | .maxlen = 3*sizeof(int), | 1382 | .maxlen = sizeof(files_stat), |
1356 | .mode = 0444, | 1383 | .mode = 0444, |
1357 | .proc_handler = proc_nr_files, | 1384 | .proc_handler = proc_nr_files, |
1358 | }, | 1385 | }, |
1359 | { | 1386 | { |
1360 | .procname = "file-max", | 1387 | .procname = "file-max", |
1361 | .data = &files_stat.max_files, | 1388 | .data = &files_stat.max_files, |
1362 | .maxlen = sizeof(int), | 1389 | .maxlen = sizeof(files_stat.max_files), |
1363 | .mode = 0644, | 1390 | .mode = 0644, |
1364 | .proc_handler = proc_dointvec, | 1391 | .proc_handler = proc_doulongvec_minmax, |
1365 | }, | 1392 | }, |
1366 | { | 1393 | { |
1367 | .procname = "nr_open", | 1394 | .procname = "nr_open", |
@@ -1377,7 +1404,7 @@ static struct ctl_table fs_table[] = { | |||
1377 | .data = &dentry_stat, | 1404 | .data = &dentry_stat, |
1378 | .maxlen = 6*sizeof(int), | 1405 | .maxlen = 6*sizeof(int), |
1379 | .mode = 0444, | 1406 | .mode = 0444, |
1380 | .proc_handler = proc_dointvec, | 1407 | .proc_handler = proc_nr_dentry, |
1381 | }, | 1408 | }, |
1382 | { | 1409 | { |
1383 | .procname = "overflowuid", | 1410 | .procname = "overflowuid", |
@@ -1480,16 +1507,12 @@ static struct ctl_table fs_table[] = { | |||
1480 | .proc_handler = &pipe_proc_fn, | 1507 | .proc_handler = &pipe_proc_fn, |
1481 | .extra1 = &pipe_min_size, | 1508 | .extra1 = &pipe_min_size, |
1482 | }, | 1509 | }, |
1483 | /* | ||
1484 | * NOTE: do not add new entries to this table unless you have read | ||
1485 | * Documentation/sysctl/ctl_unnumbered.txt | ||
1486 | */ | ||
1487 | { } | 1510 | { } |
1488 | }; | 1511 | }; |
1489 | 1512 | ||
1490 | static struct ctl_table debug_table[] = { | 1513 | static struct ctl_table debug_table[] = { |
1491 | #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \ | 1514 | #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \ |
1492 | defined(CONFIG_S390) | 1515 | defined(CONFIG_S390) || defined(CONFIG_TILE) |
1493 | { | 1516 | { |
1494 | .procname = "exception-trace", | 1517 | .procname = "exception-trace", |
1495 | .data = &show_unhandled_signals, | 1518 | .data = &show_unhandled_signals, |
@@ -1567,11 +1590,16 @@ void sysctl_head_get(struct ctl_table_header *head) | |||
1567 | spin_unlock(&sysctl_lock); | 1590 | spin_unlock(&sysctl_lock); |
1568 | } | 1591 | } |
1569 | 1592 | ||
1593 | static void free_head(struct rcu_head *rcu) | ||
1594 | { | ||
1595 | kfree(container_of(rcu, struct ctl_table_header, rcu)); | ||
1596 | } | ||
1597 | |||
1570 | void sysctl_head_put(struct ctl_table_header *head) | 1598 | void sysctl_head_put(struct ctl_table_header *head) |
1571 | { | 1599 | { |
1572 | spin_lock(&sysctl_lock); | 1600 | spin_lock(&sysctl_lock); |
1573 | if (!--head->count) | 1601 | if (!--head->count) |
1574 | kfree(head); | 1602 | call_rcu(&head->rcu, free_head); |
1575 | spin_unlock(&sysctl_lock); | 1603 | spin_unlock(&sysctl_lock); |
1576 | } | 1604 | } |
1577 | 1605 | ||
@@ -1685,13 +1713,8 @@ static int test_perm(int mode, int op) | |||
1685 | 1713 | ||
1686 | int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op) | 1714 | int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op) |
1687 | { | 1715 | { |
1688 | int error; | ||
1689 | int mode; | 1716 | int mode; |
1690 | 1717 | ||
1691 | error = security_sysctl(table, op & (MAY_READ | MAY_WRITE | MAY_EXEC)); | ||
1692 | if (error) | ||
1693 | return error; | ||
1694 | |||
1695 | if (root->permissions) | 1718 | if (root->permissions) |
1696 | mode = root->permissions(root, current->nsproxy, table); | 1719 | mode = root->permissions(root, current->nsproxy, table); |
1697 | else | 1720 | else |
@@ -1948,10 +1971,10 @@ void unregister_sysctl_table(struct ctl_table_header * header) | |||
1948 | start_unregistering(header); | 1971 | start_unregistering(header); |
1949 | if (!--header->parent->count) { | 1972 | if (!--header->parent->count) { |
1950 | WARN_ON(1); | 1973 | WARN_ON(1); |
1951 | kfree(header->parent); | 1974 | call_rcu(&header->parent->rcu, free_head); |
1952 | } | 1975 | } |
1953 | if (!--header->count) | 1976 | if (!--header->count) |
1954 | kfree(header); | 1977 | call_rcu(&header->rcu, free_head); |
1955 | spin_unlock(&sysctl_lock); | 1978 | spin_unlock(&sysctl_lock); |
1956 | } | 1979 | } |
1957 | 1980 | ||
@@ -2392,6 +2415,17 @@ static int proc_taint(struct ctl_table *table, int write, | |||
2392 | return err; | 2415 | return err; |
2393 | } | 2416 | } |
2394 | 2417 | ||
2418 | #ifdef CONFIG_PRINTK | ||
2419 | static int proc_dmesg_restrict(struct ctl_table *table, int write, | ||
2420 | void __user *buffer, size_t *lenp, loff_t *ppos) | ||
2421 | { | ||
2422 | if (write && !capable(CAP_SYS_ADMIN)) | ||
2423 | return -EPERM; | ||
2424 | |||
2425 | return proc_dointvec_minmax(table, write, buffer, lenp, ppos); | ||
2426 | } | ||
2427 | #endif | ||
2428 | |||
2395 | struct do_proc_dointvec_minmax_conv_param { | 2429 | struct do_proc_dointvec_minmax_conv_param { |
2396 | int *min; | 2430 | int *min; |
2397 | int *max; | 2431 | int *max; |
@@ -2893,7 +2927,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, | |||
2893 | } | 2927 | } |
2894 | } | 2928 | } |
2895 | 2929 | ||
2896 | #else /* CONFIG_PROC_FS */ | 2930 | #else /* CONFIG_PROC_SYSCTL */ |
2897 | 2931 | ||
2898 | int proc_dostring(struct ctl_table *table, int write, | 2932 | int proc_dostring(struct ctl_table *table, int write, |
2899 | void __user *buffer, size_t *lenp, loff_t *ppos) | 2933 | void __user *buffer, size_t *lenp, loff_t *ppos) |
@@ -2945,7 +2979,7 @@ int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, | |||
2945 | } | 2979 | } |
2946 | 2980 | ||
2947 | 2981 | ||
2948 | #endif /* CONFIG_PROC_FS */ | 2982 | #endif /* CONFIG_PROC_SYSCTL */ |
2949 | 2983 | ||
2950 | /* | 2984 | /* |
2951 | * No sense putting this after each symbol definition, twice, | 2985 | * No sense putting this after each symbol definition, twice, |