aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--init/Kconfig11
-rw-r--r--kernel/Makefile2
-rw-r--r--kernel/sysctl.c10
3 files changed, 20 insertions, 3 deletions
diff --git a/init/Kconfig b/init/Kconfig
index 98fa96eac415..3e7b257fc05f 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -550,6 +550,17 @@ config SYSCTL_SYSCALL
550 550
551 If unsure say Y here. 551 If unsure say Y here.
552 552
553config SYSCTL_SYSCALL_CHECK
554 bool "Sysctl checks" if EMBEDDED
555 depends on SYSCTL_SYSCALL
556 default y
557 ---help---
558 sys_sysctl uses binary paths that have been found challenging
559 to properly maintain and use. This enables checks that help
560 you to keep things correct.
561
562 If unsure say Y here.
563
553config KALLSYMS 564config KALLSYMS
554 bool "Load all symbols for debugging/ksymoops" if EMBEDDED 565 bool "Load all symbols for debugging/ksymoops" if EMBEDDED
555 default y 566 default y
diff --git a/kernel/Makefile b/kernel/Makefile
index 6c5f081132a4..188c43223f52 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -11,7 +11,7 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o profile.o \
11 hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \ 11 hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \
12 notifier.o ksysfs.o pm_qos_params.o 12 notifier.o ksysfs.o pm_qos_params.o
13 13
14obj-$(CONFIG_SYSCTL) += sysctl_check.o 14obj-$(CONFIG_SYSCTL_SYSCALL_CHECK) += sysctl_check.o
15obj-$(CONFIG_STACKTRACE) += stacktrace.o 15obj-$(CONFIG_STACKTRACE) += stacktrace.o
16obj-y += time/ 16obj-y += time/
17obj-$(CONFIG_DEBUG_MUTEXES) += mutex-debug.o 17obj-$(CONFIG_DEBUG_MUTEXES) += mutex-debug.o
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 0a1d2733cf41..1cdfe942d160 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1592,9 +1592,13 @@ static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1592 1592
1593static __init int sysctl_init(void) 1593static __init int sysctl_init(void)
1594{ 1594{
1595 int err;
1596 sysctl_set_parent(NULL, root_table); 1595 sysctl_set_parent(NULL, root_table);
1597 err = sysctl_check_table(current->nsproxy, root_table); 1596#ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1597 {
1598 int err;
1599 err = sysctl_check_table(current->nsproxy, root_table);
1600 }
1601#endif
1598 return 0; 1602 return 0;
1599} 1603}
1600 1604
@@ -1721,10 +1725,12 @@ struct ctl_table_header *__register_sysctl_paths(
1721 header->unregistering = NULL; 1725 header->unregistering = NULL;
1722 header->root = root; 1726 header->root = root;
1723 sysctl_set_parent(NULL, header->ctl_table); 1727 sysctl_set_parent(NULL, header->ctl_table);
1728#ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1724 if (sysctl_check_table(namespaces, header->ctl_table)) { 1729 if (sysctl_check_table(namespaces, header->ctl_table)) {
1725 kfree(header); 1730 kfree(header);
1726 return NULL; 1731 return NULL;
1727 } 1732 }
1733#endif
1728 spin_lock(&sysctl_lock); 1734 spin_lock(&sysctl_lock);
1729 header_list = lookup_header_list(root, namespaces); 1735 header_list = lookup_header_list(root, namespaces);
1730 list_add_tail(&header->ctl_entry, header_list); 1736 list_add_tail(&header->ctl_entry, header_list);