tomoyo: revert CONFIG_SECURITY_TOMOYO_LKM support
Subsystems (2)
Paul Moore
maintainerPATCH 1/1 tomoyo: revert CONFIG_SECURITY_TOMOYO_LKM support
This patch reverts two TOMOYO patches that were merged into Linus' tree during the v6.12 merge window:
8b985bbfabbe ("tomoyo: allow building as a loadable LSM module") 268225a1de1a ("tomoyo: preparation step for building as a loadable LSM module")
Together these two patches introduced the CONFIG_SECURITY_TOMOYO_LKM Kconfig build option which enabled a TOMOYO specific dynamic LSM loading mechanism (see the original commits for more details). Unfortunately, this approach was widely rejected by the LSM community as well as some members of the general kernel community. Objections included concerns over setting a bad precedent regarding individual LSMs managing their LSM callback registrations as well as general kernel symbol exporting practices. With little to no support for the CONFIG_SECURITY_TOMOYO_LKM approach outside of Tetsuo, and multiple objections, we need to revert these changes.
---
security/tomoyo/Kconfig | 15 --
security/tomoyo/Makefile | 8 +-
security/tomoyo/common.c | 14 +-
security/tomoyo/common.h | 72 -----
security/tomoyo/gc.c | 3 -
security/tomoyo/init.c | 366 --------------------------
security/tomoyo/load_policy.c | 12 -
security/tomoyo/proxy.c | 82 ------
security/tomoyo/securityfs_if.c | 10 +-
security/tomoyo/{hooks.h => tomoyo.c} | 110 +++++++-
security/tomoyo/util.c | 3 +
11 files changed, 118 insertions(+), 577 deletions(-)
delete mode 100644 security/tomoyo/init.c
delete mode 100644 security/tomoyo/proxy.c
rename security/tomoyo/{hooks.h => tomoyo.c} (79%)security/tomoyo/Kconfig +0 -15
@@ -13,21 +13,6 @@ config SECURITY_TOMOYO found at <https://tomoyo.sourceforge.net/>. If you are unsure how to answer this question, answer N. -config SECURITY_TOMOYO_LKM - bool "Cut out most of TOMOYO's code to a loadable kernel module" - default n - depends on SECURITY_TOMOYO - depends on MODULES - help - Say Y here if you want to include TOMOYO without bloating - vmlinux file. If you say Y, most of TOMOYO code is cut out to - a loadable kernel module named tomoyo.ko . This option will be - useful for kernels built by Linux distributors where TOMOYO is - included but TOMOYO is not enabled by default. Please be sure - to explicitly load tomoyo.ko if you want to activate TOMOYO - without calling userspace policy loader, for tomoyo.ko is - loaded immediately before calling userspace policy loader. - config SECURITY_TOMOYO_MAX_ACCEPT_ENTRY int "Default maximal count for learning mode" default 2048
security/tomoyo/Makefile +1 -7
@@ -1,11 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -tomoyo-objs := audit.o common.o condition.o domain.o environ.o file.o gc.o group.o memory.o mount.o network.o proxy.o realpath.o securityfs_if.o util.o -obj-y += init.o load_policy.o -ifdef CONFIG_SECURITY_TOMOYO_LKM -obj-m += tomoyo.o -else -obj-y += tomoyo.o -endif +obj-y = audit.o common.o condition.o domain.o environ.o file.o gc.o group.o load_policy.o memory.o mount.o network.o realpath.o securityfs_if.o tomoyo.o util.o targets += builtin-policy.h
security/tomoyo/common.c +2 -12
@@ -998,13 +998,8 @@ static bool tomoyo_select_domain(struct tomoyo_io_buffer *head, p =find_task_by_pid_ns (pid, &init_pid_ns); else p =find_task_by_vpid (pid); -if (p) { +if (p) domain =tomoyo_task (p)->domain_info; -#ifdef CONFIG_SECURITY_TOMOYO_LKM -if (!domain) - domain = &tomoyo_kernel_domain; -#endif - }rcu_read_unlock (); }else if (!strncmp (data,"domain=" ,7 )) {if (tomoyo_domain_def (data +7 ))
@@ -1715,13 +1710,8 @@ static void tomoyo_read_pid(struct tomoyo_io_buffer *head) p =find_task_by_pid_ns (pid, &init_pid_ns); else p =find_task_by_vpid (pid); -if (p) { +if (p) domain =tomoyo_task (p)->domain_info; -#ifdef CONFIG_SECURITY_TOMOYO_LKM -if (!domain) - domain = &tomoyo_kernel_domain; -#endif - }rcu_read_unlock ();if (!domain)return ;
security/tomoyo/common.h +0 -72
92 lines not on this page · raw message
security/tomoyo/gc.c +0 -3
@@ -9,9 +9,6 @@#include <linux/kthread.h> #include <linux/slab.h> -/* Lock for GC. */ -DEFINE_SRCU (tomoyo_ss); -/** * tomoyo_memory_free - Free memory for elements. *
security/tomoyo/init.c deleted +0 -366
366 lines not on this page · raw message
security/tomoyo/load_policy.c +0 -12
@@ -97,14 +97,6 @@ void tomoyo_load_policy(const char *filename)if (!tomoyo_policy_loader_exists ())return ; done = true; -#ifdef CONFIG_SECURITY_TOMOYO_LKM -/* Load tomoyo.ko if not yet loaded. */ -if (!tomoyo_ops.check_profile) -request_module ("tomoyo" ); -/* Check if tomoyo.ko was successfully loaded. */ -if (!tomoyo_ops.check_profile) -panic ("Failed to load tomoyo module." ); -#endif pr_info ("Calling %s to load policy. Please wait.\n" , tomoyo_loader); argv[0 ] = (char *) tomoyo_loader; argv[1 ] =NULL ;
@@ -112,11 +104,7 @@ void tomoyo_load_policy(const char *filename) envp[1 ] ="PATH=/sbin:/bin:/usr/sbin:/usr/bin" ; envp[2 ] =NULL ;call_usermodehelper (argv[0 ], argv, envp,UMH_WAIT_PROC ); -#ifdef CONFIG_SECURITY_TOMOYO_LKM - tomoyo_ops.check_profile (); -#else tomoyo_check_profile(); -#endif }#endif
security/tomoyo/proxy.c deleted +0 -82
82 lines not on this page · raw message
security/tomoyo/securityfs_if.c +3 -7
@@ -229,19 +229,17 @@ static void __init tomoyo_create_entry(const char *name, const umode_t mode, }/** -* tomoyo_interface_init - Initialize /sys/kernel/security/tomoyo/ interface. +* tomoyo_initerface_init - Initialize /sys/kernel/security/tomoyo/ interface. * * Returns 0. */ -int __init tomoyo_interface_init (void ) +static int __init tomoyo_initerface_init (void ) {struct tomoyo_domain_info *domain;struct dentry *tomoyo_dir; -#ifndef CONFIG_SECURITY_TOMOYO_LKM if (!tomoyo_enabled)return 0 ; -#endif domain =tomoyo_domain ();/* Don't create securityfs entries unless registered. */ if (domain != &tomoyo_kernel_domain)
@@ -272,6 +270,4 @@ int __init tomoyo_interface_init(void)return 0 ; } -#ifndef CONFIG_SECURITY_TOMOYO_LKM -fs_initcall (tomoyo_interface_init); -#endif +fs_initcall (tomoyo_initerface_init);
security/tomoyo/tomoyo.c renamed from security/tomoyo/hooks.h +109 -1
140 lines not on this page · raw message
security/tomoyo/util.c +3 -0
@@ -13,6 +13,9 @@/* Lock for protecting policy. */ DEFINE_MUTEX (tomoyo_policy_lock); +/* Has /sbin/init started? */ +bool tomoyo_policy_loaded; +/* * Mapping table from "enum tomoyo_mac_index" to * "enum tomoyo_mac_category_index".
Signature · 1 line
2.46.2
Paul Moore
maintainerQuoted 22 lines · Paul Moore
This patch reverts two TOMOYO patches that were merged into Linus' tree during the v6.12 merge window:
8b985bbfabbe("tomoyo: allow building as a loadable LSM module")268225a1de1a("tomoyo: preparation step for building as a loadable LSM module")Together these two patches introduced the
CONFIG_SECURITY_TOMOYO_LKMKconfigbuild option which enabled a TOMOYO specific dynamic LSM loading mechanism (see the original commits for more details). Unfortunately, this approach was widely rejected by the LSM community as well as some members of the general kernel community. Objections included concerns over setting a bad precedent regarding individual LSMs managing their LSM callback registrations as well as general kernel symbol exporting practices. With little to no support for theCONFIG_SECURITY_TOMOYO_LKMapproach outside of Tetsuo, and multiple objections, we need to revert these changes.
Quoted 16 lines
---
security/tomoyo/Kconfig | 15 --
security/tomoyo/Makefile | 8 +-
security/tomoyo/common.c | 14 +-
security/tomoyo/common.h | 72 -----
security/tomoyo/gc.c | 3 -
security/tomoyo/init.c | 366 --------------------------
security/tomoyo/load_policy.c | 12 -
security/tomoyo/proxy.c | 82 ------
security/tomoyo/securityfs_if.c | 10 +-
security/tomoyo/{hooks.h => tomoyo.c} | 110 +++++++-
security/tomoyo/util.c | 3 +
11 files changed, 118 insertions(+), 577 deletions(-)
delete mode 100644 security/tomoyo/init.c
delete mode 100644 security/tomoyo/proxy.c
rename security/tomoyo/{hooks.h => tomoyo.c} (79%)As promised, I'm going to wait until Friday (US time) to send this off to Linus in case there are any additional objections to this revert, but based on the conversation thus far it appears that support for reverting CONFIG_SECURITY_TOMOYO_LKM is high.
John, I added your ACK from the earlier thread, if you would like it removed please let me know.
If anyone else wants to add their ACK, Reviewed-by, etc. please let me know soon; I'd like to send this up to Linus in time for v6.12-rc2.
Signature · 1 line
paul-moore.com
Quoted 45 lines · Paul Moore
Quoted 22 lines · Paul Moore
This patch reverts two TOMOYO patches that were merged into Linus' tree during the v6.12 merge window:
8b985bbfabbe("tomoyo: allow building as a loadable LSM module")268225a1de1a("tomoyo: preparation step for building as a loadable LSM module")Together these two patches introduced the
CONFIG_SECURITY_TOMOYO_LKMKconfigbuild option which enabled a TOMOYO specific dynamic LSM loading mechanism (see the original commits for more details). Unfortunately, this approach was widely rejected by the LSM community as well as some members of the general kernel community. Objections included concerns over setting a bad precedent regarding individual LSMs managing their LSM callback registrations as well as general kernel symbol exporting practices. With little to no support for theCONFIG_SECURITY_TOMOYO_LKMapproach outside of Tetsuo, and multiple objections, we need to revert these changes.Quoted 16 lines
--- security/tomoyo/Kconfig | 15 -- security/tomoyo/Makefile | 8 +- security/tomoyo/common.c | 14 +- security/tomoyo/common.h | 72 ----- security/tomoyo/gc.c | 3 - security/tomoyo/init.c | 366 -------------------------- security/tomoyo/load_policy.c | 12 - security/tomoyo/proxy.c | 82 ------ security/tomoyo/securityfs_if.c | 10 +- security/tomoyo/{hooks.h => tomoyo.c} | 110 +++++++- security/tomoyo/util.c | 3 + 11 files changed, 118 insertions(+), 577 deletions(-) delete mode 100644 security/tomoyo/init.c delete mode 100644 security/tomoyo/proxy.c rename security/tomoyo/{hooks.h => tomoyo.c} (79%)As promised, I'm going to wait until Friday (US time) to send this off to Linus in case there are any additional objections to this revert, but based on the conversation thus far it appears that support for reverting
CONFIG_SECURITY_TOMOYO_LKMis high.
Quoted 5 lines
John, I added your ACK from the earlier thread, if you would like it removed please let me know.
If anyone else wants to add their ACK, Reviewed-by, etc. please let me know soon; I'd like to send this up to Linus in time for v6.12-rc2.
Merged into lsm/stable-6.12, I'll be sending this up to Linus soon.
Signature · 1 line
paul-moore.com