@@ -90,11 +90,13 @@ int __init security_init(void)
pr_info("LSM: file blob size = %d\n", blob_sizes.lbs_file);
pr_info("LSM: inode blob size = %d\n", blob_sizes.lbs_inode);
pr_info("LSM: ipc blob size = %d\n", blob_sizes.lbs_ipc);
+#ifdef CONFIG_KEYS
pr_info("LSM: key blob size = %d\n", blob_sizes.lbs_key);
+#endif /* CONFIG_KEYS */
pr_info("LSM: msg_msg blob size = %d\n", blob_sizes.lbs_msg_msg);
pr_info("LSM: sock blob size = %d\n", blob_sizes.lbs_sock);
pr_info("LSM: superblock blob size = %d\n", blob_sizes.lbs_superblock);
-#endif
+#endif /* CONFIG_SECURITY_STACKING_DEBUG */
return 0;
}
@@ -316,6 +318,7 @@ int lsm_ipc_alloc(struct kern_ipc_perm *kip)
return 0;
}
+#ifdef CONFIG_KEYS
/**
* lsm_key_alloc - allocate a composite key blob
* @key: the key that needs a blob
@@ -340,6 +343,7 @@ int lsm_key_alloc(struct key *key)
return -ENOMEM;
return 0;
}
+#endif /* CONFIG_KEYS */
/**
* lsm_msg_msg_alloc - allocate a composite msg_msg blob
@@ -5867,7 +5867,9 @@ struct lsm_blob_sizes selinux_blob_sizes = {
.lbs_file = sizeof(struct file_security_struct),
.lbs_inode = sizeof(struct inode_security_struct),
.lbs_ipc = sizeof(struct ipc_security_struct),
+#ifdef CONFIG_KEYS
.lbs_key = sizeof(struct key_security_struct),
+#endif /* CONFIG_KEYS */
.lbs_msg_msg = sizeof(struct msg_security_struct),
.lbs_sock = sizeof(struct sk_security_struct),
.lbs_superblock = sizeof(struct superblock_security_struct),
@@ -188,6 +188,7 @@ static inline struct ipc_security_struct *selinux_ipc(
#endif
}
+#ifdef CONFIG_KEYS
static inline struct key_security_struct *selinux_key(const struct key *key)
{
#ifdef CONFIG_SECURITY_STACKING
@@ -196,6 +197,7 @@ static inline struct key_security_struct *selinux_key(const struct key *key)
return key->security;
#endif
}
+#endif /* CONFIG_KEYS */
static inline struct sk_security_struct *selinux_sock(const struct sock *sock)
{
@@ -405,6 +405,7 @@ static inline struct smack_known **smack_ipc(const struct kern_ipc_perm *ipc)
#endif
}
+#ifdef CONFIG_KEYS
static inline struct smack_known **smack_key(const struct key *key)
{
#ifdef CONFIG_SECURITY_STACKING
@@ -413,6 +414,7 @@ static inline struct smack_known **smack_key(const struct key *key)
return key->security;
#endif
}
+#endif /* CONFIG_KEYS */
/*
* Is the directory transmuting?
@@ -4444,7 +4444,9 @@ struct lsm_blob_sizes smack_blob_sizes = {
.lbs_file = sizeof(struct smack_known *),
.lbs_inode = sizeof(struct inode_smack),
.lbs_ipc = sizeof(struct smack_known *),
+#ifdef CONFIG_KEYS
.lbs_key = sizeof(struct smack_known *),
+#endif /* CONFIG_KEYS */
.lbs_msg_msg = sizeof(struct smack_known *),
.lbs_sock = sizeof(struct socket_smack),
.lbs_superblock = sizeof(struct superblock_smack),
Subject: [PATCH 22/25] LSM: Put new key blob code under ifdef A repair for the preceeding patch, where the new key related code was not properly ifdefed. Signed-off-by: Casey Schaufler <casey@schaufler-ca.com> --- security/security.c | 6 +++++- security/selinux/hooks.c | 2 ++ security/selinux/include/objsec.h | 2 ++ security/smack/smack.h | 2 ++ security/smack/smack_lsm.c | 2 ++ 5 files changed, 13 insertions(+), 1 deletion(-)