Skip to content

Commit ac3c47c

Browse files
committed
lsm: output available LSMs when debugging
This will display all of the LSMs built into the kernel, regardless of if they are enabled or not. Reviewed-by: Casey Schaufler <casey@schaufler-ca.com> Reviewed-by: John Johansen <john.johhansen@canonical.com> Reviewed-by: Mimi Zohar <zohar@linux.ibm.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 5137e58 commit ac3c47c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

security/lsm_init.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,8 @@ int __init early_security_init(void)
363363
{
364364
struct lsm_info *lsm;
365365

366+
/* NOTE: lsm_pr_dbg() doesn't work here as lsm_debug is not yet set */
367+
366368
lsm_early_for_each_raw(lsm) {
367369
lsm_enabled_set(lsm, true);
368370
lsm_order_append(lsm, "early");
@@ -385,9 +387,24 @@ int __init security_init(void)
385387
struct lsm_info **lsm;
386388

387389
if (lsm_debug) {
388-
lsm_pr("built-in LSM list: %s\n", lsm_order_builtin);
390+
struct lsm_info *i;
391+
392+
cnt = 0;
393+
lsm_pr("available LSMs: ");
394+
lsm_early_for_each_raw(i)
395+
lsm_pr_cont("%s%s(E)", (cnt++ ? "," : ""), i->id->name);
396+
lsm_for_each_raw(i)
397+
lsm_pr_cont("%s%s", (cnt++ ? "," : ""), i->id->name);
398+
lsm_pr_cont("\n");
399+
400+
lsm_pr("built-in LSM config: %s\n", lsm_order_builtin);
401+
389402
lsm_pr("legacy LSM parameter: %s\n", lsm_order_legacy);
390403
lsm_pr("boot LSM parameter: %s\n", lsm_order_cmdline);
404+
405+
/* see the note about lsm_pr_dbg() in early_security_init() */
406+
lsm_early_for_each_raw(i)
407+
lsm_pr("enabled LSM early:%s\n", i->id->name);
391408
}
392409

393410
if (lsm_order_cmdline) {

0 commit comments

Comments
 (0)