summaryrefslogtreecommitdiff
path: root/security/lsm.h
diff options
context:
space:
mode:
authorPaul Moore <paul@paul-moore.com>2025-02-12 18:20:01 -0500
committerPaul Moore <paul@paul-moore.com>2025-10-22 19:24:23 -0400
commit5137e583ba2635b82667dc63cb35305750420411 (patch)
tree9fc3bccd6aaef68e6bbc0508d3038c6c1b3afa1c /security/lsm.h
parent450705334f698990804b470437f3014cee979486 (diff)
lsm: cleanup the debug and console output in lsm_init.c
Move away from an init specific init_debug() macro to a more general lsm_pr()/lsm_pr_cont()/lsm_pr_dbg() set of macros that are available both before and after init. In the process we do a number of minor changes to improve the LSM initialization output and cleanup the code somewhat. Reviewed-by: Casey Schaufler <casey@schaufler-ca.com> Reviewed-by: John Johansen <john.johhansen@canonical.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/lsm.h')
-rw-r--r--security/lsm.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/security/lsm.h b/security/lsm.h
index dbe755c45e57..8dc267977ae0 100644
--- a/security/lsm.h
+++ b/security/lsm.h
@@ -6,9 +6,20 @@
#ifndef _LSM_H_
#define _LSM_H_
+#include <linux/printk.h>
#include <linux/lsm_hooks.h>
#include <linux/lsm_count.h>
+/* LSM debugging */
+extern bool lsm_debug;
+#define lsm_pr(...) pr_info(__VA_ARGS__)
+#define lsm_pr_cont(...) pr_cont(__VA_ARGS__)
+#define lsm_pr_dbg(...) \
+ do { \
+ if (lsm_debug) \
+ pr_info(__VA_ARGS__); \
+ } while (0)
+
/* List of configured LSMs */
extern unsigned int lsm_active_cnt;
extern const struct lsm_id *lsm_idlist[];