Skip to contentSkip to conversation

LSM: Ignore "security=" when "lsm=" is specified

PATCH In review Kees Cook 6 participants 8 messages Feb 12, 2019 – Feb 25, 2019

Subsystems (3)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH v2 1/1 LSM: Ignore "security=" when "lsm=" is specified

To avoid potential confusion, explicitly ignore "security=" when "lsm=" is used on the command line, and report that it is happening.

---
 Documentation/admin-guide/kernel-parameters.txt | 10 ++++------
 security/security.c                             |  8 ++++++--
 2 files changed, 10 insertions(+), 8 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +4 -6
index 93d2c97f28fe..a0abd5f56e00 100644
@@ -2340,7 +2340,7 @@
 
 	lsm=lsm1,...,lsmN
 			[SECURITY] Choose order of LSM initialization. This
-			overrides CONFIG_LSM.
+			overrides CONFIG_LSM, and the "security=" parameter.
 
 	machvec=	[IA-64] Force the use of a particular machine-vector
 			(machvec) in a generic kernel.
@@ -4129,11 +4129,9 @@
 			Note: increases power consumption, thus should only be
 			enabled if running jitter sensitive (HPC/RT) workloads.
 
-	security=	[SECURITY] Choose a security module to enable at boot.
-			If this boot parameter is not specified, only the first
-			security module asking for security registration will be
-			loaded. An invalid security module name will be treated
-			as if no module has been chosen.
+	security=	[SECURITY] Choose a legacy "major" security module to
+			enable at boot. This has been deprecated by the
+			"lsm=" parameter.
 
 	selinux=	[SELINUX] Disable or enable SELinux at boot time.
 			Format: { "0" | "1" }
security/security.c +6 -2
index 3147785e20d7..23cbb1a295a3 100644
@@ -288,9 +288,13 @@ static void __init ordered_lsm_init(void)
 	ordered_lsms = kcalloc(LSM_COUNT + 1, sizeof(*ordered_lsms),
 				GFP_KERNEL);
 
-	if (chosen_lsm_order)
+	if (chosen_lsm_order) {
+		if (chosen_major_lsm) {
+			pr_info("security= is ignored because it is superseded by lsm=\n");
+			chosen_major_lsm = NULL;
+		}
 		ordered_lsm_parse(chosen_lsm_order, "cmdline");
-	else
+	} else
 		ordered_lsm_parse(builtin_lsm_order, "builtin");
 
 	for (lsm = ordered_lsms; *lsm; lsm++)
Signature · 5 lines
2.17.1


-- 
Kees Cook
Acked-by on v2 1/1
#1 lore raw
Quoted 5 lines · Kees Cook

To avoid potential confusion, explicitly ignore "security=" when "lsm=" is used on the command line, and report that it is happening.

Quoted 53 lines
---
 Documentation/admin-guide/kernel-parameters.txt | 10 ++++------
 security/security.c                             |  8 ++++++--
 2 files changed, 10 insertions(+), 8 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +4 -6
index 93d2c97f28fe..a0abd5f56e00 100644
@@ -2340,7 +2340,7 @@
 
 	lsm=lsm1,...,lsmN
 			[SECURITY] Choose order of LSM initialization. This
-			overrides CONFIG_LSM.
+			overrides CONFIG_LSM, and the "security=" parameter.
 
 	machvec=	[IA-64] Force the use of a particular machine-vector
 			(machvec) in a generic kernel.
@@ -4129,11 +4129,9 @@
 			Note: increases power consumption, thus should only be
 			enabled if running jitter sensitive (HPC/RT) workloads.
 
-	security=	[SECURITY] Choose a security module to enable at boot.
-			If this boot parameter is not specified, only the first
-			security module asking for security registration will be
-			loaded. An invalid security module name will be treated
-			as if no module has been chosen.
+	security=	[SECURITY] Choose a legacy "major" security module to
+			enable at boot. This has been deprecated by the
+			"lsm=" parameter.
 
 	selinux=	[SELINUX] Disable or enable SELinux at boot time.
 			Format: { "0" | "1" }
security/security.c +6 -2
index 3147785e20d7..23cbb1a295a3 100644
@@ -288,9 +288,13 @@ static void __init ordered_lsm_init(void)
 	ordered_lsms = kcalloc(LSM_COUNT + 1, sizeof(*ordered_lsms),
 				GFP_KERNEL);
 
-	if (chosen_lsm_order)
+	if (chosen_lsm_order) {
+		if (chosen_major_lsm) {
+			pr_info("security= is ignored because it is superseded by lsm=\n");
+			chosen_major_lsm = NULL;
+		}
 		ordered_lsm_parse(chosen_lsm_order, "cmdline");
-	else
+	} else
 		ordered_lsm_parse(builtin_lsm_order, "builtin");
 
 	for (lsm = ordered_lsms; *lsm; lsm++)
maintainer
#3 lore raw
Quoted 5 lines · Tetsuo Handa
Quoted 4 lines · Casey Schaufler
Quoted 3 lines · Kees Cook

To avoid potential confusion, explicitly ignore "security=" when "lsm=" is used on the command line, and report that it is happening.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

The manual for TOMOYO was updated to follow this change. SELinux folks and AppArmor folks, can we apply this change?

My main concern is that "selinux={0|1}" continues to work as it has for years. It doesn't look like this affects that, but I can't say I've dug into these changes very far.

Signature · 2 lines
paul moore
www.paul-moore.com
author
#4 lore raw
Quoted 3 lines · Paul Moore

My main concern is that "selinux={0|1}" continues to work as it has for years. It doesn't look like this affects that, but I can't say I've dug into these changes very far.

Yup, no worries; it does. :)

Signature · 1 line
Kees Cook
#5 lore raw
In reply to Tetsuo Handa
Quoted 5 lines · Tetsuo Handa
Quoted 4 lines · Casey Schaufler
Quoted 3 lines · Kees Cook

To avoid potential confusion, explicitly ignore "security=" when "lsm=" is used on the command line, and report that it is happening.

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

The manual for TOMOYO was updated to follow this change. SELinux folks and AppArmor folks, can we apply this change?

No response from Ubuntu kernel team. Redirecting to AppArmor list...

Acked-by
#6 lore raw
Quoted 9 lines · Tetsuo Handa
Quoted 8 lines · Tetsuo Handa
Quoted 7 lines · Casey Schaufler
Quoted 5 lines · Kees Cook

To avoid potential confusion, explicitly ignore "security=" when "lsm=" is used on the command line, and report that it is happening.

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

The manual for TOMOYO was updated to follow this change. SELinux folks and AppArmor folks, can we apply this change?

No response from Ubuntu kernel team. Redirecting to AppArmor list...

yeah this is okay