Skip to content

Commit 89a9684

Browse files
keesJames Morris
authored andcommitted
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. Suggested-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp> Signed-off-by: Kees Cook <keescook@chromium.org> Acked-by: Casey Schaufler <casey@schaufler-ca.com> Acked-by: John Johansen <john.johansen@canonical.com> Signed-off-by: James Morris <james.morris@microsoft.com>
1 parent e88ed48 commit 89a9684

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,7 +2321,7 @@
23212321

23222322
lsm=lsm1,...,lsmN
23232323
[SECURITY] Choose order of LSM initialization. This
2324-
overrides CONFIG_LSM.
2324+
overrides CONFIG_LSM, and the "security=" parameter.
23252325

23262326
machvec= [IA-64] Force the use of a particular machine-vector
23272327
(machvec) in a generic kernel.
@@ -4094,11 +4094,9 @@
40944094
Note: increases power consumption, thus should only be
40954095
enabled if running jitter sensitive (HPC/RT) workloads.
40964096

4097-
security= [SECURITY] Choose a security module to enable at boot.
4098-
If this boot parameter is not specified, only the first
4099-
security module asking for security registration will be
4100-
loaded. An invalid security module name will be treated
4101-
as if no module has been chosen.
4097+
security= [SECURITY] Choose a legacy "major" security module to
4098+
enable at boot. This has been deprecated by the
4099+
"lsm=" parameter.
41024100

41034101
selinux= [SELINUX] Disable or enable SELinux at boot time.
41044102
Format: { "0" | "1" }

security/security.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,13 @@ static void __init ordered_lsm_init(void)
288288
ordered_lsms = kcalloc(LSM_COUNT + 1, sizeof(*ordered_lsms),
289289
GFP_KERNEL);
290290

291-
if (chosen_lsm_order)
291+
if (chosen_lsm_order) {
292+
if (chosen_major_lsm) {
293+
pr_info("security= is ignored because it is superseded by lsm=\n");
294+
chosen_major_lsm = NULL;
295+
}
292296
ordered_lsm_parse(chosen_lsm_order, "cmdline");
293-
else
297+
} else
294298
ordered_lsm_parse(builtin_lsm_order, "builtin");
295299

296300
for (lsm = ordered_lsms; *lsm; lsm++)

0 commit comments

Comments
 (0)