aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2019-04-12 07:04:54 -0400
committerJames Morris <jamorris@linux.microsoft.com>2019-05-10 17:58:11 -0400
commite80b18599a39a625bc8b2e39ba3004a62f78805a (patch)
treecbac414dedf2b92c218906bbdcda5b3497bb5cac /security
parent1fb3b526df3bd7647e7854915ae6b22299408baf (diff)
tomoyo: Add a kernel config option for fuzzing testing.
syzbot is reporting kernel panic triggered by memory allocation fault injection before loading TOMOYO's policy [1]. To make the fuzzing tests useful, we need to assign a profile other than "disabled" (no-op) mode. Therefore, let's allow syzbot to load TOMOYO's built-in policy for "learning" mode using a kernel config option. This option must not be enabled for kernels built for production system, for this option also disables domain/program checks when modifying policy configuration via /sys/kernel/security/tomoyo/ interface. [1] https://syzkaller.appspot.com/bug?extid=29569ed06425fcf67a95 Reported-by: syzbot <syzbot+e1b8084e532b6ee7afab@syzkaller.appspotmail.com> Reported-by: syzbot <syzbot+29569ed06425fcf67a95@syzkaller.appspotmail.com> Reported-by: syzbot <syzbot+2ee3f8974c2e7dc69feb@syzkaller.appspotmail.com> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: James Morris <jamorris@linux.microsoft.com>
Diffstat (limited to 'security')
-rw-r--r--security/tomoyo/Kconfig10
-rw-r--r--security/tomoyo/common.c13
2 files changed, 22 insertions, 1 deletions
diff --git a/security/tomoyo/Kconfig b/security/tomoyo/Kconfig
index 404dce66952a..a00ab7eb6181 100644
--- a/security/tomoyo/Kconfig
+++ b/security/tomoyo/Kconfig
@@ -74,3 +74,13 @@ config SECURITY_TOMOYO_ACTIVATION_TRIGGER
74 You can override this setting via TOMOYO_trigger= kernel command line 74 You can override this setting via TOMOYO_trigger= kernel command line
75 option. For example, if you pass init=/bin/systemd option, you may 75 option. For example, if you pass init=/bin/systemd option, you may
76 want to also pass TOMOYO_trigger=/bin/systemd option. 76 want to also pass TOMOYO_trigger=/bin/systemd option.
77
78config SECURITY_TOMOYO_INSECURE_BUILTIN_SETTING
79 bool "Use insecure built-in settings for fuzzing tests."
80 default n
81 depends on SECURITY_TOMOYO
82 select SECURITY_TOMOYO_OMIT_USERSPACE_LOADER
83 help
84 Enabling this option forces minimal built-in policy and disables
85 domain/program checks for run-time policy modifications. Please enable
86 this option only if this kernel is built for doing fuzzing tests.
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index 57988d95d33d..dd3d5942e669 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -940,7 +940,7 @@ static bool tomoyo_manager(void)
940 const char *exe; 940 const char *exe;
941 const struct task_struct *task = current; 941 const struct task_struct *task = current;
942 const struct tomoyo_path_info *domainname = tomoyo_domain()->domainname; 942 const struct tomoyo_path_info *domainname = tomoyo_domain()->domainname;
943 bool found = false; 943 bool found = IS_ENABLED(CONFIG_SECURITY_TOMOYO_INSECURE_BUILTIN_SETTING);
944 944
945 if (!tomoyo_policy_loaded) 945 if (!tomoyo_policy_loaded)
946 return true; 946 return true;
@@ -2810,6 +2810,16 @@ void tomoyo_check_profile(void)
2810 */ 2810 */
2811void __init tomoyo_load_builtin_policy(void) 2811void __init tomoyo_load_builtin_policy(void)
2812{ 2812{
2813#ifdef CONFIG_SECURITY_TOMOYO_INSECURE_BUILTIN_SETTING
2814 static char tomoyo_builtin_profile[] __initdata =
2815 "PROFILE_VERSION=20150505\n"
2816 "0-CONFIG={ mode=learning grant_log=no reject_log=yes }\n";
2817 static char tomoyo_builtin_exception_policy[] __initdata =
2818 "aggregator proc:/self/exe /proc/self/exe\n";
2819 static char tomoyo_builtin_domain_policy[] __initdata = "";
2820 static char tomoyo_builtin_manager[] __initdata = "";
2821 static char tomoyo_builtin_stat[] __initdata = "";
2822#else
2813 /* 2823 /*
2814 * This include file is manually created and contains built-in policy 2824 * This include file is manually created and contains built-in policy
2815 * named "tomoyo_builtin_profile", "tomoyo_builtin_exception_policy", 2825 * named "tomoyo_builtin_profile", "tomoyo_builtin_exception_policy",
@@ -2817,6 +2827,7 @@ void __init tomoyo_load_builtin_policy(void)
2817 * "tomoyo_builtin_stat" in the form of "static char [] __initdata". 2827 * "tomoyo_builtin_stat" in the form of "static char [] __initdata".
2818 */ 2828 */
2819#include "builtin-policy.h" 2829#include "builtin-policy.h"
2830#endif
2820 u8 i; 2831 u8 i;
2821 const int idx = tomoyo_read_lock(); 2832 const int idx = tomoyo_read_lock();
2822 2833