aboutsummaryrefslogtreecommitdiff
path: root/security/selinux/include/objsec.h
diff options
context:
space:
mode:
authorCasey Schaufler <casey@schaufler-ca.com>2024-07-10 14:32:26 -0700
committerPaul Moore <paul@paul-moore.com>2024-07-29 16:54:51 -0400
commit5f8d28f6d7d568dbbc8c5bce94894474c07afd4f (patch)
treeb2fbd3be03b83a6d68059a43d09964b5ac73a00e /security/selinux/include/objsec.h
parent2aff9d20d50ac45dd13a013ef5231f4fb8912356 (diff)
lsm: infrastructure management of the key security blob
Move management of the key->security blob out of the individual security modules and into the security infrastructure. Instead of allocating the blobs from within the modules the modules tell the infrastructure how much space is required, and the space is allocated there. There are no existing modules that require a key_free hook, so the call to it and the definition for it have been removed. Signed-off-by: Casey Schaufler <casey@schaufler-ca.com> Reviewed-by: John Johansen <john.johansen@canonical.com> [PM: subject tweak] Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/selinux/include/objsec.h')
-rw-r--r--security/selinux/include/objsec.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/security/selinux/include/objsec.h b/security/selinux/include/objsec.h
index b074099acbaf..83b9443d6919 100644
--- a/security/selinux/include/objsec.h
+++ b/security/selinux/include/objsec.h
@@ -195,6 +195,13 @@ selinux_superblock(const struct super_block *superblock)
return superblock->s_security + selinux_blob_sizes.lbs_superblock;
}
+#ifdef CONFIG_KEYS
+static inline struct key_security_struct *selinux_key(const struct key *key)
+{
+ return key->security + selinux_blob_sizes.lbs_key;
+}
+#endif /* CONFIG_KEYS */
+
static inline struct sk_security_struct *selinux_sock(const struct sock *sock)
{
return sock->sk_security + selinux_blob_sizes.lbs_sock;