Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Yama: remove needless CONFIG_SECURITY_YAMA_STACKED

Now that minor LSMs can cleanly stack with major LSMs, remove the unneeded
config for Yama to be made to explicitly stack. Just selecting the main
Yama CONFIG will allow it to work, regardless of the major LSM. Since
distros using Yama are already forcing it to stack, this is effectively
a no-op change.

Additionally add MAINTAINERS entry.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: James Morris <james.l.morris@oracle.com>

authored by

Kees Cook and committed by
James Morris
730daa16 fe6c59dc

+28 -52
+4 -6
Documentation/security/Yama.txt
··· 1 - Yama is a Linux Security Module that collects a number of system-wide DAC 2 - security protections that are not handled by the core kernel itself. To 3 - select it at boot time, specify "security=yama" (though this will disable 4 - any other LSM). 5 - 6 - Yama is controlled through sysctl in /proc/sys/kernel/yama: 1 + Yama is a Linux Security Module that collects system-wide DAC security 2 + protections that are not handled by the core kernel itself. This is 3 + selectable at build-time with CONFIG_SECURITY_YAMA, and can be controlled 4 + at run-time through sysctls in /proc/sys/kernel/yama: 7 5 8 6 - ptrace_scope 9 7
+6
MAINTAINERS
··· 9102 9102 S: Supported 9103 9103 F: security/apparmor/ 9104 9104 9105 + YAMA SECURITY MODULE 9106 + M: Kees Cook <keescook@chromium.org> 9107 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git yama/tip 9108 + S: Supported 9109 + F: security/yama/ 9110 + 9105 9111 SENSABLE PHANTOM 9106 9112 M: Jiri Slaby <jirislaby@gmail.com> 9107 9113 S: Maintained
-1
arch/mips/configs/pistachio_defconfig
··· 320 320 CONFIG_SECURITY=y 321 321 CONFIG_SECURITY_NETWORK=y 322 322 CONFIG_SECURITY_YAMA=y 323 - CONFIG_SECURITY_YAMA_STACKED=y 324 323 CONFIG_DEFAULT_SECURITY_DAC=y 325 324 CONFIG_CRYPTO_AUTHENC=y 326 325 CONFIG_CRYPTO_HMAC=y
+4 -2
include/linux/lsm_hooks.h
··· 1881 1881 1882 1882 extern int __init security_module_enable(const char *module); 1883 1883 extern void __init capability_add_hooks(void); 1884 - #ifdef CONFIG_SECURITY_YAMA_STACKED 1885 - void __init yama_add_hooks(void); 1884 + #ifdef CONFIG_SECURITY_YAMA 1885 + extern void __init yama_add_hooks(void); 1886 + #else 1887 + static inline void __init yama_add_hooks(void) { } 1886 1888 #endif 1887 1889 1888 1890 #endif /* ! __LINUX_LSM_HOOKS_H */
-5
security/Kconfig
··· 132 132 default DEFAULT_SECURITY_SMACK if SECURITY_SMACK 133 133 default DEFAULT_SECURITY_TOMOYO if SECURITY_TOMOYO 134 134 default DEFAULT_SECURITY_APPARMOR if SECURITY_APPARMOR 135 - default DEFAULT_SECURITY_YAMA if SECURITY_YAMA 136 135 default DEFAULT_SECURITY_DAC 137 136 138 137 help ··· 150 151 config DEFAULT_SECURITY_APPARMOR 151 152 bool "AppArmor" if SECURITY_APPARMOR=y 152 153 153 - config DEFAULT_SECURITY_YAMA 154 - bool "Yama" if SECURITY_YAMA=y 155 - 156 154 config DEFAULT_SECURITY_DAC 157 155 bool "Unix Discretionary Access Controls" 158 156 ··· 161 165 default "smack" if DEFAULT_SECURITY_SMACK 162 166 default "tomoyo" if DEFAULT_SECURITY_TOMOYO 163 167 default "apparmor" if DEFAULT_SECURITY_APPARMOR 164 - default "yama" if DEFAULT_SECURITY_YAMA 165 168 default "" if DEFAULT_SECURITY_DAC 166 169 167 170 endmenu
+3 -8
security/security.c
··· 56 56 pr_info("Security Framework initialized\n"); 57 57 58 58 /* 59 - * Always load the capability module. 59 + * Load minor LSMs, with the capability module always first. 60 60 */ 61 61 capability_add_hooks(); 62 - #ifdef CONFIG_SECURITY_YAMA_STACKED 63 - /* 64 - * If Yama is configured for stacking load it next. 65 - */ 66 62 yama_add_hooks(); 67 - #endif 63 + 68 64 /* 69 - * Load the chosen module if there is one. 70 - * This will also find yama if it is stacking 65 + * Load all the remaining security modules. 71 66 */ 72 67 do_security_initcalls(); 73 68
+1 -8
security/yama/Kconfig
··· 6 6 This selects Yama, which extends DAC support with additional 7 7 system-wide security settings beyond regular Linux discretionary 8 8 access controls. Currently available is ptrace scope restriction. 9 + Like capabilities, this security module stacks with other LSMs. 9 10 Further information can be found in Documentation/security/Yama.txt. 10 11 11 12 If you are unsure how to answer this question, answer N. 12 - 13 - config SECURITY_YAMA_STACKED 14 - bool "Yama stacked with other LSMs" 15 - depends on SECURITY_YAMA 16 - default n 17 - help 18 - When Yama is built into the kernel, force it to stack with the 19 - selected primary LSM.
+10 -22
security/yama/yama_lsm.c
··· 353 353 LSM_HOOK_INIT(task_free, yama_task_free), 354 354 }; 355 355 356 - void __init yama_add_hooks(void) 357 - { 358 - security_add_hooks(yama_hooks, ARRAY_SIZE(yama_hooks)); 359 - } 360 - 361 356 #ifdef CONFIG_SYSCTL 362 357 static int yama_dointvec_minmax(struct ctl_table *table, int write, 363 358 void __user *buffer, size_t *lenp, loff_t *ppos) ··· 391 396 }, 392 397 { } 393 398 }; 394 - #endif /* CONFIG_SYSCTL */ 395 - 396 - static __init int yama_init(void) 399 + static void __init yama_init_sysctl(void) 397 400 { 398 - #ifndef CONFIG_SECURITY_YAMA_STACKED 399 - /* 400 - * If yama is being stacked this is already taken care of. 401 - */ 402 - if (!security_module_enable("yama")) 403 - return 0; 404 - #endif 405 - pr_info("Yama: becoming mindful.\n"); 406 - 407 - #ifdef CONFIG_SYSCTL 408 401 if (!register_sysctl_paths(yama_sysctl_path, yama_sysctl_table)) 409 402 panic("Yama: sysctl registration failed.\n"); 410 - #endif 411 - 412 - return 0; 413 403 } 404 + #else 405 + static inline void yama_init_sysctl(void) { } 406 + #endif /* CONFIG_SYSCTL */ 414 407 415 - security_initcall(yama_init); 408 + void __init yama_add_hooks(void) 409 + { 410 + pr_info("Yama: becoming mindful.\n"); 411 + security_add_hooks(yama_hooks, ARRAY_SIZE(yama_hooks)); 412 + yama_init_sysctl(); 413 + }