lkml.org 
[lkml]   [2022]   [Jun]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v36 25/33] LSM: Add a function to report multiple LSMs
Date
Add a new boolean function lsm_multiple_contexts() to
identify when multiple security modules provide security
context strings.

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Reviewed-by: John Johansen <john.johansen@canonical.com>
---
include/linux/security.h | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/include/linux/security.h b/include/linux/security.h
index 1efd34a8f75f..4cf551133e99 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -234,6 +234,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
\
 
 \ /
  Last update: 2022-06-10 01:16    [W:0.220 / U:1.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site