[PATCH v34 24/29] LSM: Add a function to report multiple LSMs
Casey Schaufler
casey at schaufler-ca.com
Fri Apr 15 21:17:56 UTC 2022
Add a new boolean function lsm_multiple_contexts() to
identify when multiple security modules provide security
context strings.
Signed-off-by: Casey Schaufler <casey at schaufler-ca.com>
---
include/linux/security.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/linux/security.h b/include/linux/security.h
index 0d3931723361..52b5046c0956 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -232,6 +232,15 @@ static inline bool lsmblob_equal(const struct lsmblob *bloba,
extern int lsm_name_to_slot(char *name);
extern const char *lsm_slot_to_name(int slot);
+static inline bool lsm_multiple_contexts(void)
+{
+#ifdef CONFIG_SECURITY
+ return lsm_slot_to_name(1) != NULL;
+#else
+ return false;
+#endif
+}
+
/**
* lsmblob_value - find the first non-zero value in an lsmblob structure.
* @blob: Pointer to the data
--
2.35.1
More information about the Linux-security-module-archive
mailing list