Skip to content

Commit

Permalink
LSM: Ignore "security=" when "lsm=" is specified
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kees authored and James Morris committed Feb 25, 2019
1 parent e88ed48 commit 89a9684
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 4 additions & 6 deletions Documentation/admin-guide/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2321,7 +2321,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.
Expand Down Expand Up @@ -4094,11 +4094,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" }
Expand Down
8 changes: 6 additions & 2 deletions security/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down

0 comments on commit 89a9684

Please sign in to comment.